[ 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')) { ?>
  27                  <script>
  28                    jQuery(document).ready(function(){
  29                      jQuery(".video-splash").fitVids();
  30                    });
  31                  </script>
  32              <?php }
  33      }
  34      
  35  	function section_opts(  ){
  36  
  37          $options = array(
  38                  array(
  39                      'key'    => 'pagelines_masthead_splash_multi',
  40                      'type'     => 'multi',
  41                      'title' => __('Masthead Splash Options','pagelines'),
  42                      'opts'    => array(
  43                          array(
  44                              'key'            => 'pagelines_masthead_img',
  45                              'type'             => 'image_upload',
  46                              'imagepreview'     => '270',
  47                              'has_alt'        => true,
  48                              'label'     => __( 'Upload custom image', 'pagelines' ),
  49                          ),
  50                          array(
  51                              'key'            => 'pagelines_masthead_html',
  52                              'type'             => 'textarea',
  53                              'label'     => __( 'Masthead Video (optional, to be used instead of image)', 'pagelines' ),
  54                          ),
  55                          array(
  56                              'key'            => 'masthead_html_width',
  57                              'type'             => 'text',
  58                              'label'     => __( 'Maximum width of splash in px (default is full width)', 'pagelines' ),
  59                          ),
  60                      ),
  61                      'help'                   => __( 'Upload an image to serve as a splash image, or use an embed code for full width video.', 'pagelines' ),
  62                  ),
  63                  array(
  64                          'col'                => 2,
  65                          'key'                => 'pagelines_masthead_text',
  66                          'type'                 => 'multi',
  67                          'label'         => __( 'Masthead Text', 'pagelines' ),
  68                          'title'             => $this->name . __( ' Text', 'pagelines' ),
  69                          'opts'    => array(
  70                              array(
  71                                  'key'        => 'pagelines_masthead_title',
  72                                  'type'        => 'text',
  73                                  'label'        => __( 'Title', 'pagelines' ), 
  74                              ),
  75                              array(
  76                                  'key'    => 'pagelines_masthead_tagline',
  77                                  'type'    => 'text',
  78                                  'label'    =>__( 'Tagline', 'pagelines' ), 
  79                              )
  80                          ),
  81  
  82                  ),
  83          ); 
  84              
  85          for($i = 1; $i <= 2; $i++){
  86  
  87              $options[] = array(
  88                  'key'        => 'masthead_button_multi_'.$i,
  89                  'type'        => 'multi',
  90                  'col'        => 3,
  91                  'title'        => __('Masthead Action Button '.$i, 'pagelines'),
  92                  'opts'    => array(
  93                      array(
  94                          'key'        => 'masthead_button_link_'.$i,
  95                          'type' => 'text',
  96                          'label' => __( 'Enter the link destination (URL - Required)', 'pagelines' ),
  97  
  98                      ),
  99                      array(
 100                          'key'        => 'masthead_button_text_'.$i,
 101                          'type'             => 'text',
 102                          'label'     => __( 'Masthead Button Text', 'pagelines' ),
 103                       ),
 104  
 105                      array(
 106                          'key'        => 'masthead_button_target_'.$i,
 107                          'type'            => 'check',
 108                          'default'        => false,
 109                          'label'    => __( 'Open link in new window.', 'pagelines' ),
 110                      ),
 111                      array(
 112                          'key'        => 'masthead_button_theme_'.$i,
 113                          'type'            => 'select_button',
 114                          'default'        => false,
 115                          'label'        => __( 'Select Button Color', 'pagelines' ),
 116                      
 117                      ),
 118                  )
 119              );
 120  
 121          }
 122              
 123                  
 124          $options[] = array(
 125                      'col'        => 2,
 126                      'key'        => 'masthead_menu',
 127                      'type'             => 'select_menu',
 128                      'title'            => __( 'Masthead Menu', 'pagelines' ),
 129                      'inputlabel'     => __( 'Select Masthead Menu', 'pagelines' ),
 130                  ); 
 131          $options[] = array(
 132                      'col'                => 2,
 133                      'key'        => 'masthead_meta',
 134                      'type'             => 'text',
 135                      'title'            => __( 'Masthead Meta', 'pagelines' ),
 136                      'inputlabel'     => __( 'Enter Masthead Meta Text', 'pagelines' ),
 137                  ); 
 138  
 139          
 140  
 141          return $options;
 142      }
 143      
 144      
 145  
 146      /**
 147      * Section template.
 148      */
 149     function section_template() {
 150             $mast_title = $this->opt('pagelines_masthead_title');
 151             $mast_img = $this->opt('pagelines_masthead_img' );
 152          $mast_tag = $this->opt('pagelines_masthead_tagline');
 153          $mast_menu = $this->opt( 'masthead_menu', array( 'default' => null ) );
 154          $masthead_meta = $this->opt('masthead_meta');
 155  
 156          $masthtmlwidth = ($this->opt('masthead_html_width')) ? $this->opt('masthead_html_width').'px' : '';
 157  
 158          $mast_title = (!$mast_title) ? 'Hello.' : $mast_title;
 159  
 160          $classes = ($mast_img) ? 'with-splash' : '';
 161          
 162      ?>
 163  
 164      <header class="jumbotron masthead <?php echo $classes;?>">
 165            <?php
 166      
 167              $theimg = $this->image( 'pagelines_masthead_img', false, array( 'masthead-img' ) );
 168                $masthtml = $this->opt('pagelines_masthead_html');
 169  
 170                if($mast_img)
 171                    printf('<div class="splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$theimg);
 172  
 173                if($masthtml)
 174                    printf('<div class="video-splash" style="max-width:%s;margin:0 auto;">%s</div>',$masthtmlwidth,$masthtml);
 175  
 176            ?>
 177  
 178        <div class="inner">
 179            <?php
 180  
 181                printf('<h1 class="masthead-title" data-sync="pagelines_masthead_title">%s</h1>',$mast_title);
 182  
 183              printf('<p class="masthead-tag" data-sync="pagelines_masthead_tagline">%s</p>',$mast_tag);
 184  
 185            ?>
 186  
 187          <?php if( $this->opt('masthead_button_link_1') || $this->opt('masthead_button_link_2') ): ?>
 188          <p class="download-info">
 189  
 190          <?php
 191              for ($i = 1; $i <= 2; $i++){
 192                  $btn_link = $this->opt('masthead_button_link_'.$i); // Flag
 193  
 194                  $btn_text = $this->opt('masthead_button_text_'.$i, array( 'default' => __('Start Here', 'pagelines') ) );
 195  
 196                  $target = ( $this->opt( 'masthead_button_target_'.$i ) ) ? 'target="_blank"' : '';
 197  
 198                  $btheme = $this->opt( 'masthead_button_theme_' . $i, array( 'default' => '' ) );
 199  
 200                  if($btn_link)
 201                      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);
 202              }
 203  
 204          ?>
 205          </p>
 206          <?php endif; ?>
 207        </div>
 208      <?php if( is_array( wp_get_nav_menu_items( $mast_menu ) ) || $masthead_meta ): ?>
 209          <div class="mastlinks">
 210              <?php
 211              if( is_array( wp_get_nav_menu_items( $mast_menu ) ) )
 212                  wp_nav_menu(
 213                      array(
 214                          'menu_class'  => 'quick-links',
 215                          'menu' => $mast_menu,
 216                          'container' => null,
 217                          'container_class' => '',
 218                          'depth' => 1,
 219                          'fallback_cb'=>''
 220                      )
 221                  );
 222  
 223  
 224              if($masthead_meta)
 225                  printf( '<div class="quick-links mastmeta">%s</div>', do_shortcode($masthead_meta) );
 226  
 227              ?>
 228          </div>
 229      <?php endif; ?>
 230      </header>
 231          <?php
 232      }
 233  }


Generated: Sun Aug 31 19:17:14 2014 Cross-referenced by PHPXref 0.7.1