PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.10
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Logger.php +21 -21 4.0.63.11.10 View file →
@@ -54,10 +54,10 @@
54 54 * @return Logger Module object.
55 55 */
56 56 public function load( $product ) {
57 57 $this->product = $product;
58 - add_action( 'wp_loaded', array( $this, 'setup_actions' ) );
59 - add_action( 'admin_init', array( $this, 'setup_notification' ) );
58 + $this->setup_notification();
59 + $this->setup_actions();
60 60 return $this;
61 61 }
62 62
63 63 /**
@@ -63,12 +63,14 @@
63 63 /**
64 64 * Setup notification on admin.
65 65 */
66 66 public function setup_notification() {
67 - if ( $this->is_logger_active() ) {
67 + if ( ! $this->product->is_wordpress_available() ) {
68 68 return;
69 69 }
70 +
70 71 add_filter( 'themeisle_sdk_registered_notifications', [ $this, 'add_notification' ] );
72 +
71 73 }
72 74
73 75 /**
74 76 * Setup tracking actions.
@@ -76,8 +78,9 @@
76 78 public function setup_actions() {
77 79 if ( ! $this->is_logger_active() ) {
78 80 return;
79 81 }
82 +
80 83 add_action(
81 84 'admin_enqueue_scripts',
82 85 function() {
83 86 if ( ! apply_filters( 'themeisle_sdk_enable_telemetry', false ) ) {
@@ -85,9 +88,9 @@
85 88 }
86 89
87 90 $this->load_telemetry();
88 91 },
89 - PHP_INT_MAX
92 + PHP_INT_MAX
90 93 );
91 94
92 95 $action_key = $this->product->get_key() . '_log_activity';
93 96 if ( ! wp_next_scheduled( $action_key ) ) {
@@ -101,28 +104,26 @@
101 104 *
102 105 * @return bool Is logger active?
103 106 */
104 107 private function is_logger_active() {
105 - if ( apply_filters( 'themeisle_sdk_disable_telemetry', false ) ) {
106 - return false;
107 - }
108 108 $default = 'no';
109 109
110 110 if ( ! $this->product->is_wordpress_available() ) {
111 111 $default = 'yes';
112 112 } else {
113 - $all_products = Loader::get_products();
114 - foreach ( $all_products as $product ) {
115 - if ( $product->requires_license() ) {
113 + $pro_slug = $this->product->get_pro_slug();
114 +
115 + if ( ! empty( $pro_slug ) ) {
116 + $all_products = Loader::get_products();
117 + if ( isset( $all_products[ $pro_slug ] ) ) {
116 118 $default = 'yes';
117 - break;
118 119 }
119 120 }
120 121 }
121 122
122 -
123 123 return ( get_option( $this->product->get_key() . '_logger_flag', $default ) === 'yes' );
124 124 }
125 +
125 126 /**
126 127 * Add notification to queue.
127 128 *
128 129 * @param array $all_notifications Previous notification.
@@ -177,17 +178,16 @@
177 178 'method' => 'POST',
178 179 'timeout' => 3,
179 180 'redirection' => 5,
180 181 'body' => array(
181 - 'site' => get_site_url(),
182 - 'slug' => $this->product->get_slug(),
183 - 'version' => $this->product->get_version(),
184 - 'wp_version' => $wp_version,
185 - 'install_time' => $this->product->get_install_time(),
186 - 'locale' => get_locale(),
187 - 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ),
188 - 'environment' => $environment,
189 - 'license' => apply_filters( $this->product->get_key() . '_license_status', '' ),
182 + 'site' => get_site_url(),
183 + 'slug' => $this->product->get_slug(),
184 + 'version' => $this->product->get_version(),
185 + 'wp_version' => $wp_version,
186 + 'locale' => get_locale(),
187 + 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ),
188 + 'environment' => $environment,
189 + 'license' => apply_filters( $this->product->get_key() . '_license_status', '' ),
190 190 ),
191 191 )
192 192 );
193 193 }