Advertisement
Digitalraindrops

wrappers.php

Jul 7th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.68 KB | None | 0 0
  1. <?php
  2. // $style = 'post' or 'block' or 'vmenu' or 'simple'
  3. function theme_wrapper($style, $args){
  4.     $func_name = "theme_{$style}_wrapper";
  5.     if (function_exists($func_name)) {
  6.         call_user_func($func_name, $args);
  7.     } else {
  8.         theme_block_wrapper($args);
  9.     }
  10. }
  11.  
  12. function theme_post_wrapper($args = '') {
  13.     $args = wp_parse_args($args,
  14.         array(
  15.             'id' => '',
  16.             'class' => '',
  17.             'title' => '',
  18.             'thumbnail' => '',
  19.             'before' => '',
  20.             'content' => '',
  21.             'after' => '',
  22.             'custom' => '' // DR Added custom option
  23.         )
  24.     );
  25.     extract($args);
  26.     if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  27.     if ($id) {
  28.         $id = ' id="' . $id . '"';
  29.     }
  30.     if ($class) {
  31.         $class = ' ' . $class;
  32.     }
  33.     ?>
  34. <div class="art-post<?php echo $class; ?>"<?php echo $id; ?>>
  35.         <div class="art-post-tl"></div>
  36.         <div class="art-post-tr"></div>
  37.         <div class="art-post-bl"></div>
  38.         <div class="art-post-br"></div>
  39.         <div class="art-post-tc"></div>
  40.         <div class="art-post-bc"></div>
  41.         <div class="art-post-cl"></div>
  42.         <div class="art-post-cr"></div>
  43.         <div class="art-post-cc"></div>
  44.         <div class="art-post-body">
  45.                 <div class="art-post-inner art-article">
  46.                 <?php
  47.                    
  48.                     // DR Added Custom Output
  49.                     if ( $custom ) echo $custom;
  50.                    
  51.                     echo $thumbnail;
  52.                     if (!theme_is_empty_html($title)){
  53.                         echo '<h2 class="art-postheader">'.$title.'</h2>';
  54.                     }
  55.                      echo $before;?>
  56.                     <div class="art-postcontent">
  57.                         <!-- article-content -->
  58.                         <?php echo $content; ?>
  59.                         <!-- /article-content -->
  60.                     </div>
  61.                     <div class="cleared"></div>
  62.                     <?php
  63.                     ob_start();
  64.                         echo $after;
  65.                     $meta = ob_get_clean();    
  66.                     if (strlen($meta) > 0) {
  67.                         echo '<div class="art-postmetadatafooter">'.$meta.'</div>';
  68.                     }
  69.                    
  70.                 ?>
  71.                 </div>
  72.             <div class="cleared"></div>
  73.         </div>
  74.     </div>
  75.    
  76.     <?php
  77. }
  78.  
  79. function theme_simple_wrapper($args = '') {
  80.     $args = wp_parse_args($args,
  81.         array(
  82.             'id' => '',
  83.             'class' => '',
  84.             'title' => '',
  85.             'content' => '',
  86.         )
  87.     );
  88.     extract($args);
  89.     if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  90.     if ($id) {
  91.         $id = ' id="' . $id . '"';
  92.     }
  93.     if ($class) {
  94.         $class = ' ' . $class;
  95.     }
  96.     echo "<div class=\"art-widget{$class}\"{$id}>";
  97.     if ( !theme_is_empty_html($title)) echo '<h5  class="art-widget-title">' . $title . '</h5>';
  98.     echo '<div class="art-widget-content">' . $content . '</div>';
  99.     echo '</div>';
  100. }
  101.  
  102. function theme_block_wrapper($args) {
  103.     $args = wp_parse_args($args,
  104.         array(
  105.             'id' => '',
  106.             'class' => '',
  107.             'title' => '',
  108.             'content' => '',
  109.         )
  110.     );
  111.     extract($args);
  112.     if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  113.     if ($id) {
  114.         $id = ' id="' . $id . '"';
  115.     }
  116.     if ($class) {
  117.         $class = ' ' . $class;
  118.     }
  119.  
  120.     $begin = <<<EOL
  121. <div class="art-block{$class}"{$id}>
  122.     <div class="art-block-body">
  123. EOL;
  124.     $begin_title  = <<<EOL
  125.  
  126. EOL;
  127.     $end_title = <<<EOL
  128.  
  129. EOL;
  130.     $begin_content = <<<EOL
  131. <div class="art-blockcontent">
  132.     <div class="art-blockcontent-body">
  133. EOL;
  134.     $end_content = <<<EOL
  135.         <div class="cleared"></div>
  136.     </div>
  137. </div>
  138. EOL;
  139.     $end = <<<EOL
  140.         <div class="cleared"></div>
  141.     </div>
  142. </div>
  143. EOL;
  144.     echo $begin;
  145.     if ($begin_title && $end_title && !theme_is_empty_html($title)) {
  146.         echo $begin_title . $title . $end_title;
  147.     }
  148.     echo $begin_content;
  149.     echo $content;
  150.     echo $end_content;
  151.     echo $end; 
  152. }
  153.  
  154. function theme_vmenu_wrapper($args) {
  155.     $args = wp_parse_args($args,
  156.         array(
  157.             'id' => '',
  158.             'class' => '',
  159.             'title' => '',
  160.             'content' => '',
  161.         )
  162.     );
  163.     extract($args);
  164.     if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  165.     if ($id) {
  166.         $id = ' id="' . $id . '"';
  167.     }
  168.     if ($class) {
  169.         $class = ' ' . $class;
  170.     }
  171.  
  172.     $begin = <<<EOL
  173. <div class="art-vmenublock{$class}"{$id}>
  174.     <div class="art-vmenublock-body">
  175. EOL;
  176.     $begin_title  = <<<EOL
  177.  
  178. EOL;
  179.     $end_title = <<<EOL
  180.  
  181. EOL;
  182.     $begin_content = <<<EOL
  183. <div class="art-vmenublockcontent">
  184.     <div class="art-vmenublockcontent-body">
  185. EOL;
  186.     $end_content = <<<EOL
  187.         <div class="cleared"></div>
  188.     </div>
  189. </div>
  190. EOL;
  191.     $end = <<<EOL
  192.         <div class="cleared"></div>
  193.     </div>
  194. </div>
  195. EOL;
  196.     echo $begin;
  197.     if ($begin_title && $end_title && !theme_is_empty_html($title)) {
  198.         echo $begin_title . $title . $end_title;
  199.     }
  200.     echo $begin_content;
  201.     echo $content;
  202.     echo $end_content;
  203.     echo $end; 
  204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement