@@ -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 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * not be used by other developers. This hook's behavior may be modified |
39 | 39 | * or the hook may be removed at any time, without warning. |
40 | 40 | */ |
41 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
41 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
42 | 42 | return $reports; |
43 | 43 | } |
44 | 44 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | <div id="monsterinsights-main-tab-<?php echo esc_attr( $report->name ); ?>" class="monsterinsights-main-nav-tab monsterinsights-nav-tab"> |
91 | 91 | <div class="monsterinsights-reports-action-bar monsterinsights-clear"> |
92 | 92 | <div class="monsterinsights-reports-action-bar-title"> |
93 | - <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
93 | + <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
94 | 94 | </div> |
95 | 95 | <div class="monsterinsights-reports-action-bar-actions"><?php |
96 | 96 | /** |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | check_ajax_referer( 'mi-admin-nonce', 'security' ); |
133 | 133 | |
134 | 134 | // Get variables |
135 | - $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | - $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | - $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | - $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
135 | + $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | + $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | + $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | + $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
139 | 139 | |
140 | 140 | |
141 | 141 | // Current user can authenticate |
142 | 142 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
143 | - wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
143 | + wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Only for Pro users, require a license key to be entered first so we can link to things. |
151 | - if ( monsterinsights_is_pro_version() ) { |
|
151 | + if ( monsterinsights_is_pro_version() ) { |
|
152 | 152 | if ( ! MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->is_network_licensed() ) { |
153 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
153 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
154 | 154 | } else if ( MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->site_license_has_error() ) { |
155 | 155 | // good to go: site licensed |
156 | 156 | } else if ( MonsterInsights()->license->is_network_licensed() && ! MonsterInsights()->license->network_license_has_error() ) { |
157 | 157 | // good to go: network licensed |
158 | 158 | } else { |
159 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
159 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | $site_auth = MonsterInsights()->auth->get_viewname(); |
165 | 165 | $ms_auth = is_multisite() && MonsterInsights()->auth->get_network_viewname(); |
166 | 166 | if ( ! $site_auth && ! $ms_auth ) { |
167 | - wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
167 | + wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | if ( empty( $name ) ) { |
171 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
171 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $report = MonsterInsights()->reporting->get_report( $name ); |
175 | 175 | |
176 | 176 | if ( empty( $report ) ) { |
177 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
177 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
178 | 178 | } |
179 | 179 | |
180 | - $args = array( 'start' => $start, 'end' => $end ); |
|
180 | + $args = array( 'start' => $start, 'end' => $end ); |
|
181 | 181 | if ( $isnetwork ) { |
182 | 182 | $args['network'] = true; |
183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | 'success' => true |
192 | 192 | ) |
193 | 193 | ); |
194 | - wp_send_json_success( array( 'html' => $data ) ); |
|
194 | + wp_send_json_success( array( 'html' => $data ) ); |
|
195 | 195 | } else { |
196 | 196 | wp_send_json_error( array( 'message' => $data['error'] ) ); |
197 | 197 | } |
@@ -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 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
38 | 38 | } |
39 | 39 | |
40 | - public function get_tt(){ |
|
40 | + public function get_tt() { |
|
41 | 41 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
42 | 42 | if ( empty( $tt ) ) { |
43 | 43 | // if TT is empty, generate a new one, save it and then return it |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | return $tt; |
48 | 48 | } |
49 | 49 | |
50 | - public function rotate_tt(){ |
|
50 | + public function rotate_tt() { |
|
51 | 51 | $tt = $this->generate_tt(); |
52 | 52 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
53 | 53 | } |
54 | 54 | |
55 | - public function generate_tt(){ |
|
55 | + public function generate_tt() { |
|
56 | 56 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
57 | 57 | } |
58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return hash_equals( $tt, $passed_tt ); |
62 | 62 | } |
63 | 63 | |
64 | - public function maybe_authenticate(){ |
|
64 | + public function maybe_authenticate() { |
|
65 | 65 | |
66 | 66 | // Check nonce |
67 | 67 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - public function authenticate_listener(){ |
|
109 | + public function authenticate_listener() { |
|
110 | 110 | // Make sure it's for us |
111 | 111 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
112 | 112 | return; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | exit; |
176 | 176 | } |
177 | 177 | |
178 | - public function maybe_reauthenticate(){ |
|
178 | + public function maybe_reauthenticate() { |
|
179 | 179 | |
180 | 180 | // Check nonce |
181 | 181 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
223 | 223 | } |
224 | 224 | |
225 | - public function reauthenticate_listener(){ |
|
225 | + public function reauthenticate_listener() { |
|
226 | 226 | // Make sure it's for us |
227 | 227 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
228 | 228 | return; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | exit; |
291 | 291 | } |
292 | 292 | |
293 | - public function maybe_verify(){ |
|
293 | + public function maybe_verify() { |
|
294 | 294 | |
295 | 295 | // Check nonce |
296 | 296 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | - public function verify_auth( $credentials = array() ){ |
|
327 | + public function verify_auth( $credentials = array() ) { |
|
328 | 328 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
329 | 329 | |
330 | 330 | if ( empty( $creds['key'] ) ) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | - public function maybe_delete(){ |
|
344 | + public function maybe_delete() { |
|
345 | 345 | |
346 | 346 | // Check nonce |
347 | 347 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - public function delete_auth( $force = false ){ |
|
384 | + public function delete_auth( $force = false ) { |
|
385 | 385 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
386 | 386 | return false; |
387 | 387 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | public function __construct() { |
29 | 29 | |
30 | 30 | // Authentication Actions |
31 | - add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | - add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | - add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | - add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
31 | + add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) ); |
|
32 | + add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) ); |
|
33 | + add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) ); |
|
34 | + add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) ); |
|
35 | 35 | |
36 | - add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | - add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
36 | + add_action( 'admin_init', array( $this, 'authenticate_listener' ) ); |
|
37 | + add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) ); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function get_tt(){ |
|
40 | + public function get_tt() { |
|
41 | 41 | $tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' ); |
42 | 42 | if ( empty( $tt ) ) { |
43 | 43 | // if TT is empty, generate a new one, save it and then return it |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | return $tt; |
48 | 48 | } |
49 | 49 | |
50 | - public function rotate_tt(){ |
|
50 | + public function rotate_tt() { |
|
51 | 51 | $tt = $this->generate_tt(); |
52 | 52 | is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt ); |
53 | 53 | } |
54 | 54 | |
55 | - public function generate_tt(){ |
|
55 | + public function generate_tt() { |
|
56 | 56 | return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) ); |
57 | 57 | } |
58 | 58 | |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | return hash_equals( $tt, $passed_tt ); |
62 | 62 | } |
63 | 63 | |
64 | - public function maybe_authenticate(){ |
|
64 | + public function maybe_authenticate() { |
|
65 | 65 | |
66 | 66 | // Check nonce |
67 | 67 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
68 | 68 | |
69 | 69 | // current user can authenticate |
70 | 70 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
71 | - wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
71 | + wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | // Only for Pro users, require a license key to be entered first so we can link to things. |
79 | 79 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
80 | 80 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
81 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
81 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // we do not have a current auth |
85 | 85 | if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) { |
86 | - wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
86 | + wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
87 | 87 | } else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) { |
88 | - wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
88 | + wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $sitei = $this->get_sitei(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | - public function authenticate_listener(){ |
|
112 | + public function authenticate_listener() { |
|
113 | 113 | // Make sure it's for us |
114 | 114 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) { |
115 | 115 | return; |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // Make sure has required params |
130 | - if ( empty( $_REQUEST['key'] ) || |
|
131 | - empty( $_REQUEST['token'] ) || |
|
132 | - empty( $_REQUEST['ua'] ) || |
|
133 | - empty( $_REQUEST['miview'] ) || |
|
134 | - empty( $_REQUEST['a'] ) || |
|
135 | - empty( $_REQUEST['w'] ) || |
|
130 | + if ( empty( $_REQUEST['key'] ) || |
|
131 | + empty( $_REQUEST['token'] ) || |
|
132 | + empty( $_REQUEST['ua'] ) || |
|
133 | + empty( $_REQUEST['miview'] ) || |
|
134 | + empty( $_REQUEST['a'] ) || |
|
135 | + empty( $_REQUEST['w'] ) || |
|
136 | 136 | empty( $_REQUEST['p'] ) |
137 | 137 | ) { |
138 | 138 | return; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $where = $this->is_network_admin() ? 'network' : 'site'; |
172 | 172 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
173 | 173 | |
174 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
174 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
175 | 175 | $url = add_query_arg( array( |
176 | 176 | 'mi_action' => 'auth', |
177 | 177 | 'success' => 'true', |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | exit; |
181 | 181 | } |
182 | 182 | |
183 | - public function maybe_reauthenticate(){ |
|
183 | + public function maybe_reauthenticate() { |
|
184 | 184 | |
185 | 185 | // Check nonce |
186 | 186 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
187 | 187 | |
188 | 188 | // current user can authenticate |
189 | 189 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
190 | - wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
190 | + wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | // Only for Pro users, require a license key to be entered first so we can link to things. |
198 | 198 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
199 | 199 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
200 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
200 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | // we do have a current auth |
204 | 204 | if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
205 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
205 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
206 | 206 | } else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
207 | - wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
207 | + wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $siteurl = add_query_arg( array( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | wp_send_json_success( array( 'redirect' => $siteurl ) ); |
228 | 228 | } |
229 | 229 | |
230 | - public function reauthenticate_listener(){ |
|
230 | + public function reauthenticate_listener() { |
|
231 | 231 | // Make sure it's for us |
232 | 232 | if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) { |
233 | 233 | return; |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | |
246 | 246 | // Make sure has required params |
247 | 247 | if ( |
248 | - empty( $_REQUEST['ua'] ) || |
|
249 | - empty( $_REQUEST['miview'] ) || |
|
250 | - empty( $_REQUEST['a'] ) || |
|
251 | - empty( $_REQUEST['w'] ) || |
|
248 | + empty( $_REQUEST['ua'] ) || |
|
249 | + empty( $_REQUEST['miview'] ) || |
|
250 | + empty( $_REQUEST['a'] ) || |
|
251 | + empty( $_REQUEST['w'] ) || |
|
252 | 252 | empty( $_REQUEST['p'] ) |
253 | 253 | ) { |
254 | 254 | return; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $where = $this->is_network_admin() ? 'network' : 'site'; |
289 | 289 | MonsterInsights()->reporting->delete_aggregate_data( $where ); |
290 | 290 | |
291 | - $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ) ; |
|
291 | + $url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' ); |
|
292 | 292 | $url = add_query_arg( array( |
293 | 293 | 'mi_action' => 'reauth', |
294 | 294 | 'success' => 'true', |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | exit; |
298 | 298 | } |
299 | 299 | |
300 | - public function maybe_verify(){ |
|
300 | + public function maybe_verify() { |
|
301 | 301 | |
302 | 302 | // Check nonce |
303 | 303 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
304 | 304 | |
305 | 305 | // current user can verify |
306 | 306 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
307 | - wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
307 | + wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | |
314 | 314 | // we have an auth to verify |
315 | 315 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
316 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
316 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
317 | 317 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
318 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
318 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) ); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
322 | 322 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
323 | - wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
323 | + wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $worked = $this->verify_auth(); |
327 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
327 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
328 | 328 | wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) ); |
329 | 329 | } else { |
330 | 330 | wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) ); |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | - public function verify_auth( $credentials = array() ){ |
|
334 | + public function verify_auth( $credentials = array() ) { |
|
335 | 335 | $creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) ); |
336 | 336 | |
337 | 337 | if ( empty( $creds['key'] ) ) { |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - public function maybe_delete(){ |
|
351 | + public function maybe_delete() { |
|
352 | 352 | |
353 | 353 | // Check nonce |
354 | 354 | check_ajax_referer( 'mi-admin-nonce', 'nonce' ); |
355 | 355 | |
356 | 356 | // current user can delete |
357 | 357 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
358 | - wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
358 | + wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) ); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -364,20 +364,20 @@ discard block |
||
364 | 364 | |
365 | 365 | // we have an auth to delete |
366 | 366 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
367 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
367 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
368 | 368 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
369 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
369 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) ); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | $valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed(); |
373 | 373 | if ( monsterinsights_is_pro_version() && ! $valid ) { |
374 | - wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
374 | + wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) ); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | $force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true'; |
378 | 378 | |
379 | 379 | $worked = $this->delete_auth( $force ); |
380 | - if ( $worked && ! is_wp_error( $worked ) ) { |
|
380 | + if ( $worked && ! is_wp_error( $worked ) ) { |
|
381 | 381 | wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) ); |
382 | 382 | } else { |
383 | 383 | if ( $force ) { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - public function delete_auth( $force = false ){ |
|
391 | + public function delete_auth( $force = false ) { |
|
392 | 392 | if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) { |
393 | 393 | return false; |
394 | 394 | } else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) { |
@@ -404,13 +404,13 @@ discard block |
||
404 | 404 | // If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways |
405 | 405 | if ( is_network_admin() ) { |
406 | 406 | $siteurl = network_admin_url(); |
407 | - if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) { |
|
407 | + if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) { |
|
408 | 408 | MonsterInsights()->auth->delete_network_analytics_profile( true ); |
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | } else { |
412 | 412 | $siteurl = site_url(); |
413 | - if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) { |
|
413 | + if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) { |
|
414 | 414 | MonsterInsights()->auth->delete_analytics_profile( true ); |
415 | 415 | return true; |
416 | 416 | } |
@@ -452,15 +452,15 @@ discard block |
||
452 | 452 | // return $sitei; |
453 | 453 | // } |
454 | 454 | |
455 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
455 | + $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
456 | 456 | $secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : ''; |
457 | - $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
457 | + $logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : ''; |
|
458 | 458 | |
459 | 459 | $sitei = $auth_key . $secure_auth_key . $logged_in_key; |
460 | - $sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei ); |
|
460 | + $sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei ); |
|
461 | 461 | $sitei = sanitize_text_field( $sitei ); |
462 | 462 | $sitei = trim( $sitei ); |
463 | - $sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei; |
|
463 | + $sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei; |
|
464 | 464 | return $sitei; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | \ 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 | } |