Changeset 980909
- Timestamp:
- 09/05/2014 01:47:48 AM (11 years ago)
- Location:
- bcms/trunk
- Files:
-
- 4 added
- 10 edited
-
bcms.php (modified) (1 diff)
-
components/class-bcms-postloop-scroller.php (modified) (3 diffs)
-
components/class-bcms-postloop-widget.php (modified) (5 diffs)
-
components/class-bcms-search.php (modified) (1 diff)
-
components/class-bcms-wiframe-encode.php (modified) (2 diffs)
-
components/class-bcms-wijax-widget.php (modified) (2 diffs)
-
components/class-bcms-wijax.php (modified) (3 diffs)
-
components/cms-widgets.php (modified) (19 diffs)
-
components/listchildren.php (modified) (6 diffs)
-
phpunit.xml (added)
-
readme.txt (modified) (1 diff)
-
tests (added)
-
tests/bootstrap.php (added)
-
tests/class-bcms-search-test.php (added)
Legend:
- Unmodified
- Added
- Removed
-
bcms/trunk/bcms.php
r833529 r980909 4 4 Plugin URI: http://wordpress.org/plugins/bcms/ 5 5 Description: Make WordPress a better CMS. Create a post loop in a widget. Lazy load widgets. More shortcodes. More good. 6 Version: 5. 26 Version: 5.3 7 7 Author: Casey Bisson 8 8 Author URI: http://maisonbisson.com/blog/ -
bcms/trunk/components/class-bcms-postloop-scroller.php
r717625 r980909 39 39 // register scripts and styles 40 40 wp_register_script( 'scrollable', $this->path_web . '/js/scrollable.min.js', array('jquery'), TRUE ); 41 bcms_late_enqueue_script( 'scrollable' );41 wp_enqueue_script( 'scrollable' ); 42 42 add_filter( 'print_footer_scripts', array( $this, 'print_js' ), 10, 1 ); 43 43 … … 45 45 { 46 46 wp_register_style( 'scrollable', $this->path_web .'/css/scrollable.css' ); 47 bcms_late_enqueue_style( 'scrollable' );47 wp_enqueue_style( 'scrollable' ); 48 48 } 49 49 } … … 52 52 { 53 53 ?> 54 <script type="text/javascript"> 54 <script type="text/javascript"> 55 55 ;(function($){ 56 56 $(window).load(function(){ -
bcms/trunk/components/class-bcms-postloop-widget.php
r833529 r980909 41 41 42 42 $this->wijax_varname = $mywijax->encoded_name( $this->id ); 43 44 extract( $args );45 43 46 44 $title = apply_filters('widget_title', empty( $instance['title'] ) ? '' : $instance['title']); … … 484 482 do_action( $action_name, 'after', $ourposts, bcms_postloop() ); 485 483 484 //If the template calls another postloop it can overwrite these values 485 $preserve = array( 486 'number' => $this->number, 487 'ttl' => $this->ttl, 488 'use_cache' => $this->use_cache, 489 ); 490 486 491 // new actions 487 492 bcms_postloop()->do_action( 'post', $instance['template'], 'after', $ourposts, $this, $instance ); … … 506 511 507 512 // output the widget 508 echo str_replace( 'class="', 'class="' . implode( ' ', $extra_classes ) .' ', $ before_widget);513 echo str_replace( 'class="', 'class="' . implode( ' ', $extra_classes ) .' ', $args['before_widget'] ); 509 514 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] ); 510 515 if ( isset( $instance['title_show'] ) && $instance['title_show'] && $title ) 511 516 { 512 echo $ before_title . $title . $after_title.'<div class="widget_subtitle">'. $instance['subtitle'] .'</div>';517 echo $args['before_title'] . $title . $args['after_title'] .'<div class="widget_subtitle">'. $instance['subtitle'] .'</div>'; 513 518 }//end if 514 519 515 echo $cached->html . $a fter_widget;520 echo $cached->html . $args['after_widget']; 516 521 517 522 // if there is something to cache, it is new, and we want to cache it, let's cache it. 518 if ( $fresh_html && isset( $cachekey ) && $ this->use_cache)523 if ( $fresh_html && isset( $cachekey ) && $preserve['use_cache'] ) 519 524 { 520 525 $cache_data = (object) array( … … 522 527 'template' => $cached->template, 523 528 'instance' => $instance, 524 'post_ids' => bcms_postloop()->posts[ $ this->number],529 'post_ids' => bcms_postloop()->posts[ $preserve['number'] ], 525 530 'time' => time(), 526 531 ); 527 wp_cache_set( $cachekey, $cache_data, 'bcmspostloop', $ this->ttl);532 wp_cache_set( $cachekey, $cache_data, 'bcmspostloop', $preserve['ttl'] ); 528 533 unset( $cache_data ); 529 534 }//end if … … 1194 1199 $instance['tax_'. $taxonomy .'_not_in'] = isset( $instance['tax_'. $taxonomy .'_not_in'] ) ? $instance['tax_'. $taxonomy .'_not_in'] : array(); 1195 1200 $instance['tax_'. $taxonomy .'_not_in_related'] = isset( $instance['tax_'. $taxonomy .'_not_in_related'] ) ? $instance['tax_'. $taxonomy .'_not_in_related'] : 0; 1201 $instance['tax_'. $taxonomy .'_bool'] = isset( $instance['tax_'. $taxonomy .'_bool'] ) ? $instance['tax_'. $taxonomy .'_bool'] : ''; 1196 1202 1197 1203 $tax = get_taxonomy( $taxonomy ); -
bcms/trunk/components/class-bcms-search.php
r833529 r980909 358 358 SELECT post_id, ( $this->relevancy_formula ) AS ftscore 359 359 FROM $this->search_table 360 WHERE ( MATCH ( content ) AGAINST ( %s $boolean) )360 WHERE ( MATCH ( content ) AGAINST ( %s ) ) 361 361 ORDER BY ftscore DESC 362 362 LIMIT 0, 1250 -
bcms/trunk/components/class-bcms-wiframe-encode.php
r717625 r980909 29 29 header( 'X-Robots-Tag: noindex', TRUE ); 30 30 31 bcms_late_enqueue_script(31 wp_enqueue_script( 32 32 'jquery-postmessage', 33 33 plugins_url( 'components/js/jquery.ba-postmessage.min.js', __DIR__ ), … … 37 37 ); 38 38 39 bcms_late_enqueue_script(39 wp_enqueue_script( 40 40 'bcms-wiframe-notify', 41 41 plugins_url( 'components/js/bcms-wiframe-notify.js', __DIR__ ), -
bcms/trunk/components/class-bcms-wijax-widget.php
r717625 r980909 7 7 { 8 8 9 function __construct()10 { 11 $widget_ops = array( 'classname' => 'widget_wijax', 'description' => __( 'Lazy load widgets after DOMDocumentReady') );12 $this->WP_Widget( 'wijax', __('Wijax Widget Lazy Loader'), $widget_ops);13 14 add_filter( 'wijax-base-current' , array( $this , 'base_current' ), 5 );15 add_filter( 'wijax-base-home' , array( $this , 'base_home' ), 5 );16 } 17 18 function widget( $args, $instance )9 public function __construct() 10 { 11 $widget_ops = array( 'classname' => 'widget_wijax', 'description' => __( 'Lazy load widgets after DOMDocumentReady' ) ); 12 $this->WP_Widget( 'wijax', __( 'Wijax Widget Lazy Loader' ), $widget_ops ); 13 14 add_filter( 'wijax-base-current', array( $this, 'base_current' ), 5 ); 15 add_filter( 'wijax-base-home', array( $this, 'base_home' ), 5 ); 16 }// end __construct 17 18 public function widget( $args, $instance ) 19 19 { 20 20 global $mywijax; 21 21 22 extract( $args ); 23 24 if( 'remote' != $instance['base'] ) 25 { 26 $base = apply_filters( 'wijax-base-'. $instance['base'] , '' ); 27 if( ! $base ) 22 // passed to bCMS_Wijax::varname() to determine if the URL should be normalized or not. 23 // You'll find the call to that method below. 24 $is_local = TRUE; 25 26 if ( 'remote' != $instance['base'] ) 27 { 28 $base = apply_filters( 'wijax-base-' . $instance['base'], '' ); 29 if ( ! $base ) 30 { 28 31 return; 32 }//end if 33 29 34 $wijax_source = $base . $mywijax->encoded_name( $instance['widget'] ); 30 $wijax_varname = $mywijax->varname( $wijax_source ); 31 } 35 }//end if 32 36 else 33 37 { 38 $is_local = FALSE; 34 39 $wijax_source = $instance['base-remote'] . $mywijax->encoded_name( $instance['widget-custom'] ); 35 $wijax_varname = $mywijax->varname( $wijax_source , FALSE ); 36 } 37 38 echo $before_widget; 39 40 preg_match( '/<([\S]*)/' , $before_title , $title_element ); 41 $title_element = trim( (string) $title_element[1] , '<>'); 42 43 preg_match( '/class.*?=.*?(\'|")(.+?)(\'|")/' , $before_title , $title_class ); 40 }//end else 41 42 // if there is a query string, let's make the request with it in place 43 // these variables are needed in the downstream request, this will be escaped on output 44 if ( $_SERVER['QUERY_STRING'] ) 45 { 46 $wijax_source .= "?{$_SERVER['QUERY_STRING']}"; 47 }//end if 48 49 // wijax doesn't work with paging. Let's strip out the "page/X/" section of the URL, which should help with cached wijax widgets 50 $wijax_source = preg_replace( '#/page/[0-9]+/wijax#', '/wijax', $wijax_source ); 51 52 $wijax_varname = $mywijax->varname( $wijax_source, $is_local ); 53 54 echo $args['before_widget']; 55 56 preg_match( '/<([\S]*)/', $args['before_title'], $title_element ); 57 $title_element = trim( (string) $title_element[1], '<>' ); 58 59 preg_match( '/class.*?=.*?(\'|")(.+?)(\'|")/', $args['before_title'], $title_class ); 44 60 $title_class = (string) $title_class[2]; 45 61 46 $loadtime = ($instance['loadtime']) ? $instance['loadtime'] : 'onload'; 47 ?> 48 <span class="wijax-loading"> 49 <img src="<?php echo $mywijax->path_web .'/img/loading-gray.gif'; ?>" alt="loading external resource" /> 50 <a href="<?php echo $wijax_source; ?>" class="wijax-source <?php echo 'wijax-' . $loadtime;?>" rel="nofollow"></a> 62 $loadtime = ( $instance['loadtime'] ) ? $instance['loadtime'] : 'onload'; 63 64 $classes = isset( $instance['classes'] ) ? $instance['classes'] : ''; 65 ?> 66 <span class="wijax-loading <?php echo esc_attr( $classes ); ?>"> 67 <img src="<?php echo /* @INSANE */ esc_url( $mywijax->path_web . '/img/loading-gray.gif' ); ?>" alt="loading external resource" /> 68 <a href="<?php echo esc_url( $wijax_source ); ?>" class="wijax-source <?php echo esc_attr( 'wijax-' . $loadtime ); ?>" rel="nofollow"></a> 51 69 <span class="wijax-opts" style="display: none;"> 52 <?php echo json_encode( array( 53 'source' => $wijax_source , 54 'varname' => $wijax_varname , 55 'title_element' => $title_element , 56 'title_class' => $title_class , 57 'title_before' => rawurlencode( $before_title ), 58 'title_after' => rawurlencode( $after_title ), 59 )); ?> 70 <?php 71 echo json_encode( array( 72 'source' => esc_url( $wijax_source ), 73 'varname' => $wijax_varname, 74 'title_element' => $title_element, 75 'title_class' => $title_class, 76 'title_before' => rawurlencode( $args['before_title'] ), 77 'title_after' => rawurlencode( $args['after_title'] ), 78 ) ); 79 ?> 60 80 </span> 61 81 </span> 62 <?php 63 echo $after_widget; 64 } 65 66 function base_home() 67 { 68 82 <?php 83 echo $args['after_widget']; 84 }//end widget 85 86 public function base_home() 87 { 69 88 return trailingslashit( home_url() ) .'wijax/'; 70 } 71 72 function base_current() 73 { 74 75 $home_path = parse_url( home_url() , PHP_URL_PATH ); 76 return esc_url_raw( trailingslashit( home_url() . str_replace( $home_path , '' , parse_url( $_SERVER['REQUEST_URI'] , PHP_URL_PATH ))) .'wijax/' ); 77 } 78 79 function update( $new_instance, $old_instance ) 89 }//end base_home 90 91 public function base_current() 92 { 93 $home_path = parse_url( home_url(), PHP_URL_PATH ); 94 return esc_url_raw( trailingslashit( home_url() . str_replace( $home_path, '', parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) ) ) . 'wijax/' ); 95 }//end base_current 96 97 public function update( $new_instance, $old_instance ) 80 98 { 81 99 $instance = $old_instance; … … 85 103 $instance['base'] = sanitize_title( $new_instance['base'] ); 86 104 $instance['base-remote'] = esc_url_raw( $new_instance['base-remote'] ); 87 $instance['loadtime'] = in_array( $new_instance['loadtime'], array( 'onload', 'onscroll') ) ? $new_instance['loadtime'] : 'onscroll'; 105 $instance['loadtime'] = in_array( $new_instance['loadtime'], array( 'onload', 'onscroll' ) ) ? $new_instance['loadtime'] : 'onscroll'; 106 $instance['classes'] = sanitize_text_field( $new_instance['classes'] ); 88 107 89 108 return $instance; 90 } 91 92 function form( $instance )109 }// end update 110 111 public function form( $instance ) 93 112 { 94 113 //Defaults 95 $instance = wp_parse_args( (array) $instance, 96 array( 97 'title' => '', 98 'homelink' => get_option( 'blogname'),114 $instance = wp_parse_args( (array) $instance, 115 array( 116 'title' => '', 117 'homelink' => get_option( 'blogname' ), 99 118 'maxchars' => 35, 119 'classes' => '', 100 120 ) 101 121 ); 102 122 103 $title = esc_attr( $instance['title'] ); 104 ?> 105 <p> 106 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /><br /> 107 <small>For convenience, not shown publicly</small 108 </p> 109 <?php 123 // @insane escaping of the get_field_id and get_field_name function calls is crazy talk but required by VIP 124 ?> 125 <p> 126 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title' ); ?></label> 127 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> 128 <br /> 129 <small>For convenience, not shown publicly</small> 130 </p> 131 <?php 110 132 echo $this->control_widgets( $instance ); 111 133 echo $this->control_base( $instance ); 112 134 echo $this->control_loadtime( $instance ); 113 } 114 115 function control_widgets( $instance , $whichfield = 'widget' ) 135 ?> 136 <p> 137 <label for="<?php echo esc_attr( $this->get_field_id( 'classes' ) ); ?>">CSS Classes</label> 138 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'classes' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'classes' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['classes'] ); ?>"/> 139 </p> 140 <?php 141 }// end form 142 143 public function control_widgets( $instance, $whichfield = 'widget' ) 116 144 { 117 145 // get the available widgets 118 146 $sidebars_widgets = wp_get_sidebars_widgets(); 119 $list = ''; 147 120 148 $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : ''; 121 149 $instance[ $whichfield . '-custom' ] = isset( $instance[ $whichfield . '-custom' ] ) ? $instance[ $whichfield . '-custom' ] : ''; 122 150 123 foreach( (array) $sidebars_widgets['wijax-area'] as $item ) 124 { 125 $list .= '<option value="'. $item .'" '. selected( $instance[ $whichfield ] , $item , FALSE ) .'>'. $item .'</option>'; 151 // @insane: the escaping of the scalars in the foreach and calls to get_field_id and get_field name are entirely unneeded, but required by VIP 152 153 $list = ''; 154 foreach ( (array) $sidebars_widgets['wijax-area'] as $item ) 155 { 156 $list .= '<option value="' . esc_attr( $item ) . '" ' . selected( $instance[ $whichfield ], $item, FALSE ) . '>' . esc_html( $item ) . '</option>'; 126 157 } 127 $list .= '<option value="custom" '. selected( $instance[ $whichfield ] , 'custom' , FALSE ) .'>Custom widget</option>'; 128 129 return '<p><label for="'. $this->get_field_id( $whichfield ) .'">Widget</label><select name="'. $this->get_field_name( $whichfield ) .'" id="'. $this->get_field_id( $whichfield ) .'" class="widefat">'. $list . '</select></p><p><label for="'. $this->get_field_id( $whichfield .'-custom' ) .'">Custom Widget Name</label><input name="'. $this->get_field_name( $whichfield .'-custom' ) .'" id="'. $this->get_field_id( $whichfield .'-custom' ) .'" class="widefat" type="text" value="'. sanitize_title( $instance[ $whichfield .'-custom' ] ).'"></p>'; 130 } 131 132 function control_base( $instance , $whichfield = 'base' ) 133 { 134 135 $bases = apply_filters( 'wijax-bases' , array( 158 $list .= '<option value="custom" ' . selected( $instance[ $whichfield ], 'custom', FALSE ) . '>Custom widget</option>'; 159 160 $return = ' 161 <p> 162 <label for="' . esc_attr( $this->get_field_id( $whichfield ) ) . '">Widget</label> 163 <select name="' . esc_attr( $this->get_field_name( $whichfield ) ) . '" id="' . esc_attr( $this->get_field_id( $whichfield ) ) . '" class="widefat">' . $list . '</select> 164 </p> 165 <p> 166 <label for="' . esc_attr( $this->get_field_id( $whichfield . '-custom' ) ) . '">Custom Widget Name</label> 167 <input name="' . esc_attr( $this->get_field_name( $whichfield . '-custom' ) ) . '" id="' . esc_attr( $this->get_field_id( $whichfield .'-custom' ) ) . '" class="widefat" type="text" value="' . sanitize_title( $instance[ $whichfield . '-custom' ] ) . '"> 168 </p>'; 169 170 return $return; 171 }//end control_widgets 172 173 public function control_base( $instance, $whichfield = 'base' ) 174 { 175 $bases = apply_filters( 'wijax-bases', array( 136 176 'current' => 'The currently requested URL', 137 177 'home' => 'The blog home URL', 138 178 'remote' => 'Remote base URL', 139 ) );179 ) ); 140 180 141 181 $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : ''; 142 182 $instance[ $whichfield . '-remote' ] = isset( $instance[ $whichfield . '-remote' ] ) ? $instance[ $whichfield . '-remote' ] : ''; 143 183 184 // @insane: the escaping of the scalars in the foreach and calls to get_field_id and get_field name are entirely unneeded, but required by VIP 185 144 186 $list = ''; 145 foreach( (array) $bases as $k => $v ) 146 $list .= '<option value="'. $k .'" '. selected( $instance[ $whichfield ] , $k , FALSE ) .'>'. $v .'</option>'; 147 148 return '<p><label for="'. $this->get_field_id( $whichfield ) .'">Base URL</label><select name="'. $this->get_field_name( $whichfield ) .'" id="'. $this->get_field_id( $whichfield ) .'" class="widefat">'. $list . '</select><br /><small>The base URL affects widget content and caching</small></p><p><label for="'. $this->get_field_id( $whichfield .'-remote' ) .'">Remote Base URL</label><input name="'. $this->get_field_name( $whichfield .'-remote' ) .'" id="'. $this->get_field_id( $whichfield .'-remote' ) .'" class="widefat" type="text" value="'. esc_url( $instance[ $whichfield .'-remote' ] ).'"></p>'; 149 } 150 151 function control_loadtime( $instance , $whichfield = 'loadtime' ) 152 { 153 154 $loadtimes = apply_filters( 'wijax-loadtime' , array( 187 foreach ( (array) $bases as $k => $v ) 188 { 189 $list .= '<option value="' . esc_attr( $k ) . '" ' . selected( $instance[ $whichfield ], $k, FALSE ) . '>' . esc_html( $v ) . '</option>'; 190 }// end foreach 191 192 $return = ' 193 <p> 194 <label for="' . esc_attr( $this->get_field_id( $whichfield ) ) . '">Base URL</label> 195 <select name="' . esc_attr( $this->get_field_name( $whichfield ) ) .'" id="' . esc_attr( $this->get_field_id( $whichfield ) ) .'" class="widefat">'. $list . '</select> 196 <br /> 197 <small>The base URL affects widget content and caching</small> 198 </p> 199 <p> 200 <label for="' . esc_attr( $this->get_field_id( $whichfield . '-remote' ) ) . '">Remote Base URL</label> 201 <input name="' . esc_attr( $this->get_field_name( $whichfield . '-remote' ) ) . '" id="' . esc_attr( $this->get_field_id( $whichfield .'-remote' ) ) . '" class="widefat" type="text" value="' . esc_url( $instance[ $whichfield .'-remote' ] ) . '"> 202 </p>'; 203 204 return $return; 205 }// end control_base 206 207 public function control_loadtime( $instance, $whichfield = 'loadtime' ) 208 { 209 $loadtimes = apply_filters( 'wijax-loadtime', array( 155 210 'onload' => 'Load content immediately when page loads', 156 211 'onscroll' => 'Wait for user to scroll page to load content', 157 ) );212 ) ); 158 213 159 214 $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : ''; 160 215 216 // @insane: the escaping of the scalars in the foreach and calls to get_field_id and get_field name are entirely unneeded, but required by VIP 217 161 218 $list = ''; 162 foreach( (array) $loadtimes as $k => $v ) 163 $list .= '<option value="'. $k .'" '. selected( $instance[ $whichfield ] , $k , FALSE ) .'>'. $v .'</option>'; 164 165 return '<p><label for="'. $this->get_field_id( $whichfield ) .'">Loadtime</label><select name="'. $this->get_field_name( $whichfield ) .'" id="'. $this->get_field_id( $whichfield ) .'" class="widefat">'. $list . '</select><br /><small>Consider waiting to load content below the fold</small></p>'; 166 } 219 foreach ( (array) $loadtimes as $k => $v ) 220 { 221 $list .= '<option value="' . esc_attr( $k ) . '" ' . selected( $instance[ $whichfield ], $k, FALSE ) . '>' . esc_html( $v ) . '</option>'; 222 }// end foreach 223 224 $return = ' 225 <p> 226 <label for="' . esc_attr( $this->get_field_id( $whichfield ) ) . '">Loadtime</label> 227 <select name="' . esc_attr( $this->get_field_name( $whichfield ) ) . '" id="' . esc_attr( $this->get_field_id( $whichfield ) ) . '" class="widefat">' . $list . '</select> 228 <br /> 229 <small>Consider waiting to load content below the fold</small> 230 </p>'; 231 232 return $return; 233 }//end control_loadtime 167 234 }// end bCMS_Wijax_Widget -
bcms/trunk/components/class-bcms-wijax.php
r892385 r980909 283 283 <script type="text/javascript"> 284 284 var wijax_widget_reload = true; 285 var wijax_queue = { 286 max_allowed_requests: 3, 287 timer: false, 288 processing: [], 289 processed: [], 290 queued: [], 291 process: function( set_timer ) { 292 if ( false !== set_timer ) { 293 set_timer = true; 294 }//end if 295 296 // allow X wijax requests to process 297 while ( 298 wijax_queue.processing.length < wijax_queue.max_allowed_requests 299 && wijax_queue.queued.length > 0 300 ) { 301 var item = wijax_queue.queued.shift(); 302 303 jQuery.ajax( item ); 304 305 wijax_queue.processing.push( item ); 306 }//end while 307 308 if ( ! wijax_queue.queued.length ) { 309 wijax_queue.timer = false; 310 return; 311 }//end if 312 313 if ( set_timer ) { 314 wijax_queue.timer = setTimeout( wijax_queue.process, 300 ); 315 }//end if 316 },// end process 317 mark_as_processed: function( url ) { 318 // find the wijax request that completed 319 for ( var i in wijax_queue.processing ) { 320 // if the URLs don't match, then this wasn't the request that just completed 321 if ( wijax_queue.processing[ i ].url != url ) { 322 continue; 323 }//end if 324 325 // stick the wijax request into the processed array 326 wijax_queue.processed.push( Object.create( wijax_queue.processing[ i ] ) ); 327 328 // remove it from the processing array 329 wijax_queue.processing.splice( i, 1 ); 330 }//end for 331 } 332 }; 333 285 334 ;(function($){ 286 $.fn.myWijaxLoader = function() 287 { 335 $.fn.myWijaxLoader = function() { 288 336 var widget_source = $(this).attr('href'); 289 337 var $widget_area = $(this).closest('.wijax-loading'); … … 294 342 var title_after = unescape( opts.title_after ); 295 343 296 $.ajax({297 url: widget_source, 344 wijax_queue.queued.push({ 345 url: widget_source, 298 346 dataType: 'script', 299 347 cache: true, 348 complete: function() { 349 wijax_queue.mark_as_processed( widget_source ); 350 }, 300 351 success: function() { 301 352 // insert the fetched markup … … 320 371 $widget_parent.removeClass( 'widget_wijax' ); 321 372 $widget_attr_el.remove(); 322 373 323 374 // trigger an event in case anything else needs to know when this widget has loaded 324 375 $( document ).trigger( 'wijax-loaded', [ widget_id ] ); 325 376 } 326 377 }); 378 379 // for each queuing of a wijax request, pass in a boolean that indicates whether or not 380 // to start a new setTimeout 381 wijax_queue.process( ! wijax_queue.timer ); 327 382 }; 328 383 -
bcms/trunk/components/cms-widgets.php
r717625 r980909 7 7 class bSuite_Widget_Pages extends WP_Widget { 8 8 9 function bSuite_Widget_Pages() { 10 $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A buncha yo blog’s WordPress Pages') ); 11 $this->WP_Widget('pages', __('Pages'), $widget_ops); 9 function bSuite_Widget_Pages() 10 { 11 $widget_ops = array( 'classname' => 'widget_pages', 'description' => __( 'A buncha yo blog’s WordPress Pages' ) ); 12 $this->WP_Widget( 'pages', __( 'Pages' ), $widget_ops ); 12 13 } 13 14 14 function widget( $args, $instance ) { 15 extract( $args ); 16 17 if( $instance['startpage'] < 0 || $instance['startpage'] === 'c' ) 18 { 19 if( ! is_singular() ) // can't generate a menu in this situation 15 function widget( $args, $instance ) 16 { 17 if ( $instance['startpage'] < 0 || $instance['startpage'] === 'c' ) 18 { 19 if ( ! is_singular() ) // can't generate a menu in this situation 20 20 return; 21 } 22 23 if ( is_singular() )21 }//end if 22 23 if ( is_singular() ) 24 24 { 25 25 $post = get_post( get_queried_object_id() ); // getting the post for use later 26 26 27 if( $post->post_parent && ( ! isset( $post->ancestors ) || ! count( $post->ancestors ) ))27 if( $post->post_parent && ( ! isset( $post->ancestors ) || ! count( $post->ancestors ) ) ) 28 28 { // the post has a parent, but the ancestors array is unset or empty 29 29 unset( $post->ancestors ); … … 32 32 } 33 33 echo '<!-- pages_widget: this appears to be page ID '. $post->ID .' with '. count( $post->ancestors ) .' ancestors -->'; 34 } 35 36 if ( is_404() )34 }//end if 35 36 if ( is_404() ) 37 37 $instance['expandtree'] = 0; 38 38 39 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? FALSE : $instance['title']);39 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? FALSE : $instance['title'] ); 40 40 $homelink = empty( $instance['homelink'] ) ? '' : $instance['homelink']; 41 41 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; … … 43 43 $depth = isset( $instance['depth'] ) ? $instance['depth'] : 1; 44 44 45 if ( $instance['startpage'] < 0 )45 if ( $instance['startpage'] < 0 ) 46 46 { 47 47 // get the ancestor tree, including the current page 48 48 $ancestors = $post->ancestors; 49 array_unshift( $ancestors , $post->ID ); //append the current page to the ancestors array in the correct order49 array_unshift( $ancestors, $post->ID ); //append the current page to the ancestors array in the correct order 50 50 51 51 // reverse the array so the slice can return empty if startpage is larger than the array 52 $startpage = current( array_slice( array_reverse( (array) $ancestors ) , absint( $instance['startpage'] ) -1 , 1 ));53 if ( ! $startpage )52 $startpage = current( array_slice( array_reverse( (array) $ancestors ), absint( $instance['startpage'] ) -1, 1 ) ); 53 if ( ! $startpage ) 54 54 return; 55 } 56 else if( $instance['startpage'] >= 0 )55 }//end if 56 elseif ( $instance['startpage'] >= 0 ) 57 57 { 58 58 $startpage = $instance['startpage']; 59 59 } 60 else if( $instance['startpage'] == 'c' )60 elseif ( $instance['startpage'] == 'c' ) 61 61 { 62 62 $startpage = $post->ID; … … 72 72 'sort_column' => $sortby, 73 73 'exclude' => $exclude, 74 'depth' => $depth 75 ) );76 77 if ( $instance['expandtree'] && ( $instance['startpage'] >= 0 ) && is_page() )74 'depth' => $depth, 75 ) ); 76 77 if ( $instance['expandtree'] && ( $instance['startpage'] >= 0 ) && is_page() ) 78 78 { 79 79 // get the ancestor tree, including the current page 80 80 $ancestors = $post->ancestors; 81 81 $ancestors[] = $post->ID; 82 $pages = get_pages( array( 'include' => implode( ',', $ancestors ))); 83 84 if ( !empty( $pages )){ 82 $pages = get_pages( array( 'include' => implode( ',', $ancestors ) ) ); 83 84 if ( ! empty( $pages ) ) 85 { 85 86 $subtree .= walk_page_tree( $pages, 0, $post->ID, array() ); 86 87 87 88 // get any siblings, insert them into the tree 88 if( count( $post->ancestors ) && ( $siblings = wp_list_pages( array( 'child_of' => array_shift( $ancestors ), 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => 1 )))){ 89 if ( count( $post->ancestors ) && ( $siblings = wp_list_pages( array( 'child_of' => array_shift( $ancestors ), 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => 1 ) ) ) ) 90 { 89 91 $subtree = preg_replace( '/<li.+?current_page_item.+?<\/li>/i', $siblings, $subtree ); 90 92 } 91 93 92 94 // get any children, insert them into the tree 93 if( $children = wp_list_pages( array( 'child_of' => $post->ID, 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => $depth ))){ 95 if ( $children = wp_list_pages( array( 'child_of' => $post->ID, 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => $depth ) ) ) 96 { 94 97 $subtree = preg_replace( '/current_page_item[^<]*<a([^<]*)/i', 'current_page_item"><a\1<ul>'. $children .'</ul>', $subtree ); 95 98 } 96 99 97 100 // insert this extended page tree into the larger list 98 if( !empty( $subtree )){ 101 if ( ! empty( $subtree ) ) 102 { 99 103 $out = preg_replace( '/<li[^>]*page-item-'. ( count( $post->ancestors ) ? end( $post->ancestors ) : $post->ID ) .'[^0-9][^>]*.*?<\/li>.*?($|<li)/si', $subtree .'\1', $out ); 100 104 reset( $post->ancestors ); 101 105 } 102 } 103 } 104 105 if ( !empty( $out ) ) { 106 echo $before_widget; 106 }//end if 107 }//end if 108 109 if ( ! empty( $out ) ) 110 { 111 echo $args['before_widget']; 107 112 if ( $title ) 108 echo $ before_title . $title . $after_title;113 echo $args['before_title'] . $title . $args['after_title']; 109 114 ?> 110 115 <ul> 111 116 <?php if ( $homelink ) 112 echo '<li class="page_item page_item-home"><a href="'. get_option( 'home') .'">'. $homelink .'</a></li>';117 echo '<li class="page_item page_item-home"><a href="'. get_option( 'home' ) .'">'. $homelink .'</a></li>'; 113 118 ?> 114 119 <?php echo $out; ?> 115 120 </ul> 116 121 <?php 117 echo $a fter_widget;118 } 119 } 122 echo $args['after_widget']; 123 }//end if 124 }//end widget 120 125 121 126 function update( $new_instance, $old_instance ) { … … 134 139 135 140 return $instance; 136 } 141 }//end update 137 142 138 143 function form( $instance ) { … … 204 209 </p> 205 210 <?php 206 } 211 }//end form 207 212 }// end bSuite_Widget_Pages 208 213 … … 220 225 } 221 226 222 function widget( $args, $instance ) {223 extract( $args );224 225 if ( is_tax() || is_tag() || is_category() )227 function widget( $args, $instance ) 228 { 229 230 if ( is_tax() || is_tag() || is_category() ) 226 231 $category_description = term_description(); 227 232 else … … 230 235 global $wp_query; 231 236 $term = $wp_query->get_queried_object(); 232 $my_tag = &get_term( $term->term_id , $term->taxonomy , OBJECT, 'display' );237 $my_tag = &get_term( $term->term_id, $term->taxonomy, OBJECT, 'display' ); 233 238 234 239 if ( is_wp_error( $my_tag ) ) 235 240 return false; 236 241 237 $my_tag_name = $my_tag->name;242 $my_tag_name = $my_tag->name; 238 243 // $my_tag_name = apply_filters( 'single_tag_title' , $my_tag->name ); 239 244 … … 241 246 $title = str_ireplace( '%term_name%', '<span class="term-name">'. $my_tag_name .'</span>', $title ); 242 247 243 echo $ before_widget;248 echo $args['before_widget']; 244 249 if ( $title ) 245 echo $ before_title . $title . $after_title;250 echo $args['before_title'] . $title . $args['after_title']; 246 251 if ( ! empty( $category_description ) ) 247 252 echo '<div class="archive-meta">' . $category_description . '</div>'; 248 253 echo '<div class="clear"></div>'; 249 echo $a fter_widget;250 } 254 echo $args['after_widget']; 255 }//end widget 251 256 252 257 function update( $new_instance, $old_instance ) { … … 255 260 256 261 return $instance; 257 } 262 }//end update 258 263 259 264 function form( $instance ) { … … 272 277 </p> 273 278 <?php 274 } 279 }//end form 275 280 }// end bSuite_Widget_CategoryDescription 276 281 … … 288 293 } 289 294 290 function widget( $args, $instance ) { 291 extract( $args ); 292 295 function widget( $args, $instance ) 296 { 293 297 wp_reset_query(); 294 298 295 299 global $wp_query; 296 300 297 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title']);301 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] ); 298 302 $maxchars = absint( $instance['maxchars'] ) > 10 ? absint( $instance['maxchars'] ) : 10; 299 303 300 304 $crumbs = array(); 301 305 302 if( !empty( $instance['homelink'] )) 303 $crumbs[] = '<li class="bloghome"><a href="'. get_option('home') .'">'. $instance['homelink'] .'</a></li>'; 304 305 if( is_singular() ){ 306 if ( ! empty( $instance['homelink'] ) ) 307 $crumbs[] = '<li class="bloghome"><a href="'. get_option( 'home' ) .'">'. $instance['homelink'] .'</a></li>'; 308 309 if ( is_singular() ) 310 { 306 311 setup_postdata( $wp_query->post ); 307 312 global $post, $page, $multipage; … … 309 314 // get the ancestor tree, if exists 310 315 $ancestors = array(); 311 if( is_array( $post->ancestors )){ 312 foreach( array_reverse( $post->ancestors ) as $post_id ){ 316 if ( is_array( $post->ancestors ) ) 317 { 318 foreach ( array_reverse( $post->ancestors ) as $post_id ) 319 { 313 320 $crumbs[] = '<li><a href="'. get_permalink( $post_id ) .'" 314 rel="bookmark" title="'. sprintf( __( 'Permanent Link to %s') , esc_attr( strip_tags( get_the_title( $post_id )))) .' ">'. ( strlen( get_the_title( $post_id )) > $maxchars ? trim( substr( get_the_title( $post_id ), 0, $maxchars )) .'…' : get_the_title( $post_id ) ) .'</a></li>';321 rel="bookmark" title="'. sprintf( __( 'Permanent Link to %s' ), esc_attr( strip_tags( get_the_title( $post_id ) ) ) ) .' ">'. ( strlen( get_the_title( $post_id ) ) > $maxchars ? trim( substr( get_the_title( $post_id ), 0, $maxchars ) ) .'…' : get_the_title( $post_id ) ) .'</a></li>'; 315 322 } 316 323 } 317 324 318 325 // add the current page to the tree 319 $crumbs[] = '<li class="'. $post->post_type .'_item '. $post->post_type .'-item-'. $post->ID .' current_'. $post->post_type .'_item" ><a href="'. get_permalink( $post->ID ) .'" rel="bookmark" title="'. sprintf( __( 'Permanent Link to %s') , esc_attr( strip_tags( get_the_title( $post->ID )))) .'">'. ( strlen( get_the_title( $post->ID )) > $maxchars ? trim( substr( get_the_title( $post->ID ), 0, $maxchars )) .'…' : get_the_title( $post->ID ) ) .'</a></li>';326 $crumbs[] = '<li class="'. $post->post_type .'_item '. $post->post_type .'-item-'. $post->ID .' current_'. $post->post_type .'_item" ><a href="'. get_permalink( $post->ID ) .'" rel="bookmark" title="'. sprintf( __( 'Permanent Link to %s' ), esc_attr( strip_tags( get_the_title( $post->ID ) ) ) ) .'">'. ( strlen( get_the_title( $post->ID ) ) > $maxchars ? trim( substr( get_the_title( $post->ID ), 0, $maxchars ) ) .'…' : get_the_title( $post->ID ) ) .'</a></li>'; 320 327 321 328 //if this is a multi-page post/page... 322 if ( $multipage ){323 329 if ( $multipage ) 330 { 324 331 // generate a permalink to this page 325 if ( 1 == $page ) { 332 if ( 1 == $page ) 333 { 326 334 $link = get_permalink( $post->ID ); 327 } else { 328 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 335 } 336 else 337 { 338 if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ) ) ) 329 339 $link = get_permalink( $post->ID ) . '&page='. $page; 330 340 else 331 $link = trailingslashit( get_permalink( $post->ID ) ) . user_trailingslashit( $page, 'single_paged' );341 $link = trailingslashit( get_permalink( $post->ID ) ) . user_trailingslashit( $page, 'single_paged' ); 332 342 } 333 343 334 344 // add it to the crumbs 335 $crumbs[] = '<li class="'. $post->post_type .'_item '. $post->post_type .'-item-'. $post->ID .' current_'. $post->post_type .'_item" ><a href="'. $link .'" rel="bookmark" title="'. sprintf( __('Permanent Link to page %d of %s') , (int) $page , esc_attr( strip_tags( get_the_title( $post->ID ))) ) .'">'. sprintf( __('Page %d') , (int) $page ) .'</a></li>'; 336 } 337 }else{ 338 339 if( is_search() ) 340 $crumbs[] = '<li><a href="'. $link .'">'. __('Search') .'</a></li>'; 345 $crumbs[] = '<li class="'. $post->post_type .'_item '. $post->post_type .'-item-'. $post->ID .' current_'. $post->post_type .'_item" ><a href="'. $link .'" rel="bookmark" title="'. sprintf( __( 'Permanent Link to page %d of %s' ), (int) $page, esc_attr( strip_tags( get_the_title( $post->ID ) ) ) ) .'">'. sprintf( __( 'Page %d' ), (int) $page ) .'</a></li>'; 346 }//end if 347 }//end if 348 else 349 { 350 if ( is_search() ) 351 $crumbs[] = '<li><a href="'. $link .'">'. __( 'Search' ) .'</a></li>'; 341 352 342 353 // if( is_paged() && $wp_query->query_vars['paged'] > 1 ) 343 354 // $page_text = sprintf( __('Page %d') , $wp_query->query_vars['paged'] ); 344 } 345 346 if ( count( $crumbs ) ) { 347 echo $before_widget; 355 }//end else 356 357 if ( count( $crumbs ) ) 358 { 359 echo $args['before_widget']; 348 360 // if ( $title ) 349 // echo $ before_title . $title . $after_title;361 // echo $args['before_title'] . $title . $args['after_title']; 350 362 ?> 351 363 <ul> … … 354 366 <div class="clear"></div> 355 367 <?php 356 echo $a fter_widget;357 } 358 } 368 echo $args['after_widget']; 369 }//end if 370 }//end widget 359 371 360 372 function update( $new_instance, $old_instance ) { … … 365 377 366 378 return $instance; 367 } 379 }//end update 368 380 369 381 function form( $instance ) { … … 389 401 </p> 390 402 <?php 391 } 403 }//end form 392 404 }// end bSuite_Widget_Crumbs 393 394 395 405 396 406 /** … … 400 410 class bSuite_Widget_Pagednav extends WP_Widget { 401 411 402 function bSuite_Widget_Pagednav() { 403 $widget_ops = array('classname' => 'widget_pagednav', 'description' => __( 'Prev/Next page navigation') ); 404 $this->WP_Widget('pagednav', __('Paged Navigation Links'), $widget_ops); 412 function bSuite_Widget_Pagednav() 413 { 414 $widget_ops = array( 'classname' => 'widget_pagednav', 'description' => __( 'Prev/Next page navigation' ) ); 415 $this->WP_Widget( 'pagednav', __( 'Paged Navigation Links' ), $widget_ops ); 405 416 } 406 417 407 function widget( $args, $instance ) { 408 extract( $args ); 409 418 function widget( $args, $instance ) 419 { 410 420 wp_reset_query(); 411 421 412 422 global $wp_query, $wp_rewrite; 413 423 414 if ( ! $wp_query->is_singular )415 { 416 $urlbase = preg_replace( '#/page/[0-9]+?(/+)?$#' , '/', remove_query_arg( 'paged' ) );417 $prettylinks = ( $wp_rewrite->using_permalinks() && ( ! strpos( $urlbase , '?' )));424 if ( ! $wp_query->is_singular ) 425 { 426 $urlbase = preg_replace( '#/page/[0-9]+?(/+)?$#', '/', remove_query_arg( 'paged' ) ); 427 $prettylinks = ( $wp_rewrite->using_permalinks() && ( ! strpos( $urlbase, '?' ) ) ); 418 428 419 429 $opts = array( 420 430 'base' => $urlbase . '%_%', 421 'format' => $prettylinks ? user_trailingslashit( trailingslashit( 'page/%#%' ) ) : ( strpos( $urlbase, '?' ) ? '&paged=%#%' : '?paged=%#%' ),431 'format' => $prettylinks ? user_trailingslashit( trailingslashit( 'page/%#%' ) ) : ( strpos( $urlbase, '?' ) ? '&paged=%#%' : '?paged=%#%' ), 422 432 'total' => absint( $wp_query->max_num_pages ), 423 433 'current' => absint( $wp_query->query_vars['paged'] ) ? absint( $wp_query->query_vars['paged'] ) : 1, … … 433 443 434 444 if ( $page_links ) 435 echo $ before_widget . $page_links .'<div class="clear"></div>'. $after_widget;436 } 445 echo $args['before_widget'] . $page_links .'<div class="clear"></div>'. $args['after_widget']; 446 }//end if 437 447 else 438 448 { 439 echo $ before_widget;449 echo $args['before_widget']; 440 450 ?> 441 <div class="alignleft"><?php previous_post_link( '« %link') ?></div>442 <div class="alignright"><?php next_post_link( '%link »') ?></div>451 <div class="alignleft"><?php previous_post_link( '« %link' ) ?></div> 452 <div class="alignright"><?php next_post_link( '%link »' ) ?></div> 443 453 <div class="clear"></div> 444 454 <?php 445 echo $a fter_widget;446 } 447 } 455 echo $args['after_widget']; 456 }//end else 457 }//end widget 448 458 449 459 function form( $instance ) { … … 466 476 </p> 467 477 <?php 468 } 478 }//end form 469 479 }// end bSuite_Widget_Pagednav -
bcms/trunk/components/listchildren.php
r717625 r980909 3 3 class bSuite_List_Children 4 4 { 5 5 6 6 function __construct() 7 7 { … … 16 16 // [pagemenu ] 17 17 global $id; 18 18 19 19 $arg = shortcode_atts( array( 20 20 'title' => 'Contents', … … 37 37 'post_status' => 'publish' 38 38 ), $arg ); 39 39 40 40 $prefix = $suffix = ''; 41 41 if( $arg['div_class'] ){ … … 62 62 } 63 63 } 64 64 65 65 if(( $arg['excerpt'] ) || ( $arg['icon'] )){ 66 66 $this->list_pages->show_excerpt = $arg['excerpt']; … … 70 70 return( $prefix . ( $arg['show_parent'] ? '<li class="page_item page_item-parent"><a href="'. get_permalink( $arg['child_of'] ) .'">'. get_the_title( $arg['child_of'] ) .'</a></li>' : '' ) . wp_list_pages( $arg ) . $suffix ); 71 71 } 72 72 73 73 function list_pages_callback( $arg ) 74 74 { 75 75 global $id, $post , $bsuite; 76 76 77 77 if( $this->list_pages->show_excerpt ){ 78 78 $post_orig = unserialize( serialize( $post )); // how else to prevent passing object by reference? 79 79 $id_orig = $id; 80 80 81 81 $post = get_post( $arg[1] ); 82 82 $id = $post->ID; 83 84 $content = ( $this->list_pages->show_icon ? '<a href="'. get_permalink( $arg[1] ) .'" class="bsuite_post_icon_link" rel="bookmark" title="Permanent Link to '. attribute_escape( get_the_title( $arg[1] )) .'">'. $bsuite->icon_get_h( $arg[1] , 's' ) .'</a>' : '' ) . apply_filters( 'the_content', get_post_field( 'post_excerpt', $arg[1] ));85 83 84 $content = ( $this->list_pages->show_icon ? '<a href="'. get_permalink( $arg[1] ) .'" class="bsuite_post_icon_link" rel="bookmark" title="Permanent Link to '. esc_attr( get_the_title( $arg[1] )) .'">'. $bsuite->icon_get_h( $arg[1] , 's' ) .'</a>' : '' ) . apply_filters( 'the_content', get_post_field( 'post_excerpt', $arg[1] )); 85 86 86 $post = $post_orig; 87 87 $id = $id_orig; 88 88 89 89 if( 5 < strlen( $content )) 90 90 return( $arg[0] .'<ul><li class="page_excerpt page_excerpt-'. $arg[1] .'">'. $content .'</li></ul>' ); 91 91 return( $arg[0] ); 92 92 93 93 }else{ 94 94 $content = apply_filters( 'the_content', get_post_field( 'post_excerpt', $arg[1] )); 95 return( $arg[0] .'<ul><li class="page_icon page_icon-'. $arg[1] .'"><a href="'. get_permalink( $arg[1] ) .'" class="bsuite_post_icon_link" rel="bookmark" title="Permanent Link to '. attribute_escape( get_the_title( $arg[1] )) .'">'. $bsuite->icon_get_h( $arg[1] , 's' ) .'</a></li></ul>' );96 95 return( $arg[0] .'<ul><li class="page_icon page_icon-'. $arg[1] .'"><a href="'. get_permalink( $arg[1] ) .'" class="bsuite_post_icon_link" rel="bookmark" title="Permanent Link to '. esc_attr( get_the_title( $arg[1] )) .'">'. $bsuite->icon_get_h( $arg[1] , 's' ) .'</a></li></ul>' ); 96 97 97 } 98 98 99 99 } 100 101 function list_attachments( $attr)100 101 function list_attachments( $attr ) 102 102 { 103 103 global $post; 104 104 105 /* 105 /* 106 106 // Allow plugins/themes to override the default gallery template. 107 107 $output = apply_filters('post_gallery', '', $attr); 108 108 if ( $output != '' ) 109 109 return $output; 110 */ 110 */ 111 111 // We're trusting author input, so let's at least make sure it looks like a valid orderby statement 112 if ( isset( $attr['orderby'] ) ) { 112 if ( isset( $attr['orderby'] ) ) 113 { 113 114 $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); 114 if ( !$attr['orderby'] ) 115 if ( ! $attr['orderby'] ) 116 { 115 117 unset( $attr['orderby'] ); 116 } 118 }//end if 119 }//end if 117 120 118 extract(shortcode_atts( array(121 $attr = shortcode_atts( array( 119 122 'order' => 'ASC', 120 123 'orderby' => 'menu_order ID', 121 124 'id' => $post->ID, 122 'post_mime_type' => FALSE ,125 'post_mime_type' => FALSE, 123 126 /* 124 127 'itemtag' => 'dl', … … 129 132 'post_mime_type' => 'image', 130 133 */ 131 ), $attr )); 132 133 $id = absint($id); 134 $attachments = get_children( array( 135 'post_parent' => $id , 136 'post_status' => 'inherit' , 137 'post_type' => 'attachment' , 138 'order' => $order, 139 'orderby' => $orderby, 140 )); 141 142 if ( empty( $attachments )) 134 ), $attr ); 135 136 $id = absint( $attr['id'] ); 137 $attachments = get_children( array( 138 'post_parent' => $id, 139 'post_status' => 'inherit', 140 'post_type' => 'attachment', 141 'order' => $attr['order'], 142 'orderby' => $attr['orderby'], 143 ) ); 144 145 if ( empty( $attachments ) ) 146 { 143 147 return ''; 144 148 }//end if 149 145 150 $output = "\n"; 146 151 foreach ( $attachments as $att_id => $attachment ) 147 152 $output .= '<li>'. wp_get_attachment_link( $att_id, FALSE, FALSE ) . "</li>\n"; 148 153 return '<ul>'. $output .'</ul>'; 149 150 } 151 } 154 155 }//end list_attachments 156 }//end class 152 157 153 158 $bsuite_list_children = new bSuite_List_Children; -
bcms/trunk/readme.txt
r833529 r980909 4 4 Tags: bSuite, cms, content management, formatting, widgets, shortcodes, post loop, post, posts, page, pages, show posts, scroller, featured posts 5 5 Requires at least: 3.3 6 Tested up to: 3.86 Tested up to: 4.0 7 7 Stable tag: trunk 8 8
Note: See TracChangeset
for help on using the changeset viewer.