@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | // Avoid loading scripts on pages that don't have admin bar such as WPBakery Page Builder. |
164 | - if (isset($_GET['vc_editable']) && isset($_GET['vc_post_id']) && $_GET['vc_editable'] === 'true') { |
|
164 | + if ( isset( $_GET['vc_editable'] ) && isset( $_GET['vc_post_id'] ) && $_GET['vc_editable'] === 'true' ) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Avoid adding admin bar scripts in Elementor's preview which is done via admin-ajax(where $pagenow = 'index.php') |
169 | - if ($pagenow === 'index.php' && isset($_GET['elementor-preview'])) { |
|
169 | + if ( $pagenow === 'index.php' && isset( $_GET['elementor-preview'] ) ) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | 'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=monsterinsights-onboarding' ) : admin_url( 'index.php?page=monsterinsights-onboarding' ), |
214 | 214 | 'roles_manage_options' => monsterinsights_get_manage_options_roles(), |
215 | 215 | 'user_roles' => $current_user->roles, |
216 | - 'roles_view_reports' => monsterinsights_get_option('view_reports'), |
|
216 | + 'roles_view_reports' => monsterinsights_get_option( 'view_reports' ), |
|
217 | 217 | ) |
218 | 218 | ); |
219 | 219 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function get_instance() |
32 | 32 | { |
33 | - if (!isset(self::$instance) && !(self::$instance instanceof MonsterInsights_VerifiedBadge_Controller)) { |
|
33 | + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof MonsterInsights_VerifiedBadge_Controller ) ) { |
|
34 | 34 | self::$instance = new MonsterInsights_VerifiedBadge_Controller(); |
35 | 35 | } |
36 | 36 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function register_shortcode() |
61 | 61 | { |
62 | - if (empty($this->shortcode_key)) { |
|
62 | + if ( empty( $this->shortcode_key ) ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - add_shortcode($this->shortcode_key, array($this, 'render_badge')); |
|
66 | + add_shortcode( $this->shortcode_key, array( $this, 'render_badge' ) ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function render_badge($atts) |
|
78 | + public function render_badge( $atts ) |
|
79 | 79 | { |
80 | - $atts = shortcode_atts(array( |
|
80 | + $atts = shortcode_atts( array( |
|
81 | 81 | 'appearance' => 'light', |
82 | 82 | 'position' => 'center' |
83 | - ), $atts, $this->shortcode_key); |
|
83 | + ), $atts, $this->shortcode_key ); |
|
84 | 84 | |
85 | - $img_src = esc_url(plugins_url('assets/images/monsterinsights-badge-' . (in_array($atts['appearance'], array('light', 'dark'), true) ? $atts['appearance'] : 'light') . '.svg', MONSTERINSIGHTS_PLUGIN_FILE)); |
|
85 | + $img_src = esc_url( plugins_url( 'assets/images/monsterinsights-badge-' . ( in_array( $atts['appearance'], array( 'light', 'dark' ), true ) ? $atts['appearance'] : 'light' ) . '.svg', MONSTERINSIGHTS_PLUGIN_FILE ) ); |
|
86 | 86 | |
87 | 87 | return sprintf( |
88 | 88 | '<div style="text-align: %1$s;"><a href="%2$s" target="_blank" rel="nofollow"><img style="display: inline-block" alt="%3$s" title="%3$s" src="%4$s"/></a></div>', |
89 | - (in_array($atts['position'], array('left', 'center', 'right'), true) ? $atts['position'] : 'center'), |
|
89 | + ( in_array( $atts['position'], array( 'left', 'center', 'right' ), true ) ? $atts['position'] : 'center' ), |
|
90 | 90 | $this->get_link(), |
91 | - __('Verified by MonsterInsights', 'google-analytics-for-wordpress'), |
|
91 | + __( 'Verified by MonsterInsights', 'google-analytics-for-wordpress' ), |
|
92 | 92 | $img_src |
93 | 93 | ); |
94 | 94 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function add_hooks() |
116 | 116 | { |
117 | - add_action('wp_footer', array($this, 'show_automatic_footer_badge'), 1000); |
|
118 | - add_action('wp_loaded', array($this, 'save_default_settings')); |
|
117 | + add_action( 'wp_footer', array( $this, 'show_automatic_footer_badge' ), 1000 ); |
|
118 | + add_action( 'wp_loaded', array( $this, 'save_default_settings' ) ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function save_default_settings() |
129 | 129 | { |
130 | - $appearance = monsterinsights_get_option('verified_appearance', false); |
|
131 | - $position = monsterinsights_get_option('verified_position', false); |
|
132 | - if (!$appearance) { |
|
133 | - monsterinsights_update_option('verified_appearance', 'light'); |
|
130 | + $appearance = monsterinsights_get_option( 'verified_appearance', false ); |
|
131 | + $position = monsterinsights_get_option( 'verified_position', false ); |
|
132 | + if ( ! $appearance ) { |
|
133 | + monsterinsights_update_option( 'verified_appearance', 'light' ); |
|
134 | 134 | } |
135 | - if (!$position) { |
|
136 | - monsterinsights_update_option('verified_position', 'center'); |
|
135 | + if ( ! $position ) { |
|
136 | + monsterinsights_update_option( 'verified_position', 'center' ); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function show_automatic_footer_badge() |
148 | 148 | { |
149 | - if (!monsterinsights_get_option('verified_automatic')) { |
|
149 | + if ( ! monsterinsights_get_option( 'verified_automatic' ) ) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $atts = array( |
154 | - 'appearance' => monsterinsights_get_option('verified_appearance'), |
|
155 | - 'position' => monsterinsights_get_option('verified_position'), |
|
154 | + 'appearance' => monsterinsights_get_option( 'verified_appearance' ), |
|
155 | + 'position' => monsterinsights_get_option( 'verified_position' ), |
|
156 | 156 | ); |
157 | 157 | // output escaped in render_badge function |
158 | - echo $this->render_badge($atts); // phpcs:ignore |
|
158 | + echo $this->render_badge( $atts ); // phpcs:ignore |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class MonsterInsights_VerifiedBadge_Controller |
|
4 | -{ |
|
3 | +class MonsterInsights_VerifiedBadge_Controller { |
|
5 | 4 | |
6 | 5 | /** |
7 | 6 | * Current class instance. |
@@ -28,8 +27,7 @@ discard block |
||
28 | 27 | * |
29 | 28 | * @return MonsterInsights_VerifiedBadge_Controller |
30 | 29 | */ |
31 | - public static function get_instance() |
|
32 | - { |
|
30 | + public static function get_instance() { |
|
33 | 31 | if (!isset(self::$instance) && !(self::$instance instanceof MonsterInsights_VerifiedBadge_Controller)) { |
34 | 32 | self::$instance = new MonsterInsights_VerifiedBadge_Controller(); |
35 | 33 | } |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | * |
45 | 43 | * @return void |
46 | 44 | */ |
47 | - public function run() |
|
48 | - { |
|
45 | + public function run() { |
|
49 | 46 | $this->register_shortcode(); |
50 | 47 | $this->add_hooks(); |
51 | 48 | } |
@@ -57,8 +54,7 @@ discard block |
||
57 | 54 | * |
58 | 55 | * @return void |
59 | 56 | */ |
60 | - private function register_shortcode() |
|
61 | - { |
|
57 | + private function register_shortcode() { |
|
62 | 58 | if (empty($this->shortcode_key)) { |
63 | 59 | return; |
64 | 60 | } |
@@ -75,8 +71,7 @@ discard block |
||
75 | 71 | * |
76 | 72 | * @return string |
77 | 73 | */ |
78 | - public function render_badge($atts) |
|
79 | - { |
|
74 | + public function render_badge($atts) { |
|
80 | 75 | $atts = shortcode_atts(array( |
81 | 76 | 'appearance' => 'light', |
82 | 77 | 'position' => 'center' |
@@ -93,8 +88,7 @@ discard block |
||
93 | 88 | ); |
94 | 89 | } |
95 | 90 | |
96 | - private function get_link() |
|
97 | - { |
|
91 | + private function get_link() { |
|
98 | 92 | return add_query_arg( |
99 | 93 | array( |
100 | 94 | 'utm_source' => 'verifiedBadge', |
@@ -112,8 +106,7 @@ discard block |
||
112 | 106 | * |
113 | 107 | * @return void |
114 | 108 | */ |
115 | - public function add_hooks() |
|
116 | - { |
|
109 | + public function add_hooks() { |
|
117 | 110 | add_action('wp_footer', array($this, 'show_automatic_footer_badge'), 1000); |
118 | 111 | add_action('wp_loaded', array($this, 'save_default_settings')); |
119 | 112 | } |
@@ -125,8 +118,7 @@ discard block |
||
125 | 118 | * |
126 | 119 | * @return void |
127 | 120 | */ |
128 | - public function save_default_settings() |
|
129 | - { |
|
121 | + public function save_default_settings() { |
|
130 | 122 | $appearance = monsterinsights_get_option('verified_appearance', false); |
131 | 123 | $position = monsterinsights_get_option('verified_position', false); |
132 | 124 | if (!$appearance) { |
@@ -144,8 +136,7 @@ discard block |
||
144 | 136 | * |
145 | 137 | * @return void |
146 | 138 | */ |
147 | - public function show_automatic_footer_badge() |
|
148 | - { |
|
139 | + public function show_automatic_footer_badge() { |
|
149 | 140 | if (!monsterinsights_get_option('verified_automatic')) { |
150 | 141 | return; |
151 | 142 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | } |
102 | 102 | wp_enqueue_script( 'monsterinsights-frontend-script', plugins_url( 'assets/js/frontend-gtag' . $suffix . '.js', MONSTERINSIGHTS_PLUGIN_FILE ), array(), monsterinsights_get_asset_version(), false ); |
103 | 103 | |
104 | - monsterinsights_localize_script( |
|
104 | + monsterinsights_localize_script( |
|
105 | 105 | 'monsterinsights-frontend-script', |
106 | 106 | 'monsterinsights_frontend', |
107 | 107 | array( |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | foreach ( $inbound_paths as $index => $pair ) { |
64 | 64 | // if empty pair, unset and continue |
65 | 65 | if ( empty( $pair['path'] ) ) { |
66 | - unset( $inbound_paths[ $index ] ); |
|
66 | + unset( $inbound_paths[$index] ); |
|
67 | 67 | continue; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // if path does not start with a /, start it with that |
71 | 71 | $path = ! empty( $pair['path'] ) ? $pair['path'] : 'aff'; |
72 | - $inbound_paths[ $index ]['path'] = trim( $path ); |
|
72 | + $inbound_paths[$index]['path'] = trim( $path ); |
|
73 | 73 | |
74 | 74 | // js escape the link label |
75 | 75 | $label = ! empty( $pair['label'] ) ? $pair['label'] : 'aff'; |
76 | - $inbound_paths[ $index ]['label'] = esc_js( trim( $label ) ); |
|
76 | + $inbound_paths[$index]['label'] = esc_js( trim( $label ) ); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | } |
88 | 88 | $i = 0; |
89 | 89 | foreach ( $download_extensions as $extension ) { |
90 | - $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
|
91 | - $i ++; |
|
90 | + $download_extensions[$i] = esc_js( trim( $extension ) ); |
|
91 | + $i++; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $download_extensions = implode( ",", $download_extensions ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | if ( $encoded ) { |
157 | 157 | return str_replace( |
158 | - [ '"' . $placeholder, $placeholder . '"' ], |
|
158 | + ['"' . $placeholder, $placeholder . '"'], |
|
159 | 159 | '', |
160 | 160 | wp_json_encode( $options ) |
161 | 161 | ); |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | var MonsterInsightsLocations = (typeof MonsterInsightsExcludeQuery === 'object') ? MonsterInsightsExcludeQuery : MonsterInsightsDefaultLocations; |
219 | 219 | } |
220 | 220 | |
221 | - <?php if ($this->should_do_optout()) { ?> |
|
221 | + <?php if ( $this->should_do_optout() ) { ?> |
|
222 | 222 | var disableStrs = [ |
223 | - <?php if (! empty( $v4_id )) { ?> |
|
223 | + <?php if ( ! empty( $v4_id ) ) { ?> |
|
224 | 224 | 'ga-disable-<?php echo esc_js( $v4_id ); ?>', |
225 | 225 | <?php } ?> |
226 | 226 | ]; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | if (type === 'event') { |
282 | - <?php if ($v4_id) { ?> |
|
282 | + <?php if ( $v4_id ) { ?> |
|
283 | 283 | parameters.send_to = monsterinsights_frontend.v4_id; |
284 | 284 | var hookName = name; |
285 | 285 | if (typeof parameters['event_category'] !== 'undefined') { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | if ( MonsterInsightsLocations.page_location ) { |
313 | 313 | __gtagTracker('set', MonsterInsightsLocations); |
314 | 314 | } |
315 | - <?php if (! empty( $v4_id )) { ?> |
|
315 | + <?php if ( ! empty( $v4_id ) ) { ?> |
|
316 | 316 | __gtagTracker('config', '<?php echo esc_js( $v4_id ); ?>', <?php echo $options_v4; // phpcs:ignore ?> ); |
317 | 317 | <?php } ?> |
318 | 318 | <?php |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | do_action( 'monsterinsights_frontend_tracking_gtag_after_pageview' ); |
326 | 326 | ?> |
327 | 327 | <?php echo esc_js( $compat ); ?> |
328 | - <?php if (apply_filters( 'monsterinsights_tracking_gtag_frontend_gatracker_compatibility', true )) { ?> |
|
328 | + <?php if ( apply_filters( 'monsterinsights_tracking_gtag_frontend_gatracker_compatibility', true ) ) { ?> |
|
329 | 329 | (function () { |
330 | 330 | /* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */ |
331 | 331 | /* ga and __gaTracker compatibility shim. */ |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | })(); |
439 | 439 | <?php } ?> |
440 | 440 | } else { |
441 | - <?php if ($this->should_do_optout()) { ?> |
|
441 | + <?php if ( $this->should_do_optout() ) { ?> |
|
442 | 442 | console.log("<?php echo esc_js( $reason ); ?>"); |
443 | 443 | (function () { |
444 | 444 | function __gtagTracker() { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | foreach ( $addresses as $key => $address ) { |
196 | 196 | if ( ! is_email( $address ) ) { |
197 | - unset( $addresses[ $key ] ); |
|
197 | + unset( $addresses[$key] ); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | |
298 | - if ( ! isset( $this->args[ $type ] ) || ! is_array( $this->args[ $type ] ) ) { |
|
299 | - $this->args[ $type ] = array(); |
|
298 | + if ( ! isset( $this->args[$type] ) || ! is_array( $this->args[$type] ) ) { |
|
299 | + $this->args[$type] = array(); |
|
300 | 300 | } |
301 | 301 | |
302 | - $this->args[ $type ] = $merge ? array_merge( $this->args[ $type ], $value ) : $value; |
|
302 | + $this->args[$type] = $merge ? array_merge( $this->args[$type], $value ) : $value; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | return $this; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function get_args( $type ) { |
318 | 318 | if ( ! empty( $type ) ) { |
319 | - return isset( $this->args[ $type ] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[ $type ], $this ) : array(); |
|
319 | + return isset( $this->args[$type] ) ? apply_filters( 'monsterinsights_emails_templates_get_args_' . $type, $this->args[$type], $this ) : array(); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | return apply_filters( 'monsterinsights_emails_templates_get_args', $this->args, $this ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | </tr> |
25 | 25 | <tr> |
26 | 26 | <td valign="top" id="templateFooter" |
27 | - style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: <?php echo esc_attr($background_color); ?>;border-top: 0;border-bottom: 0;padding-top: 12px;padding-bottom: 12px;"> |
|
27 | + style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: <?php echo esc_attr( $background_color ); ?>;border-top: 0;border-bottom: 0;padding-top: 12px;padding-bottom: 12px;"> |
|
28 | 28 | <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" |
29 | 29 | style="min-width: 100%;border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;"> |
30 | 30 | <tbody class="mcnTextBlockOuter"> |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $header_image = monsterinsights_get_option( 'email_header_image', false ); |
14 | 14 | $background_color = '#e9eaec'; |
15 | -$text_dir = is_rtl() ? 'rtl' : 'ltr'; |
|
15 | +$text_dir = is_rtl() ? 'rtl' : 'ltr'; |
|
16 | 16 | ?> |
17 | 17 | <!doctype html> |
18 | -<html dir="<?php echo esc_attr($text_dir); ?>" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" |
|
18 | +<html dir="<?php echo esc_attr( $text_dir ); ?>" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" |
|
19 | 19 | xmlns:o="urn:schemas-microsoft-com:office:office"> |
20 | 20 | <head> |
21 | 21 | <!--[if gte mso 15]> |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /***** Make theme edits below if needed *****/ |
138 | 138 | /* Page - Background Style */ |
139 | 139 | body, #bodyTable { |
140 | - background-color: <?php echo esc_attr($background_color); ?>; |
|
140 | + background-color: <?php echo esc_attr( $background_color ); ?>; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /* Page - Heading 1 */ |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | /* Footer - Footer Style */ |
223 | 223 | #templateFooter { |
224 | - background-color: <?php echo esc_attr($background_color); ?>; |
|
224 | + background-color: <?php echo esc_attr( $background_color ); ?>; |
|
225 | 225 | border-top: 0; |
226 | 226 | border-bottom: 0; |
227 | 227 | padding-top: 12px; |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | </style> |
281 | 281 | </head> |
282 | 282 | <body |
283 | - style="height: 100%;margin: 0;padding: 0;width: 100%;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: <?php echo esc_attr($background_color); ?>;"> |
|
283 | + style="height: 100%;margin: 0;padding: 0;width: 100%;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: <?php echo esc_attr( $background_color ); ?>;"> |
|
284 | 284 | <!-- Don't forget to run final template through http://templates.mailchimp.com/resources/inline-css/ --> |
285 | 285 | <center> |
286 | 286 | <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" |
287 | - style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;height: 100%;margin: 0;padding: 0;width: 100%;background-color: <?php echo esc_attr($background_color); ?>;"> |
|
287 | + style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;height: 100%;margin: 0;padding: 0;width: 100%;background-color: <?php echo esc_attr( $background_color ); ?>;"> |
|
288 | 288 | <tr> |
289 | 289 | <td align="center" valign="top" id="bodyCell" |
290 | 290 | style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;height: 100%;margin: 0;padding: 50px 50px;width: 100%;"> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | '<strong>', |
265 | 265 | $compatible_php_version['required'], // phpcs:ignore |
266 | 266 | '</strong>', |
267 | - '<a target="_blank" href="' . esc_url($url) . '">', |
|
267 | + '<a target="_blank" href="' . esc_url( $url ) . '">', |
|
268 | 268 | '</a>' |
269 | 269 | ) |
270 | 270 | ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | '<strong>', |
280 | 280 | $compatible_wp_version['required'], // phpcs:ignore |
281 | 281 | '</strong>', |
282 | - '<a target="_blank" href="' . esc_url($url) . '">', |
|
282 | + '<a target="_blank" href="' . esc_url( $url ) . '">', |
|
283 | 283 | '</a>' |
284 | 284 | ) |
285 | 285 | ); |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | |
29 | 29 | // Put together redirect URL |
30 | 30 | $url = add_query_arg( |
31 | - array( |
|
32 | - 'utm_source' => $source, // Pro/Lite Plugin |
|
33 | - 'utm_medium' => sanitize_key($medium), // Area of MonsterInsights (example Reports) |
|
34 | - 'utm_campaign' => sanitize_key($campaign), // Which link (example eCommerce Report) |
|
35 | - 'utm_content' => $content, // Version number of MI |
|
36 | - ), |
|
37 | - trailingslashit($url) |
|
31 | + array( |
|
32 | + 'utm_source' => $source, // Pro/Lite Plugin |
|
33 | + 'utm_medium' => sanitize_key($medium), // Area of MonsterInsights (example Reports) |
|
34 | + 'utm_campaign' => sanitize_key($campaign), // Which link (example eCommerce Report) |
|
35 | + 'utm_content' => $content, // Version number of MI |
|
36 | + ), |
|
37 | + trailingslashit($url) |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | if ($escape) { |
41 | - return esc_url($url); |
|
41 | + return esc_url($url); |
|
42 | 42 | } else { |
43 | - return $url; |
|
43 | + return $url; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -1009,19 +1009,19 @@ discard block |
||
1009 | 1009 | |
1010 | 1010 | // Build the body of the request. |
1011 | 1011 | $query_params = wp_parse_args( |
1012 | - $body, |
|
1013 | - array( |
|
1014 | - 'tgm-updater-action' => $action, |
|
1015 | - 'tgm-updater-key' => $key, |
|
1016 | - 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
1017 | - 'tgm-updater-referer' => site_url(), |
|
1018 | - 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
1019 | - 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
1020 | - ) |
|
1012 | + $body, |
|
1013 | + array( |
|
1014 | + 'tgm-updater-action' => $action, |
|
1015 | + 'tgm-updater-key' => $key, |
|
1016 | + 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
1017 | + 'tgm-updater-referer' => site_url(), |
|
1018 | + 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
1019 | + 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
1020 | + ) |
|
1021 | 1021 | ); |
1022 | 1022 | |
1023 | 1023 | $args = [ |
1024 | - 'headers' => $headers, |
|
1024 | + 'headers' => $headers, |
|
1025 | 1025 | ]; |
1026 | 1026 | |
1027 | 1027 | // Perform the query and retrieve the response. |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | // Bail out early if there are any errors. |
1033 | 1033 | if ( 200 != $response_code || is_wp_error( $response_body ) ) { |
1034 | - return false; |
|
1034 | + return false; |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | // Return the json decoded content. |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -function monsterinsights_get_url($medium = '', $campaign = '', $url = '', $escape = true) |
|
19 | +function monsterinsights_get_url( $medium = '', $campaign = '', $url = '', $escape = true ) |
|
20 | 20 | { |
21 | 21 | // Setup Campaign variables |
22 | 22 | $source = monsterinsights_is_pro_version() ? 'proplugin' : 'liteplugin'; |
23 | - $medium = !empty($medium) ? $medium : 'defaultmedium'; |
|
24 | - $campaign = !empty($campaign) ? $campaign : 'defaultcampaign'; |
|
23 | + $medium = ! empty( $medium ) ? $medium : 'defaultmedium'; |
|
24 | + $campaign = ! empty( $campaign ) ? $campaign : 'defaultcampaign'; |
|
25 | 25 | $content = MONSTERINSIGHTS_VERSION; |
26 | 26 | $default_url = monsterinsights_is_pro_version() ? '' : 'lite/'; |
27 | - $url = !empty($url) ? $url : 'https://www.monsterinsights.com/' . $default_url; |
|
27 | + $url = ! empty( $url ) ? $url : 'https://www.monsterinsights.com/' . $default_url; |
|
28 | 28 | |
29 | 29 | // Put together redirect URL |
30 | 30 | $url = add_query_arg( |
31 | 31 | array( |
32 | - 'utm_source' => $source, // Pro/Lite Plugin |
|
33 | - 'utm_medium' => sanitize_key($medium), // Area of MonsterInsights (example Reports) |
|
34 | - 'utm_campaign' => sanitize_key($campaign), // Which link (example eCommerce Report) |
|
35 | - 'utm_content' => $content, // Version number of MI |
|
32 | + 'utm_source' => $source, // Pro/Lite Plugin |
|
33 | + 'utm_medium' => sanitize_key( $medium ), // Area of MonsterInsights (example Reports) |
|
34 | + 'utm_campaign' => sanitize_key( $campaign ), // Which link (example eCommerce Report) |
|
35 | + 'utm_content' => $content, // Version number of MI |
|
36 | 36 | ), |
37 | - trailingslashit($url) |
|
37 | + trailingslashit( $url ) |
|
38 | 38 | ); |
39 | 39 | |
40 | - if ($escape) { |
|
41 | - return esc_url($url); |
|
40 | + if ( $escape ) { |
|
41 | + return esc_url( $url ); |
|
42 | 42 | } else { |
43 | 43 | return $url; |
44 | 44 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * if the first page visited is AMP, the cookie may be in the format amp-XXXXXXXXXXXXX-XXXXXXXX |
139 | 139 | */ |
140 | 140 | |
141 | - $ga_cookie = sanitize_text_field($_COOKIE['_ga']); |
|
141 | + $ga_cookie = sanitize_text_field( $_COOKIE['_ga'] ); |
|
142 | 142 | $cookie_parts = explode( '.', $ga_cookie ); |
143 | 143 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) ) { |
144 | 144 | $cookie_parts = array_slice( $cookie_parts, 2 ); |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | // Cookie name example: '_ga_1YS1VWHG3V'. |
174 | 174 | $cookie_name = '_ga_' . str_replace( 'G-', '', $measurement_id ); |
175 | 175 | |
176 | - if ( ! isset( $_COOKIE[ $cookie_name ] ) ) { |
|
176 | + if ( ! isset( $_COOKIE[$cookie_name] ) ) { |
|
177 | 177 | return null; |
178 | 178 | } |
179 | 179 | |
180 | 180 | // Cookie value example: 'GS1.1.1659710029.4.1.1659710504.0'. |
181 | 181 | // Session Id: ^^^^^^^^^^. |
182 | - $cookie = sanitize_text_field( $_COOKIE[ $cookie_name ] ); |
|
182 | + $cookie = sanitize_text_field( $_COOKIE[$cookie_name] ); |
|
183 | 183 | $parts = explode( '.', $cookie ); |
184 | 184 | |
185 | - if ( ! isset( $parts[2] ) ){ |
|
185 | + if ( ! isset( $parts[2] ) ) { |
|
186 | 186 | return null; |
187 | 187 | } |
188 | 188 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
329 | 329 | |
330 | 330 | foreach ( $editable_roles as $id => $name ) { |
331 | - $roles[ $id ] = translate_user_role( $name['name'] ); |
|
331 | + $roles[$id] = translate_user_role( $name['name'] ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | return $roles; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | foreach ( $editable_roles as $id => $role ) { |
356 | 356 | if ( isset( $role['capabilities']['manage_options'] ) && $role['capabilities']['manage_options'] ) { |
357 | - $roles[ $id ] = translate_user_role( $role['name'] ); |
|
357 | + $roles[$id] = translate_user_role( $role['name'] ); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
1101 | 1101 | global $wp_filter; |
1102 | 1102 | // Check that filter actually exists first |
1103 | - if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
1103 | + if ( ! isset( $wp_filter[$tag] ) ) { |
|
1104 | 1104 | return false; |
1105 | 1105 | } |
1106 | 1106 | /** |
@@ -1111,17 +1111,17 @@ discard block |
||
1111 | 1111 | * |
1112 | 1112 | * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ |
1113 | 1113 | */ |
1114 | - if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) { |
|
1115 | - $callbacks = &$wp_filter[ $tag ]->callbacks; |
|
1114 | + if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) { |
|
1115 | + $callbacks = &$wp_filter[$tag]->callbacks; |
|
1116 | 1116 | } else { |
1117 | - $callbacks = &$wp_filter[ $tag ]; |
|
1117 | + $callbacks = &$wp_filter[$tag]; |
|
1118 | 1118 | } |
1119 | 1119 | // Exit if there aren't any callbacks for specified priority |
1120 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
1120 | + if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) { |
|
1121 | 1121 | return false; |
1122 | 1122 | } |
1123 | 1123 | // Loop through each filter for the specified priority, looking for our class & method |
1124 | - foreach ( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
|
1124 | + foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) { |
|
1125 | 1125 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
1126 | 1126 | if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) { |
1127 | 1127 | continue; |
@@ -1137,19 +1137,19 @@ discard block |
||
1137 | 1137 | // Method matched, now let's check the Class |
1138 | 1138 | if ( get_class( $filter['function'][0] ) === $class_name ) { |
1139 | 1139 | // Now let's remove it from the array |
1140 | - unset( $callbacks[ $priority ][ $filter_id ] ); |
|
1140 | + unset( $callbacks[$priority][$filter_id] ); |
|
1141 | 1141 | // and if it was the only filter in that priority, unset that priority |
1142 | - if ( empty( $callbacks[ $priority ] ) ) { |
|
1143 | - unset( $callbacks[ $priority ] ); |
|
1142 | + if ( empty( $callbacks[$priority] ) ) { |
|
1143 | + unset( $callbacks[$priority] ); |
|
1144 | 1144 | } |
1145 | 1145 | // and if the only filter for that tag, set the tag to an empty array |
1146 | 1146 | if ( empty( $callbacks ) ) { |
1147 | 1147 | $callbacks = array(); |
1148 | 1148 | } |
1149 | 1149 | // If using WordPress older than 4.7 |
1150 | - if ( ! is_object( $wp_filter[ $tag ] ) ) { |
|
1150 | + if ( ! is_object( $wp_filter[$tag] ) ) { |
|
1151 | 1151 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
1152 | - unset( $GLOBALS['merged_filters'][ $tag ] ); |
|
1152 | + unset( $GLOBALS['merged_filters'][$tag] ); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | return true; |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | foreach ( $translations->entries as $msgid => $entry ) { |
1233 | - $locale[ $msgid ] = $entry->translations; |
|
1233 | + $locale[$msgid] = $entry->translations; |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | return $locale; |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | * |
1359 | 1359 | * @return int |
1360 | 1360 | */ |
1361 | -function monsterinsights_count_third_party_v4_codes($body) { |
|
1361 | +function monsterinsights_count_third_party_v4_codes( $body ) { |
|
1362 | 1362 | $count = 0; |
1363 | 1363 | return $count; |
1364 | 1364 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | $ads_id = esc_attr( monsterinsights_get_option( 'gtag_ads_conversion_id' ) ); |
1379 | 1379 | |
1380 | 1380 | if ( $ads_id === $current_code ) { |
1381 | - $count ++; |
|
1381 | + $count++; |
|
1382 | 1382 | } |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | // Main property always has a ?id=(UA|G|GT)-XXXXXXXX script |
1447 | 1447 | if ( strpos( $body, 'googletagmanager.com/gtag/js?id=' . $current_code ) !== false ) { |
1448 | 1448 | // In that case, we can safely deduct one from the total count |
1449 | - -- $total_count; |
|
1449 | + --$total_count; |
|
1450 | 1450 | } |
1451 | 1451 | |
1452 | 1452 | // Test for Advanced Ads plugin tracking code. |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | 'sslverify' => false, |
1494 | 1494 | ) |
1495 | 1495 | ); |
1496 | - $errors = array(); |
|
1496 | + $errors = array(); |
|
1497 | 1497 | |
1498 | 1498 | $accepted_http_codes = array( |
1499 | 1499 | 200, |
@@ -1744,8 +1744,8 @@ discard block |
||
1744 | 1744 | $string = explode( ' ', $text ); |
1745 | 1745 | $trimed = ''; |
1746 | 1746 | |
1747 | - for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter ++ ) { |
|
1748 | - $trimed .= isset( $string[ $wordCounter ] ) ? $string[ $wordCounter ] : ''; |
|
1747 | + for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter++ ) { |
|
1748 | + $trimed .= isset( $string[$wordCounter] ) ? $string[$wordCounter] : ''; |
|
1749 | 1749 | |
1750 | 1750 | if ( $wordCounter < $count ) { |
1751 | 1751 | $trimed .= ' '; |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | add_filter( |
1964 | 1964 | 'script_loader_tag', |
1965 | - function ( $tag, $current_handle ) use ( $handle, $script ) { |
|
1965 | + function( $tag, $current_handle ) use ( $handle, $script ) { |
|
1966 | 1966 | if ( $current_handle !== $handle ) { |
1967 | 1967 | return $tag; |
1968 | 1968 | } |
@@ -2215,8 +2215,8 @@ discard block |
||
2215 | 2215 | $month = $wp_locale->get_month( $datetime->format( 'm' ) ); |
2216 | 2216 | $weekday = $wp_locale->get_weekday( $datetime->format( 'w' ) ); |
2217 | 2217 | |
2218 | - for ( $i = 0; $i < $format_length; $i ++ ) { |
|
2219 | - switch ( $format[ $i ] ) { |
|
2218 | + for ( $i = 0; $i < $format_length; $i++ ) { |
|
2219 | + switch ( $format[$i] ) { |
|
2220 | 2220 | case 'D': |
2221 | 2221 | $new_format .= addcslashes( $wp_locale->get_weekday_abbrev( $weekday ), '\\A..Za..z' ); |
2222 | 2222 | break; |
@@ -2236,15 +2236,15 @@ discard block |
||
2236 | 2236 | $new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'A' ) ), '\\A..Za..z' ); |
2237 | 2237 | break; |
2238 | 2238 | case '\\': |
2239 | - $new_format .= $format[ $i ]; |
|
2239 | + $new_format .= $format[$i]; |
|
2240 | 2240 | |
2241 | 2241 | // If character follows a slash, we add it without translating. |
2242 | 2242 | if ( $i < $format_length ) { |
2243 | - $new_format .= $format[ ++$i ]; |
|
2243 | + $new_format .= $format[ ++$i]; |
|
2244 | 2244 | } |
2245 | 2245 | break; |
2246 | 2246 | default: |
2247 | - $new_format .= $format[ $i ]; |
|
2247 | + $new_format .= $format[$i]; |
|
2248 | 2248 | break; |
2249 | 2249 | } |
2250 | 2250 | } |
@@ -2340,7 +2340,7 @@ discard block |
||
2340 | 2340 | |
2341 | 2341 | if ( ! function_exists( 'monsterinsights_is_authed' ) ) { |
2342 | 2342 | function monsterinsights_is_authed() { |
2343 | - $site_profile = get_option('monsterinsights_site_profile'); |
|
2344 | - return isset($site_profile['key']); |
|
2343 | + $site_profile = get_option( 'monsterinsights_site_profile' ); |
|
2344 | + return isset( $site_profile['key'] ); |
|
2345 | 2345 | } |
2346 | 2346 | } |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -function monsterinsights_get_url($medium = '', $campaign = '', $url = '', $escape = true) |
|
20 | -{ |
|
19 | +function monsterinsights_get_url($medium = '', $campaign = '', $url = '', $escape = true) { |
|
21 | 20 | // Setup Campaign variables |
22 | 21 | $source = monsterinsights_is_pro_version() ? 'proplugin' : 'liteplugin'; |
23 | 22 | $medium = !empty($medium) ? $medium : 'defaultmedium'; |
@@ -182,7 +181,7 @@ discard block |
||
182 | 181 | $cookie = sanitize_text_field( $_COOKIE[ $cookie_name ] ); |
183 | 182 | $parts = explode( '.', $cookie ); |
184 | 183 | |
185 | - if ( ! isset( $parts[2] ) ){ |
|
184 | + if ( ! isset( $parts[2] ) ) { |
|
186 | 185 | return null; |
187 | 186 | } |
188 | 187 |