Plugin Directory

Changeset 2891911


Ignore:
Timestamp:
04/01/2023 06:03:06 PM (3 years ago)
Author:
wpweaver
Message:

Version 1.7

Location:
show-posts
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • show-posts/tags/1.7/atw-show-posts.php

    r2853140 r2891911  
    66Author: wpweaver
    77Author URI: http://weavertheme.com/about/
    8 Version: 1.6
     8Version: 1.7
    99
    1010License: GPL
     
    3131*/
    3232
    33 define ( 'WEAVER_SHOWPOSTS_VERSION','1.6');
    34 define ( 'WEAVER_SHOWPOSTS_MINIFY','.min');     // '' for dev, '.min' for production
    35 define ( 'WEAVER_SHOWPOSTS_TEMPLATE', false);      // future feature
     33const WEAVER_SHOWPOSTS_VERSION = '1.7';
     34const WEAVER_SHOWPOSTS_MINIFY = '.min';        // '' for dev, '.min' for production
     35const WEAVER_SHOWPOSTS_TEMPLATE = false;      // future feature
    3636
    3737// ===============================>>> REGISTER ACTIONS <<<===============================
     
    6363
    6464    if(  isset($page) && $page-> id!= 'atw_slider_post'  ) {
    65         echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-posts-dialog" class="thickbox button" id="add_atw_posts_posts" title="' . __("Add [show_posts]", 'show-posts') . '"><span class="dashicons dashicons-admin-post"></span> ' . __("Add [show_posts]", 'show-posts') . '</a>';
     65        echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-posts-dialog" class="thickbox button" id="add_atw_posts_posts" title="' . esc_html__("Add [show_posts]", 'show-posts') . '"><span class="dashicons dashicons-admin-post"></span> ' . __("Add [show_posts]", 'show-posts') . '</a>';
    6666        add_action( 'admin_footer', 'atw_posts_select_posts_form' );
    6767    }
    6868
    6969    if ( function_exists( 'atw_slider_installed') && isset($page) && $page->id != 'atw_slider_post' ) {
    70         echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-sliders-dialog" class="thickbox button" id="add_atw_slider_slidrs" title="' . __("Add [show_slider]", 'atw-slider') . '"><span class="dashicons dashicons-images-alt"></span></span> ' . __("Add [show_slider]", 'show-posts') . '</a>';
     70        echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-sliders-dialog" class="thickbox button" id="add_atw_slider_slidrs" title="' . esc_html__("Add [show_slider]", 'show-posts') . '"><span class="dashicons dashicons-images-alt"></span></span> ' . __("Add [show_slider]", 'show-posts') . '</a>';
    7171        add_action( 'admin_footer', 'atw_posts_select_slider_form' );
    7272    }
     
    8080?>
    8181    <div id="select-show-posts-dialog" style="display:none">
    82         <h3><?php _e('Insert [show_posts]', 'show-posts'); ?></h3>
    83         <p><?php _e('Add a [show_posts filter=specify-filter-name] into this page/post', 'show-posts'); ?></p>
     82        <h3><?php esc_html_e('Insert [show_posts]', 'show-posts'); ?></h3>
     83        <p><?php esc_html_e('Add a [show_posts filter=specify-filter-name] into this page/post', 'show-posts'); ?></p>
    8484<?php
    8585    $filters = atw_posts_getopt('filters');
     
    107107?>
    108108    <div id="select-show-sliders-dialog" style="display:none">
    109         <h3><?php _e('Insert [show_slider]', 'show-posts'); ?></h3>
    110         <p><?php _e('Add a [show_slider name=specify-slider-name] into this page/post', 'show-posts'); ?></p>
     109        <h3><?php esc_html_e('Insert [show_slider]', 'show-posts'); ?></h3>
     110        <p><?php esc_html_e('Add a [show_slider name=specify-slider-name] into this page/post', 'show-posts'); ?></p>
    111111<?php
    112112    $sliders = atw_posts_getopt('sliders');
  • show-posts/tags/1.7/includes/atw-admin-lib.php

    r1520034 r2891911  
    3838    <a style="margin-left:9em;text-decoration: none;" href="<?php echo esc_url($href); ?>">
    3939    <span class="download-link"><img src="<?php echo esc_url($download_img_path); ?>" />
    40     <?php _e('Download', 'weaver-xtreme' /*adm*/); echo '</span></a> - ';
     40    <?php esc_html_e('Download', 'weaver-xtreme' /*adm*/); echo '</span></a> - ';
    4141    echo $desc; echo ' &nbsp;';
    4242    echo 'Save as:'; echo ' ' . $filename . "<br /><br />\n";
  • show-posts/tags/1.7/includes/atw-posts-admin-top.php

    r1807568 r2891911  
    428428        $img = WP_CONTENT_URL . '/plugins/show-posts/images/donate-button.png';
    429429    ?>
    430 <div style="float:right;padding-right:30px;display:inline-block;"><div style="font-size:14px;font-weight:bold;display:inline-block;vertical-align: top;"><?php _e('Like <em>Weaver Show Posts</em>? Please', 'weaver-xtreme' /*adm*/); ?></div>&nbsp;&nbsp;<a href='//weavertheme.com/donate' target='_blank' alt='Please Donate' ><img src="<?php echo $img; ?>" alt="donate" style="max-height:28px;"/></a>
     430<div style="float:right;padding-right:30px;display:inline-block;"><div style="font-size:14px;font-weight:bold;display:inline-block;vertical-align: top;"><?php wp_kses_post(__('Like <em>Weaver Show Posts</em>? Please', 'show-posts' /*adm*/)); ?></div>&nbsp;&nbsp;<a href='//weavertheme.com/donate' target='_blank' alt='Please Donate' ><img src="<?php echo $img; ?>" alt="donate" style="max-height:28px;"/></a>
    431431</div>
    432432
  • show-posts/tags/1.7/includes/atw-posts-template.php

    r2213242 r2891911  
    257257function atw_posts_edit_post() {
    258258    $link = get_edit_post_link();
    259     return'<span class="atw-edit-link"><a class="post-edit-link" href="' . esc_html($link) . '">' .  __( 'Edit','show-posts') . '</a></span>';
     259    return'<span class="atw-edit-link"><a class="post-edit-link" href="' . esc_html($link) . '">' .  esc_html__( 'Edit','show-posts') . '</a></span>';
    260260}
    261261
     
    266266    $val = ' <div class="atw-entry-meta"> <div class="atw-entry-meta-icons">';
    267267
    268     $val .= sprintf( __(
     268    $val .= wp_kses_post(sprintf( __(
    269269'   <span class="entry-date">
    270270    <a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a>
     
    280280        esc_html( get_the_date() ),
    281281        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    282         sprintf( esc_attr(__( 'View all posts by %s','show-posts')), get_the_author() ),
    283         esc_html( get_the_author() )
    284     );
     282        esc_html(sprintf( __( 'View all posts by %s','show-posts'), esc_attr(get_the_author() ))),
     283        esc_attr( get_the_author() )
     284    ));
    285285
    286286    $val .= ' </div> </div>';
     
    295295        ' <footer class="atw-entry-utility"> <div class="atw-entry-meta-icons">' . "\n";
    296296
    297     $categories_list = get_the_category_list( __( ', ','show-posts') );
     297    $categories_list = get_the_category_list( esc_html__( ', ','show-posts') );
    298298    if ( $categories_list ) {
    299299        $val .= '  <span class="cat-links">' . $categories_list . " </span>\n";
    300300    } // End if categories
    301301
    302     $tags_list = get_the_tag_list( '', __( ', ','show-posts') );
     302    $tags_list = get_the_tag_list( '', esc_html__( ', ','show-posts') );
    303303    if ( $tags_list ) {
    304304        $val .= '  <span class="tag-links">' . $tags_list . "  </span>\n";
     
    307307    if ( comments_open() ) {
    308308        $val .= ' <span class="comments-link">';
    309         $val .= atw_posts_get_comments_popup_link( __( 'Leave a reply','show-posts'),
     309        $val .= wp_kses_post(atw_posts_get_comments_popup_link( __( 'Leave a reply','show-posts'),
    310310                __( '<b>1</b> Reply','show-posts'),
    311311                __( '<b>%</b> Replies','show-posts'),
    312                 'leave-reply');
     312                'leave-reply'));
    313313
    314314        $val .= ' </span><div style="clear:both;"></div>';
     
    331331
    332332function atw_posts_post_title_link() {
    333     return '<a href="' . get_permalink() . '" title="' . sprintf( esc_attr(__( 'Permalink to %s','show-posts')),
    334        the_title_attribute( 'echo=0' ) ). '" rel="bookmark">' .  get_the_title() . '</a>';
     333    return '<a href="' . esc_url(get_permalink()) . '" title="' . sprintf( esc_html(__( 'Permalink to %s','show-posts')),
     334       esc_attr(the_title_attribute( 'echo=0' ) )) . '" rel="bookmark">' .  esc_html(get_the_title()) . '</a>';
    335335}
    336336
     
    373373    $val = '';
    374374
    375     if ( false === $zero ) $zero = __( 'No Comments' );
    376     if ( false === $one ) $one = __( '1 Comment' );
    377     if ( false === $more ) $more = __( '% Comments' );
    378     if ( false === $none ) $none = __( 'Comments Off' );
     375    if ( false === $zero ) $zero = esc_html__( 'No Comments', 'show-posts' );
     376    if ( false === $one ) $one = esc_html__( '1 Comment', 'show-posts' );
     377    if ( false === $more ) $more = esc_html__( '% Comments', 'show-posts' );
     378    if ( false === $none ) $none = esc_html__( 'Comments Off', 'show-posts' );
    379379
    380380    $number = get_comments_number( $id );
     
    385385
    386386    if ( post_password_required() ) {
    387         return __('Enter your password to view comments.');
     387        return esc_html__('Enter your password to view comments.', 'show-posts');
    388388    }
    389389
  • show-posts/tags/1.7/includes/atw-showposts-sc.php

    r2428754 r2891911  
    22// ====================================== >>> atw_show_posts_shortcode <<< ======================================
    33
    4 function atw_show_posts_shortcode( $args = '' ) {
    5     /* implement [weaver_show_posts]  */
    6 
    7     /* DOC NOTES:
    8     CSS styling: The group of posts will be wrapped with a <div> with a class called
    9     .wvr-show-posts. You can add an additional class to that by providing a 'class=classname' option
    10     (without the leading '.' used in the actual CSS definition). You can also provide inline styling
    11     by providing a 'style=value' option where value is whatever styling you need, each terminated
    12     with a semi-colon (;).
    13 
    14     The optional header is in a <div> called .wvr_show_posts_header. You can add an additional class
    15     name with 'header_class=classname'. You can provide inline styling with 'header_style=value'.
    16 
    17     .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 40px; margin-left: 0px;}
    18     .widget-area .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;}
    19     */
    20 
    21     $opts = array(
    22         /* formatting options */
    23         'cols'                => '1',   // display posts in 1 to 3 columns
    24         'excerpt_length'      => '',    // excerpt length
    25         'hide_bottom_info'    => '',    // hide bottom info line
    26         'hide_featured_image' => '',    // hide featured image - FI is displayed by default
    27         'hide_title'          => '',    // hide the title?
    28         'hide_top_info'       => '',    // hide the top info line
    29         'show'                => '',    // show: title | excerpt | full | titlelist | title_featured
    30         'show_avatar'         => false, // show the author avatar
    31         'more_msg'            => '',    // replacement for Continue Reading excerpt message
    32         'use_paging'          => false, // Use paging when displaying multiple posts
    33         'no_top_clear'        => false  // prevent emitting clear:both
    34     );
    35 
    36 
    37     $slider = '';
    38     $filter = '';
    39     if ( isset( $args['slider'] ) ) {
    40         $slider = $args['slider'];
    41         unset( $args['slider'] );
    42 
    43         if ( ! function_exists( 'atw_slider_installed' ) ) {
    44             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Weaver Slider Plugin not installed.</strong>';
    45         }
    46 
    47         if ( $slider == '' || atw_posts_get_slider_opt( 'name', $slider ) == '' ) {
    48             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: You must specify a valid slider name.</strong>';
    49         }
    50 
    51         $filter = atw_posts_get_slider_opt( 'selected_slider_filter', $slider );
    52         if ( $filter == '' ) {
    53             $filter = 'default';
    54         }
    55 
    56         if ( atw_posts_get_filter_opt( 'slug', $filter ) != $filter ) {
    57             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Filter (' . $filter . ') is not a defined filter.</strong>';
    58         }
    59         $params = atw_posts_get_filter_params( $filter );
    60         if ( $params != '' ) {        // they specified a $filter via slider, so wipe out everything else
    61             unset( $args );
    62             $args = shortcode_parse_atts( $params );
    63             $args['use_paging'] = false;         // use_paging breaks sliders
    64         } else {
    65             $filter = '';
    66         }
    67     } elseif ( isset( $args['filter'] ) ) {
    68         $filter = $args['filter'];
    69         $params = atw_posts_get_filter_params( $filter );
    70         if ( $params != '' ) {        // they specified a $filter arg, so use it and wipe out anything else...
    71             unset( $args );
    72             $args = shortcode_parse_atts( $params );
    73         } else {
    74             $filter = '';
    75         }
    76     }
    77 
    78 
    79     $qargs = atw_posts_get_qargs( $args, $opts );
    80 
    81     extract( shortcode_atts( $opts, $args ) );  // setup local vars
    82 
    83     if ( $show == 'titlelist' && $slider ) {
    84         $show = 'title';
    85     }                    // cheap fix...
    86 
    87     // set transient opts for these options
    88 
    89     atw_trans_set( 'showposts', true );    // global to see if we are in this function
    90 
    91     atw_trans_set( 'show', $show );        // this will always be set - but '' (blank) implies 'full' for built-in, but not Weaver/Aspen settings for them
    92 
    93     if ( $hide_title != '' ) {
    94         atw_trans_set( 'hide_title', true );
    95     }
    96     if ( $hide_top_info != '' ) {
    97         atw_trans_set( 'hide_top_info', true );
    98     }
    99     if ( $hide_bottom_info != '' ) {
    100         atw_trans_set( 'hide_bottom_info', true );
    101     }
    102     if ( $hide_featured_image != '' ) {
    103         atw_trans_set( 'hide_featured_image', true );
    104     }
    105     if ( isset( $args['show_avatar'] ) ) {     // need this weirdness for Aspen/Weaver compatibility (not set means use global setting)
    106         if ( $show_avatar ) {
    107             atw_trans_set( 'show_avatar', true );
    108         } else {
    109             atw_trans_set( 'show_avatar', 'no' );
    110         }
    111     }
    112     if ( $more_msg != '' ) {
    113         atw_trans_set( 'more_msg', $more_msg );
    114     }
    115 
    116 
    117     $ourposts = new WP_Query( apply_filters( 'atw_show_posts_wp_query', $qargs, $args ) );
    118 
    119     /* now start the content */
    120     $class = '';
    121     if ( $filter != '' ) {
    122         $class = ' atw-show-posts-filter-' . $filter;
    123     }
    124 
    125     $content = '';
    126     $tail = '';
    127 
    128     if ( $slider == '' ) {
    129         $content = '';
    130         if ( ! $no_top_clear ) {
    131             $content = '<div style="clear:both;"></div>';
    132         }
    133         $content .= '<div class="atw-show-posts' . $class . '">';
    134         $tail = "</div><!-- show_posts -->\n";
    135     }
    136 
    137     ob_start();
    138 
    139     if ( $slider && function_exists( 'atw_slider_installed' ) && atw_posts_get_slider_opt( 'content_type', $slider ) == 'images' ) {
    140         atw_slider_do_gallery( $ourposts, $slider );
    141         // reset stuff
    142         wp_reset_query();
    143         wp_reset_postdata();
    144         atw_trans_clear_all();
    145         $content .= ob_get_clean();    // get the output
    146 
    147         return $content;
    148     }
    149 
    150     $slide_li_begin = '';
    151     $slide_li_end = '';
    152 
    153     if ( $slider ) {
    154         $style = '';
    155 
    156         $slide_li_begin = '<div class="atwk-slide"><div class="slide-content slide-post"' . $style . '>' . "\n";
    157         $slide_li_end = "\n</div></div><!-- slide-content slide-post -->\n";
    158     }
    159 
    160     // add excerpt filter here
    161     if ( $excerpt_length != '' ) {
    162         $GLOBALS['atw_show_posts_excerpt_length'] = $excerpt_length;
    163         add_filter( 'excerpt_length', 'atw_posts_excerpt_length_filter', 20 );   // user our excerpt filter early to override others
    164     }
    165 
    166 
    167     if ( $show == 'titlelist' ) {
    168         echo '<ul>';
    169     }
    170 
    171     $posts_out = 0;
    172     $col = 0;
    173     if ( ! $ourposts->have_posts() ) {
    174         echo apply_filters( 'wvr_show_posts_no_posts', __( 'No posts found.', 'atw_showposts' ));
    175     }
    176 
    177     if ( WEAVER_SHOWPOSTS_TEMPLATE && atw_posts_get_filter_opt( 'post_template', $filter ) ) {
    178         require_once( dirname( __FILE__ ) . '/atw-posts-template.php' );
    179     } // NOW - load the template code
    180 
    181     while ( $ourposts->have_posts() ) {
    182         $ourposts->the_post();
    183         $posts_out ++;
    184 
    185         echo $slide_li_begin;
    186 
    187         // aspen_per_post_style();
    188         if ( $show == 'titlelist' ) {
    189             ?>
    190             <li><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr( __( 'Permalink to %s', 'show-posts' ) ),
    191                     the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    192             <?php
    193         } else {
    194             switch ( $cols ) {
    195                 case 2:
    196                     $col++;
    197                     $style = '';
    198                     if ( ( $col % 2 ) == 1 ) {    // force stuff to be even
    199                         $style = ' style="clear:left;"';
    200                     }
    201                     echo( '<div class="atw-content-2-col atw-cf"' . $style . '>' . "\n" );
    202                     atw_show_content( $slider, $filter );
    203                     echo( "</div> <!-- atw-content-2-col -->\n" );
    204 
    205                     break;
    206                 case 3:
    207                     $col++;
    208                     $style = '';
    209                     if ( ( $col % 3 ) == 1 ) {    // force stuff to be even
    210                         $style = ' style="clear:left;"';
    211                     }
    212                     echo( '<div class="atw-content-3-col atw-cf"' . $style . '>' . "\n" );
    213                     atw_show_content( $slider, $filter );
    214                     echo( "</div> <!-- atw-content-3-col -->\n" );
    215 
    216                     break;
    217                 case 1:
    218                 default:
    219                     atw_show_content( $slider, $filter );
    220                     break;
    221             }    // end switch $cols
    222         }
    223 
    224         echo $slide_li_end;
    225 
    226     } // end loop
    227     if ( $show == 'titlelist' ) {
    228         echo "</ul>\n";
    229     }
    230 
    231     // unhook excerpt filter here
    232     if ( $excerpt_length != '' ) {
    233         unset( $GLOBALS['atw_show_posts_excerpt_length'] );
    234         remove_filter( 'excerpt_length', 'atw_posts_excerpt_length_filter', 20 );   // user our excerpt filter early to override others
    235     }
    236 
    237     if ( $use_paging ) {
    238         if ( ! $no_top_clear ) {
    239             echo '<div style="clear:both;"></div>';
    240         }
    241 
    242         ?>
    243         <div id="atw-show-posts-navigation" class="atw-post-nav">
    244             <?php
    245             $big = 999999;
    246             echo paginate_links( array(
    247                 'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    248                 'format'  => '?paged=%#%',
    249                 'current' => max( 1, $qargs['paged'] ),
    250                 'total'   => $ourposts->max_num_pages,
    251             ) );
    252             ?>
    253         </div>
    254         <?php
    255     }
    256     $content .= ob_get_clean();    // get the output
    257 
    258     // get posts
    259 
    260     $content .= $tail;
    261 
    262 
    263     // reset stuff
    264     wp_reset_query();
    265     wp_reset_postdata();
    266     atw_trans_clear_all();
    267 
    268     return $content;
     4function atw_show_posts_shortcode($args = '')
     5{
     6    /* implement [weaver_show_posts]  */
     7
     8    /* DOC NOTES:
     9    CSS styling: The group of posts will be wrapped with a <div> with a class called
     10    .wvr-show-posts. You can add an additional class to that by providing a 'class=classname' option
     11    (without the leading '.' used in the actual CSS definition). You can also provide inline styling
     12    by providing a 'style=value' option where value is whatever styling you need, each terminated
     13    with a semi-colon (;).
     14
     15    The optional header is in a <div> called .wvr_show_posts_header. You can add an additional class
     16    name with 'header_class=classname'. You can provide inline styling with 'header_style=value'.
     17
     18    .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 40px; margin-left: 0px;}
     19    .widget-area .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;}
     20    */
     21
     22    $opts = array(
     23        /* formatting options */
     24        'cols' => '1',   // display posts in 1 to 3 columns
     25        'excerpt_length' => '',    // excerpt length
     26        'hide_bottom_info' => '',    // hide bottom info line
     27        'hide_featured_image' => '',    // hide featured image - FI is displayed by default
     28        'hide_title' => '',    // hide the title?
     29        'hide_top_info' => '',    // hide the top info line
     30        'show' => '',    // show: title | excerpt | full | titlelist | title_featured
     31        'show_avatar' => false, // show the author avatar
     32        'more_msg' => '',    // replacement for Continue Reading excerpt message
     33        'use_paging' => false, // Use paging when displaying multiple posts
     34        'no_top_clear' => false  // prevent emitting clear:both
     35    );
     36
     37
     38    $slider = '';
     39    $filter = '';
     40    if (isset($args['slider'])) {
     41        $slider = $args['slider'];
     42        unset($args['slider']);
     43
     44        if (!function_exists('atw_slider_installed')) {
     45            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Weaver Slider Plugin not installed.</strong>';
     46        }
     47
     48        if ($slider == '' || atw_posts_get_slider_opt('name', $slider) == '') {
     49            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: You must specify a valid slider name.</strong>';
     50        }
     51
     52        $filter = atw_posts_get_slider_opt('selected_slider_filter', $slider);
     53        if ($filter == '') {
     54            $filter = 'default';
     55        }
     56
     57        if (atw_posts_get_filter_opt('slug', $filter) != $filter) {
     58            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Filter (' . $filter . ') is not a defined filter.</strong>';
     59        }
     60        $params = atw_posts_get_filter_params($filter);
     61        if ($params != '') {        // they specified a $filter via slider, so wipe out everything else
     62            unset($args);
     63            $args = shortcode_parse_atts($params);
     64            $args['use_paging'] = false;         // use_paging breaks sliders
     65        } else {
     66            $filter = '';
     67        }
     68    } elseif (isset($args['filter'])) {
     69        $filter = $args['filter'];
     70        $params = atw_posts_get_filter_params($filter);
     71        if ($params != '') {        // they specified a $filter arg, so use it and wipe out anything else...
     72            unset($args);
     73            $args = shortcode_parse_atts($params);
     74        } else {
     75            $filter = '';
     76        }
     77    }
     78
     79
     80    $qargs = atw_posts_get_qargs($args, $opts);
     81
     82    extract(shortcode_atts($opts, $args));  // setup local vars
     83
     84    if ($show == 'titlelist' && $slider) {
     85        $show = 'title';
     86    }                    // cheap fix...
     87
     88    // set transient opts for these options
     89
     90    atw_trans_set('showposts', true);    // global to see if we are in this function
     91
     92    atw_trans_set('show', $show);        // this will always be set - but '' (blank) implies 'full' for built-in, but not Weaver/Aspen settings for them
     93
     94    if ($hide_title != '') {
     95        atw_trans_set('hide_title', true);
     96    }
     97    if ($hide_top_info != '') {
     98        atw_trans_set('hide_top_info', true);
     99    }
     100    if ($hide_bottom_info != '') {
     101        atw_trans_set('hide_bottom_info', true);
     102    }
     103    if ($hide_featured_image != '') {
     104        atw_trans_set('hide_featured_image', true);
     105    }
     106    if (isset($args['show_avatar'])) {     // need this weirdness for Aspen/Weaver compatibility (not set means use global setting)
     107        if ($show_avatar) {
     108            atw_trans_set('show_avatar', true);
     109        } else {
     110            atw_trans_set('show_avatar', 'no');
     111        }
     112    }
     113    if ($more_msg != '') {
     114        atw_trans_set('more_msg', $more_msg);
     115    }
     116
     117
     118    $ourposts = new WP_Query(apply_filters('atw_show_posts_wp_query', $qargs, $args));
     119
     120    /* now start the content */
     121    $class = '';
     122    if ($filter != '') {
     123        $class = ' atw-show-posts-filter-' . $filter;
     124    }
     125
     126    $content = '';
     127    $tail = '';
     128
     129    if ($slider == '') {
     130        $content = '';
     131        if (!$no_top_clear) {
     132            $content = '<div style="clear:both;"></div>';
     133        }
     134        $content .= '<div class="atw-show-posts' . $class . '">';
     135        $tail = "</div><!-- show_posts -->\n";
     136    }
     137
     138    ob_start();
     139
     140    if ($slider && function_exists('atw_slider_installed') && atw_posts_get_slider_opt('content_type', $slider) == 'images') {
     141        atw_slider_do_gallery($ourposts, $slider);
     142        // reset stuff
     143        wp_reset_query();
     144        wp_reset_postdata();
     145        atw_trans_clear_all();
     146        $content .= ob_get_clean();    // get the output
     147
     148        return $content;
     149    }
     150
     151    $slide_li_begin = '';
     152    $slide_li_end = '';
     153
     154    if ($slider) {
     155        $style = '';
     156
     157        $slide_li_begin = '<div class="atwk-slide"><div class="slide-content slide-post"' . $style . '>' . "\n";
     158        $slide_li_end = "\n</div></div><!-- slide-content slide-post -->\n";
     159    }
     160
     161    // add excerpt filter here
     162    if ($excerpt_length != '') {
     163        $GLOBALS['atw_show_posts_excerpt_length'] = $excerpt_length;
     164        add_filter('excerpt_length', 'atw_posts_excerpt_length_filter', 20);   // user our excerpt filter early to override others
     165    }
     166
     167
     168    if ($show == 'titlelist') {
     169        echo '<ul>';
     170    }
     171
     172    $posts_out = 0;
     173    $col = 0;
     174    if (!$ourposts->have_posts()) {
     175        echo apply_filters('wvr_show_posts_no_posts', esc_html__('No posts found.', 'show-posts'));
     176    }
     177
     178    if (WEAVER_SHOWPOSTS_TEMPLATE && atw_posts_get_filter_opt('post_template', $filter)) {
     179        require_once(dirname(__FILE__) . '/atw-posts-template.php');
     180    } // NOW - load the template code
     181
     182    while ($ourposts->have_posts()) {
     183        $ourposts->the_post();
     184        $posts_out++;
     185
     186        echo $slide_li_begin;
     187
     188        // aspen_per_post_style();
     189        if ($show == 'titlelist') {
     190            ?>
     191            <li><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr(__('Permalink to %s', 'show-posts')),
     192                    the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a></li>
     193            <?php
     194        } else {
     195            switch ($cols) {
     196                case 2:
     197                    $col++;
     198                    $style = '';
     199                    if (($col % 2) == 1) {    // force stuff to be even
     200                        $style = ' style="clear:left;"';
     201                    }
     202                    echo('<div class="atw-content-2-col atw-cf"' . $style . '>' . "\n");
     203                    atw_show_content($slider, $filter);
     204                    echo("</div> <!-- atw-content-2-col -->\n");
     205
     206                    break;
     207                case 3:
     208                    $col++;
     209                    $style = '';
     210                    if (($col % 3) == 1) {    // force stuff to be even
     211                        $style = ' style="clear:left;"';
     212                    }
     213                    echo('<div class="atw-content-3-col atw-cf"' . $style . '>' . "\n");
     214                    atw_show_content($slider, $filter);
     215                    echo("</div> <!-- atw-content-3-col -->\n");
     216
     217                    break;
     218                case 1:
     219                default:
     220                    atw_show_content($slider, $filter);
     221                    break;
     222            }    // end switch $cols
     223        }
     224
     225        echo $slide_li_end;
     226
     227    } // end loop
     228    if ($show == 'titlelist') {
     229        echo "</ul>\n";
     230    }
     231
     232    // unhook excerpt filter here
     233    if ($excerpt_length != '') {
     234        unset($GLOBALS['atw_show_posts_excerpt_length']);
     235        remove_filter('excerpt_length', 'atw_posts_excerpt_length_filter', 20);   // user our excerpt filter early to override others
     236    }
     237
     238    if ($use_paging) {
     239        if (!$no_top_clear) {
     240            echo '<div style="clear:both;"></div>';
     241        }
     242
     243        ?>
     244        <div id="atw-show-posts-navigation" class="atw-post-nav">
     245            <?php
     246            $big = 999999;
     247            echo paginate_links(array(
     248                'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
     249                'format' => '?paged=%#%',
     250                'current' => max(1, $qargs['paged']),
     251                'total' => $ourposts->max_num_pages,
     252            ));
     253            ?>
     254        </div>
     255        <?php
     256    }
     257    $content .= ob_get_clean();    // get the output
     258
     259    // get posts
     260
     261    $content .= $tail;
     262
     263
     264    // reset stuff
     265    wp_reset_query();
     266    wp_reset_postdata();
     267    atw_trans_clear_all();
     268
     269    return $content;
    269270}
    270271
    271272// =================================== >>> atw_posts_excerpt_length_filter <<< =========================
    272273
    273 function atw_posts_excerpt_length_filter( $length ) {
    274     $val = $GLOBALS['atw_show_posts_excerpt_length'];
    275     if ( $val > 0 || $val === '0' ) {
    276         return $val;
    277     }
    278     if ( $length != 0 ) {
    279         return $length;
    280     } else {
    281         return 40;
    282     }
     274function atw_posts_excerpt_length_filter($length)
     275{
     276    $val = $GLOBALS['atw_show_posts_excerpt_length'];
     277    if ($val > 0 || $val === '0') {
     278        return $val;
     279    }
     280    if ($length != 0) {
     281        return $length;
     282    } else {
     283        return 40;
     284    }
    283285}
    284286
    285287// ====================================== >>> atw_show_content <<< ======================================
    286288
    287 function atw_show_content( $slider, $filter = '' ) {
    288 
    289     $cur_post_id = get_the_ID();
    290 
    291     /* We have to do our own sticky processing because WP is_sticky() will not work because we are in our own WP_Query,
    292      * and will thus never be on the home page which is one of the tests in the core is_sticky()
    293      */
    294 
    295     $sticky = is_sticky( $cur_post_id );
    296 
    297     do_action( 'atw_show_sliders_post_pager', $slider );
    298 
    299     $saved_the_content_filter_key = atw_save_the_content_filters();
    300 
    301     if ( ( ! atw_posts_getopt( 'ignore_aspen_weaver' ) && ( atw_posts_is_wvrx() || atw_posts_is_wii() ) )
    302          || ( atw_posts_getopt( 'use_native_theme_templates' ) && atw_posts_theme_has_templates() )
    303     ) {
    304 
    305         if ( $sticky ) {
    306             echo '<div class="sticky">';
    307         }
    308 
    309         if ( atw_posts_is_wvrx() ) {
    310             get_template_part( 'templates/content', get_post_format() );
    311         } elseif ( function_exists( 'twentysixteen_setup' ) ) {            // custom support for twentysixteen
    312             get_template_part( 'template-parts/content', get_post_format() );
    313         } else {
    314             get_template_part( 'content', get_post_format() );
    315         }
    316 
    317         if ( $sticky ) {
    318             echo '</div>';
    319         }
    320         echo "<div style='clear:both;'></div>\n";
    321         atw_restore_the_content_filters( $saved_the_content_filter_key );
    322 
    323         return;
    324     }
    325 
    326     if ( WEAVER_SHOWPOSTS_TEMPLATE ) {
    327         $template = atw_posts_get_filter_opt( 'post_template', $filter );
    328 
    329         if ( $template != '' ) {
    330             atw_posts_do_template( $slider, $template );
    331             atw_restore_the_content_filters( $saved_the_content_filter_key );
    332 
    333             return;
    334         }
    335     }
    336 
    337 
    338     $add_class = 'atw-post';
    339     if ( $sticky ) {
    340         $add_class .= ' sticky';
    341     }
    342     ?>
    343     <article id="post-<?php the_ID(); ?>" <?php post_class( $add_class ); ?>>
    344         <header class="atw-entry-header">
    345             <?php
    346             if ( ! atw_trans_get( 'hide_title' ) ) {        // ========== TITLE
    347                 ?>
    348                 <hgroup class="atw-entry-hdr"><h2 class="atw-entry-title">
    349                         <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr( __( 'Permalink to %s', 'show-posts' ) ),
    350                             the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    351                     </h2></hgroup>
    352 
    353                 <?php
    354             }
    355 
    356             if ( ! atw_trans_get( 'hide_top_info' ) ) {    // ============ TOP META
    357                 ?>
    358                 <div class="atw-entry-meta">
    359                     <div class="atw-entry-meta-icons">
    360                         <?php
    361 
    362                         printf( __( '<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a></span> <span class="by-author"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'show-posts' ),
    363                             esc_url( get_permalink() ),
    364                             esc_attr( get_the_time() ),
    365                             esc_attr( get_the_date( 'c' ) ),
    366                             esc_html( get_the_date() ),
    367                             esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    368                             sprintf( esc_attr( __( 'View all posts by %s', 'show-posts' ) ), get_the_author() ),
    369                             esc_html( get_the_author() )
    370                         );
    371 
    372                         if ( atw_trans_get( 'show_avatar' ) != '' && atw_trans_get( 'show_avatar' ) != 'no' ) {
    373                             echo '&nbsp;&nbsp;' . get_avatar( get_the_author_meta( 'user_email' ), 22, null, 'avatar' );
    374                         }
    375                         ?>
    376                     </div><!-- .atw-entry-meta-icons -->
    377                 </div><!-- .atw-entry-meta -->
    378                 <?php
    379             }
    380             ?>
    381         </header><!-- .atw-entry-header -->
    382         <?php
    383         if ( atw_trans_get( 'show' ) == 'title' ) {
    384             echo '</article><!-- #post-' . get_the_ID() . '-->';
    385             atw_restore_the_content_filters( $saved_the_content_filter_key );
    386 
    387             return;
    388         }
    389 
    390         if ( atw_trans_get( 'show' ) == 'title_featured' ) {
    391 
    392             if ( get_post_thumbnail_id() ) {
    393                 //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'thumbnail' );        // (url, width, height)
    394                 //$href = $image[0];
    395                 $href = get_permalink();
    396                 ?>
    397                 <p class='atw-featured-image'><a href="<?php echo $href; ?>"><?php esc_url( the_post_thumbnail( 'thumbnail' ) ); ?></a></p>
    398                 <?php
    399             }
    400             echo '</article><!-- #post-' . get_the_ID() . '-->';
    401             atw_restore_the_content_filters( $saved_the_content_filter_key );
    402 
    403             return;
    404         }
    405 
    406         if ( atw_trans_get( 'show' ) == 'excerpt' ) { // =================== EXCERPT
    407             ?>
    408             <div class="atw-entry-summary atw-cf">
    409                 <?php
    410                 atw_show_post_content( $slider );
    411                 ?>
    412             </div><!-- .atw-entry-summary -->
    413             <?php
    414         } else {                // ================== FULL CONTENT
    415             ?>
    416             <div class="atw-entry-content atw-cf">
    417                 <?php
    418                 atw_show_post_content( $slider );
    419                 ?>
    420             </div><!-- .atw-entry-content -->
    421             <?php
    422         }
    423 
    424         if ( ! atw_trans_get( 'hide_bottom_info' ) ) {    // ================= BOTTOM META
    425             ?>
    426 
    427             <footer class="atw-entry-utility">
    428                 <div class="atw-entry-meta-icons">
    429                     <?php
    430                     $categories_list = get_the_category_list( __( ', ', 'show-posts' ) );
    431                     if ( $categories_list ) { ?>
    432                         <span class="cat-links">
     289function atw_show_content($slider, $filter = '')
     290{
     291
     292    $cur_post_id = get_the_ID();
     293
     294    /* We have to do our own sticky processing because WP is_sticky() will not work because we are in our own WP_Query,
     295     * and will thus never be on the home page which is one of the tests in the core is_sticky()
     296     */
     297
     298    $sticky = is_sticky($cur_post_id);
     299
     300    do_action('atw_show_sliders_post_pager', $slider);
     301
     302    $saved_the_content_filter_key = atw_save_the_content_filters();
     303
     304    if ((!atw_posts_getopt('ignore_aspen_weaver') && (atw_posts_is_wvrx() || atw_posts_is_wii()))
     305        || (atw_posts_getopt('use_native_theme_templates') && atw_posts_theme_has_templates())
     306    ) {
     307
     308        if ($sticky) {
     309            echo '<div class="sticky">';
     310        }
     311
     312        if (atw_posts_is_wvrx()) {
     313            get_template_part('templates/content', get_post_format());
     314        } elseif (function_exists('twentysixteen_setup')) {            // custom support for twentysixteen
     315            get_template_part('template-parts/content', get_post_format());
     316        } else {
     317            get_template_part('content', get_post_format());
     318        }
     319
     320        if ($sticky) {
     321            echo '</div>';
     322        }
     323        echo "<div style='clear:both;'></div>\n";
     324        atw_restore_the_content_filters($saved_the_content_filter_key);
     325
     326        return;
     327    }
     328
     329    if (WEAVER_SHOWPOSTS_TEMPLATE) {
     330        $template = atw_posts_get_filter_opt('post_template', $filter);
     331
     332        if ($template != '') {
     333            atw_posts_do_template($slider, $template);
     334            atw_restore_the_content_filters($saved_the_content_filter_key);
     335
     336            return;
     337        }
     338    }
     339
     340
     341    $add_class = 'atw-post';
     342    if ($sticky) {
     343        $add_class .= ' sticky';
     344    }
     345    ?>
     346    <article id="post-<?php the_ID(); ?>" <?php post_class($add_class); ?>>
     347        <header class="atw-entry-header">
     348            <?php
     349            if (!atw_trans_get('hide_title')) {        // ========== TITLE
     350                ?>
     351                <hgroup class="atw-entry-hdr"><h2 class="atw-entry-title">
     352                        <a href="<?php the_permalink(); ?>"
     353                           title="<?php printf(esc_attr(__('Permalink to %s', 'show-posts')),
     354                               the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
     355                    </h2></hgroup>
     356
     357                <?php
     358            }
     359
     360            if (!atw_trans_get('hide_top_info')) {    // ============ TOP META
     361                ?>
     362                <div class="atw-entry-meta">
     363                    <div class="atw-entry-meta-icons">
     364                        <?php
     365
     366                        wp_kses_post(sprintf(__('<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a></span> <span class="by-author"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'show-posts'),
     367                            esc_url(get_permalink()),
     368                            esc_attr(get_the_time()),
     369                            esc_attr(get_the_date('c')),
     370                            esc_html(get_the_date()),
     371                            esc_url(get_author_posts_url(get_the_author_meta('ID'))),
     372                            esc_html(sprintf(__('View all posts by %s', 'show-posts'), esc_attr(get_the_author()))),
     373                            esc_attr(get_the_author())
     374                        ));
     375
     376                        if (atw_trans_get('show_avatar') != '' && atw_trans_get('show_avatar') != 'no') {
     377                            echo '&nbsp;&nbsp;' . get_avatar(get_the_author_meta('user_email'), 22, null, 'avatar');
     378                        }
     379                        ?>
     380                    </div><!-- .atw-entry-meta-icons -->
     381                </div><!-- .atw-entry-meta -->
     382                <?php
     383            }
     384            ?>
     385        </header><!-- .atw-entry-header -->
     386        <?php
     387        if (atw_trans_get('show') == 'title') {
     388            echo '</article><!-- #post-' . get_the_ID() . '-->';
     389            atw_restore_the_content_filters($saved_the_content_filter_key);
     390
     391            return;
     392        }
     393
     394        if (atw_trans_get('show') == 'title_featured') {
     395
     396            if (get_post_thumbnail_id()) {
     397                //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'thumbnail' );        // (url, width, height)
     398                //$href = $image[0];
     399                $href = get_permalink();
     400                ?>
     401                <p class='atw-featured-image'><a
     402                            href="<?php echo $href; ?>"><?php esc_url(the_post_thumbnail('thumbnail')); ?></a></p>
     403                <?php
     404            }
     405            echo '</article><!-- #post-' . get_the_ID() . '-->';
     406            atw_restore_the_content_filters($saved_the_content_filter_key);
     407
     408            return;
     409        }
     410
     411        if (atw_trans_get('show') == 'excerpt') { // =================== EXCERPT
     412            ?>
     413            <div class="atw-entry-summary atw-cf">
     414                <?php
     415                atw_show_post_content($slider);
     416                ?>
     417            </div><!-- .atw-entry-summary -->
     418            <?php
     419        } else {                // ================== FULL CONTENT
     420            ?>
     421            <div class="atw-entry-content atw-cf">
     422                <?php
     423                atw_show_post_content($slider);
     424                ?>
     425            </div><!-- .atw-entry-content -->
     426            <?php
     427        }
     428
     429        if (!atw_trans_get('hide_bottom_info')) {    // ================= BOTTOM META
     430            ?>
     431
     432            <footer class="atw-entry-utility">
     433                <div class="atw-entry-meta-icons">
     434                    <?php
     435                    $categories_list = get_the_category_list(esc_html__(', ', 'show-posts'));
     436                    if ($categories_list) { ?>
     437                        <span class="cat-links">
    433438<?php
    434439echo $categories_list;
    435440?>
    436441            </span>
    437                         <?php
    438                     } // End if categories
    439                     $tags_list = get_the_tag_list( '', __( ', ', 'show-posts' ) );
    440                     if ( $tags_list ) {
    441                         ?>
    442                         <span class="tag-links">
     442                        <?php
     443                    } // End if categories
     444                    $tags_list = get_the_tag_list('', esc_html__(', ', 'show-posts'));
     445                    if ($tags_list) {
     446                        ?>
     447                        <span class="tag-links">
    443448<?php
    444449echo $tags_list;
    445450?>
    446451            </span>
    447                         <?php
    448                     } // End if $tags_list
    449                     if ( comments_open() ) {
    450                         ?>
    451                         <span class="comments-link">
     452                        <?php
     453                    } // End if $tags_list
     454                    if (comments_open()) {
     455                        ?>
     456                        <span class="comments-link">
    452457<?php
    453 comments_popup_link( __( 'Leave a reply', 'show-posts' ),
    454     __( '<b>1</b> Reply', 'show-posts' ),
    455     __( '<b>%</b> Replies', 'show-posts' ),
    456     'leave-reply' );
     458wp_kses_post(comments_popup_link(__('Leave a reply', 'show-posts'),
     459    __('<b>1</b> Reply', 'show-posts'),
     460    __('<b>%</b> Replies', 'show-posts'),
     461    'leave-reply'));
    457462?>
    458463
    459464            </span>
    460                         <div style="clear:both;"></div>
    461                         <?php
    462                     } // End if comments_open()
    463                     ?>
    464                 </div><!-- .entry-meta-icons -->
    465             </footer><!-- .atw-entry-utility -->
    466             <?php
    467         }
    468         edit_post_link( __( 'Edit', 'show-posts' ), '<span class="atw-edit-link">', '</span>' );
    469         ?>
    470     </article><!-- #post-<?php the_ID(); ?> -->
    471 
    472     <?php
    473     atw_restore_the_content_filters( $saved_the_content_filter_key );
    474 }
    475 
    476 function atw_save_the_content_filters() {
    477     global $wp_filter, $wp_current_filter;
    478 
    479     $tag = 'the_content';
    480     if ( empty( $wp_filter ) || empty( $wp_current_filter ) || ! in_array( $tag, $wp_current_filter ) ) {
    481         return false;
    482     }
    483 
    484     return key( $wp_filter[ $tag ] );
    485 }
    486 
    487 function atw_restore_the_content_filters( $key = false ) {
    488     global $wp_filter;
    489     $tag = 'the_content';
    490     if ( $key !== false ) {
    491         reset( $wp_filter[ $tag ] );
    492         while ( key( $wp_filter[ $tag ] ) !== $key ) {
    493             if ( next( $wp_filter[ $tag ] ) === false ) {
    494                 break;
    495             }
    496         }
    497     }
     465                        <div style="clear:both;"></div>
     466                        <?php
     467                    } // End if comments_open()
     468                    ?>
     469                </div><!-- .entry-meta-icons -->
     470            </footer><!-- .atw-entry-utility -->
     471            <?php
     472        }
     473        edit_post_link(esc_html__('Edit', 'show-posts'), '<span class="atw-edit-link">', '</span>');
     474        ?>
     475    </article><!-- #post-<?php the_ID(); ?> -->
     476
     477    <?php
     478    atw_restore_the_content_filters($saved_the_content_filter_key);
     479}
     480
     481function atw_save_the_content_filters()
     482{
     483    global $wp_filter, $wp_current_filter;
     484
     485    $tag = 'the_content';
     486    if (empty($wp_filter) || empty($wp_current_filter) || !in_array($tag, $wp_current_filter)) {
     487        return false;
     488    }
     489
     490    return key($wp_filter[$tag]);
     491}
     492
     493function atw_restore_the_content_filters($key = false)
     494{
     495    global $wp_filter;
     496    $tag = 'the_content';
     497    if ($key !== false) {
     498        reset($wp_filter[$tag]);
     499        while (key($wp_filter[$tag]) !== $key) {
     500            if (next($wp_filter[$tag]) === false) {
     501                break;
     502            }
     503        }
     504    }
    498505}
    499506
    500507// ====================================== >>> atw_show_post_content <<< ======================================
    501508
    502 function atw_show_post_content( $slider ) {
    503     // display a post - show thumbnail, link to full size image
    504     if ( ! atw_trans_get( 'hide_featured_image' ) && get_post_thumbnail_id() ) {
    505         //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'full' );        // (url, width, height)
    506         //$href = $image[0];
    507         $href = get_permalink();
    508         ?>
    509         <span class='atw-featured-image'><a href="<?php echo $href; ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a></span>
    510         <?php
    511     }
    512 
    513     $content = '';
    514 
    515     if ( $slider && function_exists( 'atw_slider_set_pager_image' ) ) {
    516         $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );        // (url, width, height)
    517         $href = $image[0];
    518         if ( ! $href ) {
    519             $content = get_the_content( $more );
    520         }
    521 
    522     }
    523 
    524     $more = atw_trans_get( 'more_msg' );
    525     if ( $more == '' ) {
    526         $more = 'Continue Reading...';
    527     }      // we always want to show continue reading even if theme sets it to ''
    528 
    529     if ( atw_trans_get( 'show' ) == 'excerpt' ) {
    530         the_excerpt( $more );
    531     } elseif ( $content != '' ) {
    532         echo $content;
    533     } else {
    534         // atw_show_post_the_content( $more );
    535         atw_show_post_the_content( $more );
    536 
    537     }
     509function atw_show_post_content($slider)
     510{
     511    // display a post - show thumbnail, link to full size image
     512    if (!atw_trans_get('hide_featured_image') && get_post_thumbnail_id()) {
     513        //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'full' );        // (url, width, height)
     514        //$href = $image[0];
     515        $href = get_permalink();
     516        ?>
     517        <span class='atw-featured-image'><a
     518                    href="<?php echo $href; ?>"><?php the_post_thumbnail('thumbnail'); ?></a></span>
     519        <?php
     520    }
     521
     522    $content = '';
     523
     524    if ($slider && function_exists('atw_slider_set_pager_image')) {
     525        $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');        // (url, width, height)
     526        $href = $image[0];
     527        if (!$href) {
     528            $content = get_the_content($more);
     529        }
     530
     531    }
     532
     533    $more = atw_trans_get('more_msg');
     534    if ($more == '') {
     535        $more = 'Continue Reading...';
     536    }      // we always want to show continue reading even if theme sets it to ''
     537
     538    if (atw_trans_get('show') == 'excerpt') {
     539        the_excerpt($more);
     540    } elseif ($content != '') {
     541        echo $content;
     542    } else {
     543        // atw_show_post_the_content( $more );
     544        atw_show_post_the_content($more);
     545
     546    }
    538547}
    539548
    540549// ====================================== >>> atw_show_post_content <<< ======================================
    541 function atw_show_post_the_content( $more ) {
    542     // use this to support nested the_content filters - slight modification of the WP the_content()
    543 
    544     $content = get_the_content( $more, false );
    545 
    546     $content = do_shortcode( $content ); // try applying shortcodes before the_content filter
    547 
    548     $content = apply_filters( 'the_content', $content );
    549     //$content = str_replace( ']]>', ']]&gt;', $content );
    550     echo $content;
    551 }
     550function atw_show_post_the_content($more)
     551{
     552    // use this to support nested the_content filters - slight modification of the WP the_content()
     553
     554    $content = get_the_content($more, false);
     555
     556    $content = do_shortcode($content); // try applying shortcodes before the_content filter
     557
     558    $content = apply_filters('the_content', $content);
     559    //$content = str_replace( ']]>', ']]&gt;', $content );
     560    echo $content;
     561}
  • show-posts/tags/1.7/includes/downloader.php

    r2853140 r2891911  
    3030    if ( !$nonce || !$show_fn || !$ext ) {
    3131        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    32         wp_die(__('Sorry - invalid download','show-posts' /*adm*/));
     32        wp_die(esc_html__('Sorry - invalid download','show-posts' /*adm*/));
    3333    }
    3434
    3535    if (! wp_verify_nonce($nonce, 'show_posts_download')) {
    3636        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    37         wp_die(__('Sorry - download must be initiated from admin panel.','show-posts' /*adm*/) . ':' . esc_html($nonce));
     37        wp_die(esc_html__('Sorry - download must be initiated from admin panel.','show-posts' /*adm*/) . ':' . esc_html($nonce));
    3838    }
    3939
    4040    if (headers_sent()) {
    4141        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    42         wp_die(__('Headers Sent: The headers have been sent by another plugin - there may be a plugin conflict.','show-posts' /*adm*/));
     42        wp_die(esc_html__('Headers Sent: The headers have been sent by another plugin - there may be a plugin conflict.','show-posts' /*adm*/));
    4343    }
    4444
  • show-posts/tags/1.7/includes/posts-widgets.php

    r2213242 r2891911  
    88    function __construct() {
    99        $widget_ops = array('classname' => 'WeaverSS_Widget_Slider',
    10          'description' => __('Show Posts in a widget','show-sliders' /*adm*/));
     10         'description' => esc_html__('Show Posts in a widget', 'show-posts' /*adm*/));
    1111        $control_ops = array('width' => 400, 'height' => 350);
    12         parent::__construct('wvr_showposts', __('Weaver Show Posts','show-sliders' /*adm*/), $widget_ops, $control_ops);
     12        parent::__construct('wvr_showposts', esc_html__('Weaver Show Posts', 'show-posts' /*adm*/), $widget_ops, $control_ops);
    1313    }
    1414
  • show-posts/tags/1.7/readme.txt

    r2853140 r2891911  
    99Text Domain: show-posts
    1010Requires at least: 5.4
    11 Tested up to: 6.1
    12 Stable tag: 1.6
     11Tested up to: 6.2
     12Stable tag: 1.7
    1313
    1414== Description ==
     
    6060
    6161== Changelog ==
     62= 1.7 =
     63* Update: Wp 6.2 Compatibility
     64
    6265= 1.6 =
    6366* Update: WP 6.1 compatibility message
  • show-posts/trunk/atw-show-posts.php

    r2853140 r2891911  
    66Author: wpweaver
    77Author URI: http://weavertheme.com/about/
    8 Version: 1.6
     8Version: 1.7
    99
    1010License: GPL
     
    3131*/
    3232
    33 define ( 'WEAVER_SHOWPOSTS_VERSION','1.6');
    34 define ( 'WEAVER_SHOWPOSTS_MINIFY','.min');     // '' for dev, '.min' for production
    35 define ( 'WEAVER_SHOWPOSTS_TEMPLATE', false);      // future feature
     33const WEAVER_SHOWPOSTS_VERSION = '1.7';
     34const WEAVER_SHOWPOSTS_MINIFY = '.min';        // '' for dev, '.min' for production
     35const WEAVER_SHOWPOSTS_TEMPLATE = false;      // future feature
    3636
    3737// ===============================>>> REGISTER ACTIONS <<<===============================
     
    6363
    6464    if(  isset($page) && $page-> id!= 'atw_slider_post'  ) {
    65         echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-posts-dialog" class="thickbox button" id="add_atw_posts_posts" title="' . __("Add [show_posts]", 'show-posts') . '"><span class="dashicons dashicons-admin-post"></span> ' . __("Add [show_posts]", 'show-posts') . '</a>';
     65        echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-posts-dialog" class="thickbox button" id="add_atw_posts_posts" title="' . esc_html__("Add [show_posts]", 'show-posts') . '"><span class="dashicons dashicons-admin-post"></span> ' . __("Add [show_posts]", 'show-posts') . '</a>';
    6666        add_action( 'admin_footer', 'atw_posts_select_posts_form' );
    6767    }
    6868
    6969    if ( function_exists( 'atw_slider_installed') && isset($page) && $page->id != 'atw_slider_post' ) {
    70         echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-sliders-dialog" class="thickbox button" id="add_atw_slider_slidrs" title="' . __("Add [show_slider]", 'atw-slider') . '"><span class="dashicons dashicons-images-alt"></span></span> ' . __("Add [show_slider]", 'show-posts') . '</a>';
     70        echo '<a href="#TB_inline?width=400&height=300&inlineId=select-show-sliders-dialog" class="thickbox button" id="add_atw_slider_slidrs" title="' . esc_html__("Add [show_slider]", 'show-posts') . '"><span class="dashicons dashicons-images-alt"></span></span> ' . __("Add [show_slider]", 'show-posts') . '</a>';
    7171        add_action( 'admin_footer', 'atw_posts_select_slider_form' );
    7272    }
     
    8080?>
    8181    <div id="select-show-posts-dialog" style="display:none">
    82         <h3><?php _e('Insert [show_posts]', 'show-posts'); ?></h3>
    83         <p><?php _e('Add a [show_posts filter=specify-filter-name] into this page/post', 'show-posts'); ?></p>
     82        <h3><?php esc_html_e('Insert [show_posts]', 'show-posts'); ?></h3>
     83        <p><?php esc_html_e('Add a [show_posts filter=specify-filter-name] into this page/post', 'show-posts'); ?></p>
    8484<?php
    8585    $filters = atw_posts_getopt('filters');
     
    107107?>
    108108    <div id="select-show-sliders-dialog" style="display:none">
    109         <h3><?php _e('Insert [show_slider]', 'show-posts'); ?></h3>
    110         <p><?php _e('Add a [show_slider name=specify-slider-name] into this page/post', 'show-posts'); ?></p>
     109        <h3><?php esc_html_e('Insert [show_slider]', 'show-posts'); ?></h3>
     110        <p><?php esc_html_e('Add a [show_slider name=specify-slider-name] into this page/post', 'show-posts'); ?></p>
    111111<?php
    112112    $sliders = atw_posts_getopt('sliders');
  • show-posts/trunk/includes/atw-admin-lib.php

    r1520034 r2891911  
    3838    <a style="margin-left:9em;text-decoration: none;" href="<?php echo esc_url($href); ?>">
    3939    <span class="download-link"><img src="<?php echo esc_url($download_img_path); ?>" />
    40     <?php _e('Download', 'weaver-xtreme' /*adm*/); echo '</span></a> - ';
     40    <?php esc_html_e('Download', 'weaver-xtreme' /*adm*/); echo '</span></a> - ';
    4141    echo $desc; echo ' &nbsp;';
    4242    echo 'Save as:'; echo ' ' . $filename . "<br /><br />\n";
  • show-posts/trunk/includes/atw-posts-admin-top.php

    r1807568 r2891911  
    428428        $img = WP_CONTENT_URL . '/plugins/show-posts/images/donate-button.png';
    429429    ?>
    430 <div style="float:right;padding-right:30px;display:inline-block;"><div style="font-size:14px;font-weight:bold;display:inline-block;vertical-align: top;"><?php _e('Like <em>Weaver Show Posts</em>? Please', 'weaver-xtreme' /*adm*/); ?></div>&nbsp;&nbsp;<a href='//weavertheme.com/donate' target='_blank' alt='Please Donate' ><img src="<?php echo $img; ?>" alt="donate" style="max-height:28px;"/></a>
     430<div style="float:right;padding-right:30px;display:inline-block;"><div style="font-size:14px;font-weight:bold;display:inline-block;vertical-align: top;"><?php wp_kses_post(__('Like <em>Weaver Show Posts</em>? Please', 'show-posts' /*adm*/)); ?></div>&nbsp;&nbsp;<a href='//weavertheme.com/donate' target='_blank' alt='Please Donate' ><img src="<?php echo $img; ?>" alt="donate" style="max-height:28px;"/></a>
    431431</div>
    432432
  • show-posts/trunk/includes/atw-posts-template.php

    r2213242 r2891911  
    257257function atw_posts_edit_post() {
    258258    $link = get_edit_post_link();
    259     return'<span class="atw-edit-link"><a class="post-edit-link" href="' . esc_html($link) . '">' .  __( 'Edit','show-posts') . '</a></span>';
     259    return'<span class="atw-edit-link"><a class="post-edit-link" href="' . esc_html($link) . '">' .  esc_html__( 'Edit','show-posts') . '</a></span>';
    260260}
    261261
     
    266266    $val = ' <div class="atw-entry-meta"> <div class="atw-entry-meta-icons">';
    267267
    268     $val .= sprintf( __(
     268    $val .= wp_kses_post(sprintf( __(
    269269'   <span class="entry-date">
    270270    <a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a>
     
    280280        esc_html( get_the_date() ),
    281281        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    282         sprintf( esc_attr(__( 'View all posts by %s','show-posts')), get_the_author() ),
    283         esc_html( get_the_author() )
    284     );
     282        esc_html(sprintf( __( 'View all posts by %s','show-posts'), esc_attr(get_the_author() ))),
     283        esc_attr( get_the_author() )
     284    ));
    285285
    286286    $val .= ' </div> </div>';
     
    295295        ' <footer class="atw-entry-utility"> <div class="atw-entry-meta-icons">' . "\n";
    296296
    297     $categories_list = get_the_category_list( __( ', ','show-posts') );
     297    $categories_list = get_the_category_list( esc_html__( ', ','show-posts') );
    298298    if ( $categories_list ) {
    299299        $val .= '  <span class="cat-links">' . $categories_list . " </span>\n";
    300300    } // End if categories
    301301
    302     $tags_list = get_the_tag_list( '', __( ', ','show-posts') );
     302    $tags_list = get_the_tag_list( '', esc_html__( ', ','show-posts') );
    303303    if ( $tags_list ) {
    304304        $val .= '  <span class="tag-links">' . $tags_list . "  </span>\n";
     
    307307    if ( comments_open() ) {
    308308        $val .= ' <span class="comments-link">';
    309         $val .= atw_posts_get_comments_popup_link( __( 'Leave a reply','show-posts'),
     309        $val .= wp_kses_post(atw_posts_get_comments_popup_link( __( 'Leave a reply','show-posts'),
    310310                __( '<b>1</b> Reply','show-posts'),
    311311                __( '<b>%</b> Replies','show-posts'),
    312                 'leave-reply');
     312                'leave-reply'));
    313313
    314314        $val .= ' </span><div style="clear:both;"></div>';
     
    331331
    332332function atw_posts_post_title_link() {
    333     return '<a href="' . get_permalink() . '" title="' . sprintf( esc_attr(__( 'Permalink to %s','show-posts')),
    334        the_title_attribute( 'echo=0' ) ). '" rel="bookmark">' .  get_the_title() . '</a>';
     333    return '<a href="' . esc_url(get_permalink()) . '" title="' . sprintf( esc_html(__( 'Permalink to %s','show-posts')),
     334       esc_attr(the_title_attribute( 'echo=0' ) )) . '" rel="bookmark">' .  esc_html(get_the_title()) . '</a>';
    335335}
    336336
     
    373373    $val = '';
    374374
    375     if ( false === $zero ) $zero = __( 'No Comments' );
    376     if ( false === $one ) $one = __( '1 Comment' );
    377     if ( false === $more ) $more = __( '% Comments' );
    378     if ( false === $none ) $none = __( 'Comments Off' );
     375    if ( false === $zero ) $zero = esc_html__( 'No Comments', 'show-posts' );
     376    if ( false === $one ) $one = esc_html__( '1 Comment', 'show-posts' );
     377    if ( false === $more ) $more = esc_html__( '% Comments', 'show-posts' );
     378    if ( false === $none ) $none = esc_html__( 'Comments Off', 'show-posts' );
    379379
    380380    $number = get_comments_number( $id );
     
    385385
    386386    if ( post_password_required() ) {
    387         return __('Enter your password to view comments.');
     387        return esc_html__('Enter your password to view comments.', 'show-posts');
    388388    }
    389389
  • show-posts/trunk/includes/atw-showposts-sc.php

    r2428754 r2891911  
    22// ====================================== >>> atw_show_posts_shortcode <<< ======================================
    33
    4 function atw_show_posts_shortcode( $args = '' ) {
    5     /* implement [weaver_show_posts]  */
    6 
    7     /* DOC NOTES:
    8     CSS styling: The group of posts will be wrapped with a <div> with a class called
    9     .wvr-show-posts. You can add an additional class to that by providing a 'class=classname' option
    10     (without the leading '.' used in the actual CSS definition). You can also provide inline styling
    11     by providing a 'style=value' option where value is whatever styling you need, each terminated
    12     with a semi-colon (;).
    13 
    14     The optional header is in a <div> called .wvr_show_posts_header. You can add an additional class
    15     name with 'header_class=classname'. You can provide inline styling with 'header_style=value'.
    16 
    17     .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 40px; margin-left: 0px;}
    18     .widget-area .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;}
    19     */
    20 
    21     $opts = array(
    22         /* formatting options */
    23         'cols'                => '1',   // display posts in 1 to 3 columns
    24         'excerpt_length'      => '',    // excerpt length
    25         'hide_bottom_info'    => '',    // hide bottom info line
    26         'hide_featured_image' => '',    // hide featured image - FI is displayed by default
    27         'hide_title'          => '',    // hide the title?
    28         'hide_top_info'       => '',    // hide the top info line
    29         'show'                => '',    // show: title | excerpt | full | titlelist | title_featured
    30         'show_avatar'         => false, // show the author avatar
    31         'more_msg'            => '',    // replacement for Continue Reading excerpt message
    32         'use_paging'          => false, // Use paging when displaying multiple posts
    33         'no_top_clear'        => false  // prevent emitting clear:both
    34     );
    35 
    36 
    37     $slider = '';
    38     $filter = '';
    39     if ( isset( $args['slider'] ) ) {
    40         $slider = $args['slider'];
    41         unset( $args['slider'] );
    42 
    43         if ( ! function_exists( 'atw_slider_installed' ) ) {
    44             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Weaver Slider Plugin not installed.</strong>';
    45         }
    46 
    47         if ( $slider == '' || atw_posts_get_slider_opt( 'name', $slider ) == '' ) {
    48             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: You must specify a valid slider name.</strong>';
    49         }
    50 
    51         $filter = atw_posts_get_slider_opt( 'selected_slider_filter', $slider );
    52         if ( $filter == '' ) {
    53             $filter = 'default';
    54         }
    55 
    56         if ( atw_posts_get_filter_opt( 'slug', $filter ) != $filter ) {
    57             return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Filter (' . $filter . ') is not a defined filter.</strong>';
    58         }
    59         $params = atw_posts_get_filter_params( $filter );
    60         if ( $params != '' ) {        // they specified a $filter via slider, so wipe out everything else
    61             unset( $args );
    62             $args = shortcode_parse_atts( $params );
    63             $args['use_paging'] = false;         // use_paging breaks sliders
    64         } else {
    65             $filter = '';
    66         }
    67     } elseif ( isset( $args['filter'] ) ) {
    68         $filter = $args['filter'];
    69         $params = atw_posts_get_filter_params( $filter );
    70         if ( $params != '' ) {        // they specified a $filter arg, so use it and wipe out anything else...
    71             unset( $args );
    72             $args = shortcode_parse_atts( $params );
    73         } else {
    74             $filter = '';
    75         }
    76     }
    77 
    78 
    79     $qargs = atw_posts_get_qargs( $args, $opts );
    80 
    81     extract( shortcode_atts( $opts, $args ) );  // setup local vars
    82 
    83     if ( $show == 'titlelist' && $slider ) {
    84         $show = 'title';
    85     }                    // cheap fix...
    86 
    87     // set transient opts for these options
    88 
    89     atw_trans_set( 'showposts', true );    // global to see if we are in this function
    90 
    91     atw_trans_set( 'show', $show );        // this will always be set - but '' (blank) implies 'full' for built-in, but not Weaver/Aspen settings for them
    92 
    93     if ( $hide_title != '' ) {
    94         atw_trans_set( 'hide_title', true );
    95     }
    96     if ( $hide_top_info != '' ) {
    97         atw_trans_set( 'hide_top_info', true );
    98     }
    99     if ( $hide_bottom_info != '' ) {
    100         atw_trans_set( 'hide_bottom_info', true );
    101     }
    102     if ( $hide_featured_image != '' ) {
    103         atw_trans_set( 'hide_featured_image', true );
    104     }
    105     if ( isset( $args['show_avatar'] ) ) {     // need this weirdness for Aspen/Weaver compatibility (not set means use global setting)
    106         if ( $show_avatar ) {
    107             atw_trans_set( 'show_avatar', true );
    108         } else {
    109             atw_trans_set( 'show_avatar', 'no' );
    110         }
    111     }
    112     if ( $more_msg != '' ) {
    113         atw_trans_set( 'more_msg', $more_msg );
    114     }
    115 
    116 
    117     $ourposts = new WP_Query( apply_filters( 'atw_show_posts_wp_query', $qargs, $args ) );
    118 
    119     /* now start the content */
    120     $class = '';
    121     if ( $filter != '' ) {
    122         $class = ' atw-show-posts-filter-' . $filter;
    123     }
    124 
    125     $content = '';
    126     $tail = '';
    127 
    128     if ( $slider == '' ) {
    129         $content = '';
    130         if ( ! $no_top_clear ) {
    131             $content = '<div style="clear:both;"></div>';
    132         }
    133         $content .= '<div class="atw-show-posts' . $class . '">';
    134         $tail = "</div><!-- show_posts -->\n";
    135     }
    136 
    137     ob_start();
    138 
    139     if ( $slider && function_exists( 'atw_slider_installed' ) && atw_posts_get_slider_opt( 'content_type', $slider ) == 'images' ) {
    140         atw_slider_do_gallery( $ourposts, $slider );
    141         // reset stuff
    142         wp_reset_query();
    143         wp_reset_postdata();
    144         atw_trans_clear_all();
    145         $content .= ob_get_clean();    // get the output
    146 
    147         return $content;
    148     }
    149 
    150     $slide_li_begin = '';
    151     $slide_li_end = '';
    152 
    153     if ( $slider ) {
    154         $style = '';
    155 
    156         $slide_li_begin = '<div class="atwk-slide"><div class="slide-content slide-post"' . $style . '>' . "\n";
    157         $slide_li_end = "\n</div></div><!-- slide-content slide-post -->\n";
    158     }
    159 
    160     // add excerpt filter here
    161     if ( $excerpt_length != '' ) {
    162         $GLOBALS['atw_show_posts_excerpt_length'] = $excerpt_length;
    163         add_filter( 'excerpt_length', 'atw_posts_excerpt_length_filter', 20 );   // user our excerpt filter early to override others
    164     }
    165 
    166 
    167     if ( $show == 'titlelist' ) {
    168         echo '<ul>';
    169     }
    170 
    171     $posts_out = 0;
    172     $col = 0;
    173     if ( ! $ourposts->have_posts() ) {
    174         echo apply_filters( 'wvr_show_posts_no_posts', __( 'No posts found.', 'atw_showposts' ));
    175     }
    176 
    177     if ( WEAVER_SHOWPOSTS_TEMPLATE && atw_posts_get_filter_opt( 'post_template', $filter ) ) {
    178         require_once( dirname( __FILE__ ) . '/atw-posts-template.php' );
    179     } // NOW - load the template code
    180 
    181     while ( $ourposts->have_posts() ) {
    182         $ourposts->the_post();
    183         $posts_out ++;
    184 
    185         echo $slide_li_begin;
    186 
    187         // aspen_per_post_style();
    188         if ( $show == 'titlelist' ) {
    189             ?>
    190             <li><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr( __( 'Permalink to %s', 'show-posts' ) ),
    191                     the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    192             <?php
    193         } else {
    194             switch ( $cols ) {
    195                 case 2:
    196                     $col++;
    197                     $style = '';
    198                     if ( ( $col % 2 ) == 1 ) {    // force stuff to be even
    199                         $style = ' style="clear:left;"';
    200                     }
    201                     echo( '<div class="atw-content-2-col atw-cf"' . $style . '>' . "\n" );
    202                     atw_show_content( $slider, $filter );
    203                     echo( "</div> <!-- atw-content-2-col -->\n" );
    204 
    205                     break;
    206                 case 3:
    207                     $col++;
    208                     $style = '';
    209                     if ( ( $col % 3 ) == 1 ) {    // force stuff to be even
    210                         $style = ' style="clear:left;"';
    211                     }
    212                     echo( '<div class="atw-content-3-col atw-cf"' . $style . '>' . "\n" );
    213                     atw_show_content( $slider, $filter );
    214                     echo( "</div> <!-- atw-content-3-col -->\n" );
    215 
    216                     break;
    217                 case 1:
    218                 default:
    219                     atw_show_content( $slider, $filter );
    220                     break;
    221             }    // end switch $cols
    222         }
    223 
    224         echo $slide_li_end;
    225 
    226     } // end loop
    227     if ( $show == 'titlelist' ) {
    228         echo "</ul>\n";
    229     }
    230 
    231     // unhook excerpt filter here
    232     if ( $excerpt_length != '' ) {
    233         unset( $GLOBALS['atw_show_posts_excerpt_length'] );
    234         remove_filter( 'excerpt_length', 'atw_posts_excerpt_length_filter', 20 );   // user our excerpt filter early to override others
    235     }
    236 
    237     if ( $use_paging ) {
    238         if ( ! $no_top_clear ) {
    239             echo '<div style="clear:both;"></div>';
    240         }
    241 
    242         ?>
    243         <div id="atw-show-posts-navigation" class="atw-post-nav">
    244             <?php
    245             $big = 999999;
    246             echo paginate_links( array(
    247                 'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    248                 'format'  => '?paged=%#%',
    249                 'current' => max( 1, $qargs['paged'] ),
    250                 'total'   => $ourposts->max_num_pages,
    251             ) );
    252             ?>
    253         </div>
    254         <?php
    255     }
    256     $content .= ob_get_clean();    // get the output
    257 
    258     // get posts
    259 
    260     $content .= $tail;
    261 
    262 
    263     // reset stuff
    264     wp_reset_query();
    265     wp_reset_postdata();
    266     atw_trans_clear_all();
    267 
    268     return $content;
     4function atw_show_posts_shortcode($args = '')
     5{
     6    /* implement [weaver_show_posts]  */
     7
     8    /* DOC NOTES:
     9    CSS styling: The group of posts will be wrapped with a <div> with a class called
     10    .wvr-show-posts. You can add an additional class to that by providing a 'class=classname' option
     11    (without the leading '.' used in the actual CSS definition). You can also provide inline styling
     12    by providing a 'style=value' option where value is whatever styling you need, each terminated
     13    with a semi-colon (;).
     14
     15    The optional header is in a <div> called .wvr_show_posts_header. You can add an additional class
     16    name with 'header_class=classname'. You can provide inline styling with 'header_style=value'.
     17
     18    .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 40px; margin-left: 0px;}
     19    .widget-area .wvr-show-posts .hentry {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;}
     20    */
     21
     22    $opts = array(
     23        /* formatting options */
     24        'cols' => '1',   // display posts in 1 to 3 columns
     25        'excerpt_length' => '',    // excerpt length
     26        'hide_bottom_info' => '',    // hide bottom info line
     27        'hide_featured_image' => '',    // hide featured image - FI is displayed by default
     28        'hide_title' => '',    // hide the title?
     29        'hide_top_info' => '',    // hide the top info line
     30        'show' => '',    // show: title | excerpt | full | titlelist | title_featured
     31        'show_avatar' => false, // show the author avatar
     32        'more_msg' => '',    // replacement for Continue Reading excerpt message
     33        'use_paging' => false, // Use paging when displaying multiple posts
     34        'no_top_clear' => false  // prevent emitting clear:both
     35    );
     36
     37
     38    $slider = '';
     39    $filter = '';
     40    if (isset($args['slider'])) {
     41        $slider = $args['slider'];
     42        unset($args['slider']);
     43
     44        if (!function_exists('atw_slider_installed')) {
     45            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Weaver Slider Plugin not installed.</strong>';
     46        }
     47
     48        if ($slider == '' || atw_posts_get_slider_opt('name', $slider) == '') {
     49            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: You must specify a valid slider name.</strong>';
     50        }
     51
     52        $filter = atw_posts_get_slider_opt('selected_slider_filter', $slider);
     53        if ($filter == '') {
     54            $filter = 'default';
     55        }
     56
     57        if (atw_posts_get_filter_opt('slug', $filter) != $filter) {
     58            return '<strong>ERROR with [show_posts slider="' . $slider . '"]: Filter (' . $filter . ') is not a defined filter.</strong>';
     59        }
     60        $params = atw_posts_get_filter_params($filter);
     61        if ($params != '') {        // they specified a $filter via slider, so wipe out everything else
     62            unset($args);
     63            $args = shortcode_parse_atts($params);
     64            $args['use_paging'] = false;         // use_paging breaks sliders
     65        } else {
     66            $filter = '';
     67        }
     68    } elseif (isset($args['filter'])) {
     69        $filter = $args['filter'];
     70        $params = atw_posts_get_filter_params($filter);
     71        if ($params != '') {        // they specified a $filter arg, so use it and wipe out anything else...
     72            unset($args);
     73            $args = shortcode_parse_atts($params);
     74        } else {
     75            $filter = '';
     76        }
     77    }
     78
     79
     80    $qargs = atw_posts_get_qargs($args, $opts);
     81
     82    extract(shortcode_atts($opts, $args));  // setup local vars
     83
     84    if ($show == 'titlelist' && $slider) {
     85        $show = 'title';
     86    }                    // cheap fix...
     87
     88    // set transient opts for these options
     89
     90    atw_trans_set('showposts', true);    // global to see if we are in this function
     91
     92    atw_trans_set('show', $show);        // this will always be set - but '' (blank) implies 'full' for built-in, but not Weaver/Aspen settings for them
     93
     94    if ($hide_title != '') {
     95        atw_trans_set('hide_title', true);
     96    }
     97    if ($hide_top_info != '') {
     98        atw_trans_set('hide_top_info', true);
     99    }
     100    if ($hide_bottom_info != '') {
     101        atw_trans_set('hide_bottom_info', true);
     102    }
     103    if ($hide_featured_image != '') {
     104        atw_trans_set('hide_featured_image', true);
     105    }
     106    if (isset($args['show_avatar'])) {     // need this weirdness for Aspen/Weaver compatibility (not set means use global setting)
     107        if ($show_avatar) {
     108            atw_trans_set('show_avatar', true);
     109        } else {
     110            atw_trans_set('show_avatar', 'no');
     111        }
     112    }
     113    if ($more_msg != '') {
     114        atw_trans_set('more_msg', $more_msg);
     115    }
     116
     117
     118    $ourposts = new WP_Query(apply_filters('atw_show_posts_wp_query', $qargs, $args));
     119
     120    /* now start the content */
     121    $class = '';
     122    if ($filter != '') {
     123        $class = ' atw-show-posts-filter-' . $filter;
     124    }
     125
     126    $content = '';
     127    $tail = '';
     128
     129    if ($slider == '') {
     130        $content = '';
     131        if (!$no_top_clear) {
     132            $content = '<div style="clear:both;"></div>';
     133        }
     134        $content .= '<div class="atw-show-posts' . $class . '">';
     135        $tail = "</div><!-- show_posts -->\n";
     136    }
     137
     138    ob_start();
     139
     140    if ($slider && function_exists('atw_slider_installed') && atw_posts_get_slider_opt('content_type', $slider) == 'images') {
     141        atw_slider_do_gallery($ourposts, $slider);
     142        // reset stuff
     143        wp_reset_query();
     144        wp_reset_postdata();
     145        atw_trans_clear_all();
     146        $content .= ob_get_clean();    // get the output
     147
     148        return $content;
     149    }
     150
     151    $slide_li_begin = '';
     152    $slide_li_end = '';
     153
     154    if ($slider) {
     155        $style = '';
     156
     157        $slide_li_begin = '<div class="atwk-slide"><div class="slide-content slide-post"' . $style . '>' . "\n";
     158        $slide_li_end = "\n</div></div><!-- slide-content slide-post -->\n";
     159    }
     160
     161    // add excerpt filter here
     162    if ($excerpt_length != '') {
     163        $GLOBALS['atw_show_posts_excerpt_length'] = $excerpt_length;
     164        add_filter('excerpt_length', 'atw_posts_excerpt_length_filter', 20);   // user our excerpt filter early to override others
     165    }
     166
     167
     168    if ($show == 'titlelist') {
     169        echo '<ul>';
     170    }
     171
     172    $posts_out = 0;
     173    $col = 0;
     174    if (!$ourposts->have_posts()) {
     175        echo apply_filters('wvr_show_posts_no_posts', esc_html__('No posts found.', 'show-posts'));
     176    }
     177
     178    if (WEAVER_SHOWPOSTS_TEMPLATE && atw_posts_get_filter_opt('post_template', $filter)) {
     179        require_once(dirname(__FILE__) . '/atw-posts-template.php');
     180    } // NOW - load the template code
     181
     182    while ($ourposts->have_posts()) {
     183        $ourposts->the_post();
     184        $posts_out++;
     185
     186        echo $slide_li_begin;
     187
     188        // aspen_per_post_style();
     189        if ($show == 'titlelist') {
     190            ?>
     191            <li><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr(__('Permalink to %s', 'show-posts')),
     192                    the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a></li>
     193            <?php
     194        } else {
     195            switch ($cols) {
     196                case 2:
     197                    $col++;
     198                    $style = '';
     199                    if (($col % 2) == 1) {    // force stuff to be even
     200                        $style = ' style="clear:left;"';
     201                    }
     202                    echo('<div class="atw-content-2-col atw-cf"' . $style . '>' . "\n");
     203                    atw_show_content($slider, $filter);
     204                    echo("</div> <!-- atw-content-2-col -->\n");
     205
     206                    break;
     207                case 3:
     208                    $col++;
     209                    $style = '';
     210                    if (($col % 3) == 1) {    // force stuff to be even
     211                        $style = ' style="clear:left;"';
     212                    }
     213                    echo('<div class="atw-content-3-col atw-cf"' . $style . '>' . "\n");
     214                    atw_show_content($slider, $filter);
     215                    echo("</div> <!-- atw-content-3-col -->\n");
     216
     217                    break;
     218                case 1:
     219                default:
     220                    atw_show_content($slider, $filter);
     221                    break;
     222            }    // end switch $cols
     223        }
     224
     225        echo $slide_li_end;
     226
     227    } // end loop
     228    if ($show == 'titlelist') {
     229        echo "</ul>\n";
     230    }
     231
     232    // unhook excerpt filter here
     233    if ($excerpt_length != '') {
     234        unset($GLOBALS['atw_show_posts_excerpt_length']);
     235        remove_filter('excerpt_length', 'atw_posts_excerpt_length_filter', 20);   // user our excerpt filter early to override others
     236    }
     237
     238    if ($use_paging) {
     239        if (!$no_top_clear) {
     240            echo '<div style="clear:both;"></div>';
     241        }
     242
     243        ?>
     244        <div id="atw-show-posts-navigation" class="atw-post-nav">
     245            <?php
     246            $big = 999999;
     247            echo paginate_links(array(
     248                'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
     249                'format' => '?paged=%#%',
     250                'current' => max(1, $qargs['paged']),
     251                'total' => $ourposts->max_num_pages,
     252            ));
     253            ?>
     254        </div>
     255        <?php
     256    }
     257    $content .= ob_get_clean();    // get the output
     258
     259    // get posts
     260
     261    $content .= $tail;
     262
     263
     264    // reset stuff
     265    wp_reset_query();
     266    wp_reset_postdata();
     267    atw_trans_clear_all();
     268
     269    return $content;
    269270}
    270271
    271272// =================================== >>> atw_posts_excerpt_length_filter <<< =========================
    272273
    273 function atw_posts_excerpt_length_filter( $length ) {
    274     $val = $GLOBALS['atw_show_posts_excerpt_length'];
    275     if ( $val > 0 || $val === '0' ) {
    276         return $val;
    277     }
    278     if ( $length != 0 ) {
    279         return $length;
    280     } else {
    281         return 40;
    282     }
     274function atw_posts_excerpt_length_filter($length)
     275{
     276    $val = $GLOBALS['atw_show_posts_excerpt_length'];
     277    if ($val > 0 || $val === '0') {
     278        return $val;
     279    }
     280    if ($length != 0) {
     281        return $length;
     282    } else {
     283        return 40;
     284    }
    283285}
    284286
    285287// ====================================== >>> atw_show_content <<< ======================================
    286288
    287 function atw_show_content( $slider, $filter = '' ) {
    288 
    289     $cur_post_id = get_the_ID();
    290 
    291     /* We have to do our own sticky processing because WP is_sticky() will not work because we are in our own WP_Query,
    292      * and will thus never be on the home page which is one of the tests in the core is_sticky()
    293      */
    294 
    295     $sticky = is_sticky( $cur_post_id );
    296 
    297     do_action( 'atw_show_sliders_post_pager', $slider );
    298 
    299     $saved_the_content_filter_key = atw_save_the_content_filters();
    300 
    301     if ( ( ! atw_posts_getopt( 'ignore_aspen_weaver' ) && ( atw_posts_is_wvrx() || atw_posts_is_wii() ) )
    302          || ( atw_posts_getopt( 'use_native_theme_templates' ) && atw_posts_theme_has_templates() )
    303     ) {
    304 
    305         if ( $sticky ) {
    306             echo '<div class="sticky">';
    307         }
    308 
    309         if ( atw_posts_is_wvrx() ) {
    310             get_template_part( 'templates/content', get_post_format() );
    311         } elseif ( function_exists( 'twentysixteen_setup' ) ) {            // custom support for twentysixteen
    312             get_template_part( 'template-parts/content', get_post_format() );
    313         } else {
    314             get_template_part( 'content', get_post_format() );
    315         }
    316 
    317         if ( $sticky ) {
    318             echo '</div>';
    319         }
    320         echo "<div style='clear:both;'></div>\n";
    321         atw_restore_the_content_filters( $saved_the_content_filter_key );
    322 
    323         return;
    324     }
    325 
    326     if ( WEAVER_SHOWPOSTS_TEMPLATE ) {
    327         $template = atw_posts_get_filter_opt( 'post_template', $filter );
    328 
    329         if ( $template != '' ) {
    330             atw_posts_do_template( $slider, $template );
    331             atw_restore_the_content_filters( $saved_the_content_filter_key );
    332 
    333             return;
    334         }
    335     }
    336 
    337 
    338     $add_class = 'atw-post';
    339     if ( $sticky ) {
    340         $add_class .= ' sticky';
    341     }
    342     ?>
    343     <article id="post-<?php the_ID(); ?>" <?php post_class( $add_class ); ?>>
    344         <header class="atw-entry-header">
    345             <?php
    346             if ( ! atw_trans_get( 'hide_title' ) ) {        // ========== TITLE
    347                 ?>
    348                 <hgroup class="atw-entry-hdr"><h2 class="atw-entry-title">
    349                         <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr( __( 'Permalink to %s', 'show-posts' ) ),
    350                             the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    351                     </h2></hgroup>
    352 
    353                 <?php
    354             }
    355 
    356             if ( ! atw_trans_get( 'hide_top_info' ) ) {    // ============ TOP META
    357                 ?>
    358                 <div class="atw-entry-meta">
    359                     <div class="atw-entry-meta-icons">
    360                         <?php
    361 
    362                         printf( __( '<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a></span> <span class="by-author"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'show-posts' ),
    363                             esc_url( get_permalink() ),
    364                             esc_attr( get_the_time() ),
    365                             esc_attr( get_the_date( 'c' ) ),
    366                             esc_html( get_the_date() ),
    367                             esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    368                             sprintf( esc_attr( __( 'View all posts by %s', 'show-posts' ) ), get_the_author() ),
    369                             esc_html( get_the_author() )
    370                         );
    371 
    372                         if ( atw_trans_get( 'show_avatar' ) != '' && atw_trans_get( 'show_avatar' ) != 'no' ) {
    373                             echo '&nbsp;&nbsp;' . get_avatar( get_the_author_meta( 'user_email' ), 22, null, 'avatar' );
    374                         }
    375                         ?>
    376                     </div><!-- .atw-entry-meta-icons -->
    377                 </div><!-- .atw-entry-meta -->
    378                 <?php
    379             }
    380             ?>
    381         </header><!-- .atw-entry-header -->
    382         <?php
    383         if ( atw_trans_get( 'show' ) == 'title' ) {
    384             echo '</article><!-- #post-' . get_the_ID() . '-->';
    385             atw_restore_the_content_filters( $saved_the_content_filter_key );
    386 
    387             return;
    388         }
    389 
    390         if ( atw_trans_get( 'show' ) == 'title_featured' ) {
    391 
    392             if ( get_post_thumbnail_id() ) {
    393                 //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'thumbnail' );        // (url, width, height)
    394                 //$href = $image[0];
    395                 $href = get_permalink();
    396                 ?>
    397                 <p class='atw-featured-image'><a href="<?php echo $href; ?>"><?php esc_url( the_post_thumbnail( 'thumbnail' ) ); ?></a></p>
    398                 <?php
    399             }
    400             echo '</article><!-- #post-' . get_the_ID() . '-->';
    401             atw_restore_the_content_filters( $saved_the_content_filter_key );
    402 
    403             return;
    404         }
    405 
    406         if ( atw_trans_get( 'show' ) == 'excerpt' ) { // =================== EXCERPT
    407             ?>
    408             <div class="atw-entry-summary atw-cf">
    409                 <?php
    410                 atw_show_post_content( $slider );
    411                 ?>
    412             </div><!-- .atw-entry-summary -->
    413             <?php
    414         } else {                // ================== FULL CONTENT
    415             ?>
    416             <div class="atw-entry-content atw-cf">
    417                 <?php
    418                 atw_show_post_content( $slider );
    419                 ?>
    420             </div><!-- .atw-entry-content -->
    421             <?php
    422         }
    423 
    424         if ( ! atw_trans_get( 'hide_bottom_info' ) ) {    // ================= BOTTOM META
    425             ?>
    426 
    427             <footer class="atw-entry-utility">
    428                 <div class="atw-entry-meta-icons">
    429                     <?php
    430                     $categories_list = get_the_category_list( __( ', ', 'show-posts' ) );
    431                     if ( $categories_list ) { ?>
    432                         <span class="cat-links">
     289function atw_show_content($slider, $filter = '')
     290{
     291
     292    $cur_post_id = get_the_ID();
     293
     294    /* We have to do our own sticky processing because WP is_sticky() will not work because we are in our own WP_Query,
     295     * and will thus never be on the home page which is one of the tests in the core is_sticky()
     296     */
     297
     298    $sticky = is_sticky($cur_post_id);
     299
     300    do_action('atw_show_sliders_post_pager', $slider);
     301
     302    $saved_the_content_filter_key = atw_save_the_content_filters();
     303
     304    if ((!atw_posts_getopt('ignore_aspen_weaver') && (atw_posts_is_wvrx() || atw_posts_is_wii()))
     305        || (atw_posts_getopt('use_native_theme_templates') && atw_posts_theme_has_templates())
     306    ) {
     307
     308        if ($sticky) {
     309            echo '<div class="sticky">';
     310        }
     311
     312        if (atw_posts_is_wvrx()) {
     313            get_template_part('templates/content', get_post_format());
     314        } elseif (function_exists('twentysixteen_setup')) {            // custom support for twentysixteen
     315            get_template_part('template-parts/content', get_post_format());
     316        } else {
     317            get_template_part('content', get_post_format());
     318        }
     319
     320        if ($sticky) {
     321            echo '</div>';
     322        }
     323        echo "<div style='clear:both;'></div>\n";
     324        atw_restore_the_content_filters($saved_the_content_filter_key);
     325
     326        return;
     327    }
     328
     329    if (WEAVER_SHOWPOSTS_TEMPLATE) {
     330        $template = atw_posts_get_filter_opt('post_template', $filter);
     331
     332        if ($template != '') {
     333            atw_posts_do_template($slider, $template);
     334            atw_restore_the_content_filters($saved_the_content_filter_key);
     335
     336            return;
     337        }
     338    }
     339
     340
     341    $add_class = 'atw-post';
     342    if ($sticky) {
     343        $add_class .= ' sticky';
     344    }
     345    ?>
     346    <article id="post-<?php the_ID(); ?>" <?php post_class($add_class); ?>>
     347        <header class="atw-entry-header">
     348            <?php
     349            if (!atw_trans_get('hide_title')) {        // ========== TITLE
     350                ?>
     351                <hgroup class="atw-entry-hdr"><h2 class="atw-entry-title">
     352                        <a href="<?php the_permalink(); ?>"
     353                           title="<?php printf(esc_attr(__('Permalink to %s', 'show-posts')),
     354                               the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
     355                    </h2></hgroup>
     356
     357                <?php
     358            }
     359
     360            if (!atw_trans_get('hide_top_info')) {    // ============ TOP META
     361                ?>
     362                <div class="atw-entry-meta">
     363                    <div class="atw-entry-meta-icons">
     364                        <?php
     365
     366                        wp_kses_post(sprintf(__('<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a></span> <span class="by-author"><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'show-posts'),
     367                            esc_url(get_permalink()),
     368                            esc_attr(get_the_time()),
     369                            esc_attr(get_the_date('c')),
     370                            esc_html(get_the_date()),
     371                            esc_url(get_author_posts_url(get_the_author_meta('ID'))),
     372                            esc_html(sprintf(__('View all posts by %s', 'show-posts'), esc_attr(get_the_author()))),
     373                            esc_attr(get_the_author())
     374                        ));
     375
     376                        if (atw_trans_get('show_avatar') != '' && atw_trans_get('show_avatar') != 'no') {
     377                            echo '&nbsp;&nbsp;' . get_avatar(get_the_author_meta('user_email'), 22, null, 'avatar');
     378                        }
     379                        ?>
     380                    </div><!-- .atw-entry-meta-icons -->
     381                </div><!-- .atw-entry-meta -->
     382                <?php
     383            }
     384            ?>
     385        </header><!-- .atw-entry-header -->
     386        <?php
     387        if (atw_trans_get('show') == 'title') {
     388            echo '</article><!-- #post-' . get_the_ID() . '-->';
     389            atw_restore_the_content_filters($saved_the_content_filter_key);
     390
     391            return;
     392        }
     393
     394        if (atw_trans_get('show') == 'title_featured') {
     395
     396            if (get_post_thumbnail_id()) {
     397                //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'thumbnail' );        // (url, width, height)
     398                //$href = $image[0];
     399                $href = get_permalink();
     400                ?>
     401                <p class='atw-featured-image'><a
     402                            href="<?php echo $href; ?>"><?php esc_url(the_post_thumbnail('thumbnail')); ?></a></p>
     403                <?php
     404            }
     405            echo '</article><!-- #post-' . get_the_ID() . '-->';
     406            atw_restore_the_content_filters($saved_the_content_filter_key);
     407
     408            return;
     409        }
     410
     411        if (atw_trans_get('show') == 'excerpt') { // =================== EXCERPT
     412            ?>
     413            <div class="atw-entry-summary atw-cf">
     414                <?php
     415                atw_show_post_content($slider);
     416                ?>
     417            </div><!-- .atw-entry-summary -->
     418            <?php
     419        } else {                // ================== FULL CONTENT
     420            ?>
     421            <div class="atw-entry-content atw-cf">
     422                <?php
     423                atw_show_post_content($slider);
     424                ?>
     425            </div><!-- .atw-entry-content -->
     426            <?php
     427        }
     428
     429        if (!atw_trans_get('hide_bottom_info')) {    // ================= BOTTOM META
     430            ?>
     431
     432            <footer class="atw-entry-utility">
     433                <div class="atw-entry-meta-icons">
     434                    <?php
     435                    $categories_list = get_the_category_list(esc_html__(', ', 'show-posts'));
     436                    if ($categories_list) { ?>
     437                        <span class="cat-links">
    433438<?php
    434439echo $categories_list;
    435440?>
    436441            </span>
    437                         <?php
    438                     } // End if categories
    439                     $tags_list = get_the_tag_list( '', __( ', ', 'show-posts' ) );
    440                     if ( $tags_list ) {
    441                         ?>
    442                         <span class="tag-links">
     442                        <?php
     443                    } // End if categories
     444                    $tags_list = get_the_tag_list('', esc_html__(', ', 'show-posts'));
     445                    if ($tags_list) {
     446                        ?>
     447                        <span class="tag-links">
    443448<?php
    444449echo $tags_list;
    445450?>
    446451            </span>
    447                         <?php
    448                     } // End if $tags_list
    449                     if ( comments_open() ) {
    450                         ?>
    451                         <span class="comments-link">
     452                        <?php
     453                    } // End if $tags_list
     454                    if (comments_open()) {
     455                        ?>
     456                        <span class="comments-link">
    452457<?php
    453 comments_popup_link( __( 'Leave a reply', 'show-posts' ),
    454     __( '<b>1</b> Reply', 'show-posts' ),
    455     __( '<b>%</b> Replies', 'show-posts' ),
    456     'leave-reply' );
     458wp_kses_post(comments_popup_link(__('Leave a reply', 'show-posts'),
     459    __('<b>1</b> Reply', 'show-posts'),
     460    __('<b>%</b> Replies', 'show-posts'),
     461    'leave-reply'));
    457462?>
    458463
    459464            </span>
    460                         <div style="clear:both;"></div>
    461                         <?php
    462                     } // End if comments_open()
    463                     ?>
    464                 </div><!-- .entry-meta-icons -->
    465             </footer><!-- .atw-entry-utility -->
    466             <?php
    467         }
    468         edit_post_link( __( 'Edit', 'show-posts' ), '<span class="atw-edit-link">', '</span>' );
    469         ?>
    470     </article><!-- #post-<?php the_ID(); ?> -->
    471 
    472     <?php
    473     atw_restore_the_content_filters( $saved_the_content_filter_key );
    474 }
    475 
    476 function atw_save_the_content_filters() {
    477     global $wp_filter, $wp_current_filter;
    478 
    479     $tag = 'the_content';
    480     if ( empty( $wp_filter ) || empty( $wp_current_filter ) || ! in_array( $tag, $wp_current_filter ) ) {
    481         return false;
    482     }
    483 
    484     return key( $wp_filter[ $tag ] );
    485 }
    486 
    487 function atw_restore_the_content_filters( $key = false ) {
    488     global $wp_filter;
    489     $tag = 'the_content';
    490     if ( $key !== false ) {
    491         reset( $wp_filter[ $tag ] );
    492         while ( key( $wp_filter[ $tag ] ) !== $key ) {
    493             if ( next( $wp_filter[ $tag ] ) === false ) {
    494                 break;
    495             }
    496         }
    497     }
     465                        <div style="clear:both;"></div>
     466                        <?php
     467                    } // End if comments_open()
     468                    ?>
     469                </div><!-- .entry-meta-icons -->
     470            </footer><!-- .atw-entry-utility -->
     471            <?php
     472        }
     473        edit_post_link(esc_html__('Edit', 'show-posts'), '<span class="atw-edit-link">', '</span>');
     474        ?>
     475    </article><!-- #post-<?php the_ID(); ?> -->
     476
     477    <?php
     478    atw_restore_the_content_filters($saved_the_content_filter_key);
     479}
     480
     481function atw_save_the_content_filters()
     482{
     483    global $wp_filter, $wp_current_filter;
     484
     485    $tag = 'the_content';
     486    if (empty($wp_filter) || empty($wp_current_filter) || !in_array($tag, $wp_current_filter)) {
     487        return false;
     488    }
     489
     490    return key($wp_filter[$tag]);
     491}
     492
     493function atw_restore_the_content_filters($key = false)
     494{
     495    global $wp_filter;
     496    $tag = 'the_content';
     497    if ($key !== false) {
     498        reset($wp_filter[$tag]);
     499        while (key($wp_filter[$tag]) !== $key) {
     500            if (next($wp_filter[$tag]) === false) {
     501                break;
     502            }
     503        }
     504    }
    498505}
    499506
    500507// ====================================== >>> atw_show_post_content <<< ======================================
    501508
    502 function atw_show_post_content( $slider ) {
    503     // display a post - show thumbnail, link to full size image
    504     if ( ! atw_trans_get( 'hide_featured_image' ) && get_post_thumbnail_id() ) {
    505         //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'full' );        // (url, width, height)
    506         //$href = $image[0];
    507         $href = get_permalink();
    508         ?>
    509         <span class='atw-featured-image'><a href="<?php echo $href; ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a></span>
    510         <?php
    511     }
    512 
    513     $content = '';
    514 
    515     if ( $slider && function_exists( 'atw_slider_set_pager_image' ) ) {
    516         $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );        // (url, width, height)
    517         $href = $image[0];
    518         if ( ! $href ) {
    519             $content = get_the_content( $more );
    520         }
    521 
    522     }
    523 
    524     $more = atw_trans_get( 'more_msg' );
    525     if ( $more == '' ) {
    526         $more = 'Continue Reading...';
    527     }      // we always want to show continue reading even if theme sets it to ''
    528 
    529     if ( atw_trans_get( 'show' ) == 'excerpt' ) {
    530         the_excerpt( $more );
    531     } elseif ( $content != '' ) {
    532         echo $content;
    533     } else {
    534         // atw_show_post_the_content( $more );
    535         atw_show_post_the_content( $more );
    536 
    537     }
     509function atw_show_post_content($slider)
     510{
     511    // display a post - show thumbnail, link to full size image
     512    if (!atw_trans_get('hide_featured_image') && get_post_thumbnail_id()) {
     513        //$image = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'full' );        // (url, width, height)
     514        //$href = $image[0];
     515        $href = get_permalink();
     516        ?>
     517        <span class='atw-featured-image'><a
     518                    href="<?php echo $href; ?>"><?php the_post_thumbnail('thumbnail'); ?></a></span>
     519        <?php
     520    }
     521
     522    $content = '';
     523
     524    if ($slider && function_exists('atw_slider_set_pager_image')) {
     525        $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');        // (url, width, height)
     526        $href = $image[0];
     527        if (!$href) {
     528            $content = get_the_content($more);
     529        }
     530
     531    }
     532
     533    $more = atw_trans_get('more_msg');
     534    if ($more == '') {
     535        $more = 'Continue Reading...';
     536    }      // we always want to show continue reading even if theme sets it to ''
     537
     538    if (atw_trans_get('show') == 'excerpt') {
     539        the_excerpt($more);
     540    } elseif ($content != '') {
     541        echo $content;
     542    } else {
     543        // atw_show_post_the_content( $more );
     544        atw_show_post_the_content($more);
     545
     546    }
    538547}
    539548
    540549// ====================================== >>> atw_show_post_content <<< ======================================
    541 function atw_show_post_the_content( $more ) {
    542     // use this to support nested the_content filters - slight modification of the WP the_content()
    543 
    544     $content = get_the_content( $more, false );
    545 
    546     $content = do_shortcode( $content ); // try applying shortcodes before the_content filter
    547 
    548     $content = apply_filters( 'the_content', $content );
    549     //$content = str_replace( ']]>', ']]&gt;', $content );
    550     echo $content;
    551 }
     550function atw_show_post_the_content($more)
     551{
     552    // use this to support nested the_content filters - slight modification of the WP the_content()
     553
     554    $content = get_the_content($more, false);
     555
     556    $content = do_shortcode($content); // try applying shortcodes before the_content filter
     557
     558    $content = apply_filters('the_content', $content);
     559    //$content = str_replace( ']]>', ']]&gt;', $content );
     560    echo $content;
     561}
  • show-posts/trunk/includes/downloader.php

    r2853140 r2891911  
    3030    if ( !$nonce || !$show_fn || !$ext ) {
    3131        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    32         wp_die(__('Sorry - invalid download','show-posts' /*adm*/));
     32        wp_die(esc_html__('Sorry - invalid download','show-posts' /*adm*/));
    3333    }
    3434
    3535    if (! wp_verify_nonce($nonce, 'show_posts_download')) {
    3636        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    37         wp_die(__('Sorry - download must be initiated from admin panel.','show-posts' /*adm*/) . ':' . esc_html($nonce));
     37        wp_die(esc_html__('Sorry - download must be initiated from admin panel.','show-posts' /*adm*/) . ':' . esc_html($nonce));
    3838    }
    3939
    4040    if (headers_sent()) {
    4141        @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    42         wp_die(__('Headers Sent: The headers have been sent by another plugin - there may be a plugin conflict.','show-posts' /*adm*/));
     42        wp_die(esc_html__('Headers Sent: The headers have been sent by another plugin - there may be a plugin conflict.','show-posts' /*adm*/));
    4343    }
    4444
  • show-posts/trunk/includes/posts-widgets.php

    r2213242 r2891911  
    88    function __construct() {
    99        $widget_ops = array('classname' => 'WeaverSS_Widget_Slider',
    10          'description' => __('Show Posts in a widget','show-sliders' /*adm*/));
     10         'description' => esc_html__('Show Posts in a widget', 'show-posts' /*adm*/));
    1111        $control_ops = array('width' => 400, 'height' => 350);
    12         parent::__construct('wvr_showposts', __('Weaver Show Posts','show-sliders' /*adm*/), $widget_ops, $control_ops);
     12        parent::__construct('wvr_showposts', esc_html__('Weaver Show Posts', 'show-posts' /*adm*/), $widget_ops, $control_ops);
    1313    }
    1414
  • show-posts/trunk/readme.txt

    r2853140 r2891911  
    99Text Domain: show-posts
    1010Requires at least: 5.4
    11 Tested up to: 6.1
    12 Stable tag: 1.6
     11Tested up to: 6.2
     12Stable tag: 1.7
    1313
    1414== Description ==
     
    6060
    6161== Changelog ==
     62= 1.7 =
     63* Update: Wp 6.2 Compatibility
     64
    6265= 1.6 =
    6366* Update: WP 6.1 compatibility message
Note: See TracChangeset for help on using the changeset viewer.