elementor
1 year ago
logs
1 month ago
strong-testimonials-beaver-block
1 year ago
submodules
8 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
1 month ago
class-strong-testimonials-form.php
1 month ago
class-strong-testimonials-order.php
1 year ago
class-strong-testimonials-privacy.php
1 year ago
class-strong-testimonials-render.php
1 month ago
class-strong-testimonials-templates.php
1 year ago
class-strong-testimonials-view-shortcode.php
1 week ago
class-strong-testimonials-view-widget.php
1 year ago
class-strong-view-display.php
1 day ago
class-strong-view-form.php
1 day ago
class-strong-view-slideshow.php
1 day ago
class-strong-view.php
1 day ago
class-walker-strong-category-checklist-front.php
1 year ago
deprecated.php
1 year ago
filters.php
1 month ago
functions-activation.php
1 month ago
functions-content.php
11 months ago
functions-image.php
5 months ago
functions-rating.php
1 year ago
functions-template-form.php
1 week ago
functions-template.php
4 months ago
functions-views.php
1 year ago
functions.php
1 month 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
1 month ago
class-strong-view-slideshow.php
513 lines
| 1 | <?php |
| 2 | /** |
| 3 | * View Slideshow 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_Slideshow' ) ) : |
| 14 | |
| 15 | class Strong_View_Slideshow extends Strong_View_Display { |
| 16 | |
| 17 | /** |
| 18 | * Strong_View constructor. |
| 19 | * |
| 20 | * @param array $atts |
| 21 | */ |
| 22 | public function __construct( $atts = array() ) { |
| 23 | parent::__construct( $atts ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Process the view. |
| 28 | * |
| 29 | * Used by main class to load the scripts and styles for this View. |
| 30 | */ |
| 31 | public function process() { |
| 32 | $this->build_query(); |
| 33 | $this->build_classes(); |
| 34 | |
| 35 | $this->find_stylesheet(); |
| 36 | $this->has_slideshow(); |
| 37 | $this->has_stars(); |
| 38 | $this->has_readmore(); |
| 39 | $this->has_lazyload(); |
| 40 | |
| 41 | $this->load_extra_stylesheets(); |
| 42 | |
| 43 | // If we can preprocess, we can add the inline style in the <head>. |
| 44 | add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 ); |
| 45 | |
| 46 | do_action( 'wpmtst_view_processed' ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Build the view. |
| 51 | */ |
| 52 | public function build() { |
| 53 | // May need to remove any hooks or filters that were set by other Views on the page. |
| 54 | |
| 55 | do_action( 'wpmtst_view_build_before', $this ); |
| 56 | |
| 57 | $this->build_query(); |
| 58 | $this->build_classes(); |
| 59 | |
| 60 | $this->find_stylesheet(); |
| 61 | $this->has_slideshow(); |
| 62 | $this->has_stars(); |
| 63 | $this->has_readmore(); |
| 64 | $this->has_lazyload(); |
| 65 | |
| 66 | $this->load_dependent_scripts(); |
| 67 | $this->load_extra_stylesheets(); |
| 68 | |
| 69 | // If we cannot preprocess, add the inline style to the footer. |
| 70 | add_action( 'wp_footer', array( $this, 'add_custom_style' ) ); |
| 71 | |
| 72 | /** |
| 73 | * Add filters. |
| 74 | */ |
| 75 | $this->add_content_filters(); |
| 76 | add_filter( 'get_avatar', 'wpmtst_get_avatar', 10, 3 ); |
| 77 | add_filter( 'embed_defaults', 'wpmtst_embed_size', 10, 2 ); |
| 78 | |
| 79 | /** |
| 80 | * Add actions. |
| 81 | */ |
| 82 | |
| 83 | // Read more page |
| 84 | add_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' ); |
| 85 | |
| 86 | /** |
| 87 | * Locate template. |
| 88 | */ |
| 89 | $this->template_file = apply_filters( 'wpmtst_view_template_file_slideshow', WPMST()->templates->get_template_attr( $this->atts, 'template' ) ); |
| 90 | |
| 91 | /** |
| 92 | * Allow add-ons to hijack the output generation. |
| 93 | */ |
| 94 | $query = $this->query; |
| 95 | $atts = $this->atts; |
| 96 | if ( has_filter( 'wpmtst_render_view_template' ) ) { |
| 97 | $html = apply_filters( 'wpmtst_render_view_template', '', $this ); |
| 98 | } else { |
| 99 | |
| 100 | /** |
| 101 | * Gutenberg. Yay. |
| 102 | * @since 2.31.9 |
| 103 | */ |
| 104 | global $post; |
| 105 | $post_before = $post; |
| 106 | |
| 107 | ob_start(); |
| 108 | /** @noinspection PhpIncludeInspection */ |
| 109 | include $this->template_file; |
| 110 | $html = ob_get_clean(); |
| 111 | |
| 112 | $post = $post_before; |
| 113 | |
| 114 | } |
| 115 | |
| 116 | $html = $this->template_not_found_notice( isset( $this->atts['template'] ) ? $this->atts['template'] : '' ) . $html; |
| 117 | |
| 118 | /** |
| 119 | * Remove filters. |
| 120 | */ |
| 121 | $this->remove_content_filters(); |
| 122 | remove_filter( 'get_avatar', 'wpmtst_get_avatar' ); |
| 123 | remove_filter( 'embed_defaults', 'wpmtst_embed_size' ); |
| 124 | |
| 125 | /** |
| 126 | * Remove actions. |
| 127 | */ |
| 128 | remove_action( $this->atts['more_page_hook'], 'wpmtst_read_more_page' ); |
| 129 | |
| 130 | /** |
| 131 | * Hook to enqueue scripts. |
| 132 | */ |
| 133 | do_action( 'wpmtst_view_rendered', $this->atts ); |
| 134 | |
| 135 | wp_reset_postdata(); |
| 136 | |
| 137 | $this->html = apply_filters( 'strong_view_html', $html, $this ); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Build class list based on view attributes. |
| 142 | * |
| 143 | * This must happen after the query. |
| 144 | * TODO DRY |
| 145 | */ |
| 146 | public function build_classes() { |
| 147 | $options = Strong_Testimonials_Defaults::get_view_options(); |
| 148 | |
| 149 | $container_class_list = array( 'strong-view-id-' . $this->atts['view'] ); |
| 150 | $container_class_list = array_merge( $container_class_list, $this->get_template_css_class() ); |
| 151 | |
| 152 | if ( is_rtl() ) { |
| 153 | $container_class_list[] = 'rtl'; |
| 154 | } |
| 155 | |
| 156 | if ( $this->atts['class'] ) { |
| 157 | $container_class_list[] = $this->atts['class']; |
| 158 | } |
| 159 | |
| 160 | $container_data_list = array( |
| 161 | 'count' => $this->post_count, |
| 162 | ); |
| 163 | |
| 164 | $content_class_list = array(); |
| 165 | |
| 166 | $post_class_list = array( 'wpmtst-testimonial testimonial' ); |
| 167 | |
| 168 | if ( 'excerpt' === $this->atts['content'] ) { |
| 169 | $post_class_list[] = 'excerpt'; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Slideshow |
| 174 | */ |
| 175 | $settings = $this->atts['slideshow_settings']; |
| 176 | |
| 177 | $container_class_list[] = 'slider-container'; |
| 178 | |
| 179 | if ( 'show_multiple' === $settings['type'] ) { |
| 180 | $container_class_list[] = 'carousel'; |
| 181 | } |
| 182 | |
| 183 | $container_class_list[] = 'slider-mode-' . $settings['effect']; |
| 184 | |
| 185 | if ( $settings['adapt_height'] ) { |
| 186 | $container_class_list[] = 'slider-adaptive'; |
| 187 | } elseif ( $settings['stretch'] ) { |
| 188 | $container_class_list[] = 'slider-stretch'; |
| 189 | } |
| 190 | |
| 191 | $nav_methods = $options['slideshow_nav_method']; |
| 192 | $nav_styles = $options['slideshow_nav_style']; |
| 193 | $control = $settings['controls_type']; |
| 194 | $control_style = $settings['controls_style']; |
| 195 | $pager = $settings['pager_type']; |
| 196 | $pager_style = $settings['pager_style']; |
| 197 | |
| 198 | // Controls |
| 199 | if ( isset( $nav_methods['controls'][ $control ]['class'] ) && $nav_methods['controls'][ $control ]['class'] ) { |
| 200 | if ( 'sides' === $control ) { |
| 201 | if ( 'show_single' === $settings['type'] ) { |
| 202 | $container_class_list[] = $nav_methods['controls'][ $control ]['class']; |
| 203 | } else { |
| 204 | $container_class_list[] = $nav_methods['controls'][ $control ]['class'] . '-outside'; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | if ( 'none' !== $control ) { |
| 210 | if ( isset( $nav_styles['controls'][ $control_style ]['class'] ) && $nav_styles['controls'][ $control_style ]['class'] ) { |
| 211 | $container_class_list[] = $nav_styles['controls'][ $control_style ]['class']; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | // Pager |
| 216 | if ( isset( $nav_methods['pager'][ $pager ]['class'] ) && $nav_methods['pager'][ $pager ]['class'] ) { |
| 217 | $container_class_list[] = $nav_methods['pager'][ $pager ]['class']; |
| 218 | } |
| 219 | |
| 220 | if ( 'none' !== $pager ) { |
| 221 | if ( isset( $nav_styles['pager'][ $pager_style ]['class'] ) && $nav_styles['pager'][ $pager_style ]['class'] ) { |
| 222 | $container_class_list[] = $nav_styles['pager'][ $pager_style ]['class']; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | // Position |
| 227 | // TODO Simplify logic. |
| 228 | if ( 'none' !== $pager || ( 'none' !== $control && 'sides' !== $control ) ) { |
| 229 | if ( 'show_multiple' === $settings['type'] ) { |
| 230 | $settings['nav_position'] = 'outside'; |
| 231 | } |
| 232 | $container_class_list[] = 'nav-position-' . $settings['nav_position']; |
| 233 | } |
| 234 | |
| 235 | $container_data_list['slider-var'] = $this->slideshow_signature(); |
| 236 | $container_data_list['state'] = 'idle'; |
| 237 | |
| 238 | $content_class_list[] = 'wpmslider-content'; |
| 239 | |
| 240 | $post_class_list[] = 't-slide'; |
| 241 | |
| 242 | /** |
| 243 | * Filter classes. |
| 244 | */ |
| 245 | $this->atts['container_data'] = apply_filters( 'wpmtst_view_container_data', $container_data_list, $this->atts ); |
| 246 | $this->atts['container_class'] = implode( ' ', apply_filters( 'wpmtst_view_container_class', array_filter( $container_class_list ), $this->atts ) ); |
| 247 | $this->atts['content_class'] = implode( ' ', apply_filters( 'wpmtst_view_content_class', array_filter( $content_class_list ), $this->atts ) ); |
| 248 | $this->atts['post_class'] = implode( ' ', apply_filters( 'wpmtst_view_post_class', array_filter( $post_class_list ), $this->atts ) ); |
| 249 | |
| 250 | /** |
| 251 | * Store updated atts. |
| 252 | */ |
| 253 | WPMST()->set_atts( $this->atts ); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Slideshow |
| 258 | * |
| 259 | * @since 2.16.0 In Strong_View class. |
| 260 | */ |
| 261 | public function has_slideshow() { |
| 262 | |
| 263 | $settings = $this->atts['slideshow_settings']; |
| 264 | $not_full_controls = ( 'none' !== $settings['controls_type'] || 'full' !== $settings['controls_type'] ); |
| 265 | |
| 266 | /* |
| 267 | * Controls with or without Pagination |
| 268 | */ |
| 269 | if ( isset( $settings['controls_type'] ) && 'none' !== $settings['controls_type'] ) { |
| 270 | |
| 271 | $controls_type = $settings['controls_type']; |
| 272 | if ( 'sides' === $controls_type && 'show_multiple' === $settings['type'] ) { |
| 273 | $controls_type .= '-outside'; |
| 274 | } |
| 275 | |
| 276 | $filename = 'slider-controls-' . $controls_type . '-' . $settings['controls_style']; |
| 277 | |
| 278 | if ( 'full' !== $settings['controls_type'] ) { |
| 279 | if ( isset( $settings['pager_style'] ) && 'none' !== $settings['pager_type'] ) { |
| 280 | $filename .= '-pager-' . $settings['pager_style']; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) { |
| 285 | wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version ); |
| 286 | WPMST()->render->add_style( "wpmtst-$filename" ); |
| 287 | } |
| 288 | } elseif ( $not_full_controls ) { |
| 289 | |
| 290 | /* |
| 291 | * Pagination only |
| 292 | */ |
| 293 | if ( isset( $settings['pager_type'] ) && 'none' !== $settings['pager_type'] ) { |
| 294 | |
| 295 | //TODO Adapt for multiple pager types (only one right now). |
| 296 | $filename = 'slider-pager-' . $settings['pager_style']; |
| 297 | |
| 298 | if ( file_exists( WPMTST_PUBLIC . "css/$filename.css" ) ) { |
| 299 | wp_register_style( "wpmtst-$filename", WPMTST_PUBLIC_URL . "css/$filename.css", array(), $this->plugin_version ); |
| 300 | WPMST()->render->add_style( "wpmtst-$filename" ); |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | WPMST()->render->add_script( 'wpmtst-slider' ); |
| 306 | WPMST()->render->add_script_var( 'wpmtst-slider', $this->slideshow_signature(), $this->slideshow_args() ); |
| 307 | WPMST()->render->add_script( 'wpmtst-controller' ); |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Create unique slideshow signature. |
| 312 | * |
| 313 | * @since 2.7.0 |
| 314 | * @private |
| 315 | * |
| 316 | * @return string |
| 317 | */ |
| 318 | private function slideshow_signature() { |
| 319 | return 'strong_slider_id_' . $this->atts['view']; |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * Assemble slideshow settings. |
| 324 | * |
| 325 | * @since 2.7.0 |
| 326 | * @private |
| 327 | * |
| 328 | * @return array |
| 329 | */ |
| 330 | private function slideshow_args() { |
| 331 | $options = get_option( 'wpmtst_options' ); |
| 332 | $view_options = Strong_Testimonials_Defaults::get_view_options(); |
| 333 | $compat_options = apply_filters( 'wpmtst_compat_options', get_option( 'wpmtst_compat_options', array() ) ); |
| 334 | |
| 335 | /** |
| 336 | * Compatibility with lazy loading and use of imagesLoaded. |
| 337 | * |
| 338 | * @since 2.31.0 As user-configurable. |
| 339 | */ |
| 340 | $compat = array(); |
| 341 | $enabled = false; |
| 342 | $pairs = array(); |
| 343 | |
| 344 | // Presets |
| 345 | // Flatsome theme |
| 346 | if ( class_exists( 'FL_LazyLoad_Images' ) && get_theme_mod( 'lazy_load_images' ) ) { |
| 347 | $enabled = true; |
| 348 | $pairs[] = array( |
| 349 | 'start' => 'lazy-load', |
| 350 | 'finish' => '', |
| 351 | ); |
| 352 | } |
| 353 | |
| 354 | // User settings |
| 355 | if ( $compat_options['lazyload']['enabled'] ) { |
| 356 | $enabled = true; |
| 357 | foreach ( $compat_options['lazyload']['classes'] as $key => $pair ) { |
| 358 | $pairs[] = $pair; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | // Bring together the presets and user settings. |
| 363 | $compat['lazyload'] = array( |
| 364 | 'active' => $enabled, |
| 365 | 'classes' => $pairs, |
| 366 | ); |
| 367 | |
| 368 | // Convert breakpoint variable names |
| 369 | // TODO Refactor to make this unnecessary. |
| 370 | $new_breakpoints = array(); |
| 371 | |
| 372 | // Fallback |
| 373 | $new_breakpoints['single'] = array( |
| 374 | 'maxSlides' => $this->atts['slideshow_settings']['show_single']['max_slides'], |
| 375 | 'moveSlides' => $this->atts['slideshow_settings']['show_single']['move_slides'], |
| 376 | 'slideMargin' => $this->atts['slideshow_settings']['show_single']['margin'], |
| 377 | ); |
| 378 | |
| 379 | $breakpoints = $this->atts['slideshow_settings']['breakpoints']; |
| 380 | foreach ( $breakpoints as $key => $breakpoint ) { |
| 381 | $new_breakpoints['multiple'][ $key ] = array( |
| 382 | 'width' => $breakpoints[ $key ]['width'], |
| 383 | 'maxSlides' => $breakpoints[ $key ]['max_slides'], |
| 384 | 'moveSlides' => $breakpoints[ $key ]['move_slides'], |
| 385 | 'slideMargin' => $breakpoints[ $key ]['margin'], |
| 386 | ); |
| 387 | } |
| 388 | |
| 389 | $args = array( |
| 390 | 'mode' => isset( $this->atts['slideshow_settings']['effect'] ) ? $this->atts['slideshow_settings']['effect'] : 'fade', |
| 391 | 'speed' => isset( $this->atts['slideshow_settings']['speed'] ) ? $this->atts['slideshow_settings']['speed'] * 1000 : 1000, |
| 392 | 'pause' => isset( $this->atts['slideshow_settings']['pause'] ) ? $this->atts['slideshow_settings']['pause'] * 1000 : 8000, |
| 393 | 'autoHover' => ( isset( $this->atts['slideshow_settings']['auto_hover'] ) && $this->atts['slideshow_settings']['auto_hover'] ) ? 1 : 0, |
| 394 | 'autoStart' => ( isset( $this->atts['slideshow_settings']['auto_start'] ) && $this->atts['slideshow_settings']['auto_start'] ) ? 1 : 0, |
| 395 | 'infiniteLoop' => ( isset( $this->atts['slideshow_settings']['continuous_sliding'] ) && $this->atts['slideshow_settings']['continuous_sliding'] ) ? 1 : 0, |
| 396 | 'stopAutoOnClick' => ( isset( $this->atts['slideshow_settings']['stop_auto_on_click'] ) && $this->atts['slideshow_settings']['stop_auto_on_click'] ) ? 1 : 0, |
| 397 | 'adaptiveHeight' => ( isset( $this->atts['slideshow_settings']['adapt_height'] ) && $this->atts['slideshow_settings']['adapt_height'] ) ? 1 : 0, |
| 398 | 'adaptiveHeightSpeed' => isset( $this->atts['slideshow_settings']['adapt_height_speed'] ) ? $this->atts['slideshow_settings']['adapt_height_speed'] * 1000 : 500, |
| 399 | 'controls' => 0, |
| 400 | 'autoControls' => 0, |
| 401 | 'pager' => 0, |
| 402 | 'slideCount' => $this->post_count, |
| 403 | 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_slider', true ), |
| 404 | 'compat' => $compat, |
| 405 | 'touchEnabled' => apply_filters( 'wpmtst_touch_enabled', true ), |
| 406 | 'type' => isset( $this->atts['slideshow_settings']['type'] ) ? $this->atts['slideshow_settings']['type'] : 'show_single', |
| 407 | 'breakpoints' => $new_breakpoints, |
| 408 | ); |
| 409 | |
| 410 | if ( ! $this->atts['slideshow_settings']['adapt_height'] ) { |
| 411 | $args['stretch'] = $this->atts['slideshow_settings']['stretch'] ? 1 : 0; |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Controls |
| 416 | */ |
| 417 | $options = $view_options['slideshow_nav_method']['controls']; |
| 418 | $control_setting = $this->atts['slideshow_settings']['controls_type']; |
| 419 | if ( ! $control_setting ) { |
| 420 | $control_setting = 'none'; |
| 421 | } |
| 422 | if ( isset( $options[ $control_setting ] ) && isset( $options[ $control_setting ]['args'] ) ) { |
| 423 | $args['controls'] = 1; |
| 424 | $args = array_merge( $args, $options[ $control_setting ]['args'] ); |
| 425 | } |
| 426 | |
| 427 | if ( 'none' !== $control_setting ) { |
| 428 | $options = $view_options['slideshow_nav_style']['controls']; |
| 429 | $setting = $this->atts['slideshow_settings']['controls_style']; |
| 430 | if ( ! $setting ) { |
| 431 | $setting = 'none'; |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Quick fix for ticket 12014 to translate slider text controls. |
| 436 | * TODO Refactor; see fix-i18n branch in translations.strong.test. |
| 437 | * |
| 438 | * @since 2.32.1 |
| 439 | */ |
| 440 | if ( 'text' === $setting ) { |
| 441 | $options['text']['args'] = array( |
| 442 | 'startText' => esc_html_x( 'Play', 'slideshow control', 'strong-testimonials' ), |
| 443 | 'stopText' => esc_html_x( 'Pause', 'slideshow control', 'strong-testimonials' ), |
| 444 | 'prevText' => esc_html_x( 'Previous', 'slideshow_control', 'strong-testimonials' ), |
| 445 | 'nextText' => esc_html_x( 'Next', 'slideshow_control', 'strong-testimonials' ), |
| 446 | ); |
| 447 | } |
| 448 | |
| 449 | if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) { |
| 450 | $args = array_merge( $args, $options[ $setting ]['args'] ); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | /** |
| 455 | * Pager |
| 456 | */ |
| 457 | $options = $view_options['slideshow_nav_method']['pager']; |
| 458 | $pager_setting = $this->atts['slideshow_settings']['pager_type']; |
| 459 | if ( ! $pager_setting ) { |
| 460 | $pager_setting = 'none'; |
| 461 | } |
| 462 | if ( isset( $options[ $pager_setting ] ) && isset( $options[ $pager_setting ]['args'] ) ) { |
| 463 | $args = array_merge( $args, $options[ $pager_setting ]['args'] ); |
| 464 | } |
| 465 | |
| 466 | if ( 'none' !== $pager_setting ) { |
| 467 | $options = $view_options['slideshow_nav_style']['pager']; |
| 468 | $setting = $this->atts['slideshow_settings']['pager_style']; |
| 469 | if ( ! $setting ) { |
| 470 | $setting = 'none'; |
| 471 | } |
| 472 | if ( isset( $options[ $setting ] ) && isset( $options[ $setting ]['args'] ) ) { |
| 473 | $args['pager'] = 1; |
| 474 | $args = array_merge( $args, $options[ $setting ]['args'] ); |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | $args['nextUrl'] = __( 'next-slide', 'strong-testimonials' ); |
| 479 | $args['prevUrl'] = __( 'previous-slide', 'strong-testimonials' ); |
| 480 | |
| 481 | return array( 'config' => apply_filters( 'wpmtst_slider_args', $args, $this->atts ) ); |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Lazy Load |
| 486 | * |
| 487 | * @since 2.40.4 |
| 488 | */ |
| 489 | public function has_lazyload() { |
| 490 | if ( ! function_exists( 'wp_lazy_loading_enabled' ) || ! apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'strong_testimonials_has_lazyload' ) ) { |
| 491 | $options = get_option( 'wpmtst_options' ); |
| 492 | if ( isset( $options['lazyload'] ) && $options['lazyload'] ) { |
| 493 | WPMST()->render->add_style( 'wpmtst-lazyload-css' ); |
| 494 | WPMST()->render->add_script( 'wpmtst-lozad' ); |
| 495 | WPMST()->render->add_script( 'wpmtst-lozad-load' ); |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * Overwrites inherited method preventing pagination for slider type. |
| 502 | * |
| 503 | * @param $args |
| 504 | * |
| 505 | * @return array |
| 506 | */ |
| 507 | public function query_pagination( $args ) { |
| 508 | return $args; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | endif; |
| 513 |