Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. // All operations besides "list" provide a $delta argument so we know which
  2. // filter they refer to. We'll switch on that argument now so that we can
  3. // discuss each filter in turn.
  4. switch ($delta) {
  5.  
  6. // First we define the simple string substitution filter.
  7. case 0:
  8.  
  9. switch ($op) {
  10. // This description is shown in the administrative interface, unlike the
  11. // filter tips which are shown in the content editing interface.
  12. case 'description':
  13. return t('Outputs a featured links block.');
  14.  
  15. // We don't need the "prepare" operation for this filter, but it's required
  16. // to at least return the input text as-is.
  17. case 'prepare':
  18. return $text;
  19.  
  20. // The actual filtering is performed here. The supplied text should be
  21. // returned, once any necessary substitutions have taken place.
  22. case 'process':
  23. return preg_replace_callback('(\[featured_links_block(.*)\])', 'display_featured_links_block', $text);
  24.  
  25. // Since we allow the administrator to define the string that gets
  26. // substituted when "foo" is encountered, we need to provide an
  27. // interface for this customization. Note that the value of $format
  28. // needs to be provided as part of the form name, so that different
  29. // customization can be done for this filter in each of the different
  30. // input formats that may use it.
  31. case 'settings':
  32. /*$form['filter_example'] = array(
  33. '#type' => 'fieldset',
  34. '#title' => t('Foo filter'),
  35. '#collapsible' => TRUE,
  36. '#collapsed' => TRUE,
  37. );
  38. $form['filter_example']["filter_example_foo_$format"] = array(
  39. '#type' => 'textfield',
  40. '#title' => t('Substitution string'),
  41. '#default_value' => variable_get("filter_example_foo_$format", 'bar'),
  42. '#description' => t('The string to substitute for "foo" everywhere in the text.'),
  43. );
  44. return $form;*/
  45. }
  46. break;
  47.  
  48. }
  49.  
  50. }
  51.  
  52. $matches = preg_split('/[=".*"]+/', trim($matches[1]), -1, PREG_SPLIT_NO_EMPTY);
  53.  
  54. $args = array();
  55.  
  56. for($i = 0; $i < count($matches); $i += 2)
  57. $args[trim($matches[$i])] = trim($matches[$i+1]);
  58.  
  59. return theme('movehub_featured_links_block', $args);
  60.  
  61. }
  62.  
  63. <div class="bp-featured-links-block">
  64.  
  65. <h2><?php echo $title; ?></h2> <?php
  66.  
  67. $i = 0;
  68.  
  69. $result = db_query('SELECT * FROM movehub_featured_links_block_links');
  70.  
  71. while($row = db_fetch_array($result)):
  72.  
  73. if($i % 2 == 0) echo '<div class="bp-featured-links-block-row">'; ?>
  74.  
  75. <div class="bp-featured-link-block-link-container">
  76.  
  77. <div class="bp-featured-links-block-image-container">
  78.  
  79. <a href="bp-featured-links-block-link">
  80.  
  81. <div class="bp-featured-links-block-content-wrapper-cr">
  82.  
  83. <div class="bp-featured-links-block-heading">
  84. <div class="bp-featured-links-block-table">
  85. <h3 class="bp-featured-links-block-title"><?php echo $row['title']; ?></h3>
  86. </div>
  87. </div>
  88.  
  89. <img class="bp-featured-links-block-main-image" src="<?php echo $base_url . '/' . $row['img_url']; ?>" alt="<?php echo $row['title']; ?>">
  90.  
  91. <div class="bp-featured-links-block-content-cr">
  92.  
  93. <div class="bp-featured-links-block-content">
  94.  
  95. <img class="bp-featured-links-block-hover-image" src="<?php echo $base_url . '/' . $row['hover_img_url']; ?>" alt="<?php echo $row['title']; ?>">
  96.  
  97. </div>
  98.  
  99. </div>
  100.  
  101. </div>
  102.  
  103. </a>
  104.  
  105. </div>
  106.  
  107. <div class="bp-featured-links-block-links-container">
  108.  
  109. <div class="bp-featured-links-block-links">
  110.  
  111. <div class="bp-featured-links-block-table">
  112.  
  113. <div class="bp-featured-links-block-links-p"> <?php
  114.  
  115. for($ii = 1; $ii <= 8; $ii++):
  116.  
  117. if($row['sub_link_url_' . $ii] != '' && $row['sub_link_title_' . $ii] != ''): ?>
  118. <p><a href="<?php echo $row['sub_link_url_' . $ii]; ?>"><?php echo $row['sub_link_title_' . $ii] ?></a></p> <?php
  119. endif;
  120.  
  121. endfor; ?>
  122.  
  123. </div>
  124.  
  125. </div>
  126.  
  127. </div>
  128.  
  129. </div>
  130.  
  131. </div> <?php
  132.  
  133. $i++;
  134.  
  135. if($i % 2 == 0) echo '</div>'; // .bp-featured-links-block-row
  136.  
  137. endwhile; ?>
  138.  
  139. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement