-
Notifications
You must be signed in to change notification settings - Fork 0
/
monarch-disable-stats.php
45 lines (35 loc) · 1.43 KB
/
monarch-disable-stats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
* Plugin Name: Monarch Disable Stats
* Plugin URI: https://github.com/moewe-io/monarch-disable-stats
* Description: When activated this plugin will disable Monarchs statistic collection
* Version: 1.00
* Author: MOEWE
* Author URI: https://www.moewe.io/
* Text Domain: monarch-disable-stats
* Domain Path: /languages
*/
class MOEWE_Monarch_Disable_Stats {
function __construct() {
add_action('plugins_loaded', [$this, 'disable_monarch_stats'], 100);
}
function disable_monarch_stats() {
if (isset($GLOBALS['et_monarch'])) {
remove_action('wp_ajax_add_stats_record_db', array($GLOBALS['et_monarch'], 'add_stats_record_db'));
remove_action('wp_ajax_nopriv_add_stats_record_db', array($GLOBALS['et_monarch'], 'add_stats_record_db'));
add_action('wp_ajax_add_stats_record_db', array($this, 'add_stats_record_db'));
add_action('wp_ajax_nopriv_add_stats_record_db', array($this, 'add_stats_record_db'));
}
}
function add_stats_record_db() {
wp_die(__('Sorry, Monarch statistics are disabled.', 'monarch-disable-stats'));
}
}
$GLOBALS['moewe_monarch_disable_stats'] = new MOEWE_Monarch_Disable_Stats();
// Updates
require 'libs/plugin-update-checker-4.4/plugin-update-checker.php';
Puc_v4_Factory::buildUpdateChecker(
'https://github.com/moewe-io/monarch-disable-stats/',
__FILE__,
'monarch-disable-stats'
)->setBranch('master');