@@ -33,24 +33,24 @@ discard block |
||
33 | 33 | $hook = 'monsterinsights_settings'; |
34 | 34 | |
35 | 35 | if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { |
36 | - // If dashboards disabled, first settings page |
|
37 | - add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' ); |
|
38 | - $hook = 'monsterinsights_settings'; |
|
36 | + // If dashboards disabled, first settings page |
|
37 | + add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' ); |
|
38 | + $hook = 'monsterinsights_settings'; |
|
39 | 39 | |
40 | - add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
41 | - add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' ); |
|
40 | + add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); |
|
41 | + add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' ); |
|
42 | 42 | } else { |
43 | - // if dashboards enabled, first dashboard |
|
44 | - add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' ); |
|
43 | + // if dashboards enabled, first dashboard |
|
44 | + add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' ); |
|
45 | 45 | |
46 | - $hook = 'monsterinsights_reports'; |
|
46 | + $hook = 'monsterinsights_reports'; |
|
47 | 47 | |
48 | - add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
48 | + add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); |
|
49 | 49 | |
50 | - // then settings page |
|
51 | - add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
50 | + // then settings page |
|
51 | + add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); |
|
52 | 52 | |
53 | - add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' ); |
|
53 | + add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' ); |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // then addons |
61 | 61 | $network_key = MonsterInsights()->license->get_network_license_key(); |
62 | 62 | if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) { |
63 | - add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' ); |
|
63 | + add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' ); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | add_action( 'admin_menu', 'monsterinsights_admin_menu' ); |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | // First, let's see if this is an MS network enabled plugin. If it is, we should load the license |
75 | 75 | // menu page and the updater on the network panel |
76 | 76 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
77 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
77 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE ); |
81 | 81 | if ( ! is_plugin_active_for_network( $plugin ) ) { |
82 | - return; |
|
82 | + return; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $hook = 'monsterinsights_network'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | function monsterinsights_add_admin_body_class( $classes ) { |
104 | 104 | $screen = get_current_screen(); |
105 | 105 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
106 | - return $classes; |
|
106 | + return $classes; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return "$classes monsterinsights_page "; |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | |
124 | 124 | // If lite, show a link where they can get pro from |
125 | 125 | if ( ! monsterinsights_is_pro_version() ) { |
126 | - $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
127 | - array_unshift( $links, $get_pro ); |
|
126 | + $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>'; |
|
127 | + array_unshift( $links, $get_pro ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // If Lite, support goes to forum. If pro, it goes to our website |
131 | 131 | if ( monsterinsights_is_pro_version() ) { |
132 | - $support = '<a title="MonsterInsights Pro Support" href="https://www.monsterinsights.com/my-account/support/">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
133 | - array_unshift( $links, $support ); |
|
132 | + $support = '<a title="MonsterInsights Pro Support" href="https://www.monsterinsights.com/my-account/support/">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
133 | + array_unshift( $links, $support ); |
|
134 | 134 | } else { |
135 | - $support = '<a title="MonsterInsights Lite Support" href="https://wordpress.org/support/plugin/google-analytics-for-wordpress">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
136 | - array_unshift( $links, $support ); |
|
135 | + $support = '<a title="MonsterInsights Lite Support" href="https://wordpress.org/support/plugin/google-analytics-for-wordpress">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>'; |
|
136 | + array_unshift( $links, $support ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>'; |
@@ -158,26 +158,26 @@ discard block |
||
158 | 158 | function monsterinsights_load_admin_partial( $template, $data = array() ) { |
159 | 159 | |
160 | 160 | if ( monsterinsights_is_pro_version() ) { |
161 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
161 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' ); |
|
162 | 162 | |
163 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
164 | - require_once( $dir . $template . '.php' ); |
|
165 | - return true; |
|
166 | - } |
|
163 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
164 | + require_once( $dir . $template . '.php' ); |
|
165 | + return true; |
|
166 | + } |
|
167 | 167 | } else { |
168 | - $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
168 | + $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' ); |
|
169 | 169 | |
170 | - if ( file_exists( $dir . $template . '.php' ) ) { |
|
171 | - require_once( $dir . $template . '.php' ); |
|
172 | - return true; |
|
173 | - } |
|
170 | + if ( file_exists( $dir . $template . '.php' ) ) { |
|
171 | + require_once( $dir . $template . '.php' ); |
|
172 | + return true; |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' ); |
177 | 177 | |
178 | 178 | if ( file_exists( $dir . $template . '.php' ) ) { |
179 | - require_once( $dir . $template . '.php' ); |
|
180 | - return true; |
|
179 | + require_once( $dir . $template . '.php' ); |
|
180 | + return true; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return false; |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | // Get the current screen, and check whether we're viewing a MonsterInsights screen; |
194 | 194 | $screen = get_current_screen(); |
195 | 195 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
196 | - return; |
|
196 | + return; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | // If here, we're on an MonsterInsights screen, so output the header. |
200 | 200 | monsterinsights_load_admin_partial( 'header', array( |
201 | - 'mascot' => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ), |
|
202 | - 'logo' => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ), |
|
203 | - '2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
204 | - '2xlogo' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
201 | + 'mascot' => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ), |
|
202 | + 'logo' => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ), |
|
203 | + '2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
204 | + '2xlogo' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ), |
|
205 | 205 | ) ); |
206 | 206 | } |
207 | 207 | add_action( 'in_admin_header','monsterinsights_admin_header', 100 ); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | function monsterinsights_welcome_redirect() { |
210 | 210 | // Bail if no activation redirect |
211 | 211 | if ( ! get_transient( '_monsterinsights_activation_redirect' ) ) { |
212 | - return; |
|
212 | + return; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | // Delete the redirect transient |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | |
218 | 218 | // Bail if activating from network, or bulk |
219 | 219 | if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
220 | - return; |
|
220 | + return; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $upgrade = get_option( 'monsterinsights_version_upgraded_from' ); |
224 | 224 | if( ! $upgrade ) { // First time install |
225 | - //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit; |
|
225 | + //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit; |
|
226 | 226 | } else { // Update |
227 | - return; |
|
228 | - //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit; |
|
227 | + return; |
|
228 | + //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | //add_action( 'admin_init', 'monsterinsights_welcome_redirect', 11 ); @todo: Investigate |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | function monsterinsights_admin_footer( $text ) { |
242 | 242 | global $current_screen; |
243 | 243 | if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) { |
244 | - $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
245 | - $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer">★★★★★</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
244 | + $url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5'; |
|
245 | + $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer">★★★★★</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' ); |
|
246 | 246 | } |
247 | 247 | return $text; |
248 | 248 | } |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | // Don't show on MonsterInsights pages |
254 | 254 | $screen = get_current_screen(); |
255 | 255 | if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) { |
256 | - return; |
|
256 | + return; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | // Make sure they have the permissions to do something |
260 | 260 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
261 | - return; |
|
261 | + return; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Priority: |
@@ -271,45 +271,45 @@ discard block |
||
271 | 271 | |
272 | 272 | // 1. Google Analytics not authenticated |
273 | 273 | if ( ! is_network_admin() && ! monsterinsights_get_ua() ) { |
274 | - $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
275 | - $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
276 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
277 | - return; |
|
274 | + $page = admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
275 | + $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' ); |
|
276 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
277 | + return; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // 2. License key not entered for pro |
281 | 281 | $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : ''; |
282 | 282 | if ( monsterinsights_is_pro_version() && empty( $key ) ) { |
283 | - $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
284 | - $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
285 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
286 | - return; |
|
283 | + $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
284 | + $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' ); |
|
285 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
286 | + return; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // 3. License key not valid/okay for pro |
290 | 290 | if ( monsterinsights_is_pro_version() ) { |
291 | - $message = ''; |
|
292 | - if ( MonsterInsights()->license->get_site_license_key() ){ |
|
293 | - if ( MonsterInsights()->license->site_license_expired() ) { |
|
294 | - $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
295 | - } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
296 | - $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
297 | - } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
298 | - $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
299 | - } |
|
300 | - } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
301 | - if ( MonsterInsights()->license->network_license_expired() ) { |
|
302 | - $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
303 | - } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
304 | - $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
305 | - } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
306 | - $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
307 | - } |
|
308 | - } |
|
309 | - if ( ! empty( $message ) ) { |
|
310 | - echo '<div class="error"><p>'. $message.'</p></div>'; |
|
311 | - return; |
|
312 | - } |
|
291 | + $message = ''; |
|
292 | + if ( MonsterInsights()->license->get_site_license_key() ){ |
|
293 | + if ( MonsterInsights()->license->site_license_expired() ) { |
|
294 | + $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
295 | + } else if ( MonsterInsights()->license->site_license_disabled() ) { |
|
296 | + $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
297 | + } else if ( MonsterInsights()->license->site_license_invalid() ) { |
|
298 | + $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
299 | + } |
|
300 | + } else if ( MonsterInsights()->license->get_network_license_key() ) { |
|
301 | + if ( MonsterInsights()->license->network_license_expired() ) { |
|
302 | + $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
|
303 | + } else if ( MonsterInsights()->license->network_license_disabled() ) { |
|
304 | + $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
305 | + } else if ( MonsterInsights()->license->network_license_invalid() ) { |
|
306 | + $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' ); |
|
307 | + } |
|
308 | + } |
|
309 | + if ( ! empty( $message ) ) { |
|
310 | + echo '<div class="error"><p>'. $message.'</p></div>'; |
|
311 | + return; |
|
312 | + } |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // 4. Optin setting not configured |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | $notices = get_option( 'monsterinsights_notices' ); |
341 | 341 | if ( ! is_array( $notices ) ) { |
342 | - $notices = array(); |
|
342 | + $notices = array(); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | // 5. Authenticate, not manual |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
348 | 348 | |
349 | 349 | if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { |
350 | - echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
351 | - echo '<p>'; |
|
352 | - echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
353 | - echo '</p>'; |
|
354 | - echo '</div>'; |
|
355 | - return; |
|
350 | + echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">'; |
|
351 | + echo '<p>'; |
|
352 | + echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); |
|
353 | + echo '</p>'; |
|
354 | + echo '</div>'; |
|
355 | + return; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | // 6. Automatic updates not configured |
@@ -372,64 +372,64 @@ discard block |
||
372 | 372 | |
373 | 373 | // 7. WooUpsell |
374 | 374 | if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) { |
375 | - if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
376 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
377 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
378 | - echo '<p><strong>'; |
|
379 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
380 | - echo '</strong></p>'; |
|
381 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
382 | - echo '<p>'; |
|
383 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
384 | - echo '</p>'; |
|
385 | - echo '<p>'; |
|
386 | - echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
387 | - echo '</p>'; |
|
388 | - echo '<p>'; |
|
389 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
390 | - echo '</p>'; |
|
391 | - echo '<p>'; |
|
392 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
393 | - echo '</p>'; |
|
394 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=woocommercelite">', ' »</a>' ); |
|
395 | - echo '</p>'; |
|
396 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
397 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
398 | - echo '</div>'; |
|
399 | - echo '</div>'; |
|
400 | - return; |
|
401 | - } |
|
375 | + if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { |
|
376 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">'; |
|
377 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
378 | + echo '<p><strong>'; |
|
379 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' ); |
|
380 | + echo '</strong></p>'; |
|
381 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
382 | + echo '<p>'; |
|
383 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
384 | + echo '</p>'; |
|
385 | + echo '<p>'; |
|
386 | + echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
387 | + echo '</p>'; |
|
388 | + echo '<p>'; |
|
389 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
390 | + echo '</p>'; |
|
391 | + echo '<p>'; |
|
392 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
393 | + echo '</p>'; |
|
394 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=woocommercelite">', ' »</a>' ); |
|
395 | + echo '</p>'; |
|
396 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
397 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
398 | + echo '</div>'; |
|
399 | + echo '</div>'; |
|
400 | + return; |
|
401 | + } |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | // 8. EDDUpsell |
405 | 405 | if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) { |
406 | - if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
407 | - echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
408 | - echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
409 | - echo '<p><strong>'; |
|
410 | - echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
411 | - echo '</strong></p>'; |
|
412 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
413 | - echo '<p>'; |
|
414 | - echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
415 | - echo '</p>'; |
|
416 | - echo '<p>'; |
|
417 | - echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
418 | - echo '</p>'; |
|
419 | - echo '<p>'; |
|
420 | - echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
421 | - echo '</p>'; |
|
422 | - echo '<p>'; |
|
423 | - echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
424 | - echo '</p>'; |
|
425 | - echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=eddlite">', ' »</a>' ); |
|
426 | - echo '</p>'; |
|
427 | - echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
428 | - echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
429 | - echo '</div>'; |
|
430 | - echo '</div>'; |
|
431 | - return; |
|
432 | - } |
|
406 | + if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { |
|
407 | + echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">'; |
|
408 | + echo '<div class="monsterinsights-wooedd-upsell-left">'; |
|
409 | + echo '<p><strong>'; |
|
410 | + echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' ); |
|
411 | + echo '</strong></p>'; |
|
412 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
413 | + echo '<p>'; |
|
414 | + echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' ); |
|
415 | + echo '</p>'; |
|
416 | + echo '<p>'; |
|
417 | + echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' ); |
|
418 | + echo '</p>'; |
|
419 | + echo '<p>'; |
|
420 | + echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' ); |
|
421 | + echo '</p>'; |
|
422 | + echo '<p>'; |
|
423 | + echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' ); |
|
424 | + echo '</p>'; |
|
425 | + echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=eddlite">', ' »</a>' ); |
|
426 | + echo '</p>'; |
|
427 | + echo '</div><div class="monsterinsights-wooedd-upsell-right">'; |
|
428 | + echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">'; |
|
429 | + echo '</div>'; |
|
430 | + echo '</div>'; |
|
431 | + return; |
|
432 | + } |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' ); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | // AM Notices |
440 | 440 | function monsterinsights_am_notice_optout( $super_admin ) { |
441 | 441 | if ( monsterinsights_get_option( 'hide_am_notices', false ) || monsterinsights_get_option( 'network_hide_am_notices', false ) ) { |
442 | - return false; |
|
442 | + return false; |
|
443 | 443 | } |
444 | 444 | return $super_admin; |
445 | 445 | } |
@@ -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_is_pro_version() && ! 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 |
@@ -38,28 +38,28 @@ discard block |
||
38 | 38 | <div id="monsterinsights-main-tab-general" class="monsterinsights-main-nav-tab monsterinsights-nav-tab monsterinsights-active"> |
39 | 39 | <div id="monsterinsights-network-settings-general"> |
40 | 40 | <?php |
41 | - // Output any notices now |
|
42 | - /** |
|
43 | - * Developer Alert: |
|
44 | - * |
|
45 | - * Per the README, this is considered an internal hook and should |
|
46 | - * not be used by other developers. This hook's behavior may be modified |
|
47 | - * or the hook may be removed at any time, without warning. |
|
48 | - */ |
|
49 | - do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
50 | - ?> |
|
41 | + // Output any notices now |
|
42 | + /** |
|
43 | + * Developer Alert: |
|
44 | + * |
|
45 | + * Per the README, this is considered an internal hook and should |
|
46 | + * not be used by other developers. This hook's behavior may be modified |
|
47 | + * or the hook may be removed at any time, without warning. |
|
48 | + */ |
|
49 | + do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
50 | + ?> |
|
51 | 51 | <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
52 | 52 | <p><?php esc_html_e( 'Activate your MonsterInsights license key on this panel to hide the license key settings and addon pages for subsites.', 'google-analytics-for-wordpress'); ?></p> |
53 | 53 | <table class="form-table"> |
54 | 54 | <tbody> |
55 | 55 | <?php if ( monsterinsights_is_pro_version() ) { |
56 | 56 | |
57 | - $license_key = MonsterInsights()->license->get_network_license_key(); |
|
58 | - $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
|
57 | + $license_key = MonsterInsights()->license->get_network_license_key(); |
|
58 | + $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
|
59 | 59 | |
60 | - $license_type = MonsterInsights()->license->get_network_license_type(); |
|
60 | + $license_type = MonsterInsights()->license->get_network_license_type(); |
|
61 | 61 | |
62 | - ?> |
|
62 | + ?> |
|
63 | 63 | <tr id="monsterinsights-settings-key-box"> |
64 | 64 | <th scope="row"> |
65 | 65 | <label for="monsterinsights-settings-key"><?php esc_html_e( 'License Key', 'google-analytics-for-wordpress' ); ?></label> |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </tr> |
135 | 135 | |
136 | 136 | <?php if ( ! MonsterInsights()->auth->get_network_viewname() ) { |
137 | - $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
|
138 | - ?> |
|
137 | + $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
|
138 | + ?> |
|
139 | 139 | <tr id="monsterinsights-google-ua-box" <?php echo (empty( $network_ua ) ? 'class="monsterinsights-hideme"' : ''); ?> > |
140 | 140 | <form id="monsterinsights-network-general-tab" method="post"> |
141 | 141 | <th scope="row"> |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | </tr> |
167 | 167 | <?php } ?> |
168 | 168 | <?php |
169 | - $title = esc_html__( 'Hide Announcements', 'google-analytics-for-wordpress' ); |
|
170 | - $description = esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.', 'google-analytics-for-wordpress' ); |
|
171 | - echo monsterinsights_make_checkbox( 'network_hide_am_notices', $title, $description ); |
|
172 | - ?> |
|
169 | + $title = esc_html__( 'Hide Announcements', 'google-analytics-for-wordpress' ); |
|
170 | + $description = esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.', 'google-analytics-for-wordpress' ); |
|
171 | + echo monsterinsights_make_checkbox( 'network_hide_am_notices', $title, $description ); |
|
172 | + ?> |
|
173 | 173 | </tbody> |
174 | 174 | </table> |
175 | 175 | </div> |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | |
192 | 192 | // Check if user pressed the 'Update' button and nonce is valid |
193 | 193 | if ( ! isset( $_POST['monsterinsights-network-settings-submit'] ) ) { |
194 | - return; |
|
194 | + return; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | if ( ! wp_verify_nonce( $_POST['monsterinsights-network-settings-nonce'], 'monsterinsights-network-settings-nonce' ) ) { |
198 | - return; |
|
198 | + return; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
202 | - return; |
|
202 | + return; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $throw_notice = false; |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | $manual_ua_code_old = MonsterInsights()->auth->get_network_manual_ua(); |
209 | 209 | |
210 | 210 | if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old === $manual_ua_code ) { |
211 | - // Same code we had before |
|
212 | - // Do nothing |
|
211 | + // Same code we had before |
|
212 | + // Do nothing |
|
213 | 213 | } else if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old !== $manual_ua_code ) { |
214 | - // Different UA code |
|
215 | - MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
214 | + // Different UA code |
|
215 | + MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
216 | 216 | } else if ( $manual_ua_code && empty( $manual_ua_code_old ) ) { |
217 | - // Move to manual |
|
218 | - MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
217 | + // Move to manual |
|
218 | + MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
219 | 219 | } else if ( empty( $manual_ua_code ) && $manual_ua_code_old ) { |
220 | - // Deleted manual |
|
221 | - MonsterInsights()->auth->delete_network_manual_ua(); |
|
220 | + // Deleted manual |
|
221 | + MonsterInsights()->auth->delete_network_manual_ua(); |
|
222 | 222 | } else if ( isset( $_POST['network_manual_ua_code'] ) && empty( $manual_ua_code ) ) { |
223 | - $throw_notice = true; |
|
223 | + $throw_notice = true; |
|
224 | 224 | } else { |
225 | - // Not UA before or after |
|
226 | - // Do nothing |
|
225 | + // Not UA before or after |
|
226 | + // Do nothing |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $network_hide_am_notices = isset( $_POST['network_hide_am_notices'] ) ? 1 : 0; |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | |
236 | 236 | // Output an admin notice so the user knows what happened |
237 | 237 | if ( $throw_notice ) { |
238 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
238 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
239 | 239 | } else { |
240 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
240 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | add_action( 'admin_init', 'monsterinsights_network_settings_save_general', 11 ); |
244 | 244 | \ No newline at end of file |