diff --git a/.gitchange b/.gitchange index f15405b2..84659238 100644 --- a/.gitchange +++ b/.gitchange @@ -1,2 +1,2 @@ 1461486526 -853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:588681f77b1261.32209414 +853d9120b42cf4f2eabe2f35ea18a6ace7170ea6:5886ac118255b9.88334645 diff --git a/CHANGELOG.md b/CHANGELOG.md index 722e3f8f..3dbbb8e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - (s2Member) **Bug Fix:** This release corrects a minor server-side validation bug that was related to the use of non-personal email address. See [Thread #1195](https://forums.wpsharks.com/t/bugfix-file-custom-reg-fields-inc-php-missing-bracket/1195). - (s2Member) **Bug Fix:** Updated several outdated links within the software; e.g., removing older `www.` references, correcting forum links, and more. Also corrected missing changelog. See [Issue #1027](https://github.com/websharks/s2member/issues/1027). - (s2Member Pro) **Pro Upgrader:** The pro upgrader has been refactored and now asks for your s2Member Pro License Key instead of your s2Member.com password. The next time you upgrade to the most recent version of s2Member Pro, you will be asked for your License Key. You can obtain your License Key by logging into your account at s2Member.com. Once logged in, visit your 'My Account' page, where you will find your License Key right at the top. See [Issue #668](https://github.com/websharks/s2member/issues/668). - +- (s2Member/s2Member Pro) **CloudFlare Compat.:** Enhancing compatibility with Rocket Loader via `data-cfasync="false"` on dynamic s2Member scripts. See: [Issue #1038](https://github.com/websharks/s2member/issues/1038). = v161129 = - (s2Member Pro) **Bug Fix:** Stripe refund notifications via the Stripe Webhook were always interpreted by s2Member as full refunds. This release corrects this bug so that s2Member will handle partial refunds via the Stripe API properly in all cases. Props @raamdev for reporting. diff --git a/src/includes/classes/css-js-themes.inc.php b/src/includes/classes/css-js-themes.inc.php index 8444c124..edc0f780 100644 --- a/src/includes/classes/css-js-themes.inc.php +++ b/src/includes/classes/css-js-themes.inc.php @@ -131,5 +131,27 @@ public static function add_js_w_globals() } do_action('ws_plugin__s2member_after_add_js_w_globals', get_defined_vars()); } + + /** + * Disallow async loading. + * + * @package s2Member\CSS_JS + * @since 17xxxx Enhancing CloudFlare compat. + * + * @attaches-to ``add_filter('script_loader_tag');`` + * + * @param string $tag The script tag. + * @param string $handle The script handle. + * + * @return string Possibly altered script tag. + */ + public static function script_loader_tag($tag = '', $handle = '') + { + if ($handle === 'ws-plugin--s2member') { + $tag = str_replace(' src=', ' data-cfasync="false" src=', $tag); + } + return $tag; // Prevent RocketLoader from loading async. + // See: + } } } diff --git a/src/includes/hooks.inc.php b/src/includes/hooks.inc.php index 03c20ac6..2b27242e 100644 --- a/src/includes/hooks.inc.php +++ b/src/includes/hooks.inc.php @@ -71,6 +71,7 @@ add_action('wp_print_styles', 'c_ws_plugin__s2member_css_js_themes::add_css'); add_action('wp_print_scripts', 'c_ws_plugin__s2member_css_js_themes::add_js_w_globals'); +add_filter('script_loader_tag', 'c_ws_plugin__s2member_css_js_themes::script_loader_tag', 10, 2); add_action('wp_login_failed', 'c_ws_plugin__s2member_brute_force::track_failed_logins'); add_filter('authenticate', 'c_ws_plugin__s2member_brute_force::stop_brute_force_logins', 100);