[ Index ]

PHP Cross Reference of PageLines DMS

title

Body

[close]

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

   1  <?php
   2  /*
   3      Section: QuickSlider
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: A responsive slider that is easy to use and setup.
   7      Class Name: PageLinesQuickSlider
   8      Cloning: true
   9      Workswith: main, templates, sidebar_wrap
  10      Filter: slider
  11  */
  12  
  13  /**
  14   * Main section class
  15   *
  16   * @package PageLines DMS
  17   * @author PageLines
  18   */
  19  class PageLinesQuickSlider extends PageLinesSection {
  20  
  21      var $default_limit = 2;
  22  
  23      /**
  24       * Load styles and scripts
  25       */
  26  	function section_styles(){
  27          wp_enqueue_script( 'flexslider', PL_JS . '/script.flexslider.js', array( 'jquery' ), pl_get_cache_key(), true );
  28      }
  29  
  30  	function old_section_head(){
  31  
  32          $animation = ($this->opt('quick_transition') == 'slide_v' || $this->opt('quick_transition') == 'slide_h') ? 'slide' : 'fade';
  33          $transfer = ($this->opt('quick_transition') == 'slide_v') ? 'vertical' : 'horizontal';
  34  
  35          $slideshow = ($this->opt('quick_slideshow')) ? 'true' : 'false';
  36  
  37          $clone_class = 'pl-clone' . $this->oset['clone_id'];
  38  
  39          $control_nav = (!$this->opt('quick_nav') || $this->opt('quick_nav') == 'both' || $this->opt('quick_nav') == 'control_only') ? 'true' : 'false';
  40          $direction_nav = (!$this->opt('quick_nav') || $this->opt('quick_nav') == 'both' || $this->opt('quick_nav') == 'arrow_only') ? 'true' : 'false';
  41          ?>
  42  <script>
  43  jQuery(window).load(function() {
  44      // var theSlider = jQuery('<?php echo $this->prefix();?> .flexslider');
  45      // theSlider.flexslider({
  46      //     controlsContainer: '.fs-nav-container',
  47      //     animation: '<?php echo $animation;?>',
  48      //     slideDirection: '<?php echo $transfer;?>',
  49      //     slideshow: <?php echo $slideshow;?>,
  50      //     directionNav: <?php echo $direction_nav;?>,
  51      //     controlNav: <?php echo $control_nav;?>
  52      // });
  53  });
  54  </script>
  55  <?php }
  56  
  57      /**
  58      * Section template.
  59      */
  60     function section_template() {
  61  
  62      $control_nav = (!$this->opt('quick_nav') || $this->opt('quick_nav') == 'both' || $this->opt('quick_nav') == 'control_only') ? 'true' : 'false';
  63  
  64      $transition = ( $this->opt('quick_transition') == 'slide_h' ) ? 'slide' : 'fade';
  65      $animate = ( $this->opt('quick_slideshow') ) ? 'true' : 'false';
  66  
  67      $nav_class = ($control_nav) ? 'control-nav' : 'no-control-nav';
  68      ?>
  69      <div class="flexwrap animated fadeIn <?php echo 'wrap-'.$nav_class;?>">
  70          <div class="fslider">
  71          <div class="flex-gallery flexslider <?php echo 'pl-clone' . $this->oset['clone_id'];?>" data-transition="<?php echo $transition;?>" data-animate="<?php echo $animate;?>">
  72            <ul class="slides">
  73  
  74              <?php
  75  
  76              $item_array = $this->opt('quickslider_array');
  77  
  78              $format_upgrade_mapping = array(
  79                  'image'            => 'quick_image_%s',
  80                  'text'            => 'quick_text_%s',
  81                  'link'            => 'quick_link_%s',
  82                  'location'        => 'quick_text_location_%s',
  83              ); 
  84  
  85              $item_array = $this->upgrade_to_array_format( 'quickslider_array', $item_array, $format_upgrade_mapping, $this->opt('quick_slides'));
  86  
  87              $output = '';
  88  
  89              $num = count( $item_array );
  90  
  91              if( is_array($item_array) ){
  92                  
  93                  foreach( $item_array as $item ){
  94  
  95                      $the_image = pl_array_get( 'image', $item ); 
  96                      
  97                      if( $the_image ){
  98  
  99                          $the_text =  pl_array_get( 'text', $item );
 100                          $the_link =  pl_array_get( 'link', $item );
 101  
 102                          $text = ($the_text) ? sprintf('<p class="flex-caption">%s</p>', $the_text) : '';
 103  
 104                          $img = sprintf('<img src="%s" alt="" />', $the_image );
 105  
 106                          $slide = ( $the_link ) ? sprintf('<a href="%s">%s</a>', $the_link, $img ) : $img;
 107                          
 108                          $output .= sprintf('<li>%s %s</li>',$slide, $text);
 109                      }
 110  
 111                  }
 112                  
 113              }
 114          
 115  
 116              if($output == '')
 117                  $this->do_defaults();
 118              else 
 119                  echo $output;
 120  
 121  
 122              ?>
 123            </ul>
 124          </div>
 125          </div>
 126      </div>
 127  
 128          <?php
 129      }
 130  
 131  	function do_defaults(){
 132  
 133          printf(
 134              '<li><img src="%s" /></li><li><img src="%s" /></li><li><img src="%s" /></li>',
 135              $this->images.'/image3.jpg',
 136              $this->images.'/image1.jpg',
 137              $this->images.'/image2.jpg'
 138          );
 139      }
 140  
 141  	function section_opts(){
 142          
 143              $options = array();
 144  
 145              $options[] = array(
 146  
 147                  'title' => __( 'Slider Configuration', 'pagelines' ),
 148                  'type'    => 'multi',
 149                  'opts'    => array(
 150                      array(
 151                          'key'            => 'quick_transition',
 152                          'type'             => 'select',
 153                          'default'        => 'fade',
 154                          'label'     => __( 'Select Transition Type', 'pagelines' ),
 155                          'opts' => array(
 156                              'fade'             => array('name' => __( 'Use Fading Transition', 'pagelines' ) ),
 157                              'slide_h'         => array('name' => __( 'Use Slide/Horizontal Transition', 'pagelines' ) ),
 158                          ),
 159                      ), 
 160                      array(
 161                          'key'            => 'quick_slideshow',
 162                          'type'             => 'check',
 163                          'label'     => __( 'Animate Slideshow Automatically?', 'pagelines' ),
 164                      
 165                      )
 166                  )
 167  
 168              );
 169  
 170  
 171              $options[] = array(
 172                  'key'        => 'quickslider_array',
 173                  'type'        => 'accordion', 
 174                  'col'        => 2,
 175                  'title'        => __('Slides Setup', 'pagelines'), 
 176                  'post_type'    => __('Slide', 'pagelines'), 
 177                  'opts'    => array(
 178                      array(
 179                          'key'        => 'image',
 180                          'label'     => __( 'Slide Background Image', 'pagelines' ),
 181                          'type'        => 'image_upload',
 182                          'sizelimit'    => 2097152, // 2M
 183                          'help'        => __( 'For high resolution, 2000px wide x 800px tall images. (2MB Limit)', 'pagelines' )
 184  
 185                      ),
 186  
 187                      array(
 188                          'key'    => 'text',
 189                          'label'    => __( 'Slide Text', 'pagelines' ),
 190                          'type'            => 'text'
 191                      ),
 192                      array(
 193                          'key'    => 'link',
 194                          'label'    => __( 'Slide Link URL', 'pagelines' ),
 195                          'type'            => 'text'
 196                      ),
 197                      
 198  
 199  
 200                  )
 201              );
 202          
 203          return $options;
 204          
 205      }
 206      
 207  }


Generated: Wed Jul 9 23:44:08 2014 Cross-referenced by PHPXref 0.7.1