diff --git a/class/class-mainwp-child-skeleton-key.php b/class/class-mainwp-child-skeleton-key.php
index 398a065..fde6d1c 100644
--- a/class/class-mainwp-child-skeleton-key.php
+++ b/class/class-mainwp-child-skeleton-key.php
@@ -1,12 +1,11 @@
'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
}
- // to fix issue double header in response
- // else {
- // MainWP_Helper::write( MainWP_Child_Skeleton_Key::$information );
- // }
}
register_shutdown_function( 'mainwp_skeleton_key_handle_fatal_error' );
@@ -42,7 +36,6 @@ class MainWP_Child_Skeleton_Key {
}
MainWP_Helper::write( $information );
- // MainWP_Child_Skeleton_Key::$information = $information;
exit();
}
@@ -82,16 +75,20 @@ class MainWP_Child_Skeleton_Key {
$post_args = array();
$post_args['body'] = array();
$post_args['redirection'] = 5;
- $post_args['decompress'] = false; // For gzinflate() data error bug
+ $post_args['decompress'] = false;
$post_args['cookies'] = array(
- new WP_Http_Cookie( array(
- 'name' => $auth_cookie_name,
- 'value' => $auth_cookie,
- ) ),
- new WP_Http_Cookie( array(
- 'name' => LOGGED_IN_COOKIE,
- 'value' => $logged_in_cookie,
- ) ),
+ new WP_Http_Cookie(
+ array(
+ 'name' => $auth_cookie_name,
+ 'value' => $auth_cookie,
+ )
+ ),
+ new WP_Http_Cookie(
+ array(
+ 'name' => LOGGED_IN_COOKIE,
+ 'value' => $logged_in_cookie,
+ )
+ ),
);
if ( isset( $args['get'] ) ) {
@@ -142,7 +139,7 @@ class MainWP_Child_Skeleton_Key {
$received_content = wp_remote_retrieve_body( $response );
if ( preg_match( '/(.*)<\/mainwp>/', $received_content, $received_result ) > 0 ) {
- $received_content_mainwp = json_decode( base64_decode( $received_result[1] ), true ); // json format
+ $received_content_mainwp = json_decode( base64_decode( $received_result[1] ), true ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons.
if ( isset( $received_content_mainwp['error'] ) ) {
return array( 'error' => $received_content_mainwp['error'] );
}
@@ -193,10 +190,10 @@ class MainWP_Child_Skeleton_Key {
}
public function save_settings() {
- $settings = isset($_POST['settings']) ? $_POST['settings'] : array();
+ $settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array();
- if ( ! is_array($settings) || empty($settings) ) {
- return array( 'error' => 'Invalid data. Please check and try again.' );
+ if ( ! is_array( $settings ) || empty( $settings ) ) {
+ return array( 'error' => __( 'Invalid data. Please check and try again.', 'mainwp-child' ) );
}
$whitelist_options = array(
@@ -216,10 +213,8 @@ class MainWP_Child_Skeleton_Key {
$whitelist_options['general'][] = 'default_role';
}
- // $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
$whitelist_general = $whitelist_options['general'];
- // Handle translation install.
if ( ! empty( $settings['WPLANG'] ) ) {
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
if ( wp_can_install_language_pack() ) {
@@ -232,12 +227,12 @@ class MainWP_Child_Skeleton_Key {
$updated = false;
foreach ( $settings as $option => $value ) {
- if ( in_array($option, $whitelist_general) ) {
+ if ( in_array( $option, $whitelist_general ) ) {
if ( ! is_array( $value ) ) {
$value = trim( $value );
}
$value = wp_unslash( $value );
- update_option($option, $value);
+ update_option( $option, $value );
$updated = true;
}
}