Skip to content

Commit

Permalink
(s2Member/s2Member Pro) **CloudFlare Compat.:** Enhancing compatibili…
Browse files Browse the repository at this point in the history
…ty with Rocket Loader via `data-cfasync="false"` on dynamic s2Member scripts. See: [Issue #1038](#1038).
  • Loading branch information
jaswsinc committed Jan 24, 2017
1 parent eda994e commit 767d0d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions src/includes/classes/css-js-themes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode->
}
}
}
1 change: 1 addition & 0 deletions src/includes/hooks.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 767d0d3

Please sign in to comment.