[ Index ]

PHP Cross Reference of PageLines DMS

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      Edition: pro
   9      Workswith: templates, main, header, morefoot
  10      Filter: component
  11      Loading: active
  12  */
  13  
  14  /**
  15   * Main section class
  16   *
  17   * @package PageLines DMS
  18   * @author PageLines
  19   */
  20  class PLMasthead extends PageLinesSection {
  21  
  22      var $tabID = 'masthead_meta';
  23  
  24      function section_head() {
  25  
  26          if($this->opt('pagelines_masthead_html',$this->oset)) { ?>
  27                  <script>
  28                    jQuery(document).ready(function(){
  29                      jQuery(".video-splash").fitVids();
  30                    });
  31                  </script>
  32              <?php }
  33      }
  34  
  35       function section_scripts() {
  36           if( $this->opt( 'pagelines_masthead_html', $this->oset ) )
  37          wp_enqueue_script( 'pagelines-fitvids',$this->base_url . '/jquery.fitvids.js', array( 'jquery' ), PL_CORE_VERSION, true );
  38      }
  39  
  40      
  41  	function section_opts(  ){
  42  
  43          $options = array(
  44                  array(
  45                      'key'    => 'pagelines_masthead_splash_multi',
  46                      'type'     => 'multi',
  47                      'title' => __('Masthead Splash Options','pagelines'),
  48                      'opts'    => array(
  49                          array(
  50                              'key'            => 'pagelines_masthead_img',
  51                              'type'             => 'image_upload',
  52                              'imagepreview'     => '270',
  53                              'label'     => __( 'Upload custom image', 'pagelines' ),
  54                          ),
  55                          array(
  56                              'key'            => 'pagelines_masthead_html',
  57                              'type'             => 'textarea',
  58                              'label'     => __( 'Masthead Video (optional, to be used instead of image)', 'pagelines' ),
  59                          ),
  60                          array(
  61                              'key'            => 'masthead_html_width',
  62                              'type'             => 'text',
  63                              'label'     => __( 'Maximum width of splash in px (default is full width)', 'pagelines' ),
  64                          ),
  65                      ),
  66                      'help'                   => __( 'Upload an image to serve as a splash image, or use an embed code for full width video.', 'pagelines' ),
  67                  ),
  68                  array(
  69                          'key'                => 'pagelines_masthead_text',
  70                          'type'                 => 'multi',
  71                          'label'         => __( 'Masthead Text', 'pagelines' ),
  72                          'title'             => $this->name . __( ' Text', 'pagelines' ),
  73                          'opts'    => array(
  74                              array(
  75                                  'key'        => 'pagelines_masthead_title',
  76                                  'type'        => 'text',
  77                                  'label'        => __( 'Title', 'pagelines' ), 
  78                              ),
  79                              array(
  80                                  'key'    => 'pagelines_masthead_tagline',
  81                                  'type'    => 'text',
  82                                  'label'    =>__( 'Tagline', 'pagelines' ), 
  83                              )
  84                          ),
  85  
  86                  ),
  87          ); 
  88              
  89          for($i = 1; $i <= 2; $i++){
  90  
  91              $options[] = array(
  92                  'key'        => 'masthead_button_multi_'.$i,
  93                  'type'        => 'multi',
  94                  'title'        => __('Masthead Action Button '.$i, 'pagelines'),
  95                  'opts'    => array(
  96                      array(
  97                          'key'        => 'masthead_button_link_'.$i,
  98                          'type' => 'text',
  99                          'label' => __( 'Enter the link destination (URL - Required)', 'pagelines' ),
 100  
 101                      ),
 102                      array(
 103                          'key'        => 'masthead_button_text_'.$i,
 104                          'type'             => 'text',
 105                          'label'     => __( 'Masthead Button Text', 'pagelines' ),
 106                       ),
 107  
 108                      array(
 109                          'key'        => 'masthead_button_target_'.$i,
 110                          'type'            => 'check',
 111                          'default'        => false,
 112                          'label'    => __( 'Open link in new window.', 'pagelines' ),
 113                      ),
 114                      array(
 115                          'key'        => 'masthead_button_theme_'.$i,
 116                          'type'            => 'select_button',
 117                          'default'        => false,
 118                          'label'        => __( 'Select Button Color', 'pagelines' ),
 119                      
 120                      ),
 121                  )
 122              );
 123  
 124          }
 125              
 126                  
 127          $options[] = array(
 128                      'key'        => 'masthead_menu',
 129                      'type'             => 'select_menu',
 130                      'title'            => __( 'Masthead Menu', 'pagelines' ),
 131                      'inputlabel'     => __( 'Select Masthead Menu', 'pagelines' ),
 132                  ); 
 133          $options[] = array(
 134                      'key'        => 'masthead_meta',
 135                      'type'             => 'text',
 136                      'title'            => __( 'Masthead Meta', 'pagelines' ),
 137                      'inputlabel'     => __( 'Enter Masthead Meta Text', 'pagelines' ),
 138                  ); 
 139  
 140          
 141  
 142          return $options;
 143      }
 144      
 145      
 146  
 147      /**
 148      * Section template.
 149      */
 150     function section_template() {
 151             $mast_title = $this->opt('pagelines_masthead_title', $this->oset);
 152             $mast_img = $this->opt('pagelines_masthead_img', $this->oset);
 153          $mast_tag = $this->opt('pagelines_masthead_tagline', $this->oset);
 154          $mast_menu = ($this->opt('masthead_menu', $this->oset)) ? $this->opt('masthead_menu', $this->oset) : null;
 155          $masthead_meta = $this->opt('masthead_meta', $this->oset);
 156  
 157          $masthtmlwidth = ($this->opt('masthead_html_width',$this->oset)) ? $this->opt('masthead_html_width',$this->oset).'px' : '';
 158  
 159          $mast_title = (!$mast_title) ? 'Hello.' : $mast_title;
 160  
 161          $classes = ($mast_img) ? 'with-splash' : '';
 162          
 163      ?>
 164  
 165      <header class="jumbotron masthead <?php echo $classes;?>">
 166            <?php
 167  
 168                $theimg = sprintf('<img class="masthead-img" data-sync="pagelines_masthead_img" src="%s" />',$mast_img);
 169                $masthtml = $this->opt('pagelines_masthead_html',$this->oset);
 170  
 171                if($mast_img)
 172                    printf('<div class="splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$theimg);
 173  
 174                if($masthtml)
 175                    printf('<div class="video-splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$masthtml);
 176  
 177            ?>
 178  
 179        <div class="inner">
 180            <?php
 181  
 182                printf('<h1 class="masthead-title" data-sync="pagelines_masthead_title">%s</h1>',$mast_title);
 183  
 184              printf('<p class="masthead-tag" data-sync="pagelines_masthead_tagline">%s</p>',$mast_tag);
 185  
 186            ?>
 187  
 188          <p class="download-info">
 189  
 190          <?php
 191              for ($i = 1; $i <= 2; $i++){
 192                  $btn_link = $this->opt('masthead_button_link_'.$i, $this->oset); // Flag
 193  
 194                  $btn_text = ($this->opt('masthead_button_text_'.$i, $this->oset)) ? $this->opt('masthead_button_text_'.$i, $this->oset) : __('Start Here', 'pagelines');
 195  
 196                  $target = ( $this->opt( 'masthead_button_target_'.$i, $this->oset ) ) ? 'target="_blank"' : '';
 197                  $btheme = ( $this->opt( 'masthead_button_theme_'.$i, $this->oset ) ) ? $this->opt( 'masthead_button_theme_'.$i, $this->oset ) : 'primary';
 198  
 199                  if($btn_link)
 200                      printf('<a %s class="btn %s btn-large" href="%s" data-sync="masthead_button_text_%s">%s</a> ', $target, $btheme, $btn_link, $i, $btn_text);
 201              }
 202  
 203          ?>
 204  
 205          </p>
 206        </div>
 207          <div class="mastlinks">
 208              <?php
 209              if( is_array( wp_get_nav_menu_items( $mast_menu ) ) )
 210                  wp_nav_menu(
 211                      array(
 212                          'menu_class'  => 'quick-links',
 213                          'menu' => $mast_menu,
 214                          'container' => null,
 215                          'container_class' => '',
 216                          'depth' => 1,
 217                          'fallback_cb'=>''
 218                      )
 219                  );
 220  
 221  
 222              if($masthead_meta)
 223                  printf( '<div class="quick-links mastmeta">%s</div>', do_shortcode($masthead_meta) );
 224  
 225              ?>
 226  
 227  
 228          </div>
 229      </header>
 230  
 231          <?php
 232  
 233      
 234  
 235      }
 236  
 237  
 238      
 239  	function section_optionator( $settings ){
 240  
 241          $settings = wp_parse_args($settings, $this->optionator_default);
 242  
 243          $option_array = array(
 244                  'pagelines_masthead_splash_multi' => array(
 245                      'type'                 => 'multi_option',
 246                      'title'             => __('Masthead Splash Options','pagelines'),
 247                      'shortexp'    => __( 'Enter the options for the masthead splash image. If no options are specified, no image will be shown.', 'pagelines' ),
 248                      'selectvalues'    => array(
 249                          'pagelines_masthead_img' => array(
 250                              'type'             => 'image_upload',
 251                              'imagepreview'     => '270',
 252                              'inputlabel'     => __( 'Upload custom image', 'pagelines' ),
 253                          ),
 254                          'pagelines_masthead_html'   => array(
 255                              'type'             => 'textarea',
 256                              'inputlabel'     => __( 'Masthead Video (optional, to be used instead of image)', 'pagelines' ),
 257                          ),
 258                          'masthead_html_width'   => array(
 259                              'type'             => 'text',
 260                              'inputlabel'     => __( 'Maximum width of splash in px (default is full width)', 'pagelines' ),
 261                          ),
 262                      ),
 263                      'exp'                   => __( 'Upload an image to serve as a splash image, or use an embed code for full width video.', 'pagelines' ),
 264                  ),
 265                  'pagelines_masthead_text' => array(
 266                          'type'                 => 'text_multi',
 267                          'layout'            => 'full',
 268                          'inputlabel'         => __( 'Enter text for your masthead banner section', 'pagelines' ),
 269                          'title'             => $this->name . __( ' Text', 'pagelines' ),
 270                          'selectvalues'    => array(
 271                              'pagelines_masthead_title'        => array('inputlabel'=>__( 'Title', 'pagelines' ), 'default'=> ''),
 272                              'pagelines_masthead_tagline'    => array('inputlabel'=>__( 'Tagline', 'pagelines' ), 'default'=> '')
 273                          ),
 274                          'shortexp'             => __( 'The text for the masthead section', 'pagelines' ),
 275  
 276                  ),
 277                  'masthead_button_multi_1' => array(
 278                      'type'        => 'multi_option',
 279                      'title'        => __('Masthead Action Button 1', 'pagelines'),
 280                      'shortexp'    => __('Enter the options for the masthead button. If no options are specified, no button will be shown.', 'pagelines'),
 281                      'selectvalues'    => array(
 282                          'masthead_button_link_1' => array(
 283                              'type' => 'text',
 284                              'inputlabel' => __( 'Enter the link destination (URL - Required)', 'pagelines' ),
 285  
 286                          ),
 287                          'masthead_button_text_1' => array(
 288                              'type'             => 'text',
 289                              'inputlabel'     => __( 'Masthead Button Text', 'pagelines' ),
 290                           ),
 291  
 292                          'masthead_button_target_1' => array(
 293                              'type'            => 'check',
 294                              'default'        => false,
 295                              'inputlabel'    => __( 'Open link in new window.', 'pagelines' ),
 296                          ),
 297                          'masthead_button_theme_1' => array(
 298                              'type'            => 'select',
 299                              'default'        => false,
 300                              'inputlabel'    => __( 'Select Button Color', 'pagelines' ),
 301                              'selectvalues'    => array(
 302                                  'primary'    => array('name' => __( 'Blue', 'pagelines' )),
 303                                  'warning'    => array('name' => __( 'Orange', 'pagelines' )),
 304                                  'important'    => array('name' => __( 'Red', 'pagelines' )),
 305                                  'success'    => array('name' => __( 'Green', 'pagelines' )),
 306                                  'info'        => array('name' => __( 'Light Blue', 'pagelines' )),
 307                                  'reverse'    => array('name' => __( 'Grey', 'pagelines' )),
 308                              ),
 309                          ),
 310                      )
 311                  ),
 312                  'masthead_button_multi_2' => array(
 313                      'type'        => 'multi_option',
 314                      'title'        => __('Masthead Action Button 2', 'pagelines'),
 315                      'shortexp'    => __('Enter the options for the masthead button. If no options are specified, no button will be shown.', 'pagelines'),
 316                      'selectvalues'    => array(
 317                          'masthead_button_link_2' => array(
 318                              'type' => 'text',
 319                              'inputlabel' => __( 'Enter the link destination (URL - Required)', 'pagelines' ),
 320  
 321                          ),
 322                          'masthead_button_text_2' => array(
 323                              'type'             => 'text',
 324                              'inputlabel'     => __( 'Masthead Button Text', 'pagelines' ),
 325                           ),
 326  
 327                          'masthead_button_target_2' => array(
 328                              'type'            => 'check',
 329                              'default'        => false,
 330                              'inputlabel'    => __( 'Open link in new window.', 'pagelines' ),
 331                          ),
 332                          'masthead_button_theme_2' => array(
 333                              'type'            => 'select',
 334                              'default'        => false,
 335                              'inputlabel'    => __( 'Select Button Color', 'pagelines' ),
 336                              'selectvalues'    => array(
 337                                  'primary'    => array('name' => __( 'Blue', 'pagelines' )),
 338                                  'warning'    => array('name' => __( 'Orange', 'pagelines' )),
 339                                  'important'    => array('name' => __( 'Red', 'pagelines' )),
 340                                  'success'    => array('name' => __( 'Green', 'pagelines' )),
 341                                  'info'        => array('name' => __( 'Light Blue', 'pagelines' )),
 342                                  'reverse'    => array('name' => __( 'Grey', 'pagelines' )),
 343                              ),
 344                          ),
 345                      )
 346                  ),
 347                  'masthead_menu' => array(
 348                      'shortexp'    => __( 'Choose a Wordpress menu to display (optional)', 'pagelines' ),
 349                          'type'             => 'select_menu',
 350                          'title'            => __( 'Masthead Menu', 'pagelines' ),
 351                          'inputlabel'     => __( 'Select Masthead Menu', 'pagelines' ),
 352                      ),
 353                  'masthead_meta' => array(
 354                      'shortexp'    => __( 'Enter text to be shown on Masthead (optional)', 'pagelines' ),
 355                          'type'             => 'textarea',
 356                          'title'            => __( 'Masthead Meta', 'pagelines' ),
 357                          'inputlabel'     => __( 'Enter Masthead Meta Text', 'pagelines' ),
 358                      ),
 359  
 360              );
 361  
 362          $metatab_settings = array(
 363                  'id'         => $this->tabID,
 364                  'name'         => 'Masthead',
 365                  'icon'         => $this->icon,
 366                  'clone_id'    => $settings['clone_id'],
 367                  'active'    => $settings['active']
 368              );
 369  
 370          register_metatab($metatab_settings, $option_array);
 371      }
 372  
 373  }


Generated: Sun Dec 1 19:43:16 2013 Cross-referenced by PHPXref 0.7.1