MainWP Child - Version 4.0.5.1

Version Description

  • 12-13-19 =
  • Fixed: Child Reports data conversion problem
Download this release

Release Info

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

Code changes from version 4.0.5 to 4.0.5.1

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.5';
119
  private $update_version = '1.5';
120
 
121
  private $callableFunctions = array(
@@ -1654,10 +1654,10 @@ class MainWP_Child {
1654
 
1655
  public function http_request_reject_unsafe_urls( $r, $url ) {
1656
  $r['reject_unsafe_urls'] = false;
1657
- if ( isset($_POST['wpadmin_user']) && !empty($_POST['wpadmin_user']) && isset($_POST['wpadmin_passwd']) && !empty($_POST['wpadmin_passwd']) ) {
1658
- $auth = base64_encode( $_POST['wpadmin_user'] . ':' . $_POST['wpadmin_passwd'] );
1659
- $r['headers']['Authorization'] = "Basic $auth";
1660
- }
1661
  return $r;
1662
  }
1663
 
@@ -1771,7 +1771,7 @@ class MainWP_Child {
1771
  } else {
1772
  activate_plugin( $path . $fileName, '' /* false, true */ );
1773
  }
1774
- do_action( 'activate_plugin', $args['slug'], null );
1775
  }
1776
  }
1777
  } else {
@@ -2064,17 +2064,17 @@ class MainWP_Child {
2064
  } else {
2065
  $information['upgrades'][ $plugin ] = true;
2066
  // to fix logging update
2067
- if (isset($information['plugin_updates']) && isset($information['plugin_updates'][$plugin])) {
2068
- $plugin_info = $information['plugin_updates'][$plugin];
2069
- $args = array();
2070
- $args['type'] = 'plugin';
2071
- $args['slug'] = $plugin;
2072
- $args['name'] = $plugin_info->Name;
2073
- $args['version'] = $plugin_info->update->new_version;
2074
- $args['old_version'] = $plugin_info->Version;
2075
- $args['action'] = 'update';
2076
- do_action( 'mainwp_child_upgradePluginTheme', $args );
2077
- }
2078
  }
2079
  }
2080
  $failed = false;
@@ -2177,17 +2177,17 @@ class MainWP_Child {
2177
  } else {
2178
  $information['upgrades'][ $theme ] = true;
2179
  // to fix logging update
2180
- if (isset($information['theme_updates']) && isset($information['theme_updates'][$theme])) {
2181
- $theme_info = $information['theme_updates'][$theme];
2182
- $args = array();
2183
- $args['type'] = 'theme';
2184
- $args['slug'] = $theme;
2185
- $args['name'] = $theme_info['Name'];
2186
- $args['version'] = $theme_info['update']['new_version'];
2187
- $args['old_version'] = $theme_info['Version'];
2188
- $args['action'] = 'update';
2189
- do_action( 'mainwp_child_upgradePluginTheme', $args );
2190
- }
2191
 
2192
  }
2193
  }
@@ -4743,7 +4743,7 @@ class MainWP_Child {
4743
  // to fix activate issue
4744
  if ('quotes-collection/quotes-collection.php' == $plugin) {
4745
  activate_plugin( $plugin, '', false, true );
4746
- do_action( 'activate_plugin', $plugin, null );
4747
  } else {
4748
  activate_plugin( $plugin );
4749
  }
115
  }
116
 
117
  class MainWP_Child {
118
+ public static $version = '4.0.5.1';
119
  private $update_version = '1.5';
120
 
121
  private $callableFunctions = array(
1654
 
1655
  public function http_request_reject_unsafe_urls( $r, $url ) {
1656
  $r['reject_unsafe_urls'] = false;
1657
+ if ( isset($_POST['wpadmin_user']) && !empty($_POST['wpadmin_user']) && isset($_POST['wpadmin_passwd']) && !empty($_POST['wpadmin_passwd']) ) {
1658
+ $auth = base64_encode( $_POST['wpadmin_user'] . ':' . $_POST['wpadmin_passwd'] );
1659
+ $r['headers']['Authorization'] = "Basic $auth";
1660
+ }
1661
  return $r;
1662
  }
1663
 
1771
  } else {
1772
  activate_plugin( $path . $fileName, '' /* false, true */ );
1773
  }
1774
+ //do_action( 'activate_plugin', $args['slug'], null );
1775
  }
1776
  }
1777
  } else {
2064
  } else {
2065
  $information['upgrades'][ $plugin ] = true;
2066
  // to fix logging update
2067
+ // if (isset($information['plugin_updates']) && isset($information['plugin_updates'][$plugin])) {
2068
+ // $plugin_info = $information['plugin_updates'][$plugin];
2069
+ // $args = array();
2070
+ // $args['type'] = 'plugin';
2071
+ // $args['slug'] = $plugin;
2072
+ // $args['name'] = $plugin_info->Name;
2073
+ // $args['version'] = $plugin_info->update->new_version;
2074
+ // $args['old_version'] = $plugin_info->Version;
2075
+ // $args['action'] = 'update';
2076
+ // //do_action( 'mainwp_child_upgradePluginTheme', $args );
2077
+ // }
2078
  }
2079
  }
2080
  $failed = false;
2177
  } else {
2178
  $information['upgrades'][ $theme ] = true;
2179
  // to fix logging update
2180
+ // if (isset($information['theme_updates']) && isset($information['theme_updates'][$theme])) {
2181
+ // $theme_info = $information['theme_updates'][$theme];
2182
+ // $args = array();
2183
+ // $args['type'] = 'theme';
2184
+ // $args['slug'] = $theme;
2185
+ // $args['name'] = $theme_info['Name'];
2186
+ // $args['version'] = $theme_info['update']['new_version'];
2187
+ // $args['old_version'] = $theme_info['Version'];
2188
+ // $args['action'] = 'update';
2189
+ // //do_action( 'mainwp_child_upgradePluginTheme', $args );
2190
+ // }
2191
 
2192
  }
2193
  }
4743
  // to fix activate issue
4744
  if ('quotes-collection/quotes-collection.php' == $plugin) {
4745
  activate_plugin( $plugin, '', false, true );
4746
+ //do_action( 'activate_plugin', $plugin, null );
4747
  } else {
4748
  activate_plugin( $plugin );
4749
  }
class/class-mainwp-client-report.php CHANGED
@@ -133,14 +133,15 @@ class MainWP_Client_Report {
133
  'media' => 'media'
134
  );
135
 
136
- return isset( $mapping_contexts[ $context ] ) ? $mapping_contexts[ $context ] : $context;
 
137
  }
138
 
139
 
140
  public function get_connector_by_compatible_context( $context ) {
141
 
142
  $connector = "";
143
- if ( $context == "plugins" || $context == "themes" ) {
144
  $connector = "installer";
145
  } else if ( $context == 'profiles' ) {
146
  $connector = "users";
@@ -444,7 +445,7 @@ class MainWP_Client_Report {
444
  // ok, pass, do not check context
445
  } else if ( $connector == "widgets" && $record->connector == 'widgets') {
446
  // ok, pass, don't check context
447
- } else if ( $context !== $record->context) {
448
  continue;
449
  }
450
 
@@ -470,7 +471,7 @@ class MainWP_Client_Report {
470
  } else {
471
  $backups_created_time_to_fix[] = $created;
472
  }
473
- } else {
474
  if ( $action !== $record->action ) {
475
  continue;
476
  }
@@ -494,7 +495,7 @@ class MainWP_Client_Report {
494
  $skip_records[] = $record->ID;
495
  continue;
496
  }
497
- }
498
  }
499
  }
500
  $count ++;
@@ -508,6 +509,26 @@ class MainWP_Client_Report {
508
  return $token_values;
509
  }
510
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  function get_section_loop_data( $records, $tokens, $section, $skip_records = array() ) {
512
 
513
 
@@ -554,10 +575,21 @@ class MainWP_Client_Report {
554
  $loops = array();
555
  $loop_count = 0;
556
 
557
- foreach ( $records as $record ) {
558
 
559
- if (in_array($record->ID, $skip_records)) {
560
- continue;
 
 
 
 
 
 
 
 
 
 
 
561
  }
562
 
563
  // check connector
@@ -583,7 +615,7 @@ class MainWP_Client_Report {
583
  } else if ( $connector == "widgets" && $record->connector == 'widgets') {
584
  // ok, pass, don't check context
585
  //
586
- } else if ( $context !== $record->context ) {
587
  continue;
588
  }
589
 
@@ -689,9 +721,16 @@ class MainWP_Client_Report {
689
  }
690
 
691
  $value = $this->get_stream_meta_data( $record, $data );
 
692
  if ( empty( $value ) && 'comments' === $context ) {
693
  $value = __( 'Guest', 'mainwp-child-reports' );
694
  }
 
 
 
 
 
 
695
  $token_values[ $token ] = $value;
696
  break;
697
  case 'status': // sucuri cases
@@ -798,26 +837,25 @@ class MainWP_Client_Report {
798
 
799
  if ( isset( $meta[ $meta_key ] ) ) {
800
  $value = $meta[ $meta_key ];
801
- $value = current( $value );
802
 
803
- // if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) {
804
- // $value = maybe_unserialize( $value );
805
- // $value = $value['display_name'];
806
- //
807
- // if ( 'author_meta' === $meta_key && $value == '' && $context == 'comments') {
808
- // $value = __( 'Guest', 'mainwp-child-reports' );
809
- // }
810
- // // to fix empty author value
811
- // if ( empty($value) ) {
812
- // if (isset($value['agent']) && !empty($value['agent'])) {
813
- // $value = $value['agent'];
814
- // }
815
- // }
816
- //
817
- // if (!is_string($value)) {
818
- // $value = '';
819
- // }
820
- // }
821
  }
822
  }
823
 
133
  'media' => 'media'
134
  );
135
 
136
+ $context = isset( $mapping_contexts[ $context ] ) ? $mapping_contexts[ $context ] : $context;
137
+ return strtolower($context);
138
  }
139
 
140
 
141
  public function get_connector_by_compatible_context( $context ) {
142
 
143
  $connector = "";
144
+ if ( $context == "plugins" || $context == "themes" || $context == "wordpress" ) {
145
  $connector = "installer";
146
  } else if ( $context == 'profiles' ) {
147
  $connector = "users";
445
  // ok, pass, do not check context
446
  } else if ( $connector == "widgets" && $record->connector == 'widgets') {
447
  // ok, pass, don't check context
448
+ } else if ( $context !== strtolower( $record->context )) {
449
  continue;
450
  }
451
 
471
  } else {
472
  $backups_created_time_to_fix[] = $created;
473
  }
474
+ } else {
475
  if ( $action !== $record->action ) {
476
  continue;
477
  }
495
  $skip_records[] = $record->ID;
496
  continue;
497
  }
498
+ }
499
  }
500
  }
501
  $count ++;
509
  return $token_values;
510
  }
511
 
512
+ // function get_meta_value_from_summary( $summary, $meta ) {
513
+ // $value = '';
514
+ // if ( $meta == 'name' ) {
515
+ // $value = str_replace(array('Updated plugin:', 'Updated theme:'), '', $summary);
516
+ // $value = trim( $value );
517
+ // $last_space_pos = strrpos($value, ' ');
518
+ // if ($last_space_pos !== false) {
519
+ // $value = substr($value , 0, 0 - $last_space_pos);
520
+ // }
521
+ // } else if ( $meta == 'version') {
522
+ // $last_space_pos = strrpos($value, ' ');
523
+ // if ($last_space_pos !== false) {
524
+ // $value = substr($value , $last_space_pos);
525
+ // }
526
+ // } else if ( $meta == 'old_version' ) {
527
+ // $value = 'N/A';
528
+ // }
529
+ // return $value;
530
+ // }
531
+
532
  function get_section_loop_data( $records, $tokens, $section, $skip_records = array() ) {
533
 
534
 
575
  $loops = array();
576
  $loop_count = 0;
577
 
578
+ foreach ( $records as $record ) {
579
 
580
+ // $fix_meta_name = $fix_old_version = $fix_version = '';
581
+
582
+ if ( in_array($record->ID, $skip_records) ) {
583
+ // to fix incorrect meta for update logging
584
+ // if ( 'updated' === $action && ('themes' === $context || 'plugins' === $context)) {
585
+ // if ( !isset( $record->meta ) || $record->meta == '') {
586
+ // $fix_meta_name = get_meta_value_from_summary($record->summary, 'name');
587
+ // $fix_old_version = get_meta_value_from_summary($record->summary, 'old_version');
588
+ // $fix_version = get_meta_value_from_summary($record->summary, 'version');
589
+ // }
590
+ // } else {
591
+ continue;
592
+ // }
593
  }
594
 
595
  // check connector
615
  } else if ( $connector == "widgets" && $record->connector == 'widgets') {
616
  // ok, pass, don't check context
617
  //
618
+ } else if ( $context !== strtolower( $record->context ) ) {
619
  continue;
620
  }
621
 
721
  }
722
 
723
  $value = $this->get_stream_meta_data( $record, $data );
724
+
725
  if ( empty( $value ) && 'comments' === $context ) {
726
  $value = __( 'Guest', 'mainwp-child-reports' );
727
  }
728
+
729
+ // to check may compatible with old meta data
730
+ if ( empty( $value )) {
731
+ $value = $this->get_stream_meta_data( $record, 'author_meta' );
732
+ }
733
+
734
  $token_values[ $token ] = $value;
735
  break;
736
  case 'status': // sucuri cases
837
 
838
  if ( isset( $meta[ $meta_key ] ) ) {
839
  $value = $meta[ $meta_key ];
840
+ $value = current( $value );
841
 
842
+ // to compatible with old meta data
843
+ if ( 'author_meta' === $meta_key ) {
844
+ $value = maybe_unserialize( $value );
845
+ if (is_array($value)) {
846
+ $value = $value['display_name'];
847
+ // to fix empty author value
848
+ if ( empty($value) ) {
849
+ if (isset($value['agent']) && !empty($value['agent'])) {
850
+ $value = $value['agent'];
851
+ }
852
+ }
853
+ }
854
+ if (!is_string($value)) {
855
+ $value = '';
856
+ }
857
+ }
858
+ // end
 
859
  }
860
  }
861
 
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.5
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.5.1
10
  */
11
  include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
12
 
readme.txt CHANGED
@@ -5,9 +5,9 @@ Author: mainwp
5
  Author URI: https://mainwp.com
6
  Plugin URI: https://mainwp.com
7
  Requires at least: 3.6
8
- Tested up to: 5.3
9
  Requires PHP: 5.6
10
- Stable tag: 4.0.5
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.5 - 12-9-19 =
75
  * Added: support for the Pro Reports extension
76
  * Fixed: MainWP Child Reports version 2 compatibility
5
  Author URI: https://mainwp.com
6
  Plugin URI: https://mainwp.com
7
  Requires at least: 3.6
8
+ Tested up to: 5.3.1
9
  Requires PHP: 5.6
10
+ Stable tag: 4.0.5.1
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.5.1 - 12-13-19 =
75
+ * Fixed: Child Reports data conversion problem
76
+
77
  = 4.0.5 - 12-9-19 =
78
  * Added: support for the Pro Reports extension
79
  * Fixed: MainWP Child Reports version 2 compatibility