Merge with branch01

This commit is contained in:
Thang Hoang Van 2019-05-06 22:42:18 +07:00
parent 033af5c759
commit c3795a16a0
10 changed files with 76 additions and 33 deletions

View file

@ -610,6 +610,12 @@ class MainWP_Child_Back_Up_Buddy {
$information['schedules'] = pb_backupbuddy::$options['schedules']; $information['schedules'] = pb_backupbuddy::$options['schedules'];
$information['next_schedule_index'] = pb_backupbuddy::$options['next_schedule_index']; $information['next_schedule_index'] = pb_backupbuddy::$options['next_schedule_index'];
$information['schedules_run_time'] = $this->get_schedules_run_time(); $information['schedules_run_time'] = $this->get_schedules_run_time();
// to fix missing destination notice
if (isset(pb_backupbuddy::$options['remote_destinations'])) { // update
$information['remote_destinations'] = pb_backupbuddy::$options['remote_destinations'];
}
$information['result'] = 'SUCCESS'; $information['result'] = 'SUCCESS';
return $information; return $information;
} }

View file

@ -35,6 +35,7 @@ class MainWP_Child_Branding {
$opts['contact_label'] = $label; $opts['contact_label'] = $label;
$opts['extra_settings'] = get_option( 'mainwp_branding_extra_settings' ); $opts['extra_settings'] = get_option( 'mainwp_branding_extra_settings' );
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $opts );
} }
if ( !isset($opts['contact_label']) || empty($opts['contact_label']) ) { if ( !isset($opts['contact_label']) || empty($opts['contact_label']) ) {
@ -382,7 +383,7 @@ class MainWP_Child_Branding {
add_action( 'in_admin_footer', array( $this, 'in_admin_footer' ) ); add_action( 'in_admin_footer', array( $this, 'in_admin_footer' ) );
} else if (is_user_logged_in()) { } else if (is_user_logged_in()) {
// front end // front end
add_action( 'add_admin_bar_menus', array( $this, 'add_admin_bar_menus' )); add_action( 'wp_after_admin_bar_render', array( $this, 'after_admin_bar_render' ));
} }
$opts = $this->child_branding_options; $opts = $this->child_branding_options;
@ -429,7 +430,7 @@ class MainWP_Child_Branding {
// to fix // to fix
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );// add_action( 'admin_menu', array( &$this, 'admin_menu' ) );//
if ( $opts['disable_wp_branding'] !== 'Y' ) { if ( !isset($opts['disable_wp_branding']) || $opts['disable_wp_branding'] !== 'Y' ) {
add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 ); add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 );
add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 ); add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 );
// branding site generator // branding site generator
@ -986,7 +987,7 @@ class MainWP_Child_Branding {
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $this->child_branding_options ); MainWP_Helper::update_option( 'mainwp_child_branding_settings', $this->child_branding_options );
} }
public function add_admin_bar_menus() { public function after_admin_bar_render() {
$hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array()); $hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array());

View file

@ -139,7 +139,7 @@ class MainWP_Child_iThemes_Security {
add_action( 'admin_menu', array( $this, 'remove_menu' ) ); add_action( 'admin_menu', array( $this, 'remove_menu' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) ); add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'admin_head', array( &$this, 'custom_admin_css' ) ); add_action( 'admin_head', array( &$this, 'custom_admin_css' ) );
if ( isset($_GET['page']) && ($_GET['page'] == 'itsec' || $_GET['page'] == 'itsec-logs' || $_GET['page'] == 'itsec-security-check') ) { if ( isset($_GET['page']) && ($_GET['page'] == 'itsec' || $_GET['page'] == 'itsec-security-check') ) {
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' ); wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
exit(); exit();
} }

View file

