sync with branch01 + refactoring

This commit is contained in:
ruben- 2017-01-14 13:16:52 +01:00
parent 37e134a03b
commit a3c6318cce
15 changed files with 363 additions and 249 deletions

View file

@ -25,10 +25,8 @@ class MainWP_Child_Back_Up_Buddy {
return;
}
add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) );
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) );
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
if ( get_option( 'mainwp_backupbuddy_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -72,15 +70,15 @@ class MainWP_Child_Back_Up_Buddy {
}
function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backupbuddy');
function do_site_stats() {
do_action( 'mainwp_child_reports_log', 'backupbuddy');
}
function do_reports_backups($ext = '') {
if ($ext !== 'backupbuddy')
return;
function do_reports_log($ext = '') {
if ($ext !== 'backupbuddy')
return;
$backups = array();
$backups = array();
$backup_sort_dates = array();
$files = glob( backupbuddy_core::getBackupDirectory() . 'backup*.zip' );

View file

@ -19,16 +19,11 @@ class MainWP_Child_Back_Up_Wordpress {
}
public function init() {
if ( get_option( 'mainwp_backupwordpress_ext_enabled' ) !== 'Y' ) {
return;
}
if (!$this->is_plugin_installed)
return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
if ( get_option( 'mainwp_backupwordpress_ext_enabled' ) !== 'Y' ) return;
if (!$this->is_plugin_installed) return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
if ( get_option( 'mainwp_backupwordpress_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
@ -150,29 +145,30 @@ class MainWP_Child_Back_Up_Wordpress {
return $return;
}
function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backupwordpress');
function do_site_stats() {
do_action( 'mainwp_child_reports_log', 'backupwordpress');
}
function do_reports_backups($ext = '') {
if ($ext !== 'backupwordpress')
return;
// Refresh the schedules from the database to make sure we have the latest changes
HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
foreach($schedules as $schedule) {
foreach ( $schedule->get_backups() as $file ) {
$backup_type = $schedule->get_type();
$message = "BackupWordpres backup " . $backup_type . ' finished';
$destination = "N/A";
if ( file_exists($file) ) {
$date = @filemtime( $file );
if (!empty($date))
do_action("backupwordpress_backup", $destination , $message, 'finished', $backup_type, $date);
}
public function do_reports_log($ext = '') {
if ( $ext !== 'backupwordpress' ) return;
// Refresh the schedules from the database to make sure we have the latest changes
HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
foreach($schedules as $schedule) {
foreach ( $schedule->get_backups() as $file ) {
$backup_type = $schedule->get_type();
$message = "BackupWordpres backup " . $backup_type . ' finished';
$destination = "N/A";
if ( file_exists( $file ) ) {
$date = @filemtime( $file );
if ( !empty( $date ) ) {
do_action( "backupwordpress_backup", $destination, $message, 'finished', $backup_type, $date );
}
}
}
}
}
function set_showhide() {
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';

View file

@ -188,7 +188,6 @@ class MainWP_Child_Back_WP_Up {
return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
if ( get_option( 'mainwp_backwpup_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -196,42 +195,40 @@ class MainWP_Child_Back_WP_Up {
}
}
function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backwpup');
function do_site_stats() {
do_action( 'mainwp_child_reports_log', 'backwpup');
}
function do_reports_backups($ext = '') {
if ($ext !== 'backwpup')
return;
$destinations = BackWPup::get_registered_destinations();
$jobdests = $this->get_destinations_list();
if (! empty( $jobdests ) ) {
foreach ($jobdests as $jobdest) {
list( $jobid, $dest ) = explode( '_', $jobdest );
if ( ! empty( $destinations[ $dest ][ 'class' ] ) ) {
$dest_object = BackWPup::get_destination( $dest );
$items = $dest_object->file_get_list( $jobdest );
//if no items brake
if ( $items ) {
foreach ( $items as $ma ) {
if (isset($ma['time'])) {
$backup_time = $ma[ "time" ];
$message = 'BackWPup backup finished';
$backup_type = 'BackWPup';
$destination = "N/A";
if (!empty($backup_time))
do_action( 'mainwp_backwpup_backup', $message, $backup_type, $backup_time);
}
}
}
public function do_reports_log($ext = '') {
if ( $ext !== 'backwpup' ) return;
$destinations = BackWPup::get_registered_destinations();
$jobdests = $this->get_destinations_list();
if ( !empty( $jobdests ) ) {
foreach ($jobdests as $jobdest) {
list( $jobid, $dest ) = explode( '_', $jobdest );
if ( ! empty( $destinations[ $dest ][ 'class' ] ) ) {
$dest_object = BackWPup::get_destination( $dest );
$items = $dest_object->file_get_list( $jobdest );
//if no items brake
if ( $items ) {
foreach ( $items as $ma ) {
if (isset($ma['time'])) {
$backup_time = $ma[ "time" ];
$message = 'BackWPup backup finished';
$backup_type = 'BackWPup';
$destination = "N/A";
if (!empty($backup_time))
do_action( 'mainwp_backwpup_backup', $message, $backup_type, $backup_time);
}
}
}
}
}
}
function get_destinations_list() {
}
function get_destinations_list() {
$jobdest = array();
$jobids = BackWPup_Option::get_job_ids();

View file

@ -3,6 +3,7 @@
class MainWP_Child_Links_Checker {
public static $instance = null;
public $is_plugin_installed = false;
static function Instance() {
if ( null === MainWP_Child_Links_Checker::$instance ) {
@ -12,6 +13,13 @@ class MainWP_Child_Links_Checker {
return MainWP_Child_Links_Checker::$instance;
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'broken-link-checker/broken-link-checker.php' ) ) {
$this->is_plugin_installed = true;
}
}
public function action() {
$information = array();
if ( ! defined( 'BLC_ACTIVE' ) || ! function_exists( 'blc_init' ) ) {
@ -177,19 +185,16 @@ class MainWP_Child_Links_Checker {
function sync_data( $strategy = '' ) {
$information = array();
$data = $this->get_count_links();
// $max_results = isset($_POST['max_results']) ? intval($_POST['max_results']) : 50;
// $params = array( array( 'load_instances' => true ),
// 'max_results' => $max_results
// );
//$data['link_data'] = $this->do_sync_links_data($params);
$information['data'] = $data;
if (is_array($data))
$information['data'] = $data;
return $information;
}
function sync_links_data() {
if (!defined('BLC_DIRECTORY')) return;
require_once BLC_DIRECTORY . '/includes/link-query.php';
require_once BLC_DIRECTORY . '/includes/modules.php';
$blc_link_query = blcLinkQuery::getInstance();
$total = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
@ -227,6 +232,11 @@ class MainWP_Child_Links_Checker {
}
function get_count_links() {
if (!defined('BLC_DIRECTORY')) return;
require_once BLC_DIRECTORY . '/includes/link-query.php';
require_once BLC_DIRECTORY . '/includes/modules.php';
$data = array();
$blc_link_query = blcLinkQuery::getInstance();
$data['broken'] = $blc_link_query->get_filter_links( 'broken', array( 'count_only' => true ) );

View file

@ -3,8 +3,9 @@
class MainWP_Child_Pagespeed {
public static $instance = null;
public $is_plugin_installed = false;
static function Instance() {
static function Instance() {
if ( null === MainWP_Child_Pagespeed::$instance ) {
MainWP_Child_Pagespeed::$instance = new MainWP_Child_Pagespeed();
}
@ -13,6 +14,11 @@ class MainWP_Child_Pagespeed {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'google-pagespeed-insights/google-pagespeed-insights.php' ) ) {
$this->is_plugin_installed = true;
}
add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
}
@ -243,7 +249,7 @@ class MainWP_Child_Pagespeed {
return false;
}
function sync_data( $strategy = '' ) {
public function sync_data( $strategy = '' ) {
if ( empty( $strategy ) ) {
$strategy = 'both';
}

View file

@ -461,12 +461,12 @@ class MainWP_Child_Server_Information {
</style>
<div class="wrap">
<div class="updated below-h2">
<p><?php _e( 'Please include this information when requesting support:', 'mainwp' ); ?></p>
<span class="mwp_child_close_srv_info"><a href="#" id="mwp_child_download_srv_info"><?php _e( 'Download', 'mainwp' ); ?></a> | <a href="#" id="mwp_child_close_srv_info"><i class="fa fa-eye-slash"></i> <?php _e( 'Hide', 'mainwp' ); ?>
<p><?php _e( 'Please include this information when requesting support:', 'mainwp-child' ); ?></p>
<span class="mwp_child_close_srv_info"><a href="#" id="mwp_child_download_srv_info"><?php _e( 'Download', 'mainwp-child' ); ?></a> | <a href="#" id="mwp_child_close_srv_info"><i class="fa fa-eye-slash"></i> <?php _e( 'Hide', 'mainwp-child' ); ?>
</a></span>
<p class="submit">
<a class="button-primary mwp-child-get-system-report-btn" href="#"><?php _e( 'Get system report', 'mainwp' ); ?></a>
<a class="button-primary mwp-child-get-system-report-btn" href="#"><?php _e( 'Get system report', 'mainwp-child' ); ?></a>
</p>
<div id="mwp-server-information"><textarea readonly="readonly" wrap="off"></textarea></div>
@ -552,9 +552,9 @@ class MainWP_Child_Server_Information {
<th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Server configuration', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts"
style=""><?php esc_html_e( 'Required value', 'mainwp' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Value', 'mainwp' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
style=""><?php esc_html_e( 'Required value', 'mainwp-child' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Value', 'mainwp-child' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Status', 'mainwp-child' ); ?></th>
</tr>
</thead>
@ -589,8 +589,8 @@ class MainWP_Child_Server_Information {
?>
<tr>
<td></td>
<td><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td>
<td><?php echo esc_html( '= ' . __( 'direct', 'mainwp' ) ); ?></td>
<td><?php esc_html_e( 'FileSystem Method', 'mainwp-child' ); ?></td>
<td><?php echo esc_html( '= direct' ); ?></td>
<td><?php echo esc_html( self::getFileSystemMethod() ); ?></td>
<td><?php echo esc_html( self::getFileSystemMethodCheck() ); ?></td>
</tr>
@ -602,7 +602,7 @@ class MainWP_Child_Server_Information {
?>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPSafeMode(); ?></td>
</tr>
<?php
@ -641,172 +641,172 @@ class MainWP_Child_Server_Information {
<tr>
<td style="background: #333; color: #fff;"
colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp' ); ?></td>
colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp-child' ); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'WordPress Root Directory', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'WordPress Root Directory', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getWPRoot(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server Name', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerName(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server Software', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerSoftware(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Operating System', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getOS(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Architecture', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getArchitecture(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server IP', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerIP(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server Protocol', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerProtocol(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'HTTP Host', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getHTTPHost(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'HTTPS', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getHTTPS(); ?></td>
</tr>
<tr>
<td></td>
<td><?php _e( 'Server self connect', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server self connect', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::serverSelfConnect(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'User Agent', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getUserAgent(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Server Port', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerPort(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Gateway Interface', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerGetawayInterface(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Memory Usage', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::memoryUsage(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Complete URL', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Complete URL', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getCompleteURL(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Request Time', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerRequestTime(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Accept Content', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerHTTPAccept(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Accept-Charset Content', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Accept-Charset Content', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerAcceptCharset(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getScriptFileName(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Current Page URI', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Current Page URI', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getCurrentPageURI(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Remote Address', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemoteAddress(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Remote Host', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemoteHost(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'Remote Port', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemotePort(); ?></td>
</tr>
<tr>
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp' ); ?></td>
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp-child' ); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPAllowUrlFopen(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP Exif Support', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP Exif Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPExif(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP IPTC Support', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP IPTC Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPIPTC(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP XML Support', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP XML Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPXML(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::mainwpRequiredFunctions(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp-child' ); ?></td>
<td colspan="3" style="width: 73% !important;"><?php self::getLoadedPHPExtensions(); ?></td>
</tr>
<tr>
<td style="background: #333; color: #fff;"
colspan="5"><?php esc_html_e( 'MySQL INFORMATION', 'mainwp' ); ?></td>
colspan="5"><?php esc_html_e( 'MySQL INFORMATION', 'mainwp-child' ); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'MySQL Mode', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getSQLMode(); ?></td>
</tr>
<tr>
<td></td>
<td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp' ); ?></td>
<td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp-child' ); ?></td>
<td colspan="3"><?php echo esc_html( defined( 'DB_CHARSET' ) ? DB_CHARSET : '' ); ?></td>
</tr>
<tr>
<td style="background: #333; color: #fff;" colspan="5"><?php _e( 'WORDPRESS PLUGINS', 'mainwp' ); ?></td>
<td style="background: #333; color: #fff;" colspan="5"><?php _e( 'WORDPRESS PLUGINS', 'mainwp-child' ); ?></td>
</tr>
<?php
$all_plugins = get_plugins();
@ -867,7 +867,7 @@ class MainWP_Child_Server_Information {
echo esc_html( $arr[ $i ] . ', ' );
}
} else {
echo esc_html__( 'No functions disabled', 'mainwp' );
echo esc_html__( 'No functions disabled', 'mainwp-child' );
}
}
@ -915,11 +915,11 @@ class MainWP_Child_Server_Information {
<thead>
<tr>
<th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Next due', 'mainwp' ); ?></span></th>
<span><?php esc_html_e( 'Next due', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Schedule', 'mainwp' ); ?></span></th>
<span><?php esc_html_e( 'Schedule', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Hook', 'mainwp' ); ?></span></th>
<span><?php esc_html_e( 'Hook', 'mainwp-child' ); ?></span></th>
</tr>
</thead>
<tbody id="the-sites-list" class="list:sites">
@ -1122,7 +1122,7 @@ class MainWP_Child_Server_Information {
return ( stristr( $str, 'NCONF_get_string:no value' ) ? '' : $str );
}
protected static function getPHPVersion() {
public static function getPHPVersion() {
return phpversion();
}
@ -1138,7 +1138,7 @@ class MainWP_Child_Server_Information {
return ini_get( 'post_max_size' );
}
protected static function getMySQLVersion() {
public static function getMySQLVersion() {
/** @var $wpdb wpdb */
global $wpdb;
@ -1149,7 +1149,7 @@ class MainWP_Child_Server_Information {
return ini_get( 'max_input_time' );
}
protected static function getPHPMemoryLimit() {
public static function getPHPMemoryLimit() {
return ini_get( 'memory_limit' );
}
@ -1241,7 +1241,7 @@ class MainWP_Child_Server_Information {
echo esc_html( $_SERVER['GATEWAY_INTERFACE'] );
}
protected static function getServerIP() {
public static function getServerIP() {
echo esc_html( $_SERVER['SERVER_ADDR'] );
}
@ -1275,7 +1275,7 @@ class MainWP_Child_Server_Information {
protected static function getServerAcceptCharset() {
if ( ! isset( $_SERVER['HTTP_ACCEPT_CHARSET'] ) || ( '' === $_SERVER['HTTP_ACCEPT_CHARSET'] ) ) {
esc_html_e( 'N/A', 'mainwp' );
esc_html_e( 'N/A', 'mainwp-child' );
} else {
echo esc_html( $_SERVER['HTTP_ACCEPT_CHARSET'] );
}
@ -1295,9 +1295,9 @@ class MainWP_Child_Server_Information {
protected static function getHTTPS() {
if ( isset( $_SERVER['HTTPS'] ) && '' !== $_SERVER['HTTPS'] ) {
echo esc_html( __( 'ON', 'mainwp' ) . ' - ' . $_SERVER['HTTPS'] );
echo esc_html( __( 'ON', 'mainwp-child' ) . ' - ' . $_SERVER['HTTPS'] );
} else {
esc_html_e( 'OFF', 'mainwp' );
esc_html_e( 'OFF', 'mainwp-child' );
}
}
@ -1312,19 +1312,19 @@ class MainWP_Child_Server_Information {
$response = wp_remote_post( $url, $args );
$test_result = '';
if ( is_wp_error( $response ) ) {
$test_result .= sprintf( __( 'The HTTP response test get an error "%s"','mainwp' ), $response->get_error_message() );
$test_result .= sprintf( __( 'The HTTP response test get an error "%s"','mainwp-child' ), $response->get_error_message() );
}
$response_code = wp_remote_retrieve_response_code( $response );
if ( $response_code < 200 && $response_code > 204 ) {
$test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','mainwp' ), wp_remote_retrieve_response_code( $response ) );
$test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','mainwp-child' ), wp_remote_retrieve_response_code( $response ) );
} else {
$response_body = wp_remote_retrieve_body( $response );
if ( FALSE === strstr( $response_body, 'MainWP Test' ) ) {
$test_result .= sprintf( __( 'Not expected HTTP response body: %s','mainwp' ), esc_attr( strip_tags( $response_body ) ) );
$test_result .= sprintf( __( 'Not expected HTTP response body: %s','mainwp-child' ), esc_attr( strip_tags( $response_body ) ) );
}
}
if ( empty( $test_result ) ) {
_e( 'Response Test O.K.', 'mainwp' );
_e( 'Response Test O.K.', 'mainwp-child' );
} else
echo $test_result;
}
@ -1336,7 +1336,7 @@ class MainWP_Child_Server_Information {
protected static function getRemoteHost() {
if ( ! isset( $_SERVER['REMOTE_HOST'] ) || ( '' === $_SERVER['REMOTE_HOST'] ) ) {
esc_html_e( 'N/A', 'mainwp' );
esc_html_e( 'N/A', 'mainwp-child' );
} else {
echo esc_html( $_SERVER['REMOTE_HOST'] );
}
@ -1364,7 +1364,7 @@ class MainWP_Child_Server_Information {
protected static function getServerPathTranslated() {
if ( ! isset( $_SERVER['PATH_TRANSLATED'] ) || ( '' === $_SERVER['PATH_TRANSLATED'] ) ) {
esc_html_e( 'N/A', 'mainwp' );
esc_html_e( 'N/A', 'mainwp-child' );
} else {
echo esc_html( $_SERVER['PATH_TRANSLATED'] );
}
@ -1420,9 +1420,9 @@ class MainWP_Child_Server_Information {
<thead title="Click to Toggle" style="cursor: pointer;">
<tr>
<th scope="col" class="manage-column column-posts" style="width: 10%">
<span><?php esc_html_e( 'Time', 'mainwp' ); ?></span></th>
<span><?php esc_html_e( 'Time', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Error', 'mainwp' ); ?></span></th>
<span><?php esc_html_e( 'Error', 'mainwp-child' ); ?></span></th>
</tr>
</thead>
<tbody class="list:sites" id="mainwp-error-log-table">
@ -1435,7 +1435,7 @@ class MainWP_Child_Server_Information {
public static function renderErrorLog() {
$log_errors = ini_get( 'log_errors' );
if ( ! $log_errors ) {
echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp' ) . '</td></tr>';
echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp-child' ) . '</td></tr>';
}
$error_log = ini_get( 'error_log' );
@ -1455,7 +1455,7 @@ class MainWP_Child_Server_Information {
if ( empty( $lines ) ) {
echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . '</td></tr>';
echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp-child' ) . '</td></tr>';
return;
}
@ -1607,32 +1607,32 @@ class MainWP_Child_Server_Information {
$uniqueId = get_option('mainwp_child_uniqueId');
$details = array(
'siteurl' => array(
'title' => __('Site URL', 'mainwp'),
'title' => __('Site URL', 'mainwp-child'),
'value' => get_bloginfo( 'url' ),
'desc' => get_bloginfo( 'url' )
),
'adminuser' => array(
'title' => __('Administrator name', 'mainwp'),
'title' => __('Administrator name', 'mainwp-child'),
'value' => $current_user->user_login,
'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp')
'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child')
),
'friendly_name' => array(
'title' => __('Friendly site name', 'mainwp'),
'title' => __('Friendly site name', 'mainwp-child'),
'value' => get_bloginfo( 'name' ),
'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp')
'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child')
),
'uniqueid' => array(
'title' => __('Child unique security id', 'mainwp'),
'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
'desc' => __('Child unique security id is not required, however, since you have enabled it, you need to add it to your MainWP dashboad.', 'mainwp')
'desc' => __('Child unique security id is not required, however, since you have enabled it, you need to add it to your MainWP dashboad.', 'mainwp-child')
),
'verify_ssl' => array(
'title' => __('Verify certificate', 'mainwp'),
'title' => __('Verify certificate', 'mainwp-child'),
'value' => __('Yes', 'mainwp-child'),
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp')
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child')
),
'ssl_version' => array(
'title' => __('SSL version', 'mainwp'),
'title' => __('SSL version', 'mainwp-child'),
'value' => __('Auto Detect', 'mainwp-child'),
'desc' => __('Auto Detect', 'mainwp-child'),
),
@ -1644,7 +1644,7 @@ class MainWP_Child_Server_Information {
<div class="inside">
<div class="mainwp-postbox-actions-top mainwp-padding-5">
<?php
_e('If you are trying to connect this child site to your Mainwp Dashboard, you can use following details to do that. Please note that these are only suggested values.', 'mainwp');
_e('If you are trying to connect this child site to your Mainwp Dashboard, you can use following details to do that. Please note that these are only suggested values.', 'mainwp-child');
?>
</div>
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0" style="border: 0">

View file

@ -166,10 +166,12 @@ class MainWP_Child_Themes_Check {
$responses = array();
}
$avoid_themes = array( 'superstore' );
$themes_to_scan = array_splice( $all_themes, 0, apply_filters( 'mainwp_child_theme_health_check_max_themes_to_batch', 10 ) );
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
foreach ( $themes_to_scan as $slug => $v ) {
if ( in_array( $slug, $avoid_themes ) ) continue;
$body = $this->try_get_response_body( $slug, false );

View file

@ -365,12 +365,12 @@ class MainWP_Child_Updraft_Plus_Backups {
function save_settings() {
$settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
$keys = $this->get_settings_keys();
$keys_filter = $this->get_settings_keys();
$updated = false;
if ( is_array( $settings ) ) {
if ( class_exists( 'UpdraftPlus_Options' ) ) {
foreach ( $keys as $key ) {
foreach ( $keys_filter as $key ) {
if ( isset( $settings[ $key ] ) ) {
if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' );
@ -427,7 +427,19 @@ class MainWP_Child_Updraft_Plus_Backups {
$opts['secretkey'] = $settings[ $key ]['secretkey'];
$opts['path'] = $this->replace_tokens($settings[ $key ]['path']);
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else {
} else if ( 'updraft_ftp' === $key ) {
$opts = $settings[ $key ];
if ( isset( $opts['path'] ) ) {
$opts['path'] = $this->replace_tokens( $opts['path'] );
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_sftp_settings' === $key ) {
$opts = $settings[ $key ];
if ( isset( $opts['path'] ) ) {
$opts['path'] = $this->replace_tokens( $opts['path'] );
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else {
UpdraftPlus_Options::update_updraft_option( $key, $settings[ $key ] );
}
$updated = true;

View file

@ -353,19 +353,65 @@ class MainWP_Child_Wordfence {
}
public function wordfence_init() {
if ( get_option( 'mainwp_wordfence_ext_enabled' ) !== 'Y' ) {
return;
}
if ( get_option( 'mainwp_wordfence_ext_enabled' ) !== 'Y' ) return;
if ( ! $this->is_wordfence_installed ) return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
if ( get_option( 'mainwp_wordfence_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
}
$this->init_cron();
}
function do_site_stats() {
do_action( 'mainwp_child_reports_log', 'wordfence' );
}
public function do_reports_log($ext = '') {
if ( $ext !== 'wordfence' ) return;
global $wpdb;
$lastcheck = get_option('mainwp_wordfence_lastcheck_scan');
if ($lastcheck == false) {
$lastcheck = time() - 3600 * 24 * 10; // check 10 days ago
}
$status_table = $wpdb->base_prefix . 'wfStatus';
// to fix prepare sql empty
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime >= %d AND level = 1 AND type = 'info' AND msg LIKE ", $lastcheck );
$sql .= " 'Scan Complete. %';";
$rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
if ( $rows ) {
while ( $row = MainWP_Child_DB::fetch_array( $rows ) ) {
$message = "Wordfence scan completed";
$scan_time = $row['ctime'];
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $scan_time, $scan_time + 100 ); // to get nearest SUM_FINAL msg
$sql .= " 'SUM_FINAL:Scan complete.%';";
$sum_rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
$result = '';
if ($sum_rows) {
$sum_row = MainWP_Child_DB::fetch_array( $sum_rows );
if (is_array($sum_row) && isset($sum_row['msg'])) {
if ( false !== strpos( $sum_row['msg'], 'Congratulations, no problems found' ) ) {
$result = 'No issues detected';
} else {
$result = 'Issues Detected';
}
}
}
$details = $row['msg'];
do_action( 'mainwp_reports_wordfence_scan', $message, $scan_time, $details, $result );
}
}
update_option( 'mainwp_wordfence_lastcheck_scan', time() );
}
public function admin_init() {
remove_meta_box( 'wordfence_activity_report_widget', 'dashboard', 'normal' );
}

View file

@ -84,7 +84,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
}
class MainWP_Child {
public static $version = '3.2.5';
public static $version = '3.2.6';
private $update_version = '1.3';
private $callableFunctions = array(
@ -387,7 +387,7 @@ class MainWP_Child {
public function admin_notice() {
//Admin Notice...
if ( is_plugin_active( 'mainwp-child/mainwp-child.php' ) ) {
if ( ! get_option( 'mainwp_child_pubkey' ) ) {
if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::isAdmin() && is_admin() ) {
$child_name = ( $this->branding_robust === 'MainWP' ) ? 'MainWP Child' : $this->branding_robust;
$msg = '<div class="wrap"><div class="postbox" style="margin-top: 4em;"><p style="background: #a00; color: #fff; font-size: 22px; font-weight: bold; margin: 0; padding: .3em;">';
$msg .= __( 'Attention!', 'mainwp-child' );
@ -1299,6 +1299,7 @@ class MainWP_Child {
MainWP_Child_Back_WP_Up::Instance()->init();
new MainWP_Child_Back_Up_Buddy();
MainWP_Child_Wordfence::Instance()->wordfence_init();
global $_wp_submenu_nopriv;
if ($_wp_submenu_nopriv === null)
@ -3217,6 +3218,15 @@ class MainWP_Child {
$information['wpversion'] = $wp_version;
$information['siteurl'] = get_option( 'siteurl' );
$information['site_info'] = array(
'wpversion' => $wp_version,
'phpversion' => phpversion(),
'child_version' => self::$version,
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
'mysql_version' => MainWP_Child_Server_Information::getMySQLVersion(),
'ip' => $_SERVER['SERVER_ADDR']
);
//Try to switch to SSL if SSL is enabled in between!
$pubkey = get_option( 'mainwp_child_pubkey' );
$nossl = get_option( 'mainwp_child_nossl' );
@ -3495,6 +3505,29 @@ class MainWP_Child {
}
$information['syncWPRocketData'] = $data;
}
if ( isset( $othersData['syncPageSpeedData'] ) && !empty( $othersData['syncPageSpeedData'] ) ) {
if ( MainWP_Child_Pagespeed::Instance()->is_plugin_installed ) {
$information['syncPageSpeedData'] = MainWP_Child_Pagespeed::Instance()->sync_data();
}
}
if ( isset( $othersData['syncBrokenLinksCheckerData'] ) && !empty( $othersData['syncBrokenLinksCheckerData'] ) ) {
if ( MainWP_Child_Links_Checker::Instance()->is_plugin_installed ) {
$information['syncBrokenLinksCheckerData'] = MainWP_Child_Links_Checker::Instance()->sync_data();
}
}
if ( isset( $othersData['syncClientReportData'] ) && !empty( $othersData['syncClientReportData'] ) ) {
$creport_sync_data = array();
if ( ( $firsttime = get_option( 'mainwp_creport_first_time_activated' ) ) !== false ) {
$creport_sync_data['firsttime_activated'] = $firsttime;
}
if ( !empty( $creport_sync_data ) ) {
$information['syncClientReportData'] = $creport_sync_data;
}
}
}
$information['faviIcon'] = $this->get_favicon();
@ -4683,37 +4716,45 @@ class MainWP_Child {
$maint_options = array();
}
$performed_what = array();
if ( empty( $max_revisions ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Posts revisions deleted';
} else {
$results = MainWP_Helper::getRevisions( $max_revisions );
$count_deleted = MainWP_Helper::deleteRevisions( $results, $max_revisions );
$performed_what[] = 'Posts revisions deleted';
}
if ( in_array( 'autodraft', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Auto draft posts deleted';
}
if ( in_array( 'trashpost', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'trash'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Trash posts deleted';
}
if ( in_array( 'spam', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Spam comments deleted';
}
if ( in_array( 'pending', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = '0'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Pending comments deleted';
}
if ( in_array( 'trashcomment', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'";
$wpdb->query( $sql_clean );
$performed_what[] = 'Trash comments deleted';
}
if ( in_array( 'tags', $maint_options ) ) {
@ -4725,6 +4766,7 @@ class MainWP_Child {
}
}
}
$performed_what[] = 'Tags with 0 posts associated deleted';
}
if ( in_array( 'categories', $maint_options ) ) {
@ -4736,14 +4778,24 @@ class MainWP_Child {
}
}
}
$performed_what[] = 'Categories with 0 posts associated deleted';
}
if ( in_array( 'optimize', $maint_options ) ) {
$this->maintenance_optimize();
$performed_what[] = 'Database optimized';
}
if ( ! isset( $information['status'] ) ) {
$information['status'] = 'SUCCESS';
}
if ( !empty( $performed_what ) && has_action( 'mainwp_reports_maintenance' ) ) {
$details = implode( ', ', $performed_what );
$log_time = time();
$message = $result = "Maintenance Performed";
do_action( 'mainwp_reports_maintenance', $message, $log_time, $details, $result);
}
MainWP_Helper::write( $information );
}

View file

@ -2,8 +2,6 @@
class MainWP_Client_Report {
public static $instance = null;
public static $mainwpChildReports = false;
public static $streamVersionNumber = null;
static function Instance() {
if ( null === MainWP_Client_Report::$instance ) {
@ -16,6 +14,7 @@ class MainWP_Client_Report {
public static function init() {
add_filter( 'wp_stream_connectors', array( 'MainWP_Client_Report', 'init_stream_connectors' ), 10, 1 );
add_filter( 'mainwp_client_reports_connectors', array( 'MainWP_Client_Report', 'init_report_connectors' ), 10, 1 );
add_action( 'mainwp_child_log', array( 'MainWP_Client_Report', 'do_reports_log' ) );
}
public static function init_stream_connectors( $classes ) {
@ -58,18 +57,29 @@ class MainWP_Client_Report {
return $classes;
}
public static function do_reports_log( $ext = '' ) {
switch( $ext ) {
case 'backupbuddy':
MainWP_Child_Back_Up_Buddy::Instance()->do_reports_log( $ext );
break;
case 'backupwordpress':
MainWP_Child_Back_Up_Wordpress::Instance()->do_reports_log( $ext );
break;
case 'backwpup':
MainWP_Child_Back_WP_Up::Instance()->do_reports_log( $ext );
break;
case 'wordfence':
MainWP_Child_Wordfence::Instance()->do_reports_log( $ext );
break;
}
}
public function action() {
$information = array();
self::$mainwpChildReports = false;
if ( function_exists( 'mainwp_wp_stream_query' ) && class_exists( 'MainWP_WP_Stream' ) ) {
self::$mainwpChildReports = true;
} else if ( function_exists( 'wp_stream_query' ) && class_exists( 'WP_Stream' ) ) {
self::$streamVersionNumber = 149;
} else if ( function_exists( 'wp_stream_get_instance' ) && class_exists( 'WP_Stream\Plugin' ) ) {
self::$streamVersionNumber = 3;
} else {
$information['error'] = 'NO_STREAM';
if ( !function_exists( 'mainwp_wp_stream_query' ) || !class_exists( 'MainWP_WP_Stream' ) ) {
$information['error'] = 'NO_CREPORT';
MainWP_Helper::write( $information );
}
@ -87,9 +97,6 @@ class MainWP_Client_Report {
case 'set_showhide':
$information = $this->set_showhide();
break;
case 'save_settings':
$information = $this->save_settings();
break;
}
}
MainWP_Helper::write( $information );
@ -142,11 +149,7 @@ class MainWP_Client_Report {
$args = array();
foreach ( $allowed_params as $param ) {
if ( self::$mainwpChildReports ) {
$paramval = mainwp_wp_stream_filter_input( INPUT_POST, $param );
} else {
$paramval = wp_stream_filter_input( INPUT_POST, $param );
}
$paramval = mainwp_wp_stream_filter_input( INPUT_POST, $param );
if ( $paramval || '0' === $paramval ) {
$args[ $param ] = $paramval;
}
@ -224,25 +227,14 @@ class MainWP_Client_Report {
$args['action__not_in'] = array( 'login' );
// fix for Stream 3
if ( 3 !== self::$streamVersionNumber ) {
$args['fields'] = 'with-meta';
if ( isset( $args['date_from'] ) ) {
$args['date_from'] = date( 'Y-m-d H:i:s', $args['date_from'] );
}
$args['fields'] = 'with-meta';
if ( isset( $args['date_from'] ) ) {
$args['date_from'] = date( 'Y-m-d H:i:s', $args['date_from'] );
}
if ( isset( $args['date_to'] ) ) {
$args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] );
}
} else {
if ( isset( $args['date_from'] ) ) {
$args['date_from'] = date( 'Y-m-d', $args['date_from'] );
}
if ( isset( $args['date_to'] ) ) {
$args['date_to'] = date( 'Y-m-d', $args['date_to'] );
}
}
if ( isset( $args['date_to'] ) ) {
$args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] );
}
if ( MainWP_Child_Branding::is_branding() ) {
$args['hide_child_reports'] = 1;
@ -250,14 +242,7 @@ class MainWP_Client_Report {
$args['records_per_page'] = 9999;
if ( self::$mainwpChildReports ) {
$records = mainwp_wp_stream_query( $args );
} else if ( 149 === self::$streamVersionNumber ) {
$records = wp_stream_query( $args );
} else if ( 3 === self::$streamVersionNumber ) {
$records = wp_stream_get_instance()->db->query->query( $args );
}
$records = mainwp_wp_stream_query( $args );
if ( ! is_array( $records ) ) {
$records = array();
@ -380,6 +365,14 @@ class MainWP_Client_Report {
if ( $record->context !== 'mainwp_sucuri' ) {
continue;
}
} else if ( 'wordfence' === $context ) {
if ( $record->context !== 'wordfence_scans' ) {
continue;
}
} else if ( 'maintenance' === $context ) {
if ( $record->context !== 'mainwp_maintenances' ) {
continue;
}
} else {
if ( $action !== $record->action ) {
continue;
@ -451,6 +444,7 @@ class MainWP_Client_Report {
'oldversion',
'currentversion',
'date',
'time',
'count',
'author',
'old.version',
@ -499,7 +493,15 @@ class MainWP_Client_Report {
if ( $record->context !== 'mainwp_sucuri' ) {
continue;
}
} else {
} else if ( 'wordfence' === $context ) {
if ( $record->context !== 'wordfence_scans' ) {
continue;
}
} else if ( 'maintenance' === $context ) {
if ( $record->context !== 'mainwp_maintenances' ) {
continue;
}
} else {
if ( $action !== $record->action ) {
continue;
}
@ -564,8 +566,11 @@ class MainWP_Client_Report {
switch ( $data ) {
case 'date':
$token_values[ $token ] = MainWP_Helper::formatTimestamp( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
$token_values[ $token ] = MainWP_Helper::formatDate( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
break;
case 'time':
$token_values[ $token ] = MainWP_Helper::formatTime( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
break;
case 'area':
$data = 'sidebar_name';
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
@ -623,7 +628,13 @@ class MainWP_Client_Report {
if ( 'mainwp_sucuri' === $context ) {
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
} else {
$token_values[ $token ] = $token;
$token_values[ $token ] = $value;
}
break;
case 'details':
case 'result':
if ( 'wordfence' === $context || 'maintenance' === $context ) {
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
}
break;
case 'destination': // backup cases
@ -654,12 +665,7 @@ class MainWP_Client_Report {
return '';
}
$record_id = $record->ID;
$meta_key = $data;
if ( 3 === self::$streamVersionNumber && 'author_meta' === $meta_key ) {
$meta_key = 'user_meta';
}
$meta_key = $data;
$value = '';
@ -667,10 +673,7 @@ class MainWP_Client_Report {
$meta = $record->meta;
if ( isset( $meta[ $meta_key ] ) ) {
$value = $meta[ $meta_key ];
// fix for Stream 3
if ( 3 !== self::$streamVersionNumber ) {
$value = current( $value );
}
$value = current( $value );
if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) {
$value = maybe_unserialize( $value );
$value = $value['display_name'];
@ -690,16 +693,6 @@ class MainWP_Client_Report {
return $information;
}
function save_settings() {
$settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array();
$report_settings = get_option( 'mainwp_wp_stream', array() );
$report_settings['general_records_ttl'] = $settings['records_ttl'];
$report_settings['general_period_of_time'] = $settings['period_of_time'];
update_option('mainwp_wp_stream', $report_settings);
$information['result'] = 'success';
return $information;
}
public function creport_init() {
if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) {
return;
@ -716,11 +709,6 @@ class MainWP_Client_Report {
if ( isset( $_POST['mainwpsignature'] ) ) {
return $value;
}
if ( isset( $value->response['stream/stream.php'] ) ) {
unset( $value->response['stream/stream.php'] );
}
if ( isset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ) ) {
unset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] );
}
@ -732,7 +720,7 @@ class MainWP_Client_Report {
public function creport_branding_plugin( $plugins ) {
foreach ( $plugins as $key => $value ) {
$plugin_slug = basename( $key, '.php' );
if ( 'stream' === $plugin_slug || 'mainwp-child-reports' === $plugin_slug ) {
if ( 'mainwp-child-reports' === $plugin_slug ) {
unset( $plugins[ $key ] );
}
}
@ -741,7 +729,6 @@ class MainWP_Client_Report {
}
public function creport_remove_menu() {
remove_menu_page( 'wp_stream' );
remove_menu_page( 'mainwp_wp_stream' );
}
}

View file

@ -378,14 +378,14 @@ class MainWP_Clone {
$dirparts = '<a href="' . $durl . '">' . $part . DIRECTORY_SEPARATOR . '</a>' . $dirparts;
}
echo '<div style="padding: 8px 12px; background-color: #e5e5e5; margin-top: 1em;">' . __( '<strong>Current Directory:</strong> <span>' . $dirparts . '</span>', 'mainwp' ) . '</div>';
echo '<div style="padding: 8px 12px; background-color: #e5e5e5; margin-top: 1em;">' . __( '<strong>Current Directory:</strong> <span>' . $dirparts . '</span>', 'mainwp-child' ) . '</div>';
$quick_dirs = array();
$quick_dirs[] = array( __( 'Site Root', 'mainwp' ), ABSPATH );
$quick_dirs[] = array( __( 'Backup', 'mainwp' ), $backup_dir );
$quick_dirs[] = array( __( 'Site Root', 'mainwp-child' ), ABSPATH );
$quick_dirs[] = array( __( 'Backup', 'mainwp-child' ), $backup_dir );
if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) {
$quick_dirs[] = array( __( 'Uploads Folder', 'mainwp' ), $uploads['path'] );
$quick_dirs[] = array( __( 'Uploads Folder', 'mainwp-child' ), $uploads['path'] );
}
$quick_dirs[] = array( __( 'Content Folder', 'mainwp' ), WP_CONTENT_DIR );
$quick_dirs[] = array( __( 'Content Folder', 'mainwp-child' ), WP_CONTENT_DIR );
$quick_links = array();
foreach ( $quick_dirs as $dir ) {
@ -399,7 +399,7 @@ class MainWP_Clone {
}
if ( ! empty( $quick_links ) ) {
echo '<div style="padding: 8px 12px; border-bottom: 1px solid #e5e5e5; margin-bottom: 1em;"><strong>' . esc_html__( 'Quick Jump:', 'mainwp' ) . '</strong> ' . __( implode( ' | ', $quick_links ) ) . '</div>';
echo '<div style="padding: 8px 12px; border-bottom: 1px solid #e5e5e5; margin-bottom: 1em;"><strong>' . esc_html__( 'Quick Jump:', 'mainwp-child' ) . '</strong> ' . __( implode( ' | ', $quick_links ) ) . '</div>';
}
$dir_files = scandir( $current_dir );
@ -436,7 +436,7 @@ class MainWP_Clone {
<div class="clonesite_select_site_item">
<div class="mainwp-child_name_label">
<a href="<?php echo esc_url( add_query_arg( array( 'dir' => rawurlencode( $parent ) ), $url ) ); ?>"
title="<?php echo esc_attr( dirname( $current_dir ) ) ?>"><?php esc_html_e( 'Parent Folder', 'mainwp' ) ?></a>
title="<?php echo esc_attr( dirname( $current_dir ) ) ?>"><?php esc_html_e( 'Parent Folder', 'mainwp-child' ) ?></a>
</div>
</div>

View file

@ -980,6 +980,14 @@ class MainWP_Helper {
return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp );
}
public static function formatDate( $timestamp ) {
return date_i18n( get_option( 'date_format' ), $timestamp );
}
public static function formatTime( $timestamp ) {
return date_i18n( get_option( 'time_format' ), $timestamp );
}
public static function formatTimestamp( $timestamp ) {
return date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp );
}

View file

@ -304,7 +304,7 @@ class MainWP_Security {
}
public static function remove_theme_versions( $src ) {
if ( 'T' === self::get_security_option( 'styles_version' ) ) {
if ( self::get_security_option( 'styles_version' ) ) {
if ( strpos( $src, '?ver=' ) ) {
$src = remove_query_arg( 'ver', $src );
}

View file

@ -6,7 +6,7 @@
Author: MainWP
Author URI: https://mainwp.com
Text Domain: mainwp-child
Version: 3.2.6-beta
Version: 3.2.6
*/
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
header( 'X-Frame-Options: ALLOWALL' );