@@ -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 ); |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | 38 | |
39 | - // Populate $notices |
|
40 | - $this->notices = get_option( 'monsterinsights_notices' ); |
|
41 | - if ( ! is_array( $this->notices ) ) { |
|
42 | - $this->notices = array(); |
|
43 | - } |
|
39 | + // Populate $notices |
|
40 | + $this->notices = get_option( 'monsterinsights_notices' ); |
|
41 | + if ( ! is_array( $this->notices ) ) { |
|
42 | + $this->notices = array(); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | */ |
56 | 56 | |
57 | 57 | public function is_dismissed( $notice ) { |
58 | - if ( ! isset( $this->notices[ $notice ] ) ) { |
|
59 | - return false; |
|
60 | - } |
|
61 | - return true; |
|
58 | + if ( ! isset( $this->notices[ $notice ] ) ) { |
|
59 | + return false; |
|
60 | + } |
|
61 | + return true; |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return null |
73 | 73 | */ |
74 | 74 | public function dismiss( $notice ) { |
75 | - $this->notices[ $notice ] = true; |
|
76 | - update_option( 'monsterinsights_notices', $this->notices ); |
|
75 | + $this->notices[ $notice ] = true; |
|
76 | + update_option( 'monsterinsights_notices', $this->notices ); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | * @return null |
89 | 89 | */ |
90 | 90 | public function undismiss( $notice ) { |
91 | - unset( $this->notices[ $notice ] ); |
|
92 | - update_option( 'monsterinsights_notices', $this->notices ); |
|
91 | + unset( $this->notices[ $notice ] ); |
|
92 | + update_option( 'monsterinsights_notices', $this->notices ); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param bool $is_dismissible User can Dismiss Message (default: false) |
109 | 109 | */ |
110 | 110 | public function display_inline_notice( $name, $title, $message, $type = 'success', $is_dismissible = false, $args = array() ) { |
111 | - /* Available/Planned $args options |
|
111 | + /* Available/Planned $args options |
|
112 | 112 | * $args = array( |
113 | 113 | * 'primary' => array( |
114 | 114 | * 'text' => '', |
@@ -127,110 +127,110 @@ discard block |
||
127 | 127 | */ |
128 | 128 | |
129 | 129 | |
130 | - // Check if the notice is dismissible, and if so has been dismissed. |
|
131 | - if ( $is_dismissible && $this->is_dismissed( $name ) ) { |
|
132 | - // Nothing to show here, return! |
|
133 | - return ''; |
|
134 | - } |
|
130 | + // Check if the notice is dismissible, and if so has been dismissed. |
|
131 | + if ( $is_dismissible && $this->is_dismissed( $name ) ) { |
|
132 | + // Nothing to show here, return! |
|
133 | + return ''; |
|
134 | + } |
|
135 | 135 | |
136 | - $dismissible = ( $is_dismissible ) ? ' is-dismissible': ''; |
|
136 | + $dismissible = ( $is_dismissible ) ? ' is-dismissible': ''; |
|
137 | 137 | |
138 | - // Display inline notice |
|
139 | - ob_start(); |
|
140 | - ?> |
|
138 | + // Display inline notice |
|
139 | + ob_start(); |
|
140 | + ?> |
|
141 | 141 | <div class="monsterinsights-notice <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice' . $dismissible; ?>" data-notice="<?php echo esc_attr( $name ); ?>"> |
142 | 142 | <div class="monsterinsights-notice-icon <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-icon'?>"> |
143 | 143 | </div> |
144 | 144 | <div class="monsterinsights-notice-text <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-text'?>"> |
145 | 145 | <?php |
146 | - // Title |
|
147 | - if ( ! empty ( $title ) ) { |
|
148 | - ?> |
|
146 | + // Title |
|
147 | + if ( ! empty ( $title ) ) { |
|
148 | + ?> |
|
149 | 149 | <p class="monsterinsights-notice-title"><?php echo esc_html( $title ); ?></p> |
150 | 150 | <?php |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - // Message |
|
154 | - if ( ! empty( $message ) ) { |
|
155 | - if ( empty( $args['skip_message_escape'] ) ) { |
|
156 | - ?> |
|
153 | + // Message |
|
154 | + if ( ! empty( $message ) ) { |
|
155 | + if ( empty( $args['skip_message_escape'] ) ) { |
|
156 | + ?> |
|
157 | 157 | <p class="monsterinsights-notice-message"><?php echo esc_html( $message ); ?></p> |
158 | 158 | <?php |
159 | - } else { |
|
160 | - ?> |
|
159 | + } else { |
|
160 | + ?> |
|
161 | 161 | <p class="monsterinsights-notice-message"><?php echo $message; ?></p> |
162 | 162 | <?php |
163 | - } |
|
164 | - } |
|
163 | + } |
|
164 | + } |
|
165 | 165 | |
166 | - // Primary Button |
|
167 | - if ( ! empty( $args['primary']['text'] ) ) { |
|
166 | + // Primary Button |
|
167 | + if ( ! empty( $args['primary']['text'] ) ) { |
|
168 | 168 | |
169 | - $text = ''; |
|
170 | - if ( ! empty( $args['primary']['text'] ) ) { |
|
171 | - $text = $args['primary']['text']; |
|
172 | - } |
|
173 | - |
|
174 | - $url = '#'; |
|
175 | - if ( ! empty( $args['primary']['url'] ) ) { |
|
176 | - $url = $args['primary']['url']; |
|
177 | - } |
|
178 | - |
|
179 | - $target = ''; |
|
180 | - if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') { |
|
181 | - $target = ' target="_blank" rel="noopener noreferrer"'; |
|
182 | - } |
|
183 | - |
|
184 | - $class = 'button button-primary'; |
|
185 | - if ( ! empty( $args['primary']['class'] ) ) { |
|
186 | - $class = ' class="'. $args['primary']['class'] . '"'; |
|
187 | - } |
|
188 | - ?> |
|
169 | + $text = ''; |
|
170 | + if ( ! empty( $args['primary']['text'] ) ) { |
|
171 | + $text = $args['primary']['text']; |
|
172 | + } |
|
173 | + |
|
174 | + $url = '#'; |
|
175 | + if ( ! empty( $args['primary']['url'] ) ) { |
|
176 | + $url = $args['primary']['url']; |
|
177 | + } |
|
178 | + |
|
179 | + $target = ''; |
|
180 | + if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') { |
|
181 | + $target = ' target="_blank" rel="noopener noreferrer"'; |
|
182 | + } |
|
183 | + |
|
184 | + $class = 'button button-primary'; |
|
185 | + if ( ! empty( $args['primary']['class'] ) ) { |
|
186 | + $class = ' class="'. $args['primary']['class'] . '"'; |
|
187 | + } |
|
188 | + ?> |
|
189 | 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 | |
193 | - // Secondary Button |
|
194 | - if ( ! empty( $args['secondary']['text'] ) ) { |
|
193 | + // Secondary Button |
|
194 | + if ( ! empty( $args['secondary']['text'] ) ) { |
|
195 | 195 | |
196 | - $text = ''; |
|
197 | - if ( ! empty( $args['secondary']['text'] ) ) { |
|
198 | - $text = $args['secondary']['text']; |
|
199 | - } |
|
200 | - |
|
201 | - $url = '#'; |
|
202 | - if ( ! empty( $args['secondary']['url'] ) ) { |
|
203 | - $url = $args['secondary']['url']; |
|
204 | - } |
|
205 | - |
|
206 | - $target = ''; |
|
207 | - if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') { |
|
208 | - $target = ' target="_blank" rel="noopener noreferrer"'; |
|
209 | - } |
|
210 | - |
|
211 | - $class = 'button button-secondary'; |
|
212 | - if ( ! empty( $args['secondary']['class'] ) ) { |
|
213 | - $class = ' class="'. $args['secondary']['class'] . '"'; |
|
214 | - } |
|
215 | - ?> |
|
196 | + $text = ''; |
|
197 | + if ( ! empty( $args['secondary']['text'] ) ) { |
|
198 | + $text = $args['secondary']['text']; |
|
199 | + } |
|
200 | + |
|
201 | + $url = '#'; |
|
202 | + if ( ! empty( $args['secondary']['url'] ) ) { |
|
203 | + $url = $args['secondary']['url']; |
|
204 | + } |
|
205 | + |
|
206 | + $target = ''; |
|
207 | + if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') { |
|
208 | + $target = ' target="_blank" rel="noopener noreferrer"'; |
|
209 | + } |
|
210 | + |
|
211 | + $class = 'button button-secondary'; |
|
212 | + if ( ! empty( $args['secondary']['class'] ) ) { |
|
213 | + $class = ' class="'. $args['secondary']['class'] . '"'; |
|
214 | + } |
|
215 | + ?> |
|
216 | 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 | |
220 | - // Dismiss Button |
|
221 | - if ( $is_dismissible ) { |
|
222 | - ?> |
|
220 | + // Dismiss Button |
|
221 | + if ( $is_dismissible ) { |
|
222 | + ?> |
|
223 | 223 | <button type="button" class="notice-dismiss<?php echo $dismissible; ?>"> |
224 | 224 | <span class="screen-reader-text"> |
225 | 225 | <?php esc_html_e( 'Dismiss this notice', 'google-analytics-for-wordpress' ); ?> |
226 | 226 | </span> |
227 | 227 | </button> |
228 | 228 | <?php |
229 | - } |
|
230 | - ?> |
|
229 | + } |
|
230 | + ?> |
|
231 | 231 | </div> |
232 | 232 | </div> |
233 | 233 | <?php |
234 | - return ob_get_clean(); |
|
234 | + return ob_get_clean(); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | \ No newline at end of file |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct( $args = array() ) { |
27 | 27 | |
28 | - parent::__construct(); |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_upgrader( &$upgrader ) { |
40 | 40 | |
41 | - if ( is_object( $upgrader ) ) { |
|
42 | - $this->upgrader =& $upgrader; |
|
43 | - } |
|
41 | + if ( is_object( $upgrader ) ) { |
|
42 | + $this->upgrader =& $upgrader; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function set_result( $result ) { |
55 | 55 | |
56 | - $this->result = $result; |
|
56 | + $this->result = $result; |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function error( $errors ) { |
84 | 84 | |
85 | - if ( ! empty( $errors ) ) { |
|
86 | - echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) ); |
|
87 | - die; |
|
88 | - } |
|
85 | + if ( ! empty( $errors ) ) { |
|
86 | + echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) ); |
|
87 | + die; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | } |
91 | 91 |
@@ -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 | } |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | |
14 | 14 | // If this is multisite and is not on the main site, return early. |
15 | 15 | if ( is_multisite() && ! is_main_site() ) { |
16 | - return $update; |
|
16 | + return $update; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // If we don't have everything we need, return early. |
20 | 20 | $item = (array) $item; |
21 | 21 | if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) { |
22 | - return $update; |
|
22 | + return $update; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | // If the plugin isn't ours, return early. |
26 | 26 | $is_free = 'google-analytics-for-wordpress' === $item['slug']; |
27 | 27 | $is_paid = isset( $item['monsterinsights_plugin'] ); // see updater class |
28 | 28 | if ( ! $is_free && ! $is_paid ) { |
29 | - return $update; |
|
29 | + return $update; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $version = $is_free ? MONSTERINSIGHTS_LITE_VERSION : $item['old_version']; |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | |
37 | 37 | // If the opt in update allows major updates but there is no major version update, return early. |
38 | 38 | if ( $current_major < $new_major ) { |
39 | - if ( $automatic_updates === 'all' ) { |
|
40 | - return true; |
|
41 | - } else { |
|
42 | - return $update; |
|
43 | - } |
|
39 | + if ( $automatic_updates === 'all' ) { |
|
40 | + return true; |
|
41 | + } else { |
|
42 | + return $update; |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // If the opt in update allows minor updates but there is no minor version update, return early. |
47 | 47 | if ( $current_major == $new_major ) { |
48 | - if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) { |
|
49 | - return true; |
|
50 | - } else { |
|
51 | - return $update; |
|
52 | - } |
|
48 | + if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) { |
|
49 | + return true; |
|
50 | + } else { |
|
51 | + return $update; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // All our checks have passed - this plugin can be updated! |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | function monsterinsights_get_major_version( $version ) { |
88 | 88 | $exploded_version = explode( '.', $version ); |
89 | 89 | if ( isset( $exploded_version[2] ) ) { |
90 | - return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2]; |
|
90 | + return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2]; |
|
91 | 91 | } else { |
92 | - return $exploded_version[0] . '.' . $exploded_version[1] . '.0'; |
|
92 | + return $exploded_version[0] . '.' . $exploded_version[1] . '.0'; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -166,7 +166,7 @@ |
||
166 | 166 | |
167 | 167 | // Deactivate the addon. |
168 | 168 | if ( isset( $_POST['plugin'] ) ) { |
169 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
169 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
170 | 170 | $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
171 | 171 | } else { |
172 | 172 | $deactivate = deactivate_plugins( $_POST['plugin'] ); |
@@ -132,7 +132,7 @@ |
||
132 | 132 | // Activate the addon. |
133 | 133 | if ( isset( $_POST['plugin'] ) ) { |
134 | 134 | if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
135 | - $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
|
135 | + $activate = activate_plugin( $_POST['plugin'], null, true ); |
|
136 | 136 | } else { |
137 | 137 | $activate = activate_plugin( $_POST['plugin'] ); |
138 | 138 | } |
@@ -51,60 +51,60 @@ discard block |
||
51 | 51 | check_ajax_referer( 'monsterinsights-install', 'nonce' ); |
52 | 52 | |
53 | 53 | if ( ! current_user_can( 'install_plugins' ) ) { |
54 | - echo json_encode( true ); |
|
54 | + echo json_encode( true ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Install the addon. |
58 | 58 | if ( isset( $_POST['plugin'] ) ) { |
59 | - $download_url = $_POST['plugin']; |
|
60 | - global $hook_suffix; |
|
61 | - |
|
62 | - // Set the current screen to avoid undefined notices. |
|
63 | - set_current_screen(); |
|
64 | - |
|
65 | - // Prepare variables. |
|
66 | - $method = ''; |
|
67 | - $url = add_query_arg( |
|
68 | - array( |
|
69 | - 'page' => 'monsterinsights-settings' |
|
70 | - ), |
|
71 | - admin_url( 'admin.php' ) |
|
72 | - ); |
|
73 | - $url = esc_url( $url ); |
|
74 | - |
|
75 | - // Start output bufferring to catch the filesystem form if credentials are needed. |
|
76 | - ob_start(); |
|
77 | - if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
|
78 | - $form = ob_get_clean(); |
|
79 | - echo json_encode( array( 'form' => $form ) ); |
|
80 | - wp_die(); |
|
81 | - } |
|
82 | - |
|
83 | - // If we are not authenticated, make it happen now. |
|
84 | - if ( ! WP_Filesystem( $creds ) ) { |
|
85 | - ob_start(); |
|
86 | - request_filesystem_credentials( $url, $method, true, false, null ); |
|
87 | - $form = ob_get_clean(); |
|
88 | - echo json_encode( array( 'form' => $form ) ); |
|
89 | - wp_die(); |
|
90 | - } |
|
91 | - |
|
92 | - // We do not need any extra credentials if we have gotten this far, so let's install the plugin. |
|
93 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
94 | - $base = MonsterInsights(); |
|
95 | - require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php'; |
|
59 | + $download_url = $_POST['plugin']; |
|
60 | + global $hook_suffix; |
|
61 | + |
|
62 | + // Set the current screen to avoid undefined notices. |
|
63 | + set_current_screen(); |
|
64 | + |
|
65 | + // Prepare variables. |
|
66 | + $method = ''; |
|
67 | + $url = add_query_arg( |
|
68 | + array( |
|
69 | + 'page' => 'monsterinsights-settings' |
|
70 | + ), |
|
71 | + admin_url( 'admin.php' ) |
|
72 | + ); |
|
73 | + $url = esc_url( $url ); |
|
74 | + |
|
75 | + // Start output bufferring to catch the filesystem form if credentials are needed. |
|
76 | + ob_start(); |
|
77 | + if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
|
78 | + $form = ob_get_clean(); |
|
79 | + echo json_encode( array( 'form' => $form ) ); |
|
80 | + wp_die(); |
|
81 | + } |
|
82 | + |
|
83 | + // If we are not authenticated, make it happen now. |
|
84 | + if ( ! WP_Filesystem( $creds ) ) { |
|
85 | + ob_start(); |
|
86 | + request_filesystem_credentials( $url, $method, true, false, null ); |
|
87 | + $form = ob_get_clean(); |
|
88 | + echo json_encode( array( 'form' => $form ) ); |
|
89 | + wp_die(); |
|
90 | + } |
|
91 | + |
|
92 | + // We do not need any extra credentials if we have gotten this far, so let's install the plugin. |
|
93 | + require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
94 | + $base = MonsterInsights(); |
|
95 | + require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php'; |
|
96 | 96 | |
97 | - // Create the plugin upgrader with our custom skin. |
|
98 | - $installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() ); |
|
99 | - $installer->install( $download_url ); |
|
100 | - |
|
101 | - // Flush the cache and return the newly installed plugin basename. |
|
102 | - wp_cache_flush(); |
|
103 | - if ( $installer->plugin_info() ) { |
|
104 | - $plugin_basename = $installer->plugin_info(); |
|
105 | - echo json_encode( array( 'plugin' => $plugin_basename ) ); |
|
106 | - wp_die(); |
|
107 | - } |
|
97 | + // Create the plugin upgrader with our custom skin. |
|
98 | + $installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() ); |
|
99 | + $installer->install( $download_url ); |
|
100 | + |
|
101 | + // Flush the cache and return the newly installed plugin basename. |
|
102 | + wp_cache_flush(); |
|
103 | + if ( $installer->plugin_info() ) { |
|
104 | + $plugin_basename = $installer->plugin_info(); |
|
105 | + echo json_encode( array( 'plugin' => $plugin_basename ) ); |
|
106 | + wp_die(); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // Send back a response. |
@@ -126,21 +126,21 @@ discard block |
||
126 | 126 | check_ajax_referer( 'monsterinsights-activate', 'nonce' ); |
127 | 127 | |
128 | 128 | if ( ! current_user_can( 'activate_plugins' ) ) { |
129 | - echo json_encode( true ); |
|
129 | + echo json_encode( true ); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Activate the addon. |
133 | 133 | if ( isset( $_POST['plugin'] ) ) { |
134 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
135 | - $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
|
136 | - } else { |
|
137 | - $activate = activate_plugin( $_POST['plugin'] ); |
|
138 | - } |
|
139 | - |
|
140 | - if ( is_wp_error( $activate ) ) { |
|
141 | - echo json_encode( array( 'error' => $activate->get_error_message() ) ); |
|
142 | - wp_die(); |
|
143 | - } |
|
134 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
135 | + $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
|
136 | + } else { |
|
137 | + $activate = activate_plugin( $_POST['plugin'] ); |
|
138 | + } |
|
139 | + |
|
140 | + if ( is_wp_error( $activate ) ) { |
|
141 | + echo json_encode( array( 'error' => $activate->get_error_message() ) ); |
|
142 | + wp_die(); |
|
143 | + } |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | echo json_encode( true ); |
@@ -161,16 +161,16 @@ discard block |
||
161 | 161 | check_ajax_referer( 'monsterinsights-deactivate', 'nonce' ); |
162 | 162 | |
163 | 163 | if ( ! current_user_can( 'activate_plugins' ) ) { |
164 | - echo json_encode( true ); |
|
164 | + echo json_encode( true ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // Deactivate the addon. |
168 | 168 | if ( isset( $_POST['plugin'] ) ) { |
169 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
170 | - $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
|
171 | - } else { |
|
172 | - $deactivate = deactivate_plugins( $_POST['plugin'] ); |
|
173 | - } |
|
169 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
170 | + $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
|
171 | + } else { |
|
172 | + $deactivate = deactivate_plugins( $_POST['plugin'] ); |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | echo json_encode( true ); |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | |
194 | 194 | // Deactivate the notice |
195 | 195 | if ( isset( $_POST['notice'] ) ) { |
196 | - // Init the notice class and mark notice as deactivated |
|
197 | - MonsterInsights()->notices->dismiss( $_POST['notice'] ); |
|
196 | + // Init the notice class and mark notice as deactivated |
|
197 | + MonsterInsights()->notices->dismiss( $_POST['notice'] ); |
|
198 | 198 | |
199 | - // Return true |
|
200 | - echo json_encode( true ); |
|
201 | - wp_die(); |
|
199 | + // Return true |
|
200 | + echo json_encode( true ); |
|
201 | + wp_die(); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // If here, an error occurred |
@@ -131,7 +131,7 @@ |
||
131 | 131 | |
132 | 132 | // Activate the addon. |
133 | 133 | if ( isset( $_POST['plugin'] ) ) { |
134 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
134 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
135 | 135 | $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
136 | 136 | } else { |
137 | 137 | $activate = activate_plugin( $_POST['plugin'] ); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
868 | 868 | global $wp_filter; |
869 | 869 | // Check that filter actually exists first |
870 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
870 | + if ( ! isset( $wp_filter[ $tag ] ) ) return false; |
|
871 | 871 | /** |
872 | 872 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
873 | 873 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $callbacks = &$wp_filter[ $tag ]; |
883 | 883 | } |
884 | 884 | // Exit if there aren't any callbacks for specified priority |
885 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
885 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return false; |
|
886 | 886 | // Loop through each filter for the specified priority, looking for our class & method |
887 | 887 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
888 | 888 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
905 | 905 | unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
906 | 906 | } |
907 | - return TRUE; |
|
907 | + return true; |
|
908 | 908 | } |
909 | 909 | } |
910 | - return FALSE; |
|
910 | + return false; |
|
911 | 911 | } |
912 | 912 | } // End function exists |
913 | 913 |
@@ -844,11 +844,11 @@ discard block |
||
844 | 844 | return $countries; |
845 | 845 | } |
846 | 846 | |
847 | -function monsterinsights_get_api_url(){ |
|
847 | +function monsterinsights_get_api_url() { |
|
848 | 848 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
849 | 849 | } |
850 | 850 | |
851 | -function monsterinsights_get_licensing_url(){ |
|
851 | +function monsterinsights_get_licensing_url() { |
|
852 | 852 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
853 | 853 | } |
854 | 854 | |
@@ -917,7 +917,9 @@ discard block |
||
917 | 917 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
918 | 918 | global $wp_filter; |
919 | 919 | // Check that filter actually exists first |
920 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
920 | + if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
921 | + return FALSE; |
|
922 | + } |
|
921 | 923 | /** |
922 | 924 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
923 | 925 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -932,23 +934,35 @@ discard block |
||
932 | 934 | $callbacks = &$wp_filter[ $tag ]; |
933 | 935 | } |
934 | 936 | // Exit if there aren't any callbacks for specified priority |
935 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
937 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
938 | + return FALSE; |
|
939 | + } |
|
936 | 940 | // Loop through each filter for the specified priority, looking for our class & method |
937 | 941 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
938 | 942 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
939 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
943 | + if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) { |
|
944 | + continue; |
|
945 | + } |
|
940 | 946 | // If first value in array is not an object, it can't be a class |
941 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
947 | + if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) { |
|
948 | + continue; |
|
949 | + } |
|
942 | 950 | // Method doesn't match the one we're looking for, goto next |
943 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
951 | + if ( $filter[ 'function' ][ 1 ] !== $method_name ) { |
|
952 | + continue; |
|
953 | + } |
|
944 | 954 | // Method matched, now let's check the Class |
945 | 955 | if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
946 | 956 | // Now let's remove it from the array |
947 | 957 | unset( $callbacks[ $priority ][ $filter_id ] ); |
948 | 958 | // and if it was the only filter in that priority, unset that priority |
949 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
959 | + if ( empty( $callbacks[ $priority ] ) ) { |
|
960 | + unset( $callbacks[ $priority ] ); |
|
961 | + } |
|
950 | 962 | // and if the only filter for that tag, set the tag to an empty array |
951 | - if ( empty( $callbacks ) ) $callbacks = array(); |
|
963 | + if ( empty( $callbacks ) ) { |
|
964 | + $callbacks = array(); |
|
965 | + } |
|
952 | 966 | // If using WordPress older than 4.7 |
953 | 967 | if ( ! is_object( $wp_filter[ $tag ] ) ) { |
954 | 968 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | $user = new WP_User( $user_id ); |
33 | 33 | } |
34 | 34 | |
35 | - $track_user = true; |
|
36 | - $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
35 | + $track_user = true; |
|
36 | + $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
37 | 37 | |
38 | 38 | if ( ! empty( $roles ) && is_array( $roles ) ) { |
39 | 39 | foreach ( $roles as $role ) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | |
101 | 101 | $ga_cookie = $_COOKIE['_ga']; |
102 | - $cookie_parts = explode('.', $ga_cookie ); |
|
102 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
103 | 103 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
104 | 104 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
105 | 105 | if ( is_string( $uuid ) ) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | $ga_cookie = $_COOKIE['_ga']; |
161 | - $cookie_parts = explode('.', $ga_cookie ); |
|
161 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
162 | 162 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
163 | 163 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
164 | 164 | if ( is_string( $uuid ) ) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | function monsterinsights_generate_ga_client_id() { |
176 | - return rand(100000000,999999999) . '.' . time(); |
|
176 | + return rand( 100000000, 999999999 ) . '.' . time(); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $stop = time(); |
194 | 194 | } |
195 | 195 | |
196 | - $diff = (int) abs( $stop - $start ); |
|
196 | + $diff = (int) abs( $stop - $start ); |
|
197 | 197 | $hours = round( $diff / HOUR_IN_SECONDS ); |
198 | 198 | return $hours; |
199 | 199 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
252 | 252 | |
253 | 253 | foreach ( $editable_roles as $id => $name ) { |
254 | - $roles[ $id ] = translate_user_role( $name['name'] ); |
|
254 | + $roles[$id] = translate_user_role( $name['name'] ); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return $roles; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | foreach ( $editable_roles as $id => $role ) { |
279 | 279 | if ( isset( $role['capabilities']['manage_options'] ) && $role['capabilities']['manage_options'] ) { |
280 | - $roles[ $id ] = translate_user_role( $role['name'] ); |
|
280 | + $roles[$id] = translate_user_role( $role['name'] ); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | } |
325 | 325 | if ( substr_count( $host, '.' ) > 1 ) { |
326 | - $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
326 | + $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
327 | 327 | foreach ( $subdomains_to_check as $subdomain ) { |
328 | 328 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
329 | 329 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
@@ -339,16 +339,16 @@ discard block |
||
339 | 339 | |
340 | 340 | // Set cookie to expire in 2 years |
341 | 341 | function monsterinsights_get_cookie_expiration_date( $time ) { |
342 | - return date('D, j F Y H:i:s', time() + $time ); |
|
342 | + return date( 'D, j F Y H:i:s', time() + $time ); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | function monsterinsights_string_ends_with( $string, $ending ) { |
346 | - $strlen = strlen($string); |
|
347 | - $endinglen = strlen($ending); |
|
346 | + $strlen = strlen( $string ); |
|
347 | + $endinglen = strlen( $ending ); |
|
348 | 348 | if ( $endinglen > $strlen ) { |
349 | 349 | return false; |
350 | 350 | } |
351 | - return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0; |
|
351 | + return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | function monsterinsights_string_starts_with( $string, $start ) { |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | return $countries; |
873 | 873 | } |
874 | 874 | |
875 | -function monsterinsights_get_api_url(){ |
|
875 | +function monsterinsights_get_api_url() { |
|
876 | 876 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
877 | 877 | } |
878 | 878 | |
879 | -function monsterinsights_get_licensing_url(){ |
|
879 | +function monsterinsights_get_licensing_url() { |
|
880 | 880 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
881 | 881 | } |
882 | 882 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
923 | -if ( ! function_exists ( 'remove_class_filter' ) ) { |
|
923 | +if ( ! function_exists( 'remove_class_filter' ) ) { |
|
924 | 924 | /** |
925 | 925 | * Remove Class Filter Without Access to Class Object |
926 | 926 | * |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
942 | 942 | global $wp_filter; |
943 | 943 | // Check that filter actually exists first |
944 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
944 | + if ( ! isset( $wp_filter[$tag] ) ) return FALSE; |
|
945 | 945 | /** |
946 | 946 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
947 | 947 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -950,33 +950,33 @@ discard block |
||
950 | 950 | * |
951 | 951 | * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ |
952 | 952 | */ |
953 | - if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) { |
|
954 | - $callbacks = &$wp_filter[ $tag ]->callbacks; |
|
953 | + if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) { |
|
954 | + $callbacks = &$wp_filter[$tag]->callbacks; |
|
955 | 955 | } else { |
956 | - $callbacks = &$wp_filter[ $tag ]; |
|
956 | + $callbacks = &$wp_filter[$tag]; |
|
957 | 957 | } |
958 | 958 | // Exit if there aren't any callbacks for specified priority |
959 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
959 | + if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE; |
|
960 | 960 | // Loop through each filter for the specified priority, looking for our class & method |
961 | - foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
|
961 | + foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) { |
|
962 | 962 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
963 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
963 | + if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue; |
|
964 | 964 | // If first value in array is not an object, it can't be a class |
965 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
965 | + if ( ! is_object( $filter['function'][0] ) ) continue; |
|
966 | 966 | // Method doesn't match the one we're looking for, goto next |
967 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
967 | + if ( $filter['function'][1] !== $method_name ) continue; |
|
968 | 968 | // Method matched, now let's check the Class |
969 | - if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
|
969 | + if ( get_class( $filter['function'][0] ) === $class_name ) { |
|
970 | 970 | // Now let's remove it from the array |
971 | - unset( $callbacks[ $priority ][ $filter_id ] ); |
|
971 | + unset( $callbacks[$priority][$filter_id] ); |
|
972 | 972 | // and if it was the only filter in that priority, unset that priority |
973 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
973 | + if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] ); |
|
974 | 974 | // and if the only filter for that tag, set the tag to an empty array |
975 | 975 | if ( empty( $callbacks ) ) $callbacks = array(); |
976 | 976 | // If using WordPress older than 4.7 |
977 | - if ( ! is_object( $wp_filter[ $tag ] ) ) { |
|
977 | + if ( ! is_object( $wp_filter[$tag] ) ) { |
|
978 | 978 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
979 | - unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
|
979 | + unset( $GLOBALS['merged_filters'][$tag] ); |
|
980 | 980 | } |
981 | 981 | return TRUE; |
982 | 982 | } |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | } |
986 | 986 | } // End function exists |
987 | 987 | |
988 | -if ( ! function_exists ( 'remove_class_action' ) ) { |
|
988 | +if ( ! function_exists( 'remove_class_action' ) ) { |
|
989 | 989 | /** |
990 | 990 | * Remove Class Action Without Access to Class Object |
991 | 991 | * |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | foreach ( $translations->entries as $msgid => $entry ) { |
1058 | - $locale[ $msgid ] = $entry->translations; |
|
1058 | + $locale[$msgid] = $entry->translations; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | return $locale; |
@@ -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 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return array Array of the options to use. |
58 | 58 | */ |
59 | 59 | public function frontend_tracking_options( ) { |
60 | - return array(); |
|
60 | + return array(); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @return string Javascript to output. |
74 | 74 | */ |
75 | 75 | public function frontend_output( ) { |
76 | - $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
77 | - $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' ) . ' -->'; |
|
78 | - $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
79 | - return $output; |
|
76 | + $output = '<!-- This site uses the Google Analytics by MonsterInsights plugin v ' . MONSTERINSIGHTS_VERSION .' - https://www.monsterinsights.com/ -->'; |
|
77 | + $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' ) . ' -->'; |
|
78 | + $output .= '<!-- / Google Analytics by MonsterInsights -->'; |
|
79 | + return $output; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | \ 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 = '#'; |
@@ -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 = '#'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | do_action( 'monsterinsights_tracking_before_' . $mode ); |
38 | 38 | do_action( 'monsterinsights_tracking_before', $mode ); |
39 | 39 | if ( $mode === 'preview' ) { |
40 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php'; |
|
41 | - $tracking = new MonsterInsights_Tracking_Preview(); |
|
42 | - echo $tracking->frontend_output(); |
|
40 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php'; |
|
41 | + $tracking = new MonsterInsights_Tracking_Preview(); |
|
42 | + echo $tracking->frontend_output(); |
|
43 | 43 | } else { |
44 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php'; |
|
45 | - $tracking = new MonsterInsights_Tracking_Analytics(); |
|
46 | - echo $tracking->frontend_output(); |
|
44 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php'; |
|
45 | + $tracking = new MonsterInsights_Tracking_Analytics(); |
|
46 | + echo $tracking->frontend_output(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | do_action( 'monsterinsights_tracking_after_' . $mode ); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $track_user = monsterinsights_track_user(); |
70 | 70 | |
71 | 71 | if ( $track_user && ( $events_mode === 'js' || $events_mode === 'php' ) ) { |
72 | - require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
73 | - new MonsterInsights_Analytics_Events(); |
|
72 | + require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php'; |
|
73 | + new MonsterInsights_Analytics_Events(); |
|
74 | 74 | } else { |
75 | - // User is in the disabled group or events mode is off |
|
75 | + // User is in the disabled group or events mode is off |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | add_action( 'template_redirect', 'monsterinsights_events_tracking', 9 ); |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | global $post; |
92 | 92 | |
93 | 93 | if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){ |
94 | - if ( is_feed() ) { |
|
95 | - if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
|
96 | - $delimiter = '#'; |
|
97 | - } else { |
|
98 | - $delimiter = '?'; |
|
99 | - if ( strpos( $guid, $delimiter ) > 0 ) { |
|
100 | - $delimiter = '&'; |
|
101 | - } |
|
102 | - } |
|
103 | - return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name ); |
|
104 | - } |
|
94 | + if ( is_feed() ) { |
|
95 | + if ( monsterinsights_get_option( 'allow_anchor', false ) ) { |
|
96 | + $delimiter = '#'; |
|
97 | + } else { |
|
98 | + $delimiter = '?'; |
|
99 | + if ( strpos( $guid, $delimiter ) > 0 ) { |
|
100 | + $delimiter = '&'; |
|
101 | + } |
|
102 | + } |
|
103 | + return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name ); |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | return $guid; |
107 | 107 | } |
@@ -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> |