@ -273,7 +273,7 @@ class MainWP_Child_Pagespeed {
$information['error'] = __( 'The API is busy checking other pages, please try again later.', 'gpagespeedi' ); $information['error'] = __( 'The API is busy checking other pages, please try again later.', 'gpagespeedi' );
} else { } else {
//do_action( 'googlepagespeedinsightsworker', array(), $forceRecheck ); //do_action( 'googlepagespeedinsightsworker', array(), $forceRecheck );
do_action( 'run_gpi', $forceRecheck ); // to fix do_action( 'run_gpi', $forceRecheck ); // to fix
$information['checked_pages'] = 1; $information['checked_pages'] = 1;
} }
} }
@ -342,7 +342,7 @@ class MainWP_Child_Pagespeed {
//$page_stats_column = $strategy . '_page_stats'; //$page_stats_column = $strategy . '_page_stats';
$data_typestocheck = self::getTypesToCheck( 'all' ); $data_typestocheck = self::get_filter_options( 'all' );
$gpi_page_stats = $wpdb->prefix . 'gpi_page_stats'; $gpi_page_stats = $wpdb->prefix . 'gpi_page_stats';
if ( ! empty( $data_typestocheck ) ) { if ( ! empty( $data_typestocheck ) ) {
@ -360,7 +360,7 @@ class MainWP_Child_Pagespeed {
$allpagedata = array(); $allpagedata = array();
} }
$reports_typestocheck = self::getTypesToCheck( 'all' ); $reports_typestocheck = self::get_filter_options( 'all' );
$gpi_page_reports = $wpdb->prefix . 'gpi_page_reports'; $gpi_page_reports = $wpdb->prefix . 'gpi_page_reports';
if ( ! empty( $reports_typestocheck ) ) { if ( ! empty( $reports_typestocheck ) ) {
@ -435,7 +435,7 @@ class MainWP_Child_Pagespeed {
); );
} }
static function getTypesToCheck($restrict_type = 'all') { static function get_filter_options($restrict_type = 'all') {
$types = array(); $types = array();
$gpi_options = get_option('gpagespeedi_options'); $gpi_options = get_option('gpagespeedi_options');
@ -496,6 +496,25 @@ class MainWP_Child_Pagespeed {
} }
} }
if ( $gpi_options['check_custom_urls'] ) {
global $wpdb;
$gpi_custom_urls = $wpdb->prefix . 'gpi_custom_urls';
$custom_url_types = $wpdb->get_col(
"
SELECT DISTINCT type
FROM $gpi_custom_urls
"
);
if ( ! empty( $custom_url_types ) ) {
foreach ( $custom_url_types as $custom_url_type ) {
$typestocheck[] = 'type = %s';
$types[1][] = $custom_url_type;
}
}
}
if(!empty($typestocheck)) { if(!empty($typestocheck)) {
$types[0] = ''; $types[0] = '';
foreach($typestocheck as $type) foreach($typestocheck as $type)

View file

@ -826,8 +826,8 @@ class MainWP_Child_Server_Information {
?> ?>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><?php echo $plugin['Name']; ?></td> <td><?php echo esc_html($plugin['Name']); ?></td>
<td><?php echo $plugin['Version']; ?></td> <td><?php echo esc_html($plugin['Version']); ?></td>
<td><?php echo is_plugin_active($slug) ? 'Active' : 'Inactive'; ?></td> <td><?php echo is_plugin_active($slug) ? 'Active' : 'Inactive'; ?></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
@ -1569,11 +1569,6 @@ class MainWP_Child_Server_Information {
public static function renderWPConfig() { public static function renderWPConfig() {
?> ?>
<style>
#mainwp-code-display code {
background: none !important;
}
</style>
<div class="postbox" id="mainwp-code-display"> <div class="postbox" id="mainwp-code-display">
<h3 class="hndle" style="padding: 8px 12px; font-size: 14px;"><span>WP-Config.php</span></h3> <h3 class="hndle" style="padding: 8px 12px; font-size: 14px;"><span>WP-Config.php</span></h3>
@ -1673,9 +1668,9 @@ class MainWP_Child_Server_Information {
foreach ($details as $row) { foreach ($details as $row) {
?> ?>
<tr> <tr>
<th style="width: 20%"><strong><?php echo $row['title']; ?></strong></th> <th style="width: 20%"><strong><?php echo esc_html($row['title']); ?></strong></th>
<td style="width: 20%"><strong><?php echo $row['value']; ?></strong></td> <td style="width: 20%"><strong><?php echo esc_html($row['value']); ?></strong></td>
<td><?php echo $row['desc']; ?></td> <td><?php echo esc_html($row['desc']); ?></td>
</tr> </tr>
<?php <?php
} }

View file

@ -31,6 +31,8 @@ class MainWP_Child_Staging {
public function __construct() { public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'wp-staging/wp-staging.php' ) && defined('WPSTG_PLUGIN_DIR')) { if ( is_plugin_active( 'wp-staging/wp-staging.php' ) && defined('WPSTG_PLUGIN_DIR')) {
$this->is_plugin_installed = true;
} else if ( is_plugin_active( 'wp-staging-pro/wp-staging-pro.php' ) ) {
$this->is_plugin_installed = true; $this->is_plugin_installed = true;
} }
@ -429,6 +431,10 @@ class MainWP_Child_Staging {
unset( $value->response['wp-staging/wp-staging.php'] ); unset( $value->response['wp-staging/wp-staging.php'] );
} }
if ( isset( $value->response['wp-staging-pro/wp-staging-pro.php'] ) ) {
unset( $value->response['wp-staging-pro/wp-staging-pro.php'] );
}
return $value; return $value;
} }
} }

View file

@ -40,10 +40,10 @@ class MainWP_Child_Timecapsule {
public function init() { public function init() {
if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' ) if (!$this->is_plugin_installed)
return; return;
if (!$this->is_plugin_installed) if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' )
return; return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -70,8 +70,6 @@ class MainWP_Child_Timecapsule {
} }
$information = array(); $information = array();
if (get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y')
MainWP_Helper::update_option( 'mainwp_time_capsule_ext_enabled', 'Y', 'yes' );
$options_helper = new Wptc_Options_Helper(); $options_helper = new Wptc_Options_Helper();
$options = WPTC_Factory::get('config'); $options = WPTC_Factory::get('config');
@ -245,6 +243,8 @@ class MainWP_Child_Timecapsule {
public function syncOthersData( $information, $data = array() ) { public function syncOthersData( $information, $data = array() ) {
if ( isset( $data['syncWPTimeCapsule'] ) && $data['syncWPTimeCapsule'] ) { if ( isset( $data['syncWPTimeCapsule'] ) && $data['syncWPTimeCapsule'] ) {
$information['syncWPTimeCapsule'] = $this->get_sync_data(); $information['syncWPTimeCapsule'] = $this->get_sync_data();
if (get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y')
MainWP_Helper::update_option( 'mainwp_time_capsule_ext_enabled', 'Y', 'yes' );
} }
return $information; return $information;
} }
@ -724,6 +724,10 @@ function get_sibling_files_callback_wptc() {
} }
$last_time = time() - 24 * 7 * 2 * 60 * 60; // 2 weeks ago $last_time = time() - 24 * 7 * 2 * 60 * 60; // 2 weeks ago
$lasttime_logged = MainWP_Helper::get_lasttime_backup('wptimecapsule');
if (empty($lasttime_logged))
$last_time = time() - 24 * 7 * 8 * 60 * 60; // 8 weeks ago
$all_last_backups = $this->getBackups( $last_time ); $all_last_backups = $this->getBackups( $last_time );
if (is_array($all_last_backups)) { if (is_array($all_last_backups)) {

View file

@ -940,7 +940,11 @@ class MainWP_Child_Updraft_Plus_Backups {
do_action( $event, apply_filters( 'updraft_backupnow_options', $options, array() ) ); do_action( $event, apply_filters( 'updraft_backupnow_options', $options, array() ) );
return $msg; //return $msg;
// Control returns when the backup finished; but, the browser connection should have been closed before
die;
// not used anymore // not used anymore
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) { // if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {

View file

@ -580,7 +580,7 @@ class MainWP_Child {
remove_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 ); remove_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
set_site_transient( 'mainwp_update_plugins_cached', $plugins, DAY_IN_SECONDS); set_site_transient( 'mainwp_update_plugins_cached', $plugins, DAY_IN_SECONDS);
wp_destroy_current_session(); // to fix issue multi user session //wp_destroy_current_session(); // to fix issue multi user session
} }
@ -590,7 +590,7 @@ class MainWP_Child {
remove_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 ); remove_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
set_site_transient( 'mainwp_update_themes_cached', $themes, DAY_IN_SECONDS); set_site_transient( 'mainwp_update_themes_cached', $themes, DAY_IN_SECONDS);
wp_destroy_current_session(); // to fix issue multi user session //wp_destroy_current_session(); // to fix issue multi user session
} }
@ -607,7 +607,7 @@ class MainWP_Child {
if (isset($this->callableFunctions[ $function ])) { if (isset($this->callableFunctions[ $function ])) {
call_user_func( array( $this, $this->callableFunctions[ $function ] ) ); call_user_func( array( $this, $this->callableFunctions[ $function ] ) );
} }
wp_destroy_current_session(); // to fix issue multi user session //wp_destroy_current_session(); // to fix issue multi user session
} }
} }
@ -1593,7 +1593,7 @@ class MainWP_Child {
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) { if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
new MainWP_Keyword_Links(); new MainWP_Keyword_Links();
if ( ! is_admin() ) { if ( ! is_admin() ) {
add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 ); //add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 );
} }
MainWP_Keyword_Links::Instance()->update_htaccess(); // if needed MainWP_Keyword_Links::Instance()->update_htaccess(); // if needed
MainWP_Keyword_Links::Instance()->redirect_cloak(); MainWP_Keyword_Links::Instance()->redirect_cloak();
@ -4013,6 +4013,14 @@ class MainWP_Child {
$information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info(); $information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info();
$information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info(); $information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info();
if (isset( $_POST['user'] )) {
$user = get_user_by( 'login', $_POST['user'] );
if ( $user && property_exists($user, 'ID') && $user->ID) {
$information['admin_nicename'] = $user->data->user_nicename;
$information['admin_useremail'] = $user->data->user_email;
}
}
try { try {
do_action('mainwp_child_site_stats'); do_action('mainwp_child_site_stats');
} catch(Exception $e) { } catch(Exception $e) {

View file

@ -143,7 +143,7 @@ class MainWP_Helper {
// to fix issue re-create new attachment // to fix issue re-create new attachment
if ( $check_file_existed ) { if ( $check_file_existed ) {
if ( file_exists( $local_img_path ) ) { if ( file_exists( $local_img_path ) ) {
if ( filesize( $local_img_path ) == filesize( $temporary_file ) ) { // file exited if ( filesize( $local_img_path ) == filesize( $temporary_file ) ) { // file exited
$result = self::get_maybe_existed_attached_id( $local_img_url ); $result = self::get_maybe_existed_attached_id( $local_img_url );
if ( is_array($result) ) { // found attachment if ( is_array($result) ) { // found attachment
@ -1210,27 +1210,27 @@ class MainWP_Helper {
switch($by) { switch($by) {
case 'backupbuddy': case 'backupbuddy':
if ( !is_plugin_active( 'backupbuddy/backupbuddy.php' ) && !is_plugin_active( 'Backupbuddy/backupbuddy.php' )) { if ( !is_plugin_active( 'backupbuddy/backupbuddy.php' ) && !is_plugin_active( 'Backupbuddy/backupbuddy.php' )) {
return -1; return 0;
} }
break; break;
case 'backupwordpress': case 'backupwordpress':
if ( !is_plugin_active( 'backupwordpress/backupwordpress.php' )) { if ( !is_plugin_active( 'backupwordpress/backupwordpress.php' )) {
return -1; return 0;
} }
break; break;
case 'backwpup': case 'backwpup':
if ( !is_plugin_active( 'backwpup/backwpup.php' ) && !is_plugin_active( 'backwpup-pro/backwpup.php' ) ) { if ( !is_plugin_active( 'backwpup/backwpup.php' ) && !is_plugin_active( 'backwpup-pro/backwpup.php' ) ) {
return -1; return 0;
} }
break; break;
case 'updraftplus': case 'updraftplus':
if ( !is_plugin_active( 'updraftplus/updraftplus.php' )) { if ( !is_plugin_active( 'updraftplus/updraftplus.php' )) {
return -1; return 0;
} }
break; break;
case 'wptimecapsule': case 'wptimecapsule':
if ( !is_plugin_active( 'wp-time-capsule/wp-time-capsule.php' )) { if ( !is_plugin_active( 'wp-time-capsule/wp-time-capsule.php' )) {
return -1; return 0;
} }
break; break;
default: default: