MainWP Child - Version 4.0.6.2

Version Description

  • 2-3-20 =
  • Fixed: connection problems caused by issues with json_encode function
Download this release

Release Info

Developer mainwp
Plugin Icon 128x128 MainWP Child
Version 4.0.6.2
Comparing to
See all releases

Code changes from version 4.0.6.1 to 4.0.6.2

class/class-mainwp-child.php CHANGED
@@ -115,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
115
  }
116
 
117
  class MainWP_Child {
118
- public static $version = '4.0.6.1';
119
  private $update_version = '1.5';
120
 
121
  private $callableFunctions = array(
@@ -1539,7 +1539,7 @@ class MainWP_Child {
1539
  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' ) );
1540
  }
1541
 
1542
-
1543
  if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
1544
  new MainWP_Keyword_Links();
1545
  if ( ! is_admin() ) {
@@ -3038,7 +3038,7 @@ class MainWP_Child {
3038
  $new_user['role'] = 'subscriber';
3039
  }
3040
  }
3041
-
3042
  $new_user_id = wp_insert_user( $new_user );
3043
 
3044
  if ( is_wp_error( $new_user_id ) ) {
@@ -3586,9 +3586,9 @@ class MainWP_Child {
3586
  MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
3587
  }
3588
  }
3589
-
3590
- if ( isset( $_POST['siteId'] ) ) {
3591
- MainWP_Helper::update_option( 'mainwp_child_siteid', intval($_POST['siteId']) );
3592
  }
3593
 
3594
  if ( isset( $_POST['pluginDir'] ) ) {
@@ -3629,7 +3629,7 @@ class MainWP_Child {
3629
  MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
3630
  }
3631
  }
3632
-
3633
  $information['version'] = self::$version;
3634
  $information['wpversion'] = $wp_version;
3635
  $information['siteurl'] = get_option( 'siteurl' );
@@ -3995,14 +3995,14 @@ class MainWP_Child {
3995
  if ( ! is_array( $othersData ) ) {
3996
  $othersData = array();
3997
  }
3998
-
3999
  if ( isset( $othersData['wpvulndbToken'] ) ) {
4000
- $wpvulndb_token = get_option( 'mainwp_child_wpvulndb_token', '' );
4001
- if ( $wpvulndb_token != $othersData['wpvulndbToken'] ) {
4002
- MainWP_Helper::update_option( 'mainwp_child_wpvulndb_token', $othersData['wpvulndbToken'] );
4003
  }
4004
  }
4005
-
4006
  try{
4007
  $information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
4008
  } catch(Exception $e) {
@@ -5287,7 +5287,7 @@ class MainWP_Child {
5287
  $maint_options = array();
5288
  }
5289
 
5290
-
5291
  // $this->options = array(
5292
  // 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ),
5293
  // 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ),
@@ -5299,11 +5299,11 @@ class MainWP_Child {
5299
  // 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ),
5300
  // 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' )
5301
  // );
5302
-
5303
  $performed_what = array();
5304
  if ( empty( $max_revisions ) ) {
5305
  $sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
5306
- $wpdb->query( $sql_clean );
5307
  // to fix issue of meta_value short length
5308
  $performed_what[] = 'revisions'; //'Posts revisions deleted';
5309
  } else {
115
  }
116
 
117
  class MainWP_Child {
118
+ public static $version = '4.0.6.2';
119
  private $update_version = '1.5';
120
 
121
  private $callableFunctions = array(
1539
  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' ) );
1540
  }
1541
 
1542
+
1543
  if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
1544
  new MainWP_Keyword_Links();
1545
  if ( ! is_admin() ) {
3038
  $new_user['role'] = 'subscriber';
3039
  }
3040
  }
3041
+
3042
  $new_user_id = wp_insert_user( $new_user );
3043
 
3044
  if ( is_wp_error( $new_user_id ) ) {
3586
  MainWP_Helper::update_option( 'mainwp_child_clone_sites', '0' );
3587
  }
3588
  }
3589
+
3590
+ if ( isset( $_POST['siteId'] ) ) {
3591
+ MainWP_Helper::update_option( 'mainwp_child_siteid', intval($_POST['siteId']) );
3592
  }
3593
 
3594
  if ( isset( $_POST['pluginDir'] ) ) {
3629
  MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
3630
  }
3631
  }
3632
+
3633
  $information['version'] = self::$version;
3634
  $information['wpversion'] = $wp_version;
3635
  $information['siteurl'] = get_option( 'siteurl' );
3995
  if ( ! is_array( $othersData ) ) {
3996
  $othersData = array();
3997
  }
3998
+
3999
  if ( isset( $othersData['wpvulndbToken'] ) ) {
4000
+ $wpvulndb_token = get_option( 'mainwp_child_wpvulndb_token', '' );
4001
+ if ( $wpvulndb_token != $othersData['wpvulndbToken'] ) {
4002
+ MainWP_Helper::update_option( 'mainwp_child_wpvulndb_token', $othersData['wpvulndbToken'] );
4003
  }
4004
  }
4005
+
4006
  try{
4007
  $information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
4008
  } catch(Exception $e) {
5287
  $maint_options = array();
5288
  }
5289
 
5290
+
5291
  // $this->options = array(
5292
  // 'revisions' => __( 'Delete all post revisions', 'mainwp-maintenance-extension' ),
5293
  // 'autodraft' => __( 'Delete all auto draft posts', 'mainwp-maintenance-extension' ),
5299
  // 'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-maintenance-extension' ),
5300
  // 'optimize' => __( 'Optimize database tables', 'mainwp-maintenance-extension' )
5301
  // );
5302
+
5303
  $performed_what = array();
5304
  if ( empty( $max_revisions ) ) {
5305
  $sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
5306
+ $wpdb->query( $sql_clean );
5307
  // to fix issue of meta_value short length
5308
  $performed_what[] = 'revisions'; //'Posts revisions deleted';
5309
  } else {
class/class-mainwp-helper.php CHANGED
@@ -4,18 +4,39 @@ class MainWP_Helper {
4
 
5
  static function write( $val ) {
6
  if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
7
- $output = json_encode( $val );
8
  else:
9
  $output = serialize( $val );
10
  endif;
11
 
12
  die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  static function close_connection( $val = null ) {
16
 
17
  if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
18
- $output = json_encode( $val );
19
  else:
20
  $output = serialize( $val );
21
  endif;
4
 
5
  static function write( $val ) {
6
  if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
7
+ $output = self::safe_json_encode( $val );
8
  else:
9
  $output = serialize( $val );
10
  endif;
11
 
12
  die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' );
13
  }
14
+
15
+ public static function utf8ize($mixed) {
16
+ if (is_array($mixed)) {
17
+ foreach ($mixed as $key => $value) {
18
+ $mixed[$key] = self::utf8ize($value);
19
+ }
20
+ } elseif (is_string($mixed)) {
21
+ if ( function_exists( 'mb_convert_encoding' )) {
22
+ return mb_convert_encoding($mixed, "UTF-8", "UTF-8");
23
+ }
24
+ }
25
+ return $mixed;
26
+ }
27
+
28
+ public static function safe_json_encode($value, $options = 0, $depth = 512) {
29
+ $encoded = @json_encode($value, $options, $depth);
30
+ if ($encoded === false && $value && json_last_error() == JSON_ERROR_UTF8) {
31
+ $encoded = @json_encode(self::utf8ize($value), $options, $depth);
32
+ }
33
+ return $encoded;
34
+ }
35
 
36
  static function close_connection( $val = null ) {
37
 
38
  if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
39
+ $output = self::safe_json_encode( $val );
40
  else:
41
  $output = serialize( $val );
42
  endif;
mainwp-child.php CHANGED
@@ -6,7 +6,7 @@
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
  Text Domain: mainwp-child
9
- Version: 4.0.6.1
10
  */
11
  include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
12
 
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
  Text Domain: mainwp-child
9
+ Version: 4.0.6.2
10
  */
11
  include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
12
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ Plugin URI: https://mainwp.com
7
  Requires at least: 3.6
8
  Tested up to: 5.3.2
9
  Requires PHP: 5.6
10
- Stable tag: 4.0.6.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -71,6 +71,9 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
71
 
72
  == Changelog ==
73
 
 
 
 
74
  = 4.0.6.1 - 1-20-20 =
75
  * Updated: MainWP_Child_WPvivid_BackupRestore class
76
 
7
  Requires at least: 3.6
8
  Tested up to: 5.3.2
9
  Requires PHP: 5.6
10
+ Stable tag: 4.0.6.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
71
 
72
  == Changelog ==
73
 
74
+ = 4.0.6.2 - 2-3-20 =
75
+ * Fixed: connection problems caused by issues with json_encode function
76
+
77
  = 4.0.6.1 - 1-20-20 =
78
  * Updated: MainWP_Child_WPvivid_BackupRestore class
79