Version Description
- 2-9-2017 =
- Fixed: an issue with recording duplicate values for UpdraftPlus backups
- Fixed: multiple issues with recording backups made by supported plugins
- Fixed: an issue with recording incorrect values for plugins and themes versions
- Added: support for Wordfence tokens
- Added: support for Maintanence tokens
- Added: support for Page Speed tokens
- Added: support for Broken Links tokens
- Updated: system compatibility udpates required by upcoming MainWP Client Reports Extension versoin
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child Reports |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- connectors/installer.php +17 -8
- connectors/maintenance.php +41 -0
- connectors/posts.php +20 -1
- connectors/wordfence.php +41 -0
- includes/admin.php +59 -72
- includes/connector.php +36 -8
- includes/connectors.php +3 -1
- includes/db.php +2 -0
- includes/install.php +40 -7
- includes/list-table.php +4 -3
- includes/live-update.php +1 -1
- includes/query.php +10 -7
- includes/settings.php +45 -15
- mainwp-child-reports.php +23 -24
- readme.txt +14 -4
- ui/admin.js +3 -2
connectors/installer.php
CHANGED
@@ -54,6 +54,16 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
54 |
return $links;
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
public static function callback_mainwp_child_installPluginTheme($args ) {
|
58 |
$logs = array();
|
59 |
$success = isset($args['success']) ? $args['success'] : 0;
|
@@ -215,13 +225,12 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
215 |
} else {
|
216 |
$slugs = array( $upgrader->skin->plugin );
|
217 |
}
|
218 |
-
|
219 |
foreach ( $slugs as $slug ) {
|
220 |
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $slug );
|
221 |
$name = $plugin_data['Name'];
|
222 |
$version = $plugin_data['Version'];
|
223 |
-
$old_version = $
|
224 |
-
|
225 |
$logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
|
226 |
}
|
227 |
} else { // theme
|
@@ -235,11 +244,11 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
235 |
$stylesheet = $theme['Stylesheet Dir'] . '/style.css';
|
236 |
$theme_data = get_file_data( $stylesheet, array( 'Version' => 'Version' ) );
|
237 |
$name = $theme['Name'];
|
238 |
-
|
239 |
$version = $theme_data['Version'];
|
240 |
|
241 |
$logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
|
242 |
-
}
|
243 |
}
|
244 |
} else {
|
245 |
return false;
|
@@ -264,7 +273,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
264 |
}
|
265 |
|
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(
|
@@ -280,7 +289,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
280 |
}
|
281 |
|
282 |
public static function callback_deactivate_plugin( $slug, $network_wide ) {
|
283 |
-
$plugins = get_plugins();
|
284 |
$name = $plugins[ $slug ]['Name'];
|
285 |
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
286 |
self::log(
|
@@ -338,7 +347,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
|
|
338 |
return false;
|
339 |
}
|
340 |
|
341 |
-
$_plugins = get_plugins();
|
342 |
|
343 |
foreach ( $plugins as $plugin ) {
|
344 |
$plugins_to_delete[ $plugin ] = $_plugins[ $plugin ];
|
54 |
return $links;
|
55 |
}
|
56 |
|
57 |
+
|
58 |
+
public static function get_plugins() {
|
59 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
60 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
61 |
+
}
|
62 |
+
|
63 |
+
return get_plugins();
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
public static function callback_mainwp_child_installPluginTheme($args ) {
|
68 |
$logs = array();
|
69 |
$success = isset($args['success']) ? $args['success'] : 0;
|
225 |
} else {
|
226 |
$slugs = array( $upgrader->skin->plugin );
|
227 |
}
|
228 |
+
|
229 |
foreach ( $slugs as $slug ) {
|
230 |
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $slug );
|
231 |
$name = $plugin_data['Name'];
|
232 |
$version = $plugin_data['Version'];
|
233 |
+
$old_version = $upgrader->skin->plugin_info['Version']; // to fix old version
|
|
|
234 |
$logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
|
235 |
}
|
236 |
} else { // theme
|
244 |
$stylesheet = $theme['Stylesheet Dir'] . '/style.css';
|
245 |
$theme_data = get_file_data( $stylesheet, array( 'Version' => 'Version' ) );
|
246 |
$name = $theme['Name'];
|
247 |
+
$old_version = $upgrader->skin->theme_info->get('Version'); // to fix old version //$theme['Version'];
|
248 |
$version = $theme_data['Version'];
|
249 |
|
250 |
$logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
|
251 |
+
}
|
252 |
}
|
253 |
} else {
|
254 |
return false;
|
273 |
}
|
274 |
|
275 |
public static function callback_activate_plugin( $slug, $network_wide ) {
|
276 |
+
$plugins = self::get_plugins();
|
277 |
$name = $plugins[ $slug ]['Name'];
|
278 |
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
279 |
self::log(
|
289 |
}
|
290 |
|
291 |
public static function callback_deactivate_plugin( $slug, $network_wide ) {
|
292 |
+
$plugins = self::get_plugins();
|
293 |
$name = $plugins[ $slug ]['Name'];
|
294 |
$network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
|
295 |
self::log(
|
347 |
return false;
|
348 |
}
|
349 |
|
350 |
+
$_plugins = self::get_plugins();
|
351 |
|
352 |
foreach ( $plugins as $plugin ) {
|
353 |
$plugins_to_delete[ $plugin ] = $_plugins[ $plugin ];
|
connectors/maintenance.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MainWP_WP_Stream_Connector_Maintenance extends MainWP_WP_Stream_Connector {
|
4 |
+
|
5 |
+
public static $name = 'mainwp_maintenance';
|
6 |
+
|
7 |
+
public static $actions = array(
|
8 |
+
'mainwp_reports_maintenance',
|
9 |
+
);
|
10 |
+
|
11 |
+
public static function get_label() {
|
12 |
+
return __( 'Maintenance', 'default' );
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function get_action_labels() {
|
16 |
+
return array(
|
17 |
+
'mainwp_reports_maintenance' => __( 'Maintenance', 'default' ),
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
public static function get_context_labels() {
|
22 |
+
return array(
|
23 |
+
'mainwp_maintenances' => __( 'Maintenance', 'default' ),
|
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_maintenance( $message, $log_time, $details, $result = '') {
|
34 |
+
self::log(
|
35 |
+
$message,
|
36 |
+
compact('log_time', 'details' , 'result'),
|
37 |
+
0,
|
38 |
+
array( 'mainwp_maintenances' => 'mainwp_reports_maintenance' )
|
39 |
+
);
|
40 |
+
}
|
41 |
+
}
|
connectors/posts.php
CHANGED
@@ -168,7 +168,26 @@ class MainWP_WP_Stream_Connector_Posts extends MainWP_WP_Stream_Connector {
|
|
168 |
}
|
169 |
|
170 |
$post_type_name = strtolower( self::get_post_type_name( $post->post_type ) );
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
self::log(
|
173 |
$message,
|
174 |
array(
|
168 |
}
|
169 |
|
170 |
$post_type_name = strtolower( self::get_post_type_name( $post->post_type ) );
|
171 |
+
|
172 |
+
if ($action == 'updated' && ($post->post_type == 'page' || $post->post_type == 'post')) {
|
173 |
+
$report_settings = get_option('mainwp_wp_stream', array());
|
174 |
+
$minutes = is_array($report_settings) && isset($report_settings['general_period_of_time']) ? $report_settings['general_period_of_time'] : 30;
|
175 |
+
if (!empty($minutes) && intval($minutes) > 0) {
|
176 |
+
$args = array();
|
177 |
+
$args['object_id'] = $post->ID;
|
178 |
+
$date_from = time() - $minutes * 60;
|
179 |
+
$args['datetime_from'] = date( 'Y-m-d H:i:s', $date_from );
|
180 |
+
$args['context'] = $post->post_type;
|
181 |
+
$args['action'] = 'updated';
|
182 |
+
$args['records_per_page'] = 9999;
|
183 |
+
$args['orderby'] = 'created';
|
184 |
+
$args['order'] = 'desc';
|
185 |
+
$items = mainwp_wp_stream_query( $args );
|
186 |
+
if (count($items) > 0)
|
187 |
+
return;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
self::log(
|
192 |
$message,
|
193 |
array(
|
connectors/wordfence.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MainWP_WP_Stream_Connector_Wordfence extends MainWP_WP_Stream_Connector {
|
4 |
+
|
5 |
+
public static $name = 'wordfence_scan';
|
6 |
+
|
7 |
+
public static $actions = array(
|
8 |
+
'mainwp_reports_wordfence_scan',
|
9 |
+
);
|
10 |
+
|
11 |
+
public static function get_label() {
|
12 |
+
return __( 'Wordfence', 'default' );
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function get_action_labels() {
|
16 |
+
return array(
|
17 |
+
'mainwp_reports_wordfence_scan' => __( 'Wordfence scan', 'default' ),
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
public static function get_context_labels() {
|
22 |
+
return array(
|
23 |
+
'wordfence_scans' => __( 'Wordfence scan', '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_wordfence_scan( $message, $scan_time, $details, $result = '') {
|
34 |
+
self::log(
|
35 |
+
$message,
|
36 |
+
compact('scan_time', 'result', 'details'),
|
37 |
+
0,
|
38 |
+
array( 'wordfence_scans' => 'mainwp_reports_wordfence_scan' )
|
39 |
+
);
|
40 |
+
}
|
41 |
+
}
|
includes/admin.php
CHANGED
@@ -59,16 +59,16 @@ class MainWP_WP_Stream_Admin {
|
|
59 |
// Ajax author's name by ID
|
60 |
add_action( 'wp_ajax_mainwp_wp_stream_get_filter_value_by_id', array( __CLASS__, 'get_filter_value_by_id' ) );
|
61 |
|
62 |
-
add_filter('
|
63 |
// hmbkp_backup_complete
|
64 |
-
add_action('
|
65 |
}
|
66 |
|
67 |
public static function get_branding_title() {
|
68 |
if (self::$brandingTitle === null) {
|
69 |
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
70 |
$branding_header = get_option( 'mainwp_branding_plugin_header' );
|
71 |
-
if ( ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) )
|
72 |
self::$brandingTitle = stripslashes( $branding_header['name'] );
|
73 |
} else {
|
74 |
self::$brandingTitle = '';
|
@@ -90,73 +90,50 @@ class MainWP_WP_Stream_Admin {
|
|
90 |
}
|
91 |
}
|
92 |
|
93 |
-
public static function
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$
|
100 |
-
$
|
101 |
-
$args['orderby'] = 'created';
|
102 |
-
$args['order'] = 'desc';
|
103 |
-
$items = mainwp_wp_stream_query( $args );
|
104 |
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
$
|
|
|
109 |
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$message = "";
|
114 |
-
$backup_type = "";
|
115 |
-
if (isset($backup['db'])) {
|
116 |
-
$message .= "database, ";
|
117 |
-
$backup_type .= "database, ";
|
118 |
-
}
|
119 |
-
if (isset($backup['plugins'])) {
|
120 |
-
$message .= "plugins, ";
|
121 |
-
$backup_type .= "plugins, ";
|
122 |
-
}
|
123 |
-
|
124 |
-
if (isset($backup['themes'])) {
|
125 |
-
$message .= "themes, ";
|
126 |
-
$backup_type .= "themes, ";
|
127 |
-
}
|
128 |
-
|
129 |
-
$message = rtrim($message, ', ');
|
130 |
-
$message = "Updraftplus backup " . $message ." finished";
|
131 |
-
|
132 |
-
$backup_type = rtrim($backup_type, ', ');
|
133 |
-
|
134 |
-
$size = "N/A";
|
135 |
-
if (isset($backup['db-size'])) {
|
136 |
-
$size = $backup['db-size'];
|
137 |
-
} else if (isset($backup['themes-size'])) {
|
138 |
-
$size = $backup['themes-size'];
|
139 |
-
}
|
140 |
-
$destination = "";
|
141 |
-
// if (isset($backup['service']) && is_array($backup['service'])) {
|
142 |
-
// foreach($backup['service'] as $ser) {
|
143 |
-
// $destination .= $ser . ", ";
|
144 |
-
// }
|
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 $
|
156 |
}
|
157 |
|
158 |
-
public static function
|
159 |
-
do_action('
|
160 |
}
|
161 |
|
162 |
static function get_record_meta_data($record, $meta_key) {
|
@@ -184,15 +161,15 @@ class MainWP_WP_Stream_Admin {
|
|
184 |
return $subPages;
|
185 |
}
|
186 |
|
187 |
-
$
|
188 |
-
if (empty($
|
189 |
-
$
|
190 |
} else {
|
191 |
-
$
|
192 |
}
|
193 |
|
194 |
-
$subPages[] = array('title' => $
|
195 |
-
$subPages[] = array('title' => $
|
196 |
return $subPages;
|
197 |
}
|
198 |
|
@@ -296,7 +273,11 @@ class MainWP_WP_Stream_Admin {
|
|
296 |
|
297 |
public static function register_list_table() {
|
298 |
require_once MAINWP_WP_STREAM_INC_DIR . 'list-table.php';
|
299 |
-
|
|
|
|
|
|
|
|
|
300 |
}
|
301 |
|
302 |
public static function render_reports_page() {
|
@@ -448,7 +429,7 @@ class MainWP_WP_Stream_Admin {
|
|
448 |
if ( is_multisite() && ! is_plugin_active_for_network( MAINWP_WP_STREAM_PLUGIN ) ) {
|
449 |
$where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() );
|
450 |
}
|
451 |
-
|
452 |
$wpdb->query(
|
453 |
$wpdb->prepare(
|
454 |
"DELETE `stream`, `context`, `meta`
|
@@ -515,6 +496,12 @@ class MainWP_WP_Stream_Admin {
|
|
515 |
}
|
516 |
|
517 |
public static function ajax_filters() {
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
switch ( mainwp_wp_stream_filter_input( INPUT_GET, 'filter' ) ) {
|
519 |
case 'author':
|
520 |
$users = array_merge(
|
59 |
// Ajax author's name by ID
|
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_save_last_backup', array( __CLASS__, 'hookUpdraftplusSaveLastBackup' ));
|
63 |
// hmbkp_backup_complete
|
64 |
+
add_action('mainwp_child_reports_log', array( __CLASS__, 'hook_reports_log' ), 10, 1);
|
65 |
}
|
66 |
|
67 |
public static function get_branding_title() {
|
68 |
if (self::$brandingTitle === null) {
|
69 |
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
70 |
$branding_header = get_option( 'mainwp_branding_plugin_header' );
|
71 |
+
if ( ! $cancelled_branding && ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) ) {
|
72 |
self::$brandingTitle = stripslashes( $branding_header['name'] );
|
73 |
} else {
|
74 |
self::$brandingTitle = '';
|
90 |
}
|
91 |
}
|
92 |
|
93 |
+
public static function hookUpdraftplusSaveLastBackup($last_backup) {
|
94 |
+
|
95 |
+
if (!is_array($last_backup))
|
96 |
+
return $last_backup;
|
97 |
+
|
98 |
+
if (isset($last_backup['backup_time'])) {
|
99 |
+
$date = $last_backup['backup_time'];
|
100 |
+
$backup = $last_backup['backup_array'];
|
|
|
|
|
|
|
101 |
|
102 |
+
$message = "";
|
103 |
+
$backup_type = "";
|
104 |
+
if (isset($backup['db'])) {
|
105 |
+
$message .= "database, ";
|
106 |
+
$backup_type .= "database, ";
|
107 |
}
|
108 |
+
if (isset($backup['plugins'])) {
|
109 |
+
$message .= "plugins, ";
|
110 |
+
$backup_type .= "plugins, ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
+
|
113 |
+
if (isset($backup['themes'])) {
|
114 |
+
$message .= "themes, ";
|
115 |
+
$backup_type .= "themes, ";
|
116 |
+
}
|
117 |
+
|
118 |
+
$message = rtrim($message, ', ');
|
119 |
+
$message = "Updraftplus backup " . $message ." finished";
|
120 |
+
|
121 |
+
$backup_type = rtrim($backup_type, ', ');
|
122 |
+
|
123 |
+
$size = "N/A";
|
124 |
+
if (isset($backup['db-size'])) {
|
125 |
+
$size = $backup['db-size'];
|
126 |
+
} else if (isset($backup['themes-size'])) {
|
127 |
+
$size = $backup['themes-size'];
|
128 |
+
}
|
129 |
+
$destination = "";
|
130 |
+
do_action("updraftplus_backup", $destination , $message, __('Finished', 'mainwp-child-reports'), $backup_type, $date);
|
131 |
}
|
132 |
+
return $last_backup;
|
133 |
}
|
134 |
|
135 |
+
public static function hook_reports_log($ext_name = '') {
|
136 |
+
do_action('mainwp_child_log', $ext_name);
|
137 |
}
|
138 |
|
139 |
static function get_record_meta_data($record, $meta_key) {
|
161 |
return $subPages;
|
162 |
}
|
163 |
|
164 |
+
$branding_text = MainWP_WP_Stream_Admin::get_branding_title();
|
165 |
+
if (empty($branding_text)) {
|
166 |
+
$branding_text = 'Child Reports';
|
167 |
} else {
|
168 |
+
$branding_text = $branding_text . ' Reports';
|
169 |
}
|
170 |
|
171 |
+
$subPages[] = array('title' => $branding_text, 'slug' => 'reports-page' , 'callback' => array( __CLASS__, 'render_reports_page' ) , 'load_callback' => array( __CLASS__, 'register_list_table' ));
|
172 |
+
$subPages[] = array('title' => $branding_text . ' Settings', 'slug' => 'reports-settings' , 'callback' => array( __CLASS__, 'render_reports_settings' ) );
|
173 |
return $subPages;
|
174 |
}
|
175 |
|
273 |
|
274 |
public static function register_list_table() {
|
275 |
require_once MAINWP_WP_STREAM_INC_DIR . 'list-table.php';
|
276 |
+
$param = array();
|
277 |
+
if (isset(self::$screen_id['main'])) {
|
278 |
+
$param['screen'] = self::$screen_id['main'];
|
279 |
+
}
|
280 |
+
self::$list_table = new MainWP_WP_Stream_List_Table( $param );
|
281 |
}
|
282 |
|
283 |
public static function render_reports_page() {
|
429 |
if ( is_multisite() && ! is_plugin_active_for_network( MAINWP_WP_STREAM_PLUGIN ) ) {
|
430 |
$where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() );
|
431 |
}
|
432 |
+
|
433 |
$wpdb->query(
|
434 |
$wpdb->prepare(
|
435 |
"DELETE `stream`, `context`, `meta`
|
496 |
}
|
497 |
|
498 |
public static function ajax_filters() {
|
499 |
+
if ( ! defined( 'DOING_AJAX' ) ) {
|
500 |
+
wp_die( '-1' );
|
501 |
+
}
|
502 |
+
|
503 |
+
check_ajax_referer( 'mainwp_creport_filters_user_search_nonce', 'nonce' );
|
504 |
+
|
505 |
switch ( mainwp_wp_stream_filter_input( INPUT_GET, 'filter' ) ) {
|
506 |
case 'author':
|
507 |
$users = array_merge(
|
includes/connector.php
CHANGED
@@ -54,24 +54,52 @@ abstract class MainWP_WP_Stream_Connector {
|
|
54 |
|
55 |
$created_timestamp = null;
|
56 |
|
57 |
-
if (is_array($contexts)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
$created_timestamp = 0;
|
59 |
-
$
|
60 |
|
61 |
if ( isset($contexts['backwpup_backups']) ) {
|
62 |
-
$
|
63 |
} elseif ( isset($contexts['backupwordpress_backups']) ) {
|
64 |
-
$
|
65 |
} elseif ( isset($contexts['backupbuddy_backups']) ) {
|
66 |
-
$
|
|
|
|
|
67 |
}
|
68 |
|
69 |
-
if ( !empty($
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
if (empty($created_timestamp) )
|
72 |
return;
|
73 |
|
74 |
-
$saved_item = MainWP_WP_Stream_Log::get_instance()->get_log( array( 'context' => $
|
75 |
|
76 |
if ($saved_item)
|
77 |
return;
|
54 |
|
55 |
$created_timestamp = null;
|
56 |
|
57 |
+
if (is_array($contexts) && is_array($args)) {
|
58 |
+
|
59 |
+
if (isset($contexts['plugins']) && !empty($contexts['plugins']) ) {
|
60 |
+
if (isset($args['slug']) && ( $args['slug'] == 'mainwp-child/mainwp-child.php' || $args['slug'] == 'mainwp-child-reports/mainwp-child-reports.php' )) {
|
61 |
+
$hide_child_plugins = get_option('mainwp_creport_hide_child_plugins', 'yes');
|
62 |
+
if ($hide_child_plugins == 'yes') {
|
63 |
+
return false;
|
64 |
+
} else {
|
65 |
+
$branding_text = MainWP_WP_Stream_Admin::get_branding_title();
|
66 |
+
if (!empty($branding_text)) {
|
67 |
+
if ($args['slug'] == 'mainwp-child/mainwp-child.php') {
|
68 |
+
$args['name'] = $branding_text;
|
69 |
+
} else {
|
70 |
+
$args['name'] = $branding_text . ' Reports';
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
$created_timestamp = 0;
|
78 |
+
$child_context = '';
|
79 |
|
80 |
if ( isset($contexts['backwpup_backups']) ) {
|
81 |
+
$child_context = 'backwpup_backups';
|
82 |
} elseif ( isset($contexts['backupwordpress_backups']) ) {
|
83 |
+
$child_context = 'backupwordpress_backups';
|
84 |
} elseif ( isset($contexts['backupbuddy_backups']) ) {
|
85 |
+
$child_context = 'backupbuddy_backups';
|
86 |
+
} elseif ( isset($contexts['wordfence_scans']) ) {
|
87 |
+
$child_context = 'wordfence_scans';
|
88 |
}
|
89 |
|
90 |
+
if ( !empty($child_context) ) {
|
91 |
+
if (is_array($args)) {
|
92 |
+
if (isset($args['backup_time'])) {
|
93 |
+
$created_timestamp = $args['backup_time'];
|
94 |
+
} else if (isset($args['scan_time'])) {
|
95 |
+
$created_timestamp = $args['scan_time'];
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
if (empty($created_timestamp) )
|
100 |
return;
|
101 |
|
102 |
+
$saved_item = MainWP_WP_Stream_Log::get_instance()->get_log( array( 'context' => $child_context, 'created' => date("Y-m-d H:i:s", $created_timestamp ) ) );
|
103 |
|
104 |
if ($saved_item)
|
105 |
return;
|
includes/connectors.php
CHANGED
@@ -29,7 +29,9 @@ class MainWP_WP_Stream_Connectors {
|
|
29 |
'updraftplus',
|
30 |
'backupwordpress',
|
31 |
'backwpup',
|
32 |
-
'backupbuddy'
|
|
|
|
|
33 |
);
|
34 |
$classes = array();
|
35 |
foreach ( $connectors as $connector ) {
|
29 |
'updraftplus',
|
30 |
'backupwordpress',
|
31 |
'backwpup',
|
32 |
+
'backupbuddy',
|
33 |
+
'wordfence',
|
34 |
+
'maintenance',
|
35 |
);
|
36 |
$classes = array();
|
37 |
foreach ( $connectors as $connector ) {
|
includes/db.php
CHANGED
@@ -87,6 +87,8 @@ class MainWP_WP_Stream_DB {
|
|
87 |
}
|
88 |
foreach ( (array) $vals as $val ) {
|
89 |
$val = maybe_serialize( $val );
|
|
|
|
|
90 |
$this->insert_meta( $record_id, $key, $val );
|
91 |
}
|
92 |
}
|
87 |
}
|
88 |
foreach ( (array) $vals as $val ) {
|
89 |
$val = maybe_serialize( $val );
|
90 |
+
if (empty($val))
|
91 |
+
continue;
|
92 |
$this->insert_meta( $record_id, $key, $val );
|
93 |
}
|
94 |
}
|
includes/install.php
CHANGED
@@ -46,14 +46,31 @@ class MainWP_WP_Stream_Install {
|
|
46 |
return;
|
47 |
}
|
48 |
|
49 |
-
global $wpdb;
|
50 |
-
|
|
|
|
|
|
|
51 |
self::$db_version = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
if ( empty( self::$db_version ) ) {
|
54 |
self::install( self::$current );
|
55 |
self::copy_stream_db();
|
56 |
-
} elseif ( version_compare( self::$db_version, self::$current, '!=') ) {
|
|
|
57 |
update_site_option( self::KEY, self::$current );
|
58 |
}
|
59 |
|
@@ -322,11 +339,10 @@ class MainWP_WP_Stream_Install {
|
|
322 |
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
323 |
record_id bigint(20) unsigned NOT NULL,
|
324 |
meta_key varchar(200) NOT NULL,
|
325 |
-
meta_value
|
326 |
PRIMARY KEY (meta_id),
|
327 |
-
KEY record_id (record_id),
|
328 |
-
KEY meta_key (meta_key)
|
329 |
-
KEY meta_value (meta_value)
|
330 |
)";
|
331 |
|
332 |
if ( ! empty( $wpdb->charset ) ) {
|
@@ -345,4 +361,21 @@ class MainWP_WP_Stream_Install {
|
|
345 |
|
346 |
return $current;
|
347 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
}
|
46 |
return;
|
47 |
}
|
48 |
|
49 |
+
global $wpdb;
|
50 |
+
|
51 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "mainwp_stream'" ) !== $wpdb->prefix . "mainwp_stream" ||
|
52 |
+
$wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "mainwp_stream_meta'" ) !== $wpdb->prefix . "mainwp_stream_meta"
|
53 |
+
) {
|
54 |
self::$db_version = false;
|
55 |
+
} else {
|
56 |
+
if (false === get_option('mainwp_creport_first_time_activated')) {
|
57 |
+
$sql = "SELECT MIN( created ) AS first_time " .
|
58 |
+
"FROM {$wpdb->prefix}mainwp_stream " .
|
59 |
+
"WHERE created != '0000-00-00 00:00:00'";
|
60 |
+
$result = $wpdb->get_results( $sql, ARRAY_A );
|
61 |
+
$time = time();
|
62 |
+
if (isset($result[0]) && !empty($result[0]['first_time'])) {
|
63 |
+
$time = strtotime( $result[0]['first_time'] );
|
64 |
+
}
|
65 |
+
update_option('mainwp_creport_first_time_activated', $time);
|
66 |
+
}
|
67 |
+
}
|
68 |
|
69 |
if ( empty( self::$db_version ) ) {
|
70 |
self::install( self::$current );
|
71 |
self::copy_stream_db();
|
72 |
+
} elseif ( version_compare( self::$db_version, self::$current, '!=') ) {
|
73 |
+
self::check_updates();
|
74 |
update_site_option( self::KEY, self::$current );
|
75 |
}
|
76 |
|
339 |
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
340 |
record_id bigint(20) unsigned NOT NULL,
|
341 |
meta_key varchar(200) NOT NULL,
|
342 |
+
meta_value text NOT NULL,
|
343 |
PRIMARY KEY (meta_id),
|
344 |
+
KEY record_id (record_id(100)),
|
345 |
+
KEY meta_key (meta_key(100))
|
|
|
346 |
)";
|
347 |
|
348 |
if ( ! empty( $wpdb->charset ) ) {
|
361 |
|
362 |
return $current;
|
363 |
}
|
364 |
+
|
365 |
+
public static function check_updates() {
|
366 |
+
global $wpdb;
|
367 |
+
|
368 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
369 |
+
$current_version = self::get_db_version();
|
370 |
+
|
371 |
+
$prefix = self::$table_prefix;
|
372 |
+
|
373 |
+
if (version_compare($current_version, '0.0.4', '<')) {
|
374 |
+
$wpdb->query( "ALTER TABLE {$prefix}mainwp_stream_meta CHANGE `meta_value` `meta_value` TEXT " . ( !empty($wpdb->charset) ? "CHARACTER SET " . $wpdb->charset : "" ) . ( !empty($wpdb->collate) ? " COLLATE " . $wpdb->collate : "" ) . " NOT NULL;");
|
375 |
+
if ( $wpdb->get_var( "SHOW INDEX FROM {$prefix}mainwp_stream_meta WHERE column_name = 'meta_value'")) {
|
376 |
+
$wpdb->query( "ALTER TABLE {$prefix}mainwp_stream_meta DROP INDEX meta_value");
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
}
|
381 |
}
|
includes/list-table.php
CHANGED
@@ -469,7 +469,8 @@ class MainWP_WP_Stream_List_Table extends WP_List_Table {
|
|
469 |
}
|
470 |
|
471 |
$filters_string .= sprintf( '<input type="submit" id="record-query-submit" class="button" value="%s">', __( 'Filter', 'default' ) );
|
472 |
-
|
|
|
473 |
$url = self_admin_url( MainWP_WP_Stream_Admin::ADMIN_PARENT_PAGE );
|
474 |
|
475 |
printf( '<div class="alignleft actions">%s</div>', $filters_string ); // xss ok
|
@@ -632,7 +633,7 @@ class MainWP_WP_Stream_List_Table extends WP_List_Table {
|
|
632 |
$user_id = get_current_user_id();
|
633 |
$option = get_user_meta( $user_id, 'stream_live_update_records', true );
|
634 |
|
635 |
-
$
|
636 |
|
637 |
ob_start();
|
638 |
?>
|
@@ -640,7 +641,7 @@ class MainWP_WP_Stream_List_Table extends WP_List_Table {
|
|
640 |
<h5><?php esc_html_e( 'Live updates', 'mainwp-child-reports' ) ?></h5>
|
641 |
|
642 |
<div>
|
643 |
-
<input type="hidden" name="
|
644 |
</div>
|
645 |
<div>
|
646 |
<input type="hidden" name="enable_live_update_user" id="enable_live_update_user" value="<?php echo absint( $user_id ) ?>" />
|
469 |
}
|
470 |
|
471 |
$filters_string .= sprintf( '<input type="submit" id="record-query-submit" class="button" value="%s">', __( 'Filter', 'default' ) );
|
472 |
+
$filters_string .= wp_nonce_field( 'mainwp_creport_filters_user_search_nonce', 'mainwp_creport_filters_user_search_nonce' );
|
473 |
+
|
474 |
$url = self_admin_url( MainWP_WP_Stream_Admin::ADMIN_PARENT_PAGE );
|
475 |
|
476 |
printf( '<div class="alignleft actions">%s</div>', $filters_string ); // xss ok
|
633 |
$user_id = get_current_user_id();
|
634 |
$option = get_user_meta( $user_id, 'stream_live_update_records', true );
|
635 |
|
636 |
+
$mainwp_creport_live_update_records_nonce = wp_create_nonce( 'mainwp_creport_live_update_records_nonce' );
|
637 |
|
638 |
ob_start();
|
639 |
?>
|
641 |
<h5><?php esc_html_e( 'Live updates', 'mainwp-child-reports' ) ?></h5>
|
642 |
|
643 |
<div>
|
644 |
+
<input type="hidden" name="mainwp_creport_live_update_nonce" id="mainwp_creport_live_update_nonce" value="<?php echo esc_attr( $mainwp_creport_live_update_records_nonce ) ?>" />
|
645 |
</div>
|
646 |
<div>
|
647 |
<input type="hidden" name="enable_live_update_user" id="enable_live_update_user" value="<?php echo absint( $user_id ) ?>" />
|
includes/live-update.php
CHANGED
@@ -14,7 +14,7 @@ class MainWP_WP_Stream_Live_Update {
|
|
14 |
}
|
15 |
|
16 |
public static function enable_live_update() {
|
17 |
-
check_ajax_referer( '
|
18 |
|
19 |
$input = array(
|
20 |
'checked' => FILTER_SANITIZE_STRING,
|
14 |
}
|
15 |
|
16 |
public static function enable_live_update() {
|
17 |
+
check_ajax_referer( 'mainwp_creport_live_update_records_nonce', 'nonce' );
|
18 |
|
19 |
$input = array(
|
20 |
'checked' => FILTER_SANITIZE_STRING,
|
includes/query.php
CHANGED
@@ -128,8 +128,6 @@ class MainWP_WP_Stream_Query {
|
|
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'];
|
@@ -143,16 +141,19 @@ class MainWP_WP_Stream_Query {
|
|
143 |
/**
|
144 |
* PARSE DATE FILTERS
|
145 |
*/
|
146 |
-
if ( $args['date'] ) {
|
147 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) = %s", $args['date'] );
|
148 |
} else {
|
149 |
-
if ( $args['date_from'] ) {
|
150 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) >= %s", $args['date_from'] );
|
151 |
}
|
152 |
-
if ( $args['date_to'] ) {
|
153 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) <= %s", $args['date_to'] );
|
|
|
|
|
|
|
154 |
}
|
155 |
-
}
|
156 |
|
157 |
/**
|
158 |
* PARSE __IN PARAM FAMILY
|
@@ -327,7 +328,9 @@ class MainWP_WP_Stream_Query {
|
|
327 |
$limits";
|
328 |
|
329 |
$sql = apply_filters( 'mainwp_wp_stream_query', $sql, $args );
|
330 |
-
|
|
|
|
|
331 |
$results = $wpdb->get_results( $sql );
|
332 |
|
333 |
if ( 'with-meta' === $fields && is_array( $results ) && $results ) {
|
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 |
if (is_array($ret) && count($ret)> 0) {
|
132 |
foreach($ret as $val) {
|
133 |
$child_record_ids[] = $val['record_id'];
|
141 |
/**
|
142 |
* PARSE DATE FILTERS
|
143 |
*/
|
144 |
+
if ( isset( $args['date'] ) && !empty( $args['date'] ) ) {
|
145 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) = %s", $args['date'] );
|
146 |
} else {
|
147 |
+
if ( isset($args['date_from']) && !empty($args['date_from']) ) {
|
148 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) >= %s", $args['date_from'] );
|
149 |
}
|
150 |
+
if ( isset($args['date_to']) && !empty($args['date_to']) ) {
|
151 |
$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) <= %s", $args['date_to'] );
|
152 |
+
}
|
153 |
+
if ( isset($args['datetime_from']) && !empty($args['datetime_from']) ) {
|
154 |
+
$where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.created >= %s", $args['datetime_from'] );
|
155 |
}
|
156 |
+
}
|
157 |
|
158 |
/**
|
159 |
* PARSE __IN PARAM FAMILY
|
328 |
$limits";
|
329 |
|
330 |
$sql = apply_filters( 'mainwp_wp_stream_query', $sql, $args );
|
331 |
+
|
332 |
+
//error_log($sql);
|
333 |
+
|
334 |
$results = $wpdb->get_results( $sql );
|
335 |
|
336 |
if ( 'with-meta' === $fields && is_array( $results ) && $results ) {
|
includes/settings.php
CHANGED
@@ -168,12 +168,21 @@ class MainWP_WP_Stream_Settings {
|
|
168 |
return apply_filters( 'mainwp_wp_stream_settings_option_key', $option_key );
|
169 |
}
|
170 |
|
171 |
-
public static function get_fields() {
|
172 |
-
if ( empty( self::$fields ) ) {
|
173 |
-
|
174 |
-
require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
|
175 |
-
$
|
176 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
self::$fields = array(
|
178 |
'general' => array(
|
179 |
'title' => esc_html__( 'General', 'default' ),
|
@@ -187,9 +196,19 @@ class MainWP_WP_Stream_Settings {
|
|
187 |
'default' => 180,
|
188 |
'after_field' => esc_html__( 'days', 'mainwp-child-reports' ),
|
189 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
array(
|
191 |
'name' => 'delete_all_records',
|
192 |
-
'title' => $
|
193 |
'type' => 'link',
|
194 |
'href' => add_query_arg(
|
195 |
array(
|
@@ -252,7 +271,7 @@ class MainWP_WP_Stream_Settings {
|
|
252 |
public static function register_settings() {
|
253 |
$sections = self::get_fields();
|
254 |
|
255 |
-
register_setting( self::$option_key, self::$option_key );
|
256 |
|
257 |
foreach ( $sections as $section_name => $section ) {
|
258 |
add_settings_section(
|
@@ -280,7 +299,16 @@ class MainWP_WP_Stream_Settings {
|
|
280 |
}
|
281 |
}
|
282 |
}
|
283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
public static function updated_option_trigger_flush_rules( $old_value, $new_value ) {
|
285 |
if ( is_array( $new_value ) && is_array( $old_value ) ) {
|
286 |
$new_value = ( array_key_exists( 'general_private_feeds', $new_value ) ) ? $new_value['general_private_feeds'] : 0;
|
@@ -307,7 +335,8 @@ class MainWP_WP_Stream_Settings {
|
|
307 |
$nonce = isset( $field['nonce'] ) ? $field['nonce'] : null;
|
308 |
$current_value = self::$options[ $section . '_' . $name ];
|
309 |
$option_key = self::$option_key;
|
310 |
-
|
|
|
311 |
if ( is_callable( $current_value ) ) {
|
312 |
$current_value = call_user_func( $current_value );
|
313 |
}
|
@@ -382,11 +411,11 @@ class MainWP_WP_Stream_Settings {
|
|
382 |
}
|
383 |
$output .= '</fieldset></div>';
|
384 |
break;
|
385 |
-
case 'select':
|
386 |
-
|
387 |
$default_value = isset( $default['value'] ) ? $default['value'] : '-1';
|
388 |
$default_name = isset( $default['name'] ) ? $default['name'] : 'Choose Setting';
|
389 |
-
|
390 |
$output = sprintf(
|
391 |
'<select name="%1$s[%2$s_%3$s]" id="%1$s_%2$s_%3$s">',
|
392 |
esc_attr( $option_key ),
|
@@ -396,18 +425,19 @@ class MainWP_WP_Stream_Settings {
|
|
396 |
$output .= sprintf(
|
397 |
'<option value="%1$s" %2$s>%3$s</option>',
|
398 |
esc_attr( $default_value ),
|
399 |
-
|
400 |
esc_html( $default_name )
|
401 |
);
|
402 |
foreach ( $field['choices'] as $value => $label ) {
|
403 |
$output .= sprintf(
|
404 |
'<option value="%1$s" %2$s>%3$s</option>',
|
405 |
esc_attr( $value ),
|
406 |
-
|
407 |
esc_html( $label )
|
408 |
);
|
409 |
}
|
410 |
$output .= '</select>';
|
|
|
411 |
break;
|
412 |
case 'file':
|
413 |
$output = sprintf(
|
168 |
return apply_filters( 'mainwp_wp_stream_settings_option_key', $option_key );
|
169 |
}
|
170 |
|
171 |
+
public static function get_fields() {
|
172 |
+
if ( empty( self::$fields ) ) {
|
173 |
+
if (!class_exists('MainWP_WP_Stream_Admin'))
|
174 |
+
require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
|
175 |
+
$branding_text = MainWP_WP_Stream_Admin::get_branding_title();
|
176 |
+
$branding_text = !empty($branding_text) ? 'Reset ' . $branding_text . ' Reports Database' : esc_html__( 'Reset MainWP Child Reports Database', 'mainwp-child-reports' );
|
177 |
+
$branding_name = !empty($branding_text) ? $branding_text : 'MainWP Child';
|
178 |
+
$chk_label = 'Hide ' . $branding_name . ' and ' . $branding_name . ' Reports from reports';
|
179 |
+
$chk_desc = 'If selected, the ' . $branding_name . ' plugin and the ' . $branding_name . ' Reports plugin will be left out from reports for this site.';
|
180 |
+
$hide_child_plugins = get_option('mainwp_creport_hide_child_plugins', 'yes');
|
181 |
+
// to fix can not set default checked checkbox
|
182 |
+
$checkbox_hide_childs = '<tr><th scope="row"><label for="mainwp_creport_hide_child_plugins">' . $chk_label;
|
183 |
+
$checkbox_hide_childs .= '</label></th><td><label><input name="mainwp_creport_hide_child_plugins" id="mainwp_creport_hide_child_plugins" value="1" type="checkbox" ' . ($hide_child_plugins == 'yes' ? 'checked' : '') . '> ';
|
184 |
+
$checkbox_hide_childs .= '</label><p class="description">' . $chk_desc . '.</p></td></tr>';
|
185 |
+
|
186 |
self::$fields = array(
|
187 |
'general' => array(
|
188 |
'title' => esc_html__( 'General', 'default' ),
|
196 |
'default' => 180,
|
197 |
'after_field' => esc_html__( 'days', 'mainwp-child-reports' ),
|
198 |
),
|
199 |
+
array(
|
200 |
+
'name' => 'period_of_time',
|
201 |
+
'title' => esc_html__( 'Minimum time between posts/pages update reports', 'mainwp-child-reports' ),
|
202 |
+
'type' => 'select',
|
203 |
+
'choices' => array( '0' => '0', '30' => '30', '60' => '60', '90' => '90', '120' => '120'),
|
204 |
+
'desc' => '',
|
205 |
+
'default' => 30,
|
206 |
+
'current_value' => array( '30' ),
|
207 |
+
'after_field' => esc_html__( 'minutes', 'mainwp-child-reports' ) . $checkbox_hide_childs, // to add checkbox
|
208 |
+
),
|
209 |
array(
|
210 |
'name' => 'delete_all_records',
|
211 |
+
'title' => 'Reset ' . $branding_name . ' Reports Database',
|
212 |
'type' => 'link',
|
213 |
'href' => add_query_arg(
|
214 |
array(
|
271 |
public static function register_settings() {
|
272 |
$sections = self::get_fields();
|
273 |
|
274 |
+
register_setting( self::$option_key, self::$option_key, array( 'MainWP_WP_Stream_Settings', 'sanitize_settings' ) );
|
275 |
|
276 |
foreach ( $sections as $section_name => $section ) {
|
277 |
add_settings_section(
|
299 |
}
|
300 |
}
|
301 |
}
|
302 |
+
|
303 |
+
public static function sanitize_settings( $input ) {
|
304 |
+
if (isset($_POST['mainwp_creport_hide_child_plugins'])) {
|
305 |
+
update_option('mainwp_creport_hide_child_plugins', 'yes');
|
306 |
+
} else {
|
307 |
+
update_option('mainwp_creport_hide_child_plugins', 'no');
|
308 |
+
}
|
309 |
+
return $input;
|
310 |
+
}
|
311 |
+
|
312 |
public static function updated_option_trigger_flush_rules( $old_value, $new_value ) {
|
313 |
if ( is_array( $new_value ) && is_array( $old_value ) ) {
|
314 |
$new_value = ( array_key_exists( 'general_private_feeds', $new_value ) ) ? $new_value['general_private_feeds'] : 0;
|
335 |
$nonce = isset( $field['nonce'] ) ? $field['nonce'] : null;
|
336 |
$current_value = self::$options[ $section . '_' . $name ];
|
337 |
$option_key = self::$option_key;
|
338 |
+
|
339 |
+
|
340 |
if ( is_callable( $current_value ) ) {
|
341 |
$current_value = call_user_func( $current_value );
|
342 |
}
|
411 |
}
|
412 |
$output .= '</fieldset></div>';
|
413 |
break;
|
414 |
+
case 'select':
|
415 |
+
$current_value = (array) self::$options[ $section . '_' . $name ];
|
416 |
$default_value = isset( $default['value'] ) ? $default['value'] : '-1';
|
417 |
$default_name = isset( $default['name'] ) ? $default['name'] : 'Choose Setting';
|
418 |
+
|
419 |
$output = sprintf(
|
420 |
'<select name="%1$s[%2$s_%3$s]" id="%1$s_%2$s_%3$s">',
|
421 |
esc_attr( $option_key ),
|
425 |
$output .= sprintf(
|
426 |
'<option value="%1$s" %2$s>%3$s</option>',
|
427 |
esc_attr( $default_value ),
|
428 |
+
selected( in_array( $default_value, $current_value ), true, false ),
|
429 |
esc_html( $default_name )
|
430 |
);
|
431 |
foreach ( $field['choices'] as $value => $label ) {
|
432 |
$output .= sprintf(
|
433 |
'<option value="%1$s" %2$s>%3$s</option>',
|
434 |
esc_attr( $value ),
|
435 |
+
selected( in_array( $value, $current_value ), true, false ),
|
436 |
esc_html( $label )
|
437 |
);
|
438 |
}
|
439 |
$output .= '</select>';
|
440 |
+
$output .= $after_field;
|
441 |
break;
|
442 |
case 'file':
|
443 |
$output = sprintf(
|
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 |
/**
|
@@ -28,7 +28,7 @@
|
|
28 |
|
29 |
class MainWP_WP_Stream {
|
30 |
|
31 |
-
const VERSION = '0.0.
|
32 |
|
33 |
public static $instance;
|
34 |
|
@@ -83,26 +83,25 @@ class MainWP_WP_Stream {
|
|
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 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
}
|
106 |
|
107 |
}
|
108 |
|
@@ -118,7 +117,7 @@ class MainWP_WP_Stream {
|
|
118 |
public static function install() {
|
119 |
// Install plugin tables
|
120 |
require_once MAINWP_WP_STREAM_INC_DIR . 'install.php';
|
121 |
-
$update = MainWP_WP_Stream_Install::get_instance();
|
122 |
}
|
123 |
|
124 |
public function verify_database_present() {
|
@@ -170,7 +169,7 @@ class MainWP_WP_Stream {
|
|
170 |
if ( ! empty( $uninstall_message ) ) {
|
171 |
self::notice( $uninstall_message );
|
172 |
}
|
173 |
-
}
|
174 |
}
|
175 |
|
176 |
static function update_activation_hook() {
|
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.3
|
9 |
*/
|
10 |
|
11 |
/**
|
28 |
|
29 |
class MainWP_WP_Stream {
|
30 |
|
31 |
+
const VERSION = '0.0.4'; // to check for update
|
32 |
|
33 |
public static $instance;
|
34 |
|
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 |
+
|
87 |
+
require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
|
88 |
+
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Admin', 'load' ) );
|
89 |
+
|
90 |
+
|
91 |
+
// Registers a hook that connectors and other plugins can use whenever a stream update happens
|
92 |
+
add_action( 'admin_init', array( __CLASS__, 'update_activation_hook' ) );
|
93 |
+
|
94 |
+
require_once MAINWP_WP_STREAM_INC_DIR . 'dashboard.php';
|
95 |
+
add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Dashboard_Widget', '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 |
|
117 |
public static function install() {
|
118 |
// Install plugin tables
|
119 |
require_once MAINWP_WP_STREAM_INC_DIR . 'install.php';
|
120 |
+
$update = MainWP_WP_Stream_Install::get_instance();
|
121 |
}
|
122 |
|
123 |
public function verify_database_present() {
|
169 |
if ( ! empty( $uninstall_message ) ) {
|
170 |
self::notice( $uninstall_message );
|
171 |
}
|
172 |
+
}
|
173 |
}
|
174 |
|
175 |
static function update_activation_hook() {
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== MainWP Child Reports ===
|
2 |
-
Contributors:
|
3 |
Donate link:
|
4 |
Tags: MainWP Child Reports, MainWP, MainWP Child, MainWP Client Reports Extension, child reports, reports, actions, activity, admin, analytics, dashboard, log, notification, users, Backupwordpress, Updraftplus
|
5 |
-
Author:
|
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,16 @@ Credit to the [Stream Plugin](https://wordpress.org/plugins/stream/) which the M
|
|
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)
|
1 |
=== MainWP Child Reports ===
|
2 |
+
Contributors: MainWP
|
3 |
Donate link:
|
4 |
Tags: MainWP Child Reports, MainWP, MainWP Child, MainWP Client Reports Extension, child reports, reports, actions, activity, admin, analytics, dashboard, log, notification, users, Backupwordpress, Updraftplus
|
5 |
+
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.7.2
|
10 |
+
Stable tag: 1.3
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
36 |
|
37 |
== Changelog ==
|
38 |
|
39 |
+
= 1.3 - 2-9-2017 =
|
40 |
+
* Fixed: an issue with recording duplicate values for UpdraftPlus backups
|
41 |
+
* Fixed: multiple issues with recording backups made by supported plugins
|
42 |
+
* Fixed: an issue with recording incorrect values for plugins and themes versions
|
43 |
+
* Added: support for Wordfence tokens
|
44 |
+
* Added: support for Maintanence tokens
|
45 |
+
* Added: support for Page Speed tokens
|
46 |
+
* Added: support for Broken Links tokens
|
47 |
+
* Updated: system compatibility udpates required by upcoming MainWP Client Reports Extension versoin
|
48 |
+
|
49 |
= 1.2 - 11-9-2016 =
|
50 |
* Fixed: Issue with hiding the plugin in Client Reports
|
51 |
* Fixed: Conflict with the auto backup feature of the UpdraftPlus Backups plugin (#8435)
|
ui/admin.js
CHANGED
@@ -52,7 +52,8 @@ jQuery(function( $ ) {
|
|
52 |
datatype: 'json',
|
53 |
data: function( term ) {
|
54 |
return {
|
55 |
-
action: 'mainwp_wp_stream_filters',
|
|
|
56 |
filter: $( el ).attr( 'name' ),
|
57 |
q: term
|
58 |
};
|
@@ -428,7 +429,7 @@ jQuery(function( $ ) {
|
|
428 |
|
429 |
//Enable Live Update Checkbox Ajax
|
430 |
$( '#enable_live_update' ).click(function() {
|
431 |
-
var nonce = $( '#
|
432 |
var user = $( '#enable_live_update_user' ).val();
|
433 |
var checked = 'unchecked';
|
434 |
if ( $( '#enable_live_update' ).is( ':checked' ) ) {
|
52 |
datatype: 'json',
|
53 |
data: function( term ) {
|
54 |
return {
|
55 |
+
action: 'mainwp_wp_stream_filters',
|
56 |
+
nonce: $( '#mainwp_creport_filters_user_search_nonce' ).val(),
|
57 |
filter: $( el ).attr( 'name' ),
|
58 |
q: term
|
59 |
};
|
429 |
|
430 |
//Enable Live Update Checkbox Ajax
|
431 |
$( '#enable_live_update' ).click(function() {
|
432 |
+
var nonce = $( '#mainwp_creport_live_update_nonce' ).val();
|
433 |
var user = $( '#enable_live_update_user' ).val();
|
434 |
var checked = 'unchecked';
|
435 |
if ( $( '#enable_live_update' ).is( ':checked' ) ) {
|