@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | |
27 | 27 | $defaults = array( |
28 | 28 | 't' => 'event', // Required: Hit type |
29 | - 'ec' => '', // Optional: Event category |
|
30 | - 'ea' => '', // Optional: Event Action |
|
31 | - 'el' => '', // Optional: Event Label |
|
32 | - 'ev' => null, // Optional: Event Value |
|
29 | + 'ec' => '', // Optional: Event category |
|
30 | + 'ea' => '', // Optional: Event Action |
|
31 | + 'el' => '', // Optional: Event Label |
|
32 | + 'ev' => null, // Optional: Event Value |
|
33 | 33 | ); |
34 | 34 | |
35 | - $body = array_merge( $defaults , $args ); |
|
35 | + $body = array_merge( $defaults, $args ); |
|
36 | 36 | |
37 | 37 | // We want to get the user's IP address when possible |
38 | - $ip = ''; |
|
38 | + $ip = ''; |
|
39 | 39 | if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) && ! filter_var( $_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP ) === false ) { |
40 | 40 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
41 | 41 | } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP ) === false ) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'uip' => $ip, |
82 | 82 | |
83 | 83 | // Optional: User Agent |
84 | - 'ua' => ! empty( $user_agent ) ? $user_agent : $_SERVER['HTTP_USER_AGENT'], |
|
84 | + 'ua' => ! empty( $user_agent ) ? $user_agent : $_SERVER['HTTP_USER_AGENT'], |
|
85 | 85 | |
86 | 86 | // Optional: Time of the event |
87 | 87 | 'z' => time() |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Unset empty values to reduce request size |
100 | 100 | foreach ( $body as $key => $value ) { |
101 | 101 | if ( empty( $value ) ) { |
102 | - unset( $body[ $key ] ); |
|
102 | + unset( $body[$key] ); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // Optional: Event Value |
143 | 143 | 'ev' => null, |
144 | 144 | ); |
145 | - $args = wp_parse_args( $args, $default_args ); |
|
145 | + $args = wp_parse_args( $args, $default_args ); |
|
146 | 146 | //$args = apply_filters( 'monsterinsights_mp_track_event_call', $args ); |
147 | 147 | |
148 | 148 | return monsterinsights_mp_api_call( $args ); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | |
57 | 57 | public function is_dismissed( $notice ) { |
58 | - if ( ! isset( $this->notices[ $notice ] ) ) { |
|
58 | + if ( ! isset( $this->notices[$notice] ) ) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | return true; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return null |
73 | 73 | */ |
74 | 74 | public function dismiss( $notice ) { |
75 | - $this->notices[ $notice ] = true; |
|
75 | + $this->notices[$notice] = true; |
|
76 | 76 | update_option( 'monsterinsights_notices', $this->notices ); |
77 | 77 | |
78 | 78 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return null |
89 | 89 | */ |
90 | 90 | public function undismiss( $notice ) { |
91 | - unset( $this->notices[ $notice ] ); |
|
91 | + unset( $this->notices[$notice] ); |
|
92 | 92 | update_option( 'monsterinsights_notices', $this->notices ); |
93 | 93 | |
94 | 94 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return ''; |
134 | 134 | } |
135 | 135 | |
136 | - $dismissible = ( $is_dismissible ) ? ' is-dismissible': ''; |
|
136 | + $dismissible = ( $is_dismissible ) ? ' is-dismissible' : ''; |
|
137 | 137 | |
138 | 138 | // Display inline notice |
139 | 139 | ob_start(); |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | $target = ''; |
180 | - if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') { |
|
180 | + if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank' ) { |
|
181 | 181 | $target = ' target="_blank" rel="noopener noreferrer"'; |
182 | 182 | } |
183 | 183 | |
184 | 184 | $class = 'button button-primary'; |
185 | 185 | if ( ! empty( $args['primary']['class'] ) ) { |
186 | - $class = ' class="'. $args['primary']['class'] . '"'; |
|
186 | + $class = ' class="' . $args['primary']['class'] . '"'; |
|
187 | 187 | } |
188 | 188 | ?> |
189 | - <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a> |
|
189 | + <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a> |
|
190 | 190 | <?php |
191 | 191 | } |
192 | 192 | |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | $target = ''; |
207 | - if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') { |
|
207 | + if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank' ) { |
|
208 | 208 | $target = ' target="_blank" rel="noopener noreferrer"'; |
209 | 209 | } |
210 | 210 | |
211 | 211 | $class = 'button button-secondary'; |
212 | 212 | if ( ! empty( $args['secondary']['class'] ) ) { |
213 | - $class = ' class="'. $args['secondary']['class'] . '"'; |
|
213 | + $class = ' class="' . $args['secondary']['class'] . '"'; |
|
214 | 214 | } |
215 | 215 | ?> |
216 | - <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a> |
|
216 | + <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a> |
|
217 | 217 | <?php |
218 | 218 | } |
219 | 219 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public function set_upgrader( &$upgrader ) { |
40 | 40 | |
41 | 41 | if ( is_object( $upgrader ) ) { |
42 | - $this->upgrader =& $upgrader; |
|
42 | + $this->upgrader = & $upgrader; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -84,9 +84,9 @@ |
||
84 | 84 | * @return string Javascript to output. |
85 | 85 | */ |
86 | 86 | public function frontend_output( ) { |
87 | - $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
88 | - $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
89 | - $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
87 | + $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION . ' - https://www.monsterinsights.com/ -->'; |
|
88 | + $output .= '<!-- ' . esc_html__( "You are currently in a preview window. MonsterInsights doesn't track preview window traffic to avoid false visit reports.", 'google-analytics-for-wordpress' ) . ' -->'; |
|
89 | + $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
90 | 90 | return $output; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -126,7 +126,7 @@ |
||
126 | 126 | function monsterinsights_rss_link_tagger( $guid ) { |
127 | 127 | global $post; |
128 | 128 | |
129 | - if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
|
129 | + if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ) { |
|
130 | 130 | if ( is_feed() ) { |
131 | 131 | if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
132 | 132 | $delimiter = '#'; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | } |
6 | 6 | |
7 | 7 | function monsterinsights_tools_url_builder() { |
8 | - ob_start();?> |
|
8 | + ob_start(); ?> |
|
9 | 9 | <div class="monsterinsights-upsell-under-box"> |
10 | 10 | <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2> |
11 | 11 | <p class="monsterinsights-upsell-lite-text"><?php esc_html_e( "By upgrading to MonsterInsights Pro, you can unlock the MonsterInsights URL builder that helps you better track your advertising and email marketing campaigns.", 'google-analytics-for-wordpress' ); ?></p> |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - add_action( 'admin_print_scripts', array( $this, 'js' ), 20 ); |
|
58 | - add_action( 'admin_print_scripts', array( $this, 'css' ) ); |
|
59 | - add_action( 'admin_footer', array( $this, 'modal' ) ); |
|
57 | + add_action( 'admin_print_scripts', array( $this, 'js' ), 20 ); |
|
58 | + add_action( 'admin_print_scripts', array( $this, 'css' ) ); |
|
59 | + add_action( 'admin_footer', array( $this, 'modal' ) ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function is_dev_url() { |
69 | 69 | // If it is an AM dev site, return false, so we can see them on our dev sites. |
70 | - if ( defined ('AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) { |
|
70 | + if ( defined( 'AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | } |
103 | 103 | if ( substr_count( $host, '.' ) > 1 ) { |
104 | - $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
104 | + $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
105 | 105 | foreach ( $subdomains_to_check as $subdomain ) { |
106 | 106 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
107 | 107 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | <div class="am-deactivate-survey-wrap"> |
314 | 314 | <form class="am-deactivate-survey" method="post"> |
315 | 315 | <span class="am-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', 'google-analytics-for-wordpress' ); ?></span> |
316 | - <span class="am-deactivate-survey-desc"><?php echo sprintf( esc_html__('If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); ?></span> |
|
316 | + <span class="am-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', 'google-analytics-for-wordpress' ), $this->name ); ?></span> |
|
317 | 317 | <div class="am-deactivate-survey-options"> |
318 | 318 | <?php foreach ( $options as $id => $option ) : ?> |
319 | 319 | <div class="am-deactivate-survey-option"> |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | <?php endforeach; ?> |
329 | 329 | </div> |
330 | 330 | <div class="am-deactivate-survey-footer"> |
331 | - <button type="submit" class="am-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__('Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></button> |
|
332 | - <a href="#" class="am-deactivate-survey-deactivate"><?php echo sprintf( esc_html__('Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></a> |
|
331 | + <button type="submit" class="am-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></button> |
|
332 | + <a href="#" class="am-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', 'google-analytics-for-wordpress' ), '&' ); ?></a> |
|
333 | 333 | </div> |
334 | 334 | </form> |
335 | 335 | </div> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return; |
191 | 191 | } |
192 | 192 | |
193 | - $plugin_notifications = $this->get_plugin_notifications( - 1, array( |
|
193 | + $plugin_notifications = $this->get_plugin_notifications( -1, array( |
|
194 | 194 | 'post_status' => 'all', |
195 | 195 | 'meta_key' => 'viewed', |
196 | 196 | 'meta_value' => '0', |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ( ! $continue ) { |
252 | - unset( $plugin_notifications[ $key ] ); |
|
252 | + unset( $plugin_notifications[$key] ); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | if ( ! $continue ) { |
267 | - unset( $plugin_notifications[ $key ] ); |
|
267 | + unset( $plugin_notifications[$key] ); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $continue = (string) wp_get_theme() === $theme; |
274 | 274 | |
275 | 275 | if ( ! empty( $theme ) && ! $continue ) { |
276 | - unset( $plugin_notifications[ $key ] ); |
|
276 | + unset( $plugin_notifications[$key] ); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Version validation. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | if ( ! $continue ) { |
288 | - unset( $plugin_notifications[ $key ] ); |
|
288 | + unset( $plugin_notifications[$key] ); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | if ( ! $continue ) { |
301 | - unset( $plugin_notifications[ $key ] ); |
|
301 | + unset( $plugin_notifications[$key] ); |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | if ( ! $continue ) { |
315 | - unset( $plugin_notifications[ $key ] ); |
|
315 | + unset( $plugin_notifications[$key] ); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | public function revoke_notifications( $ids ) { |
445 | 445 | // Loop through each of the IDs and find the post that has it as meta. |
446 | 446 | foreach ( (array) $ids as $id ) { |
447 | - $notifications = $this->get_plugin_notifications( - 1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) ); |
|
447 | + $notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) ); |
|
448 | 448 | if ( $notifications ) { |
449 | 449 | foreach ( $notifications as $notification ) { |
450 | 450 | update_post_meta( $notification->ID, 'viewed', 1 ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function monsterinsights_get_option( $key = '', $default = false ) { |
49 | 49 | global $monsterinsights_settings; |
50 | - $value = ! empty( $monsterinsights_settings[ $key ] ) ? $monsterinsights_settings[ $key ] : $default; |
|
50 | + $value = ! empty( $monsterinsights_settings[$key] ) ? $monsterinsights_settings[$key] : $default; |
|
51 | 51 | $value = apply_filters( 'monsterinsights_get_option', $value, $key, $default ); |
52 | 52 | return apply_filters( 'monsterinsights_get_option_' . $key, $value, $key, $default ); |
53 | 53 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_update_option( $key = '', $value = false ) { |
147 | 147 | |
148 | 148 | // If no key, exit |
149 | - if ( empty( $key ) ){ |
|
149 | + if ( empty( $key ) ) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $value = apply_filters( 'monsterinsights_update_option', $value, $key ); |
178 | 178 | |
179 | 179 | // Next let's try to update the value |
180 | - $settings[ $key ] = $value; |
|
180 | + $settings[$key] = $value; |
|
181 | 181 | $did_update = false; |
182 | 182 | //if ( $update_network_option ) { |
183 | 183 | // $did_update = update_site_option( $option_name, $settings ); |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | //} |
187 | 187 | |
188 | 188 | // If it updated, let's update the global variable |
189 | - if ( $did_update ){ |
|
189 | + if ( $did_update ) { |
|
190 | 190 | global $monsterinsights_settings; |
191 | - $monsterinsights_settings[ $key ] = $value; |
|
191 | + $monsterinsights_settings[$key] = $value; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $did_update; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | - if ( empty( $key ) ){ |
|
208 | + if ( empty( $key ) ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | //} |
225 | 225 | |
226 | 226 | // Next let's try to remove the key |
227 | - if( isset( $settings[ $key ] ) ) { |
|
228 | - unset( $settings[ $key ] ); |
|
227 | + if ( isset( $settings[$key] ) ) { |
|
228 | + unset( $settings[$key] ); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $did_update = false; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | //} |
237 | 237 | |
238 | 238 | // If it updated, let's update the global variable |
239 | - if ( $did_update ){ |
|
239 | + if ( $did_update ) { |
|
240 | 240 | global $monsterinsights_settings; |
241 | 241 | $monsterinsights_settings = $settings; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
258 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | // Next let's try to remove the keys |
277 | 277 | foreach ( $keys as $key ) { |
278 | - if( isset( $settings[ $key ] ) ) { |
|
279 | - unset( $settings[ $key ] ); |
|
278 | + if ( isset( $settings[$key] ) ) { |
|
279 | + unset( $settings[$key] ); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //} |
289 | 289 | |
290 | 290 | // If it updated, let's update the global variable |
291 | - if ( $did_update ){ |
|
291 | + if ( $did_update ) { |
|
292 | 292 | global $monsterinsights_settings; |
293 | 293 | $monsterinsights_settings = $settings; |
294 | 294 | } |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | ); |
380 | 380 | |
381 | 381 | foreach ( $exclude as $e ) { |
382 | - if ( ! empty( $settings[ $e ] ) ) { |
|
383 | - unset( $settings[ $e ] ); |
|
382 | + if ( ! empty( $settings[$e] ) ) { |
|
383 | + unset( $settings[$e] ); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | return wp_json_encode( $settings ); |