[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/sections/sb_footcols/ -> section.php (source)

   1  <?php
   2  /*
   3      Section: Footer Columns Sidebar
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: A 5 column widgetized sidebar in the footer
   7      Class Name: PageLinesFootCols
   8      Workswith: morefoot, footer
   9      Persistant: true
  10  */
  11  
  12  /**
  13   * Footer Columns Sidebar Section
  14   *
  15   * @package PageLines Framework
  16   * @author PageLines
  17   */
  18  class PageLinesFootCols extends PageLinesSection {
  19  
  20      public $markup_start;
  21      public $markup_end;
  22  
  23      /**
  24      * PHP that always loads no matter if section is added or not.
  25      */
  26  	function section_persistent(){
  27  
  28          $per_row = (ploption('footer_num_columns')) ? ploption('footer_num_columns') : 5;
  29  
  30          $this->markup_start = sprintf( '<div class="pp%s footcol"><div class="footcol-pad">', $per_row );
  31          $this->markup_end     = '</div></div>';
  32  
  33  
  34          pagelines_register_sidebar(array(
  35              'name'=>$this->name,
  36              'description'    => __('Use this sidebar if you want to use widgets in your footer columns instead of the default.', 'pagelines'),
  37              'before_widget' => $this->markup_start,
  38              'after_widget'     => $this->markup_end,
  39              'before_title'     => '<h3 class="widget-title">',
  40              'after_title'     => '</h3>'
  41          ) );
  42  
  43          register_nav_menus( array(
  44              'footer_nav' => __( 'Page Navigation in Footer Columns', 'pagelines' )
  45          ) );
  46  
  47  
  48      }
  49  
  50      /**
  51      * Section template.
  52      */
  53  	function section_template() {
  54  
  55          $default = array();
  56  
  57          if(ploption('footer_logo') && VPRO)
  58              $default[] = sprintf( '<a href="%s" class="home" title="%s"><img src="%s" alt="%s"/></a>',  home_url(),  __('Home', 'pagelines'), ploption('footer_logo'),  get_bloginfo('name') );
  59          else
  60              $default[] = sprintf( '<h3 class="site-title"><a class="home" href="%s" title="%s">%s</a></h3>', home_url(), __('Home', 'pagelines'), get_bloginfo('name') );
  61  
  62          $default[] = sprintf( '<h3 class="widget-title">%s</h3>%s',
  63                  __('Pages','pagelines'),
  64                  wp_nav_menu( array('menu_class' => 'footer-links list-links', 'theme_location'=>'footer_nav', 'depth' => 1, 'echo' => false) )
  65              );
  66  
  67          $default[] = sprintf( '<h3 class="widget-title">%s</h3><ul class="latest_posts">%s</ul>',
  68                  __('The Latest','pagelines'),
  69                  $this->recent_post()
  70              );
  71  
  72          $default[] = sprintf( '<h3 class="widget-title">%s</h3><div class="findent footer-more">%s</div>',
  73                  __('More','pagelines'),
  74                  ploption('footer_more')
  75              );
  76  
  77          $default[] = sprintf( '<div class="findent terms">%s</div>',
  78                  ploption('footer_terms')
  79              );
  80  
  81  
  82          ob_start(); // dynamic sidebar always outputs
  83  
  84          if (!dynamic_sidebar($this->name) ) {
  85  
  86              foreach($default as $key => $c){
  87                  printf($this->markup_start, '', '');
  88                  echo $c;
  89                  echo $this->markup_end;
  90              }
  91  
  92          }
  93  
  94          printf('<div class="fcolumns ppfull pprow"><div class="fcolumns-pad fix">%s</div></div><div class="clear"></div>', ob_get_clean());
  95  
  96      }
  97  
  98  
  99      /**
 100      *
 101      * @TODO document
 102      *
 103      */
 104  	function recent_post(){
 105          $out = '';
 106          foreach( get_posts('numberposts=1&offset=0') as $key => $p ){
 107              $out .= sprintf(
 108                  '<li class="list-item fix"><div class="list_item_text"><h5><a class="list_text_link" href="%s"><span class="list-title">%s</span></a></h5><div class="list-excerpt">%s</div></div></li>',
 109                  get_permalink( $p->ID ),
 110                  $p->post_title,
 111                  custom_trim_excerpt($p->post_content, 12)
 112              );
 113          }
 114  
 115          return $out;
 116      }
 117  
 118  }


Generated: Thu May 23 23:52:43 2013 Cross-referenced by PHPXref 0.7.1