PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | public/template/loop/class-loop-html.php +68 -51 4.0.72.2.10 View file →
@@ -9,9 +9,9 @@
9 9 */
10 10
11 11 // If this file is called directly, abort.
12 12 if ( ! defined( 'WPINC' ) ) {
13 - die; // Exit if accessed directly.
13 + die;
14 14 }
15 15 /**
16 16 * Post all html method.
17 17 *
@@ -21,13 +21,13 @@
21 21
22 22 /**
23 23 * Section title
24 24 *
25 - * @param int $title shortcode title.
25 + * @param int $pcp_id Shortcode id.
26 26 * @return void
27 27 */
28 - public static function pcp_section_title( $title ) {
29 - $section_title_text = apply_filters( 'pcp_section_title_text', $title );
28 + public static function pcp_section_title( $pcp_id ) {
29 + $section_title_text = apply_filters( 'pcp_section_title_text', get_the_title( $pcp_id ) );
30 30 $section_title = apply_filters( 'pcp_filter_section_title', sprintf( '<h2 class="pcp-section-title">%1$s</h2>', $section_title_text ), $section_title_text );
31 31 echo wp_kses_post( $section_title );
32 32 }
33 33
@@ -35,9 +35,8 @@
35 35 * Post title html.
36 36 *
37 37 * @param array $sorter post content option array.
38 38 * @param string $layout layout preset.
39 - * @param array $options The options array.
40 39 * @return void
41 40 */
42 41 public static function pcp_post_title( $sorter, $layout, $options ) {
43 42
@@ -45,11 +44,13 @@
45 44 $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings );
46 45 $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true );
47 46 $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options );
48 47 $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options );
49 - $pcp_link_rel_text = $pcp_link_rel ? 'rel=nofollow' : '';
50 - $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
51 -
48 + $pcp_link_rel_text = '';
49 + if ( $pcp_link_rel ) {
50 + $pcp_link_rel_text = "rel='nofollow'";
51 + }
52 + $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
52 53 if ( is_array( $post_meta_fields ) && 'accordion_layout' !== $layout && $show_post_meta ) {
53 54 foreach ( $post_meta_fields as $each_meta ) {
54 55 if ( 'taxonomy' === $each_meta['select_post_meta'] ) {
55 56 $taxonomy = $each_meta['post_meta_taxonomy'];
@@ -57,13 +58,13 @@
57 58 if ( 'above_title' === $meta_position ) {
58 59 $terms = get_the_term_list( get_the_ID(), $taxonomy, '', ' ' );
59 60 if ( $terms ) {
60 61 ?>
61 - <div class="pcp-category above_title <?php echo esc_attr( $taxonomy ); ?>">
62 - <?php echo wp_kses_post( $terms ); ?>
62 + <div class="pcp-category above_title <?php echo $taxonomy; ?>">
63 + <?php echo $terms; ?>
63 64 </div>
64 65 <?php
65 - }
66 + };
66 67 }
67 68 }
68 69 }
69 70 }
@@ -79,9 +80,8 @@
79 80 $allowed_html_tags = array(
80 81 'em' => array(),
81 82 'strong' => array(),
82 83 'sup' => array(),
83 - 'sub' => array(),
84 84 'i' => array(),
85 85 'small' => array(),
86 86 'del' => array(),
87 87 'br' => array(),
@@ -91,15 +91,15 @@
91 91 'class' => array(),
92 92 ),
93 93 );
94 94 ?>
95 - <<?php echo tag_escape( $post_title_tag ); ?> class="sp-pcp-title">
95 + <<?php echo esc_attr( $post_title_tag ); ?> class="sp-pcp-title">
96 96 <?php if ( 'none' === $pcp_page_link_type ) { ?>
97 - <?php printf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ) ); ?>
97 + <?php echo sprintf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ) ); ?>
98 98 <?php } else { ?>
99 - <?php printf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?>
99 + <?php echo sprintf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?>
100 100 <?php } ?>
101 - </<?php echo tag_escape( $post_title_tag ); ?>>
101 + </<?php echo esc_attr( $post_title_tag ); ?>>
102 102 <?php
103 103 }
104 104 }
105 105
@@ -122,9 +122,19 @@
122 122 if ( $show_post_content ) {
123 123 echo wp_kses_post( SP_PC_Functions::pcp_content( $post_content_setting, $pcp_content_type ) );
124 124 }
125 125 if ( $show_read_more ) {
126 - self::pcp_readmore( $post_content_setting, $pcp_content_type, $options );
126 + wp_kses(
127 + self::pcp_readmore( $post_content_setting, $pcp_content_type, $options ),
128 + array(
129 + 'a' => array(
130 + 'href' => array(),
131 + 'title' => array(),
132 + ),
133 + 'em' => array(),
134 + 'strong' => array(),
135 + )
136 + );
127 137 }
128 138 ?>
129 139 </div>
130 140 <?php
@@ -142,20 +152,23 @@
142 152 $show_read_more = isset( $view_options['show_read_more'] ) ? $view_options['show_read_more'] : '';
143 153 if ( ! $show_read_more || 'full_content' === $content_type ) {
144 154 return '';
145 155 }
146 -
156 + // $read_more_type = isset( $view_options['read_more_type'] ) ? $view_options['read_more_type'] : '';
147 157 $pcp_read_label = isset( $view_options['pcp_read_label'] ) ? $view_options['pcp_read_label'] : '';
148 158 $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options );
149 159 $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options );
150 - $pcp_link_rel_text = $pcp_link_rel ? 'rel=nofollow' : '';
151 - $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
160 + $pcp_link_rel_text = '';
161 + if ( $pcp_link_rel ) {
162 + $pcp_link_rel_text = "rel='nofollow'";
163 + }
164 + $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
152 165 ?>
153 166 <div class="sp-pcp-readmore">
154 167 <?php if ( 'none' === $pcp_page_link_type ) { ?>
155 - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo esc_attr( $pcp_link_rel_text ); ?>>
168 + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>>
156 169 <?php } else { ?>
157 - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo esc_attr( $pcp_link_rel_text ); ?>>
170 + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>>
158 171 <?php } ?>
159 172 <?php echo esc_html( $pcp_read_label ); ?> </a>
160 173 </div>
161 174 <?php
@@ -175,9 +188,9 @@
175 188 $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options );
176 189 $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options );
177 190 $pcp_link_rel_text = '';
178 191 if ( $pcp_link_rel ) {
179 - $pcp_link_rel_text = 'rel=nofollow';
192 + $pcp_link_rel_text = "rel='nofollow'";
180 193 }
181 194 $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
182 195 if ( SP_PC_Functions::pcp_metabox_value( 'post_thumb_show', $_post_thumb_setting ) ) {
183 196 $pcp_image_attr = SP_PC_Functions::pcp_sized_thumb( $_post_thumb_setting, $slide_id );
@@ -204,8 +217,9 @@
204 217 /**
205 218 * Post meta HTML
206 219 *
207 220 * @param array $sorter post content option array.
221 + * @param int $visitor_count views count.
208 222 * @return void
209 223 */
210 224 public static function pcp_post_meta_html( $sorter ) {
211 225 $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter );
@@ -210,17 +224,16 @@
210 224 public static function pcp_post_meta_html( $sorter ) {
211 225 $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter );
212 226 $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings );
213 227 $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true );
214 - $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings, ' ' );
215 -
228 + $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings );
216 229 if ( $post_meta_fields && $show_post_meta ) {
217 230 ?>
218 231 <div class="sp-pcp-post-meta">
219 232 <?php
220 - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' ) );
233 + echo apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' );
221 234 SP_PC_Functions::pcp_get_post_meta( $post_meta_fields, $_meta_separator );
222 - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' ) );
235 + echo apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' );
223 236 ?>
224 237 </div>
225 238 <?php
226 239 }
@@ -232,9 +245,8 @@
232 245 * @param array $sorter post sorting option.
233 246 * @param string $layout Layout preset.
234 247 * @param int $scode_id The Shortcode ID.
235 248 * @param object $post The Post object.
236 - * @param array $options The options array.
237 249 * @return void
238 250 */
239 251 public static function pcp_post_content_with_thumb( $sorter, $layout, $scode_id, $post, $options ) {
240 252 if ( $sorter ) {
@@ -262,9 +274,8 @@
262 274 *
263 275 * @param array $sorter post sorting option.
264 276 * @param string $layout Layout preset.
265 277 * @param object $post visitor number.
266 - * @param array $options The options array.
267 278 * @return void
268 279 */
269 280 public static function pcp_post_content_without_thumb( $sorter, $layout, $post, $options ) {
270 281 if ( $sorter ) {
@@ -286,14 +297,15 @@
286 297
287 298 /**
288 299 * Pagination function
289 300 *
290 - * @param object $loop Query array.
291 - * @param array $view_options shortcode options.
292 - * @param array $shortcode_id shortcode id.
293 - * @param array $on_screen screen type.
301 + * @param array $loop Query array.
302 + * @param array $upper_id Fields upper id.
303 + * @param array $paged The pagination type.
304 + * @param array $on_screen screen type.
294 305 */
295 - public static function pcp_pagination_bar( $loop, $view_options, $shortcode_id, $on_screen = null ) {
306 + public static function pcp_pagination_bar( $loop, $upper_id, $paged = null, $on_screen = null ) {
307 + $view_options = get_post_meta( $upper_id, 'sp_pcp_view_options', true );
296 308 // $posts_found;
297 309 $posts_found = $loop->found_posts;
298 310 $post_offset = isset( $view_options['pcp_post_offset'] ) ? $view_options['pcp_post_offset'] : 0;
299 311 $post_limit = isset( $view_options['pcp_post_limit'] ) ? $view_options['pcp_post_limit'] : '';
@@ -300,9 +312,9 @@
300 312 $post_limit = ( $post_limit > 0 && $posts_found > $post_limit ) ? $post_limit : $posts_found;
301 313 $post_per_page = isset( $view_options['post_per_page'] ) ? $view_options['post_per_page'] : '';
302 314 $post_per_page = ( $post_per_page > $post_limit ) ? $post_limit : $post_per_page;
303 315 // Post display settings.
304 - $post_limit = (int) $post_limit;
316 + $post_limit = (int) $post_limit;
305 317 if ( $post_limit < 1 ) {
306 318 $pages = 0;
307 319 } else {
308 320 $pages = SP_PC_Functions::pcp_max_pages( $post_limit, $post_per_page );
@@ -308,23 +320,28 @@
308 320 $pages = SP_PC_Functions::pcp_max_pages( $post_limit, $post_per_page );
309 321 }
310 322 $big = 999999999; // need an unlikely integer.
311 323 if ( $pages > 1 ) {
312 - $paged_var = 'paged' . $shortcode_id;
313 - // phpcs:ignore WordPress.Security.NonceVerification -- read-only operation, so can safely ignore it.
314 - $page_current = ( ! empty( $_GET[ "$paged_var" ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ "$paged_var" ] ) ) : 1;
315 - $page_links = paginate_links(
316 - array(
317 - 'format' => '?' . $paged_var . '=%#%',
318 - 'current' => $page_current,
319 - 'total' => $pages,
320 - 'show_all' => true,
321 - 'prev_next' => true,
322 - 'type' => 'array',
323 - 'prev_text' => '<i class="fa fa-angle-left"></i>',
324 - 'next_text' => '<i class="fa fa-angle-right"></i>',
325 - )
326 - );
327 - echo wp_kses_post( implode( $page_links ) );
324 + if ( get_query_var( 'paged' ) ) {
325 + $page_current = max( 1, get_query_var( 'paged' ) );
326 + } elseif ( get_query_var( 'page' ) ) {
327 + $page_current = max( 1, get_query_var( 'page' ) );
328 + } else {
329 + $page_current = 1;
330 + }
331 + $page_links = paginate_links(
332 + array(
333 + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
334 + 'format' => '?paged=%#%',
335 + 'current' => $page_current,
336 + 'total' => $pages,
337 + 'show_all' => true,
338 + 'prev_next' => true,
339 + 'type' => 'array',
340 + 'prev_text' => '<i class="fa fa-angle-left"></i>',
341 + 'next_text' => '<i class="fa fa-angle-right"></i>',
342 + )
343 + );
344 + echo implode( $page_links );
328 345 }
329 346 }
330 347 }