Plugin Directory

Changeset 980909


Ignore:
Timestamp:
09/05/2014 01:47:48 AM (11 years ago)
Author:
misterbisson
Message:

Tested good in wp4, incremented version number to reflect minor improvements. Contributors:

History in github: https://github.com/misterbisson/bcms/compare/286d7a629500590f6882c1941138e8958eff5631...HEAD

Location:
bcms/trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • bcms/trunk/bcms.php

    r833529 r980909  
    44Plugin URI: http://wordpress.org/plugins/bcms/
    55Description: Make WordPress a better CMS. Create a post loop in a widget. Lazy load widgets. More shortcodes. More good.
    6 Version: 5.2
     6Version: 5.3
    77Author: Casey Bisson
    88Author URI: http://maisonbisson.com/blog/
  • bcms/trunk/components/class-bcms-postloop-scroller.php

    r717625 r980909  
    3939        // register scripts and styles
    4040        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' );
    4242        add_filter( 'print_footer_scripts', array( $this, 'print_js' ), 10, 1 );
    4343
     
    4545        {
    4646            wp_register_style( 'scrollable', $this->path_web .'/css/scrollable.css' );
    47             bcms_late_enqueue_style( 'scrollable' );
     47            wp_enqueue_style( 'scrollable' );
    4848        }
    4949    }
     
    5252    {
    5353?>
    54 <script type="text/javascript"> 
     54<script type="text/javascript">
    5555    ;(function($){
    5656        $(window).load(function(){
  • bcms/trunk/components/class-bcms-postloop-widget.php

    r833529 r980909  
    4141
    4242        $this->wijax_varname = $mywijax->encoded_name( $this->id );
    43 
    44         extract( $args );
    4543
    4644        $title = apply_filters('widget_title', empty( $instance['title'] ) ? '' : $instance['title']);
     
    484482            do_action( $action_name, 'after', $ourposts, bcms_postloop() );
    485483
     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
    486491            // new actions
    487492            bcms_postloop()->do_action( 'post', $instance['template'], 'after', $ourposts, $this, $instance );
     
    506511
    507512            // 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'] );
    509514            $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] );
    510515            if ( isset( $instance['title_show'] ) && $instance['title_show'] && $title )
    511516            {
    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>';
    513518            }//end if
    514519
    515             echo $cached->html . $after_widget;
     520            echo $cached->html . $args['after_widget'];
    516521
    517522            // 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'] )
    519524            {
    520525                $cache_data = (object) array(
     
    522527                    'template' => $cached->template,
    523528                    'instance' => $instance,
    524                     'post_ids' => bcms_postloop()->posts[ $this->number ],
     529                    'post_ids' => bcms_postloop()->posts[ $preserve['number'] ],
    525530                    'time' => time(),
    526531                );
    527                 wp_cache_set( $cachekey, $cache_data, 'bcmspostloop', $this->ttl );
     532                wp_cache_set( $cachekey, $cache_data, 'bcmspostloop', $preserve['ttl'] );
    528533                unset( $cache_data );
    529534            }//end if
     
    11941199            $instance['tax_'. $taxonomy .'_not_in'] = isset( $instance['tax_'. $taxonomy .'_not_in'] ) ? $instance['tax_'. $taxonomy .'_not_in'] : array();
    11951200            $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'] : '';
    11961202
    11971203            $tax = get_taxonomy( $taxonomy );
  • bcms/trunk/components/class-bcms-search.php

    r833529 r980909  
    358358            SELECT post_id, ( $this->relevancy_formula ) AS ftscore
    359359            FROM $this->search_table
    360             WHERE ( MATCH ( content ) AGAINST ( %s $boolean ) )
     360            WHERE ( MATCH ( content ) AGAINST ( %s ) )
    361361            ORDER BY ftscore DESC
    362362            LIMIT 0, 1250
  • bcms/trunk/components/class-bcms-wiframe-encode.php

    r717625 r980909  
    2929        header( 'X-Robots-Tag: noindex', TRUE );
    3030
    31         bcms_late_enqueue_script(
     31        wp_enqueue_script(
    3232            'jquery-postmessage',
    3333            plugins_url( 'components/js/jquery.ba-postmessage.min.js', __DIR__ ),
     
    3737        );
    3838
    39         bcms_late_enqueue_script(
     39        wp_enqueue_script(
    4040            'bcms-wiframe-notify',
    4141            plugins_url( 'components/js/bcms-wiframe-notify.js', __DIR__ ),
  • bcms/trunk/components/class-bcms-wijax-widget.php

    r717625 r980909  
    77{
    88
    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 )
    1919    {
    2020        global $mywijax;
    2121
    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            {
    2831                return;
     32            }//end if
     33
    2934            $wijax_source = $base . $mywijax->encoded_name( $instance['widget'] );
    30             $wijax_varname = $mywijax->varname( $wijax_source );
    31         }
     35        }//end if
    3236        else
    3337        {
     38            $is_local = FALSE;
    3439            $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 );
    4460        $title_class = (string) $title_class[2];
    4561
    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>
    5169            <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                ?>
    6080            </span>
    6181        </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    {
    6988        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 )
    8098    {
    8199        $instance = $old_instance;
     
    85103        $instance['base'] = sanitize_title( $new_instance['base'] );
    86104        $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'] );
    88107
    89108        return $instance;
    90     }
    91 
    92     function form( $instance )
     109    }// end update
     110
     111    public function form( $instance )
    93112    {
    94113        //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' ),
    99118                'maxchars' => 35,
     119                'classes' => '',
    100120            )
    101121        );
    102122
    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
    110132        echo $this->control_widgets( $instance );
    111133        echo $this->control_base( $instance );
    112134        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' )
    116144    {
    117145        // get the available widgets
    118146        $sidebars_widgets = wp_get_sidebars_widgets();
    119         $list = '';
     147
    120148        $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : '';
    121149        $instance[ $whichfield . '-custom' ] = isset( $instance[ $whichfield . '-custom' ] ) ? $instance[ $whichfield . '-custom' ] : '';
    122150
    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>';
    126157        }
    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(
    136176            'current' => 'The currently requested URL',
    137177            'home' => 'The blog home URL',
    138178            'remote' => 'Remote base URL',
    139         ));
     179        ) );
    140180
    141181        $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : '';
    142182        $instance[ $whichfield . '-remote' ] = isset( $instance[ $whichfield . '-remote' ] ) ? $instance[ $whichfield . '-remote' ] : '';
    143183
     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
    144186        $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(
    155210            'onload'    => 'Load content immediately when page loads',
    156211            'onscroll'  => 'Wait for user to scroll page to load content',
    157         ));
     212        ) );
    158213
    159214        $instance[ $whichfield ] = isset( $instance[ $whichfield ] ) ? $instance[ $whichfield ] : '';
    160215
     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
    161218        $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
    167234}// end bCMS_Wijax_Widget
  • bcms/trunk/components/class-bcms-wijax.php

    r892385 r980909  
    283283<script type="text/javascript">
    284284    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
    285334    ;(function($){
    286         $.fn.myWijaxLoader = function()
    287         {
     335        $.fn.myWijaxLoader = function() {
    288336            var widget_source = $(this).attr('href');
    289337            var $widget_area = $(this).closest('.wijax-loading');
     
    294342            var title_after = unescape( opts.title_after );
    295343
    296             $.ajax({
    297                 url: widget_source, 
     344            wijax_queue.queued.push({
     345                url: widget_source,
    298346                dataType: 'script',
    299347                cache: true,
     348                complete: function() {
     349                    wijax_queue.mark_as_processed( widget_source );
     350                },
    300351                success: function() {
    301352                    // insert the fetched markup
     
    320371                    $widget_parent.removeClass( 'widget_wijax' );
    321372                    $widget_attr_el.remove();
    322                    
     373
    323374                    // trigger an event in case anything else needs to know when this widget has loaded
    324375                    $( document ).trigger( 'wijax-loaded', [ widget_id ] );
    325376                }
    326377            });
     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 );
    327382        };
    328383
  • bcms/trunk/components/cms-widgets.php

    r717625 r980909  
    77class bSuite_Widget_Pages extends WP_Widget {
    88
    9     function bSuite_Widget_Pages() {
    10         $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A buncha yo blog&#8217;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&#8217;s WordPress Pages' ) );
     12        $this->WP_Widget( 'pages', __( 'Pages' ), $widget_ops );
    1213    }
    1314
    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
    2020                return;
    21         }
    22 
    23         if( is_singular() )
     21        }//end if
     22
     23        if ( is_singular() )
    2424        {
    2525            $post = get_post( get_queried_object_id() ); // getting the post for use later
    2626
    27             if( $post->post_parent && ( ! isset( $post->ancestors ) || ! count( $post->ancestors )))
     27            if( $post->post_parent && ( ! isset( $post->ancestors ) || ! count( $post->ancestors ) ) )
    2828            { // the post has a parent, but the ancestors array is unset or empty
    2929                unset( $post->ancestors );
     
    3232            }
    3333            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() )
    3737            $instance['expandtree'] = 0;
    3838
    39         $title = apply_filters('widget_title', empty( $instance['title'] ) ? FALSE : $instance['title']);
     39        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? FALSE : $instance['title'] );
    4040        $homelink = empty( $instance['homelink'] ) ? '' : $instance['homelink'];
    4141        $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
     
    4343        $depth = isset( $instance['depth'] ) ? $instance['depth'] : 1;
    4444
    45         if( $instance['startpage'] < 0 )
     45        if ( $instance['startpage'] < 0 )
    4646        {
    4747            // get the ancestor tree, including the current page
    4848            $ancestors = $post->ancestors;
    49             array_unshift( $ancestors , $post->ID ); //append the current page to the ancestors array in the correct order
     49            array_unshift( $ancestors, $post->ID ); //append the current page to the ancestors array in the correct order
    5050
    5151            // 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 )
    5454                return;
    55         }
    56         else if( $instance['startpage'] >= 0 )
     55        }//end if
     56        elseif ( $instance['startpage'] >= 0 )
    5757        {
    5858            $startpage = $instance['startpage'];
    5959        }
    60         else if( $instance['startpage'] == 'c' )
     60        elseif ( $instance['startpage'] == 'c' )
    6161        {
    6262            $startpage = $post->ID;
     
    7272                'sort_column' => $sortby,
    7373                '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() )
    7878        {
    7979            // get the ancestor tree, including the current page
    8080            $ancestors = $post->ancestors;
    8181            $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            {
    8586                $subtree .= walk_page_tree( $pages, 0, $post->ID, array() );
    8687
    8788                // 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                {
    8991                    $subtree = preg_replace( '/<li.+?current_page_item.+?<\/li>/i', $siblings, $subtree );
    9092                }
    9193
    9294                // 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                {
    9497                    $subtree = preg_replace( '/current_page_item[^<]*<a([^<]*)/i', 'current_page_item"><a\1<ul>'. $children .'</ul>', $subtree );
    9598                }
    9699
    97100                // insert this extended page tree into the larger list
    98                 if( !empty( $subtree )){
     101                if ( ! empty( $subtree ) )
     102                {
    99103                    $out = preg_replace( '/<li[^>]*page-item-'. ( count( $post->ancestors ) ? end( $post->ancestors ) : $post->ID ) .'[^0-9][^>]*.*?<\/li>.*?($|<li)/si', $subtree .'\1', $out );
    100104                    reset( $post->ancestors );
    101105                }
    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'];
    107112            if ( $title )
    108                 echo $before_title . $title . $after_title;
     113                echo $args['before_title'] . $title . $args['after_title'];
    109114        ?>
    110115        <ul>
    111116            <?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>';
    113118            ?>
    114119            <?php echo $out; ?>
    115120        </ul>
    116121        <?php
    117             echo $after_widget;
    118         }
    119     }
     122            echo $args['after_widget'];
     123        }//end if
     124    }//end widget
    120125
    121126    function update( $new_instance, $old_instance ) {
     
    134139
    135140        return $instance;
    136     }
     141    }//end update
    137142
    138143    function form( $instance ) {
     
    204209        </p>
    205210<?php
    206     }
     211    }//end form
    207212}// end bSuite_Widget_Pages
    208213
     
    220225    }
    221226
    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() )
    226231            $category_description = term_description();
    227232        else
     
    230235        global $wp_query;
    231236        $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' );
    233238
    234239        if ( is_wp_error( $my_tag ) )
    235240            return false;
    236241
    237         $my_tag_name =  $my_tag->name;
     242        $my_tag_name = $my_tag->name;
    238243//      $my_tag_name = apply_filters( 'single_tag_title' , $my_tag->name );
    239244
     
    241246        $title = str_ireplace( '%term_name%', '<span class="term-name">'. $my_tag_name .'</span>', $title );
    242247
    243         echo $before_widget;
     248        echo $args['before_widget'];
    244249        if ( $title )
    245             echo $before_title . $title . $after_title;
     250            echo $args['before_title'] . $title . $args['after_title'];
    246251        if ( ! empty( $category_description ) )
    247252            echo '<div class="archive-meta">' . $category_description . '</div>';
    248253        echo '<div class="clear"></div>';
    249         echo $after_widget;
    250     }
     254        echo $args['after_widget'];
     255    }//end widget
    251256
    252257    function update( $new_instance, $old_instance ) {
     
    255260
    256261        return $instance;
    257     }
     262    }//end update
    258263
    259264    function form( $instance ) {
     
    272277        </p>
    273278<?php
    274     }
     279    }//end form
    275280}// end bSuite_Widget_CategoryDescription
    276281
     
    288293    }
    289294
    290     function widget( $args, $instance ) {
    291         extract( $args );
    292 
     295    function widget( $args, $instance )
     296    {
    293297        wp_reset_query();
    294298
    295299        global $wp_query;
    296300
    297         $title = apply_filters('widget_title', empty( $instance['title'] ) ? '' : $instance['title']);
     301        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] );
    298302        $maxchars = absint( $instance['maxchars'] ) > 10 ? absint( $instance['maxchars'] ) : 10;
    299303
    300304        $crumbs = array();
    301305
    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        {
    306311            setup_postdata( $wp_query->post );
    307312            global $post, $page, $multipage;
     
    309314            // get the ancestor tree, if exists
    310315            $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                {
    313320                    $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 )) .'&#8230;' : 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 ) ) .'&#8230;' : get_the_title( $post_id ) ) .'</a></li>';
    315322                }
    316323            }
    317324
    318325            // 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 )) .'&#8230;' : 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 ) ) .'&#8230;' : get_the_title( $post->ID ) ) .'</a></li>';
    320327
    321328            //if this is a multi-page post/page...
    322             if( $multipage ){
    323 
     329            if ( $multipage )
     330            {
    324331                // generate a permalink to this page
    325                 if ( 1 == $page ) {
     332                if ( 1 == $page )
     333                {
    326334                    $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' ) ) )
    329339                        $link = get_permalink( $post->ID ) . '&amp;page='. $page;
    330340                    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' );
    332342                }
    333343
    334344                // 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>';
    341352
    342353//          if( is_paged() && $wp_query->query_vars['paged'] > 1 )
    343354//              $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'];
    348360//          if ( $title )
    349 //              echo $before_title . $title . $after_title;
     361//              echo $args['before_title'] . $title . $args['after_title'];
    350362        ?>
    351363            <ul>
     
    354366            <div class="clear"></div>
    355367        <?php
    356             echo $after_widget;
    357         }
    358     }
     368            echo $args['after_widget'];
     369        }//end if
     370    }//end widget
    359371
    360372    function update( $new_instance, $old_instance ) {
     
    365377
    366378        return $instance;
    367     }
     379    }//end update
    368380
    369381    function form( $instance ) {
     
    389401        </p>
    390402<?php
    391     }
     403    }//end form
    392404}// end bSuite_Widget_Crumbs
    393 
    394 
    395405
    396406/**
     
    400410class bSuite_Widget_Pagednav extends WP_Widget {
    401411
    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 );
    405416    }
    406417
    407     function widget( $args, $instance ) {
    408         extract( $args );
    409 
     418    function widget( $args, $instance )
     419    {
    410420        wp_reset_query();
    411421
    412422        global $wp_query, $wp_rewrite;
    413423
    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, '?' ) ) );
    418428
    419429            $opts = array(
    420430                'base' => $urlbase . '%_%',
    421                 'format' => $prettylinks ? user_trailingslashit( trailingslashit( 'page/%#%' )) : ( strpos( $urlbase , '?' ) ? '&paged=%#%' : '?paged=%#%' ),
     431                'format' => $prettylinks ? user_trailingslashit( trailingslashit( 'page/%#%' ) ) : ( strpos( $urlbase, '?' ) ? '&paged=%#%' : '?paged=%#%' ),
    422432                'total' => absint( $wp_query->max_num_pages ),
    423433                'current' => absint( $wp_query->query_vars['paged'] ) ? absint( $wp_query->query_vars['paged'] ) : 1,
     
    433443
    434444            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
    437447        else
    438448        {
    439             echo $before_widget;
     449            echo $args['before_widget'];
    440450?>
    441             <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    442             <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
     451            <div class="alignleft"><?php previous_post_link( '&laquo; %link' ) ?></div>
     452            <div class="alignright"><?php next_post_link( '%link &raquo;' ) ?></div>
    443453            <div class="clear"></div>
    444454<?php
    445             echo $after_widget;
    446         }
    447     }
     455            echo $args['after_widget'];
     456        }//end else
     457    }//end widget
    448458
    449459    function form( $instance ) {
     
    466476        </p>
    467477        <?php
    468     }
     478    }//end form
    469479}// end bSuite_Widget_Pagednav
  • bcms/trunk/components/listchildren.php

    r717625 r980909  
    33class bSuite_List_Children
    44{
    5    
     5
    66    function __construct()
    77    {
     
    1616        // [pagemenu ]
    1717        global $id;
    18    
     18
    1919        $arg = shortcode_atts( array(
    2020            'title' => 'Contents',
     
    3737            'post_status' => 'publish'
    3838        ), $arg );
    39    
     39
    4040        $prefix = $suffix = '';
    4141        if( $arg['div_class'] ){
     
    6262            }
    6363        }
    64    
     64
    6565        if(( $arg['excerpt'] ) || ( $arg['icon'] )){
    6666            $this->list_pages->show_excerpt = $arg['excerpt'];
     
    7070        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 );
    7171    }
    72    
     72
    7373    function list_pages_callback( $arg )
    7474    {
    7575        global $id, $post , $bsuite;
    76    
     76
    7777        if( $this->list_pages->show_excerpt ){
    7878            $post_orig = unserialize( serialize( $post )); // how else to prevent passing object by reference?
    7979            $id_orig = $id;
    80    
     80
    8181            $post = get_post( $arg[1] );
    8282            $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
    8686            $post = $post_orig;
    8787            $id = $id_orig;
    88    
     88
    8989            if( 5 < strlen( $content ))
    9090                return( $arg[0] .'<ul><li class="page_excerpt page_excerpt-'. $arg[1] .'">'. $content .'</li></ul>' );
    9191            return( $arg[0] );
    92    
     92
    9393        }else{
    9494            $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
    9797        }
    98    
     98
    9999    }
    100    
    101     function list_attachments($attr)
     100
     101    function list_attachments( $attr )
    102102    {
    103103        global $post;
    104104
    105 /* 
     105/*
    106106        // Allow plugins/themes to override the default gallery template.
    107107        $output = apply_filters('post_gallery', '', $attr);
    108108        if ( $output != '' )
    109109            return $output;
    110 */ 
     110*/
    111111        // 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        {
    113114            $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
    114             if ( !$attr['orderby'] )
     115            if ( ! $attr['orderby'] )
     116            {
    115117                unset( $attr['orderby'] );
    116         }
     118            }//end if
     119        }//end if
    117120
    118         extract( shortcode_atts( array(
     121        $attr = shortcode_atts( array(
    119122            'order'      => 'ASC',
    120123            'orderby'    => 'menu_order ID',
    121124            'id'         => $post->ID,
    122             'post_mime_type' => FALSE ,
     125            'post_mime_type' => FALSE,
    123126/*
    124127            'itemtag'    => 'dl',
     
    129132            'post_mime_type' => 'image',
    130133*/
    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        {
    143147            return '';
    144    
     148        }//end if
     149
    145150        $output = "\n";
    146151        foreach ( $attachments as $att_id => $attachment )
    147152            $output .= '<li>'. wp_get_attachment_link( $att_id, FALSE, FALSE ) . "</li>\n";
    148153        return '<ul>'. $output .'</ul>';
    149    
    150     }
    151 }
     154
     155    }//end list_attachments
     156}//end class
    152157
    153158$bsuite_list_children = new bSuite_List_Children;
  • bcms/trunk/readme.txt

    r833529 r980909  
    44Tags: bSuite, cms, content management, formatting, widgets, shortcodes, post loop, post, posts, page, pages, show posts, scroller, featured posts
    55Requires at least: 3.3
    6 Tested up to: 3.8
     6Tested up to: 4.0
    77Stable tag: trunk
    88
Note: See TracChangeset for help on using the changeset viewer.