Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // All operations besides "list" provide a $delta argument so we know which
- // filter they refer to. We'll switch on that argument now so that we can
- // discuss each filter in turn.
- switch ($delta) {
- // First we define the simple string substitution filter.
- case 0:
- switch ($op) {
- // This description is shown in the administrative interface, unlike the
- // filter tips which are shown in the content editing interface.
- case 'description':
- return t('Outputs a featured links block.');
- // We don't need the "prepare" operation for this filter, but it's required
- // to at least return the input text as-is.
- case 'prepare':
- return $text;
- // The actual filtering is performed here. The supplied text should be
- // returned, once any necessary substitutions have taken place.
- case 'process':
- return preg_replace_callback('(\[featured_links_block(.*)\])', 'display_featured_links_block', $text);
- // Since we allow the administrator to define the string that gets
- // substituted when "foo" is encountered, we need to provide an
- // interface for this customization. Note that the value of $format
- // needs to be provided as part of the form name, so that different
- // customization can be done for this filter in each of the different
- // input formats that may use it.
- case 'settings':
- /*$form['filter_example'] = array(
- '#type' => 'fieldset',
- '#title' => t('Foo filter'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $form['filter_example']["filter_example_foo_$format"] = array(
- '#type' => 'textfield',
- '#title' => t('Substitution string'),
- '#default_value' => variable_get("filter_example_foo_$format", 'bar'),
- '#description' => t('The string to substitute for "foo" everywhere in the text.'),
- );
- return $form;*/
- }
- break;
- }
- }
- $matches = preg_split('/[=".*"]+/', trim($matches[1]), -1, PREG_SPLIT_NO_EMPTY);
- $args = array();
- for($i = 0; $i < count($matches); $i += 2)
- $args[trim($matches[$i])] = trim($matches[$i+1]);
- return theme('movehub_featured_links_block', $args);
- }
- <div class="bp-featured-links-block">
- <h2><?php echo $title; ?></h2> <?php
- $i = 0;
- $result = db_query('SELECT * FROM movehub_featured_links_block_links');
- while($row = db_fetch_array($result)):
- if($i % 2 == 0) echo '<div class="bp-featured-links-block-row">'; ?>
- <div class="bp-featured-link-block-link-container">
- <div class="bp-featured-links-block-image-container">
- <a href="bp-featured-links-block-link">
- <div class="bp-featured-links-block-content-wrapper-cr">
- <div class="bp-featured-links-block-heading">
- <div class="bp-featured-links-block-table">
- <h3 class="bp-featured-links-block-title"><?php echo $row['title']; ?></h3>
- </div>
- </div>
- <img class="bp-featured-links-block-main-image" src="<?php echo $base_url . '/' . $row['img_url']; ?>" alt="<?php echo $row['title']; ?>">
- <div class="bp-featured-links-block-content-cr">
- <div class="bp-featured-links-block-content">
- <img class="bp-featured-links-block-hover-image" src="<?php echo $base_url . '/' . $row['hover_img_url']; ?>" alt="<?php echo $row['title']; ?>">
- </div>
- </div>
- </div>
- </a>
- </div>
- <div class="bp-featured-links-block-links-container">
- <div class="bp-featured-links-block-links">
- <div class="bp-featured-links-block-table">
- <div class="bp-featured-links-block-links-p"> <?php
- for($ii = 1; $ii <= 8; $ii++):
- if($row['sub_link_url_' . $ii] != '' && $row['sub_link_title_' . $ii] != ''): ?>
- <p><a href="<?php echo $row['sub_link_url_' . $ii]; ?>"><?php echo $row['sub_link_title_' . $ii] ?></a></p> <?php
- endif;
- endfor; ?>
- </div>
- </div>
- </div>
- </div>
- </div> <?php
- $i++;
- if($i % 2 == 0) echo '</div>'; // .bp-featured-links-block-row
- endwhile; ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement