@@ -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 |
@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -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'] ); |
@@ -58,53 +58,53 @@ discard block |
||
58 | 58 | |
59 | 59 | // Install the addon. |
60 | 60 | if ( isset( $_POST['plugin'] ) ) { |
61 | - $download_url = $_POST['plugin']; |
|
62 | - global $hook_suffix; |
|
63 | - |
|
64 | - // Set the current screen to avoid undefined notices. |
|
65 | - set_current_screen(); |
|
66 | - |
|
67 | - // Prepare variables. |
|
68 | - $method = ''; |
|
69 | - $url = add_query_arg( |
|
70 | - array( |
|
71 | - 'page' => 'monsterinsights-settings' |
|
72 | - ), |
|
73 | - admin_url( 'admin.php' ) |
|
74 | - ); |
|
75 | - $url = esc_url( $url ); |
|
76 | - |
|
77 | - // Start output bufferring to catch the filesystem form if credentials are needed. |
|
78 | - ob_start(); |
|
79 | - if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
|
80 | - $form = ob_get_clean(); |
|
81 | - echo json_encode( array( 'form' => $form ) ); |
|
82 | - wp_die(); |
|
83 | - } |
|
84 | - |
|
85 | - // If we are not authenticated, make it happen now. |
|
86 | - if ( ! WP_Filesystem( $creds ) ) { |
|
87 | - ob_start(); |
|
88 | - request_filesystem_credentials( $url, $method, true, false, null ); |
|
89 | - $form = ob_get_clean(); |
|
90 | - echo json_encode( array( 'form' => $form ) ); |
|
91 | - wp_die(); |
|
92 | - } |
|
93 | - |
|
94 | - // We do not need any extra credentials if we have gotten this far, so let's install the plugin. |
|
61 | + $download_url = $_POST['plugin']; |
|
62 | + global $hook_suffix; |
|
63 | + |
|
64 | + // Set the current screen to avoid undefined notices. |
|
65 | + set_current_screen(); |
|
66 | + |
|
67 | + // Prepare variables. |
|
68 | + $method = ''; |
|
69 | + $url = add_query_arg( |
|
70 | + array( |
|
71 | + 'page' => 'monsterinsights-settings' |
|
72 | + ), |
|
73 | + admin_url( 'admin.php' ) |
|
74 | + ); |
|
75 | + $url = esc_url( $url ); |
|
76 | + |
|
77 | + // Start output bufferring to catch the filesystem form if credentials are needed. |
|
78 | + ob_start(); |
|
79 | + if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
|
80 | + $form = ob_get_clean(); |
|
81 | + echo json_encode( array( 'form' => $form ) ); |
|
82 | + wp_die(); |
|
83 | + } |
|
84 | + |
|
85 | + // If we are not authenticated, make it happen now. |
|
86 | + if ( ! WP_Filesystem( $creds ) ) { |
|
87 | + ob_start(); |
|
88 | + request_filesystem_credentials( $url, $method, true, false, null ); |
|
89 | + $form = ob_get_clean(); |
|
90 | + echo json_encode( array( 'form' => $form ) ); |
|
91 | + wp_die(); |
|
92 | + } |
|
93 | + |
|
94 | + // We do not need any extra credentials if we have gotten this far, so let's install the plugin. |
|
95 | 95 | monsterinsights_require_upgrader( false ); |
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. |
@@ -133,16 +133,16 @@ discard block |
||
133 | 133 | |
134 | 134 | // Activate the addon. |
135 | 135 | if ( isset( $_POST['plugin'] ) ) { |
136 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
137 | - $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
|
138 | - } else { |
|
139 | - $activate = activate_plugin( $_POST['plugin'] ); |
|
140 | - } |
|
141 | - |
|
142 | - if ( is_wp_error( $activate ) ) { |
|
143 | - echo json_encode( array( 'error' => $activate->get_error_message() ) ); |
|
144 | - wp_die(); |
|
145 | - } |
|
136 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
137 | + $activate = activate_plugin( $_POST['plugin'], NULL, true ); |
|
138 | + } else { |
|
139 | + $activate = activate_plugin( $_POST['plugin'] ); |
|
140 | + } |
|
141 | + |
|
142 | + if ( is_wp_error( $activate ) ) { |
|
143 | + echo json_encode( array( 'error' => $activate->get_error_message() ) ); |
|
144 | + wp_die(); |
|
145 | + } |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | echo json_encode( true ); |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | |
171 | 171 | // Deactivate the addon. |
172 | 172 | if ( isset( $_POST['plugin'] ) ) { |
173 | - if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
174 | - $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
|
175 | - } else { |
|
176 | - $deactivate = deactivate_plugins( $_POST['plugin'] ); |
|
177 | - } |
|
173 | + if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { |
|
174 | + $deactivate = deactivate_plugins( $_POST['plugin'], false, true ); |
|
175 | + } else { |
|
176 | + $deactivate = deactivate_plugins( $_POST['plugin'] ); |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | echo json_encode( true ); |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | |
198 | 198 | // Deactivate the notice |
199 | 199 | if ( isset( $_POST['notice'] ) ) { |
200 | - // Init the notice class and mark notice as deactivated |
|
201 | - MonsterInsights()->notices->dismiss( $_POST['notice'] ); |
|
200 | + // Init the notice class and mark notice as deactivated |
|
201 | + MonsterInsights()->notices->dismiss( $_POST['notice'] ); |
|
202 | 202 | |
203 | - // Return true |
|
204 | - echo json_encode( true ); |
|
205 | - wp_die(); |
|
203 | + // Return true |
|
204 | + echo json_encode( true ); |
|
205 | + wp_die(); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // If here, an error occurred |
@@ -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 |
@@ -887,11 +887,11 @@ discard block |
||
887 | 887 | return $countries; |
888 | 888 | } |
889 | 889 | |
890 | -function monsterinsights_get_api_url(){ |
|
890 | +function monsterinsights_get_api_url() { |
|
891 | 891 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
892 | 892 | } |
893 | 893 | |
894 | -function monsterinsights_get_licensing_url(){ |
|
894 | +function monsterinsights_get_licensing_url() { |
|
895 | 895 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
896 | 896 | } |
897 | 897 | |
@@ -956,7 +956,9 @@ discard block |
||
956 | 956 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
957 | 957 | global $wp_filter; |
958 | 958 | // Check that filter actually exists first |
959 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
959 | + if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
960 | + return FALSE; |
|
961 | + } |
|
960 | 962 | /** |
961 | 963 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
962 | 964 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -971,23 +973,35 @@ discard block |
||
971 | 973 | $callbacks = &$wp_filter[ $tag ]; |
972 | 974 | } |
973 | 975 | // Exit if there aren't any callbacks for specified priority |
974 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
976 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
977 | + return FALSE; |
|
978 | + } |
|
975 | 979 | // Loop through each filter for the specified priority, looking for our class & method |
976 | 980 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
977 | 981 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
978 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
982 | + if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) { |
|
983 | + continue; |
|
984 | + } |
|
979 | 985 | // If first value in array is not an object, it can't be a class |
980 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
986 | + if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) { |
|
987 | + continue; |
|
988 | + } |
|
981 | 989 | // Method doesn't match the one we're looking for, goto next |
982 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
990 | + if ( $filter[ 'function' ][ 1 ] !== $method_name ) { |
|
991 | + continue; |
|
992 | + } |
|
983 | 993 | // Method matched, now let's check the Class |
984 | 994 | if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
985 | 995 | // Now let's remove it from the array |
986 | 996 | unset( $callbacks[ $priority ][ $filter_id ] ); |
987 | 997 | // and if it was the only filter in that priority, unset that priority |
988 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
998 | + if ( empty( $callbacks[ $priority ] ) ) { |
|
999 | + unset( $callbacks[ $priority ] ); |
|
1000 | + } |
|
989 | 1001 | // and if the only filter for that tag, set the tag to an empty array |
990 | - if ( empty( $callbacks ) ) $callbacks = array(); |
|
1002 | + if ( empty( $callbacks ) ) { |
|
1003 | + $callbacks = array(); |
|
1004 | + } |
|
991 | 1005 | // If using WordPress older than 4.7 |
992 | 1006 | if ( ! is_object( $wp_filter[ $tag ] ) ) { |
993 | 1007 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
@@ -1443,7 +1457,7 @@ discard block |
||
1443 | 1457 | * |
1444 | 1458 | * @return trimed sentence |
1445 | 1459 | */ |
1446 | -function monsterinsights_trim_text( $text, $count ){ |
|
1460 | +function monsterinsights_trim_text( $text, $count ) { |
|
1447 | 1461 | $text = str_replace(" ", " ", $text); |
1448 | 1462 | $string = explode(" ", $text); |
1449 | 1463 | $trimed = ""; |
@@ -1451,7 +1465,7 @@ discard block |
||
1451 | 1465 | for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter++ ) { |
1452 | 1466 | $trimed .= isset( $string[$wordCounter] ) ? $string[$wordCounter] : ''; |
1453 | 1467 | |
1454 | - if ( $wordCounter < $count ){ |
|
1468 | + if ( $wordCounter < $count ) { |
|
1455 | 1469 | $trimed .= " "; |
1456 | 1470 | } else { |
1457 | 1471 | $trimed .= "..."; |
@@ -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 ) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | |
184 | 184 | function monsterinsights_generate_ga_client_id() { |
185 | - return rand(100000000,999999999) . '.' . time(); |
|
185 | + return rand( 100000000, 999999999 ) . '.' . time(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $stop = time(); |
203 | 203 | } |
204 | 204 | |
205 | - $diff = (int) abs( $stop - $start ); |
|
205 | + $diff = (int) abs( $stop - $start ); |
|
206 | 206 | $hours = round( $diff / HOUR_IN_SECONDS ); |
207 | 207 | return $hours; |
208 | 208 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
261 | 261 | |
262 | 262 | foreach ( $editable_roles as $id => $name ) { |
263 | - $roles[ $id ] = translate_user_role( $name['name'] ); |
|
263 | + $roles[$id] = translate_user_role( $name['name'] ); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | return $roles; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | foreach ( $editable_roles as $id => $role ) { |
288 | 288 | if ( isset( $role['capabilities']['manage_options'] ) && $role['capabilities']['manage_options'] ) { |
289 | - $roles[ $id ] = translate_user_role( $role['name'] ); |
|
289 | + $roles[$id] = translate_user_role( $role['name'] ); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | } |
334 | 334 | if ( substr_count( $host, '.' ) > 1 ) { |
335 | - $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
335 | + $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); |
|
336 | 336 | foreach ( $subdomains_to_check as $subdomain ) { |
337 | 337 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
338 | 338 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
@@ -348,16 +348,16 @@ discard block |
||
348 | 348 | |
349 | 349 | // Set cookie to expire in 2 years |
350 | 350 | function monsterinsights_get_cookie_expiration_date( $time ) { |
351 | - return date('D, j F Y H:i:s', time() + $time ); |
|
351 | + return date( 'D, j F Y H:i:s', time() + $time ); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | function monsterinsights_string_ends_with( $string, $ending ) { |
355 | - $strlen = strlen($string); |
|
356 | - $endinglen = strlen($ending); |
|
355 | + $strlen = strlen( $string ); |
|
356 | + $endinglen = strlen( $ending ); |
|
357 | 357 | if ( $endinglen > $strlen ) { |
358 | 358 | return false; |
359 | 359 | } |
360 | - return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0; |
|
360 | + return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | function monsterinsights_string_starts_with( $string, $start ) { |
@@ -887,11 +887,11 @@ discard block |
||
887 | 887 | return $countries; |
888 | 888 | } |
889 | 889 | |
890 | -function monsterinsights_get_api_url(){ |
|
890 | +function monsterinsights_get_api_url() { |
|
891 | 891 | return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' ); |
892 | 892 | } |
893 | 893 | |
894 | -function monsterinsights_get_licensing_url(){ |
|
894 | +function monsterinsights_get_licensing_url() { |
|
895 | 895 | return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' ); |
896 | 896 | } |
897 | 897 | |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
938 | -if ( ! function_exists ( 'remove_class_filter' ) ) { |
|
938 | +if ( ! function_exists( 'remove_class_filter' ) ) { |
|
939 | 939 | /** |
940 | 940 | * Remove Class Filter Without Access to Class Object |
941 | 941 | * |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
957 | 957 | global $wp_filter; |
958 | 958 | // Check that filter actually exists first |
959 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
959 | + if ( ! isset( $wp_filter[$tag] ) ) return FALSE; |
|
960 | 960 | /** |
961 | 961 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
962 | 962 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -965,33 +965,33 @@ discard block |
||
965 | 965 | * |
966 | 966 | * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ |
967 | 967 | */ |
968 | - if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) { |
|
969 | - $callbacks = &$wp_filter[ $tag ]->callbacks; |
|
968 | + if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) { |
|
969 | + $callbacks = &$wp_filter[$tag]->callbacks; |
|
970 | 970 | } else { |
971 | - $callbacks = &$wp_filter[ $tag ]; |
|
971 | + $callbacks = &$wp_filter[$tag]; |
|
972 | 972 | } |
973 | 973 | // Exit if there aren't any callbacks for specified priority |
974 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
974 | + if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE; |
|
975 | 975 | // Loop through each filter for the specified priority, looking for our class & method |
976 | - foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
|
976 | + foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) { |
|
977 | 977 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
978 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
978 | + if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue; |
|
979 | 979 | // If first value in array is not an object, it can't be a class |
980 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
980 | + if ( ! is_object( $filter['function'][0] ) ) continue; |
|
981 | 981 | // Method doesn't match the one we're looking for, goto next |
982 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
982 | + if ( $filter['function'][1] !== $method_name ) continue; |
|
983 | 983 | // Method matched, now let's check the Class |
984 | - if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
|
984 | + if ( get_class( $filter['function'][0] ) === $class_name ) { |
|
985 | 985 | // Now let's remove it from the array |
986 | - unset( $callbacks[ $priority ][ $filter_id ] ); |
|
986 | + unset( $callbacks[$priority][$filter_id] ); |
|
987 | 987 | // and if it was the only filter in that priority, unset that priority |
988 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
988 | + if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] ); |
|
989 | 989 | // and if the only filter for that tag, set the tag to an empty array |
990 | 990 | if ( empty( $callbacks ) ) $callbacks = array(); |
991 | 991 | // If using WordPress older than 4.7 |
992 | - if ( ! is_object( $wp_filter[ $tag ] ) ) { |
|
992 | + if ( ! is_object( $wp_filter[$tag] ) ) { |
|
993 | 993 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
994 | - unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
|
994 | + unset( $GLOBALS['merged_filters'][$tag] ); |
|
995 | 995 | } |
996 | 996 | return TRUE; |
997 | 997 | } |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | } // End function exists |
1002 | 1002 | |
1003 | -if ( ! function_exists ( 'remove_class_action' ) ) { |
|
1003 | +if ( ! function_exists( 'remove_class_action' ) ) { |
|
1004 | 1004 | /** |
1005 | 1005 | * Remove Class Action Without Access to Class Object |
1006 | 1006 | * |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | foreach ( $translations->entries as $msgid => $entry ) { |
1073 | - $locale[ $msgid ] = $entry->translations; |
|
1073 | + $locale[$msgid] = $entry->translations; |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | return $locale; |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $pattern = '/UA-[0-9-]+/'; |
1223 | 1223 | if ( $type === 'ua' && isset( $options['ga-UID'] ) && preg_match( $pattern, $options['ga-UID'] ) ) { |
1224 | - ++ $count; |
|
1224 | + ++$count; |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $pattern = '/UA-[0-9-]+/'; |
1234 | 1234 | if ( $type === 'ua' && ! empty( $code ) && preg_match( $pattern, $code ) ) { |
1235 | - ++ $count; |
|
1235 | + ++$count; |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $connected_type = MonsterInsights()->auth->get_connected_type(); |
1295 | 1295 | if ( $type === $connected_type && strpos( $body, 'googletagmanager.com/gtag/js?id=' . $current_code ) !== false ) { |
1296 | 1296 | // In that case, we can safely deduct one from the total count |
1297 | - -- $total_count; |
|
1297 | + --$total_count; |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | if ( $total_count > $limit ) { |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $response_code = wp_remote_retrieve_response_code( $request ); |
1337 | 1337 | |
1338 | 1338 | if ( in_array( $response_code, $accepted_http_codes, true ) ) { |
1339 | - $body = wp_remote_retrieve_body( $request ); |
|
1339 | + $body = wp_remote_retrieve_body( $request ); |
|
1340 | 1340 | |
1341 | 1341 | $errors = array_merge( |
1342 | 1342 | monsterinsights_detect_tracking_code_error( $body ), |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * @param string $url The url to which users get redirected. |
1368 | 1368 | */ |
1369 | 1369 | function monsterinsights_custom_track_pretty_links_redirect( $url ) { |
1370 | - if ( ! function_exists( 'monsterinsights_mp_track_event_call' ) && ! function_exists( 'monsterinsights_mp_collect_v4') ) { |
|
1370 | + if ( ! function_exists( 'monsterinsights_mp_track_event_call' ) && ! function_exists( 'monsterinsights_mp_collect_v4' ) ) { |
|
1371 | 1371 | return; |
1372 | 1372 | } |
1373 | 1373 | // Try to determine if click originated on the same site. |
@@ -1514,22 +1514,22 @@ discard block |
||
1514 | 1514 | * |
1515 | 1515 | * @return trimed sentence |
1516 | 1516 | */ |
1517 | -function monsterinsights_trim_text( $text, $count ){ |
|
1518 | - $text = str_replace(" ", " ", $text); |
|
1519 | - $string = explode(" ", $text); |
|
1517 | +function monsterinsights_trim_text( $text, $count ) { |
|
1518 | + $text = str_replace( " ", " ", $text ); |
|
1519 | + $string = explode( " ", $text ); |
|
1520 | 1520 | $trimed = ""; |
1521 | 1521 | |
1522 | 1522 | for ( $wordCounter = 0; $wordCounter <= $count; $wordCounter++ ) { |
1523 | 1523 | $trimed .= isset( $string[$wordCounter] ) ? $string[$wordCounter] : ''; |
1524 | 1524 | |
1525 | - if ( $wordCounter < $count ){ |
|
1525 | + if ( $wordCounter < $count ) { |
|
1526 | 1526 | $trimed .= " "; |
1527 | 1527 | } else { |
1528 | 1528 | $trimed .= "..."; |
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | |
1532 | - $trimed = trim($trimed); |
|
1532 | + $trimed = trim( $trimed ); |
|
1533 | 1533 | |
1534 | 1534 | return $trimed; |
1535 | 1535 | } |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | $monsterinsights_reference = isset( $_GET['monsterinsights_reference'] ) ? $_GET['monsterinsights_reference'] : ''; |
1606 | 1606 | |
1607 | 1607 | if ( 'post-new.php' === $pagenow && 'pretty-link' === $post_type && 'url_builder' === $monsterinsights_reference ) { |
1608 | - $onboard = get_option( 'prli_onboard' ); |
|
1608 | + $onboard = get_option( 'prli_onboard' ); |
|
1609 | 1609 | |
1610 | 1610 | if ( $onboard == 'welcome' || $onboard == 'update' ) { |
1611 | 1611 | update_option( 'monsterinsights_backup_prli_onboard_value', $onboard ); |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; |
1626 | 1626 | |
1627 | 1627 | if ( 'edit.php' === $pagenow && 'pretty-link' === $post_type ) { |
1628 | - $onboard = get_option( 'monsterinsights_backup_prli_onboard_value' ); |
|
1628 | + $onboard = get_option( 'monsterinsights_backup_prli_onboard_value' ); |
|
1629 | 1629 | |
1630 | 1630 | if ( class_exists( 'PrliBaseController' ) && ( $onboard == 'welcome' || $onboard == 'update' ) ) { |
1631 | 1631 | update_option( 'prli_onboard', $onboard ); |
@@ -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 |
@@ -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> |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Helper method for deleting a setting's value. |
|
199 | - * |
|
200 | - * @since 6.0.0 |
|
201 | - * @access public |
|
202 | - * |
|
203 | - * @param string $key The setting key. |
|
204 | - * @return boolean True if removed, false if not. |
|
205 | - */ |
|
198 | + * Helper method for deleting a setting's value. |
|
199 | + * |
|
200 | + * @since 6.0.0 |
|
201 | + * @access public |
|
202 | + * |
|
203 | + * @param string $key The setting key. |
|
204 | + * @return boolean True if removed, false if not. |
|
205 | + */ |
|
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | 208 | if ( empty( $key ) ){ |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * Helper method for deleting multiple settings value. |
|
249 | - * |
|
250 | - * @since 6.0.0 |
|
251 | - * @access public |
|
252 | - * |
|
253 | - * @param string $key The setting key. |
|
254 | - * @return boolean True if removed, false if not. |
|
255 | - */ |
|
248 | + * Helper method for deleting multiple settings value. |
|
249 | + * |
|
250 | + * @since 6.0.0 |
|
251 | + * @access public |
|
252 | + * |
|
253 | + * @param string $key The setting key. |
|
254 | + * @return boolean True if removed, false if not. |
|
255 | + */ |
|
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | 258 | if ( empty( $keys ) || ! is_array( $keys ) ){ |
@@ -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 ); |
@@ -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 | |
@@ -186,7 +186,7 @@ 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 | 191 | $monsterinsights_settings[ $key ] = $value; |
192 | 192 | } |
@@ -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 | |
@@ -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 | |
@@ -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 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return array Array of the options to use. |
59 | 59 | */ |
60 | 60 | public function frontend_tracking_options( ) { |
61 | - return array(); |
|
61 | + return array(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -74,6 +74,6 @@ discard block |
||
74 | 74 | * @return string Javascript to output. |
75 | 75 | */ |
76 | 76 | public function frontend_output( ) { |
77 | - return "<!-- MonsterInsights Abstract Tracking class -->"; |
|
77 | + return "<!-- MonsterInsights Abstract Tracking class -->"; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function add_report( $report = false ){ |
|
27 | + public function add_report( $report = false ) { |
|
28 | 28 | if ( empty( $report ) || ! is_object( $report ) ) { |
29 | 29 | return; |
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function add_report( $report = false ){ |
|
27 | + public function add_report( $report = false ) { |
|
28 | 28 | if ( empty( $report ) || ! is_object( $report ) ) { |
29 | 29 | return; |
30 | 30 | } |