@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ?> |
27 | 27 | <div id="monsterinsights-settings-general"> |
28 | 28 | <?php |
29 | - ?> |
|
29 | + ?> |
|
30 | 30 | <?php //Status page coming soon. ?> |
31 | 31 | <!-- <hr /> --> |
32 | 32 | </div> |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function monsterinsights_system_info() { |
42 | 42 | if ( ! empty( $_REQUEST['monsterinsights-action'] ) && $_REQUEST['monsterinsights-action'] === 'download_sysinfo' ) { |
43 | - if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
44 | - return; |
|
45 | - } |
|
46 | - nocache_headers(); |
|
47 | - header( 'Content-Type: text/plain' ); |
|
48 | - header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' ); |
|
49 | - echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] ); |
|
50 | - die(); |
|
43 | + if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
44 | + return; |
|
45 | + } |
|
46 | + nocache_headers(); |
|
47 | + header( 'Content-Type: text/plain' ); |
|
48 | + header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' ); |
|
49 | + echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] ); |
|
50 | + die(); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | //add_action( 'admin_init', 'monsterinsights_system_info' ); |
54 | 54 | \ No newline at end of file |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -24,9 +24,9 @@ |
||
24 | 24 | ?> |
25 | 25 | <div id="monsterinsights-settings-general"> |
26 | 26 | <?php |
27 | - // Output any notices now |
|
28 | - do_action( 'monsterinsights_settings_support_tab_notice' ); |
|
29 | - ?> |
|
27 | + // Output any notices now |
|
28 | + do_action( 'monsterinsights_settings_support_tab_notice' ); |
|
29 | + ?> |
|
30 | 30 | <?php //Status page coming soon. ?> |
31 | 31 | <!-- <hr /> --> |
32 | 32 | </div> |
@@ -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 ) ){ |
@@ -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 |
@@ -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 |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | global $admin_page_hooks; |
19 | 19 | |
20 | 20 | if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) { |
21 | - return false; |
|
21 | + return false; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $settings_page = false; |
25 | 25 | if ( ! empty( $admin_page_hooks['monsterinsights_dashboard'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_dashboard'] . '_page_monsterinsights_addons' ) { |
26 | - $settings_page = true; |
|
26 | + $settings_page = true; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | if ( ! empty( $admin_page_hooks['monsterinsights_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] . '_page_monsterinsights_addons' ) { |
30 | - $settings_page = true; |
|
30 | + $settings_page = true; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if ( ! empty( $admin_page_hooks['monsterinsights_network'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_network'] . '_page_monsterinsights_addons-network' ) { |
34 | - $settings_page = true; |
|
34 | + $settings_page = true; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return $settings_page; |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function monsterinsights_maybe_refresh_addons() { |
48 | 48 | if ( ! monsterinsights_is_addons_page() ) { |
49 | - return; |
|
49 | + return; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | if ( empty( $_POST['google-analytics-for-wordpress-refresh-addons-submit'] ) ) { |
54 | - return; |
|
54 | + return; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( ! wp_verify_nonce( $_POST['google-analytics-for-wordpress-refresh-addons'], 'google-analytics-for-wordpress-refresh-addons' ) ) { |
58 | - return; |
|
58 | + return; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | monsterinsights_get_addons_data( MonsterInsights()->license->get_valid_license_key() ); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | <div id="monsterinsights-addons" class="wrap"> |
94 | 94 | <div class="monsterinsights-clear"> |
95 | 95 | <?php |
96 | - /** |
|
97 | - * Developer Alert: |
|
98 | - * |
|
99 | - * Per the README, this is considered an internal hook and should |
|
100 | - * not be used by other developers. This hook's behavior may be modified |
|
101 | - * or the hook may be removed at any time, without warning. |
|
102 | - */ |
|
103 | - ?> |
|
96 | + /** |
|
97 | + * Developer Alert: |
|
98 | + * |
|
99 | + * Per the README, this is considered an internal hook and should |
|
100 | + * not be used by other developers. This hook's behavior may be modified |
|
101 | + * or the hook may be removed at any time, without warning. |
|
102 | + */ |
|
103 | + ?> |
|
104 | 104 | <?php do_action( 'monsterinsights_addons_section' ); ?> |
105 | 105 | </div> |
106 | 106 | </div> |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | |
118 | 118 | // If error(s) occurred during license key verification, display them and exit now. |
119 | 119 | if ( ! MonsterInsights()->license->get_valid_license_key() ) { |
120 | - ?> |
|
120 | + ?> |
|
121 | 121 | <div class="error below-h2"> |
122 | 122 | <p> |
123 | 123 | <?php esc_html_e( 'In order to get access to Addons, you need to resolve your license key errors.', 'google-analytics-for-wordpress' ); ?> |
124 | 124 | </p> |
125 | 125 | </div> |
126 | 126 | <?php |
127 | - return; |
|
127 | + return; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // Get Addons |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // If no Addon(s) were returned, our API call returned an error. |
134 | 134 | // Show an error message with a button to reload the page, which will trigger another API call. |
135 | 135 | if ( ! $addons ) { |
136 | - ?> |
|
136 | + ?> |
|
137 | 137 | <form id="monsterinsights-addons-refresh-addons-form" method="post"> |
138 | 138 | <p> |
139 | 139 | <?php esc_html_e( 'There was an issue retrieving the addons for this site. Please click on the button below the refresh the addons data.', 'google-analytics-for-wordpress' ); ?> |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | </p> |
144 | 144 | </form> |
145 | 145 | <?php |
146 | - return; |
|
146 | + return; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // If here, we have Addons to display, so let's output them now. |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | ?> |
154 | 154 | <div id="monsterinsights-addons"> |
155 | 155 | <?php |
156 | - // Output Addons the User is licensed to use. |
|
157 | - if ( count( $addons['licensed'] )> 0 ) { |
|
158 | - ?> |
|
156 | + // Output Addons the User is licensed to use. |
|
157 | + if ( count( $addons['licensed'] )> 0 ) { |
|
158 | + ?> |
|
159 | 159 | <div class="monsterinsights-addons-area licensed" class="monsterinsights-clear"> |
160 | 160 | <h3><?php esc_html_e( 'Available Addons:', 'google-analytics-for-wordpress' ); ?></h3> |
161 | 161 | |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | <!-- list container class required for list.js --> |
164 | 164 | <div class="list"> |
165 | 165 | <?php |
166 | - foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | - monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | - } |
|
169 | - ?> |
|
166 | + foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | + monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </div> |
171 | 171 | </div> |
172 | 172 | </div> |
173 | 173 | <?php |
174 | - } // Close licensed addons |
|
174 | + } // Close licensed addons |
|
175 | 175 | |
176 | - // Output Addons the User isn't licensed to use. |
|
177 | - if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | - ?> |
|
176 | + // Output Addons the User isn't licensed to use. |
|
177 | + if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | + ?> |
|
179 | 179 | <div class="monsterinsights-addons-area unlicensed" class="monsterinsights-clear"> |
180 | 180 | <h3><?php esc_html_e( 'Unlock More Addons', 'google-analytics-for-wordpress' ); ?></h3> |
181 | 181 | <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url. '">', '</a>' ); ?></p> |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | <!-- list container class required for list.js --> |
185 | 185 | <div class="list"> |
186 | 186 | <?php |
187 | - foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | - monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | - } |
|
190 | - ?> |
|
187 | + foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | + monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | + } |
|
190 | + ?> |
|
191 | 191 | </div> |
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <?php |
195 | - } // Close unlicensed addons |
|
196 | - ?> |
|
195 | + } // Close unlicensed addons |
|
196 | + ?> |
|
197 | 197 | </div> |
198 | 198 | <?php |
199 | 199 | |
@@ -215,37 +215,37 @@ discard block |
||
215 | 215 | |
216 | 216 | // Get addons data from transient or perform API query if no transient. |
217 | 217 | if ( false === ( $addons = get_transient( '_monsterinsights_addons' ) ) ) { |
218 | - $addons = monsterinsights_get_addons_data( $key ); |
|
218 | + $addons = monsterinsights_get_addons_data( $key ); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // If no Addons exist, return false |
222 | 222 | if ( ! $addons ) { |
223 | - return false; |
|
223 | + return false; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // Iterate through Addons, to build two arrays: |
227 | 227 | // - Addons the user is licensed to use, |
228 | 228 | // - Addons the user isn't licensed to use. |
229 | 229 | $results = array( |
230 | - 'licensed' => array(), |
|
231 | - 'unlicensed'=> array(), |
|
230 | + 'licensed' => array(), |
|
231 | + 'unlicensed'=> array(), |
|
232 | 232 | ); |
233 | 233 | foreach ( (array) $addons as $i => $addon ) { |
234 | 234 | |
235 | - // Determine whether the user is licensed to use this Addon or not. |
|
236 | - if ( |
|
237 | - empty( $type ) || |
|
238 | - ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | - ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | - ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | - ) { |
|
242 | - // Unlicensed |
|
243 | - $results['unlicensed'][] = $addon; |
|
244 | - continue; |
|
245 | - } |
|
246 | - |
|
247 | - // Licensed |
|
248 | - $results['licensed'][] = $addon; |
|
235 | + // Determine whether the user is licensed to use this Addon or not. |
|
236 | + if ( |
|
237 | + empty( $type ) || |
|
238 | + ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | + ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | + ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | + ) { |
|
242 | + // Unlicensed |
|
243 | + $results['unlicensed'][] = $addon; |
|
244 | + continue; |
|
245 | + } |
|
246 | + |
|
247 | + // Licensed |
|
248 | + $results['licensed'][] = $addon; |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | // Get Addons |
269 | 269 | // If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information. |
270 | 270 | if ( $key ) { |
271 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
271 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
272 | 272 | } else { |
273 | - $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-all-addons-data', array() ); |
|
273 | + $addons = MonsterInsights()->license_actions->perform_remote_request( 'get-all-addons-data', array() ); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // If there was an API error, set transient for only 10 minutes. |
277 | 277 | if ( ! $addons ) { |
278 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
279 | - return false; |
|
278 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
279 | + return false; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // If there was an error retrieving the addons, set the error. |
283 | 283 | if ( isset( $addons->error ) ) { |
284 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
285 | - return false; |
|
284 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
285 | + return false; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // Otherwise, our request worked. Save the data and return it. |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | $keys = array_keys( get_plugins() ); |
304 | 304 | |
305 | 305 | foreach ( $keys as $key ) { |
306 | - if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
307 | - return $key; |
|
308 | - } |
|
306 | + if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
307 | + return $key; |
|
308 | + } |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $slug; |
@@ -328,24 +328,24 @@ discard block |
||
328 | 328 | $slug = str_replace( 'monsterinsights-', '', $addon->slug ); |
329 | 329 | $slug = 'monsterinsights-' . $addon->slug; |
330 | 330 | if ( $slug === 'monsterinsights-ecommerce' ) { |
331 | - $slug = 'ga-ecommerce'; |
|
331 | + $slug = 'ga-ecommerce'; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
335 | 335 | $categories = implode( ',', $addon->categories ); |
336 | 336 | if ( ! $installed_plugins ) { |
337 | - $installed_plugins = get_plugins(); |
|
337 | + $installed_plugins = get_plugins(); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // If the Addon doesn't supply an upgrade_url key, it's because the user hasn't provided a license |
341 | 341 | // get_upgrade_link() will return the Lite or Pro link as necessary for us. |
342 | 342 | if ( ! isset( $addon->upgrade_url ) ) { |
343 | - $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
343 | + $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | // Link user to doc to install MI pro to install addons |
347 | 347 | if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
348 | - $addon->url = 'https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons'; |
|
348 | + $addon->url = 'https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons'; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | // Output the card |
@@ -353,19 +353,19 @@ discard block |
||
353 | 353 | <div class="monsterinsights-addon"> |
354 | 354 | <h3 class="monsterinsights-addon-title"><?php echo esc_html( $addon->title ); ?></h3> |
355 | 355 | <?php |
356 | - if ( ! empty( $addon->image ) ) { |
|
357 | - ?> |
|
356 | + if ( ! empty( $addon->image ) ) { |
|
357 | + ?> |
|
358 | 358 | <img class="monsterinsights-addon-thumb" src="<?php echo esc_attr( esc_url( $addon->image ) ); ?>" alt="<?php echo esc_attr( $addon->title ); ?>" /> |
359 | 359 | <?php |
360 | - } |
|
361 | - ?> |
|
360 | + } |
|
361 | + ?> |
|
362 | 362 | |
363 | 363 | <p class="monsterinsights-addon-excerpt"><?php echo esc_html( $addon->excerpt ); ?></p> |
364 | 364 | |
365 | 365 | <?php |
366 | - // If the Addon is unlicensed, show the upgrade button |
|
367 | - if ( ! $is_licensed ) { |
|
368 | - ?> |
|
366 | + // If the Addon is unlicensed, show the upgrade button |
|
367 | + if ( ! $is_licensed ) { |
|
368 | + ?> |
|
369 | 369 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
370 | 370 | <div class="interior"> |
371 | 371 | <div class="monsterinsights-addon-upgrade"> |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | </div> |
378 | 378 | </div> |
379 | 379 | <?php |
380 | - } else { |
|
381 | - // Addon is licensed |
|
382 | - |
|
383 | - // If the plugin is not installed, display an install message and button. |
|
384 | - if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
385 | - if ( empty( $addon->url ) ) { |
|
386 | - $addon->url = ''; |
|
387 | - } |
|
388 | - ?> |
|
380 | + } else { |
|
381 | + // Addon is licensed |
|
382 | + |
|
383 | + // If the plugin is not installed, display an install message and button. |
|
384 | + if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
385 | + if ( empty( $addon->url ) ) { |
|
386 | + $addon->url = ''; |
|
387 | + } |
|
388 | + ?> |
|
389 | 389 | <div class="monsterinsights-addon-not-installed monsterinsights-addon-message"> |
390 | 390 | <div class="interior"> |
391 | 391 | <?php if ( monsterinsights_is_pro_version() ) { ?> |
@@ -408,22 +408,22 @@ discard block |
||
408 | 408 | </div> |
409 | 409 | </div> |
410 | 410 | <?php |
411 | - } else { |
|
412 | - // Plugin is installed. |
|
411 | + } else { |
|
412 | + // Plugin is installed. |
|
413 | 413 | |
414 | - $active = false; |
|
415 | - $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
416 | - $ss_active = is_plugin_active( $plugin_basename ); |
|
417 | - |
|
418 | - if ( is_multisite() && is_network_admin() ) { |
|
419 | - $active = is_plugin_active_for_network( $plugin_basename ); |
|
420 | - } else { |
|
421 | - $active = is_plugin_active( $plugin_basename ); |
|
422 | - } |
|
423 | - |
|
424 | - if ( $active ) { |
|
425 | - // Plugin is active. Display the active message and deactivate button. |
|
426 | - ?> |
|
414 | + $active = false; |
|
415 | + $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
416 | + $ss_active = is_plugin_active( $plugin_basename ); |
|
417 | + |
|
418 | + if ( is_multisite() && is_network_admin() ) { |
|
419 | + $active = is_plugin_active_for_network( $plugin_basename ); |
|
420 | + } else { |
|
421 | + $active = is_plugin_active( $plugin_basename ); |
|
422 | + } |
|
423 | + |
|
424 | + if ( $active ) { |
|
425 | + // Plugin is active. Display the active message and deactivate button. |
|
426 | + ?> |
|
427 | 427 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
428 | 428 | <div class="interior"> |
429 | 429 | <?php if ( $ms_active ) { ?> |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | </div> |
450 | 450 | </div> |
451 | 451 | <?php |
452 | - } else { |
|
453 | - // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
454 | - ?> |
|
452 | + } else { |
|
453 | + // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
454 | + ?> |
|
455 | 455 | <div class="monsterinsights-addon-inactive monsterinsights-addon-message"> |
456 | 456 | <div class="interior"> |
457 | 457 | <?php if ( $ms_active ) { ?> |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | </div> |
475 | 475 | </div> |
476 | 476 | <?php |
477 | - } |
|
478 | - } |
|
479 | - } |
|
480 | - ?> |
|
477 | + } |
|
478 | + } |
|
479 | + } |
|
480 | + ?> |
|
481 | 481 | </div> |
482 | 482 | <?php |
483 | 483 | } |
484 | 484 | \ No newline at end of file |