Version Description
- 11-9-2016 =
- Fixed: Issue with hiding the plugin in Client Reports
- Fixed: Conflict with the auto backup feature of the UpdraftPlus Backups plugin (#8435)
- Fixed: Issue with double records for the UpdraftPlus backups
- Fixed: Issue with recorging UpdraftPlus and BackUpWordPress backups
- Added: Support for the BackupBuddy plugin
- Added: Support for the MainWP Branding (#10609)
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child Reports |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- connectors/backupbuddy.php +41 -0
- connectors/backupwordpress.php +2 -2
- connectors/installer.php +3 -5
- connectors/updraftplus.php +1 -1
- includes/admin.php +24 -34
- includes/connector.php +24 -6
- includes/connectors.php +2 -1
- includes/install.php +0 -16
- includes/query.php +18 -1
- mainwp-child-reports.php +97 -20
- readme.txt +10 -2
connectors/backupbuddy.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MainWP_WP_Stream_Connector_Backupbuddy extends MainWP_WP_Stream_Connector {
|
4 |
+
|
5 |
+
public static $name = 'backupbuddy_backups';
|
6 |
+
|
7 |
+
public static $actions = array(
|
8 |
+
'mainwp_reports_backupbuddy_backup',
|
9 |
+
);
|
10 |
+
|
11 |
+
public static function get_label() {
|
12 |
+
return __( 'BackupBuddy', 'default' );
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function get_action_labels() {
|
16 |
+
return array(
|
17 |
+
'mainwp_reports_backupbuddy_backup' => __( 'BackupBuddy Backup', 'default' ),
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
public static function get_context_labels() {
|
22 |
+
return array(
|
23 |
+
'backupbuddy_backups' => __( 'BackupBuddy Backups', 'mainwp-child-reports' ),
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
public static function action_links( $links, $record ) {
|
28 |
+
if (isset($record->object_id)) {
|
29 |
+
}
|
30 |
+
return $links;
|
31 |
+
}
|
32 |
+
|
33 |
+
public static function callback_mainwp_reports_backupbuddy_backup( $message, $type , $backup_time = 0) {
|
34 |
+
self::log(
|
35 |
+
$message,
|
36 |
+
compact('type', 'backup_time'),
|
37 |
+
0,
|
38 |
+
array( 'backupbuddy_backups' => 'mainwp_reports_backupbuddy_backup' )
|
39 |
+
);
|
40 |
+
}
|
41 |
+
}
|
connectors/backupwordpress.php
CHANGED
@@ -30,10 +30,10 @@ class MainWP_WP_Stream_Connector_Backupwordpress extends MainWP_WP_Stream_Connec
|
|
30 |
return $links;
|
31 |
}
|
32 |
|
33 |
-
public static function callback_backupwordpress_backup($destination, $message, $status, $type, $
|
34 |
self::log(
|
35 |
$message,
|
36 |
-
compact('destination', 'status', 'type', '
|
37 |
0,
|
38 |
array( 'backupwordpress_backups' => 'backupwordpress_backup' )
|
39 |
);
|
30 |
return $links;
|
31 |
}
|
32 |
|
33 |
+
public static function callback_backupwordpress_backup($destination, $message, $status, $type, $backup_time = 0) {
|
34 |
self::log(
|
35 |
$message,
|
36 |
+
compact('destination', 'status', 'type', 'backup_time'),
|
37 |
0,
|
38 |
array( 'backupwordpress_backups' => 'backupwordpress_backup' )
|
39 |
);
|
connectors/installer.php
CHANGED
@@ -266,15 +266,14 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
266 |
public static function callback_activate_plugin( $slug, $network_wide ) {
|
267 |
$plugins = get_plugins();
|
268 |
$name = $plugins[ $slug ]['Name'];
|
269 |
-
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
270 |
-
|
271 |
self::log(
|
272 |
_x(
|
273 |
'"%1$s" plugin activated %2$s',
|
274 |
'1: Plugin name, 2: Single site or network wide',
|
275 |
'mainwp_child_reports'
|
276 |
),
|
277 |
-
compact( 'name', 'network_wide' ),
|
278 |
null,
|
279 |
array( 'plugins' => 'activated' )
|
280 |
);
|
@@ -284,14 +283,13 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
284 |
$plugins = get_plugins();
|
285 |
$name = $plugins[ $slug ]['Name'];
|
286 |
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
287 |
-
|
288 |
self::log(
|
289 |
_x(
|
290 |
'"%1$s" plugin deactivated %2$s',
|
291 |
'1: Plugin name, 2: Single site or network wide',
|
292 |
'mainwp_child_reports'
|
293 |
),
|
294 |
-
compact( 'name', 'network_wide' ),
|
295 |
null,
|
296 |
array( 'plugins' => 'deactivated' )
|
297 |
);
|
266 |
public static function callback_activate_plugin( $slug, $network_wide ) {
|
267 |
$plugins = get_plugins();
|
268 |
$name = $plugins[ $slug ]['Name'];
|
269 |
+
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
|
|
270 |
self::log(
|
271 |
_x(
|
272 |
'"%1$s" plugin activated %2$s',
|
273 |
'1: Plugin name, 2: Single site or network wide',
|
274 |
'mainwp_child_reports'
|
275 |
),
|
276 |
+
compact( 'name', 'network_wide', 'slug' ),
|
277 |
null,
|
278 |
array( 'plugins' => 'activated' )
|
279 |
);
|
283 |
$plugins = get_plugins();
|
284 |
$name = $plugins[ $slug ]['Name'];
|
285 |
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
|
|
286 |
self::log(
|
287 |
_x(
|
288 |
'"%1$s" plugin deactivated %2$s',
|
289 |
'1: Plugin name, 2: Single site or network wide',
|
290 |
'mainwp_child_reports'
|
291 |
),
|
292 |
+
compact( 'name', 'network_wide', 'slug' ),
|
293 |
null,
|
294 |
array( 'plugins' => 'deactivated' )
|
295 |
);
|
connectors/updraftplus.php
CHANGED
@@ -30,7 +30,7 @@ class MainWP_WP_Stream_Connector_Updraftplus extends MainWP_WP_Stream_Connector
|
|
30 |
return $links;
|
31 |
}
|
32 |
|
33 |
-
public static function callback_updraftplus_backup($destination, $message, $status, $type, $backup_date) {
|
34 |
self::log(
|
35 |
$message,
|
36 |
compact('destination', 'status', 'type', 'backup_date'),
|
30 |
return $links;
|
31 |
}
|
32 |
|
33 |
+
public static function callback_updraftplus_backup($destination, $message, $status, $type, $backup_date) {
|
34 |
self::log(
|
35 |
$message,
|
36 |
compact('destination', 'status', 'type', 'backup_date'),
|
includes/admin.php
CHANGED
@@ -60,7 +60,8 @@ class MainWP_WP_Stream_Admin {
|
|
60 |
add_action( 'wp_ajax_mainwp_wp_stream_get_filter_value_by_id', array( __CLASS__, 'get_filter_value_by_id' ) );
|
61 |
|
62 |
add_filter('updraftplus_backup_complete', array( __CLASS__, 'hookUpdraftplusBackupComplete' ));
|
63 |
-
|
|
|
64 |
}
|
65 |
|
66 |
public static function get_branding_title() {
|
@@ -106,9 +107,9 @@ class MainWP_WP_Stream_Admin {
|
|
106 |
$record = current($items);
|
107 |
$updraftplus_last_backupdate = self::get_record_meta_data($record, 'backup_date');
|
108 |
}
|
109 |
-
|
110 |
foreach($backup_history as $date => $backup) {
|
111 |
-
if ($date > $updraftplus_last_backupdate) {
|
112 |
$message = "";
|
113 |
$backup_type = "";
|
114 |
if (isset($backup['db'])) {
|
@@ -144,30 +145,19 @@ class MainWP_WP_Stream_Admin {
|
|
144 |
// }
|
145 |
// $destination = rtrim($destination, ', ');
|
146 |
do_action("updraftplus_backup", $destination , $message, __('Finished', 'mainwp-child-reports'), $backup_type, $date);
|
|
|
147 |
}
|
148 |
}
|
149 |
|
150 |
}
|
151 |
|
152 |
}
|
|
|
153 |
}
|
154 |
|
155 |
-
public static function
|
156 |
-
|
157 |
-
$message = "BackupWordpres backup " . $backup->get_type() . ' finished';
|
158 |
-
$backup_type = $backup->get_type();
|
159 |
-
$destination = "N/A";
|
160 |
-
$file = $backup->get_archive_filepath();
|
161 |
-
if ( file_exists($file) ) {
|
162 |
-
$date = @filemtime( $file );
|
163 |
-
$size = @filesize( $file );
|
164 |
-
} else {
|
165 |
-
$date = $size = 0;
|
166 |
-
}
|
167 |
-
do_action("backupwordpress_backup", $destination , $message, 'finished', $backup_type, $date);
|
168 |
-
}
|
169 |
}
|
170 |
-
|
171 |
|
172 |
static function get_record_meta_data($record, $meta_key) {
|
173 |
|
@@ -189,22 +179,22 @@ class MainWP_WP_Stream_Admin {
|
|
189 |
return $value;
|
190 |
}
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
|
209 |
public static function admin_enqueue_scripts( $hook ) {
|
210 |
wp_register_script( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.min.js', array( 'jquery' ), '3.4.5', true );
|
60 |
add_action( 'wp_ajax_mainwp_wp_stream_get_filter_value_by_id', array( __CLASS__, 'get_filter_value_by_id' ) );
|
61 |
|
62 |
add_filter('updraftplus_backup_complete', array( __CLASS__, 'hookUpdraftplusBackupComplete' ));
|
63 |
+
// hmbkp_backup_complete
|
64 |
+
add_action('mainwp_client_reports_backups', array( __CLASS__, 'hookReportsBackups' ), 10, 1);
|
65 |
}
|
66 |
|
67 |
public static function get_branding_title() {
|
107 |
$record = current($items);
|
108 |
$updraftplus_last_backupdate = self::get_record_meta_data($record, 'backup_date');
|
109 |
}
|
110 |
+
$saved_date = array();
|
111 |
foreach($backup_history as $date => $backup) {
|
112 |
+
if ($date > $updraftplus_last_backupdate && !in_array($date, $saved_date)) {
|
113 |
$message = "";
|
114 |
$backup_type = "";
|
115 |
if (isset($backup['db'])) {
|
145 |
// }
|
146 |
// $destination = rtrim($destination, ', ');
|
147 |
do_action("updraftplus_backup", $destination , $message, __('Finished', 'mainwp-child-reports'), $backup_type, $date);
|
148 |
+
$saved_date[] = $date;
|
149 |
}
|
150 |
}
|
151 |
|
152 |
}
|
153 |
|
154 |
}
|
155 |
+
return $delete_jobdata;
|
156 |
}
|
157 |
|
158 |
+
public static function hookReportsBackups($ext_name = '') {
|
159 |
+
do_action('mainwp_extensions_reports_backups', $ext_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
|
|
161 |
|
162 |
static function get_record_meta_data($record, $meta_key) {
|
163 |
|
179 |
return $value;
|
180 |
}
|
181 |
|
182 |
+
public static function init_subpages($subPages = array()) {
|
183 |
+
if ( is_network_admin() && ! is_plugin_active_for_network( MAINWP_WP_STREAM_PLUGIN ) ) {
|
184 |
+
return $subPages;
|
185 |
+
}
|
186 |
+
|
187 |
+
$title = MainWP_WP_Stream_Admin::get_branding_title();
|
188 |
+
if (empty($title)) {
|
189 |
+
$title = 'Child Reports';
|
190 |
+
} else {
|
191 |
+
$title = self::$brandingTitle . ' Reports';
|
192 |
+
}
|
193 |
+
|
194 |
+
$subPages[] = array('title' => $title, 'slug' => 'reports-page' , 'callback' => array( __CLASS__, 'render_reports_page' ) , 'load_callback' => array( __CLASS__, 'register_list_table' ));
|
195 |
+
$subPages[] = array('title' => $title . ' Settings', 'slug' => 'reports-settings' , 'callback' => array( __CLASS__, 'render_reports_settings' ) );
|
196 |
+
return $subPages;
|
197 |
+
}
|
198 |
|
199 |
public static function admin_enqueue_scripts( $hook ) {
|
200 |
wp_register_script( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.min.js', array( 'jquery' ), '3.4.5', true );
|
includes/connector.php
CHANGED
@@ -53,12 +53,30 @@ abstract class MainWP_WP_Stream_Connector {
|
|
53 |
}
|
54 |
|
55 |
$created_timestamp = null;
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
$class = get_called_class();
|
64 |
|
53 |
}
|
54 |
|
55 |
$created_timestamp = null;
|
56 |
+
|
57 |
+
if (is_array($contexts)) {
|
58 |
+
$created_timestamp = 0;
|
59 |
+
$backup_context = '';
|
60 |
+
|
61 |
+
if ( isset($contexts['backwpup_backups']) ) {
|
62 |
+
$backup_context = 'backwpup_backups';
|
63 |
+
} elseif ( isset($contexts['backupwordpress_backups']) ) {
|
64 |
+
$backup_context = 'backupwordpress_backups';
|
65 |
+
} elseif ( isset($contexts['backupbuddy_backups']) ) {
|
66 |
+
$backup_context = 'backupbuddy_backups';
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( !empty($backup_context) ) {
|
70 |
+
$created_timestamp = is_array($args) && isset($args['backup_time']) ? $args['backup_time'] : null;
|
71 |
+
if (empty($created_timestamp) )
|
72 |
+
return;
|
73 |
+
|
74 |
+
$saved_item = MainWP_WP_Stream_Log::get_instance()->get_log( array( 'context' => $backup_context, 'created' => get_gmt_from_date( date("Y-m-d H:i:s", $created_timestamp ) ) ) );
|
75 |
+
|
76 |
+
if ($saved_item)
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
}
|
80 |
|
81 |
$class = get_called_class();
|
82 |
|
includes/connectors.php
CHANGED
@@ -28,7 +28,8 @@ class MainWP_WP_Stream_Connectors {
|
|
28 |
'widgets',
|
29 |
'updraftplus',
|
30 |
'backupwordpress',
|
31 |
-
'backwpup'
|
|
|
32 |
);
|
33 |
$classes = array();
|
34 |
foreach ( $connectors as $connector ) {
|
28 |
'widgets',
|
29 |
'updraftplus',
|
30 |
'backupwordpress',
|
31 |
+
'backwpup',
|
32 |
+
'backupbuddy'
|
33 |
);
|
34 |
$classes = array();
|
35 |
foreach ( $connectors as $connector ) {
|
includes/install.php
CHANGED
@@ -64,22 +64,6 @@ class MainWP_WP_Stream_Install {
|
|
64 |
|
65 |
public static function check_to_copy_data() {
|
66 |
$stream_db_version = get_site_option( 'wp_stream_db' ); // store db version of the plugin stream 1.4.9
|
67 |
-
// if (empty($stream_db_version)) {
|
68 |
-
// return;
|
69 |
-
// } else if (version_compare($stream_db_version, '1.4.9', '=')) {
|
70 |
-
// if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "stream'" ) !== $wpdb->prefix . "stream" )
|
71 |
-
// return;
|
72 |
-
// if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "stream_context'" ) !== $wpdb->prefix . "stream_context" )
|
73 |
-
// return;
|
74 |
-
// if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "stream_meta'" ) !== $wpdb->prefix . "stream_meta" )
|
75 |
-
// return;
|
76 |
-
// } else if (version_compare($stream_db_version, '3.0' , '>=')) {
|
77 |
-
// if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "stream'" ) !== $wpdb->prefix . "stream" )
|
78 |
-
// return;
|
79 |
-
// if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "stream_meta'" ) !== $wpdb->prefix . "stream_meta" )
|
80 |
-
// return;
|
81 |
-
// }
|
82 |
-
|
83 |
update_option('mainwp_child_reports_check_to_copy_data', 'yes');
|
84 |
return;
|
85 |
}
|
64 |
|
65 |
public static function check_to_copy_data() {
|
66 |
$stream_db_version = get_site_option( 'wp_stream_db' ); // store db version of the plugin stream 1.4.9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
update_option('mainwp_child_reports_check_to_copy_data', 'yes');
|
68 |
return;
|
69 |
}
|
includes/query.php
CHANGED
@@ -122,7 +122,24 @@ class MainWP_WP_Stream_Query {
|
|
122 |
if ( $args['visibility'] ) {
|
123 |
$where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.visibility = %s", $args['visibility'] );
|
124 |
}
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
/**
|
127 |
* PARSE DATE FILTERS
|
128 |
*/
|
122 |
if ( $args['visibility'] ) {
|
123 |
$where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.visibility = %s", $args['visibility'] );
|
124 |
}
|
125 |
+
|
126 |
+
if (isset($args['hide_child_reports']) && $args['hide_child_reports']) {
|
127 |
+
$child_record_ids = array();
|
128 |
+
$sql_meta = "SELECT record_id FROM $wpdb->mainwp_reportsmeta WHERE meta_key = 'slug' AND (meta_value = 'mainwp-child/mainwp-child.php' OR meta_value = 'mainwp-child-reports/mainwp-child-reports.php')";
|
129 |
+
$ret = $wpdb->get_results( $sql_meta, 'ARRAY_A' );
|
130 |
+
|
131 |
+
error_log(print_r($ret, true));
|
132 |
+
|
133 |
+
if (is_array($ret) && count($ret)> 0) {
|
134 |
+
foreach($ret as $val) {
|
135 |
+
$child_record_ids[] = $val['record_id'];
|
136 |
+
}
|
137 |
+
}
|
138 |
+
if (count($child_record_ids) > 0) {
|
139 |
+
$where .= " AND $wpdb->mainwp_reports.ID NOT IN (" . implode(",", $child_record_ids). ") ";
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
/**
|
144 |
* PARSE DATE FILTERS
|
145 |
*/
|
mainwp-child-reports.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
-
Version: 1.
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -33,11 +33,11 @@ class MainWP_WP_Stream {
|
|
33 |
public static $instance;
|
34 |
|
35 |
public $db = null;
|
36 |
-
|
37 |
public $network = null;
|
38 |
|
39 |
public static $notices = array();
|
40 |
-
|
41 |
private function __construct() {
|
42 |
define( 'MAINWP_WP_STREAM_PLUGIN', plugin_basename( __FILE__ ) );
|
43 |
define( 'MAINWP_WP_STREAM_DIR', plugin_dir_path( __FILE__ ) );
|
@@ -82,10 +82,7 @@ class MainWP_WP_Stream {
|
|
82 |
// Load query class
|
83 |
require_once MAINWP_WP_STREAM_INC_DIR . 'query.php';
|
84 |
require_once MAINWP_WP_STREAM_INC_DIR . 'context-query.php';
|
85 |
-
|
86 |
-
// Add frontend indicator
|
87 |
-
add_action( 'wp_head', array( $this, 'frontend_indicator' ) );
|
88 |
-
|
89 |
if ( is_admin() ) {
|
90 |
require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
|
91 |
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Admin', 'load' ) );
|
@@ -99,7 +96,12 @@ class MainWP_WP_Stream {
|
|
99 |
|
100 |
require_once MAINWP_WP_STREAM_INC_DIR . 'live-update.php';
|
101 |
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Live_Update', 'load' ) );
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
}
|
@@ -170,8 +172,8 @@ class MainWP_WP_Stream {
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
|
174 |
-
|
175 |
MainWP_WP_Stream_Admin::register_update_hook( dirname( plugin_basename( __FILE__ ) ), array( __CLASS__, 'install' ), self::VERSION );
|
176 |
}
|
177 |
|
@@ -203,16 +205,6 @@ class MainWP_WP_Stream {
|
|
203 |
}
|
204 |
}
|
205 |
|
206 |
-
public function frontend_indicator() {
|
207 |
-
$comment = sprintf( 'Stream WordPress user activity plugin v%s', esc_html( self::VERSION ) ); // Localization not needed
|
208 |
-
|
209 |
-
$comment = apply_filters( 'mainwp_wp_stream_frontend_indicator', $comment );
|
210 |
-
|
211 |
-
if ( ! empty( $comment ) ) {
|
212 |
-
echo sprintf( "<!-- %s -->\n", esc_html( $comment ) ); // xss ok
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
public static function get_instance() {
|
217 |
if ( empty( self::$instance ) ) {
|
218 |
$class = __CLASS__;
|
@@ -221,7 +213,92 @@ class MainWP_WP_Stream {
|
|
221 |
|
222 |
return self::$instance;
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
if ( MainWP_WP_Stream::is_valid_php_version() ) {
|
5 |
Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
+
Version: 1.2
|
9 |
*/
|
10 |
|
11 |
/**
|
33 |
public static $instance;
|
34 |
|
35 |
public $db = null;
|
36 |
+
private $plugin_slug;
|
37 |
public $network = null;
|
38 |
|
39 |
public static $notices = array();
|
40 |
+
|
41 |
private function __construct() {
|
42 |
define( 'MAINWP_WP_STREAM_PLUGIN', plugin_basename( __FILE__ ) );
|
43 |
define( 'MAINWP_WP_STREAM_DIR', plugin_dir_path( __FILE__ ) );
|
82 |
// Load query class
|
83 |
require_once MAINWP_WP_STREAM_INC_DIR . 'query.php';
|
84 |
require_once MAINWP_WP_STREAM_INC_DIR . 'context-query.php';
|
85 |
+
$this->plugin_slug = plugin_basename( __FILE__ );
|
|
|
|
|
|
|
86 |
if ( is_admin() ) {
|
87 |
require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
|
88 |
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Admin', 'load' ) );
|
96 |
|
97 |
require_once MAINWP_WP_STREAM_INC_DIR . 'live-update.php';
|
98 |
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Live_Update', 'load' ) );
|
99 |
+
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
100 |
+
// branding proccess
|
101 |
+
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
102 |
+
if ( !$cancelled_branding ) {
|
103 |
+
add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
|
104 |
+
}
|
105 |
}
|
106 |
|
107 |
}
|
172 |
}
|
173 |
}
|
174 |
}
|
175 |
+
|
176 |
+
static function update_activation_hook() {
|
177 |
MainWP_WP_Stream_Admin::register_update_hook( dirname( plugin_basename( __FILE__ ) ), array( __CLASS__, 'install' ), self::VERSION );
|
178 |
}
|
179 |
|
205 |
}
|
206 |
}
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
public static function get_instance() {
|
209 |
if ( empty( self::$instance ) ) {
|
210 |
$class = __CLASS__;
|
213 |
|
214 |
return self::$instance;
|
215 |
}
|
216 |
+
|
217 |
+
public function branding_child_plugin( $plugins ) {
|
218 |
+
if ( 'T' === get_option( 'mainwp_branding_child_hide' ) ) {
|
219 |
+
foreach ( $plugins as $key => $value ) {
|
220 |
+
$plugin_slug = basename( $key, '.php' );
|
221 |
+
if ( 'mainwp-child-reports' === $plugin_slug ) {
|
222 |
+
unset( $plugins[ $key ] );
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
return $plugins;
|
227 |
+
}
|
228 |
+
|
229 |
+
$header = get_option( 'mainwp_branding_plugin_header' );
|
230 |
+
if ( is_array( $header ) && ! empty( $header['name'] ) ) {
|
231 |
+
return $this->update_child_header( $plugins, $header );
|
232 |
+
} else {
|
233 |
+
return $plugins;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
public function plugin_row_meta( $plugin_meta, $plugin_file ) {
|
238 |
+
if ( $this->plugin_slug !== $plugin_file ) {
|
239 |
+
return $plugin_meta;
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( ! self::is_branding() ) {
|
243 |
+
return $plugin_meta;
|
244 |
+
}
|
245 |
+
// hide View details links
|
246 |
+
$meta_total = count( $plugin_meta );
|
247 |
+
for ( $i = 0; $i < $meta_total; $i++ ) {
|
248 |
+
$str_meta = $plugin_meta[ $i ];
|
249 |
+
if ( strpos( $str_meta, 'plugin-install.php?tab=plugin-information' ) ) {
|
250 |
+
unset( $plugin_meta[ $i ] );
|
251 |
+
break;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
return $plugin_meta;
|
256 |
+
}
|
257 |
+
|
258 |
+
public static function is_branding() {
|
259 |
+
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
260 |
+
if ( $cancelled_branding ) {
|
261 |
+
return false;
|
262 |
+
}
|
263 |
+
|
264 |
+
// hide
|
265 |
+
if ( 'T' === get_option( 'mainwp_branding_child_hide' ) ) {
|
266 |
+
return true;
|
267 |
+
}
|
268 |
+
// branding
|
269 |
+
$header = get_option( 'mainwp_branding_plugin_header' );
|
270 |
+
if ( is_array( $header ) && ! empty( $header['name'] ) ) {
|
271 |
+
return true;
|
272 |
+
}
|
273 |
|
274 |
+
return false;
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
public function update_child_header( $plugins, $header ) {
|
279 |
+
$plugin_key = '';
|
280 |
+
foreach ( $plugins as $key => $value ) {
|
281 |
+
$plugin_slug = basename( $key, '.php' );
|
282 |
+
if ( 'mainwp-child-reports' === $plugin_slug ) {
|
283 |
+
$plugin_key = $key;
|
284 |
+
$plugin_data = $value;
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
if ( ! empty( $plugin_key ) ) {
|
289 |
+
$plugin_data['Name'] = stripslashes( $header['name'] . " reports" );
|
290 |
+
$plugin_data['Description'] = stripslashes( $header['description'] );
|
291 |
+
$plugin_data['Author'] = stripslashes( $header['author'] );
|
292 |
+
$plugin_data['AuthorURI'] = stripslashes( $header['authoruri'] );
|
293 |
+
if ( ! empty( $header['pluginuri'] ) ) {
|
294 |
+
$plugin_data['PluginURI'] = stripslashes( $header['pluginuri'] );
|
295 |
+
}
|
296 |
+
$plugins[ $plugin_key ] = $plugin_data;
|
297 |
+
}
|
298 |
+
|
299 |
+
return $plugins;
|
300 |
+
}
|
301 |
+
|
302 |
}
|
303 |
|
304 |
if ( MainWP_WP_Stream::is_valid_php_version() ) {
|
readme.txt
CHANGED
@@ -6,8 +6,8 @@ Author: mainwp
|
|
6 |
Author URI: https://mainwp.com
|
7 |
Plugin URI: https://mainwp.com
|
8 |
Requires at least: 3.6
|
9 |
-
Tested up to: 4.
|
10 |
-
Stable tag: 1.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -36,6 +36,14 @@ Credit to the [Stream Plugin](https://wordpress.org/plugins/stream/) which the M
|
|
36 |
|
37 |
== Changelog ==
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
= 1.1 - 4-28-2016 =
|
40 |
* Updated: Support for the MainWP Child Plugin version 3.1.3
|
41 |
|
6 |
Author URI: https://mainwp.com
|
7 |
Plugin URI: https://mainwp.com
|
8 |
Requires at least: 3.6
|
9 |
+
Tested up to: 4.6.1
|
10 |
+
Stable tag: 1.2
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
36 |
|
37 |
== Changelog ==
|
38 |
|
39 |
+
= 1.2 - 11-9-2016 =
|
40 |
+
* Fixed: Issue with hiding the plugin in Client Reports
|
41 |
+
* Fixed: Conflict with the auto backup feature of the UpdraftPlus Backups plugin (#8435)
|
42 |
+
* Fixed: Issue with double records for the UpdraftPlus backups
|
43 |
+
* Fixed: Issue with recorging UpdraftPlus and BackUpWordPress backups
|
44 |
+
* Added: Support for the BackupBuddy plugin
|
45 |
+
* Added: Support for the MainWP Branding (#10609)
|
46 |
+
|
47 |
= 1.1 - 4-28-2016 =
|
48 |
* Updated: Support for the MainWP Child Plugin version 3.1.3
|
49 |
|