mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
* Fixed: connection problems caused by issues with json_encode function
This commit is contained in:
parent
197652ebcc
commit
329bd94989
4 changed files with 43 additions and 19 deletions
|
@ -115,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWP_Child {
|
class MainWP_Child {
|
||||||
public static $version = '4.0.6.1';
|
public static $version = '4.0.6.2';
|
||||||
private $update_version = '1.5';
|
private $update_version = '1.5';
|
||||||
|
|
||||||
private $callableFunctions = array(
|
private $callableFunctions = array(
|
||||||
|
@ -1539,7 +1539,7 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
||||||
new MainWP_Keyword_Links();
|
new MainWP_Keyword_Links();
|
||||||
if ( ! is_admin() ) {
|
if ( ! is_admin() ) {
|
||||||
|
@ -3038,7 +3038,7 @@ class MainWP_Child {
|
||||||
$new_user['role'] = 'subscriber';
|
$new_user['role'] = 'subscriber';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_user_id = wp_insert_user( $new_user );
|
$new_user_id = wp_insert_user( $new_user );
|
||||||
|
|
||||||
if ( is_wp_error( $new_user_id ) ) {
|
if ( is_wp_error( $new_user_id ) ) {
|
||||||
|
@ -3586,9 +3586,9 @@ class MainWP_Child {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
|
MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['siteId'] ) ) {
|
if ( isset( $_POST['siteId'] ) ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_siteid', intval($_POST['siteId']) );
|
MainWP_Helper::update_option( 'mainwp_child_siteid', intval($_POST['siteId']) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['pluginDir'] ) ) {
|
if ( isset( $_POST['pluginDir'] ) ) {
|
||||||
|
@ -3629,7 +3629,7 @@ class MainWP_Child {
|
||||||
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
|
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$information['version'] = self::$version;
|
$information['version'] = self::$version;
|
||||||
$information['wpversion'] = $wp_version;
|
$information['wpversion'] = $wp_version;
|
||||||
$information['siteurl'] = get_option( 'siteurl' );
|
$information['siteurl'] = get_option( 'siteurl' );
|
||||||
|
@ -3995,14 +3995,14 @@ class MainWP_Child {
|
||||||
if ( ! is_array( $othersData ) ) {
|
if ( ! is_array( $othersData ) ) {
|
||||||
$othersData = array();
|
$othersData = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $othersData['wpvulndbToken'] ) ) {
|
if ( isset( $othersData['wpvulndbToken'] ) ) {
|
||||||
$wpvulndb_token = get_option( 'mainwp_child_wpvulndb_token', '' );
|
$wpvulndb_token = get_option( 'mainwp_child_wpvulndb_token', '' );
|
||||||
if ( $wpvulndb_token != $othersData['wpvulndbToken'] ) {
|
if ( $wpvulndb_token != $othersData['wpvulndbToken'] ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_wpvulndb_token', $othersData['wpvulndbToken'] );
|
MainWP_Helper::update_option( 'mainwp_child_wpvulndb_token', $othersData['wpvulndbToken'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
@ -5287,7 +5287,7 @@ class MainWP_Child {
|
||||||
$maint_options = array();
|
$maint_options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $this->options = array(
|
// $this->options = array(
|
||||||
// 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ),
|
// 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ),
|
||||||
// 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ),
|
// 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ),
|
||||||
|
@ -5299,11 +5299,11 @@ class MainWP_Child {
|
||||||
// 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ),
|
// 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ),
|
||||||
// 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' )
|
// 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' )
|
||||||
// );
|
// );
|
||||||
|
|
||||||
$performed_what = array();
|
$performed_what = array();
|
||||||
if ( empty( $max_revisions ) ) {
|
if ( empty( $max_revisions ) ) {
|
||||||
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
|
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
|
||||||
$wpdb->query( $sql_clean );
|
$wpdb->query( $sql_clean );
|
||||||
// to fix issue of meta_value short length
|
// to fix issue of meta_value short length
|
||||||
$performed_what[] = 'revisions'; //'Posts revisions deleted';
|
$performed_what[] = 'revisions'; //'Posts revisions deleted';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,18 +4,39 @@ class MainWP_Helper {
|
||||||
|
|
||||||
static function write( $val ) {
|
static function write( $val ) {
|
||||||
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
||||||
$output = json_encode( $val );
|
$output = self::safe_json_encode( $val );
|
||||||
else:
|
else:
|
||||||
$output = serialize( $val );
|
$output = serialize( $val );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
|
die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function utf8ize($mixed) {
|
||||||
|
if (is_array($mixed)) {
|
||||||
|
foreach ($mixed as $key => $value) {
|
||||||
|
$mixed[$key] = self::utf8ize($value);
|
||||||
|
}
|
||||||
|
} elseif (is_string($mixed)) {
|
||||||
|
if ( function_exists( 'mb_convert_encoding' )) {
|
||||||
|
return mb_convert_encoding($mixed, "UTF-8", "UTF-8");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $mixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function safe_json_encode($value, $options = 0, $depth = 512) {
|
||||||
|
$encoded = @json_encode($value, $options, $depth);
|
||||||
|
if ($encoded === false && $value && json_last_error() == JSON_ERROR_UTF8) {
|
||||||
|
$encoded = @json_encode(self::utf8ize($value), $options, $depth);
|
||||||
|
}
|
||||||
|
return $encoded;
|
||||||
|
}
|
||||||
|
|
||||||
static function close_connection( $val = null ) {
|
static function close_connection( $val = null ) {
|
||||||
|
|
||||||
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
||||||
$output = json_encode( $val );
|
$output = self::safe_json_encode( $val );
|
||||||
else:
|
else:
|
||||||
$output = serialize( $val );
|
$output = serialize( $val );
|
||||||
endif;
|
endif;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
Author: MainWP
|
Author: MainWP
|
||||||
Author URI: https://mainwp.com
|
Author URI: https://mainwp.com
|
||||||
Text Domain: mainwp-child
|
Text Domain: mainwp-child
|
||||||
Version: 4.0.6.1
|
Version: 4.0.6.2
|
||||||
*/
|
*/
|
||||||
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Plugin URI: https://mainwp.com
|
||||||
Requires at least: 3.6
|
Requires at least: 3.6
|
||||||
Tested up to: 5.3.2
|
Tested up to: 5.3.2
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable tag: 4.0.6.1
|
Stable tag: 4.0.6.2
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 4.0.6.2 - 2-3-20 =
|
||||||
|
* Fixed: connection problems caused by issues with json_encode function
|
||||||
|
|
||||||
= 4.0.6.1 - 1-20-20 =
|
= 4.0.6.1 - 1-20-20 =
|
||||||
* Updated: MainWP_Child_WPvivid_BackupRestore class
|
* Updated: MainWP_Child_WPvivid_BackupRestore class
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue