PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.4.1
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.4.1
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 All 199 releases
← All changes | admin/section/class-convertkit-settings-tools.php +9 -37 2.2.8 → 2.4.1 View file →
@@ -74,9 +74,9 @@
74 74 $log = new ConvertKit_Log( CONVERTKIT_PLUGIN_PATH );
75 75 $log->clear();
76 76
77 77 // Redirect to Tools screen.
78 - $this->redirect_to_tools_screen();
78 + $this->redirect();
79 79
80 80 }
81 81
82 82 /**
@@ -201,17 +201,17 @@
201 201 return;
202 202 }
203 203
204 204 // Bail if no configuration file was supplied.
205 - if ( ! is_array( $_FILES ) ) {
206 - $this->redirect_to_tools_screen();
205 + if ( ! is_array( $_FILES ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
206 + $this->redirect();
207 207 }
208 - if ( $_FILES['import']['error'] !== 0 ) {
209 - $this->redirect_to_tools_screen( 'import_configuration_upload_error' );
208 + if ( $_FILES['import']['error'] !== 0 ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
209 + $this->redirect( 'import_configuration_upload_error' );
210 210 }
211 211
212 212 // Read file.
213 - $json = $wp_filesystem->get_contents( $_FILES['import']['tmp_name'] );
213 + $json = $wp_filesystem->get_contents( $_FILES['import']['tmp_name'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
214 214
215 215 // Decode.
216 216 $import = json_decode( $json, true );
217 217
@@ -216,14 +216,14 @@
216 216 $import = json_decode( $json, true );
217 217
218 218 // Bail if the data isn't JSON.
219 219 if ( is_null( $import ) ) {
220 - $this->redirect_to_tools_screen( 'import_configuration_invalid_file_type' );
220 + $this->redirect( 'import_configuration_invalid_file_type' );
221 221 }
222 222
223 223 // Bail if no settings exist.
224 224 if ( ! array_key_exists( 'settings', $import ) ) {
225 - $this->redirect_to_tools_screen( 'import_configuration_empty' );
225 + $this->redirect( 'import_configuration_empty' );
226 226 }
227 227
228 228 // Import: Settings.
229 229 if ( array_key_exists( 'settings', $import ) ) {
@@ -237,9 +237,9 @@
237 237 update_option( $restrict_content_settings::SETTINGS_NAME, $import['restrict_content'] );
238 238 }
239 239
240 240 // Redirect to Tools screen.
241 - $this->redirect_to_tools_screen( false, 'import_configuration_success' );
241 + $this->redirect( false, 'import_configuration_success' );
242 242
243 243 }
244 244
245 245 /**
@@ -257,36 +257,8 @@
257 257 return false;
258 258 }
259 259
260 260 return wp_verify_nonce( sanitize_key( $_REQUEST['_convertkit_settings_tools_nonce'] ), 'convertkit-settings-tools' );
261 -
262 - }
263 -
264 - /**
265 - * Redirects to the ConvertKit > Tools screen.
266 - *
267 - * @since 1.9.7.4
268 - *
269 - * @param false|string $error The error message key.
270 - * @param false|string $success The success message key.
271 - */
272 - private function redirect_to_tools_screen( $error = false, $success = false ) {
273 -
274 - // Build URL to redirect to, depending on whether a message is included.
275 - $args = array(
276 - 'page' => '_wp_convertkit_settings',
277 - 'tab' => 'tools',
278 - );
279 - if ( $error !== false ) {
280 - $args['error'] = $error;
281 - }
282 - if ( $success !== false ) {
283 - $args['success'] = $success;
284 - }
285 -
286 - // Redirect to ConvertKit > Tools screen.
287 - wp_safe_redirect( add_query_arg( $args, 'options-general.php' ) );
288 - exit();
289 261
290 262 }
291 263
292 264 /**