elementor
1 year ago
logs
2 months ago
strong-testimonials-beaver-block
1 year ago
submodules
9 months ago
class-strong-gutemberg.php
1 year ago
class-strong-log.php
1 year ago
class-strong-mail.php
1 year ago
class-strong-testimonials-average-shortcode.php
1 year ago
class-strong-testimonials-count-shortcode.php
1 year ago
class-strong-testimonials-defaults.php
3 weeks ago
class-strong-testimonials-form.php
2 months ago
class-strong-testimonials-order.php
1 year ago
class-strong-testimonials-privacy.php
1 year ago
class-strong-testimonials-render.php
2 months ago
class-strong-testimonials-templates.php
3 weeks ago
class-strong-testimonials-view-shortcode.php
1 month ago
class-strong-testimonials-view-widget.php
1 year ago
class-strong-view-display.php
6 days ago
class-strong-view-form.php
3 weeks ago
class-strong-view-slideshow.php
1 month ago
class-strong-view.php
1 month ago
class-walker-strong-category-checklist-front.php
1 year ago
deprecated.php
1 year ago
filters.php
2 months ago
functions-activation.php
3 weeks ago
functions-content.php
1 year ago
functions-image.php
6 months ago
functions-rating.php
1 year ago
functions-template-form.php
3 weeks ago
functions-template.php
3 weeks ago
functions-views.php
1 year ago
functions.php
2 weeks ago
l10n-polylang.php
1 year ago
l10n-wpml.php
1 year ago
post-types.php
1 week ago
retro.php
1 year ago
scripts.php
2 months ago
class-strong-view-display.php
578 lines
| 1 | <?php |
| 2 | /** |
| 3 | * View Display Mode class. |
| 4 | * |
| 5 | * @since 2.16.0 |
| 6 | */ |
| 7 | |
| 8 | // Exit if accessed directly |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | if ( ! class_exists( 'Strong_View_Display' ) ) : |
| 14 | |
| 15 | class Strong_View_Display extends Strong_View { |
| 16 | |
| 17 | /** |
| 18 | * The number of posts. |
| 19 | * |
| 20 | * @var int |
| 21 | */ |
| 22 | public $post_count; |
| 23 | public $found_posts; |
| 24 | |
| 25 | /** |
| 26 | * The number of pages. |
| 27 | * |
| 28 | * @var int |
| 29 | */ |
| 30 | public $page_count = 1; |
| 31 | |
| 32 | /** |
| 33 | * Strong_View constructor. |
| 34 | * |
| 35 | * @param array $atts |
| 36 | */ |
| 37 | public function __construct( $atts = array() ) { |
| 38 | parent::__construct( $atts ); |
| 39 | add_action( 'wpmtst_view_processed', array( $this, 'reset_view' ) ); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Reset stuff after view is processed or rendered. |
| 44 | * |
| 45 | * @since 2.31.0 |
| 46 | */ |
| 47 | public function reset_view() { |
| 48 | wp_reset_postdata(); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Adjust query for standard pagination. |
| 53 | * |
| 54 | * @param $args |
| 55 | * |
| 56 | * @return mixed |
| 57 | */ |
| 58 | public function query_pagination( $args ) { |
| 59 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) ) { |
| 60 | if ( $this->atts['pagination'] && 'standard' === $this->atts['pagination_settings']['type'] ) { |
| 61 | // Limit is not compatible with standard pagination. |
| 62 | $this->atts['count'] = -1; |
| 63 | $args['posts_per_page'] = $this->atts['pagination_settings']['per_page']; |
| 64 | $args['paged'] = wpmtst_get_paged(); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | return $args; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Adjust query for infinite scroll pagination. |
| 73 | * |
| 74 | * @param $args |
| 75 | * |
| 76 | * @return mixed |
| 77 | */ |
| 78 | public function query_infinitescroll( $args ) { |
| 79 | |
| 80 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) && isset( $this->atts['mode'] ) ) { |
| 81 | if ( $this->atts['pagination'] && in_array( $this->atts['pagination_settings']['type'], array( 'infinitescroll', 'loadmore' ), true ) && 'slideshow' !== $this->atts['mode'] ) { |
| 82 | // Limit is not compatible with standard pagination. |
| 83 | $this->atts['count'] = -1; |
| 84 | $args['posts_per_page'] = $this->atts['pagination_settings']['per_page']; |
| 85 | $args['paged'] = wpmtst_get_paged(); |
| 86 | } elseif ( 'slideshow' === $this->atts['mode'] ) { |
| 87 | $args['posts_per_page'] = $this->atts['count']; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | return $args; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Process the view. |
| 96 | * |
| 97 | * Used by main class to load the scripts and styles for this View. |
| 98 | */ |
| 99 | public function process() { |
| 100 | $this->build_query(); |
| 101 | $this->build_classes(); |
| 102 | |
| 103 | $this->find_stylesheet(); |
| 104 | $this->has_stars(); |
| 105 | $this->has_pagination(); |
| 106 | $this->has_layouts(); |
| 107 | $this->has_readmore(); |
| 108 | |
| 109 | $this->load_extra_stylesheets(); |
| 110 | |
| 111 | // If we can preprocess, we can add the inline style in <head>. |
| 112 | add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 ); |
| 113 | |
| 114 | do_action( 'wpmtst_view_processed' ); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Build the view. |
| 119 | */ |
| 120 | public function build() { |
| 121 | // May need to remove any hooks or filters that were set by other Views on the page. |
| 122 | |
| 123 | do_action( 'wpmtst_view_build_before', $this ); |
| 124 | |
| 125 | $this->build_query(); |
| 126 | $this->build_classes(); |
| 127 | |
| 128 | $this->find_stylesheet(); |
| 129 | $this->has_stars(); |
| 130 | $this->has_pagination(); |
| 131 | $this->has_layouts(); |
| 132 | $this->has_readmore(); |
| 133 | $this->has_lazyload(); |
| 134 | |
| 135 | $this->load_dependent_scripts(); |
| 136 | $this->load_extra_stylesheets(); |
| 137 | |
| 138 | // If we cannot preprocess, add the inline style to the footer. |
| 139 | add_action( 'wp_footer', array( $this, 'add_custom_style' ) ); |
| 140 | |
| 141 | /** |
| 142 | * Add filters. |
| 143 | */ |
| 144 | $this->add_content_filters(); |
| 145 | add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 ); |
| 146 | add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 ); |
| 147 | |
| 148 | /** |
| 149 | * Add actions. |
| 150 | */ |
| 151 | // Standard pagination |
| 152 | if ( isset( $this->atts['pagination'] ) && $this->atts['pagination'] && 'standard' === $this->atts['pagination_settings']['type'] ) { |
| 153 | if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'before' ) ) { |
| 154 | add_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' ); |
| 155 | } |
| 156 | if ( false !== strpos( $this->atts['pagination_settings']['nav'], 'after' ) ) { |
| 157 | add_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' ); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | // Read more page |
| 162 | if ( isset( $this->atts['more_page_hook'] ) ) { |
| 163 | add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' ); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Locate template. |
| 168 | */ |
| 169 | $this->template_file = apply_filters( 'wpmtst_view_template_file_display', WPMST()->templates->get_template_attr( $this->atts, 'template' ) ); |
| 170 | |
| 171 | /** |
| 172 | * Allow add-ons to hijack the output generation. |
| 173 | */ |
| 174 | $query = $this->query; |
| 175 | $atts = $this->atts; |
| 176 | $html = ''; |
| 177 | |
| 178 | if ( ! $this->found_posts ) { |
| 179 | if ( current_user_can( 'strong_testimonials_views' ) && 'infinitescroll' !== $this->atts['pagination_settings']['type'] ) { |
| 180 | $html = $this->nothing_found(); |
| 181 | } |
| 182 | } elseif ( has_filter( 'wpmtst_render_view_template' ) ) { |
| 183 | $html = apply_filters( 'wpmtst_render_view_template', '', $this ); |
| 184 | } else { |
| 185 | |
| 186 | /** |
| 187 | * Gutenberg. Yay. |
| 188 | * @since 2.31.9 |
| 189 | */ |
| 190 | global $post; |
| 191 | $post_before = $post; |
| 192 | |
| 193 | ob_start(); |
| 194 | /** @noinspection PhpIncludeInspection */ |
| 195 | include $this->template_file; |
| 196 | $html = ob_get_clean(); |
| 197 | |
| 198 | $post = $post_before; |
| 199 | } |
| 200 | |
| 201 | $html = $this->template_not_found_notice( isset( $this->atts['template'] ) ? $this->atts['template'] : '' ) . $html; |
| 202 | |
| 203 | /** |
| 204 | * Remove filters. |
| 205 | */ |
| 206 | $this->remove_content_filters(); |
| 207 | remove_filter( 'get_avatar', 'wpmtst_get_avatar' ); |
| 208 | remove_filter( 'embed_defaults', 'wpmtst_embed_size' ); |
| 209 | |
| 210 | /** |
| 211 | * Remove actions. |
| 212 | */ |
| 213 | if ( isset( $this->atts['more_page_hook'] ) ) { |
| 214 | remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' ); |
| 215 | } |
| 216 | remove_action( 'wpmtst_view_header', 'wpmtst_standard_pagination' ); |
| 217 | remove_action( 'wpmtst_view_footer', 'wpmtst_standard_pagination' ); |
| 218 | |
| 219 | /** |
| 220 | * Hook to enqueue scripts. |
| 221 | */ |
| 222 | do_action( 'wpmtst_view_rendered', $this->atts ); |
| 223 | |
| 224 | do_action( 'wpmtst_view_processed' ); |
| 225 | |
| 226 | $this->html = apply_filters( 'strong_view_html', $html, $this ); |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Build our query. |
| 231 | */ |
| 232 | public function build_query() { |
| 233 | $ids = isset( $this->atts['id'] ) ? explode( ',', $this->atts['id'] ) : false; |
| 234 | |
| 235 | $args = array( |
| 236 | 'post_type' => 'wpm-testimonial', |
| 237 | 'post_status' => 'publish', |
| 238 | 'posts_per_page' => -1, |
| 239 | 'paged' => null, |
| 240 | ); |
| 241 | |
| 242 | // Scoped to this single query build so settings from other views |
| 243 | // on the same page can't leak into each other. |
| 244 | add_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) ); |
| 245 | add_filter( 'wpmtst_build_query', array( $this, 'query_infinitescroll' ) ); |
| 246 | $args = apply_filters( 'wpmtst_build_query', $args ); |
| 247 | remove_filter( 'wpmtst_build_query', array( $this, 'query_pagination' ) ); |
| 248 | remove_filter( 'wpmtst_build_query', array( $this, 'query_infinitescroll' ) ); |
| 249 | |
| 250 | // id's override category |
| 251 | if ( isset( $this->atts['id'] ) && $this->atts['id'] ) { |
| 252 | $args['post__in'] = $ids; |
| 253 | } elseif ( isset( $this->atts['category'] ) && $this->atts['category'] ) { |
| 254 | $categories = apply_filters( 'wpmtst_l10n_cats', explode( ',', $this->atts['category'] ) ); |
| 255 | $args['tax_query'] = array( |
| 256 | array( |
| 257 | 'taxonomy' => 'wpm-testimonial-category', |
| 258 | 'field' => 'id', |
| 259 | 'terms' => $categories, |
| 260 | ), |
| 261 | ); |
| 262 | } |
| 263 | |
| 264 | // order by |
| 265 | if ( isset( $this->atts['order'] ) && 'submit_date' === $this->atts['order'] ) { |
| 266 | $args['meta_key'] = 'submit_date'; |
| 267 | $args['orderby'] = 'meta_value'; |
| 268 | $args['order'] = 'DESC'; |
| 269 | $args['meta_type'] = 'DATETIME'; |
| 270 | } elseif ( isset( $this->atts['order'] ) && 'menu_order' === $this->atts['order'] ) { |
| 271 | $args['orderby'] = 'menu_order'; |
| 272 | $args['order'] = 'ASC'; |
| 273 | } else { |
| 274 | $args['orderby'] = 'post_date'; |
| 275 | if ( isset( $this->atts['order'] ) && 'newest' === $this->atts['order'] ) { |
| 276 | $args['order'] = 'DESC'; |
| 277 | } else { |
| 278 | $args['order'] = 'ASC'; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | // For Post Types Order plugin |
| 283 | $args['ignore_custom_sort'] = true; |
| 284 | |
| 285 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) ) { |
| 286 | if ( $this->atts['pagination'] && in_array( $this->atts['pagination_settings']['type'], array( 'infinitescroll', 'loadmore' ), true ) ) { |
| 287 | if ( empty( $this->atts['paged'] ) ) { |
| 288 | $this->atts['paged'] = 1; |
| 289 | } |
| 290 | $args['paged'] = $this->atts['paged']; |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | $query = new WP_Query( apply_filters( 'wpmtst_query_args', $args, $this->atts ) ); |
| 295 | /** |
| 296 | * Shuffle array in PHP instead of SQL. |
| 297 | * |
| 298 | * @since 1.16 |
| 299 | */ |
| 300 | if ( isset( $this->atts['order'] ) && 'random' === $this->atts['order'] ) { |
| 301 | $options = apply_filters( 'wpmtst_compat_options', get_option( 'wpmtst_compat_options', array() ) ); |
| 302 | if ( isset( $options['random_js'] ) && $options['random_js'] ) { |
| 303 | WPMST()->render->add_script( 'wpmtst-random' ); |
| 304 | } else { |
| 305 | shuffle( $query->posts ); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Extract slice of array, which may be shuffled. |
| 311 | * |
| 312 | * Use lesser value: requested count or actual count. |
| 313 | * Thanks chestozo. |
| 314 | * |
| 315 | * @link https://github.com/cdillon/strong-testimonials/pull/5 |
| 316 | * |
| 317 | * @since 1.16.1 |
| 318 | */ |
| 319 | if ( isset( $this->atts['count'] ) && $this->atts['count'] > 0 ) { |
| 320 | $count = min( $this->atts['count'], count( $query->posts ) ); |
| 321 | $query->posts = array_slice( $query->posts, 0, $count ); |
| 322 | $query->post_count = $count; |
| 323 | $query->found_posts = $count; |
| 324 | } |
| 325 | |
| 326 | $this->post_count = $query->post_count; |
| 327 | $this->found_posts = $query->found_posts; |
| 328 | $this->query = $query; |
| 329 | WPMST()->set_query( $query ); |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Build class list based on view attributes. |
| 334 | * |
| 335 | * This must happen after the query. |
| 336 | * TODO DRY |
| 337 | */ |
| 338 | public function build_classes() { |
| 339 | $container_class_list = isset( $this->atts['view'] ) ? array( 'strong-view-id-' . $this->atts['view'] ) : array(); |
| 340 | $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() ); |
| 341 | |
| 342 | if ( is_rtl() ) { |
| 343 | $container_class_list[] = 'rtl'; |
| 344 | } |
| 345 | |
| 346 | if ( isset( $this->atts['class'] ) && $this->atts['class'] ) { |
| 347 | $container_class_list[] = $this->atts['class']; |
| 348 | } |
| 349 | |
| 350 | $container_data_list = array( |
| 351 | 'count' => $this->post_count, |
| 352 | ); |
| 353 | |
| 354 | $content_class_list = array(); |
| 355 | |
| 356 | $post_class_list = array( 'wpmtst-testimonial testimonial' ); |
| 357 | |
| 358 | if ( isset( $this->atts['content'] ) && 'excerpt' === $this->atts['content'] ) { |
| 359 | $post_class_list[] = 'excerpt'; |
| 360 | } |
| 361 | |
| 362 | if ( $this->is_paginated() && ! $this->is_masonry() ) { |
| 363 | $content_class_list[] = 'strong-paginated'; |
| 364 | $container_class_list[] = 'strong-pager'; |
| 365 | $container_data_list['pager-var'] = $this->pager_signature(); |
| 366 | $container_data_list['state'] = 'idle'; |
| 367 | } |
| 368 | |
| 369 | if ( $this->is_masonry() ) { |
| 370 | $container_data_list['state'] = 'idle'; |
| 371 | } |
| 372 | |
| 373 | if ( $this->is_hybrid() ) { |
| 374 | $container_class_list[] = 'more-in-place'; |
| 375 | } |
| 376 | |
| 377 | // layouts |
| 378 | $content_class_list[] = 'strong-' . ( isset( $this->atts['layout'] ) && $this->atts['layout'] ? $this->atts['layout'] : 'normal' ); |
| 379 | $content_class_list[] = 'columns-' . ( isset( $this->atts['layout'] ) && $this->atts['layout'] ? $this->atts['column_count'] : '1' ); |
| 380 | |
| 381 | /** |
| 382 | * Filter classes. |
| 383 | */ |
| 384 | $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts ); |
| 385 | $this->atts['container_class'] = implode( ' ', apply_filters( 'wpmtst_view_container_class', $container_class_list, $this->atts ) ); |
| 386 | $this->atts['content_class'] = implode( ' ', apply_filters( 'wpmtst_view_content_class', $content_class_list, $this->atts ) ); |
| 387 | $this->atts['post_class'] = implode( ' ', apply_filters( 'wpmtst_view_post_class', $post_class_list, $this->atts ) ); |
| 388 | |
| 389 | /** |
| 390 | * Store updated atts. |
| 391 | */ |
| 392 | WPMST()->set_atts( $this->atts ); |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Return true if using simple pagination (JavaScript). |
| 397 | * |
| 398 | * @since 2.28.0 |
| 399 | * |
| 400 | * @return bool |
| 401 | */ |
| 402 | public function is_paginated() { |
| 403 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) ) { |
| 404 | return ( $this->atts['pagination'] && 'simple' === $this->atts['pagination_settings']['type'] ); |
| 405 | } |
| 406 | return false; |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Return true if using infinitescroll pagination (JavaScript). |
| 411 | * |
| 412 | * @since 2.28.0 |
| 413 | * |
| 414 | * @return bool |
| 415 | */ |
| 416 | public function is_infinitescroll() { |
| 417 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) ) { |
| 418 | return ( $this->atts['pagination'] && 'infinitescroll' === $this->atts['pagination_settings']['type'] ); |
| 419 | } |
| 420 | return false; |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Return true if using load more button pagination (JavaScript). |
| 425 | * |
| 426 | * @since 2.28.0 |
| 427 | * |
| 428 | * @return bool |
| 429 | */ |
| 430 | public function is_loadmore() { |
| 431 | if ( isset( $this->atts['pagination'] ) && isset( $this->atts['pagination_settings'] ) && isset( $this->atts['pagination_settings']['type'] ) ) { |
| 432 | return ( $this->atts['pagination'] && 'loadmore' === $this->atts['pagination_settings']['type'] ); |
| 433 | } |
| 434 | return false; |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Return true if using Masonry. |
| 439 | * |
| 440 | * @since 2.28.0 |
| 441 | * |
| 442 | * @return bool |
| 443 | */ |
| 444 | public function is_masonry() { |
| 445 | return ( isset( $this->atts['layout'] ) && 'masonry' === $this->atts['layout'] ); |
| 446 | } |
| 447 | |
| 448 | /** |
| 449 | * Return true if read-more in place. |
| 450 | * |
| 451 | * @since 2.33.0 |
| 452 | * |
| 453 | * @return bool |
| 454 | */ |
| 455 | public function is_hybrid() { |
| 456 | return ( isset( $this->atts['more_post_in_place'] ) && $this->atts['more_post_in_place'] ); |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Pagination |
| 461 | * |
| 462 | * @since 2.16.0 In Strong_View class. |
| 463 | */ |
| 464 | public function has_pagination() { |
| 465 | if ( $this->is_paginated() ) { |
| 466 | WPMST()->render->add_script( 'wpmtst-pager' ); |
| 467 | WPMST()->render->add_script_var( 'wpmtst-pager', $this->pager_signature(), $this->pager_args() ); |
| 468 | WPMST()->render->add_script( 'wpmtst-controller' ); |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * Create unique pager signature. |
| 474 | * |
| 475 | * @since 2.13.2 |
| 476 | * @since 2.22.3 In this class. |
| 477 | * |
| 478 | * @return string |
| 479 | */ |
| 480 | public function pager_signature() { |
| 481 | return 'strong_pager_id_' . $this->atts['view']; |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Assemble pager settings. |
| 486 | * |
| 487 | * @since 2.13.2 |
| 488 | * @since 2.22.3 In this class. |
| 489 | * |
| 490 | * @return array |
| 491 | */ |
| 492 | public function pager_args() { |
| 493 | $options = get_option( 'wpmtst_options' ); |
| 494 | |
| 495 | $nav = $this->atts['pagination_settings']['nav']; |
| 496 | if ( false !== strpos( $nav, 'before' ) && false !== strpos( $nav, 'after' ) ) { |
| 497 | $nav = 'both'; |
| 498 | } |
| 499 | |
| 500 | $saved_scrolltop = isset( $options['scrolltop'] ) ? (bool) $options['scrolltop'] : true; |
| 501 | $saved_offset = isset( $options['scrolltop_offset'] ) ? (int) $options['scrolltop_offset'] : 0; |
| 502 | $scrolltop = apply_filters( 'wpmtst_scrolltop', array( |
| 503 | 'enabled' => $saved_scrolltop, |
| 504 | 'offset' => $saved_offset, |
| 505 | ) ); |
| 506 | |
| 507 | // Remember: top level is converted to strings! |
| 508 | $args = array( |
| 509 | 'config' => array( |
| 510 | 'pageSize' => $this->atts['pagination_settings']['per_page'], |
| 511 | 'currentPage' => 1, |
| 512 | 'pagerLocation' => $nav, |
| 513 | 'scrollTop' => $scrolltop['enabled'], |
| 514 | 'offset' => $scrolltop['offset'], |
| 515 | 'imagesLoaded' => true, |
| 516 | ), |
| 517 | ); |
| 518 | |
| 519 | return apply_filters( 'wpmtst_view_pagination', $args, $this->atts['view'] ); |
| 520 | } |
| 521 | |
| 522 | /** |
| 523 | * Layouts |
| 524 | * |
| 525 | * @since 2.16.0 In Strong_View class. |
| 526 | */ |
| 527 | public function has_layouts() { |
| 528 | if ( $this->is_masonry() ) { |
| 529 | WPMST()->render->add_script( 'jquery-masonry' ); |
| 530 | WPMST()->render->add_script( 'imagesloaded' ); |
| 531 | |
| 532 | if ( apply_filters( 'wpmtst_load_masonry_style', true ) ) { |
| 533 | WPMST()->render->add_style( 'wpmtst-masonry-style' ); |
| 534 | } |
| 535 | } elseif ( isset( $this->atts['layout'] ) && 'columns' === $this->atts['layout'] ) { |
| 536 | if ( apply_filters( 'wpmtst_load_columns_style', true ) ) { |
| 537 | WPMST()->render->add_style( 'wpmtst-columns-style' ); |
| 538 | } |
| 539 | } elseif ( isset( $this->atts['layout'] ) && 'grid' === $this->atts['layout'] ) { |
| 540 | if ( apply_filters( 'wpmtst_load_grid_style', true ) ) { |
| 541 | WPMST()->render->add_style( 'wpmtst-grid-style' ); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | WPMST()->render->add_script( 'wpmtst-controller' ); |
| 546 | } |
| 547 | |
| 548 | /** |
| 549 | * Read more in place |
| 550 | * |
| 551 | * @since 2.33.0 |
| 552 | */ |
| 553 | public function has_readmore() { |
| 554 | if ( $this->is_hybrid() ) { |
| 555 | WPMST()->render->add_style( 'wpmtst-animate' ); |
| 556 | WPMST()->render->add_script( 'wpmtst-readmore' ); |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Lazy Load |
| 562 | * |
| 563 | * @since 2.40.4 |
| 564 | */ |
| 565 | public function has_lazyload() { |
| 566 | if ( ! function_exists( 'wp_lazy_loading_enabled' ) || ! apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'strong_testimonials_has_lazyload' ) ) { |
| 567 | $options = get_option( 'wpmtst_options' ); |
| 568 | if ( isset( $options['lazyload'] ) && $options['lazyload'] ) { |
| 569 | WPMST()->render->add_style( 'wpmtst-lazyload-css' ); |
| 570 | WPMST()->render->add_script( 'wpmtst-lozad' ); |
| 571 | WPMST()->render->add_script( 'wpmtst-lozad-load' ); |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | endif; |
| 578 |