[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

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

   1  <?php
   2  /*
   3      Section: Masthead
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: A responsive full width splash and text area. Great for getting big ideas across quickly.
   7      Class Name: PLMasthead
   8      Workswith: templates, main, header, morefoot
   9  */
  10  
  11  /**
  12   * Main section class
  13   *
  14   * @package PageLines Framework
  15   * @author PageLines
  16   */
  17  class PLMasthead extends PageLinesSection {
  18  
  19      var $tabID = 'masthead_meta';
  20  
  21      function section_head() {
  22  
  23          if(ploption('pagelines_masthead_html',$this->oset)) { ?>
  24                  <script>
  25                    jQuery(document).ready(function(){
  26                      jQuery(".video-splash").fitVids();
  27                    });
  28                  </script>
  29              <?php }
  30      }
  31  
  32       function section_scripts() {
  33           if(ploption('pagelines_masthead_html',$this->oset))
  34          wp_enqueue_script('fitvid',$this->base_url.'/jquery.fitvids.js',array('jquery'));
  35      }
  36  
  37  	function section_optionator( $settings ){
  38  
  39          $settings = wp_parse_args($settings, $this->optionator_default);
  40  
  41          $option_array = array(
  42                  'pagelines_masthead_splash_multi' => array(
  43                      'type'                 => 'multi_option',
  44                      'title'             => __('Masthead Splash Options','pagelines'),
  45                      'shortexp'    => __('Enter the options for the masthead splash image. If no options are specified, no image will be shown.', 'pagelines'),
  46                      'selectvalues'    => array(
  47                          'pagelines_masthead_img' => array(
  48                              'type'             => 'image_upload',
  49                              'imagepreview'     => '270',
  50                              'inputlabel'     => 'Upload custom image',
  51                          ),
  52                          'pagelines_masthead_imgalt' => array(
  53                              'type'             => 'text',
  54                              'inputlabel'     => 'Masthead Image Alt',
  55                          ),
  56                          'pagelines_masthead_html'   => array(
  57                              'type'             => 'textarea',
  58                              'inputlabel'     => 'Masthead Video (optional, to be used instead of image)',
  59                          ),
  60                          'masthead_html_width'   => array(
  61                              'type'             => 'text_small',
  62                              'inputlabel'     => 'Maxium width of splash in px (default is full width)',
  63                          ),
  64                      ),
  65                      'exp'                   => 'Upload an image to serve as a splash image, or use an embed code for full width video.',
  66                  ),
  67                  'pagelines_masthead_text' => array(
  68                          'type'                 => 'text_multi',
  69                          'layout'            => 'full',
  70                          'inputlabel'         => 'Enter text for your masthead banner section',
  71                          'title'             => $this->name.' Text',
  72                          'selectvalues'    => array(
  73                              'pagelines_masthead_title'        => array('inputlabel'=>'Title', 'default'=> ''),
  74                              'pagelines_masthead_tagline'    => array('inputlabel'=>'Tagline', 'default'=> '')
  75                          ),
  76                          'shortexp'             => 'The text for the masthead section',
  77  
  78                  ),
  79                  'masthead_button_multi_1' => array(
  80                      'type'        => 'multi_option',
  81                      'title'        => __('Masthead Action Button 1', 'pagelines'),
  82                      'shortexp'    => __('Enter the options for the masthead button. If no options are specified, no button will be shown.', 'pagelines'),
  83                      'selectvalues'    => array(
  84                          'masthead_button_link_1' => array(
  85                              'type' => 'text',
  86                              'inputlabel' => 'Enter the link destination (URL - Required)',
  87  
  88                          ),
  89                          'masthead_button_text_1' => array(
  90                              'type'             => 'text',
  91                              'inputlabel'     => 'Masthead Button Text',
  92                           ),
  93  
  94                          'masthead_button_target_1' => array(
  95                              'type'            => 'check',
  96                              'default'        => false,
  97                              'inputlabel'    => 'Open link in new window.',
  98                          ),
  99                          'masthead_button_theme_1' => array(
 100                              'type'            => 'select',
 101                              'default'        => false,
 102                              'inputlabel'    => 'Select Button Color',
 103                              'selectvalues'    => array(
 104                                  'primary'    => array('name' => 'Blue'),
 105                                  'warning'    => array('name' => 'Orange'),
 106                                  'important'    => array('name' => 'Red'),
 107                                  'success'    => array('name' => 'Green'),
 108                                  'info'        => array('name' => 'Light Blue'),
 109                                  'reverse'    => array('name' => 'Grey'),
 110                              ),
 111                          ),
 112                      )
 113                  ),
 114                  'masthead_button_multi_2' => array(
 115                      'type'        => 'multi_option',
 116                      'title'        => __('Masthead Action Button 2', 'pagelines'),
 117                      'shortexp'    => __('Enter the options for the masthead button. If no options are specified, no button will be shown.', 'pagelines'),
 118                      'selectvalues'    => array(
 119                          'masthead_button_link_2' => array(
 120                              'type' => 'text',
 121                              'inputlabel' => 'Enter the link destination (URL - Required)',
 122  
 123                          ),
 124                          'masthead_button_text_2' => array(
 125                              'type'             => 'text',
 126                              'inputlabel'     => 'Masthead Button Text',
 127                           ),
 128  
 129                          'masthead_button_target_2' => array(
 130                              'type'            => 'check',
 131                              'default'        => false,
 132                              'inputlabel'    => 'Open link in new window.',
 133                          ),
 134                          'masthead_button_theme_2' => array(
 135                              'type'            => 'select',
 136                              'default'        => false,
 137                              'inputlabel'    => 'Select Button Color',
 138                              'selectvalues'    => array(
 139                                  'primary'    => array('name' => 'Blue'),
 140                                  'warning'    => array('name' => 'Orange'),
 141                                  'important'    => array('name' => 'Red'),
 142                                  'success'    => array('name' => 'Green'),
 143                                  'info'        => array('name' => 'Light Blue'),
 144                                  'reverse'    => array('name' => 'Grey'),
 145                              ),
 146                          ),
 147                      )
 148                  ),
 149                  'masthead_menu' => array(
 150                      'shortexp'    => __('Choose a Wordpress menu to display (optional)', 'pagelines'),
 151                          'type'             => 'select_menu',
 152                          'title'            => 'Masthead Menu',
 153                          'inputlabel'     => 'Select Masthead Menu',
 154                      ),
 155                  'masthead_meta' => array(
 156                      'shortexp'    => __('Enter text to be shown on Masthead (optional)', 'pagelines'),
 157                          'type'             => 'textarea',
 158                          'title'            => 'Masthead Meta',
 159                          'inputlabel'     => 'Enter Masthead Meta Text',
 160                      ),
 161  
 162              );
 163  
 164          $metatab_settings = array(
 165                  'id'         => $this->tabID,
 166                  'name'         => 'Masthead',
 167                  'icon'         => $this->icon,
 168                  'clone_id'    => $settings['clone_id'],
 169                  'active'    => $settings['active']
 170              );
 171  
 172          register_metatab($metatab_settings, $option_array);
 173      }
 174  
 175      /**
 176      * Section template.
 177      */
 178     function section_template( $clone_id ) {
 179             $mast_title = ploption('pagelines_masthead_title', $this->oset);
 180             $mast_img = ploption('pagelines_masthead_img', $this->oset);
 181          $mast_imgalt = ploption('pagelines_masthead_imgalt', $this->oset);
 182          $mast_tag = ploption('pagelines_masthead_tagline', $this->oset);
 183          $mast_menu = (ploption('masthead_menu', $this->oset)) ? ploption('masthead_menu', $this->oset) : null;
 184          $masthead_meta = ploption('masthead_meta', $this->oset);
 185  
 186          $masthtmlwidth = (ploption('masthead_html_width',$this->oset)) ? ploption('masthead_html_width',$this->oset).'px' : '';
 187  
 188  
 189          // A Responsive, Drag &amp; Drop Platform for Beautiful Websites
 190  
 191          $classes = ($mast_img) ? 'with-splash' : '';
 192  
 193      if($mast_title){ ?>
 194  
 195      <header class="jumbotron masthead <?php echo $classes;?>">
 196            <?php
 197  
 198                $theimg = sprintf('<img class="masthead-img" src="%s" alt="%s"/>',$mast_img, $mast_imgalt);
 199                $masthtml = ploption('pagelines_masthead_html',$this->oset);
 200  
 201                if($mast_img)
 202                    printf('<div class="splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$theimg);
 203  
 204                if($masthtml)
 205                    printf('<div class="video-splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$masthtml);
 206  
 207            ?>
 208  
 209        <div class="inner">
 210            <?php
 211  
 212                if($mast_title)
 213                    printf('<h1 class="masthead-title">%s</h1>',$mast_title);
 214  
 215              if($mast_tag)
 216                    printf('<p class="masthead-tag">%s</p>',$mast_tag);
 217  
 218            ?>
 219  
 220          <p class="download-info">
 221  
 222          <?php
 223              for ($i = 1; $i <= 2; $i++){
 224                  $butt_link = ploption('masthead_button_link_'.$i, $this->oset); // Flag
 225  
 226                  $butt_text = (ploption('masthead_button_text_'.$i, $this->oset)) ? ploption('masthead_button_text_'.$i, $this->oset) : __('Start Here', 'pagelines');
 227  
 228                  $target = ( ploption( 'masthead_button_target_'.$i, $this->oset ) ) ? 'target="_blank"' : '';
 229                  $btheme = ( ploption( 'masthead_button_theme_'.$i, $this->oset ) ) ? ploption( 'masthead_button_theme_'.$i, $this->oset ) : 'primary';
 230  
 231                  if($butt_link)
 232                      printf('<a %s class="btn btn-%s btn-large" href="%s">%s</a> ', $target, $btheme, $butt_link, $butt_text);
 233              }
 234  
 235          ?>
 236  
 237          </p>
 238        </div>
 239          <div class="mastlinks">
 240              <?php
 241  
 242              if($mast_menu)
 243                  wp_nav_menu(
 244                      array(
 245                          'menu_class'  => 'quick-links',
 246                          'menu' => $mast_menu,
 247                          'container' => null,
 248                          'container_class' => '',
 249                          'depth' => 1,
 250                          'fallback_cb'=>''
 251                      )
 252                  );
 253  
 254  
 255              if($masthead_meta)
 256                  printf( '<div class="quick-links mastmeta">%s</div>', do_shortcode($masthead_meta) );
 257  
 258              ?>
 259  
 260  
 261          </div>
 262      </header>
 263      <hr class="soften" />
 264  
 265          <?php
 266  
 267          } else
 268              echo setup_section_notify($this, __('Set Masthead page options to activate.', 'pagelines') );
 269  
 270      }
 271  
 272  
 273  }


Generated: Sat Apr 6 23:00:27 2013 Cross-referenced by PHPXref 0.7.1