@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $internal_label = esc_js( $internal_label ); |
91 | 91 | |
92 | 92 | // Get inbound as outbound to track |
93 | - $inbound_paths = monsterinsights_get_option( 'track_internal_as_outbound','' ); |
|
93 | + $inbound_paths = monsterinsights_get_option( 'track_internal_as_outbound', '' ); |
|
94 | 94 | $inbound_paths = explode( ',', $inbound_paths ); |
95 | 95 | if ( ! is_array( $inbound_paths ) ) { |
96 | 96 | $inbound_paths = array( $inbound_paths ); |
97 | 97 | } |
98 | 98 | $i = 0; |
99 | - foreach ( $inbound_paths as $path ){ |
|
100 | - $inbound_paths[ $i ] = esc_js( trim( $path ) ); |
|
99 | + foreach ( $inbound_paths as $path ) { |
|
100 | + $inbound_paths[$i] = esc_js( trim( $path ) ); |
|
101 | 101 | $i++; |
102 | 102 | } |
103 | 103 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | $download_extensions = array( $download_extensions ); |
111 | 111 | } |
112 | 112 | $i = 0; |
113 | - foreach( $download_extensions as $extension ){ |
|
114 | - $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
|
113 | + foreach ( $download_extensions as $extension ) { |
|
114 | + $download_extensions[$i] = esc_js( trim( $extension ) ); |
|
115 | 115 | $i++; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $download_extensions = implode( ",", $download_extensions ); |
119 | 119 | |
120 | - $is_debug_mode = monsterinsights_is_debug_mode(); |
|
120 | + $is_debug_mode = monsterinsights_is_debug_mode(); |
|
121 | 121 | if ( current_user_can( 'manage_options' ) && $is_debug_mode ) { |
122 | 122 | $is_debug_mode = 'true'; |
123 | 123 | } else { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $inbound_paths = array( $inbound_paths ); |
97 | 97 | } |
98 | 98 | $i = 0; |
99 | - foreach ( $inbound_paths as $path ){ |
|
99 | + foreach ( $inbound_paths as $path ) { |
|
100 | 100 | $inbound_paths[ $i ] = esc_js( trim( $path ) ); |
101 | 101 | $i++; |
102 | 102 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $download_extensions = array( $download_extensions ); |
111 | 111 | } |
112 | 112 | $i = 0; |
113 | - foreach( $download_extensions as $extension ){ |
|
113 | + foreach( $download_extensions as $extension ) { |
|
114 | 114 | $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
115 | 115 | $i++; |
116 | 116 | } |
@@ -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 |
@@ -52,7 +52,7 @@ |
||
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 | - <?php if ( monsterinsights_is_pro_version() ) { |
|
55 | + <?php if ( monsterinsights_is_pro_version() ) { |
|
56 | 56 | |
57 | 57 | $license_key = MonsterInsights()->license->get_network_license_key(); |
58 | 58 | $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
@@ -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 |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
50 | 50 | ?> |
51 | - <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
|
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> |
|
51 | + <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress' ); ?></h1> |
|
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() ) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | <form id="monsterinsights-google-authenticate" method="post"> |
113 | 113 | <?php if ( MonsterInsights()->auth->get_network_viewname() && MonsterInsights()->auth->get_network_ua() ) { ?> |
114 | 114 | <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_network_licensed() ) { ?> |
115 | - <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p> |
|
115 | + <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p> |
|
116 | 116 | <?php } else { ?> |
117 | 117 | <p><?php echo esc_html__( 'Profile Active: ', 'google-analytics-for-wordpress' ) . MonsterInsights()->auth->get_network_viewname(); ?></p> |
118 | 118 | <p><?php wp_nonce_field( 'monsterinsights-google-authenticated-nonce', 'monsterinsights-google-authenticated-nonce' ); ?> |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <?php } ?> |
123 | 123 | <?php } else { ?> |
124 | 124 | <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_network_licensed() ) { ?> |
125 | - <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p> |
|
125 | + <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p> |
|
126 | 126 | <?php } else { ?> |
127 | 127 | <?php wp_nonce_field( 'monsterinsights-google-authenticate-nonce', 'monsterinsights-google-authenticate-nonce' ); ?> |
128 | 128 | <?php submit_button( esc_html__( 'Authenticate with your Google account', 'google-analytics-for-wordpress' ), 'button-action', 'monsterinsights-google-authenticate-submit', false ); ?> |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | <?php if ( ! MonsterInsights()->auth->get_network_viewname() ) { |
137 | 137 | $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
138 | 138 | ?> |
139 | - <tr id="monsterinsights-google-ua-box" <?php echo (empty( $network_ua ) ? 'class="monsterinsights-hideme"' : ''); ?> > |
|
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"> |
142 | 142 | <label for="monsterinsights-google-ua"><?php esc_html_e( 'Network UA code', 'google-analytics-for-wordpress' ); ?></label> |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | </th> |
158 | 158 | <td> |
159 | 159 | <p> |
160 | - <?php echo sprintf( esc_html__( 'Already purchased an upgrade to MonsterInsights Pro? To unlock your Pro features and addons, %sfollow our upgrade guide%s to install MonsterInsights Pro.' ), '<a href="'. monsterinsights_get_url( 'network-settings-page', 'go-lite-pro-link', "https://www.monsterinsights.com/docs/go-lite-pro" ) .'">', '</a>' ); ?> |
|
160 | + <?php echo sprintf( esc_html__( 'Already purchased an upgrade to MonsterInsights Pro? To unlock your Pro features and addons, %sfollow our upgrade guide%s to install MonsterInsights Pro.' ), '<a href="' . monsterinsights_get_url( 'network-settings-page', 'go-lite-pro-link', "https://www.monsterinsights.com/docs/go-lite-pro" ) . '">', '</a>' ); ?> |
|
161 | 161 | </p> |
162 | 162 | <p> |
163 | - <?php echo sprintf( esc_html__( "Don't yet have a Pro license? %sVisit our website%s to upgrade and learn more about all the amazing features, expanded report and powerful addons you unlock when you go Pro." ), '<a href="'. monsterinsights_get_upgrade_link( 'network-settings-page', 'upgrade-to-pro-link' ) .'">', '</a>' ); ?> |
|
163 | + <?php echo sprintf( esc_html__( "Don't yet have a Pro license? %sVisit our website%s to upgrade and learn more about all the amazing features, expanded report and powerful addons you unlock when you go Pro." ), '<a href="' . monsterinsights_get_upgrade_link( 'network-settings-page', 'upgrade-to-pro-link' ) . '">', '</a>' ); ?> |
|
164 | 164 | </p> |
165 | 165 | </td> |
166 | 166 | </tr> |
@@ -19,32 +19,32 @@ discard block |
||
19 | 19 | global $admin_page_hooks; |
20 | 20 | |
21 | 21 | if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) { |
22 | - return false; |
|
22 | + return false; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $settings_page = false; |
26 | 26 | if ( ! empty( $admin_page_hooks['monsterinsights_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] ) { |
27 | - $settings_page = true; |
|
27 | + $settings_page = true; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( ! empty( $admin_page_hooks['monsterinsights_reports'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_reports'] ) { |
31 | - $settings_page = true; |
|
31 | + $settings_page = true; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | if ( $current_screen->id === 'toplevel_page_monsterinsights_settings' ) { |
35 | - $settings_page = true; |
|
35 | + $settings_page = true; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if ( $current_screen->id === 'insights_page_monsterinsights_settings' ) { |
39 | - $settings_page = true; |
|
39 | + $settings_page = true; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if ( $current_screen->id === 'insights_page_monsterinsights_tracking' ) { |
43 | - $settings_page = true; |
|
43 | + $settings_page = true; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'monsterinsights_network' ) !== false ) { |
47 | - $settings_page = true; |
|
47 | + $settings_page = true; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $settings_page; |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | function monsterinsights_save_general_settings_page() { |
107 | 107 | |
108 | 108 | if ( ! monsterinsights_is_settings_page() ) { |
109 | - return; |
|
109 | + return; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Check if user pressed the 'Update' button and nonce is valid |
113 | 113 | if ( ! isset( $_POST['monsterinsights-settings-submit'] ) ) { |
114 | - return; |
|
114 | + return; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | if ( ! wp_verify_nonce( $_POST['monsterinsights-settings-nonce'], 'monsterinsights-settings-nonce' ) ) { |
118 | - return; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
122 | - return; |
|
122 | + return; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if ( ! empty( $_POST['monsterinsights_settings_tab'] ) && $_POST['monsterinsights_settings_tab'] === 'general' ) { |
126 | - /** |
|
127 | - * Developer Alert: |
|
128 | - * |
|
129 | - * Per the README, this is considered an internal hook and should |
|
130 | - * not be used by other developers. This hook's behavior may be modified |
|
131 | - * or the hook may be removed at any time, without warning. |
|
132 | - */ |
|
133 | - do_action( 'monsterinsights_settings_save_general' ); |
|
126 | + /** |
|
127 | + * Developer Alert: |
|
128 | + * |
|
129 | + * Per the README, this is considered an internal hook and should |
|
130 | + * not be used by other developers. This hook's behavior may be modified |
|
131 | + * or the hook may be removed at any time, without warning. |
|
132 | + */ |
|
133 | + do_action( 'monsterinsights_settings_save_general' ); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | add_action( 'current_screen', 'monsterinsights_save_general_settings_page' ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | <?php echo esc_html__( 'General', 'google-analytics-for-wordpress' ); ?> |
80 | 80 | </a> |
81 | 81 | |
82 | - <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url('admin.php?page=monsterinsights_tracking#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-engagement');?>" title="<?php echo esc_attr( __( 'Tracking', 'google-analytics-for-wordpress' ) ); ?>"> |
|
82 | + <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url( 'admin.php?page=monsterinsights_tracking#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-engagement' ); ?>" title="<?php echo esc_attr( __( 'Tracking', 'google-analytics-for-wordpress' ) ); ?>"> |
|
83 | 83 | <?php echo esc_html__( 'Tracking', 'google-analytics-for-wordpress' ); ?> |
84 | 84 | </a> |
85 | 85 | </h1> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ob_start(); |
179 | 179 | ?> |
180 | 180 | <tr id="monsterinsights-input-<?php echo esc_attr( $option_class ); ?>"> |
181 | - <?php if ( !empty ( $title ) ) { ?> |
|
181 | + <?php if ( ! empty ( $title ) ) { ?> |
|
182 | 182 | <th scope="row"> |
183 | 183 | <label for="monsterinsights-<?php echo esc_attr( $option_class ); ?>"><?php echo $title; ?></label> |
184 | 184 | </th> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | <h1 id="monsterinsights-settings-page-main-nav" class="monsterinsights-main-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-pages"> |
39 | 39 | <a class="monsterinsights-main-nav-item monsterinsights-nav-item monsterinsights-spacing-item" href="#"> </a> |
40 | 40 | |
41 | - <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url('admin.php?page=monsterinsights_settings');?>" title="<?php echo esc_attr( __( 'General', 'google-analytics-for-wordpress' ) ); ?>"> |
|
41 | + <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url( 'admin.php?page=monsterinsights_settings' ); ?>" title="<?php echo esc_attr( __( 'General', 'google-analytics-for-wordpress' ) ); ?>"> |
|
42 | 42 | <?php echo esc_html__( 'General', 'google-analytics-for-wordpress' ); ?> |
43 | 43 | </a> |
44 | 44 |
@@ -35,54 +35,54 @@ |
||
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | 37 | switch( $cap ) { |
38 | - case 'monsterinsights_view_dashboard' : |
|
39 | - $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
38 | + case 'monsterinsights_view_dashboard' : |
|
39 | + $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
40 | 40 | |
41 | - $user_can_via_settings = false; |
|
42 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | - foreach ( $roles as $role ) { |
|
44 | - if ( is_string( $role ) ) { |
|
45 | - if ( user_can( $user_id, $role ) ) { |
|
46 | - $user_can_via_settings = true; |
|
47 | - break; |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | - if ( user_can( $user_id, $roles ) ) { |
|
53 | - $user_can_via_settings = true; |
|
54 | - } |
|
55 | - } |
|
41 | + $user_can_via_settings = false; |
|
42 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | + foreach ( $roles as $role ) { |
|
44 | + if ( is_string( $role ) ) { |
|
45 | + if ( user_can( $user_id, $role ) ) { |
|
46 | + $user_can_via_settings = true; |
|
47 | + break; |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | + if ( user_can( $user_id, $roles ) ) { |
|
53 | + $user_can_via_settings = true; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | - $caps = array(); |
|
59 | - } |
|
57 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | + $caps = array(); |
|
59 | + } |
|
60 | 60 | |
61 | - break; |
|
62 | - case 'monsterinsights_save_settings' : |
|
63 | - $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
61 | + break; |
|
62 | + case 'monsterinsights_save_settings' : |
|
63 | + $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
64 | 64 | |
65 | - $user_can_via_settings = false; |
|
66 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | - foreach ( $roles as $role ) { |
|
68 | - if ( is_string( $role ) ) { |
|
69 | - if ( user_can( $user_id, $role ) ) { |
|
70 | - $user_can_via_settings = true; |
|
71 | - break; |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | - if ( user_can( $user_id, $roles ) ) { |
|
77 | - $user_can_via_settings = true; |
|
78 | - } |
|
79 | - } |
|
65 | + $user_can_via_settings = false; |
|
66 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | + foreach ( $roles as $role ) { |
|
68 | + if ( is_string( $role ) ) { |
|
69 | + if ( user_can( $user_id, $role ) ) { |
|
70 | + $user_can_via_settings = true; |
|
71 | + break; |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | + if ( user_can( $user_id, $roles ) ) { |
|
77 | + $user_can_via_settings = true; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | - $caps = array(); |
|
83 | - } |
|
81 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | + $caps = array(); |
|
83 | + } |
|
84 | 84 | |
85 | - break; |
|
85 | + break; |
|
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | - switch( $cap ) { |
|
37 | + switch ( $cap ) { |
|
38 | 38 | case 'monsterinsights_view_dashboard' : |
39 | 39 | $roles = monsterinsights_get_option( 'view_reports', array() ); |
40 | 40 | |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
89 | -add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 ); |
|
90 | 89 | \ No newline at end of file |
90 | +add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 ); |
|
91 | 91 | \ No newline at end of file |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function add_report( $report = false ){ |
|
27 | + public function add_report( $report = false ) { |
|
28 | 28 | if ( empty( $report ) || ! is_object( $report ) ) { |
29 | 29 | return; |
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function add_report( $report = false ){ |
|
27 | + public function add_report( $report = false ) { |
|
28 | 28 | if ( empty( $report ) || ! is_object( $report ) ) { |
29 | 29 | return; |
30 | 30 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Let's get the HTML to output for a particular report. This is not the AJAX endpoint. Args can hold things (generally start/end date range) |
37 | - protected function get_report_html( $args = array() ) { |
|
37 | + protected function get_report_html( $args = array() ) { |
|
38 | 38 | /* Defined in the report class */ |
39 | 39 | // For ajax, args start, end, and data will be set with the data to use. Else call $this->get_data( array( 'default' => true ) ) |
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 | |
43 | - public function additional_data(){ |
|
43 | + public function additional_data() { |
|
44 | 44 | return array(); |
45 | 45 | } |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return monsterinsights_get_message( 'error', esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); |
55 | 55 | } |
56 | 56 | |
57 | - if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { |
|
57 | + if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { |
|
58 | 58 | if ( current_user_can( 'monsterinsights_save_settings' ) ) { |
59 | 59 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
60 | 60 | return monsterinsights_get_message( 'error', |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - if ( monsterinsights_is_pro_version() ){ |
|
72 | + if ( monsterinsights_is_pro_version() ) { |
|
73 | 73 | if ( ! MonsterInsights()->license->has_license() ) { |
74 | 74 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
75 | 75 | return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ),'<a href="' . $url . '">','</a>' ); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | if ( ! class_exists( 'MonsterInsightsDateTime' ) ) { |
352 | 352 | class MonsterInsightsDateTime extends DateTime { |
353 | 353 | public static function createFromFormat( $format, $time, $timezone = null ) { |
354 | - if ( ! $timezone ) { |
|
354 | + if ( ! $timezone ) { |
|
355 | 355 | $timezone = new DateTimeZone( date_default_timezone_get() ); |
356 | 356 | } |
357 | 357 | if ( version_compare( PHP_VERSION, '5.3', '>=' ) ) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 6.0.0 |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10 , 3 ); |
|
33 | + add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10, 3 ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Let's get the HTML to output for a particular report. This is not the AJAX endpoint. Args can hold things (generally start/end date range) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return ''; |
41 | 41 | } |
42 | 42 | |
43 | - public function additional_data(){ |
|
43 | + public function additional_data() { |
|
44 | 44 | return array(); |
45 | 45 | } |
46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function show_report( $args = array() ) { |
52 | 52 | |
53 | 53 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
54 | - return monsterinsights_get_message( 'error', esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); |
|
54 | + return monsterinsights_get_message( 'error', esc_html__( 'Access denied', 'google-analytics-for-wordpress' ) ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - if ( monsterinsights_is_pro_version() ){ |
|
72 | + if ( monsterinsights_is_pro_version() ) { |
|
73 | 73 | if ( ! MonsterInsights()->license->has_license() ) { |
74 | 74 | $url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
75 | - return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ),'<a href="' . $url . '">','</a>' ); |
|
75 | + return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); |
|
76 | 76 | } else if ( MonsterInsights()->license->license_has_error() ) { |
77 | 77 | return monsterinsights_get_message( 'error', $this->get_license_error() ); |
78 | 78 | } |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | return monsterinsights_get_message( 'error', $args['error'] ); |
108 | 108 | } |
109 | 109 | |
110 | - if ( empty( $args['data' ] ) || ! is_array( $args['data' ] ) ) { |
|
110 | + if ( empty( $args['data'] ) || ! is_array( $args['data'] ) ) { |
|
111 | 111 | if ( monsterinsights_is_pro_version() ) { |
112 | 112 | return ''; |
113 | 113 | } else { |
114 | 114 | // Try to get default data. |
115 | 115 | $args = $this->get_data( array( 'default' => true ) ); |
116 | - if ( empty( $args['data'] ) || is_array( $args['data' ] ) ) { |
|
116 | + if ( empty( $args['data'] ) || is_array( $args['data'] ) ) { |
|
117 | 117 | return monsterinsights_get_message( 'error', __( 'No data found', 'google-analytics-for-wordpress' ) ); |
118 | 118 | } |
119 | 119 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $start = ! empty( $args['start'] ) && $this->is_valid_date( $args['start'] ) ? $args['start'] : ''; |
150 | - $end = ! empty( $args['end'] ) && $this->is_valid_date( $args['end'] ) ? $args['end'] : ''; |
|
150 | + $end = ! empty( $args['end'] ) && $this->is_valid_date( $args['end'] ) ? $args['end'] : ''; |
|
151 | 151 | |
152 | 152 | if ( ! MonsterInsights()->license->license_can( $this->level ) ) { |
153 | 153 | return array( |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | $data = ! $site_auth && $ms_auth ? get_site_transient( $transient ) : get_transient( $transient ); |
203 | 203 | } |
204 | 204 | |
205 | - if ( ! empty( $data ) && |
|
206 | - ! empty( $data['expires'] ) && |
|
205 | + if ( ! empty( $data ) && |
|
206 | + ! empty( $data['expires'] ) && |
|
207 | 207 | $data['expires'] >= time() && |
208 | - ! empty( $data['data'] ) && |
|
209 | - ! empty( $data['p'] ) && |
|
208 | + ! empty( $data['data'] ) && |
|
209 | + ! empty( $data['p'] ) && |
|
210 | 210 | $data['p'] === $p |
211 | 211 | ) { |
212 | 212 | return array( |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // Nothing in cache, either not saved before, expired or mismatch. Let's grab from API |
219 | - $api_options = array( 'start' => $start, 'end' => $end); |
|
219 | + $api_options = array( 'start' => $start, 'end' => $end ); |
|
220 | 220 | if ( ! $site_auth && $ms_auth ) { |
221 | 221 | $api_options['network'] = true; |
222 | 222 | } |
223 | 223 | |
224 | - $api = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' ); |
|
224 | + $api = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' ); |
|
225 | 225 | |
226 | 226 | $additional_data = $this->additional_data(); |
227 | 227 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $api->set_additional_data( $additional_data ); |
230 | 230 | } |
231 | 231 | |
232 | - $ret = $api->request(); |
|
232 | + $ret = $api->request(); |
|
233 | 233 | //echo print_r( $ret['data']);wp_die(); |
234 | 234 | |
235 | 235 | if ( is_wp_error( $ret ) ) { |
@@ -290,44 +290,44 @@ discard block |
||
290 | 290 | // Is a valid date value |
291 | 291 | public function is_valid_date( $date = '' ) { |
292 | 292 | $d = MonsterInsightsDateTime::createFromFormat( 'Y-m-d', $date ); |
293 | - return $d && $d->format('Y-m-d') === $date; |
|
293 | + return $d && $d->format( 'Y-m-d' ) === $date; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
297 | 297 | * Do not use the functions below this. They are unused and are just here so people |
298 | 298 | * with out of date MonsterInsights addons won't get fatal errors. |
299 | 299 | */ |
300 | - protected function get_api_max_limit() {return 300;} |
|
301 | - protected function get_date_range() {return array();} |
|
300 | + protected function get_api_max_limit() {return 300; } |
|
301 | + protected function get_date_range() {return array(); } |
|
302 | 302 | |
303 | 303 | public function get_upsell_notice() { |
304 | 304 | $has_level = MonsterInsights()->license->get_license_type(); |
305 | 305 | $has_level = $has_level ? $has_level : 'lite'; |
306 | 306 | $message = sprintf( __( 'You currently have a %s level license, but this report requires at least a %s level license to view the %s. Please upgrade to view this report.', 'google-analytics-for-wordpress' ), $has_level, $this->level, $this->title ); |
307 | - ob_start();?> |
|
308 | - <div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name;?>-bg"> |
|
307 | + ob_start(); ?> |
|
308 | + <div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name; ?>-bg"> |
|
309 | 309 | <div class="monsterinsights-upsell-container"> |
310 | 310 | <div class="row justify-content-center"> |
311 | 311 | <div class="col-lg-10 col-lg-offset-1 align-self-center"> |
312 | 312 | <div class="monsterinsights-upsell-card"> |
313 | - <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/[email protected] 2x" alt=""> |
|
313 | + <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/[email protected] 2x" alt=""> |
|
314 | 314 | <div class="monsterinsights-upsell-card-card-content"> |
315 | - <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' );?></span> |
|
316 | - <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' );?></strong></p> |
|
315 | + <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' ); ?></span> |
|
316 | + <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' ); ?></strong></p> |
|
317 | 317 | <?php if ( monsterinsights_is_pro_version() ) { ?> |
318 | 318 | <p ><?php echo sprintf( esc_html__( "Hey there! It looks like you've got the %s license installed on your site. |
319 | - That's awesome! %s",'google-analytics-for-wordpress'), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
319 | + That's awesome! %s",'google-analytics-for-wordpress' ), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
320 | 320 | |
321 | - <p><?php echo sprintf( esc_html__( "Do you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with the %s level%s of our paid packages. You'll need to upgrade your license to get instant access.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<strong><a href="'. monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://monsterinsights.com/my-account/' ) .'">' . $this->level,'</a></strong>' ); ?></p> |
|
322 | - <p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.",'google-analytics-for-wordpress'), '<a href="'. monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://monsterinsights.com/my-account/' ) .'"><strong>','</strong></a>', '<a href="'. monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/' ) .'" style="text-decoration:underline !important">', '</a>' ); ?></p> |
|
323 | - <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p> |
|
321 | + <p><?php echo sprintf( esc_html__( "Do you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with the %s level%s of our paid packages. You'll need to upgrade your license to get instant access.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<strong><a href="' . monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://monsterinsights.com/my-account/' ) . '">' . $this->level, '</a></strong>' ); ?></p> |
|
322 | + <p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.", 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://monsterinsights.com/my-account/' ) . '"><strong>', '</strong></a>', '<a href="' . monsterinsights_get_url( 'reports-page', $this->name . '-report-upsell-license-link', 'https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/' ) . '" style="text-decoration:underline !important">', '</a>' ); ?></p> |
|
323 | + <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p> |
|
324 | 324 | <?php } else { ?> |
325 | 325 | <p><?php echo sprintf( esc_html__( "Hey there! %s It looks like you've got the free version of MonsterInsights installed on your site. |
326 | - That's awesome!",'google-analytics-for-wordpress'), '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
326 | + That's awesome!",'google-analytics-for-wordpress' ), '<span class="dashicons dashicons-smiley"></span>' ); ?></p> |
|
327 | 327 | |
328 | - <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<a href="'. monsterinsights_get_upgrade_link( 'reports-page', $this->name . '-report-upsell-license-link' ) .'">' . $this->level,'</a>' ); ?></p> |
|
329 | - <p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.",'google-analytics-for-wordpress'), '<a href="'. monsterinsights_get_upgrade_link( 'reports-page', $this->name . '-report-upsell-license-link' ) .'"><strong>', '</strong></a>','<a style="text-decoration:underline !important" href="'. monsterinsights_get_url( 'reports-page', $this->name . '-report-go-lite-pro-link', 'https://www.monsterinsights.com/docs/go-lite-pro/' ) .'">', '</a>' ); ?></p> |
|
330 | - <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p> |
|
328 | + <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<a href="' . monsterinsights_get_upgrade_link( 'reports-page', $this->name . '-report-upsell-license-link' ) . '">' . $this->level, '</a>' ); ?></p> |
|
329 | + <p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.", 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_upgrade_link( 'reports-page', $this->name . '-report-upsell-license-link' ) . '"><strong>', '</strong></a>', '<a style="text-decoration:underline !important" href="' . monsterinsights_get_url( 'reports-page', $this->name . '-report-go-lite-pro-link', 'https://www.monsterinsights.com/docs/go-lite-pro/' ) . '">', '</a>' ); ?></p> |
|
330 | + <p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p> |
|
331 | 331 | <?php } ?> |
332 | 332 | </div> |
333 | 333 | <div class="monsterinsights-upsell-card-action"> |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @return string |
366 | 366 | */ |
367 | 367 | public function get_addons_page_link() { |
368 | - $addons_url = add_query_arg( 'page', 'monsterinsights_addons', admin_url( 'admin.php' ) ); |
|
368 | + $addons_url = add_query_arg( 'page', 'monsterinsights_addons', admin_url( 'admin.php' ) ); |
|
369 | 369 | return sprintf( '<a href="%1$s">%2$s</a>', $addons_url, esc_html__( 'Visit addons page', 'google-analytics-for-wordpress' ) ); |
370 | 370 | } |
371 | 371 |
@@ -47,27 +47,27 @@ discard block |
||
47 | 47 | * @since 6.0.0 |
48 | 48 | */ |
49 | 49 | public function __construct() { |
50 | - add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
50 | + add_action( 'admin_init', array( $this, 'admin_init' ) ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function admin_init() { |
54 | - // Possibly verify the key. |
|
55 | - $this->maybe_verify_key(); |
|
56 | - |
|
57 | - // Add potential admin notices for actions around the admin. |
|
58 | - add_action( 'admin_notices', array( $this, 'monsterinsights_notices' ), 11 ); |
|
59 | - add_action( 'network_admin_notices', array( $this, 'monsterinsights_notices' ), 11 ); |
|
60 | - |
|
61 | - // Grab the license key. If it is not set (even after verification), return early. |
|
62 | - $this->key = is_network_admin() ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
63 | - if ( ! $this->key ) { |
|
64 | - return; |
|
65 | - } |
|
66 | - |
|
67 | - // Possibly handle validating, deactivating and refreshing license keys. |
|
68 | - $this->maybe_validate_key(); |
|
69 | - $this->maybe_deactivate_key(); |
|
70 | - $this->maybe_refresh_key(); |
|
54 | + // Possibly verify the key. |
|
55 | + $this->maybe_verify_key(); |
|
56 | + |
|
57 | + // Add potential admin notices for actions around the admin. |
|
58 | + add_action( 'admin_notices', array( $this, 'monsterinsights_notices' ), 11 ); |
|
59 | + add_action( 'network_admin_notices', array( $this, 'monsterinsights_notices' ), 11 ); |
|
60 | + |
|
61 | + // Grab the license key. If it is not set (even after verification), return early. |
|
62 | + $this->key = is_network_admin() ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key(); |
|
63 | + if ( ! $this->key ) { |
|
64 | + return; |
|
65 | + } |
|
66 | + |
|
67 | + // Possibly handle validating, deactivating and refreshing license keys. |
|
68 | + $this->maybe_validate_key(); |
|
69 | + $this->maybe_deactivate_key(); |
|
70 | + $this->maybe_refresh_key(); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function maybe_verify_key() { |
81 | 81 | |
82 | - if ( empty( $_POST['monsterinsights-license-key'] ) || strlen( $_POST['monsterinsights-license-key'] ) < 10 || empty( $_POST['monsterinsights-verify-submit'] ) ) { |
|
83 | - return; |
|
84 | - } |
|
82 | + if ( empty( $_POST['monsterinsights-license-key'] ) || strlen( $_POST['monsterinsights-license-key'] ) < 10 || empty( $_POST['monsterinsights-verify-submit'] ) ) { |
|
83 | + return; |
|
84 | + } |
|
85 | 85 | |
86 | - if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
87 | - return; |
|
88 | - } |
|
86 | + if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
87 | + return; |
|
88 | + } |
|
89 | 89 | |
90 | - if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
91 | - return; |
|
92 | - } |
|
90 | + if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
91 | + return; |
|
92 | + } |
|
93 | 93 | |
94 | - $this->verify_key(); |
|
94 | + $this->verify_key(); |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
@@ -102,32 +102,32 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function verify_key() { |
104 | 104 | |
105 | - // Perform a request to verify the key. |
|
106 | - $verify = $this->perform_remote_request( 'verify-key', array( 'tgm-updater-key' => trim( $_POST['monsterinsights-license-key'] ) ) ); |
|
107 | - |
|
108 | - // If it returns false, send back a generic error message and return. |
|
109 | - if ( ! $verify ) { |
|
110 | - $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
111 | - return; |
|
112 | - } |
|
113 | - |
|
114 | - // If an error is returned, set the error and return. |
|
115 | - if ( ! empty( $verify->error ) ) { |
|
116 | - $this->errors[] = $verify->error; |
|
117 | - return; |
|
118 | - } |
|
119 | - |
|
120 | - // Otherwise, our request has been done successfully. Update the option and set the success message. |
|
121 | - $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
122 | - $option['key'] = trim( $_POST['monsterinsights-license-key'] ); |
|
123 | - $option['type'] = isset( $verify->type ) ? $verify->type : $option['type']; |
|
124 | - $option['is_expired'] = false; |
|
125 | - $option['is_disabled'] = false; |
|
126 | - $option['is_invalid'] = false; |
|
127 | - $this->success[] = isset( $verify->success ) ? $verify->success : esc_html__( 'Congratulations! This site is now receiving automatic updates.', 'google-analytics-for-wordpress' ); |
|
128 | - is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
129 | - delete_transient( '_monsterinsights_addons' ); |
|
130 | - monsterinsights_get_addons_data( $option['key'] ); |
|
105 | + // Perform a request to verify the key. |
|
106 | + $verify = $this->perform_remote_request( 'verify-key', array( 'tgm-updater-key' => trim( $_POST['monsterinsights-license-key'] ) ) ); |
|
107 | + |
|
108 | + // If it returns false, send back a generic error message and return. |
|
109 | + if ( ! $verify ) { |
|
110 | + $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
111 | + return; |
|
112 | + } |
|
113 | + |
|
114 | + // If an error is returned, set the error and return. |
|
115 | + if ( ! empty( $verify->error ) ) { |
|
116 | + $this->errors[] = $verify->error; |
|
117 | + return; |
|
118 | + } |
|
119 | + |
|
120 | + // Otherwise, our request has been done successfully. Update the option and set the success message. |
|
121 | + $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
122 | + $option['key'] = trim( $_POST['monsterinsights-license-key'] ); |
|
123 | + $option['type'] = isset( $verify->type ) ? $verify->type : $option['type']; |
|
124 | + $option['is_expired'] = false; |
|
125 | + $option['is_disabled'] = false; |
|
126 | + $option['is_invalid'] = false; |
|
127 | + $this->success[] = isset( $verify->success ) ? $verify->success : esc_html__( 'Congratulations! This site is now receiving automatic updates.', 'google-analytics-for-wordpress' ); |
|
128 | + is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
129 | + delete_transient( '_monsterinsights_addons' ); |
|
130 | + monsterinsights_get_addons_data( $option['key'] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | * @return null Return early if the transient has not expired yet. |
139 | 139 | */ |
140 | 140 | public function maybe_validate_key() { |
141 | - $check = is_network_admin() ? MonsterInsights()->license->time_to_check_network_license() : MonsterInsights()->license->time_to_check_site_license(); |
|
142 | - if ( $check ) { |
|
143 | - $this->validate_key(); |
|
144 | - } |
|
141 | + $check = is_network_admin() ? MonsterInsights()->license->time_to_check_network_license() : MonsterInsights()->license->time_to_check_site_license(); |
|
142 | + if ( $check ) { |
|
143 | + $this->validate_key(); |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -153,58 +153,58 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function validate_key( $forced = false ) { |
155 | 155 | |
156 | - $validate = $this->perform_remote_request( 'validate-key', array( 'tgm-updater-key' => $this->key ) ); |
|
157 | - |
|
158 | - // If there was a basic API error in validation, only set the transient for 10 minutes before retrying. |
|
159 | - if ( ! $validate ) { |
|
160 | - // If forced, set contextual success message. |
|
161 | - if ( $forced ) { |
|
162 | - $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
163 | - } |
|
164 | - return; |
|
165 | - } |
|
166 | - |
|
167 | - $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
168 | - $option['is_expired'] = false; |
|
169 | - $option['is_disabled'] = false; |
|
170 | - $option['is_invalid'] = false; |
|
171 | - |
|
172 | - // If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license. |
|
173 | - if ( isset( $validate->key ) || isset( $validate->author ) ) { |
|
174 | - $option['is_invalid'] = true; |
|
175 | - is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
176 | - return; |
|
177 | - } |
|
178 | - |
|
179 | - // If the license has expired, set the transient and expired flag and return. |
|
180 | - if ( isset( $validate->expired ) ) { |
|
181 | - $option['is_expired'] = true; |
|
182 | - is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
183 | - return; |
|
184 | - } |
|
185 | - |
|
186 | - // If the license is disabled, set the transient and disabled flag and return. |
|
187 | - if ( isset( $validate->disabled ) ) { |
|
188 | - $option['is_disabled'] = true; |
|
189 | - is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
190 | - return; |
|
191 | - } |
|
192 | - |
|
193 | - // If forced, set contextual success message. |
|
194 | - if ( ( ! empty( $validate->key ) || ! empty( $this->key ) ) && $forced ) { |
|
195 | - $key = ! empty( $validate->key ) ? $validate->key : $this->key; |
|
196 | - delete_transient( '_monsterinsights_addons' ); |
|
197 | - monsterinsights_get_addons_data( $key ); |
|
198 | - $this->success[] = esc_html__( 'Congratulations! Your key has been refreshed successfully.', 'google-analytics-for-wordpress' ); |
|
199 | - } |
|
200 | - |
|
201 | - $option = array(); |
|
202 | - $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
203 | - $option['type'] = isset( $validate->type ) ? $validate->type : $option['type']; |
|
204 | - $option['is_expired'] = false; |
|
205 | - $option['is_disabled'] = false; |
|
206 | - $option['is_invalid'] = false; |
|
207 | - is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
156 | + $validate = $this->perform_remote_request( 'validate-key', array( 'tgm-updater-key' => $this->key ) ); |
|
157 | + |
|
158 | + // If there was a basic API error in validation, only set the transient for 10 minutes before retrying. |
|
159 | + if ( ! $validate ) { |
|
160 | + // If forced, set contextual success message. |
|
161 | + if ( $forced ) { |
|
162 | + $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
163 | + } |
|
164 | + return; |
|
165 | + } |
|
166 | + |
|
167 | + $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
168 | + $option['is_expired'] = false; |
|
169 | + $option['is_disabled'] = false; |
|
170 | + $option['is_invalid'] = false; |
|
171 | + |
|
172 | + // If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license. |
|
173 | + if ( isset( $validate->key ) || isset( $validate->author ) ) { |
|
174 | + $option['is_invalid'] = true; |
|
175 | + is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
176 | + return; |
|
177 | + } |
|
178 | + |
|
179 | + // If the license has expired, set the transient and expired flag and return. |
|
180 | + if ( isset( $validate->expired ) ) { |
|
181 | + $option['is_expired'] = true; |
|
182 | + is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
183 | + return; |
|
184 | + } |
|
185 | + |
|
186 | + // If the license is disabled, set the transient and disabled flag and return. |
|
187 | + if ( isset( $validate->disabled ) ) { |
|
188 | + $option['is_disabled'] = true; |
|
189 | + is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
190 | + return; |
|
191 | + } |
|
192 | + |
|
193 | + // If forced, set contextual success message. |
|
194 | + if ( ( ! empty( $validate->key ) || ! empty( $this->key ) ) && $forced ) { |
|
195 | + $key = ! empty( $validate->key ) ? $validate->key : $this->key; |
|
196 | + delete_transient( '_monsterinsights_addons' ); |
|
197 | + monsterinsights_get_addons_data( $key ); |
|
198 | + $this->success[] = esc_html__( 'Congratulations! Your key has been refreshed successfully.', 'google-analytics-for-wordpress' ); |
|
199 | + } |
|
200 | + |
|
201 | + $option = array(); |
|
202 | + $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license(); |
|
203 | + $option['type'] = isset( $validate->type ) ? $validate->type : $option['type']; |
|
204 | + $option['is_expired'] = false; |
|
205 | + $option['is_disabled'] = false; |
|
206 | + $option['is_invalid'] = false; |
|
207 | + is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -217,19 +217,19 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function maybe_deactivate_key() { |
219 | 219 | |
220 | - if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-deactivate-submit'] ) ) { |
|
221 | - return; |
|
222 | - } |
|
220 | + if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-deactivate-submit'] ) ) { |
|
221 | + return; |
|
222 | + } |
|
223 | 223 | |
224 | - if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
225 | - return; |
|
226 | - } |
|
224 | + if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
225 | + return; |
|
226 | + } |
|
227 | 227 | |
228 | - if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
229 | - return; |
|
230 | - } |
|
228 | + if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
229 | + return; |
|
230 | + } |
|
231 | 231 | |
232 | - $this->deactivate_key(); |
|
232 | + $this->deactivate_key(); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -240,24 +240,24 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function deactivate_key() { |
242 | 242 | |
243 | - // Perform a request to deactivate the key. |
|
244 | - $deactivate = $this->perform_remote_request( 'deactivate-key', array( 'tgm-updater-key' => $_POST['monsterinsights-license-key'] ) ); |
|
243 | + // Perform a request to deactivate the key. |
|
244 | + $deactivate = $this->perform_remote_request( 'deactivate-key', array( 'tgm-updater-key' => $_POST['monsterinsights-license-key'] ) ); |
|
245 | 245 | |
246 | - // If it returns false, send back a generic error message and return. |
|
247 | - if ( ! $deactivate ) { |
|
248 | - $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
249 | - return; |
|
250 | - } |
|
246 | + // If it returns false, send back a generic error message and return. |
|
247 | + if ( ! $deactivate ) { |
|
248 | + $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' ); |
|
249 | + return; |
|
250 | + } |
|
251 | 251 | |
252 | - // If an error is returned, set the error and return. |
|
253 | - if ( ! empty( $deactivate->error ) && ! monsterinsights_is_debug_mode() ) { |
|
254 | - $this->errors[] = $deactivate->error; |
|
255 | - return; |
|
256 | - } |
|
252 | + // If an error is returned, set the error and return. |
|
253 | + if ( ! empty( $deactivate->error ) && ! monsterinsights_is_debug_mode() ) { |
|
254 | + $this->errors[] = $deactivate->error; |
|
255 | + return; |
|
256 | + } |
|
257 | 257 | |
258 | - // Otherwise, our request has been done successfully. Reset the option and set the success message. |
|
259 | - $this->success[] = isset( $deactivate->success ) ? $deactivate->success : esc_html__( 'Congratulations! You have deactivated the key from this site successfully.', 'google-analytics-for-wordpress' ); |
|
260 | - is_network_admin() ? MonsterInsights()->license->delete_network_license() : MonsterInsights()->license->delete_site_license(); |
|
258 | + // Otherwise, our request has been done successfully. Reset the option and set the success message. |
|
259 | + $this->success[] = isset( $deactivate->success ) ? $deactivate->success : esc_html__( 'Congratulations! You have deactivated the key from this site successfully.', 'google-analytics-for-wordpress' ); |
|
260 | + is_network_admin() ? MonsterInsights()->license->delete_network_license() : MonsterInsights()->license->delete_site_license(); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | |
@@ -270,20 +270,20 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function maybe_refresh_key() { |
272 | 272 | |
273 | - if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-refresh-submit'] ) ) { |
|
274 | - return; |
|
275 | - } |
|
273 | + if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-refresh-submit'] ) ) { |
|
274 | + return; |
|
275 | + } |
|
276 | 276 | |
277 | - if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
278 | - return; |
|
279 | - } |
|
277 | + if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) { |
|
278 | + return; |
|
279 | + } |
|
280 | 280 | |
281 | - if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
282 | - return; |
|
283 | - } |
|
281 | + if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
|
282 | + return; |
|
283 | + } |
|
284 | 284 | |
285 | - // Refreshing is simply a word alias for validating a key. Force true to set contextual messages. |
|
286 | - $this->validate_key( true ); |
|
285 | + // Refreshing is simply a word alias for validating a key. Force true to set contextual messages. |
|
286 | + $this->validate_key( true ); |
|
287 | 287 | |
288 | 288 | } |
289 | 289 | |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | * @since 7.0.0 |
294 | 294 | */ |
295 | 295 | public function monsterinsights_notices() { |
296 | - if ( ! monsterinsights_is_pro_version() ) { |
|
297 | - return; |
|
298 | - } |
|
296 | + if ( ! monsterinsights_is_pro_version() ) { |
|
297 | + return; |
|
298 | + } |
|
299 | 299 | |
300 | - $screen = get_current_screen(); |
|
301 | - if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
|
302 | - return; |
|
303 | - } |
|
300 | + $screen = get_current_screen(); |
|
301 | + if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { |
|
302 | + return; |
|
303 | + } |
|
304 | 304 | |
305 | - if ( ! empty( $this->errors ) ) { ?> |
|
305 | + if ( ! empty( $this->errors ) ) { ?> |
|
306 | 306 | <div class="error"> |
307 | 307 | <p><?php echo implode( '<br>', $this->errors ); ?></p> |
308 | 308 | </div> |
@@ -326,46 +326,46 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function perform_remote_request( $action, $body = array(), $headers = array(), $return_format = 'json' ) { |
328 | 328 | |
329 | - // Build the body of the request. |
|
330 | - $body = wp_parse_args( |
|
331 | - $body, |
|
332 | - array( |
|
333 | - 'tgm-updater-action' => $action, |
|
334 | - 'tgm-updater-key' => $this->key, |
|
335 | - 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
336 | - 'tgm-updater-referer' => site_url(), |
|
337 | - 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
338 | - 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
339 | - ) |
|
340 | - ); |
|
341 | - $body = http_build_query( $body, '', '&' ); |
|
342 | - |
|
343 | - // Build the headers of the request. |
|
344 | - $headers = wp_parse_args( |
|
345 | - $headers, |
|
346 | - array( |
|
347 | - 'Content-Type' => 'application/x-www-form-urlencoded', |
|
348 | - 'Content-Length' => strlen( $body ) |
|
349 | - ) |
|
350 | - ); |
|
351 | - |
|
352 | - // Setup variable for wp_remote_post. |
|
353 | - $post = array( |
|
354 | - 'headers' => $headers, |
|
355 | - 'body' => $body |
|
356 | - ); |
|
357 | - |
|
358 | - // Perform the query and retrieve the response. |
|
359 | - $response = wp_remote_post( monsterinsights_get_licensing_url(), $post ); |
|
360 | - $response_code = wp_remote_retrieve_response_code( $response ); |
|
361 | - $response_body = wp_remote_retrieve_body( $response ); |
|
362 | - |
|
363 | - // Bail out early if there are any errors. |
|
364 | - if ( 200 != $response_code || is_wp_error( $response_body ) ) { |
|
365 | - return false; |
|
366 | - } |
|
367 | - |
|
368 | - // Return the json decoded content. |
|
369 | - return json_decode( $response_body ); |
|
329 | + // Build the body of the request. |
|
330 | + $body = wp_parse_args( |
|
331 | + $body, |
|
332 | + array( |
|
333 | + 'tgm-updater-action' => $action, |
|
334 | + 'tgm-updater-key' => $this->key, |
|
335 | + 'tgm-updater-wp-version' => get_bloginfo( 'version' ), |
|
336 | + 'tgm-updater-referer' => site_url(), |
|
337 | + 'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION, |
|
338 | + 'tgm-updater-is-pro' => monsterinsights_is_pro_version(), |
|
339 | + ) |
|
340 | + ); |
|
341 | + $body = http_build_query( $body, '', '&' ); |
|
342 | + |
|
343 | + // Build the headers of the request. |
|
344 | + $headers = wp_parse_args( |
|
345 | + $headers, |
|
346 | + array( |
|
347 | + 'Content-Type' => 'application/x-www-form-urlencoded', |
|
348 | + 'Content-Length' => strlen( $body ) |
|
349 | + ) |
|
350 | + ); |
|
351 | + |
|
352 | + // Setup variable for wp_remote_post. |
|
353 | + $post = array( |
|
354 | + 'headers' => $headers, |
|
355 | + 'body' => $body |
|
356 | + ); |
|
357 | + |
|
358 | + // Perform the query and retrieve the response. |
|
359 | + $response = wp_remote_post( monsterinsights_get_licensing_url(), $post ); |
|
360 | + $response_code = wp_remote_retrieve_response_code( $response ); |
|
361 | + $response_body = wp_remote_retrieve_body( $response ); |
|
362 | + |
|
363 | + // Bail out early if there are any errors. |
|
364 | + if ( 200 != $response_code || is_wp_error( $response_body ) ) { |
|
365 | + return false; |
|
366 | + } |
|
367 | + |
|
368 | + // Return the json decoded content. |
|
369 | + return json_decode( $response_body ); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | \ No newline at end of file |
@@ -171,14 +171,14 @@ |
||
171 | 171 | |
172 | 172 | // If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license. |
173 | 173 | if ( isset( $validate->key ) || isset( $validate->author ) ) { |
174 | - $option['is_invalid'] = true; |
|
174 | + $option['is_invalid'] = true; |
|
175 | 175 | is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
176 | 176 | return; |
177 | 177 | } |
178 | 178 | |
179 | 179 | // If the license has expired, set the transient and expired flag and return. |
180 | 180 | if ( isset( $validate->expired ) ) { |
181 | - $option['is_expired'] = true; |
|
181 | + $option['is_expired'] = true; |
|
182 | 182 | is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option ); |
183 | 183 | return; |
184 | 184 | } |