Skip to content

Commit

Permalink
postpone jump out on AJAX calls for Statify 1.7 compatibility (#22)
Browse files Browse the repository at this point in the history
Statify 1.7 changed the JS tacking endpoint to WP AJAX, so we must not
skip the complete initialization on AJAX calls anymore. The routine now
breaks after adding the filter (if necessary).
  • Loading branch information
stklcode authored May 20, 2020
1 parent 9caa7b0 commit 902e211
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Same for IPv6 prefixes like _2001:db8:a0b:12f0::/64_.

## Changelog ##

### 1.5.1 / unreleased ###
* Fix initialization on AJAX calls for _Statify_ 1.7 compatibility

### 1.5.0 / 13.05.2020 ###
* Minimum required WordPress version is 4.7
* Removed `load_plugin_textdomain()` and `Domain Path` header
Expand Down
9 changes: 7 additions & 2 deletions inc/class-statifyblacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class StatifyBlacklist {
* @return void
*/
public static function init() {
// Skip on autosave or AJAX.
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Skip on autosave.
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
return;
}

Expand All @@ -97,6 +97,11 @@ public static function init() {
add_filter( 'statify__skip_tracking', array( 'StatifyBlacklist', 'apply_blacklist_filter' ) );
}

// Statify uses WP AJAX as of 1.7, so we need to reach this point. But there are no further admin/cron actions.
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}

// Admin only filters.
if ( is_admin() ) {
StatifyBlacklist_Admin::init();
Expand Down

0 comments on commit 902e211

Please sign in to comment.