@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | parent::__construct(); |
24 | 24 | } |
25 | 25 | |
26 | - protected function get_report_html( $data = array() ){ |
|
26 | + protected function get_report_html( $data = array() ) { |
|
27 | 27 | return $this->get_upsell_notice(); |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $license_key = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key(); |
88 | 88 | return $license_key; |
89 | 89 | } |
90 | - public function get_site_license_key(){ |
|
90 | + public function get_site_license_key() { |
|
91 | 91 | return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : ''; |
92 | 92 | } |
93 | - public function get_network_license_key(){ |
|
93 | + public function get_network_license_key() { |
|
94 | 94 | return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : ''; |
95 | 95 | } |
96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return $this->licensed; |
99 | 99 | } |
100 | 100 | |
101 | - public function is_site_licensed(){ |
|
101 | + public function is_site_licensed() { |
|
102 | 102 | return ! empty( $this->site['key'] ) // has key |
103 | 103 | && $this->get_site_license_type() // has type |
104 | 104 | && ! $this->site_license_expired() // isn't expired |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - public function get_site_license_updates(){ |
|
120 | + public function get_site_license_updates() { |
|
121 | 121 | return get_option( 'monsterinsights_license_updates', '' ); |
122 | 122 | } |
123 | - public function get_network_license_updates(){ |
|
123 | + public function get_network_license_updates() { |
|
124 | 124 | return get_site_option( 'monsterinsights_network_license_updates', '' ); |
125 | 125 | } |
126 | 126 | |
127 | - public function set_site_license_updates(){ |
|
127 | + public function set_site_license_updates() { |
|
128 | 128 | update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) ); |
129 | 129 | } |
130 | 130 | public function set_network_license_updates() { |
131 | 131 | update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) ); |
132 | 132 | } |
133 | 133 | |
134 | - public function delete_site_license_updates(){ |
|
134 | + public function delete_site_license_updates() { |
|
135 | 135 | delete_option( 'monsterinsights_license_updates' ); |
136 | 136 | } |
137 | - public function delete_network_license_updates(){ |
|
137 | + public function delete_network_license_updates() { |
|
138 | 138 | delete_site_option( 'monsterinsights_license_updates' ); |
139 | 139 | } |
140 | 140 | |
141 | - public function time_to_check_site_license(){ |
|
141 | + public function time_to_check_site_license() { |
|
142 | 142 | $timestamp = get_option( 'monsterinsights_license_updates' ); |
143 | 143 | if ( ! $timestamp ) { |
144 | 144 | return true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | - public function time_to_check_network_license(){ |
|
154 | + public function time_to_check_network_license() { |
|
155 | 155 | $timestamp = get_site_option( 'monsterinsights_network_license_updates' ); |
156 | 156 | if ( ! $timestamp ) { |
157 | 157 | return true; |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - public function set_site_license( $data = array() ){ |
|
168 | + public function set_site_license( $data = array() ) { |
|
169 | 169 | update_option( 'monsterinsights_license', $data ); |
170 | 170 | $this->set_site_license_updates(); |
171 | - $this->site = $data; |
|
171 | + $this->site = $data; |
|
172 | 172 | } |
173 | - public function set_network_license( $data = array() ){ |
|
173 | + public function set_network_license( $data = array() ) { |
|
174 | 174 | update_site_option( 'monsterinsights_network_license', $data ); |
175 | 175 | $this->set_network_license_updates(); |
176 | - $this->network = $data; |
|
176 | + $this->network = $data; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | public function delete_site_license() { |
180 | 180 | delete_option( 'monsterinsights_license' ); |
181 | 181 | $this->delete_site_license_updates(); |
182 | - $this->site = array(); |
|
182 | + $this->site = array(); |
|
183 | 183 | } |
184 | 184 | public function delete_network_license() { |
185 | 185 | delete_site_option( 'monsterinsights_network_license' ); |
@@ -187,21 +187,21 @@ discard block |
||
187 | 187 | $this->network = array(); |
188 | 188 | } |
189 | 189 | |
190 | - public function get_license_type(){ |
|
190 | + public function get_license_type() { |
|
191 | 191 | if ( ! $this->has_license() ) { |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
195 | 195 | return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type(); |
196 | 196 | } |
197 | - public function get_site_license_type(){ |
|
197 | + public function get_site_license_type() { |
|
198 | 198 | return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : ''; |
199 | 199 | } |
200 | - public function get_network_license_type(){ |
|
200 | + public function get_network_license_type() { |
|
201 | 201 | return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : ''; |
202 | 202 | } |
203 | 203 | |
204 | - public function license_has_error(){ |
|
204 | + public function license_has_error() { |
|
205 | 205 | if ( ! $this->has_license() ) { |
206 | 206 | return false; |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | || $this->site_license_invalid() // is invalid |
216 | 216 | ; |
217 | 217 | } |
218 | - public function network_license_has_error(){ |
|
218 | + public function network_license_has_error() { |
|
219 | 219 | return |
220 | 220 | $this->network_license_expired() // is expired |
221 | 221 | || $this->network_license_disabled() // is disabled |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | ; |
224 | 224 | } |
225 | 225 | |
226 | - public function license_expired(){ |
|
226 | + public function license_expired() { |
|
227 | 227 | if ( ! $this->has_license() ) { |
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | 231 | return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired(); |
232 | 232 | } |
233 | - public function site_license_expired(){ |
|
233 | + public function site_license_expired() { |
|
234 | 234 | return ! empty( $this->site['is_expired'] ); |
235 | 235 | } |
236 | - public function network_license_expired(){ |
|
236 | + public function network_license_expired() { |
|
237 | 237 | return ! empty( $this->network['is_expired'] ); |
238 | 238 | } |
239 | 239 | |
240 | - public function license_disabled(){ |
|
240 | + public function license_disabled() { |
|
241 | 241 | if ( ! $this->has_license() ) { |
242 | 242 | return false; |
243 | 243 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | public function site_license_disabled() { |
248 | 248 | return ! empty( $this->site['is_disabled'] ); |
249 | 249 | } |
250 | - public function network_license_disabled(){ |
|
250 | + public function network_license_disabled() { |
|
251 | 251 | return ! empty( $this->network['is_disabled'] ); |
252 | 252 | } |
253 | 253 | |
254 | - public function license_invalid(){ |
|
254 | + public function license_invalid() { |
|
255 | 255 | if ( ! $this->has_license() ) { |
256 | 256 | return false; |
257 | 257 | } |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | public function site_license_invalid() { |
262 | 262 | return ! empty( $this->site['is_invalid'] ); |
263 | 263 | } |
264 | - public function network_license_invalid(){ |
|
264 | + public function network_license_invalid() { |
|
265 | 265 | return ! empty( $this->network['is_invalid'] ); |
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | - public function get_license_error(){ |
|
269 | + public function get_license_error() { |
|
270 | 270 | if ( ! $this->has_license() ) { |
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | |
274 | 274 | return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error(); |
275 | 275 | } |
276 | - public function get_site_license_error(){ |
|
276 | + public function get_site_license_error() { |
|
277 | 277 | if ( $this->site_license_expired() ) { |
278 | - return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
278 | + return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
279 | 279 | } else if ( $this->site_license_disabled() ) { |
280 | 280 | return esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
281 | 281 | } else if ( $this->site_license_invalid() ) { |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | return ''; |
285 | 285 | } |
286 | 286 | |
287 | - public function get_network_license_error(){ |
|
287 | + public function get_network_license_error() { |
|
288 | 288 | if ( $this->site_license_expired() ) { |
289 | - return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
289 | + return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
290 | 290 | } else if ( $this->site_license_disabled() ) { |
291 | 291 | return esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
292 | 292 | } else if ( $this->site_license_invalid() ) { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return $can_access; |
363 | 363 | } |
364 | 364 | |
365 | - public function get_default_license_key(){ |
|
365 | + public function get_default_license_key() { |
|
366 | 366 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
367 | 367 | return MONSTERINSIGHTS_LICENSE_KEY; |
368 | 368 | } |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | $license_key = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key(); |
88 | 88 | return $license_key; |
89 | 89 | } |
90 | - public function get_site_license_key(){ |
|
90 | + public function get_site_license_key() { |
|
91 | 91 | return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : ''; |
92 | 92 | } |
93 | - public function get_network_license_key(){ |
|
93 | + public function get_network_license_key() { |
|
94 | 94 | return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : ''; |
95 | 95 | } |
96 | 96 | |
97 | - public function has_license() { |
|
97 | + public function has_license() { |
|
98 | 98 | return $this->licensed; |
99 | 99 | } |
100 | 100 | |
101 | - public function is_site_licensed(){ |
|
101 | + public function is_site_licensed() { |
|
102 | 102 | return ! empty( $this->site['key'] ) // has key |
103 | 103 | && $this->get_site_license_type() // has type |
104 | 104 | && ! $this->site_license_expired() // isn't expired |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - public function get_site_license_updates(){ |
|
120 | + public function get_site_license_updates() { |
|
121 | 121 | return get_option( 'monsterinsights_license_updates', '' ); |
122 | 122 | } |
123 | - public function get_network_license_updates(){ |
|
123 | + public function get_network_license_updates() { |
|
124 | 124 | return get_site_option( 'monsterinsights_network_license_updates', '' ); |
125 | 125 | } |
126 | 126 | |
127 | - public function set_site_license_updates(){ |
|
127 | + public function set_site_license_updates() { |
|
128 | 128 | update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) ); |
129 | 129 | } |
130 | 130 | public function set_network_license_updates() { |
131 | 131 | update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) ); |
132 | 132 | } |
133 | 133 | |
134 | - public function delete_site_license_updates(){ |
|
134 | + public function delete_site_license_updates() { |
|
135 | 135 | delete_option( 'monsterinsights_license_updates' ); |
136 | 136 | } |
137 | - public function delete_network_license_updates(){ |
|
137 | + public function delete_network_license_updates() { |
|
138 | 138 | delete_site_option( 'monsterinsights_license_updates' ); |
139 | 139 | } |
140 | 140 | |
141 | - public function time_to_check_site_license(){ |
|
141 | + public function time_to_check_site_license() { |
|
142 | 142 | $timestamp = get_option( 'monsterinsights_license_updates' ); |
143 | 143 | if ( ! $timestamp ) { |
144 | 144 | return true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | - public function time_to_check_network_license(){ |
|
154 | + public function time_to_check_network_license() { |
|
155 | 155 | $timestamp = get_site_option( 'monsterinsights_network_license_updates' ); |
156 | 156 | if ( ! $timestamp ) { |
157 | 157 | return true; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - public function set_site_license( $data = array() ){ |
|
168 | + public function set_site_license( $data = array() ) { |
|
169 | 169 | update_option( 'monsterinsights_license', $data ); |
170 | 170 | $this->set_site_license_updates(); |
171 | 171 | $this->site = $data; |
172 | 172 | } |
173 | - public function set_network_license( $data = array() ){ |
|
173 | + public function set_network_license( $data = array() ) { |
|
174 | 174 | update_site_option( 'monsterinsights_network_license', $data ); |
175 | 175 | $this->set_network_license_updates(); |
176 | 176 | $this->network = $data; |
@@ -187,21 +187,21 @@ discard block |
||
187 | 187 | $this->network = array(); |
188 | 188 | } |
189 | 189 | |
190 | - public function get_license_type(){ |
|
190 | + public function get_license_type() { |
|
191 | 191 | if ( ! $this->has_license() ) { |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
195 | 195 | return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type(); |
196 | 196 | } |
197 | - public function get_site_license_type(){ |
|
197 | + public function get_site_license_type() { |
|
198 | 198 | return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : ''; |
199 | 199 | } |
200 | - public function get_network_license_type(){ |
|
200 | + public function get_network_license_type() { |
|
201 | 201 | return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : ''; |
202 | 202 | } |
203 | 203 | |
204 | - public function license_has_error(){ |
|
204 | + public function license_has_error() { |
|
205 | 205 | if ( ! $this->has_license() ) { |
206 | 206 | return false; |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | || $this->site_license_invalid() // is invalid |
216 | 216 | ; |
217 | 217 | } |
218 | - public function network_license_has_error(){ |
|
218 | + public function network_license_has_error() { |
|
219 | 219 | return |
220 | 220 | $this->network_license_expired() // is expired |
221 | 221 | || $this->network_license_disabled() // is disabled |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | ; |
224 | 224 | } |
225 | 225 | |
226 | - public function license_expired(){ |
|
226 | + public function license_expired() { |
|
227 | 227 | if ( ! $this->has_license() ) { |
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | 231 | return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired(); |
232 | 232 | } |
233 | - public function site_license_expired(){ |
|
233 | + public function site_license_expired() { |
|
234 | 234 | return ! empty( $this->site['is_expired'] ); |
235 | 235 | } |
236 | - public function network_license_expired(){ |
|
236 | + public function network_license_expired() { |
|
237 | 237 | return ! empty( $this->network['is_expired'] ); |
238 | 238 | } |
239 | 239 | |
240 | - public function license_disabled(){ |
|
240 | + public function license_disabled() { |
|
241 | 241 | if ( ! $this->has_license() ) { |
242 | 242 | return false; |
243 | 243 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | public function site_license_disabled() { |
248 | 248 | return ! empty( $this->site['is_disabled'] ); |
249 | 249 | } |
250 | - public function network_license_disabled(){ |
|
250 | + public function network_license_disabled() { |
|
251 | 251 | return ! empty( $this->network['is_disabled'] ); |
252 | 252 | } |
253 | 253 | |
254 | - public function license_invalid(){ |
|
254 | + public function license_invalid() { |
|
255 | 255 | if ( ! $this->has_license() ) { |
256 | 256 | return false; |
257 | 257 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | public function site_license_invalid() { |
262 | 262 | return ! empty( $this->site['is_invalid'] ); |
263 | 263 | } |
264 | - public function network_license_invalid(){ |
|
264 | + public function network_license_invalid() { |
|
265 | 265 | return ! empty( $this->network['is_invalid'] ); |
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | - public function get_license_error(){ |
|
269 | + public function get_license_error() { |
|
270 | 270 | if ( ! $this->has_license() ) { |
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | |
274 | 274 | return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error(); |
275 | 275 | } |
276 | - public function get_site_license_error(){ |
|
276 | + public function get_site_license_error() { |
|
277 | 277 | if ( $this->site_license_expired() ) { |
278 | 278 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
279 | 279 | } else if ( $this->site_license_disabled() ) { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | return ''; |
285 | 285 | } |
286 | 286 | |
287 | - public function get_network_license_error(){ |
|
287 | + public function get_network_license_error() { |
|
288 | 288 | if ( $this->site_license_expired() ) { |
289 | 289 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
290 | 290 | } else if ( $this->site_license_disabled() ) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | return ''; |
296 | 296 | } |
297 | 297 | |
298 | - public function license_can( $requires = 'lite' ) { |
|
298 | + public function license_can( $requires = 'lite' ) { |
|
299 | 299 | if ( ! monsterinsights_is_pro_version() || ! $this->has_license() ) { |
300 | 300 | return $requires === 'lite'; |
301 | 301 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return $can_access; |
363 | 363 | } |
364 | 364 | |
365 | - public function get_default_license_key(){ |
|
365 | + public function get_default_license_key() { |
|
366 | 366 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
367 | 367 | return MONSTERINSIGHTS_LICENSE_KEY; |
368 | 368 | } |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | global $admin_page_hooks; |
19 | 19 | |
20 | 20 | if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) { |
21 | - return false; |
|
21 | + return false; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $settings_page = false; |
25 | 25 | if ( ! empty( $admin_page_hooks['monsterinsights_dashboard'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_dashboard'] . '_page_monsterinsights_addons' ) { |
26 | - $settings_page = true; |
|
26 | + $settings_page = true; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | if ( ! empty( $admin_page_hooks['monsterinsights_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] . '_page_monsterinsights_addons' ) { |
30 | - $settings_page = true; |
|
30 | + $settings_page = true; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if ( ! empty( $admin_page_hooks['monsterinsights_network'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_network'] . '_page_monsterinsights_addons-network' ) { |
34 | - $settings_page = true; |
|
34 | + $settings_page = true; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return $settings_page; |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function monsterinsights_maybe_refresh_addons() { |
48 | 48 | if ( ! monsterinsights_is_addons_page() ) { |
49 | - return; |
|
49 | + return; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | if ( empty( $_POST['google-analytics-for-wordpress-refresh-addons-submit'] ) ) { |
54 | - return; |
|
54 | + return; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( ! wp_verify_nonce( $_POST['google-analytics-for-wordpress-refresh-addons'], 'google-analytics-for-wordpress-refresh-addons' ) ) { |
58 | - return; |
|
58 | + return; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | monsterinsights_get_addons_data( MonsterInsights()->license->get_valid_license_key() ); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | <div id="monsterinsights-addons" class="wrap"> |
94 | 94 | <div class="monsterinsights-clear"> |
95 | 95 | <?php |
96 | - /** |
|
97 | - * Developer Alert: |
|
98 | - * |
|
99 | - * Per the README, this is considered an internal hook and should |
|
100 | - * not be used by other developers. This hook's behavior may be modified |
|
101 | - * or the hook may be removed at any time, without warning. |
|
102 | - */ |
|
103 | - ?> |
|
96 | + /** |
|
97 | + * Developer Alert: |
|
98 | + * |
|
99 | + * Per the README, this is considered an internal hook and should |
|
100 | + * not be used by other developers. This hook's behavior may be modified |
|
101 | + * or the hook may be removed at any time, without warning. |
|
102 | + */ |
|
103 | + ?> |
|
104 | 104 | <?php do_action( 'monsterinsights_addons_section' ); ?> |
105 | 105 | </div> |
106 | 106 | </div> |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | |
118 | 118 | // If error(s) occurred during license key verification, display them and exit now. |
119 | 119 | if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->get_valid_license_key() ) { |
120 | - ?> |
|
120 | + ?> |
|
121 | 121 | <div class="error below-h2"> |
122 | 122 | <p> |
123 | 123 | <?php esc_html_e( 'In order to get access to Addons, you need to resolve your license key errors.', 'google-analytics-for-wordpress' ); ?> |
124 | 124 | </p> |
125 | 125 | </div> |
126 | 126 | <?php |
127 | - return; |
|
127 | + return; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // Get Addons |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // If no Addon(s) were returned, our API call returned an error. |
134 | 134 | // Show an error message with a button to reload the page, which will trigger another API call. |
135 | 135 | if ( ! $addons ) { |
136 | - ?> |
|
136 | + ?> |
|
137 | 137 | <form id="monsterinsights-addons-refresh-addons-form" method="post"> |
138 | 138 | <p> |
139 | 139 | <?php esc_html_e( 'There was an issue retrieving the addons for this site. Please click on the button below the refresh the addons data.', 'google-analytics-for-wordpress' ); ?> |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | </p> |
144 | 144 | </form> |
145 | 145 | <?php |
146 | - return; |
|
146 | + return; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // If here, we have Addons to display, so let's output them now. |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | ?> |
154 | 154 | <div id="monsterinsights-addons"> |
155 | 155 | <?php |
156 | - // Output Addons the User is licensed to use. |
|
157 | - if ( count( $addons['licensed'] )> 0 ) { |
|
158 | - ?> |
|
156 | + // Output Addons the User is licensed to use. |
|
157 | + if ( count( $addons['licensed'] )> 0 ) { |
|
158 | + ?> |
|
159 | 159 | <div class="monsterinsights-addons-area licensed" class="monsterinsights-clear"> |
160 | 160 | <h3><?php esc_html_e( 'Available Addons:', 'google-analytics-for-wordpress' ); ?></h3> |
161 | 161 | |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | <!-- list container class required for list.js --> |
164 | 164 | <div class="list"> |
165 | 165 | <?php |
166 | - foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | - monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | - } |
|
169 | - ?> |
|
166 | + foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | + monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </div> |
171 | 171 | </div> |
172 | 172 | </div> |
173 | 173 | <?php |
174 | - } // Close licensed addons |
|
174 | + } // Close licensed addons |
|
175 | 175 | |
176 | - // Output Addons the User isn't licensed to use. |
|
177 | - if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | - ?> |
|
176 | + // Output Addons the User isn't licensed to use. |
|
177 | + if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | + ?> |
|
179 | 179 | <div class="monsterinsights-addons-area unlicensed" class="monsterinsights-clear"> |
180 | 180 | <h3><?php esc_html_e( 'Unlock More Addons', 'google-analytics-for-wordpress' ); ?></h3> |
181 | 181 | <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url. '">', '</a>' ); ?></p> |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | <!-- list container class required for list.js --> |
185 | 185 | <div class="list"> |
186 | 186 | <?php |
187 | - foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | - monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | - } |
|
190 | - ?> |
|
187 | + foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | + monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | + } |
|
190 | + ?> |
|
191 | 191 | </div> |
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <?php |
195 | - } // Close unlicensed addons |
|
196 | - ?> |
|
195 | + } // Close unlicensed addons |
|
196 | + ?> |
|
197 | 197 | </div> |
198 | 198 | <?php |
199 | 199 | |
@@ -215,37 +215,37 @@ discard block |
||
215 | 215 | |
216 | 216 | // Get addons data from transient or perform API query if no transient. |
217 | 217 | if ( false === ( $addons = get_transient( '_monsterinsights_addons' ) ) ) { |
218 | - $addons = monsterinsights_get_addons_data( $key ); |
|
218 | + $addons = monsterinsights_get_addons_data( $key ); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // If no Addons exist, return false |
222 | 222 | if ( ! $addons ) { |
223 | - return false; |
|
223 | + return false; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // Iterate through Addons, to build two arrays: |
227 | 227 | // - Addons the user is licensed to use, |
228 | 228 | // - Addons the user isn't licensed to use. |
229 | 229 | $results = array( |
230 | - 'licensed' => array(), |
|
231 | - 'unlicensed'=> array(), |
|
230 | + 'licensed' => array(), |
|
231 | + 'unlicensed'=> array(), |
|
232 | 232 | ); |
233 | 233 | foreach ( (array) $addons as $i => $addon ) { |
234 | 234 | |
235 | - // Determine whether the user is licensed to use this Addon or not. |
|
236 | - if ( |
|
237 | - empty( $type ) || |
|
238 | - ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | - ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | - ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | - ) { |
|
242 | - // Unlicensed |
|
243 | - $results['unlicensed'][] = $addon; |
|
244 | - continue; |
|
245 | - } |
|
246 | - |
|
247 | - // Licensed |
|
248 | - $results['licensed'][] = $addon; |
|
235 | + // Determine whether the user is licensed to use this Addon or not. |
|
236 | + if ( |
|
237 | + empty( $type ) || |
|
238 | + ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | + ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | + ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | + ) { |
|
242 | + // Unlicensed |
|
243 | + $results['unlicensed'][] = $addon; |
|
244 | + continue; |
|
245 | + } |
|
246 | + |
|
247 | + // Licensed |
|
248 | + $results['licensed'][] = $addon; |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | // Get Addons |
269 | 269 | // If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information. |
270 | 270 | if ( $key ) { |
271 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
271 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
272 | 272 | } else { |
273 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-all-addons-data', array() ); |
|
273 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-all-addons-data', array() ); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // If there was an API error, set transient for only 10 minutes. |
277 | 277 | if ( ! $addons ) { |
278 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
279 | - return false; |
|
278 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
279 | + return false; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // If there was an error retrieving the addons, set the error. |
283 | 283 | if ( isset( $addons->error ) ) { |
284 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
285 | - return false; |
|
284 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
285 | + return false; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // Otherwise, our request worked. Save the data and return it. |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | $keys = array_keys( get_plugins() ); |
304 | 304 | |
305 | 305 | foreach ( $keys as $key ) { |
306 | - if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
307 | - return $key; |
|
308 | - } |
|
306 | + if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
307 | + return $key; |
|
308 | + } |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $slug; |
@@ -328,24 +328,24 @@ discard block |
||
328 | 328 | $slug = str_replace( 'monsterinsights-', '', $addon->slug ); |
329 | 329 | $slug = 'monsterinsights-' . $addon->slug; |
330 | 330 | if ( $slug === 'monsterinsights-ecommerce' ) { |
331 | - $slug = 'ga-ecommerce'; |
|
331 | + $slug = 'ga-ecommerce'; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
335 | 335 | $categories = implode( ',', $addon->categories ); |
336 | 336 | if ( ! $installed_plugins ) { |
337 | - $installed_plugins = get_plugins(); |
|
337 | + $installed_plugins = get_plugins(); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // If the Addon doesn't supply an upgrade_url key, it's because the user hasn't provided a license |
341 | 341 | // get_upgrade_link() will return the Lite or Pro link as necessary for us. |
342 | 342 | if ( ! isset( $addon->upgrade_url ) ) { |
343 | - $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
343 | + $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | // Link user to doc to install MI pro to install addons |
347 | 347 | if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
348 | - $addon->url = monsterinsights_get_url( 'addons-page', 'install-addons-link', "https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons" ); |
|
348 | + $addon->url = monsterinsights_get_url( 'addons-page', 'install-addons-link', "https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons" ); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | // Output the card |
@@ -353,19 +353,19 @@ discard block |
||
353 | 353 | <div class="monsterinsights-addon"> |
354 | 354 | <h3 class="monsterinsights-addon-title"><?php echo esc_html( $addon->title ); ?></h3> |
355 | 355 | <?php |
356 | - if ( ! empty( $addon->image ) ) { |
|
357 | - ?> |
|
356 | + if ( ! empty( $addon->image ) ) { |
|
357 | + ?> |
|
358 | 358 | <img class="monsterinsights-addon-thumb" src="<?php echo esc_attr( esc_url( $addon->image ) ); ?>" alt="<?php echo esc_attr( $addon->title ); ?>" /> |
359 | 359 | <?php |
360 | - } |
|
361 | - ?> |
|
360 | + } |
|
361 | + ?> |
|
362 | 362 | |
363 | 363 | <p class="monsterinsights-addon-excerpt"><?php echo esc_html( $addon->excerpt ); ?></p> |
364 | 364 | |
365 | 365 | <?php |
366 | - // If the Addon is unlicensed, show the upgrade button |
|
367 | - if ( ! $is_licensed ) { |
|
368 | - ?> |
|
366 | + // If the Addon is unlicensed, show the upgrade button |
|
367 | + if ( ! $is_licensed ) { |
|
368 | + ?> |
|
369 | 369 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
370 | 370 | <div class="interior"> |
371 | 371 | <div class="monsterinsights-addon-upgrade"> |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | </div> |
378 | 378 | </div> |
379 | 379 | <?php |
380 | - } else { |
|
381 | - // Addon is licensed |
|
382 | - |
|
383 | - // If the plugin is not installed, display an install message and button. |
|
384 | - if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
385 | - if ( empty( $addon->url ) ) { |
|
386 | - $addon->url = ''; |
|
387 | - } |
|
388 | - ?> |
|
380 | + } else { |
|
381 | + // Addon is licensed |
|
382 | + |
|
383 | + // If the plugin is not installed, display an install message and button. |
|
384 | + if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
385 | + if ( empty( $addon->url ) ) { |
|
386 | + $addon->url = ''; |
|
387 | + } |
|
388 | + ?> |
|
389 | 389 | <div class="monsterinsights-addon-not-installed monsterinsights-addon-message"> |
390 | 390 | <div class="interior"> |
391 | 391 | <?php if ( monsterinsights_is_pro_version() ) { ?> |
@@ -408,22 +408,22 @@ discard block |
||
408 | 408 | </div> |
409 | 409 | </div> |
410 | 410 | <?php |
411 | - } else { |
|
412 | - // Plugin is installed. |
|
411 | + } else { |
|
412 | + // Plugin is installed. |
|
413 | 413 | |
414 | - $active = false; |
|
415 | - $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
416 | - $ss_active = is_plugin_active( $plugin_basename ); |
|
417 | - |
|
418 | - if ( is_multisite() && is_network_admin() ) { |
|
419 | - $active = is_plugin_active_for_network( $plugin_basename ); |
|
420 | - } else { |
|
421 | - $active = is_plugin_active( $plugin_basename ); |
|
422 | - } |
|
423 | - |
|
424 | - if ( $active ) { |
|
425 | - // Plugin is active. Display the active message and deactivate button. |
|
426 | - ?> |
|
414 | + $active = false; |
|
415 | + $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
416 | + $ss_active = is_plugin_active( $plugin_basename ); |
|
417 | + |
|
418 | + if ( is_multisite() && is_network_admin() ) { |
|
419 | + $active = is_plugin_active_for_network( $plugin_basename ); |
|
420 | + } else { |
|
421 | + $active = is_plugin_active( $plugin_basename ); |
|
422 | + } |
|
423 | + |
|
424 | + if ( $active ) { |
|
425 | + // Plugin is active. Display the active message and deactivate button. |
|
426 | + ?> |
|
427 | 427 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
428 | 428 | <div class="interior"> |
429 | 429 | <?php if ( $ms_active ) { ?> |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | </div> |
450 | 450 | </div> |
451 | 451 | <?php |
452 | - } else { |
|
453 | - // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
454 | - ?> |
|
452 | + } else { |
|
453 | + // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
454 | + ?> |
|
455 | 455 | <div class="monsterinsights-addon-inactive monsterinsights-addon-message"> |
456 | 456 | <div class="interior"> |
457 | 457 | <?php if ( $ms_active ) { ?> |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | </div> |
475 | 475 | </div> |
476 | 476 | <?php |
477 | - } |
|
478 | - } |
|
479 | - } |
|
480 | - ?> |
|
477 | + } |
|
478 | + } |
|
479 | + } |
|
480 | + ?> |
|
481 | 481 | </div> |
482 | 482 | <?php |
483 | 483 | } |
484 | 484 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * not be used by other developers. This hook's behavior may be modified |
77 | 77 | * or the hook may be removed at any time, without warning. |
78 | 78 | */ |
79 | - do_action('monsterinsights_head'); |
|
79 | + do_action( 'monsterinsights_head' ); |
|
80 | 80 | ?> |
81 | 81 | <?php echo monsterinsights_ublock_notice(); ?> |
82 | 82 | <div id="monsterinsights-addon-heading" class="monsterinsights-addons-subheading monsterinsights-clearfix-after"> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | <div id="monsterinsights-addons"> |
155 | 155 | <?php |
156 | 156 | // Output Addons the User is licensed to use. |
157 | - if ( count( $addons['licensed'] )> 0 ) { |
|
157 | + if ( count( $addons['licensed'] ) > 0 ) { |
|
158 | 158 | ?> |
159 | 159 | <div class="monsterinsights-addons-area licensed" class="monsterinsights-clear"> |
160 | 160 | <h3><?php esc_html_e( 'Available Addons:', 'google-analytics-for-wordpress' ); ?></h3> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ?> |
179 | 179 | <div class="monsterinsights-addons-area unlicensed" class="monsterinsights-clear"> |
180 | 180 | <h3><?php esc_html_e( 'Unlock More Addons', 'google-analytics-for-wordpress' ); ?></h3> |
181 | - <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url. '">', '</a>' ); ?></p> |
|
181 | + <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url . '">', '</a>' ); ?></p> |
|
182 | 182 | |
183 | 183 | <div id="monsterinsights-addons-unlicensed" class="monsterinsights-addons"> |
184 | 184 | <!-- list container class required for list.js --> |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $slug = 'ga-ecommerce'; |
332 | 332 | } |
333 | 333 | |
334 | - $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
|
334 | + $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
|
335 | 335 | $categories = implode( ',', $addon->categories ); |
336 | 336 | if ( ! $installed_plugins ) { |
337 | 337 | $installed_plugins = get_plugins(); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // Link user to doc to install MI pro to install addons |
347 | - if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
347 | + if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[$plugin_basename] ) ) { |
|
348 | 348 | $addon->url = monsterinsights_get_url( 'addons-page', 'install-addons-link', "https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons" ); |
349 | 349 | } |
350 | 350 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | // Addon is licensed |
382 | 382 | |
383 | 383 | // If the plugin is not installed, display an install message and button. |
384 | - if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
384 | + if ( ! isset( $installed_plugins[$plugin_basename] ) ) { |
|
385 | 385 | if ( empty( $addon->url ) ) { |
386 | 386 | $addon->url = ''; |
387 | 387 | } |
@@ -427,17 +427,17 @@ discard block |
||
427 | 427 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
428 | 428 | <div class="interior"> |
429 | 429 | <?php if ( $ms_active ) { ?> |
430 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Active%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
430 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Active%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
431 | 431 | <?php } else { ?> |
432 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sActive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
432 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sActive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
433 | 433 | <?php } ?> |
434 | - <?php if ( ( is_multisite() && is_network_admin() && $ms_active ) || ! is_multisite() || ( is_multisite() && !is_network_admin() && !$ms_active && $ss_active ) ) { ?> |
|
434 | + <?php if ( ( is_multisite() && is_network_admin() && $ms_active ) || ! is_multisite() || ( is_multisite() && ! is_network_admin() && ! $ms_active && $ss_active ) ) { ?> |
|
435 | 435 | <div class="monsterinsights-addon-action"> |
436 | 436 | <a class="button button-primary monsterinsights-addon-action-button monsterinsights-deactivate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>"> |
437 | 437 | <i class="monsterinsights-toggle-on"></i> |
438 | 438 | <?php if ( is_multisite() && is_network_admin() && $ms_active ) { ?> |
439 | 439 | <?php esc_html_e( 'Network deactivate', 'google-analytics-for-wordpress' ); ?> |
440 | - <?php } else if ( is_multisite() && !is_network_admin() && !$ms_active && $ss_active ) { ?> |
|
440 | + <?php } else if ( is_multisite() && ! is_network_admin() && ! $ms_active && $ss_active ) { ?> |
|
441 | 441 | <?php esc_html_e( 'Deactivate', 'google-analytics-for-wordpress' ); ?> |
442 | 442 | <?php } else { ?> |
443 | 443 | <?php esc_html_e( 'Deactivate', 'google-analytics-for-wordpress' ); ?> |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | <div class="monsterinsights-addon-inactive monsterinsights-addon-message"> |
456 | 456 | <div class="interior"> |
457 | 457 | <?php if ( $ms_active ) { ?> |
458 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Inactive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
458 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Inactive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
459 | 459 | <?php } else { ?> |
460 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sInactive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
460 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sInactive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
461 | 461 | <?php } ?> |
462 | 462 | <div class="monsterinsights-addon-action"> |
463 | 463 | <a class="button button-primary monsterinsights-addon-action-button monsterinsights-activate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>"> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * not be used by other developers. This hook's behavior may be modified |
39 | 39 | * or the hook may be removed at any time, without warning. |
40 | 40 | */ |
41 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
41 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
42 | 42 | return $reports; |
43 | 43 | } |
44 | 44 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | <div id="monsterinsights-main-tab-<?php echo esc_attr( $report->name ); ?>" class="monsterinsights-main-nav-tab monsterinsights-nav-tab"> |
91 | 91 | <div class="monsterinsights-reports-action-bar monsterinsights-clear"> |
92 | 92 | <div class="monsterinsights-reports-action-bar-title"> |
93 | - <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
93 | + <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
94 | 94 | </div> |
95 | 95 | <div class="monsterinsights-reports-action-bar-actions"><?php |
96 | 96 | /** |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | check_ajax_referer( 'mi-admin-nonce', 'security' ); |
133 | 133 | |
134 | 134 | // Get variables |
135 | - $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | - $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | - $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | - $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
135 | + $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | + $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | + $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | + $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
139 | 139 | |
140 | 140 | |
141 | 141 | // Current user can authenticate |
142 | 142 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
143 | - wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
143 | + wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Only for Pro users, require a license key to be entered first so we can link to things. |
151 | - if ( monsterinsights_is_pro_version() ) { |
|
151 | + if ( monsterinsights_is_pro_version() ) { |
|
152 | 152 | if ( ! MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->is_network_licensed() ) { |
153 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
153 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
154 | 154 | } else if ( MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->site_license_has_error() ) { |
155 | 155 | // good to go: site licensed |
156 | 156 | } else if ( MonsterInsights()->license->is_network_licensed() && ! MonsterInsights()->license->network_license_has_error() ) { |
157 | 157 | // good to go: network licensed |
158 | 158 | } else { |
159 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
159 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | $site_auth = MonsterInsights()->auth->get_viewname(); |
165 | 165 | $ms_auth = is_multisite() && MonsterInsights()->auth->get_network_viewname(); |
166 | 166 | if ( ! $site_auth && ! $ms_auth ) { |
167 | - wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
167 | + wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | if ( empty( $name ) ) { |
171 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
171 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $report = MonsterInsights()->reporting->get_report( $name ); |
175 | 175 | |
176 | 176 | if ( empty( $report ) ) { |
177 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
177 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
178 | 178 | } |
179 | 179 | |
180 | - $args = array( 'start' => $start, 'end' => $end ); |
|
180 | + $args = array( 'start' => $start, 'end' => $end ); |
|
181 | 181 | if ( $isnetwork ) { |
182 | 182 | $args['network'] = true; |
183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | 'success' => true |
192 | 192 | ) |
193 | 193 | ); |
194 | - wp_send_json_success( array( 'html' => $data ) ); |
|
194 | + wp_send_json_success( array( 'html' => $data ) ); |
|
195 | 195 | } else { |
196 | 196 | wp_send_json_error( array( 'message' => $data['error'], 'data' => $data['data'] ) ); |
197 | 197 | } |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $data['usagetracking'] = get_option( 'monsterinsights_usage_tracking_config', false ); |
95 | 95 | $data['usercount'] = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set'; |
96 | 96 | $data['usesauth'] = $usesauth; |
97 | - $data['timezoneoffset']= date('P'); |
|
98 | - $data['installed_lite']= get_option( 'monsterinsights_installed_lite', array() ); |
|
97 | + $data['timezoneoffset'] = date( 'P' ); |
|
98 | + $data['installed_lite'] = get_option( 'monsterinsights_installed_lite', array() ); |
|
99 | 99 | $data['installed_pro'] = get_option( 'monsterinsights_installed_pro', array() ); |
100 | 100 | |
101 | 101 | |
102 | 102 | |
103 | 103 | // Retrieve current plugin information |
104 | - if( ! function_exists( 'get_plugins' ) ) { |
|
104 | + if ( ! function_exists( 'get_plugins' ) ) { |
|
105 | 105 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
106 | 106 | } |
107 | 107 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ( $plugins as $key => $plugin ) { |
112 | 112 | if ( in_array( $plugin, $active_plugins ) ) { |
113 | 113 | // Remove active plugins from list so we can show active and inactive separately |
114 | - unset( $plugins[ $key ] ); |
|
114 | + unset( $plugins[$key] ); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | |
132 | - if( ! $this->tracking_allowed() && ! $override ) { |
|
132 | + if ( ! $this->tracking_allowed() && ! $override ) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | public function schedule_send() { |
162 | 162 | if ( ! wp_next_scheduled( 'monsterinsights_usage_tracking_cron' ) ) { |
163 | 163 | $tracking = array(); |
164 | - $tracking['day'] = rand( 0, 6 ); |
|
164 | + $tracking['day'] = rand( 0, 6 ); |
|
165 | 165 | $tracking['hour'] = rand( 0, 23 ); |
166 | 166 | $tracking['minute'] = rand( 0, 59 ); |
167 | 167 | $tracking['second'] = rand( 0, 59 ); |
168 | - $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) + |
|
169 | - ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
168 | + $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) + |
|
169 | + ( $tracking['hour'] * HOUR_IN_SECONDS ) + |
|
170 | 170 | ( $tracking['minute'] * MINUTE_IN_SECONDS ) + |
171 | 171 | $tracking['second']; |
172 | - $tracking['initsend'] = strtotime("next sunday") + $tracking['offset']; |
|
172 | + $tracking['initsend'] = strtotime( "next sunday" ) + $tracking['offset']; |
|
173 | 173 | |
174 | 174 | wp_schedule_event( $tracking['initsend'], 'weekly', 'monsterinsights_usage_tracking_cron' ); |
175 | 175 | update_option( 'monsterinsights_usage_tracking_config', $tracking ); |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $datapoints = array(); |
92 | - foreach ( $data[ $class ]['datapoints'] as $datapoint ) { |
|
92 | + foreach ( $data[$class]['datapoints'] as $datapoint ) { |
|
93 | 93 | $datapoints[] = esc_js( $datapoint ); |
94 | 94 | } |
95 | 95 | |
96 | 96 | $trendpoints = array(); |
97 | - foreach ( $data[ $class ]['trendpoints'] as $trendpoint ) { |
|
97 | + foreach ( $data[$class]['trendpoints'] as $trendpoint ) { |
|
98 | 98 | $trendpoints[] = esc_js( $trendpoint ); |
99 | 99 | } |
100 | 100 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | } ); |
134 | 134 | |
135 | - var ctx = document.getElementById( "monsterinsights-overview-<?php echo $class;?>" ); |
|
135 | + var ctx = document.getElementById( "monsterinsights-overview-<?php echo $class; ?>" ); |
|
136 | 136 | var data = { |
137 | 137 | labels: [<?php echo implode( ', ', $labels ); ?>], |
138 | 138 | datasets: [ |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | pointHoverRadius: 6,//The radius of the point when hovered. |
158 | 158 | |
159 | 159 | |
160 | - labels: [<?php echo implode( ', ', $labels ); ?>], |
|
161 | - data: [<?php echo implode( ', ', $datapoints ); ?>], |
|
160 | + labels: [<?php echo implode( ', ', $labels ); ?>], |
|
161 | + data: [<?php echo implode( ', ', $datapoints ); ?>], |
|
162 | 162 | trend: [<?php echo implode( ', ', $trendpoints ); ?>], |
163 | 163 | }, |
164 | 164 | ] |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } ); |
247 | 247 | }; |
248 | 248 | |
249 | - var MonsterInsightsOverview<?php echo time();?> = new Chart( ctx, { |
|
249 | + var MonsterInsightsOverview<?php echo time(); ?> = new Chart( ctx, { |
|
250 | 250 | type: 'LineWithLine', |
251 | 251 | data: data, |
252 | 252 | plugins: [ |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | $countries = monsterinsights_get_country_list( true ); |
868 | 868 | $i = 1; |
869 | 869 | foreach ( $data['countries'] as $icountry => $countrydata ) { |
870 | - if ( ! empty( $countries[ $countrydata['iso'] ] ) ) { |
|
871 | - echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[ $countrydata['iso'] ] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
870 | + if ( ! empty( $countries[$countrydata['iso']] ) ) { |
|
871 | + echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[$countrydata['iso']] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
|
872 | 872 | } else { |
873 | 873 | echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>'; |
874 | 874 | } |
875 | - $i ++; |
|
875 | + $i++; |
|
876 | 876 | } |
877 | 877 | ?> |
878 | 878 | </ul> |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | . number_format_i18n( $referralsdata['sessions'] ) . |
914 | 914 | '</span>' . |
915 | 915 | '</li>'; |
916 | - $i ++; |
|
916 | + $i++; |
|
917 | 917 | } |
918 | 918 | ?> |
919 | 919 | </ul> |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | number_format_i18n( $toppagesdata['sessions'] ) . |
960 | 960 | '</span>' . |
961 | 961 | '</li>'; |
962 | - $i ++; |
|
962 | + $i++; |
|
963 | 963 | } |
964 | 964 | ?> |
965 | 965 | </ul> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | 33 | // Allow dashboard widget to be hidden on multisite installs |
34 | - $show_widget = is_multisite() ? apply_filters( 'monsterinsights_show_dashboard_widget', true ) : true; |
|
34 | + $show_widget = is_multisite() ? apply_filters( 'monsterinsights_show_dashboard_widget', true ) : true; |
|
35 | 35 | if ( ! $show_widget ) { |
36 | 36 | return false; |
37 | 37 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | |
62 | 62 | // Attept to place the widget at the top. |
63 | 63 | $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; |
64 | - $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[ self::WIDGET_KEY ] ); |
|
65 | - unset( $normal_dashboard[ self::WIDGET_KEY ] ); |
|
64 | + $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[self::WIDGET_KEY] ); |
|
65 | + unset( $normal_dashboard[self::WIDGET_KEY] ); |
|
66 | 66 | $sorted_dashboard = array_merge( $widget_instance, $normal_dashboard ); |
67 | 67 | $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; |
68 | 68 | } |