| [ Index ] |
PHP Cross Reference of PageLines Framework |
[Summary view] [Print] [Text view]
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 */ 11 12 /** 13 * Main section class 14 * 15 * @package PageLines Framework 16 * @author PageLines 17 */ 18 class PageLinesQuickSlider extends PageLinesSection { 19 20 var $default_limit = 2; 21 22 /** 23 * Load styles and scripts 24 */ 25 function section_styles(){ 26 wp_enqueue_script( 'flexslider', $this->base_url.'/flexslider/jquery.flexslider-min.js', array( 'jquery' ) ); 27 } 28 29 function section_head($clone_id){ 30 31 $animation = (ploption('quick_transition', $this->oset) == 'slide_v' || ploption('quick_transition', $this->oset) == 'slide_h') ? 'slide' : 'fade'; 32 $transfer = (ploption('quick_transition', $this->oset) == 'slide_v') ? 'vertical' : 'horizontal'; 33 34 $slideshow = (ploption('quick_slideshow', $this->oset)) ? 'true' : 'false'; 35 36 $clone_class = 'pl-clone'.$clone_id; 37 38 $control_nav = (!ploption('quick_nav', $this->oset) || ploption('quick_nav', $this->oset) == 'both' || ploption('quick_nav', $this->oset) == 'control_only') ? 'true' : 'false'; 39 $direction_nav = (!ploption('quick_nav', $this->oset) || ploption('quick_nav', $this->oset) == 'both' || ploption('quick_nav', $this->oset) == 'arrow_only') ? 'true' : 'false'; 40 ?> 41 <script> 42 jQuery(window).load(function() { 43 var theSlider = jQuery('.flexslider.<?php echo $clone_class;?>'); 44 theSlider.flexslider({ 45 controlsContainer: '.fs-nav-container', 46 animation: '<?php echo $animation;?>', 47 slideDirection: '<?php echo $transfer;?>', 48 slideshow: <?php echo $slideshow;?>, 49 directionNav: <?php echo $direction_nav;?>, 50 controlNav: <?php echo $control_nav;?> 51 }); 52 }); 53 </script> 54 <?php } 55 56 /** 57 * Section template. 58 */ 59 function section_template( $clone_id ) { 60 61 $control_nav = (!ploption('quick_nav', $this->oset) || ploption('quick_nav', $this->oset) == 'both' || ploption('quick_nav', $this->oset) == 'control_only') ? 'true' : 'false'; 62 63 $nav_class = ($control_nav) ? 'control-nav' : 'no-control-nav'; 64 ?> 65 <div class="flexwrap animated fadeIn <?php echo 'wrap-'.$nav_class;?>"> 66 <div class="fslider"> 67 <div class="flexslider <?php echo 'pl-clone'.$clone_id;?>"> 68 <ul class="slides"> 69 70 <?php 71 72 $slides = (ploption('quick_slides', $this->oset)) ? ploption('quick_slides', $this->oset) : $this->default_limit; 73 74 $output = ''; 75 for($i = 1; $i <= $slides; $i++){ 76 77 if(ploption('quick_image_'.$i, $this->oset)){ 78 79 $the_text = ploption('quick_text_'.$i, $this->tset); 80 81 $img_alt = ploption('quick_img_alt_'.$i,$this->tset); 82 83 $tlocation = ploption('quick_text_location_'.$i, $this->oset); 84 85 if($tlocation == 'right_top') 86 $caption_style = 'right:0; bottom: auto; top:0;'; 87 elseif($tlocation == 'left_bottom') 88 $caption_style = 'left:0; bottom:0; top: auto;'; 89 elseif($tlocation == 'left_top') 90 $caption_style = 'left:0; bottom:auto; top: 0;'; 91 else 92 $caption_style = 'right:0; bottom:0; top: auto;'; 93 94 95 $text = ($the_text) ? sprintf('<p class="flex-caption" style="%s">%s</p>', $caption_style, $the_text) : ''; 96 97 $img = sprintf('<img src="%s" alt="%s"/>', ploption( 'quick_image_'.$i, $this->tset ),$img_alt ); 98 99 $slide = (ploption('quick_link_'.$i, $this->oset)) ? sprintf('<a href="%s">%s</a>', ploption('quick_link_'.$i, $this->oset), $img ) : $img; 100 $output .= sprintf('<li>%s %s</li>',$slide, $text); 101 } 102 } 103 104 if($output == ''){ 105 $this->do_defaults(); 106 } else { 107 echo $output; 108 109 } 110 111 112 ?> 113 </ul> 114 </div> 115 </div> 116 <div class="fs-nav-container <?php echo $nav_class;?>"></div> 117 </div> 118 119 <?php 120 } 121 122 function do_defaults(){ 123 124 printf( 125 '<li><img src="%s" /></li><li><img src="%s" /></li><li><img src="%s" /></li>', 126 $this->images.'/image3.jpg', 127 $this->images.'/image1.jpg', 128 $this->images.'/image2.jpg' 129 ); 130 } 131 132 /** 133 * 134 * Page-by-page options for PostPins 135 * 136 */ 137 function section_optionator( $settings ){ 138 $settings = wp_parse_args( $settings, $this->optionator_default ); 139 140 $array = array(); 141 142 $array['quick_slides'] = array( 143 'type' => 'count_select', 144 'count_start' => 1, 145 'count_number' => 10, 146 'default' => '3', 147 'inputlabel' => __( 'Number of Slides to Configure', 'pagelines' ), 148 'title' => __( 'Number of Slides', 'pagelines' ), 149 'shortexp' => __( 'Enter the number of QuickSlider slides. <strong>Default is 3</strong>', 'pagelines' ), 150 'exp' => __( "This number will be used to generate slides and option setup.", 'pagelines' ), 151 152 ); 153 154 $array['quick_transition'] = array( 155 'type' => 'select', 156 'selectvalues' => array( 157 'fade' => array('name' => __( 'Use Fading Transition', 'pagelines' ) ), 158 'slide_h' => array('name' => __( 'Use Slide/Horizontal Transition', 'pagelines' ) ), 159 ), 160 'inputlabel' => __( 'Select Transition Type', 'pagelines' ), 161 'title' => __( 'Slider Transition Type', 'pagelines' ), 162 'shortexp' => __( 'Configure the way slides transfer to one another.', 'pagelines' ), 163 'exp' => __( "", 'pagelines' ), 164 165 ); 166 167 $array['quick_nav'] = array( 168 'type' => 'select', 169 'selectvalues' => array( 170 'both' => array('name' => __( 'Use Both Arrow and Slide Control Navigation', 'pagelines' ) ), 171 'none' => array('name' => __( 'No Navigation', 'pagelines' ) ), 172 'control_only' => array('name' => __( 'Slide Controls Only', 'pagelines' ) ), 173 'arrow_only' => array('name' => __( 'Arrow Navigation Only', 'pagelines' ) ), 174 ), 175 'inputlabel' => __( 'Slider Navigation', 'pagelines' ), 176 'title' => __( 'Slider Navigation mode', 'pagelines' ), 177 'shortexp' => __( 'Configure the navigation for this slider.', 'pagelines' ), 178 'exp' => __( "", 'pagelines' ), 179 180 ); 181 182 $array['quick_slideshow'] = array( 183 'type' => 'check', 184 185 'inputlabel' => __( 'Animate Slideshow Automatically?', 'pagelines' ), 186 'title' => __( 'Automatic Slideshow?', 'pagelines' ), 187 'shortexp' => __( 'Autoplay the slides, transitioning every 7 seconds.', 'pagelines' ), 188 'exp' => __( "", 'pagelines' ), 189 190 ); 191 192 global $post_ID; 193 194 $oset = array('post_id' => $post_ID, 'clone_id' => $settings['clone_id'], 'type' => $settings['type']); 195 196 $slides = (ploption('quick_slides', $oset)) ? ploption('quick_slides', $oset) : $this->default_limit; 197 198 for($i = 1; $i <= $slides; $i++){ 199 200 201 $array['quick_slide_'.$i] = array( 202 'type' => 'multi_option', 203 'selectvalues' => array( 204 'quick_image_'.$i => array( 205 'inputlabel' => __( 'Slide Image', 'pagelines' ), 206 'type' => 'image_upload' 207 ), 208 'quick_img_alt_'.$i => array( 209 'inputlabel' => __( 'Image Alt', 'pagelines' ), 210 'type' => 'text' 211 ), 212 'quick_text_'.$i => array( 213 'inputlabel' => __( 'Slide Text', 'pagelines' ), 214 'type' => 'textarea' 215 ), 216 'quick_link_'.$i => array( 217 'inputlabel' => __( 'Slide Link URL', 'pagelines' ), 218 'type' => 'text' 219 ), 220 'quick_text_location_'.$i => array( 221 'inputlabel' => __( 'Slide Text Location', 'pagelines' ), 222 'type' => 'select', 223 'selectvalues' => array( 224 'right_bottom' => array('name'=> 'Right/Bottom'), 225 'right_top' => array('name'=> 'Right/Top'), 226 'left_bottom' => array('name'=> 'Left/Bottom'), 227 'left_top' => array('name'=> 'Left/Top') 228 ) 229 ), 230 ), 231 'title' => __( 'QuickSlider Slide ', 'pagelines' ) . $i, 232 'shortexp' => __( 'Setup options for slide number ', 'pagelines' ) . $i, 233 'exp' => __( 'For best results all images in the slider should have the same dimensions.', 'pagelines') 234 ); 235 236 } 237 238 239 240 $metatab_settings = array( 241 'id' => 'quickslider_options', 242 'name' => __( 'QuickSlider', 'pagelines' ), 243 'icon' => $this->icon, 244 'clone_id' => $settings['clone_id'], 245 'active' => $settings['active'] 246 ); 247 248 register_metatab( $metatab_settings, $array ); 249 250 } 251 252 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Apr 6 23:00:27 2013 | Cross-referenced by PHPXref 0.7.1 |