Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/ThirdParty/Themes/Shoptimizer.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + namespace WP_Rocket\ThirdParty\Themes;
3 +
4 + use WP_Rocket\Event_Management\Subscriber_Interface;
5 +
6 + class Shoptimizer implements Subscriber_Interface {
7 + /**
8 + * Returns an array of events that this subscriber wants to listen to.
9 + *
10 + * @return array
11 + */
12 + public static function get_subscribed_events() {
13 + return [
14 + 'rocket_exclude_defer_js' => 'exclude_jquery_deferjs_with_cart_drawer',
15 + ];
16 + }
17 +
18 + /**
19 + * Exclude Jquery from defer JS.
20 + *
21 + * @param array $exclusions Excluded values from defer JS.
22 + *
23 + * @return array
24 + */
25 + public function exclude_jquery_deferjs_with_cart_drawer( $exclusions ) {
26 + if ( ! function_exists( 'shoptimizer_get_option' ) || ! shoptimizer_get_option( 'shoptimizer_layout_woocommerce_enable_sidebar_cart' ) ) {
27 + return $exclusions;
28 + }
29 +
30 + $exclusions[] = '\/jquery(-migrate)?-?([0-9.]+)?(.min|.slim|.slim.min)?.js(\?(.*))?';
31 + return $exclusions;
32 + }
33 + }
34 +