mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
Merge pull request #38 from mainwp/bogdan01-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
6356d22be7
28 changed files with 891 additions and 829 deletions
|
@ -118,7 +118,7 @@ class MainWP_Backup {
|
||||||
@ini_set( 'max_execution_time', $this->timeout );
|
@ini_set( 'max_execution_time', $this->timeout );
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
if ( !is_array( $files ) ) {
|
if ( ! is_array( $files ) ) {
|
||||||
$files = array( $files );
|
$files = array( $files );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class MainWP_Backup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !$error;
|
return ! $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$this->is_backupbuddy_installed = true;
|
$this->is_backupbuddy_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_backupbuddy_installed) {
|
if ( ! $this->is_backupbuddy_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_backupbuddy_installed) {
|
if ( ! $this->is_backupbuddy_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,14 +132,14 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
// Backup type.
|
// Backup type.
|
||||||
$pretty_type = array(
|
$pretty_type = array(
|
||||||
'full' => 'Full',
|
'full' => 'Full',
|
||||||
'db' => 'Database',
|
'db' => 'Database',
|
||||||
'files' => 'Files',
|
'files' => 'Files',
|
||||||
);
|
);
|
||||||
|
|
||||||
$recentBackups_list = glob( backupbuddy_core::getLogDirectory() . 'fileoptions/*.txt' );
|
$recentBackups_list = glob( backupbuddy_core::getLogDirectory() . 'fileoptions/*.txt' );
|
||||||
|
|
||||||
foreach( $recentBackups_list as $backup_fileoptions ) {
|
foreach ( $recentBackups_list as $backup_fileoptions ) {
|
||||||
|
|
||||||
$backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true );
|
$backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true );
|
||||||
if ( method_exists($backup, 'is_ok') && true !== ( $result = $backup->is_ok() ) ) {
|
if ( method_exists($backup, 'is_ok') && true !== ( $result = $backup->is_ok() ) ) {
|
||||||
|
@ -148,7 +148,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$backup = &$backup->options;
|
$backup = &$backup->options;
|
||||||
|
|
||||||
if ( !isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) {
|
if ( ! isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$finish_time = $backup['finish_time'];
|
$finish_time = $backup['finish_time'];
|
||||||
$message = 'BackupBuddy ' . $backupType . ' finished';
|
$message = 'BackupBuddy ' . $backupType . ' finished';
|
||||||
if (!empty($finish_time)) {
|
if ( ! empty($finish_time)) {
|
||||||
do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
|
do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$finish_time = $state['stats']['last_remote_snapshot'];
|
$finish_time = $state['stats']['last_remote_snapshot'];
|
||||||
$backupType = 'Live Backup to cloud';
|
$backupType = 'Live Backup to cloud';
|
||||||
$message = 'BackupBuddy ' . $backupType . ' finished';
|
$message = 'BackupBuddy ' . $backupType . ' finished';
|
||||||
if (!empty($finish_time)) {
|
if ( ! empty($finish_time)) {
|
||||||
do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
|
do_action( 'mainwp_reports_backupbuddy_backup', $message, $backupType, $finish_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
|
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( pb_backupbuddy::$options ) ) {
|
if ( ! isset( pb_backupbuddy::$options ) ) {
|
||||||
pb_backupbuddy::load();
|
pb_backupbuddy::load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,26 +489,26 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
if (is_array($settings)) {
|
if (is_array($settings)) {
|
||||||
if ($type === 'all' || 'general_settings' === $type) {
|
if ($type === 'all' || 'general_settings' === $type) {
|
||||||
foreach($filter_general_settings as $field) {
|
foreach ($filter_general_settings as $field) {
|
||||||
if(isset($settings[ $field ])) {
|
if (isset($settings[ $field ])) {
|
||||||
$save_settings[ $field ] = $settings[ $field ];
|
$save_settings[ $field ] = $settings[ $field ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type === 'all' || 'advanced_settings' === $type) {
|
if ($type === 'all' || 'advanced_settings' === $type) {
|
||||||
foreach($filter_advanced_settings as $field) {
|
foreach ($filter_advanced_settings as $field) {
|
||||||
if(isset($settings[ $field ])) {
|
if (isset($settings[ $field ])) {
|
||||||
$save_settings[ $field ] = $settings[ $field ];
|
$save_settings[ $field ] = $settings[ $field ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($save_settings)) {
|
if ( ! empty($save_settings)) {
|
||||||
$newOptions = pb_backupbuddy::$options;
|
$newOptions = pb_backupbuddy::$options;
|
||||||
|
|
||||||
foreach($newOptions as $key => $val) {
|
foreach ($newOptions as $key => $val) {
|
||||||
if (isset($save_settings[ $key ])) {
|
if (isset($save_settings[ $key ])) {
|
||||||
$newOptions[ $key ] = $save_settings[ $key ];
|
$newOptions[ $key ] = $save_settings[ $key ];
|
||||||
}
|
}
|
||||||
|
@ -632,7 +632,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$schedule_id = (int) $_POST['schedule_id'];
|
$schedule_id = (int) $_POST['schedule_id'];
|
||||||
|
|
||||||
if ( !isset( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) || ! is_array( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) ) {
|
if ( ! isset( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) || ! is_array( pb_backupbuddy::$options['schedules'][ $schedule_id ] ) ) {
|
||||||
return array( 'error' => __( 'Error: not found the backup schedule or invalid data', 'mainwp-child' ) );
|
return array( 'error' => __( 'Error: not found the backup schedule or invalid data', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,12 +650,12 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$schedule_id = intval($_POST['schedule_id']);
|
$schedule_id = intval($_POST['schedule_id']);
|
||||||
$schedule = unserialize(base64_decode($_POST['data']));
|
$schedule = unserialize(base64_decode($_POST['data']));
|
||||||
|
|
||||||
if (!is_array($schedule)) {
|
if ( ! is_array($schedule)) {
|
||||||
return array( 'error' => __( 'Invalid schedule data', 'mainwp-child' ) );
|
return array( 'error' => __( 'Invalid schedule data', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
$information = array();
|
$information = array();
|
||||||
// add new
|
// add new
|
||||||
if (!isset(pb_backupbuddy::$options['schedules'][ $schedule_id ])) {
|
if ( ! isset(pb_backupbuddy::$options['schedules'][ $schedule_id ])) {
|
||||||
$next_index = pb_backupbuddy::$options['next_schedule_index'];
|
$next_index = pb_backupbuddy::$options['next_schedule_index'];
|
||||||
pb_backupbuddy::$options['next_schedule_index']++; // This change will be saved in savesettings function below.
|
pb_backupbuddy::$options['next_schedule_index']++; // This change will be saved in savesettings function below.
|
||||||
pb_backupbuddy::$options['schedules'][ $schedule_id ] = $schedule;
|
pb_backupbuddy::$options['schedules'][ $schedule_id ] = $schedule;
|
||||||
|
@ -683,7 +683,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$profile_id = $_POST['profile_id'];
|
$profile_id = $_POST['profile_id'];
|
||||||
$profile = unserialize(base64_decode($_POST['data']));
|
$profile = unserialize(base64_decode($_POST['data']));
|
||||||
|
|
||||||
if (!is_array($profile)) {
|
if ( ! is_array($profile)) {
|
||||||
return array( 'error' => __( 'Invalid profile data', 'mainwp-child' ) );
|
return array( 'error' => __( 'Invalid profile data', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
if ( is_array( $item_ids ) && count( $item_ids ) > 0 ) {
|
if ( is_array( $item_ids ) && count( $item_ids ) > 0 ) {
|
||||||
$needs_save = false;
|
$needs_save = false;
|
||||||
$deleted_files = array();
|
$deleted_files = array();
|
||||||
foreach( $item_ids as $item ) {
|
foreach ( $item_ids as $item ) {
|
||||||
if ( file_exists( backupbuddy_core::getBackupDirectory() . $item ) ) {
|
if ( file_exists( backupbuddy_core::getBackupDirectory() . $item ) ) {
|
||||||
if ( @unlink( backupbuddy_core::getBackupDirectory() . $item ) === true ) {
|
if ( @unlink( backupbuddy_core::getBackupDirectory() . $item ) === true ) {
|
||||||
$deleted_files[] = $item;
|
$deleted_files[] = $item;
|
||||||
|
@ -755,7 +755,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
if ( isset( $data['syncBackupBuddy'] ) && $data['syncBackupBuddy'] ) {
|
if ( isset( $data['syncBackupBuddy'] ) && $data['syncBackupBuddy'] ) {
|
||||||
try {
|
try {
|
||||||
$information['syncBackupBuddy'] = $this->get_sync_data();
|
$information['syncBackupBuddy'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,14 +781,14 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
MainWP_Helper::check_methods('backupbuddy_api', array( 'getOverview' ) );
|
MainWP_Helper::check_methods('backupbuddy_api', array( 'getOverview' ) );
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['plugins_root'] = backupbuddy_core::get_plugins_root();
|
$data['plugins_root'] = backupbuddy_core::get_plugins_root();
|
||||||
$data['themes_root'] = backupbuddy_core::get_themes_root();
|
$data['themes_root'] = backupbuddy_core::get_themes_root();
|
||||||
$data['media_root'] = backupbuddy_core::get_media_root();
|
$data['media_root'] = backupbuddy_core::get_media_root();
|
||||||
$data['additional_tables'] = $this->pb_additional_tables();
|
$data['additional_tables'] = $this->pb_additional_tables();
|
||||||
$data['abspath'] = ABSPATH;
|
$data['abspath'] = ABSPATH;
|
||||||
|
|
||||||
$getOverview = backupbuddy_api::getOverview();
|
$getOverview = backupbuddy_api::getOverview();
|
||||||
$data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup'];
|
$data['editsSinceLastBackup'] = $getOverview['editsSinceLastBackup'];
|
||||||
|
|
||||||
if ( isset( $getOverview['lastBackupStats']['finish'] ) ) {
|
if ( isset( $getOverview['lastBackupStats']['finish'] ) ) {
|
||||||
$finish_time = $getOverview['lastBackupStats']['finish'];
|
$finish_time = $getOverview['lastBackupStats']['finish'];
|
||||||
|
@ -801,7 +801,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
// not exit here
|
// not exit here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_note() {
|
function save_note() {
|
||||||
if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
|
if ( ! isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
|
||||||
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
|
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
|
||||||
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() );
|
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() );
|
||||||
}
|
}
|
||||||
|
@ -874,11 +874,11 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$file = backupbuddy_core::getBackupDirectory() . $callback_data;
|
$file = backupbuddy_core::getBackupDirectory() . $callback_data;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
return array(
|
return array(
|
||||||
'result' =>'SUCCESS',
|
'result' => 'SUCCESS',
|
||||||
'hash' => md5_file( $file ),
|
'hash' => md5_file( $file ),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return array( 'error' =>'Not found the file' );
|
return array( 'error' => 'Not found the file' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,7 +929,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$subdirs = array();
|
$subdirs = array();
|
||||||
|
|
||||||
// Strip out any files/subdirs that are not actually directly under the given root
|
// Strip out any files/subdirs that are not actually directly under the given root
|
||||||
foreach( $files as $key => $file ) {
|
foreach ( $files as $key => $file ) {
|
||||||
|
|
||||||
// If shorter than root length then certainly is not within this (root) directory.
|
// If shorter than root length then certainly is not within this (root) directory.
|
||||||
// It's a quick test that is more effective the longer the root (the deeper you go
|
// It's a quick test that is more effective the longer the root (the deeper you go
|
||||||
|
@ -976,7 +976,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$subdir = substr( $unrooted_file, 0, ( $pos + 1 ) );
|
$subdir = substr( $unrooted_file, 0, ( $pos + 1 ) );
|
||||||
|
|
||||||
// Have we already seen it
|
// Have we already seen it
|
||||||
if ( !in_array( $subdir, $subdirs ) ) {
|
if ( ! in_array( $subdir, $subdirs ) ) {
|
||||||
|
|
||||||
// Not already seen so record we have seen it and modify this entry to be
|
// Not already seen so record we have seen it and modify this entry to be
|
||||||
// specific for the subdir/
|
// specific for the subdir/
|
||||||
|
@ -1012,7 +1012,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
function exclude_tree() {
|
function exclude_tree() {
|
||||||
$root = substr( ABSPATH, 0, strlen( ABSPATH ) - 1 ) . '/' . ltrim( urldecode( $_POST['dir'] ), '/\\' );
|
$root = substr( ABSPATH, 0, strlen( ABSPATH ) - 1 ) . '/' . ltrim( urldecode( $_POST['dir'] ), '/\\' );
|
||||||
if( file_exists( $root ) ) {
|
if ( file_exists( $root ) ) {
|
||||||
$files = scandir( $root );
|
$files = scandir( $root );
|
||||||
|
|
||||||
natcasesort( $files );
|
natcasesort( $files );
|
||||||
|
@ -1020,11 +1020,11 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
// Sort with directories first.
|
// Sort with directories first.
|
||||||
$sorted_files = array(); // Temporary holder for sorting files.
|
$sorted_files = array(); // Temporary holder for sorting files.
|
||||||
$sorted_directories = array(); // Temporary holder for sorting directories.
|
$sorted_directories = array(); // Temporary holder for sorting directories.
|
||||||
foreach( $files as $file ) {
|
foreach ( $files as $file ) {
|
||||||
if ( ( $file == '.' ) || ( $file == '..' ) ) {
|
if ( ( $file == '.' ) || ( $file == '..' ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( is_file( str_replace( '//', '/', $root . $file ) ) ) {
|
if ( is_file( str_replace( '//', '/', $root . $file ) ) ) {
|
||||||
array_push( $sorted_files, $file );
|
array_push( $sorted_files, $file );
|
||||||
} else {
|
} else {
|
||||||
array_unshift( $sorted_directories, $file );
|
array_unshift( $sorted_directories, $file );
|
||||||
|
@ -1037,10 +1037,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
if( count( $files ) > 0 ) { // Files found.
|
if ( count( $files ) > 0 ) { // Files found.
|
||||||
echo '<ul class="jqueryFileTree" style="display: none;">';
|
echo '<ul class="jqueryFileTree" style="display: none;">';
|
||||||
foreach( $files as $file ) {
|
foreach ( $files as $file ) {
|
||||||
if( file_exists( str_replace( '//', '/', $root . $file ) ) ) {
|
if ( file_exists( str_replace( '//', '/', $root . $file ) ) ) {
|
||||||
if ( is_dir( str_replace( '//', '/', $root . $file ) ) ) { // Directory.
|
if ( is_dir( str_replace( '//', '/', $root . $file ) ) ) { // Directory.
|
||||||
echo '<li class="directory collapsed">';
|
echo '<li class="directory collapsed">';
|
||||||
$return = '';
|
$return = '';
|
||||||
|
@ -1091,7 +1091,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
} else {
|
} else {
|
||||||
$results = $wpdb->get_results( 'SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()', ARRAY_A );
|
$results = $wpdb->get_results( 'SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()', ARRAY_A );
|
||||||
}
|
}
|
||||||
foreach( $results as $result ) {
|
foreach ( $results as $result ) {
|
||||||
|
|
||||||
if ( true === $display_size ) {
|
if ( true === $display_size ) {
|
||||||
// Fix up row count and average row length for InnoDB engine which returns inaccurate (and changing) values for these.
|
// Fix up row count and average row length for InnoDB engine which returns inaccurate (and changing) values for these.
|
||||||
|
@ -1189,7 +1189,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$files_array = explode( ',', $files );
|
$files_array = explode( ',', $files );
|
||||||
$files = array();
|
$files = array();
|
||||||
foreach( $files_array as $file ) {
|
foreach ( $files_array as $file ) {
|
||||||
if ( substr( $file, -1 ) == '/' ) { // If directory then add wildcard.
|
if ( substr( $file, -1 ) == '/' ) { // If directory then add wildcard.
|
||||||
$file = $file . '*';
|
$file = $file . '*';
|
||||||
}
|
}
|
||||||
|
@ -1230,10 +1230,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$files = array_merge( $files, $files2 );
|
$files = array_merge( $files, $files2 );
|
||||||
|
|
||||||
if ( is_array( $files ) && !empty( $files ) ) { // For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
|
if ( is_array( $files ) && ! empty( $files ) ) { // For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
|
||||||
|
|
||||||
$backup_prefix = backupbuddy_core::backup_prefix(); // Backup prefix for this site. Used for MS checking that this user can see this backup.
|
$backup_prefix = backupbuddy_core::backup_prefix(); // Backup prefix for this site. Used for MS checking that this user can see this backup.
|
||||||
foreach( $files as $file_id => $file ) {
|
foreach ( $files as $file_id => $file ) {
|
||||||
|
|
||||||
if ( ( $subsite_mode === true ) && is_multisite() ) { // If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes.
|
if ( ( $subsite_mode === true ) && is_multisite() ) { // If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes.
|
||||||
|
|
||||||
|
@ -1258,19 +1258,19 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
// Backup status.
|
// Backup status.
|
||||||
$pretty_status = array(
|
$pretty_status = array(
|
||||||
true => '<span class="pb_label pb_label-success">Good</span>', // v4.0+ Good.
|
true => '<span class="pb_label pb_label-success">Good</span>', // v4.0+ Good.
|
||||||
'pass' => '<span class="pb_label pb_label-success">Good</span>', // Pre-v4.0 Good.
|
'pass' => '<span class="pb_label pb_label-success">Good</span>', // Pre-v4.0 Good.
|
||||||
false => '<span class="pb_label pb_label-important">Bad</span>', // v4.0+ Bad.
|
false => '<span class="pb_label pb_label-important">Bad</span>', // v4.0+ Bad.
|
||||||
'fail' => '<span class="pb_label pb_label-important">Bad</span>', // Pre-v4.0 Bad.
|
'fail' => '<span class="pb_label pb_label-important">Bad</span>', // Pre-v4.0 Bad.
|
||||||
);
|
);
|
||||||
|
|
||||||
// Backup type.
|
// Backup type.
|
||||||
$pretty_type = array(
|
$pretty_type = array(
|
||||||
'full' => 'Full',
|
'full' => 'Full',
|
||||||
'db' => 'Database',
|
'db' => 'Database',
|
||||||
'files' => 'Files',
|
'files' => 'Files',
|
||||||
'themes' => 'Themes',
|
'themes' => 'Themes',
|
||||||
'plugins' => 'Plugins',
|
'plugins' => 'Plugins',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Defaults...
|
// Defaults...
|
||||||
|
@ -1331,7 +1331,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
$integrity = pb_backupbuddy::$format->prettify( $status, $pretty_status ) . ' ';
|
$integrity = pb_backupbuddy::$format->prettify( $status, $pretty_status ) . ' ';
|
||||||
if ( isset( $backup_integrity['scan_notes'] ) && count( (array) $backup_integrity['scan_notes'] ) > 0 ) {
|
if ( isset( $backup_integrity['scan_notes'] ) && count( (array) $backup_integrity['scan_notes'] ) > 0 ) {
|
||||||
foreach( (array) $backup_integrity['scan_notes'] as $scan_note ) {
|
foreach ( (array) $backup_integrity['scan_notes'] as $scan_note ) {
|
||||||
$integrity .= $scan_note . ' ';
|
$integrity .= $scan_note . ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1368,7 +1368,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
arsort( $backup_sort_dates );
|
arsort( $backup_sort_dates );
|
||||||
// Re-arrange backups based on sort dates.
|
// Re-arrange backups based on sort dates.
|
||||||
$sorted_backups = array();
|
$sorted_backups = array();
|
||||||
foreach( $backup_sort_dates as $backup_file => $backup_sort_date ) {
|
foreach ( $backup_sort_dates as $backup_file => $backup_sort_date ) {
|
||||||
$sorted_backups[ $backup_file ] = $backups[ $backup_file ];
|
$sorted_backups[ $backup_file ] = $backups[ $backup_file ];
|
||||||
unset( $backups[ $backup_file ] );
|
unset( $backups[ $backup_file ] );
|
||||||
}
|
}
|
||||||
|
@ -1387,12 +1387,12 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
// Backup type.
|
// Backup type.
|
||||||
$pretty_type = array(
|
$pretty_type = array(
|
||||||
'full' => 'Full',
|
'full' => 'Full',
|
||||||
'db' => 'Database',
|
'db' => 'Database',
|
||||||
'files' => 'Files',
|
'files' => 'Files',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach( $recentBackups_list as $backup_fileoptions ) {
|
foreach ( $recentBackups_list as $backup_fileoptions ) {
|
||||||
|
|
||||||
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
|
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
|
||||||
pb_backupbuddy::status( 'details', 'Fileoptions instance #1.' );
|
pb_backupbuddy::status( 'details', 'Fileoptions instance #1.' );
|
||||||
|
@ -1403,7 +1403,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
$backup = &$backup->options;
|
$backup = &$backup->options;
|
||||||
|
|
||||||
if ( !isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) {
|
if ( ! isset( $backup['serial'] ) || ( $backup['serial'] == '' ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ( $backup['finish_time'] >= $backup['start_time'] ) && ( 0 != $backup['start_time'] ) ) {
|
if ( ( $backup['finish_time'] >= $backup['start_time'] ) && ( 0 != $backup['start_time'] ) ) {
|
||||||
|
@ -1485,17 +1485,17 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
);
|
);
|
||||||
|
|
||||||
function pb_backupbuddy_aasort ( &$array, $key) {
|
function pb_backupbuddy_aasort ( &$array, $key) {
|
||||||
$sorter=array();
|
$sorter = array();
|
||||||
$ret=array();
|
$ret = array();
|
||||||
reset($array);
|
reset($array);
|
||||||
foreach ($array as $ii => $va) {
|
foreach ($array as $ii => $va) {
|
||||||
$sorter[ $ii ]=$va[ $key ];
|
$sorter[ $ii ] = $va[ $key ];
|
||||||
}
|
}
|
||||||
asort($sorter);
|
asort($sorter);
|
||||||
foreach ($sorter as $ii => $va) {
|
foreach ($sorter as $ii => $va) {
|
||||||
$ret[ $ii ]=$array[ $ii ];
|
$ret[ $ii ] = $array[ $ii ];
|
||||||
}
|
}
|
||||||
$array=$ret;
|
$array = $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
pb_backupbuddy_aasort( $recentBackups, 'start_timestamp' ); // Sort by multidimensional array with key start_timestamp.
|
pb_backupbuddy_aasort( $recentBackups, 'start_timestamp' ); // Sort by multidimensional array with key start_timestamp.
|
||||||
|
@ -1506,7 +1506,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_scheduled_backup() {
|
function delete_scheduled_backup() {
|
||||||
$schedule_ids = $_POST['schedule_ids'];
|
$schedule_ids = $_POST['schedule_ids'];
|
||||||
$schedule_ids = explode(',', $schedule_ids);
|
$schedule_ids = explode(',', $schedule_ids);
|
||||||
|
|
||||||
if (empty($schedule_ids)) {
|
if (empty($schedule_ids)) {
|
||||||
|
@ -1537,7 +1537,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
<textarea readonly="readonly" id="backupbuddy_messages" wrap="off" style="width: 100%; min-height: 400px; height: 500px; height: 80%; background: #FFF;">
|
<textarea readonly="readonly" id="backupbuddy_messages" wrap="off" style="width: 100%; min-height: 400px; height: 500px; height: 80%; background: #FFF;">
|
||||||
<?php
|
<?php
|
||||||
foreach( (array) $lines as $rawline ) {
|
foreach ( (array) $lines as $rawline ) {
|
||||||
$line = json_decode( $rawline, true );
|
$line = json_decode( $rawline, true );
|
||||||
//print_r( $line );
|
//print_r( $line );
|
||||||
if ( is_array( $line ) ) {
|
if ( is_array( $line ) ) {
|
||||||
|
@ -1602,7 +1602,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
if ( isset( $integrity['status_details'] ) ) { // $integrity['status_details'] is NOT array (old, pre-3.1.9).
|
if ( isset( $integrity['status_details'] ) ) { // $integrity['status_details'] is NOT array (old, pre-3.1.9).
|
||||||
echo '<h3>Integrity Technical Details</h3>';
|
echo '<h3>Integrity Technical Details</h3>';
|
||||||
echo '<textarea style="width: 100%; height: 175px;" wrap="off">';
|
echo '<textarea style="width: 100%; height: 175px;" wrap="off">';
|
||||||
foreach( $integrity as $item_name => $item_value ) {
|
foreach ( $integrity as $item_name => $item_value ) {
|
||||||
$item_value = str_replace( '<br />', '<br>', $item_value );
|
$item_value = str_replace( '<br />', '<br>', $item_value );
|
||||||
$item_value = str_replace( '<br><br>', '<br>', $item_value );
|
$item_value = str_replace( '<br><br>', '<br>', $item_value );
|
||||||
$item_value = str_replace( '<br>', "\n ", $item_value );
|
$item_value = str_replace( '<br>', "\n ", $item_value );
|
||||||
|
@ -1636,7 +1636,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
} else { // 4.0+ Tests.
|
} else { // 4.0+ Tests.
|
||||||
$tests = array();
|
$tests = array();
|
||||||
if ( isset( $integrity['tests'] ) ) {
|
if ( isset( $integrity['tests'] ) ) {
|
||||||
foreach( (array) $integrity['tests'] as $test ) {
|
foreach ( (array) $integrity['tests'] as $test ) {
|
||||||
if ( true === $test['pass'] ) {
|
if ( true === $test['pass'] ) {
|
||||||
$status_text = '<span class="pb_label pb_label-success">Pass</span>';
|
$status_text = '<span class="pb_label pb_label-success">Pass</span>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1655,8 +1655,8 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
pb_backupbuddy::$ui->list_table(
|
pb_backupbuddy::$ui->list_table(
|
||||||
$tests,
|
$tests,
|
||||||
array(
|
array(
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
'css' => 'width: 100%; min-width: 200px;',
|
'css' => 'width: 100%; min-width: 200px;',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1672,8 +1672,8 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
pb_backupbuddy::$ui->list_table(
|
pb_backupbuddy::$ui->list_table(
|
||||||
$metaInfo,
|
$metaInfo,
|
||||||
array(
|
array(
|
||||||
'columns' => array( 'Backup Details', 'Value' ),
|
'columns' => array( 'Backup Details', 'Value' ),
|
||||||
'css' => 'width: 100%; min-width: 200px;',
|
'css' => 'width: 100%; min-width: 200px;',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1683,7 +1683,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$steps = array();
|
$steps = array();
|
||||||
$steps[] = array( 'Start Time', $start_time, '' );
|
$steps[] = array( 'Start Time', $start_time, '' );
|
||||||
if ( isset( $backup_options->options['steps'] ) ) {
|
if ( isset( $backup_options->options['steps'] ) ) {
|
||||||
foreach( $backup_options->options['steps'] as $step ) {
|
foreach ( $backup_options->options['steps'] as $step ) {
|
||||||
if ( isset( $step['finish_time'] ) && ( $step['finish_time'] != 0 ) ) {
|
if ( isset( $step['finish_time'] ) && ( $step['finish_time'] != 0 ) ) {
|
||||||
|
|
||||||
// Step name.
|
// Step name.
|
||||||
|
@ -1713,7 +1713,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$step_name = 'Zip archive creation (Write speed: ' . $write_speed . ')';
|
$step_name = 'Zip archive creation (Write speed: ' . $write_speed . ')';
|
||||||
} elseif ( $step['function'] == 'post_backup' ) {
|
} elseif ( $step['function'] == 'post_backup' ) {
|
||||||
$step_name = 'Post-backup cleanup';
|
$step_name = 'Post-backup cleanup';
|
||||||
} elseif( $step['function'] == 'integrity_check' ) {
|
} elseif ( $step['function'] == 'integrity_check' ) {
|
||||||
$step_name = 'Integrity Check';
|
$step_name = 'Integrity Check';
|
||||||
} else {
|
} else {
|
||||||
$step_name = $step['function'];
|
$step_name = $step['function'];
|
||||||
|
@ -1770,8 +1770,8 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
pb_backupbuddy::$ui->list_table(
|
pb_backupbuddy::$ui->list_table(
|
||||||
$steps,
|
$steps,
|
||||||
array(
|
array(
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
'css' => 'width: 100%; min-width: 200px;',
|
'css' => 'width: 100%; min-width: 200px;',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1823,14 +1823,14 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
backupbuddy_core::verifyAjaxAccess();
|
backupbuddy_core::verifyAjaxAccess();
|
||||||
|
|
||||||
if ( is_multisite() && !current_user_can( 'manage_network' ) ) { // If a Network and NOT the superadmin must make sure they can only download the specific subsite backups for security purposes.
|
if ( is_multisite() && ! current_user_can( 'manage_network' ) ) { // If a Network and NOT the superadmin must make sure they can only download the specific subsite backups for security purposes.
|
||||||
|
|
||||||
if ( !strstr( pb_backupbuddy::_GET( 'backupbuddy_backup' ), backupbuddy_core::backup_prefix() ) ) {
|
if ( ! strstr( pb_backupbuddy::_GET( 'backupbuddy_backup' ), backupbuddy_core::backup_prefix() ) ) {
|
||||||
die( 'Access Denied. You may only download backups specific to your Multisite Subsite. Only Network Admins may download backups for another subsite in the network.' );
|
die( 'Access Denied. You may only download backups specific to your Multisite Subsite. Only Network Admins may download backups for another subsite in the network.' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !file_exists( backupbuddy_core::getBackupDirectory() . pb_backupbuddy::_GET( 'backupbuddy_backup' ) ) ) { // Does not exist.
|
if ( ! file_exists( backupbuddy_core::getBackupDirectory() . pb_backupbuddy::_GET( 'backupbuddy_backup' ) ) ) { // Does not exist.
|
||||||
die( 'Error #548957857584784332. The requested backup file does not exist. It may have already been deleted.' );
|
die( 'Error #548957857584784332. The requested backup file does not exist. It may have already been deleted.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1872,7 +1872,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
function create_backup() {
|
function create_backup() {
|
||||||
$requested_profile = $_POST['profile_id'];
|
$requested_profile = $_POST['profile_id'];
|
||||||
|
|
||||||
if (!isset(pb_backupbuddy::$options['profiles'][ $requested_profile ])) {
|
if ( ! isset(pb_backupbuddy::$options['profiles'][ $requested_profile ])) {
|
||||||
return array( 'error' => 'Invalid Profile. Not found.' );
|
return array( 'error' => 'Invalid Profile. Not found.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,7 +1941,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
function stop_backup() {
|
function stop_backup() {
|
||||||
$serial = $_POST['serial'];
|
$serial = $_POST['serial'];
|
||||||
set_transient( 'pb_backupbuddy_stop_backup-' . $serial, true, ( 60*60*24 ) );
|
set_transient( 'pb_backupbuddy_stop_backup-' . $serial, true, ( 60 * 60 * 24 ) );
|
||||||
return array( 'ok' => 1 );
|
return array( 'ok' => 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1959,7 +1959,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
'bucket',
|
'bucket',
|
||||||
'region',
|
'region',
|
||||||
);
|
);
|
||||||
foreach($not_override as $opt) {
|
foreach ($not_override as $opt) {
|
||||||
if (isset($data[ $opt ])) {
|
if (isset($data[ $opt ])) {
|
||||||
unset($data[ $opt ]);
|
unset($data[ $opt ]);
|
||||||
}
|
}
|
||||||
|
@ -2047,7 +2047,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
pb_backupbuddy::status( 'details', 'Remote send NOT set to delete after successful send.' );
|
pb_backupbuddy::status( 'details', 'Remote send NOT set to delete after successful send.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( pb_backupbuddy::$options['remote_destinations'][ $destination_id ] ) ) {
|
if ( ! isset( pb_backupbuddy::$options['remote_destinations'][ $destination_id ] ) ) {
|
||||||
return array( 'error' => 'Error #833383: Invalid destination ID `' . htmlentities( $destination_id ) . '`.' );
|
return array( 'error' => 'Error #833383: Invalid destination ID `' . htmlentities( $destination_id ) . '`.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2059,7 +2059,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$stash_quota = pb_backupbuddy_destination_stash::get_quota( pb_backupbuddy::$options['remote_destinations'][ $destination_id ], true );
|
$stash_quota = pb_backupbuddy_destination_stash::get_quota( pb_backupbuddy::$options['remote_destinations'][ $destination_id ], true );
|
||||||
|
|
||||||
if ( isset( $stash_quota['error'] ) ) {
|
if ( isset( $stash_quota['error'] ) ) {
|
||||||
return array( 'error' => ' Error accessing Stash account. Send aborted. Details: `' . implode( ' - ', $stash_quota['error'] ) . '`.' );
|
return array( 'error' => ' Error accessing Stash account. Send aborted. Details: `' . implode( ' - ', $stash_quota['error'] ) . '`.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $backup_file != '' ) {
|
if ( $backup_file != '' ) {
|
||||||
|
@ -2119,7 +2119,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$message = '';
|
$message = '';
|
||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
if ( 'cleanup_now' == $other_action ) {
|
if ( 'cleanup_now' == $other_action ) {
|
||||||
$message = 'Performing cleanup procedures now trimming old files and data.';
|
$message = 'Performing cleanup procedures now trimming old files and data.';
|
||||||
require_once pb_backupbuddy::plugin_path() . '/classes/housekeeping.php';
|
require_once pb_backupbuddy::plugin_path() . '/classes/housekeeping.php';
|
||||||
backupbuddy_housekeeping::run_periodic( 0 ); // 0 cleans up everything even if not very old.
|
backupbuddy_housekeeping::run_periodic( 0 ); // 0 cleans up everything even if not very old.
|
||||||
|
@ -2156,7 +2156,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
$cancelCount = 0;
|
$cancelCount = 0;
|
||||||
for ($x = 0; $x <= 3; $x++) { // Try this a few times since there may be race conditions on an open file.
|
for ($x = 0; $x <= 3; $x++) { // Try this a few times since there may be race conditions on an open file.
|
||||||
foreach( $files as $file ) {
|
foreach ( $files as $file ) {
|
||||||
pb_backupbuddy::status( 'details', 'Fileoptions instance #383.' );
|
pb_backupbuddy::status( 'details', 'Fileoptions instance #383.' );
|
||||||
|
|
||||||
$backup_options = new pb_backupbuddy_fileoptions( $file, $read_only = false );
|
$backup_options = new pb_backupbuddy_fileoptions( $file, $read_only = false );
|
||||||
|
@ -2225,12 +2225,12 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
if ( $continue_1 === true ) {
|
if ( $continue_1 === true ) {
|
||||||
|
|
||||||
if ( !empty( $_POST['refresh'] ) ) {
|
if ( ! empty( $_POST['refresh'] ) ) {
|
||||||
delete_transient( 'pb_backupbuddy_malwarescan' );
|
delete_transient( 'pb_backupbuddy_malwarescan' );
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo '<br />Scanning `' . $url . '`.<br /><br />';
|
//echo '<br />Scanning `' . $url . '`.<br /><br />';
|
||||||
if ( !defined( 'pluginbuddy_importbuddy' ) ) {
|
if ( ! defined( 'pluginbuddy_importbuddy' ) ) {
|
||||||
$scan = get_transient( 'pb_backupbuddy_malwarescan' );
|
$scan = get_transient( 'pb_backupbuddy_malwarescan' );
|
||||||
} else {
|
} else {
|
||||||
$scan = false;
|
$scan = false;
|
||||||
|
@ -2258,7 +2258,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$scan = 'N;';
|
$scan = 'N;';
|
||||||
} else {
|
} else {
|
||||||
$scan = $scan['body'];
|
$scan = $scan['body'];
|
||||||
set_transient( 'pb_backupbuddy_malwarescan', $scan, 60*60*1 ); // 1 hour cache.
|
set_transient( 'pb_backupbuddy_malwarescan', $scan, 60 * 60 * 1 ); // 1 hour cache.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2289,14 +2289,14 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
if ( $continue_2 === true ) {
|
if ( $continue_2 === true ) {
|
||||||
function lined_array( $array ) {
|
function lined_array( $array ) {
|
||||||
if ( is_array( $array ) ) {
|
if ( is_array( $array ) ) {
|
||||||
foreach( $array as $array_key => $array_item ) {
|
foreach ( $array as $array_key => $array_item ) {
|
||||||
if ( is_array( $array_item ) ) {
|
if ( is_array( $array_item ) ) {
|
||||||
$array[ $array_key ] = lined_array( $array_item );
|
$array[ $array_key ] = lined_array( $array_item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//return implode( '<br />', $array );
|
//return implode( '<br />', $array );
|
||||||
$return = '';
|
$return = '';
|
||||||
foreach( $array as $array_item ) {
|
foreach ( $array as $array_item ) {
|
||||||
$return .= $array_item . '<br />';
|
$return .= $array_item . '<br />';
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -2309,7 +2309,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $scan['MALWARE'] ) && ( $scan['MALWARE'] != 'E' ) ) {
|
if ( ! empty( $scan['MALWARE'] ) && ( $scan['MALWARE'] != 'E' ) ) {
|
||||||
echo '<table><tr><td><i class="fa fa-exclamation-circle fa-5x" style="color: red"></i></td><td><h1>', __('Warning: Possible Malware Detected!', 'it-l10n-backupbuddy' ), '</h1>',__('See details below.', 'it-l10n-backupbuddy' ), '</td></tr></table>';
|
echo '<table><tr><td><i class="fa fa-exclamation-circle fa-5x" style="color: red"></i></td><td><h1>', __('Warning: Possible Malware Detected!', 'it-l10n-backupbuddy' ), '</h1>',__('See details below.', 'it-l10n-backupbuddy' ), '</td></tr></table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2326,7 +2326,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<label><?php _e('Malware', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Malware', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['MALWARE']['WARN'] ) ) { // Malware found.
|
if ( ! empty( $scan['MALWARE']['WARN'] ) ) { // Malware found.
|
||||||
echo lined_array( $scan['MALWARE']['WARN'] );
|
echo lined_array( $scan['MALWARE']['WARN'] );
|
||||||
backupbuddy_core::addNotification( 'malware_found', 'Malware detected on `' . $url . '`.', 'A malware scan was run on the site and detected malware.', array(), true ); // Urgent
|
backupbuddy_core::addNotification( 'malware_found', 'Malware detected on `' . $url . '`.', 'A malware scan was run on the site and detected malware.', array(), true ); // Urgent
|
||||||
} else { // No malware found.
|
} else { // No malware found.
|
||||||
|
@ -2344,32 +2344,42 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<label><?php _e('Site', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Site', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['SCAN']['SITE'] ) ) { echo lined_array( $scan['SCAN']['SITE'] );
|
if ( ! empty( $scan['SCAN']['SITE'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['SCAN']['SITE'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Hostname', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Hostname', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['SCAN']['DOMAIN'] ) ) { echo lined_array( $scan['SCAN']['DOMAIN'] );
|
if ( ! empty( $scan['SCAN']['DOMAIN'] ) ) {
|
||||||
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['SCAN']['DOMAIN'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('IP Address', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('IP Address', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['SCAN']['IP'] ) ) { echo lined_array( $scan['SCAN']['IP'] );
|
if ( ! empty( $scan['SCAN']['IP'] ) ) {
|
||||||
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['SCAN']['IP'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('System details', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('System details', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['SYSTEM']['NOTICE'] ) ) { echo lined_array( $scan['SYSTEM']['NOTICE'] );
|
if ( ! empty( $scan['SYSTEM']['NOTICE'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['SYSTEM']['NOTICE'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Information', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Information', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['SYSTEM']['INFO'] ) ) { echo lined_array( $scan['SYSTEM']['INFO'] );
|
if ( ! empty( $scan['SYSTEM']['INFO'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['SYSTEM']['INFO'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -2381,32 +2391,42 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<label><?php _e('Details', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Details', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['WEBAPP']['INFO'] ) ) { echo lined_array( $scan['WEBAPP']['INFO'] );
|
if ( ! empty( $scan['WEBAPP']['INFO'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['WEBAPP']['INFO'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Versions', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Versions', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['WEBAPP']['VERSION'] ) ) { echo lined_array( $scan['WEBAPP']['VERSION'] );
|
if ( ! empty( $scan['WEBAPP']['VERSION'] ) ) {
|
||||||
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['WEBAPP']['VERSION'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Notices', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Notices', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['WEBAPP']['NOTICE'] ) ) { echo lined_array( $scan['WEBAPP']['NOTICE'] );
|
if ( ! empty( $scan['WEBAPP']['NOTICE'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['WEBAPP']['NOTICE'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Errors', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Errors', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['WEBAPP']['ERROR'] ) ) { echo lined_array( $scan['WEBAPP']['ERROR'] );
|
if ( ! empty( $scan['WEBAPP']['ERROR'] ) ) {
|
||||||
} else { echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['WEBAPP']['ERROR'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>',__('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<label><?php _e('Warnings', 'it-l10n-backupbuddy' ); ?></label>
|
<label><?php _e('Warnings', 'it-l10n-backupbuddy' ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['WEBAPP']['WARN'] ) ) { echo lined_array( $scan['WEBAPP']['WARN'] );
|
if ( ! empty( $scan['WEBAPP']['WARN'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['WEBAPP']['WARN'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -2417,8 +2437,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<h3 class="hndle"><span><?php _e('Links', 'it-l10n-backupbuddy' ); ?></span></h3>
|
<h3 class="hndle"><span><?php _e('Links', 'it-l10n-backupbuddy' ); ?></span></h3>
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['LINKS']['URL'] ) ) { echo lined_array( $scan['LINKS']['URL'] );
|
if ( ! empty( $scan['LINKS']['URL'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['LINKS']['URL'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2428,8 +2450,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<h3 class="hndle"><span><?php _e('Local Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
|
<h3 class="hndle"><span><?php _e('Local Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['LINKS']['JSLOCAL'] ) ) { echo lined_array( $scan['LINKS']['JSLOCAL'] );
|
if ( ! empty( $scan['LINKS']['JSLOCAL'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
echo lined_array( $scan['LINKS']['JSLOCAL'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ),'</i><br />'; }
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2439,8 +2463,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<h3 class="hndle"><span><?php _e('External Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
|
<h3 class="hndle"><span><?php _e('External Javascript', 'it-l10n-backupbuddy' ); ?></span></h3>
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['LINKS']['JSEXTERNAL'] ) ) { echo lined_array( $scan['LINKS']['JSEXTERNAL'] );
|
if ( ! empty( $scan['LINKS']['JSEXTERNAL'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['LINKS']['JSEXTERNAL'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2450,8 +2476,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<h3 class="hndle"><span><?php _e('Iframes Included', 'it-l10n-backupbuddy' ); ?></span></h3>
|
<h3 class="hndle"><span><?php _e('Iframes Included', 'it-l10n-backupbuddy' ); ?></span></h3>
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['LINKS']['IFRAME'] ) ) { echo lined_array( $scan['LINKS']['IFRAME'] );
|
if ( ! empty( $scan['LINKS']['IFRAME'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['LINKS']['IFRAME'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2461,8 +2489,10 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
<h3 class="hndle"><span><?php _e('Blacklisting Status', 'it-l10n-backupbuddy' ); ?></span></h3>
|
<h3 class="hndle"><span><?php _e('Blacklisting Status', 'it-l10n-backupbuddy' ); ?></span></h3>
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php
|
<?php
|
||||||
if ( !empty( $scan['BLACKLIST']['INFO'] ) ) { echo lined_array( $scan['BLACKLIST']['INFO'] );
|
if ( ! empty( $scan['BLACKLIST']['INFO'] ) ) {
|
||||||
} else { echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
echo lined_array( $scan['BLACKLIST']['INFO'] );
|
||||||
|
} else {
|
||||||
|
echo '<i>', __('none', 'it-l10n-backupbuddy' ), '</i><br />'; }
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2547,8 +2577,8 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
pb_backupbuddy::$options['remote_destinations'][ $nextDestKey ]['email'] = $_POST['email'];
|
pb_backupbuddy::$options['remote_destinations'][ $nextDestKey ]['email'] = $_POST['email'];
|
||||||
|
|
||||||
// Archive limits.
|
// Archive limits.
|
||||||
foreach( $archive_types as $archive_type => $archive_type_name ) {
|
foreach ( $archive_types as $archive_type => $archive_type_name ) {
|
||||||
foreach( $archive_periods as $archive_period ) {
|
foreach ( $archive_periods as $archive_period ) {
|
||||||
$settings_name = 'limit_' . $archive_type . '_' . $archive_period;
|
$settings_name = 'limit_' . $archive_type . '_' . $archive_period;
|
||||||
pb_backupbuddy::$options['remote_destinations'][ $nextDestKey ][ $settings_name ] = $_POST['live_settings'][ $settings_name ];
|
pb_backupbuddy::$options['remote_destinations'][ $nextDestKey ][ $settings_name ] = $_POST['live_settings'][ $settings_name ];
|
||||||
}
|
}
|
||||||
|
@ -2607,7 +2637,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$destination_id = backupbuddy_live::getLiveID();
|
$destination_id = backupbuddy_live::getLiveID();
|
||||||
$destination_settings = isset(pb_backupbuddy::$options['remote_destinations'][ $destination_id ]) ? pb_backupbuddy::$options['remote_destinations'][ $destination_id ] : array();
|
$destination_settings = isset(pb_backupbuddy::$options['remote_destinations'][ $destination_id ]) ? pb_backupbuddy::$options['remote_destinations'][ $destination_id ] : array();
|
||||||
|
|
||||||
$check_current = !empty($destination_settings) ? true : false;
|
$check_current = ! empty($destination_settings) ? true : false;
|
||||||
|
|
||||||
$error = '';
|
$error = '';
|
||||||
if ( $new_destination_id && is_array($data) ) {
|
if ( $new_destination_id && is_array($data) ) {
|
||||||
|
@ -2624,7 +2654,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
pb_backupbuddy::save();
|
pb_backupbuddy::save();
|
||||||
//pb_backupbuddy::alert( __( 'Settings saved. Restarting Live process so they take immediate effect.', 'it-l10n-backupbuddy' ) );
|
//pb_backupbuddy::alert( __( 'Settings saved. Restarting Live process so they take immediate effect.', 'it-l10n-backupbuddy' ) );
|
||||||
set_transient( 'backupbuddy_live_jump', array( 'daily_init', array() ), 60*60*48 ); // Tells Live process to restart from the beginning (if mid-process) so new settigns apply.
|
set_transient( 'backupbuddy_live_jump', array( 'daily_init', array() ), 60 * 60 * 48 ); // Tells Live process to restart from the beginning (if mid-process) so new settigns apply.
|
||||||
|
|
||||||
backupbuddy_live::send_trim_settings();
|
backupbuddy_live::send_trim_settings();
|
||||||
return array( 'ok' => 1 );
|
return array( 'ok' => 1 );
|
||||||
|
@ -2655,7 +2685,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$error = 'Error: Empty destination id.';
|
$error = 'Error: Empty destination id.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($error)) {
|
if ( ! empty($error)) {
|
||||||
$return['error'] = $error;
|
$return['error'] = $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2771,7 +2801,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
}
|
}
|
||||||
|
|
||||||
$backup_list_temp = array();
|
$backup_list_temp = array();
|
||||||
foreach( (array) $files as $file ) {
|
foreach ( (array) $files as $file ) {
|
||||||
|
|
||||||
if ( ( '' != $remotePath ) && ( ! backupbuddy_core::startsWith( basename( $file['filename'] ), $remotePath ) ) ) { // Only show backups for this site unless set to show all.
|
if ( ( '' != $remotePath ) && ( ! backupbuddy_core::startsWith( basename( $file['filename'] ), $remotePath ) ) ) { // Only show backups for this site unless set to show all.
|
||||||
continue;
|
continue;
|
||||||
|
@ -2782,7 +2812,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$backup_type = backupbuddy_core::getBackupTypeFromFile( $file['filename'], $quiet = false, $skip_fileoptions = true );
|
$backup_type = backupbuddy_core::getBackupTypeFromFile( $file['filename'], $quiet = false, $skip_fileoptions = true );
|
||||||
|
|
||||||
// Generate array of table rows.
|
// Generate array of table rows.
|
||||||
while( isset( $backup_list_temp[ $last_modified ] ) ) { // Avoid collisions.
|
while ( isset( $backup_list_temp[ $last_modified ] ) ) { // Avoid collisions.
|
||||||
$last_modified += 0.1;
|
$last_modified += 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2806,7 +2836,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
|
|
||||||
krsort( $backup_list_temp );
|
krsort( $backup_list_temp );
|
||||||
$backup_list = array();
|
$backup_list = array();
|
||||||
foreach( $backup_list_temp as $backup_item ) {
|
foreach ( $backup_list_temp as $backup_item ) {
|
||||||
$backup_list[ $backup_item[0][0] ] = $backup_item;
|
$backup_list[ $backup_item[0][0] ] = $backup_item;
|
||||||
}
|
}
|
||||||
unset( $backup_list_temp );
|
unset( $backup_list_temp );
|
||||||
|
@ -2852,7 +2882,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$settings = pb_backupbuddy_destination_stash2::_formatSettings( $settings );
|
$settings = pb_backupbuddy_destination_stash2::_formatSettings( $settings );
|
||||||
|
|
||||||
$deleteFiles = array();
|
$deleteFiles = array();
|
||||||
foreach( (array) $files as $file ) {
|
foreach ( (array) $files as $file ) {
|
||||||
$file = base64_decode( $file );
|
$file = base64_decode( $file );
|
||||||
|
|
||||||
$startPos = pb_backupbuddy_destination_stash2::strrpos_count( $file, '/', 2 ) + 1; // next to last slash.
|
$startPos = pb_backupbuddy_destination_stash2::strrpos_count( $file, '/', 2 ) + 1; // next to last slash.
|
||||||
|
@ -3114,7 +3144,7 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
$package_name = Ithemes_Updater_Functions::get_package_name( $package );
|
$package_name = Ithemes_Updater_Functions::get_package_name( $package );
|
||||||
$message = '';
|
$message = '';
|
||||||
|
|
||||||
switch( $code ) {
|
switch ( $code ) {
|
||||||
case 'ITXAPI_Updater_Bad_Login':
|
case 'ITXAPI_Updater_Bad_Login':
|
||||||
$message = __( 'Incorrect password. Please make sure that you are supplying your iThemes membership username and password details.', 'it-l10n-mainwp-backupbuddy' );
|
$message = __( 'Incorrect password. Please make sure that you are supplying your iThemes membership username and password details.', 'it-l10n-mainwp-backupbuddy' );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,7 +43,8 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) { return;
|
if ( ! $this->is_plugin_installed) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
|
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
|
||||||
|
@ -66,7 +67,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
if ( isset( $value->response['backupwordpress/backupwordpress.php'] ) ) {
|
if ( isset( $value->response['backupwordpress/backupwordpress.php'] ) ) {
|
||||||
|
@ -154,7 +155,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
if ( isset( $data['syncBackUpWordPress'] ) && $data['syncBackUpWordPress'] ) {
|
if ( isset( $data['syncBackUpWordPress'] ) && $data['syncBackUpWordPress'] ) {
|
||||||
try {
|
try {
|
||||||
$information['syncBackUpWordPress'] = $this->get_sync_data();
|
$information['syncBackUpWordPress'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,9 +203,11 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
|
|
||||||
// ok
|
// ok
|
||||||
public function do_reports_log( $ext = '') {
|
public function do_reports_log( $ext = '') {
|
||||||
if ( $ext !== 'backupwordpress' ) { return;
|
if ( $ext !== 'backupwordpress' ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->is_plugin_installed) { return;
|
if ( ! $this->is_plugin_installed) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -218,14 +221,14 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
$check = current($schedules);
|
$check = current($schedules);
|
||||||
MainWP_Helper::check_methods($check, array( 'get_backups', 'get_type' ));
|
MainWP_Helper::check_methods($check, array( 'get_backups', 'get_type' ));
|
||||||
|
|
||||||
foreach($schedules as $schedule) {
|
foreach ($schedules as $schedule) {
|
||||||
foreach ( $schedule->get_backups() as $file ) {
|
foreach ( $schedule->get_backups() as $file ) {
|
||||||
$backup_type = $schedule->get_type();
|
$backup_type = $schedule->get_type();
|
||||||
$message = 'BackupWordpres backup ' . $backup_type . ' finished';
|
$message = 'BackupWordpres backup ' . $backup_type . ' finished';
|
||||||
$destination = 'N/A';
|
$destination = 'N/A';
|
||||||
if ( file_exists( $file ) ) {
|
if ( file_exists( $file ) ) {
|
||||||
$date = @filemtime( $file );
|
$date = @filemtime( $file );
|
||||||
if ( !empty( $date ) ) {
|
if ( ! empty( $date ) ) {
|
||||||
do_action( 'mainwp_reports_backupwordpress_backup', $destination, $message, 'finished', $backup_type, $date );
|
do_action( 'mainwp_reports_backupwordpress_backup', $destination, $message, 'finished', $backup_type, $date );
|
||||||
MainWP_Helper::update_lasttime_backup('backupwordpress', $date); // to support backup before update feature
|
MainWP_Helper::update_lasttime_backup('backupwordpress', $date); // to support backup before update feature
|
||||||
}
|
}
|
||||||
|
@ -233,7 +236,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,7 +353,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
}
|
}
|
||||||
|
|
||||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||||
$started_ago = method_exists($schedule, 'get_schedule_running_start_time') ? $schedule->get_schedule_running_start_time() : $schedule->get_schedule_start_time();
|
$started_ago = method_exists($schedule, 'get_schedule_running_start_time') ? $schedule->get_schedule_running_start_time() : $schedule->get_schedule_start_time();
|
||||||
$out = array(
|
$out = array(
|
||||||
'b' => $this->get_backupslist_html( $schedule ),
|
'b' => $this->get_backupslist_html( $schedule ),
|
||||||
'count' => count( $schedule->get_backups() ),
|
'count' => count( $schedule->get_backups() ),
|
||||||
|
@ -377,7 +380,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
$current_option = get_option( 'hmbkp_schedule_' . $sch_id );
|
$current_option = get_option( 'hmbkp_schedule_' . $sch_id );
|
||||||
if ( is_array( $current_option ) ) {
|
if ( is_array( $current_option ) ) {
|
||||||
unset( $current_option['excludes'] ); // not send this value
|
unset( $current_option['excludes'] ); // not send this value
|
||||||
$started_ago = method_exists($schedule, 'get_schedule_running_start_time') ? $schedule->get_schedule_running_start_time() : $schedule->get_schedule_start_time();
|
$started_ago = method_exists($schedule, 'get_schedule_running_start_time') ? $schedule->get_schedule_running_start_time() : $schedule->get_schedule_start_time();
|
||||||
$send_back_schedules[ $sch_id ] = array(
|
$send_back_schedules[ $sch_id ] = array(
|
||||||
'options' => $current_option,
|
'options' => $current_option,
|
||||||
'b' => $this->get_backupslist_html( $schedule ),
|
'b' => $this->get_backupslist_html( $schedule ),
|
||||||
|
@ -424,7 +427,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
return array( 'error' => $deleted->get_error_message() );
|
return array( 'error' => $deleted->get_error_message() );
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
'result' => 'SUCCESS',
|
'result' => 'SUCCESS',
|
||||||
'b' => $this->get_backupslist_html( $schedule ),
|
'b' => $this->get_backupslist_html( $schedule ),
|
||||||
'count' => count( $schedule->get_backups() ),
|
'count' => count( $schedule->get_backups() ),
|
||||||
|
@ -626,7 +629,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
if ($new_version) {
|
if ($new_version) {
|
||||||
$is_default_rule = ( in_array( $exclude, $excludes->get_default_excludes() ) ) || ( HM\BackUpWordPress\Path::get_path() === trailingslashit( HM\BackUpWordPress\Path::get_root() ) . untrailingslashit( $exclude ) );
|
$is_default_rule = ( in_array( $exclude, $excludes->get_default_excludes() ) ) || ( HM\BackUpWordPress\Path::get_path() === trailingslashit( HM\BackUpWordPress\Path::get_root() ) . untrailingslashit( $exclude ) );
|
||||||
} else {
|
} else {
|
||||||
$is_default_rule = ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) );
|
$is_default_rule = ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $is_default_rule ) :
|
if ( $is_default_rule ) :
|
||||||
|
@ -1118,8 +1121,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
$exclude_rule = ABSPATH . $excl_rule;
|
$exclude_rule = ABSPATH . $excl_rule;
|
||||||
$path = realpath($exclude_rule);
|
$path = realpath($exclude_rule);
|
||||||
// If it exist
|
// If it exist
|
||||||
if($path !== false)
|
if ($path !== false) {
|
||||||
{
|
|
||||||
$schedule->set_excludes( $exclude_rule, true );
|
$schedule->set_excludes( $exclude_rule, true );
|
||||||
$schedule->save();
|
$schedule->save();
|
||||||
}
|
}
|
||||||
|
@ -1219,8 +1221,8 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach($schedules as $sch_id => $sch) {
|
foreach ($schedules as $sch_id => $sch) {
|
||||||
if ( empty($sch_id) || !isset( $sch['options'] ) || ! is_array( $sch['options'] ) ) {
|
if ( empty($sch_id) || ! isset( $sch['options'] ) || ! is_array( $sch['options'] ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$options = $sch['options'];
|
$options = $sch['options'];
|
||||||
|
|
|
@ -218,7 +218,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
|
|
||||||
if (!$this->is_backwpup_installed) {
|
if ( ! $this->is_backwpup_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,9 +239,10 @@ class MainWP_Child_Back_WP_Up {
|
||||||
}
|
}
|
||||||
// ok
|
// ok
|
||||||
public function do_reports_log( $ext = '') {
|
public function do_reports_log( $ext = '') {
|
||||||
if ( $ext !== 'backwpup' ) { return;
|
if ( $ext !== 'backwpup' ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->is_backwpup_installed) {
|
if ( ! $this->is_backwpup_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,11 +273,11 @@ class MainWP_Child_Back_WP_Up {
|
||||||
$log_items = array();
|
$log_items = array();
|
||||||
foreach ( $logfiles as $mtime => $logfile ) {
|
foreach ( $logfiles as $mtime => $logfile ) {
|
||||||
$meta = BackWPup_Job::read_logheader( $log_folder . '/' . $logfile );
|
$meta = BackWPup_Job::read_logheader( $log_folder . '/' . $logfile );
|
||||||
if (!isset($meta['logtime']) || $meta['logtime'] < $lasttime_logged) {
|
if ( ! isset($meta['logtime']) || $meta['logtime'] < $lasttime_logged) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($meta['errors']) && !empty($meta['errors'])) {
|
if (isset($meta['errors']) && ! empty($meta['errors'])) {
|
||||||
continue; // do not logging backups have errors
|
continue; // do not logging backups have errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +285,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
$log_items[ $mtime ]['file'] = $logfile;
|
$log_items[ $mtime ]['file'] = $logfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $log_items ) ) {
|
if ( ! empty( $log_items ) ) {
|
||||||
$job_types = array(
|
$job_types = array(
|
||||||
'DBDUMP' => __('Database backup', 'mainwp-child'),
|
'DBDUMP' => __('Database backup', 'mainwp-child'),
|
||||||
'FILE' => __('File backup', 'mainwp-child'),
|
'FILE' => __('File backup', 'mainwp-child'),
|
||||||
|
@ -303,7 +304,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
}
|
}
|
||||||
$job_job_types = explode('+', $log['type']);
|
$job_job_types = explode('+', $log['type']);
|
||||||
$backup_type = '';
|
$backup_type = '';
|
||||||
foreach($job_job_types as $typeid) {
|
foreach ($job_job_types as $typeid) {
|
||||||
if (isset( $job_types[ $typeid ] )) {
|
if (isset( $job_types[ $typeid ] )) {
|
||||||
$backup_type .= ' + ' . $job_types[ $typeid ];
|
$backup_type .= ' + ' . $job_types[ $typeid ];
|
||||||
}
|
}
|
||||||
|
@ -333,13 +334,13 @@ class MainWP_Child_Back_WP_Up {
|
||||||
|
|
||||||
// ok
|
// ok
|
||||||
function syncOthersData( $information, $data = array() ) {
|
function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncBackwpupData'] ) && $data['syncBackwpupData'] ) {
|
if ( isset( $data['syncBackwpupData'] ) && $data['syncBackwpupData'] ) {
|
||||||
try{
|
try {
|
||||||
$lastbackup = MainWP_Helper::get_lasttime_backup('backwpup');
|
$lastbackup = MainWP_Helper::get_lasttime_backup('backwpup');
|
||||||
$information['syncBackwpupData'] = array(
|
$information['syncBackwpupData'] = array(
|
||||||
'lastbackup' => $lastbackup,
|
'lastbackup' => $lastbackup,
|
||||||
);
|
);
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,7 +779,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
|
|
||||||
$temp_array['downloadurl_id'] = '/wp-admin/admin.php?page=backwpupbackups';
|
$temp_array['downloadurl_id'] = '/wp-admin/admin.php?page=backwpupbackups';
|
||||||
if ( preg_match( '/.*&jobid=([^&]+)&.*/is', $temp_array['downloadurl'], $matches )) {
|
if ( preg_match( '/.*&jobid=([^&]+)&.*/is', $temp_array['downloadurl'], $matches )) {
|
||||||
if ( !empty( $matches[1] ) && is_numeric( $matches[1] ) ) {
|
if ( ! empty( $matches[1] ) && is_numeric( $matches[1] ) ) {
|
||||||
$temp_array['downloadurl_id'] .= '&download_click_id=' . $matches[1];
|
$temp_array['downloadurl_id'] .= '&download_click_id=' . $matches[1];
|
||||||
}
|
}
|
||||||
error_log('did match' . print_r($matches, true));
|
error_log('did match' . print_r($matches, true));
|
||||||
|
@ -807,7 +808,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init_download_backup() {
|
public function init_download_backup() {
|
||||||
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'backwpupbackups' || !isset( $_GET['download_click_id'] ) || empty( $_GET['download_click_id'] )) {
|
if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'backwpupbackups' || ! isset( $_GET['download_click_id'] ) || empty( $_GET['download_click_id'] )) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -1374,7 +1375,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
'backupuploads' => FILTER_VALIDATE_BOOLEAN,
|
'backupuploads' => FILTER_VALIDATE_BOOLEAN,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach( $boolean_fields_def as $key => $value ) {
|
foreach ( $boolean_fields_def as $key => $value ) {
|
||||||
BackWPup_Option::update( $id, $key, ! empty( $post_data[ $key ] ) );
|
BackWPup_Option::update( $id, $key, ! empty( $post_data[ $key ] ) );
|
||||||
}
|
}
|
||||||
// Parse and save directories to exclude
|
// Parse and save directories to exclude
|
||||||
|
@ -1400,7 +1401,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
'flags' => FILTER_FORCE_ARRAY,
|
'flags' => FILTER_FORCE_ARRAY,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
foreach( $exclude_dirs_def as $key => $filter ) {
|
foreach ( $exclude_dirs_def as $key => $filter ) {
|
||||||
$value = ! empty( $post_data[ $key ] ) && is_array( $post_data[ $key ] ) ? $post_data[ $key ] : array();
|
$value = ! empty( $post_data[ $key ] ) && is_array( $post_data[ $key ] ) ? $post_data[ $key ] : array();
|
||||||
BackWPup_Option::update( $id, $key, $value );
|
BackWPup_Option::update( $id, $key, $value );
|
||||||
}
|
}
|
||||||
|
@ -1439,7 +1440,7 @@ class MainWP_Child_Back_WP_Up {
|
||||||
|
|
||||||
if (isset($settings['value']['backupdir']) && empty($settings['value']['backupdir'])) {
|
if (isset($settings['value']['backupdir']) && empty($settings['value']['backupdir'])) {
|
||||||
$backupdir = BackWPup_Option::get( (int) $job_id, 'backupdir' );
|
$backupdir = BackWPup_Option::get( (int) $job_id, 'backupdir' );
|
||||||
if (!empty($backupdir)) {
|
if ( ! empty($backupdir)) {
|
||||||
$settings['value']['backupdir'] = $backupdir;
|
$settings['value']['backupdir'] = $backupdir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
$opts = get_option( 'mainwp_child_branding_settings' );
|
$opts = get_option( 'mainwp_child_branding_settings' );
|
||||||
|
|
||||||
if ( !is_array( $opts ) ) {
|
if ( ! is_array( $opts ) ) {
|
||||||
// compatible with old code
|
// compatible with old code
|
||||||
$opts = array();
|
$opts = array();
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class MainWP_Child_Branding {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $opts );
|
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']) ) {
|
||||||
$opts['contact_label'] = 'Contact Support';
|
$opts['contact_label'] = 'Contact Support';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class MainWP_Child_Branding {
|
||||||
$extra = array();
|
$extra = array();
|
||||||
if (is_array($this->child_branding_options) && isset($this->child_branding_options['extra_settings'])) {
|
if (is_array($this->child_branding_options) && isset($this->child_branding_options['extra_settings'])) {
|
||||||
$extra = $this->child_branding_options['extra_settings'];
|
$extra = $this->child_branding_options['extra_settings'];
|
||||||
if (!is_array($extra)) {
|
if ( ! is_array($extra)) {
|
||||||
$extra = array();
|
$extra = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class MainWP_Child_Branding {
|
||||||
'branding_ext_enabled',
|
'branding_ext_enabled',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($brandingOptions_empty as $opt) {
|
foreach ($brandingOptions_empty as $opt) {
|
||||||
if (isset($this->child_branding_options[ $opt ])) {
|
if (isset($this->child_branding_options[ $opt ])) {
|
||||||
$this->child_branding_options[ $opt ] = '';
|
$this->child_branding_options[ $opt ] = '';
|
||||||
}
|
}
|
||||||
|
@ -204,24 +204,24 @@ class MainWP_Child_Branding {
|
||||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
||||||
$current_settings['branding_header'] = $header;
|
$current_settings['branding_header'] = $header;
|
||||||
$current_settings['support_email'] = $settings['child_support_email'];
|
$current_settings['support_email'] = $settings['child_support_email'];
|
||||||
$current_settings['support_message'] = $settings['child_support_message'];
|
$current_settings['support_message'] = $settings['child_support_message'];
|
||||||
$current_settings['remove_restore'] = $settings['child_remove_restore'];
|
$current_settings['remove_restore'] = $settings['child_remove_restore'];
|
||||||
$current_settings['remove_setting'] = $settings['child_remove_setting'];
|
$current_settings['remove_setting'] = $settings['child_remove_setting'];
|
||||||
$current_settings['remove_server_info'] = $settings['child_remove_server_info'];
|
$current_settings['remove_server_info'] = $settings['child_remove_server_info'];
|
||||||
$current_settings['remove_connection_detail'] = isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0;
|
$current_settings['remove_connection_detail'] = isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0;
|
||||||
$current_settings['remove_wp_tools'] = $settings['child_remove_wp_tools'];
|
$current_settings['remove_wp_tools'] = $settings['child_remove_wp_tools'];
|
||||||
$current_settings['remove_wp_setting'] = $settings['child_remove_wp_setting'];
|
$current_settings['remove_wp_setting'] = $settings['child_remove_wp_setting'];
|
||||||
$current_settings['remove_permalink'] = $settings['child_remove_permalink'];
|
$current_settings['remove_permalink'] = $settings['child_remove_permalink'];
|
||||||
$current_settings['contact_label'] = $settings['child_button_contact_label'];
|
$current_settings['contact_label'] = $settings['child_button_contact_label'];
|
||||||
$current_settings['email_message'] = $settings['child_send_email_message'];
|
$current_settings['email_message'] = $settings['child_send_email_message'];
|
||||||
$current_settings['return_sender'] = $settings['child_message_return_sender'];
|
$current_settings['return_sender'] = $settings['child_message_return_sender'];
|
||||||
$current_settings['submit_button_title'] = $settings['child_submit_button_title'];
|
$current_settings['submit_button_title'] = $settings['child_submit_button_title'];
|
||||||
|
|
||||||
if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
||||||
$current_settings['disable_wp_branding'] = $settings['child_disable_wp_branding'];
|
$current_settings['disable_wp_branding'] = $settings['child_disable_wp_branding'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_setting = array(
|
$extra_setting = array(
|
||||||
|
@ -342,7 +342,7 @@ class MainWP_Child_Branding {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
||||||
$current_settings['show_support'] = ( $settings['child_show_support_button'] && !empty($settings['child_support_email']) ) ? 'T' : '';
|
$current_settings['show_support'] = ( $settings['child_show_support_button'] && ! empty($settings['child_support_email']) ) ? 'T' : '';
|
||||||
$current_settings['disable_change'] = $settings['child_disable_change'] ? 'T' : '';
|
$current_settings['disable_change'] = $settings['child_disable_change'] ? 'T' : '';
|
||||||
$current_settings['disable_switching_theme'] = $settings['child_disable_switching_theme'] ? 'T' : '';
|
$current_settings['disable_switching_theme'] = $settings['child_disable_switching_theme'] ? 'T' : '';
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ class MainWP_Child_Branding {
|
||||||
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y' ) {
|
if ( ! isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,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 ( !isset($opts['disable_wp_branding']) || $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
|
||||||
|
@ -484,7 +484,7 @@ class MainWP_Child_Branding {
|
||||||
function admin_menu() {
|
function admin_menu() {
|
||||||
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
|
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
|
||||||
if ( $allow_contact ) {; // ok
|
if ( $allow_contact ) {; // ok
|
||||||
} elseif ( !current_user_can( 'administrator' ) ) {
|
} elseif ( ! current_user_can( 'administrator' ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,13 +809,13 @@ class MainWP_Child_Branding {
|
||||||
$email = $this->child_branding_options['support_email'];
|
$email = $this->child_branding_options['support_email'];
|
||||||
$sub = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_subject'] ) ) );
|
$sub = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_subject'] ) ) );
|
||||||
$from = trim($_POST['mainwp_branding_contact_send_from']);
|
$from = trim($_POST['mainwp_branding_contact_send_from']);
|
||||||
$subject = !empty( $sub ) ? $sub : 'MainWP - Support Contact';
|
$subject = ! empty( $sub ) ? $sub : 'MainWP - Support Contact';
|
||||||
$content = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_content'] ) ) );
|
$content = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_content'] ) ) );
|
||||||
$mail = $headers = '';
|
$mail = $headers = '';
|
||||||
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
|
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
|
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
|
||||||
if (!empty($from)) {
|
if ( ! empty($from)) {
|
||||||
$headers .= 'From: "' . $from . '" <' . $from . ">\r\n";
|
$headers .= 'From: "' . $from . '" <' . $from . ">\r\n";
|
||||||
}
|
}
|
||||||
$mail .= "<p>Support Email from: <a href='" . site_url() . "'>" . site_url() . "</a></p>\r\n\r\n";
|
$mail .= "<p>Support Email from: <a href='" . site_url() . "'>" . site_url() . "</a></p>\r\n\r\n";
|
||||||
|
@ -936,7 +936,7 @@ class MainWP_Child_Branding {
|
||||||
public function add_support_button_in_top_admin_bar( $wp_admin_bar ) {
|
public function add_support_button_in_top_admin_bar( $wp_admin_bar ) {
|
||||||
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
|
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
|
||||||
if ( $allow_contact ) {; // ok
|
if ( $allow_contact ) {; // ok
|
||||||
} elseif ( !current_user_can( 'administrator' ) ) {
|
} elseif ( ! current_user_can( 'administrator' ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,7 +964,7 @@ class MainWP_Child_Branding {
|
||||||
public function is_branding() {
|
public function is_branding() {
|
||||||
$opts = $this->child_branding_options;
|
$opts = $this->child_branding_options;
|
||||||
|
|
||||||
if (!isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y') {
|
if ( ! isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ class MainWP_Child_Branding {
|
||||||
if ( 'T' === $is_hide ) {
|
if ( 'T' === $is_hide ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ( is_array( $branding_header ) && !empty( $branding_header['name'] ) ) {
|
if ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1006,7 +1006,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
|
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
|
||||||
|
|
||||||
if (!is_array($hide_slugs)) {
|
if ( ! is_array($hide_slugs)) {
|
||||||
$hide_slugs = array();
|
$hide_slugs = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,7 +1014,7 @@ class MainWP_Child_Branding {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('get_plugin_updates')) {
|
if ( ! function_exists('get_plugin_updates')) {
|
||||||
include_once ABSPATH . '/wp-admin/includes/update.php';
|
include_once ABSPATH . '/wp-admin/includes/update.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
$updates = get_plugin_updates();
|
$updates = get_plugin_updates();
|
||||||
if (is_array($updates)) {
|
if (is_array($updates)) {
|
||||||
foreach($updates as $slug => $data) {
|
foreach ($updates as $slug => $data) {
|
||||||
if (in_array($slug, $hide_slugs)) {
|
if (in_array($slug, $hide_slugs)) {
|
||||||
$count_hide++;
|
$count_hide++;
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1059,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
|
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
|
||||||
|
|
||||||
if (!is_array($hide_slugs)) {
|
if ( ! is_array($hide_slugs)) {
|
||||||
$hide_slugs = array();
|
$hide_slugs = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
$updates = get_plugin_updates();
|
$updates = get_plugin_updates();
|
||||||
if (is_array($updates)) {
|
if (is_array($updates)) {
|
||||||
foreach($updates as $slug => $data) {
|
foreach ($updates as $slug => $data) {
|
||||||
if (in_array($slug, $hide_slugs)) {
|
if (in_array($slug, $hide_slugs)) {
|
||||||
$count_hide++;
|
$count_hide++;
|
||||||
}
|
}
|
||||||
|
@ -1186,7 +1186,7 @@ class MainWP_Child_Branding {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ class MainWP_Child_iThemes_Security {
|
||||||
// ok
|
// ok
|
||||||
function syncOthersData( $information, $data = array() ) {
|
function syncOthersData( $information, $data = array() ) {
|
||||||
if ( is_array( $data ) && isset( $data['ithemeExtActivated'] ) && ( 'yes' === $data['ithemeExtActivated'] ) ) {
|
if ( is_array( $data ) && isset( $data['ithemeExtActivated'] ) && ( 'yes' === $data['ithemeExtActivated'] ) ) {
|
||||||
try{
|
try {
|
||||||
$information['syncIThemeData'] = array(
|
$information['syncIThemeData'] = array(
|
||||||
'users_and_roles' => $this->get_available_admin_users_and_roles(),
|
'users_and_roles' => $this->get_available_admin_users_and_roles(),
|
||||||
);
|
);
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log($e->getMessage());
|
error_log($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
$information = array();
|
$information = array();
|
||||||
if ( ! class_exists( 'ITSEC_Core' ) || !class_exists('ITSEC_Modules')) {
|
if ( ! class_exists( 'ITSEC_Core' ) || ! class_exists('ITSEC_Modules')) {
|
||||||
$information['error'] = 'NO_ITHEME';
|
$information['error'] = 'NO_ITHEME';
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ithemes_init() {
|
public function ithemes_init() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,18 +211,18 @@ class MainWP_Child_iThemes_Security {
|
||||||
|
|
||||||
$update_settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
|
$update_settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
|
||||||
|
|
||||||
foreach($update_settings as $module => $settings) {
|
foreach ($update_settings as $module => $settings) {
|
||||||
$do_not_save = false;
|
$do_not_save = false;
|
||||||
if (in_array($module, $_itsec_modules)) {
|
if (in_array($module, $_itsec_modules)) {
|
||||||
if ($module == 'wordpress-salts') {
|
if ($module == 'wordpress-salts') {
|
||||||
$settings['last_generated'] = ITSEC_Modules::get_setting( $module, 'last_generated' ); // not update
|
$settings['last_generated'] = ITSEC_Modules::get_setting( $module, 'last_generated' ); // not update
|
||||||
} elseif ($module == 'global') {
|
} elseif ($module == 'global') {
|
||||||
$keep_olds = array( 'did_upgrade', 'log_info', 'show_new_dashboard_notice', 'show_security_check', 'nginx_file' );
|
$keep_olds = array( 'did_upgrade', 'log_info', 'show_new_dashboard_notice', 'show_security_check', 'nginx_file' );
|
||||||
foreach($keep_olds as $key) {
|
foreach ($keep_olds as $key) {
|
||||||
$settings[ $key ] = ITSEC_Modules::get_setting( $module, $key ); // not update
|
$settings[ $key ] = ITSEC_Modules::get_setting( $module, $key ); // not update
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($settings['log_location']) || empty($settings['log_location']) ) {
|
if ( ! isset($settings['log_location']) || empty($settings['log_location']) ) {
|
||||||
$settings['log_location'] = ITSEC_Modules::get_setting( $module, 'log_location' );
|
$settings['log_location'] = ITSEC_Modules::get_setting( $module, 'log_location' );
|
||||||
} else {
|
} else {
|
||||||
$result = $this->validate_directory('log_location', $settings['log_location']);
|
$result = $this->validate_directory('log_location', $settings['log_location']);
|
||||||
|
@ -233,7 +233,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($module == 'backup') {
|
} elseif ($module == 'backup') {
|
||||||
if (!isset($settings['location']) || empty($settings['location']) ) {
|
if ( ! isset($settings['location']) || empty($settings['location']) ) {
|
||||||
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' );
|
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' );
|
||||||
} else {
|
} else {
|
||||||
$result = $this->validate_directory('location', $settings['location']);
|
$result = $this->validate_directory('location', $settings['location']);
|
||||||
|
@ -242,12 +242,12 @@ class MainWP_Child_iThemes_Security {
|
||||||
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' ); // no change
|
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' ); // no change
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isset($settings['exclude']) ) {
|
if ( ! isset($settings['exclude']) ) {
|
||||||
$settings['exclude'] = ITSEC_Modules::get_setting( $module, 'exclude' );
|
$settings['exclude'] = ITSEC_Modules::get_setting( $module, 'exclude' );
|
||||||
|
|
||||||
}
|
}
|
||||||
} elseif ($module == 'hide-backend') {
|
} elseif ($module == 'hide-backend') {
|
||||||
if (isset($settings['enabled']) && !empty($settings['enabled'])) {
|
if (isset($settings['enabled']) && ! empty($settings['enabled'])) {
|
||||||
$permalink_structure = get_option( 'permalink_structure', false );
|
$permalink_structure = get_option( 'permalink_structure', false );
|
||||||
if ( empty( $permalink_structure ) && ! is_multisite() ) {
|
if ( empty( $permalink_structure ) && ! is_multisite() ) {
|
||||||
$errors[] = __( 'You must change <strong>WordPress permalinks</strong> to a setting other than "Plain" in order to use "Hide Backend" feature.', 'better-wp-security' );
|
$errors[] = __( 'You must change <strong>WordPress permalinks</strong> to a setting other than "Plain" in order to use "Hide Backend" feature.', 'better-wp-security' );
|
||||||
|
@ -286,7 +286,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
}
|
}
|
||||||
foreach ($settings['notifications'] as $key => $val) {
|
foreach ($settings['notifications'] as $key => $val) {
|
||||||
foreach ($update_fields as $field) {
|
foreach ($update_fields as $field) {
|
||||||
if(isset($val[ $field ])) {
|
if (isset($val[ $field ])) {
|
||||||
$current_settings['notifications'][ $key ][ $field ] = $val[ $field ];
|
$current_settings['notifications'][ $key ][ $field ] = $val[ $field ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$do_not_save ) {
|
if ( ! $do_not_save ) {
|
||||||
ITSEC_Modules::set_settings( $module, $settings );
|
ITSEC_Modules::set_settings( $module, $settings );
|
||||||
$updated = true;
|
$updated = true;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
|
|
||||||
$return['nbf_settings'] = $nbf_settings;
|
$return['nbf_settings'] = $nbf_settings;
|
||||||
|
|
||||||
if (!empty($errors)) {
|
if ( ! empty($errors)) {
|
||||||
$return['extra_message'] = $errors;
|
$return['extra_message'] = $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
$str_error = sprintf( __( 'The backup request returned an unexpected response. It returned a response of type <code>%1$s</code>.', 'better-wp-security' ), gettype( $result ) );
|
$str_error = sprintf( __( 'The backup request returned an unexpected response. It returned a response of type <code>%1$s</code>.', 'better-wp-security' ), gettype( $result ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($str_error)) {
|
if ( ! empty($str_error)) {
|
||||||
$return['error'] = $str_error;
|
$return['error'] = $str_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
$last_generated = ITSEC_Core::get_current_time_gmt();
|
$last_generated = ITSEC_Core::get_current_time_gmt();
|
||||||
ITSEC_Modules::set_setting( 'wordpress-salts', 'last_generated', $last_generated );
|
ITSEC_Modules::set_setting( 'wordpress-salts', 'last_generated', $last_generated );
|
||||||
}
|
}
|
||||||
if (!empty($str_error)) {
|
if ( ! empty($str_error)) {
|
||||||
$return['error'] = $str_error;
|
$return['error'] = $str_error;
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -690,12 +690,12 @@ class MainWP_Child_iThemes_Security {
|
||||||
|
|
||||||
$settings = $_POST['settings'];
|
$settings = $_POST['settings'];
|
||||||
|
|
||||||
if (!is_array($settings)) {
|
if ( ! is_array($settings)) {
|
||||||
$settings = array();
|
$settings = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_username = isset( $settings['new_username'] ) ? $settings['new_username'] : '';
|
$new_username = isset( $settings['new_username'] ) ? $settings['new_username'] : '';
|
||||||
$change_id = isset( $settings['change_id'] ) && $settings['change_id'] ? true : false;
|
$change_id = isset( $settings['change_id'] ) && $settings['change_id'] ? true : false;
|
||||||
|
|
||||||
//load utility functions
|
//load utility functions
|
||||||
if ( ! class_exists( 'ITSEC_Lib' ) ) {
|
if ( ! class_exists( 'ITSEC_Lib' ) ) {
|
||||||
|
@ -970,7 +970,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php';
|
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php';
|
||||||
}
|
}
|
||||||
$response = array();
|
$response = array();
|
||||||
$results= ITSEC_Malware_Scanner::scan();
|
$results = ITSEC_Malware_Scanner::scan();
|
||||||
$response['html'] = ITSEC_Malware_Scan_Results_Template::get_html( $results, true );
|
$response['html'] = ITSEC_Malware_Scan_Results_Template::get_html( $results, true );
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ class MainWP_Child_iThemes_Security {
|
||||||
|
|
||||||
$active_modules = $_POST['active_modules'];
|
$active_modules = $_POST['active_modules'];
|
||||||
|
|
||||||
if (!is_array($active_modules)) {
|
if ( ! is_array($active_modules)) {
|
||||||
$active_modules = array();
|
$active_modules = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MainWP_Child_Links_Checker {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$this->is_plugin_installed ) {
|
if ( ! $this->is_plugin_installed ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class MainWP_Child_Links_Checker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
MainWP_Helper::write( array( 'error' => $e->getMessage() ) );
|
MainWP_Helper::write( array( 'error' => $e->getMessage() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,9 +210,9 @@ class MainWP_Child_Links_Checker {
|
||||||
// ok
|
// ok
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncBrokenLinksCheckerData'] ) && $data['syncBrokenLinksCheckerData'] ) {
|
if ( isset( $data['syncBrokenLinksCheckerData'] ) && $data['syncBrokenLinksCheckerData'] ) {
|
||||||
try{
|
try {
|
||||||
$information['syncBrokenLinksCheckerData'] = $this->get_sync_data();
|
$information['syncBrokenLinksCheckerData'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,8 @@ class MainWP_Child_Links_Checker {
|
||||||
|
|
||||||
function get_links_data() {
|
function get_links_data() {
|
||||||
|
|
||||||
if (!defined('BLC_DIRECTORY')) { return;
|
if ( ! defined('BLC_DIRECTORY')) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
||||||
|
@ -267,7 +268,7 @@ class MainWP_Child_Links_Checker {
|
||||||
$link_data = $this->links_checker_data($params);
|
$link_data = $this->links_checker_data($params);
|
||||||
|
|
||||||
$total_sync = 0;
|
$total_sync = 0;
|
||||||
if ($offset){
|
if ($offset) {
|
||||||
$total_sync = $offset;
|
$total_sync = $offset;
|
||||||
}
|
}
|
||||||
$total_sync += ( is_array($link_data) ? count($link_data) : 0 );
|
$total_sync += ( is_array($link_data) ? count($link_data) : 0 );
|
||||||
|
@ -291,7 +292,8 @@ class MainWP_Child_Links_Checker {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_count_links() {
|
function get_count_links() {
|
||||||
if (!defined('BLC_DIRECTORY')) { return;
|
if ( ! defined('BLC_DIRECTORY')) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
||||||
|
|
|
@ -34,7 +34,7 @@ class MainWP_Child_Pagespeed {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class MainWP_Child_Pagespeed {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class MainWP_Child_Pagespeed {
|
||||||
public function hide_menu() {
|
public function hide_menu() {
|
||||||
global $submenu;
|
global $submenu;
|
||||||
if (isset($submenu['tools.php'])) {
|
if (isset($submenu['tools.php'])) {
|
||||||
foreach($submenu['tools.php'] as $key => $menu) {
|
foreach ($submenu['tools.php'] as $key => $menu) {
|
||||||
if ($menu[2] == 'google-pagespeed-insights') {
|
if ($menu[2] == 'google-pagespeed-insights') {
|
||||||
unset($submenu['tools.php'][ $key ]);
|
unset($submenu['tools.php'][ $key ]);
|
||||||
break;
|
break;
|
||||||
|
@ -257,7 +257,7 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
|
|
||||||
function check_pages() {
|
function check_pages() {
|
||||||
if (isset($_POST['force_recheck']) && !empty($_POST['force_recheck'])) {
|
if (isset($_POST['force_recheck']) && ! empty($_POST['force_recheck'])) {
|
||||||
$recheck = true;
|
$recheck = true;
|
||||||
} else {
|
} else {
|
||||||
$recheck = false;
|
$recheck = false;
|
||||||
|
@ -286,9 +286,9 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncPageSpeedData'] ) && $data['syncPageSpeedData'] ) {
|
if ( isset( $data['syncPageSpeedData'] ) && $data['syncPageSpeedData'] ) {
|
||||||
try{
|
try {
|
||||||
$information['syncPageSpeedData'] = $this->get_sync_data();
|
$information['syncPageSpeedData'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
if ( 'both' === $strategy || 'desktop' === $strategy ) {
|
if ( 'both' === $strategy || 'desktop' === $strategy ) {
|
||||||
$result = self::cal_pagespeed_data( 'desktop' );
|
$result = self::cal_pagespeed_data( 'desktop' );
|
||||||
if ( !empty($result) && is_array($result) ) {
|
if ( ! empty($result) && is_array($result) ) {
|
||||||
$data['desktop_score'] = $result['average_score'];
|
$data['desktop_score'] = $result['average_score'];
|
||||||
$data['desktop_total_pages'] = $result['total_pages'];
|
$data['desktop_total_pages'] = $result['total_pages'];
|
||||||
$data['desktop_last_modified'] = $result['last_modified'];
|
$data['desktop_last_modified'] = $result['last_modified'];
|
||||||
|
@ -320,7 +320,7 @@ class MainWP_Child_Pagespeed {
|
||||||
}
|
}
|
||||||
if ( 'both' === $strategy || 'mobile' === $strategy ) {
|
if ( 'both' === $strategy || 'mobile' === $strategy ) {
|
||||||
$result = self::cal_pagespeed_data( 'mobile' );
|
$result = self::cal_pagespeed_data( 'mobile' );
|
||||||
if ( !empty($result) && is_array($result) ) {
|
if ( ! empty($result) && is_array($result) ) {
|
||||||
$data['mobile_score'] = $result['average_score'];
|
$data['mobile_score'] = $result['average_score'];
|
||||||
$data['mobile_total_pages'] = $result['total_pages'];
|
$data['mobile_total_pages'] = $result['total_pages'];
|
||||||
$data['mobile_last_modified'] = $result['last_modified'];
|
$data['mobile_last_modified'] = $result['last_modified'];
|
||||||
|
@ -441,56 +441,54 @@ class MainWP_Child_Pagespeed {
|
||||||
static function get_filter_options( $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');
|
||||||
$typestocheck = array();
|
$typestocheck = array();
|
||||||
|
|
||||||
if($gpi_options['check_pages']) {
|
if ($gpi_options['check_pages']) {
|
||||||
if($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'pages') {
|
if ($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'pages') {
|
||||||
$typestocheck[] = 'type = %s';
|
$typestocheck[] = 'type = %s';
|
||||||
$types[1][] = 'page';
|
$types[1][] = 'page';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($gpi_options['check_posts']) {
|
if ($gpi_options['check_posts']) {
|
||||||
if($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'posts') {
|
if ($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'posts') {
|
||||||
$typestocheck[] = 'type = %s';
|
$typestocheck[] = 'type = %s';
|
||||||
$types[1][] = 'post';
|
$types[1][] = 'post';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($gpi_options['check_categories']) {
|
if ($gpi_options['check_categories']) {
|
||||||
if($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'categories') {
|
if ($restrict_type == 'all' || $restrict_type == 'ignored' || $restrict_type == 'categories') {
|
||||||
$typestocheck[] = 'type = %s';
|
$typestocheck[] = 'type = %s';
|
||||||
$types[1][] = 'category';
|
$types[1][] = 'category';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($gpi_options['cpt_whitelist']) {
|
if ($gpi_options['cpt_whitelist']) {
|
||||||
if($restrict_type == 'all' || $restrict_type == 'ignored' || stristr($restrict_type, 'gpi_custom_posts')) {
|
if ($restrict_type == 'all' || $restrict_type == 'ignored' || stristr($restrict_type, 'gpi_custom_posts')) {
|
||||||
|
|
||||||
$cpt_whitelist_arr = false;
|
$cpt_whitelist_arr = false;
|
||||||
if(!empty($gpi_options['cpt_whitelist'])) {
|
if ( ! empty($gpi_options['cpt_whitelist'])) {
|
||||||
$cpt_whitelist_arr = unserialize($gpi_options['cpt_whitelist']);
|
$cpt_whitelist_arr = unserialize($gpi_options['cpt_whitelist']);
|
||||||
}
|
}
|
||||||
$args=array(
|
$args = array(
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'_builtin' => false,
|
'_builtin' => false,
|
||||||
);
|
);
|
||||||
$custom_post_types = get_post_types($args, 'names', 'and');
|
$custom_post_types = get_post_types($args, 'names', 'and');
|
||||||
if($restrict_type != 'gpi_custom_posts' && $restrict_type != 'all' && $restrict_type != 'ignored') {
|
if ($restrict_type != 'gpi_custom_posts' && $restrict_type != 'all' && $restrict_type != 'ignored') {
|
||||||
$restrict_type = str_replace('gpi_custom_posts-', '', $restrict_type);
|
$restrict_type = str_replace('gpi_custom_posts-', '', $restrict_type);
|
||||||
foreach($custom_post_types as $post_type)
|
foreach ($custom_post_types as $post_type) {
|
||||||
{
|
if ($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
|
||||||
if($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
|
if ($post_type == $restrict_type) {
|
||||||
if($post_type == $restrict_type) {
|
|
||||||
$typestocheck[] = 'type = %s';
|
$typestocheck[] = 'type = %s';
|
||||||
$types[1][] = $custom_post_types[ $post_type ];
|
$types[1][] = $custom_post_types[ $post_type ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach($custom_post_types as $post_type)
|
foreach ($custom_post_types as $post_type) {
|
||||||
{
|
if ($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
|
||||||
if($cpt_whitelist_arr && in_array($post_type, $cpt_whitelist_arr)) {
|
|
||||||
$typestocheck[] = 'type = %s';
|
$typestocheck[] = 'type = %s';
|
||||||
$types[1][] = $custom_post_types[ $post_type ];
|
$types[1][] = $custom_post_types[ $post_type ];
|
||||||
}
|
}
|
||||||
|
@ -518,15 +516,13 @@ class MainWP_Child_Pagespeed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($typestocheck)) {
|
if ( ! empty($typestocheck)) {
|
||||||
$types[0] = '';
|
$types[0] = '';
|
||||||
foreach($typestocheck as $type)
|
foreach ($typestocheck as $type) {
|
||||||
{
|
if ( ! is_array($type)) {
|
||||||
if(!is_array($type)) {
|
|
||||||
$types[0] .= $type . ' OR ';
|
$types[0] .= $type . ' OR ';
|
||||||
} else {
|
} else {
|
||||||
foreach($type as $custom_post_type)
|
foreach ($type as $custom_post_type) {
|
||||||
{
|
|
||||||
$types[0] .= 'type = %s OR ';
|
$types[0] .= 'type = %s OR ';
|
||||||
$types[1][] = $custom_post_type;
|
$types[1][] = $custom_post_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,14 +151,12 @@ class MainWP_Child_Plugins_Check {
|
||||||
$plugin_info = get_transient( $this->tran_name_plugin_timestamps );
|
$plugin_info = get_transient( $this->tran_name_plugin_timestamps );
|
||||||
|
|
||||||
//Sanity check the response
|
//Sanity check the response
|
||||||
if( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) )
|
if ( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) ) {
|
||||||
{
|
|
||||||
return $plugin_meta;
|
return $plugin_meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
//See if this specific plugin is in the known list
|
//See if this specific plugin is in the known list
|
||||||
if( array_key_exists( $plugin_file, $plugin_info ) )
|
if ( array_key_exists( $plugin_file, $plugin_info ) ) {
|
||||||
{
|
|
||||||
//Get now
|
//Get now
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
$last_updated = $plugin_info[ $plugin_file ]['last_updated'];
|
$last_updated = $plugin_info[ $plugin_file ]['last_updated'];
|
||||||
|
@ -173,12 +171,9 @@ class MainWP_Child_Plugins_Check {
|
||||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||||
|
|
||||||
//If we're outside the window for tolerance show a message
|
//If we're outside the window for tolerance show a message
|
||||||
if( $diff_in_days > $tolerance_in_days )
|
if ( $diff_in_days > $tolerance_in_days ) {
|
||||||
{
|
|
||||||
$plugin_meta[] = sprintf( '<strong style="color: #f00;">This plugin has not been updated by the author in %1$d days!</strong>', $diff_in_days );
|
$plugin_meta[] = sprintf( '<strong style="color: #f00;">This plugin has not been updated by the author in %1$d days!</strong>', $diff_in_days );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$plugin_meta[] = sprintf( '<span style="color: #090;">This plugin was last updated by the author in %1$d days ago.</span>', $diff_in_days );
|
$plugin_meta[] = sprintf( '<span style="color: #090;">This plugin was last updated by the author in %1$d days ago.</span>', $diff_in_days );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1336,13 +1336,13 @@ class MainWP_Child_Server_Information {
|
||||||
'sslverify' => apply_filters( 'https_local_ssl_verify', true ),
|
'sslverify' => apply_filters( 'https_local_ssl_verify', true ),
|
||||||
'timeout' => 15,
|
'timeout' => 15,
|
||||||
);
|
);
|
||||||
$response = wp_remote_post( $url, $args );
|
$response = wp_remote_post( $url, $args );
|
||||||
$test_result = '';
|
$test_result = '';
|
||||||
if ( is_wp_error( $response ) ) {
|
if ( is_wp_error( $response ) ) {
|
||||||
$test_result .= sprintf( __( 'The HTTP response test get an error "%s"', 'mainwp-child' ), $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 );
|
$response_code = wp_remote_retrieve_response_code( $response );
|
||||||
if ( $response_code < 200 && $response_code > 204 ) {
|
if ( $response_code < 200 && $response_code > 204 ) {
|
||||||
$test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)', 'mainwp-child' ), 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 {
|
} else {
|
||||||
$response_body = wp_remote_retrieve_body( $response );
|
$response_body = wp_remote_retrieve_body( $response );
|
||||||
|
@ -1602,7 +1602,7 @@ class MainWP_Child_Server_Information {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$configFound ) {
|
if ( ! $configFound ) {
|
||||||
_e( 'wp-config.php not found', 'mainwp' );
|
_e( 'wp-config.php not found', 'mainwp' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1652,12 +1652,12 @@ class MainWP_Child_Server_Information {
|
||||||
),
|
),
|
||||||
'uniqueid' => array(
|
'uniqueid' => array(
|
||||||
'title' => __('Child unique security id', 'mainwp-child'),
|
'title' => __('Child unique security id', 'mainwp-child'),
|
||||||
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
|
'value' => ! empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
|
||||||
'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child'), stripslashes( $branding_title ) ),
|
'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child'), stripslashes( $branding_title ) ),
|
||||||
),
|
),
|
||||||
'verify_ssl' => array(
|
'verify_ssl' => array(
|
||||||
'title' => __('Verify certificate', 'mainwp-child'),
|
'title' => __('Verify certificate', 'mainwp-child'),
|
||||||
'value' => __('Yes', '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-child'),
|
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'),
|
||||||
),
|
),
|
||||||
'ssl_version' => array(
|
'ssl_version' => array(
|
||||||
|
|
|
@ -195,7 +195,7 @@ class MainWP_Child_Skeleton_Key {
|
||||||
public function save_settings() {
|
public function save_settings() {
|
||||||
$settings = isset($_POST['settings']) ? $_POST['settings'] : array();
|
$settings = isset($_POST['settings']) ? $_POST['settings'] : array();
|
||||||
|
|
||||||
if (!is_array($settings) || empty($settings)) {
|
if ( ! is_array($settings) || empty($settings)) {
|
||||||
return array( 'error' => 'Invalid data. Please check and try again.' );
|
return array( 'error' => 'Invalid data. Please check and try again.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,11 +203,11 @@ class MainWP_Child_Skeleton_Key {
|
||||||
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
|
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !is_multisite() ) {
|
if ( ! is_multisite() ) {
|
||||||
if ( !defined( 'WP_SITEURL' ) ) {
|
if ( ! defined( 'WP_SITEURL' ) ) {
|
||||||
$whitelist_options['general'][] = 'siteurl';
|
$whitelist_options['general'][] = 'siteurl';
|
||||||
}
|
}
|
||||||
if ( !defined( 'WP_HOME' ) ) {
|
if ( ! defined( 'WP_HOME' ) ) {
|
||||||
$whitelist_options['general'][] = 'home';
|
$whitelist_options['general'][] = 'home';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ class MainWP_Child_Skeleton_Key {
|
||||||
}
|
}
|
||||||
|
|
||||||
$updated = false;
|
$updated = false;
|
||||||
foreach($settings as $option => $value) {
|
foreach ($settings as $option => $value) {
|
||||||
if (in_array($option, $whitelist_general)) {
|
if (in_array($option, $whitelist_general)) {
|
||||||
if ( ! is_array( $value ) ) {
|
if ( ! is_array( $value ) ) {
|
||||||
$value = trim( $value );
|
$value = trim( $value );
|
||||||
|
@ -242,7 +242,7 @@ class MainWP_Child_Skeleton_Key {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$updated) {
|
if ( ! $updated) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class MainWP_Child_Staging {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class MainWP_Child_Staging {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ class MainWP_Child_Staging {
|
||||||
|
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncWPStaging'] ) && $data['syncWPStaging'] ) {
|
if ( isset( $data['syncWPStaging'] ) && $data['syncWPStaging'] ) {
|
||||||
try{
|
try {
|
||||||
$information['syncWPStaging'] = $this->get_sync_data();
|
$information['syncWPStaging'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
// do not exit
|
// do not exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,11 +77,11 @@ class MainWP_Child_Staging {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
MainWP_Helper::write( array( 'error' => 'Please install WP Staging plugin on child website' ) );
|
MainWP_Helper::write( array( 'error' => 'Please install WP Staging plugin on child website' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists( 'WPStaging\WPStaging' )){
|
if ( ! class_exists( 'WPStaging\WPStaging' )) {
|
||||||
require_once WPSTG_PLUGIN_DIR . 'apps/Core/WPStaging.php';
|
require_once WPSTG_PLUGIN_DIR . 'apps/Core/WPStaging.php';
|
||||||
}
|
}
|
||||||
\WPStaging\WPStaging::getInstance();
|
\WPStaging\WPStaging::getInstance();
|
||||||
|
@ -176,7 +176,7 @@ class MainWP_Child_Staging {
|
||||||
);
|
);
|
||||||
|
|
||||||
$save_fields = array();
|
$save_fields = array();
|
||||||
foreach($filters as $field) {
|
foreach ($filters as $field) {
|
||||||
if (isset($settings[ $field ])) {
|
if (isset($settings[ $field ])) {
|
||||||
$save_fields[ $field ] = $settings[ $field ];
|
$save_fields[ $field ] = $settings[ $field ];
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ class MainWP_Child_Staging {
|
||||||
|
|
||||||
public function get_overview() {
|
public function get_overview() {
|
||||||
$return = array(
|
$return = array(
|
||||||
'availableClones' => get_option( 'wpstg_existing_clones_beta', array()),
|
'availableClones' => get_option( 'wpstg_existing_clones_beta', array()),
|
||||||
);
|
);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -215,12 +215,12 @@ class MainWP_Child_Staging {
|
||||||
$clones = get_option( 'wpstg_existing_clones_beta', array() );
|
$clones = get_option( 'wpstg_existing_clones_beta', array() );
|
||||||
|
|
||||||
// Check clone name length
|
// Check clone name length
|
||||||
if( $cloneNameLength < 1 || $cloneNameLength > 16 ) {
|
if ( $cloneNameLength < 1 || $cloneNameLength > 16 ) {
|
||||||
echo array(
|
echo array(
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Clone name must be between 1 - 16 characters',
|
'message' => 'Clone name must be between 1 - 16 characters',
|
||||||
);
|
);
|
||||||
} elseif( array_key_exists( $cloneName, $clones ) ) {
|
} elseif ( array_key_exists( $cloneName, $clones ) ) {
|
||||||
return array(
|
return array(
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Clone name is already in use, please choose an another clone name',
|
'message' => 'Clone name is already in use, please choose an another clone name',
|
||||||
|
@ -235,7 +235,7 @@ class MainWP_Child_Staging {
|
||||||
$this->url = ''; // to fix warning
|
$this->url = ''; // to fix warning
|
||||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||||
|
|
||||||
if( !$cloning->save() ) {
|
if ( ! $cloning->save() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ class MainWP_Child_Staging {
|
||||||
|
|
||||||
$cloning = new WPStaging\Backend\Modules\Jobs\Updating();
|
$cloning = new WPStaging\Backend\Modules\Jobs\Updating();
|
||||||
|
|
||||||
if( !$cloning->save() ) {
|
if ( ! $cloning->save() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,11 +350,11 @@ class MainWP_Child_Staging {
|
||||||
|
|
||||||
// from wp-staging plugin
|
// from wp-staging plugin
|
||||||
public function hasFreeDiskSpace() {
|
public function hasFreeDiskSpace() {
|
||||||
if( !function_exists( 'disk_free_space' ) ) {
|
if ( ! function_exists( 'disk_free_space' ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$freeSpace = @disk_free_space( ABSPATH );
|
$freeSpace = @disk_free_space( ABSPATH );
|
||||||
if( false === $freeSpace ) {
|
if ( false === $freeSpace ) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'freespace' => false,
|
'freespace' => false,
|
||||||
'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)),
|
'usedspace' => $this->formatSize($this->getDirectorySizeInclSubdirs(ABSPATH)),
|
||||||
|
@ -379,8 +379,7 @@ class MainWP_Child_Staging {
|
||||||
|
|
||||||
// from wp-staging plugin
|
// from wp-staging plugin
|
||||||
public function formatSize( $bytes, $precision = 2) {
|
public function formatSize( $bytes, $precision = 2) {
|
||||||
if ( (float) $bytes < 1)
|
if ( (float) $bytes < 1) {
|
||||||
{
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +423,7 @@ class MainWP_Child_Staging {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,8 @@ class MainWP_Child_Themes_Check {
|
||||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||||
|
|
||||||
foreach ( $themes_to_scan as $slug => $v ) {
|
foreach ( $themes_to_scan as $slug => $v ) {
|
||||||
if ( in_array( $slug, $avoid_themes ) ) { continue;
|
if ( in_array( $slug, $avoid_themes ) ) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $this->try_get_response_body( $slug, false );
|
$body = $this->try_get_response_body( $slug, false );
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MainWP_Child_Timecapsule {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class MainWP_Child_Timecapsule {
|
||||||
|
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class MainWP_Child_Timecapsule {
|
||||||
|
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
MainWP_Helper::write( array( 'error' => 'Please install WP Time Capsule plugin on child website' ) );
|
MainWP_Helper::write( array( 'error' => 'Please install WP Time Capsule plugin on child website' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class MainWP_Child_Timecapsule {
|
||||||
$_POST['mwp_action'] == 'save_settings' ||
|
$_POST['mwp_action'] == 'save_settings' ||
|
||||||
$_POST['mwp_action'] == 'get_staging_details_wptc' ||
|
$_POST['mwp_action'] == 'get_staging_details_wptc' ||
|
||||||
$_POST['mwp_action'] == 'progress_wptc'
|
$_POST['mwp_action'] == 'progress_wptc'
|
||||||
) && ( !$is_user_logged_in || !$privileges_wptc )
|
) && ( ! $is_user_logged_in || ! $privileges_wptc )
|
||||||
) {
|
) {
|
||||||
MainWP_Helper::write( array( 'error' => 'You are not login to your WP Time Capsule account.' ) );
|
MainWP_Helper::write( array( 'error' => 'You are not login to your WP Time Capsule account.' ) );
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ class MainWP_Child_Timecapsule {
|
||||||
|
|
||||||
|
|
||||||
public function require_files() {
|
public function require_files() {
|
||||||
if (! class_exists('WPTC_Base_Factory') && defined('WPTC_PLUGIN_DIR') ) {
|
if ( ! class_exists('WPTC_Base_Factory') && defined('WPTC_PLUGIN_DIR') ) {
|
||||||
if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Base/Factory.php') ) {
|
if ( MainWP_Helper::check_files_exists(WPTC_PLUGIN_DIR . 'Base/Factory.php') ) {
|
||||||
include_once WPTC_PLUGIN_DIR . 'Base/Factory.php';
|
include_once WPTC_PLUGIN_DIR . 'Base/Factory.php';
|
||||||
}
|
}
|
||||||
|
@ -281,10 +281,10 @@ class MainWP_Child_Timecapsule {
|
||||||
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'main_account_email' => $main_account_email_var,
|
'main_account_email' => $main_account_email_var,
|
||||||
'signed_in_repos' => $wptc_settings->get_connected_cloud_info(),
|
'signed_in_repos' => $wptc_settings->get_connected_cloud_info(),
|
||||||
'plan_name' => $options_helper->get_plan_interval_from_subs_info(),
|
'plan_name' => $options_helper->get_plan_interval_from_subs_info(),
|
||||||
'plan_interval' => $options_helper->get_plan_interval_from_subs_info(),
|
'plan_interval' => $options_helper->get_plan_interval_from_subs_info(),
|
||||||
'lastbackup_time' => !empty($last_backup_time) ? $last_backup_time : 0,
|
'lastbackup_time' => ! empty($last_backup_time) ? $last_backup_time : 0,
|
||||||
'is_user_logged_in' => $options_helper->get_is_user_logged_in(),
|
'is_user_logged_in' => $options_helper->get_is_user_logged_in(),
|
||||||
'backups_count' => $backups_count,
|
'backups_count' => $backups_count,
|
||||||
);
|
);
|
||||||
|
@ -318,7 +318,7 @@ class MainWP_Child_Timecapsule {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exclude_file_list() {
|
public function exclude_file_list() {
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
||||||
}
|
}
|
||||||
$category = $_POST['category'];
|
$category = $_POST['category'];
|
||||||
|
@ -331,7 +331,7 @@ class MainWP_Child_Timecapsule {
|
||||||
|
|
||||||
$config = WPTC_Factory::get('config');
|
$config = WPTC_Factory::get('config');
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
if (!$config->get_option('in_progress')) {
|
if ( ! $config->get_option('in_progress')) {
|
||||||
spawn_cron();
|
spawn_cron();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,13 +346,13 @@ class MainWP_Child_Timecapsule {
|
||||||
$return_array['is_staging_running'] = apply_filters('is_any_staging_process_going_on', '');
|
$return_array['is_staging_running'] = apply_filters('is_any_staging_process_going_on', '');
|
||||||
$cron_status = $config->get_option('wptc_own_cron_status');
|
$cron_status = $config->get_option('wptc_own_cron_status');
|
||||||
|
|
||||||
if (!empty($cron_status)) {
|
if ( ! empty($cron_status)) {
|
||||||
$return_array['wptc_own_cron_status'] = unserialize($cron_status);
|
$return_array['wptc_own_cron_status'] = unserialize($cron_status);
|
||||||
$return_array['wptc_own_cron_status_notified'] = (int) $config->get_option('wptc_own_cron_status_notified');
|
$return_array['wptc_own_cron_status_notified'] = (int) $config->get_option('wptc_own_cron_status_notified');
|
||||||
}
|
}
|
||||||
|
|
||||||
$start_backups_failed_server = $config->get_option('start_backups_failed_server');
|
$start_backups_failed_server = $config->get_option('start_backups_failed_server');
|
||||||
if (!empty($start_backups_failed_server)) {
|
if ( ! empty($start_backups_failed_server)) {
|
||||||
$return_array['start_backups_failed_server'] = unserialize($start_backups_failed_server);
|
$return_array['start_backups_failed_server'] = unserialize($start_backups_failed_server);
|
||||||
$config->set_option('start_backups_failed_server', false);
|
$config->set_option('start_backups_failed_server', false);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ class MainWP_Child_Timecapsule {
|
||||||
$processed_files = WPTC_Factory::get('processed-files');
|
$processed_files = WPTC_Factory::get('processed-files');
|
||||||
$last_backup_time = $config->get_option('last_backup_time');
|
$last_backup_time = $config->get_option('last_backup_time');
|
||||||
|
|
||||||
if (!empty($last_backup_time)) {
|
if ( ! empty($last_backup_time)) {
|
||||||
$user_time = $config->cnvt_UTC_to_usrTime($last_backup_time);
|
$user_time = $config->cnvt_UTC_to_usrTime($last_backup_time);
|
||||||
$processed_files->modify_schedule_backup_time($user_time);
|
$processed_files->modify_schedule_backup_time($user_time);
|
||||||
$formatted_date = date('M d @ g:i a', $user_time);
|
$formatted_date = date('M d @ g:i a', $user_time);
|
||||||
|
@ -385,7 +385,7 @@ class MainWP_Child_Timecapsule {
|
||||||
wptc_own_cron_status();
|
wptc_own_cron_status();
|
||||||
$status = array();
|
$status = array();
|
||||||
$cron_status = $config->get_option('wptc_own_cron_status');
|
$cron_status = $config->get_option('wptc_own_cron_status');
|
||||||
if (!empty($cron_status)) {
|
if ( ! empty($cron_status)) {
|
||||||
$cron_status = unserialize($cron_status);
|
$cron_status = unserialize($cron_status);
|
||||||
|
|
||||||
if ($cron_status['status'] == 'success') {
|
if ($cron_status['status'] == 'success') {
|
||||||
|
@ -488,9 +488,10 @@ function get_sibling_files_callback_wptc() {
|
||||||
/*
|
/*
|
||||||
-- Ordering parameters -- */
|
-- Ordering parameters -- */
|
||||||
//Parameters that are going to be used to order the result
|
//Parameters that are going to be used to order the result
|
||||||
$orderby = !empty($_POST['orderby']) ? mysql_real_escape_string($_POST['orderby']) : 'id';
|
$orderby = ! empty($_POST['orderby']) ? mysql_real_escape_string($_POST['orderby']) : 'id';
|
||||||
$order = !empty($_POST['order']) ? mysql_real_escape_string($_POST['order']) : 'DESC';
|
$order = ! empty($_POST['order']) ? mysql_real_escape_string($_POST['order']) : 'DESC';
|
||||||
if (!empty($orderby) & !empty($order)) {$query .= ' ORDER BY ' . $orderby . ' ' . $order;}
|
if ( ! empty($orderby) & ! empty($order)) {
|
||||||
|
$query .= ' ORDER BY ' . $orderby . ' ' . $order;}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-- Pagination parameters -- */
|
-- Pagination parameters -- */
|
||||||
|
@ -499,12 +500,13 @@ function get_sibling_files_callback_wptc() {
|
||||||
//How many to display per page?
|
//How many to display per page?
|
||||||
$perpage = 20;
|
$perpage = 20;
|
||||||
//Which page is this?
|
//Which page is this?
|
||||||
$paged = !empty($_POST['paged']) ? $_POST['paged'] : '';
|
$paged = ! empty($_POST['paged']) ? $_POST['paged'] : '';
|
||||||
if (empty($paged) || !is_numeric($paged) || $paged <= 0) {$paged = 1;} //Page Number
|
if (empty($paged) || ! is_numeric($paged) || $paged <= 0) {
|
||||||
|
$paged = 1;} //Page Number
|
||||||
//How many pages do we have in total?
|
//How many pages do we have in total?
|
||||||
$totalpages = ceil($totalitems / $perpage); //Total number of pages
|
$totalpages = ceil($totalitems / $perpage); //Total number of pages
|
||||||
//adjust the query to take pagination into account
|
//adjust the query to take pagination into account
|
||||||
if (!empty($paged) && !empty($perpage)) {
|
if ( ! empty($paged) && ! empty($perpage)) {
|
||||||
$offset = ( $paged - 1 ) * $perpage;
|
$offset = ( $paged - 1 ) * $perpage;
|
||||||
$query .= ' LIMIT ' . (int) $offset . ',' . (int) $perpage;
|
$query .= ' LIMIT ' . (int) $offset . ',' . (int) $perpage;
|
||||||
}
|
}
|
||||||
|
@ -519,13 +521,13 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
function lazy_load_activity_log_wptc() {
|
function lazy_load_activity_log_wptc() {
|
||||||
|
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $_POST['data'];
|
$data = $_POST['data'];
|
||||||
|
|
||||||
if (!isset($data['action_id']) || !isset($data['limit'])) {
|
if ( ! isset($data['action_id']) || ! isset($data['limit'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -561,11 +563,11 @@ function get_sibling_files_callback_wptc() {
|
||||||
function get_display_rows( $records) {
|
function get_display_rows( $records) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
//Get the records registered in the prepare_items method
|
//Get the records registered in the prepare_items method
|
||||||
if (!is_array($records)) {
|
if ( ! is_array($records)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$i=0;
|
$i = 0;
|
||||||
$limit = WPTC_Factory::get('config')->get_option('activity_log_lazy_load_limit');
|
$limit = WPTC_Factory::get('config')->get_option('activity_log_lazy_load_limit');
|
||||||
//Get the columns registered in the get_columns and get_sortable_columns methods
|
//Get the columns registered in the get_columns and get_sortable_columns methods
|
||||||
// $columns = $this->get_columns();
|
// $columns = $this->get_columns();
|
||||||
|
@ -606,13 +608,13 @@ function get_sibling_files_callback_wptc() {
|
||||||
// $user_tz_now = $user_tz->format("M d, Y @ g:i:s a");
|
// $user_tz_now = $user_tz->format("M d, Y @ g:i:s a");
|
||||||
$user_tz_now = date('M d, Y @ g:i:s a', $user_time);
|
$user_tz_now = date('M d, Y @ g:i:s a', $user_time);
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (!( strpos($rec->type, 'backup') === false )) {
|
if ( ! ( strpos($rec->type, 'backup') === false )) {
|
||||||
//Backup process
|
//Backup process
|
||||||
$msg = 'Backup Process';
|
$msg = 'Backup Process';
|
||||||
} elseif (!( strpos($rec->type, 'restore') === false )) {
|
} elseif ( ! ( strpos($rec->type, 'restore') === false )) {
|
||||||
//Restore Process
|
//Restore Process
|
||||||
$msg = 'Restore Process';
|
$msg = 'Restore Process';
|
||||||
} elseif (!( strpos($rec->type, 'staging') === false )) {
|
} elseif ( ! ( strpos($rec->type, 'staging') === false )) {
|
||||||
//Restore Process
|
//Restore Process
|
||||||
$msg = 'Staging Process';
|
$msg = 'Staging Process';
|
||||||
} else {
|
} else {
|
||||||
|
@ -689,7 +691,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
|
|
||||||
public function exclude_table_list() {
|
public function exclude_table_list() {
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
||||||
}
|
}
|
||||||
$category = $_POST['data']['category'];
|
$category = $_POST['data']['category'];
|
||||||
|
@ -709,10 +711,11 @@ function get_sibling_files_callback_wptc() {
|
||||||
// ok
|
// ok
|
||||||
public function do_reports_log( $ext = '') {
|
public function do_reports_log( $ext = '') {
|
||||||
|
|
||||||
if ( $ext !== 'wptimecapsule' ) { return;
|
if ( $ext !== 'wptimecapsule' ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +728,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$backup_time = $config->get_option('last_backup_time');
|
$backup_time = $config->get_option('last_backup_time');
|
||||||
|
|
||||||
if (!empty($backup_time)) {
|
if ( ! empty($backup_time)) {
|
||||||
MainWP_Helper::update_lasttime_backup( 'wptimecapsule', $backup_time ); // to support backup before update feature
|
MainWP_Helper::update_lasttime_backup( 'wptimecapsule', $backup_time ); // to support backup before update feature
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,20 +749,20 @@ function get_sibling_files_callback_wptc() {
|
||||||
$message = 'WP Time Capsule backup finished';
|
$message = 'WP Time Capsule backup finished';
|
||||||
$backup_type = 'WP Time Capsule backup';
|
$backup_type = 'WP Time Capsule backup';
|
||||||
if (count($formatted_backups) > 0) {
|
if (count($formatted_backups) > 0) {
|
||||||
foreach($formatted_backups as $key => $value) {
|
foreach ($formatted_backups as $key => $value) {
|
||||||
$backup_time = $key;
|
$backup_time = $key;
|
||||||
do_action( 'mainwp_reports_wptimecapsule_backup', $message, $backup_type, $backup_time );
|
do_action( 'mainwp_reports_wptimecapsule_backup', $message, $backup_type, $backup_time );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function include_table_list() {
|
public function include_table_list() {
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
||||||
}
|
}
|
||||||
$category = $_POST['data']['category'];
|
$category = $_POST['data']['category'];
|
||||||
|
@ -770,7 +773,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
public function include_table_structure_only() {
|
public function include_table_structure_only() {
|
||||||
|
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +785,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
public function include_file_list() {
|
public function include_file_list() {
|
||||||
|
|
||||||
if (!isset($_POST['data'])) {
|
if ( ! isset($_POST['data'])) {
|
||||||
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
wptc_die_with_json_encode( array( 'status' => 'no data found' ) );
|
||||||
}
|
}
|
||||||
$category = $_POST['category'];
|
$category = $_POST['category'];
|
||||||
|
@ -802,7 +805,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
private function process_wptc_login() {
|
private function process_wptc_login() {
|
||||||
$options_helper = new Wptc_Options_Helper();
|
$options_helper = new Wptc_Options_Helper();
|
||||||
|
|
||||||
if($options_helper->get_is_user_logged_in()){
|
if ($options_helper->get_is_user_logged_in()) {
|
||||||
return array(
|
return array(
|
||||||
'result' => 'is_user_logged_in',
|
'result' => 'is_user_logged_in',
|
||||||
'sync_data' => $this->get_sync_data(),
|
'sync_data' => $this->get_sync_data(),
|
||||||
|
@ -836,7 +839,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$is_user_logged_in = $options->get_option('is_user_logged_in');
|
$is_user_logged_in = $options->get_option('is_user_logged_in');
|
||||||
|
|
||||||
if (!$is_user_logged_in) {
|
if ( ! $is_user_logged_in) {
|
||||||
return array( 'error' => 'Login failed.' );
|
return array( 'error' => 'Login failed.' );
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
|
@ -851,7 +854,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$plugins = $backup_before_auto_update_settings->get_installed_plugins();
|
$plugins = $backup_before_auto_update_settings->get_installed_plugins();
|
||||||
|
|
||||||
if ($plugins) {
|
if ($plugins) {
|
||||||
return array( 'results' =>$plugins );
|
return array( 'results' => $plugins );
|
||||||
}
|
}
|
||||||
return array( 'results' => array() );
|
return array( 'results' => array() );
|
||||||
}
|
}
|
||||||
|
@ -862,7 +865,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$plugins = $backup_before_auto_update_settings->get_installed_themes();
|
$plugins = $backup_before_auto_update_settings->get_installed_themes();
|
||||||
if ($plugins) {
|
if ($plugins) {
|
||||||
return array( 'results' =>$plugins );
|
return array( 'results' => $plugins );
|
||||||
}
|
}
|
||||||
return array( 'results' => array() );
|
return array( 'results' => array() );
|
||||||
}
|
}
|
||||||
|
@ -960,7 +963,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$options_helper = new Wptc_Options_Helper();
|
$options_helper = new Wptc_Options_Helper();
|
||||||
|
|
||||||
if( !$options_helper->get_is_user_logged_in() ){
|
if ( ! $options_helper->get_is_user_logged_in() ) {
|
||||||
return array(
|
return array(
|
||||||
'sync_data' => $this->get_sync_data(),
|
'sync_data' => $this->get_sync_data(),
|
||||||
'error' => 'Login to your WP Time Capsule account first',
|
'error' => 'Login to your WP Time Capsule account first',
|
||||||
|
@ -969,8 +972,8 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$data = unserialize(base64_decode($_POST['data']));
|
$data = unserialize(base64_decode($_POST['data']));
|
||||||
|
|
||||||
$tabName = $_POST['tabname'];
|
$tabName = $_POST['tabname'];
|
||||||
$is_general = $_POST['is_general'];
|
$is_general = $_POST['is_general'];
|
||||||
|
|
||||||
$saved = false;
|
$saved = false;
|
||||||
|
|
||||||
|
@ -981,7 +984,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$config->set_option('user_excluded_extenstions', $data['user_excluded_extenstions']);
|
$config->set_option('user_excluded_extenstions', $data['user_excluded_extenstions']);
|
||||||
$config->set_option('user_excluded_files_more_than_size_settings', $data['user_excluded_files_more_than_size_settings']);
|
$config->set_option('user_excluded_files_more_than_size_settings', $data['user_excluded_files_more_than_size_settings']);
|
||||||
|
|
||||||
if (!empty($data['backup_slot'])) {
|
if ( ! empty($data['backup_slot'])) {
|
||||||
$config->set_option('old_backup_slot', $config->get_option('backup_slot'));
|
$config->set_option('old_backup_slot', $config->get_option('backup_slot'));
|
||||||
$config->set_option('backup_slot', $data['backup_slot']);
|
$config->set_option('backup_slot', $data['backup_slot']);
|
||||||
}
|
}
|
||||||
|
@ -991,7 +994,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$config->set_option('wptc_timezone', $data['wptc_timezone']);
|
$config->set_option('wptc_timezone', $data['wptc_timezone']);
|
||||||
$config->set_option('schedule_time_str', $data['schedule_time_str']);
|
$config->set_option('schedule_time_str', $data['schedule_time_str']);
|
||||||
|
|
||||||
if(!empty($data['schedule_time_str']) && !empty($data['wptc_timezone']) ){
|
if ( ! empty($data['schedule_time_str']) && ! empty($data['wptc_timezone']) ) {
|
||||||
if (function_exists('wptc_modify_schedule_backup')) {
|
if (function_exists('wptc_modify_schedule_backup')) {
|
||||||
wptc_modify_schedule_backup();
|
wptc_modify_schedule_backup();
|
||||||
}
|
}
|
||||||
|
@ -999,7 +1002,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$notice = apply_filters('check_requirements_auto_backup_wptc', '');
|
$notice = apply_filters('check_requirements_auto_backup_wptc', '');
|
||||||
|
|
||||||
if (!empty($data['revision_limit']) && !$notice ) {
|
if ( ! empty($data['revision_limit']) && ! $notice ) {
|
||||||
$notice = apply_filters('save_settings_revision_limit_wptc', $data['revision_limit']);
|
$notice = apply_filters('save_settings_revision_limit_wptc', $data['revision_limit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,7 +1024,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$current['update_settings']['themes']['status'] = $new['update_settings']['themes']['status'];
|
$current['update_settings']['themes']['status'] = $new['update_settings']['themes']['status'];
|
||||||
$current['update_settings']['plugins']['status'] = $new['update_settings']['plugins']['status'];
|
$current['update_settings']['plugins']['status'] = $new['update_settings']['plugins']['status'];
|
||||||
|
|
||||||
if (!$is_general) {
|
if ( ! $is_general) {
|
||||||
if (isset($new['update_settings']['plugins']['included'])) {
|
if (isset($new['update_settings']['plugins']['included'])) {
|
||||||
$current['update_settings']['plugins']['included'] = $new['update_settings']['plugins']['included'];
|
$current['update_settings']['plugins']['included'] = $new['update_settings']['plugins']['included'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1047,14 +1050,14 @@ function get_sibling_files_callback_wptc() {
|
||||||
$current['themes']['status'] = $new['themes']['status'];
|
$current['themes']['status'] = $new['themes']['status'];
|
||||||
$current['plugins']['status'] = $new['plugins']['status'];
|
$current['plugins']['status'] = $new['plugins']['status'];
|
||||||
|
|
||||||
if (!$is_general) {
|
if ( ! $is_general) {
|
||||||
$vulns_plugins_included = !empty($new['plugins']['vulns_plugins_included']) ? $new['plugins']['vulns_plugins_included'] : array();
|
$vulns_plugins_included = ! empty($new['plugins']['vulns_plugins_included']) ? $new['plugins']['vulns_plugins_included'] : array();
|
||||||
|
|
||||||
$plugin_include_array = array();
|
$plugin_include_array = array();
|
||||||
|
|
||||||
if (!empty($vulns_plugins_included)) {
|
if ( ! empty($vulns_plugins_included)) {
|
||||||
$plugin_include_array = explode(',', $vulns_plugins_included);
|
$plugin_include_array = explode(',', $vulns_plugins_included);
|
||||||
$plugin_include_array = !empty($plugin_include_array) ? $plugin_include_array : array();
|
$plugin_include_array = ! empty($plugin_include_array) ? $plugin_include_array : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
wptc_log($plugin_include_array, '--------$plugin_include_array--------');
|
wptc_log($plugin_include_array, '--------$plugin_include_array--------');
|
||||||
|
@ -1065,11 +1068,11 @@ function get_sibling_files_callback_wptc() {
|
||||||
|
|
||||||
$current['plugins']['excluded'] = serialize($included_plugins);
|
$current['plugins']['excluded'] = serialize($included_plugins);
|
||||||
|
|
||||||
$vulns_themes_included = !empty($new['themes']['vulns_themes_included']) ? $new['themes']['vulns_themes_included'] : array();
|
$vulns_themes_included = ! empty($new['themes']['vulns_themes_included']) ? $new['themes']['vulns_themes_included'] : array();
|
||||||
|
|
||||||
$themes_include_array = array();
|
$themes_include_array = array();
|
||||||
|
|
||||||
if (!empty($vulns_themes_included)) {
|
if ( ! empty($vulns_themes_included)) {
|
||||||
$themes_include_array = explode(',', $vulns_themes_included);
|
$themes_include_array = explode(',', $vulns_themes_included);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,7 +1090,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$config->set_option('internal_staging_deep_link_limit', $data['internal_staging_deep_link_limit']);
|
$config->set_option('internal_staging_deep_link_limit', $data['internal_staging_deep_link_limit']);
|
||||||
$config->set_option('internal_staging_enable_admin_login', $data['internal_staging_enable_admin_login']);
|
$config->set_option('internal_staging_enable_admin_login', $data['internal_staging_enable_admin_login']);
|
||||||
$config->set_option('staging_is_reset_permalink', $data['staging_is_reset_permalink']);
|
$config->set_option('staging_is_reset_permalink', $data['staging_is_reset_permalink']);
|
||||||
if (!$is_general) {
|
if ( ! $is_general) {
|
||||||
$config->set_option('staging_login_custom_link', $data['staging_login_custom_link']);
|
$config->set_option('staging_login_custom_link', $data['staging_login_custom_link']);
|
||||||
}
|
}
|
||||||
$saved = true;
|
$saved = true;
|
||||||
|
@ -1169,8 +1172,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
$curlversion = curl_version();
|
$curlversion = curl_version();
|
||||||
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['version'] ) . '</td></tr>';
|
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['version'] ) . '</td></tr>';
|
||||||
echo '<tr title=""><td>' . __( 'cURL SSL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['ssl_version'] ) . '</td></tr>';
|
echo '<tr title=""><td>' . __( 'cURL SSL version', 'wp-time-capsule' ) . '</td><td>' . esc_html( $curlversion['ssl_version'] ) . '</td></tr>';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . __( 'unavailable', 'wp-time-capsule' ) . '</td></tr>';
|
echo '<tr title=""><td>' . __( 'cURL version', 'wp-time-capsule' ) . '</td><td>' . __( 'unavailable', 'wp-time-capsule' ) . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1279,7 +1281,7 @@ function get_sibling_files_callback_wptc() {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
if ( isset( $value->response['wp-time-capsule/wp-time-capsule.php'] ) ) {
|
if ( isset( $value->response['wp-time-capsule/wp-time-capsule.php'] ) ) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function hookUpdraftplusSaveLastBackup( $last_backup) {
|
public static function hookUpdraftplusSaveLastBackup( $last_backup) {
|
||||||
if (!is_array($last_backup)) {
|
if ( ! is_array($last_backup)) {
|
||||||
return $last_backup;
|
return $last_backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
// ok
|
// ok
|
||||||
function syncOthersData( $information, $data = array() ) {
|
function syncOthersData( $information, $data = array() ) {
|
||||||
try{
|
try {
|
||||||
if ( isset( $data['syncUpdraftData'] ) && $info = $data['syncUpdraftData'] ) {
|
if ( isset( $data['syncUpdraftData'] ) && $info = $data['syncUpdraftData'] ) {
|
||||||
if ( $this->is_plugin_installed ) {
|
if ( $this->is_plugin_installed ) {
|
||||||
$with_hist = true;
|
$with_hist = true;
|
||||||
|
@ -70,7 +70,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$information['sync_Updraftvault_quota_text'] = $this->connected_html();
|
$information['sync_Updraftvault_quota_text'] = $this->connected_html();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$information = $this->vault_disconnect();
|
$information = $this->vault_disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
$information = array( 'error' => $e->getMessage() );
|
$information = array( 'error' => $e->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
private function do_vault_connect() {
|
private function do_vault_connect() {
|
||||||
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
||||||
if ( is_array( $vault_settings ) && !empty( $vault_settings['token'] ) && !empty( $vault_settings['email'] ) ) {
|
if ( is_array( $vault_settings ) && ! empty( $vault_settings['token'] ) && ! empty( $vault_settings['email'] ) ) {
|
||||||
return array(
|
return array(
|
||||||
'connected' => true,
|
'connected' => true,
|
||||||
'html' => $this->connected_html(),
|
'html' => $this->connected_html(),
|
||||||
|
@ -276,7 +276,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
MainWP_Helper::check_methods('UpdraftPlus_Options', 'get_updraft_option');
|
MainWP_Helper::check_methods('UpdraftPlus_Options', 'get_updraft_option');
|
||||||
|
|
||||||
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
||||||
if ( !is_array( $vault_settings ) || empty( $vault_settings['token'] ) || empty( $vault_settings['email'] ) ) {
|
if ( ! is_array( $vault_settings ) || empty( $vault_settings['token'] ) || empty( $vault_settings['email'] ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$ret .= __( 'This site is <strong>connected</strong> to UpdraftPlus Vault.', 'updraftplus' ) . ' ' . __( "Well done - there's nothing more needed to set up.", 'updraftplus' ) . '</p><p><strong>' . __( 'Vault owner', 'updraftplus' ) . ':</strong> ' . htmlspecialchars( $vault_settings['email'] );
|
$ret .= __( 'This site is <strong>connected</strong> to UpdraftPlus Vault.', 'updraftplus' ) . ' ' . __( "Well done - there's nothing more needed to set up.", 'updraftplus' ) . '</p><p><strong>' . __( 'Vault owner', 'updraftplus' ) . ':</strong> ' . htmlspecialchars( $vault_settings['email'] );
|
||||||
|
|
||||||
$ret .= '<br><strong>' . __( 'Quota:', 'updraftplus' ) . '</strong> ';
|
$ret .= '<br><strong>' . __( 'Quota:', 'updraftplus' ) . '</strong> ';
|
||||||
if ( !isset( $vault_settings['quota'] ) || !is_numeric( $vault_settings['quota'] ) || ( $vault_settings['quota'] < 0 ) ) {
|
if ( ! isset( $vault_settings['quota'] ) || ! is_numeric( $vault_settings['quota'] ) || ( $vault_settings['quota'] < 0 ) ) {
|
||||||
$ret .= __( 'Unknown', 'updraftplus' );
|
$ret .= __( 'Unknown', 'updraftplus' );
|
||||||
} else {
|
} else {
|
||||||
$quota_via_transient = get_transient( 'updraftvault_quota_text' );
|
$quota_via_transient = get_transient( 'updraftvault_quota_text' );
|
||||||
|
@ -318,12 +318,13 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( is_wp_error( $result ) || ( false === $result ) ) { return $result;
|
if ( is_wp_error( $result ) || ( false === $result ) ) {
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = json_decode( $result['body'], true );
|
$response = json_decode( $result['body'], true );
|
||||||
|
|
||||||
if ( !is_array( $response ) || !isset( $response['mothership'] ) || !isset( $response['loggedin'] ) ) {
|
if ( ! is_array( $response ) || ! isset( $response['mothership'] ) || ! isset( $response['loggedin'] ) ) {
|
||||||
if ( preg_match( '/has banned your IP address \(([\.:0-9a-f]+)\)/', $result['body'], $matches ) ) {
|
if ( preg_match( '/has banned your IP address \(([\.:0-9a-f]+)\)/', $result['body'], $matches ) ) {
|
||||||
return new WP_Error( 'banned_ip', sprintf( __( "UpdraftPlus.com has responded with 'Access Denied'.", 'updraftplus' ) . '<br>' . __( "It appears that your web server's IP Address (%s) is blocked.", 'updraftplus' ) . ' ' . __( 'This most likely means that you share a webserver with a hacked website that has been used in previous attacks.', 'updraftplus' ) . '<br> <a href="https://updraftplus.com/unblock-ip-address/" target="_blank">' . __( 'To remove the block, please go here.', 'updraftplus' ) . '</a> ', $matches[1] ) );
|
return new WP_Error( 'banned_ip', sprintf( __( "UpdraftPlus.com has responded with 'Access Denied'.", 'updraftplus' ) . '<br>' . __( "It appears that your web server's IP Address (%s) is blocked.", 'updraftplus' ) . ' ' . __( 'This most likely means that you share a webserver with a hacked website that has been used in previous attacks.', 'updraftplus' ) . '<br> <a href="https://updraftplus.com/unblock-ip-address/" target="_blank">' . __( 'To remove the block, please go here.', 'updraftplus' ) . '</a> ', $matches[1] ) );
|
||||||
} else {
|
} else {
|
||||||
|
@ -333,26 +334,28 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
switch ( $response['loggedin'] ) {
|
switch ( $response['loggedin'] ) {
|
||||||
case 'connected':
|
case 'connected':
|
||||||
if ( !empty( $response['token'] ) ) {
|
if ( ! empty( $response['token'] ) ) {
|
||||||
// Store it
|
// Store it
|
||||||
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
|
||||||
if ( !is_array( $vault_settings ) ) { $vault_settings = array();
|
if ( ! is_array( $vault_settings ) ) {
|
||||||
|
$vault_settings = array();
|
||||||
}
|
}
|
||||||
$vault_settings['email'] = $email;
|
$vault_settings['email'] = $email;
|
||||||
$vault_settings['token'] = (string) $response['token'];
|
$vault_settings['token'] = (string) $response['token'];
|
||||||
$vault_settings['quota'] = -1;
|
$vault_settings['quota'] = -1;
|
||||||
unset( $vault_settings['last_config'] );
|
unset( $vault_settings['last_config'] );
|
||||||
if ( isset($response['quota'] ) ) { $vault_settings['quota'] = $response['quota'];
|
if ( isset($response['quota'] ) ) {
|
||||||
|
$vault_settings['quota'] = $response['quota'];
|
||||||
}
|
}
|
||||||
UpdraftPlus_Options::update_updraft_option( 'updraft_updraftvault', $vault_settings );
|
UpdraftPlus_Options::update_updraft_option( 'updraft_updraftvault', $vault_settings );
|
||||||
} elseif ( isset( $response['quota'] ) && !$response['quota'] ) {
|
} elseif ( isset( $response['quota'] ) && ! $response['quota'] ) {
|
||||||
return new WP_Error( 'no_quota', __( 'You do not currently have any UpdraftPlus Vault quota', 'updraftplus' ) );
|
return new WP_Error( 'no_quota', __( 'You do not currently have any UpdraftPlus Vault quota', 'updraftplus' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'unknown_response', __( 'UpdraftPlus.Com returned a response, but we could not understand it', 'updraftplus' ) );
|
return new WP_Error( 'unknown_response', __( 'UpdraftPlus.Com returned a response, but we could not understand it', 'updraftplus' ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'authfailed':
|
case 'authfailed':
|
||||||
if ( !empty( $response['authproblem'] ) ) {
|
if ( ! empty( $response['authproblem'] ) ) {
|
||||||
if ( 'invalidpassword' == $response['authproblem'] ) {
|
if ( 'invalidpassword' == $response['authproblem'] ) {
|
||||||
$authfail_error = new WP_Error( 'authfailed', __( 'Your email address was valid, but your password was not recognised by UpdraftPlus.Com.', 'updraftplus' ) . ' <a href="https://updraftplus.com/my-account/lost-password/">' . __( 'If you have forgotten your password, then go here to change your password on updraftplus.com.', 'updraftplus' ) . '</a>' );
|
$authfail_error = new WP_Error( 'authfailed', __( 'Your email address was valid, but your password was not recognised by UpdraftPlus.Com.', 'updraftplus' ) . ' <a href="https://updraftplus.com/my-account/lost-password/">' . __( 'If you have forgotten your password, then go here to change your password on updraftplus.com.', 'updraftplus' ) . '</a>' );
|
||||||
return $authfail_error;
|
return $authfail_error;
|
||||||
|
@ -396,7 +399,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
'su' => base64_encode( home_url() ),
|
'su' => base64_encode( home_url() ),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !empty( $vault_settings['token'] ) ) { $post_body['token'] = (string) $vault_settings['token'];
|
if ( ! empty( $vault_settings['token'] ) ) {
|
||||||
|
$post_body['token'] = (string) $vault_settings['token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use SSL to prevent snooping
|
// Use SSL to prevent snooping
|
||||||
|
@ -413,7 +417,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
require_once UPDRAFTPLUS_DIR . '/class-updraftplus.php';
|
require_once UPDRAFTPLUS_DIR . '/class-updraftplus.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! class_exists( 'UpdraftPlus_Options' ) && file_exists( UPDRAFTPLUS_DIR . '/options.php' ) ) {
|
if ( ! class_exists( 'UpdraftPlus_Options' ) && file_exists( UPDRAFTPLUS_DIR . '/options.php' ) ) {
|
||||||
require_once UPDRAFTPLUS_DIR . '/options.php';
|
require_once UPDRAFTPLUS_DIR . '/options.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,20 +436,20 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$settings_key = null;
|
$settings_key = null;
|
||||||
if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) {
|
if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
if (isset($settings['is_general']) && !empty($settings['is_general'])){
|
if (isset($settings['is_general']) && ! empty($settings['is_general'])) {
|
||||||
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
} else {
|
} else {
|
||||||
// $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey'];
|
// $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey'];
|
||||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||||
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($settings['is_general']) && !empty($settings['is_general'])){
|
if (isset($settings['is_general']) && ! empty($settings['is_general'])) {
|
||||||
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
} else {
|
} else {
|
||||||
// $opts['appkey'] = $settings[ $key ]['appkey'];
|
// $opts['appkey'] = $settings[ $key ]['appkey'];
|
||||||
|
@ -520,15 +524,15 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $value );
|
UpdraftPlus_Options::update_updraft_option( $key, $value );
|
||||||
} elseif ( 'updraft_s3' === $key ) {
|
} elseif ( 'updraft_s3' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][ $settings_key ]['accesskey'] = $settings[ $key ]['accesskey'];
|
$opts['settings'][ $settings_key ]['accesskey'] = $settings[ $key ]['accesskey'];
|
||||||
$opts['settings'][ $settings_key ]['secretkey'] = $settings[ $key ]['secretkey'];
|
$opts['settings'][ $settings_key ]['secretkey'] = $settings[ $key ]['secretkey'];
|
||||||
$opts['settings'][ $settings_key ]['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
$opts['settings'][ $settings_key ]['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
||||||
if (!empty($opts['settings'][ $settings_key ]['path']) && '/' == substr($opts['settings'][ $settings_key ]['path'], 0, 1)) {
|
if ( ! empty($opts['settings'][ $settings_key ]['path']) && '/' == substr($opts['settings'][ $settings_key ]['path'], 0, 1)) {
|
||||||
$opts['settings'][ $settings_key ]['path'] = substr($opts['settings'][ $settings_key ]['path'], 1);
|
$opts['settings'][ $settings_key ]['path'] = substr($opts['settings'][ $settings_key ]['path'], 1);
|
||||||
}
|
}
|
||||||
if (isset($settings[ $key ]['rrs'])) { // premium settings
|
if (isset($settings[ $key ]['rrs'])) { // premium settings
|
||||||
|
@ -539,7 +543,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$opts['accesskey'] = $settings[ $key ]['accesskey'];
|
$opts['accesskey'] = $settings[ $key ]['accesskey'];
|
||||||
$opts['secretkey'] = $settings[ $key ]['secretkey'];
|
$opts['secretkey'] = $settings[ $key ]['secretkey'];
|
||||||
$opts['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
$opts['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
||||||
if (!empty($opts['path']) && '/' == substr($opts['path'], 0, 1)) {
|
if ( ! empty($opts['path']) && '/' == substr($opts['path'], 0, 1)) {
|
||||||
$opts['path'] = substr($opts['path'], 1);
|
$opts['path'] = substr($opts['path'], 1);
|
||||||
}
|
}
|
||||||
if (isset($settings[ $key ]['rrs'])) { // premium settings
|
if (isset($settings[ $key ]['rrs'])) { // premium settings
|
||||||
|
@ -551,10 +555,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} elseif ( 'updraft_s3generic' === $key ) {
|
} elseif ( 'updraft_s3generic' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3generic' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3generic' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][ $settings_key ]['endpoint'] = $settings[ $key ]['endpoint'];
|
$opts['settings'][ $settings_key ]['endpoint'] = $settings[ $key ]['endpoint'];
|
||||||
$opts['settings'][ $settings_key ]['accesskey'] = $settings[ $key ]['accesskey'];
|
$opts['settings'][ $settings_key ]['accesskey'] = $settings[ $key ]['accesskey'];
|
||||||
|
@ -570,10 +574,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} elseif ( 'updraft_dreamobjects' === $key ) {
|
} elseif ( 'updraft_dreamobjects' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dreamobjects' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dreamobjects' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][ $settings_key ]['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
$opts['settings'][ $settings_key ]['path'] = $this->replace_tokens($settings[ $key ]['path']);
|
||||||
$opts['settings'][ $settings_key ]['endpoint'] = $settings[ $key ]['endpoint'];
|
$opts['settings'][ $settings_key ]['endpoint'] = $settings[ $key ]['endpoint'];
|
||||||
|
@ -584,10 +588,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} elseif ( 'updraft_ftp' === $key ) {
|
} elseif ( 'updraft_ftp' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_ftp' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_ftp' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
if ( isset( $settings[ $key ]['path'] ) ) {
|
if ( isset( $settings[ $key ]['path'] ) ) {
|
||||||
$opts['settings'][ $settings_key ]['host'] = $settings[ $key ]['host'];
|
$opts['settings'][ $settings_key ]['host'] = $settings[ $key ]['host'];
|
||||||
|
@ -609,10 +613,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} elseif ( 'updraft_sftp_settings' === $key ) {
|
} elseif ( 'updraft_sftp_settings' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_sftp' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_sftp' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
if ( isset( $settings[ $key ]['path'] ) ) {
|
if ( isset( $settings[ $key ]['path'] ) ) {
|
||||||
$opts['settings'][ $settings_key ]['host'] = $settings[ $key ]['host'];
|
$opts['settings'][ $settings_key ]['host'] = $settings[ $key ]['host'];
|
||||||
|
@ -637,11 +641,11 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
UpdraftPlus_Options::update_updraft_option( 'updraft_sftp', $opts );
|
UpdraftPlus_Options::update_updraft_option( 'updraft_sftp', $opts );
|
||||||
} elseif ('updraft_webdav_settings' == $key) {
|
} elseif ('updraft_webdav_settings' == $key) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_webdav' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_webdav' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][ $settings_key ]['url'] = $this->replace_tokens( $settings[ $key ]['url'] );
|
$opts['settings'][ $settings_key ]['url'] = $this->replace_tokens( $settings[ $key ]['url'] );
|
||||||
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
|
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
|
||||||
|
@ -649,7 +653,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
} elseif ( 'updraft_backblaze' === $key ) {
|
} elseif ( 'updraft_backblaze' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
|
||||||
if (!is_array($opts)) {
|
if ( ! is_array($opts)) {
|
||||||
$opts = array();
|
$opts = array();
|
||||||
}
|
}
|
||||||
if (is_array($opts) && isset($opts['settings'])) {
|
if (is_array($opts) && isset($opts['settings'])) {
|
||||||
|
@ -673,7 +677,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($settings['do_not_save_remote_settings']) || empty($settings['do_not_save_remote_settings'])) {
|
if ( ! isset($settings['do_not_save_remote_settings']) || empty($settings['do_not_save_remote_settings'])) {
|
||||||
UpdraftPlus_Options::update_updraft_option( 'updraft_service', $settings['updraft_service'] );
|
UpdraftPlus_Options::update_updraft_option( 'updraft_service', $settings['updraft_service'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +728,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
function addons_connect() {
|
function addons_connect() {
|
||||||
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
|
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
|
||||||
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) { require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
|
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) {
|
||||||
|
require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
|
||||||
}
|
}
|
||||||
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
|
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
|
||||||
return array( 'error' => 'NO_PREMIUM' );
|
return array( 'error' => 'NO_PREMIUM' );
|
||||||
|
@ -1163,7 +1168,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$bh = $this->build_historystatus();
|
$bh = $this->build_historystatus();
|
||||||
|
|
||||||
// to fix performance issue
|
// to fix performance issue
|
||||||
if ( $with_hist ) {
|
if ( $with_hist ) {
|
||||||
$out['updraft_historystatus'] = $bh['h'];
|
$out['updraft_historystatus'] = $bh['h'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2609,13 +2614,15 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$updraftplus->get_max_packet_size();
|
$updraftplus->get_max_packet_size();
|
||||||
|
|
||||||
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
|
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
|
||||||
if (!isset($backup['nonce']) || !isset($backup['db'])) { return array( $mess, $warn, $err, $info );
|
if ( ! isset($backup['nonce']) || ! isset($backup['db'])) {
|
||||||
|
return array( $mess, $warn, $err, $info );
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_file = ( is_string($backup['db']) ) ? $updraft_dir . '/' . $backup['db'] : $updraft_dir . '/' . $backup['db'][0];
|
$db_file = ( is_string($backup['db']) ) ? $updraft_dir . '/' . $backup['db'] : $updraft_dir . '/' . $backup['db'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_readable($db_file)) { return array( $mess, $warn, $err, $info );
|
if ( ! is_readable($db_file)) {
|
||||||
|
return array( $mess, $warn, $err, $info );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypted - decrypt it
|
// Encrypted - decrypt it
|
||||||
|
@ -2623,7 +2630,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
$encryption = empty($res['updraft_encryptionphrase']) ? UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase') : $res['updraft_encryptionphrase'];
|
$encryption = empty($res['updraft_encryptionphrase']) ? UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase') : $res['updraft_encryptionphrase'];
|
||||||
|
|
||||||
if (!$encryption) {
|
if ( ! $encryption) {
|
||||||
if (class_exists('UpdraftPlus_Addon_MoreDatabase')) {
|
if (class_exists('UpdraftPlus_Addon_MoreDatabase')) {
|
||||||
$err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
|
$err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2644,14 +2651,14 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
// Even the empty schema when gzipped comes to 1565 bytes; a blank WP 3.6 install at 5158. But we go low, in case someone wants to share single tables.
|
// Even the empty schema when gzipped comes to 1565 bytes; a blank WP 3.6 install at 5158. But we go low, in case someone wants to share single tables.
|
||||||
if (filesize($db_file) < 1000) {
|
if (filesize($db_file) < 1000) {
|
||||||
$err[] = sprintf(__('The database is too small to be a valid WordPress database (size: %s Kb).', 'updraftplus'), round(filesize($db_file)/1024, 1));
|
$err[] = sprintf(__('The database is too small to be a valid WordPress database (size: %s Kb).', 'updraftplus'), round(filesize($db_file) / 1024, 1));
|
||||||
return array( $mess, $warn, $err, $info );
|
return array( $mess, $warn, $err, $info );
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_plain = ( '.gz' == substr($db_file, -3, 3) ) ? false : true;
|
$is_plain = ( '.gz' == substr($db_file, -3, 3) ) ? false : true;
|
||||||
|
|
||||||
$dbhandle = ( $is_plain ) ? fopen($db_file, 'r') : $this->gzopen_for_read($db_file, $warn, $err);
|
$dbhandle = ( $is_plain ) ? fopen($db_file, 'r') : $this->gzopen_for_read($db_file, $warn, $err);
|
||||||
if (!is_resource($dbhandle)) {
|
if ( ! is_resource($dbhandle)) {
|
||||||
$err[] = __('Failed to open database file.', 'updraftplus');
|
$err[] = __('Failed to open database file.', 'updraftplus');
|
||||||
return array( $mess, $warn, $err, $info );
|
return array( $mess, $warn, $err, $info );
|
||||||
}
|
}
|
||||||
|
@ -2699,7 +2706,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$db_collates_found = array();
|
$db_collates_found = array();
|
||||||
$db_supported_charset_related_to_unsupported_collation = false;
|
$db_supported_charset_related_to_unsupported_collation = false;
|
||||||
$db_supported_charsets_related_to_unsupported_collations = array();
|
$db_supported_charsets_related_to_unsupported_collations = array();
|
||||||
while (( ( $is_plain && !feof($dbhandle) ) || ( !$is_plain && !gzeof($dbhandle) ) ) && ( $line<100 || ( !$header_only && count($wanted_tables)>0 ) || ( ( microtime(true) - $charset_scan_start_time ) < $db_charset_collate_scan_timeout && !empty($db_supported_character_sets) ) )) {
|
while (( ( $is_plain && ! feof($dbhandle) ) || ( ! $is_plain && ! gzeof($dbhandle) ) ) && ( $line < 100 || ( ! $header_only && count($wanted_tables) > 0 ) || ( ( microtime(true) - $charset_scan_start_time ) < $db_charset_collate_scan_timeout && ! empty($db_supported_character_sets) ) )) {
|
||||||
$line++;
|
$line++;
|
||||||
// Up to 1MB
|
// Up to 1MB
|
||||||
$buffer = ( $is_plain ) ? rtrim(fgets($dbhandle, 1048576)) : rtrim(gzgets($dbhandle, 1048576));
|
$buffer = ( $is_plain ) ? rtrim(fgets($dbhandle, 1048576)) : rtrim(gzgets($dbhandle, 1048576));
|
||||||
|
@ -2708,10 +2715,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$processing_create = false;
|
$processing_create = false;
|
||||||
if ('' == $old_siteurl && preg_match('/^\# Backup of: (http(.*))$/', $buffer, $matches)) {
|
if ('' == $old_siteurl && preg_match('/^\# Backup of: (http(.*))$/', $buffer, $matches)) {
|
||||||
$old_siteurl = untrailingslashit($matches[1]);
|
$old_siteurl = untrailingslashit($matches[1]);
|
||||||
$mess[] = __('Backup of:', 'updraftplus') . ' ' . htmlspecialchars($old_siteurl) . ( ( !empty($old_wp_version) ) ? ' ' . sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '' );
|
$mess[] = __('Backup of:', 'updraftplus') . ' ' . htmlspecialchars($old_siteurl) . ( ( ! empty($old_wp_version) ) ? ' ' . sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '' );
|
||||||
// Check for should-be migration
|
// Check for should-be migration
|
||||||
if (untrailingslashit(site_url()) != $old_siteurl) {
|
if (untrailingslashit(site_url()) != $old_siteurl) {
|
||||||
if (!$migration_warning) {
|
if ( ! $migration_warning) {
|
||||||
$migration_warning = true;
|
$migration_warning = true;
|
||||||
$info['migration'] = true;
|
$info['migration'] = true;
|
||||||
// && !class_exists('UpdraftPlus_Addons_Migrator')
|
// && !class_exists('UpdraftPlus_Addons_Migrator')
|
||||||
|
@ -2741,7 +2748,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$info['same_url'] = false;
|
$info['same_url'] = false;
|
||||||
$warn[] = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>', $old_siteurl, $res);
|
$warn[] = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>', $old_siteurl, $res);
|
||||||
}
|
}
|
||||||
if (!class_exists('UpdraftPlus_Addons_Migrator')) {
|
if ( ! class_exists('UpdraftPlus_Addons_Migrator')) {
|
||||||
$warn[] .= '<strong><a href="' . apply_filters('updraftplus_com_link', 'https://updraftplus.com/faqs/tell-me-more-about-the-search-and-replace-site-location-in-the-database-option/') . '">' . __('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus') . '</a></strong>';
|
$warn[] .= '<strong><a href="' . apply_filters('updraftplus_com_link', 'https://updraftplus.com/faqs/tell-me-more-about-the-search-and-replace-site-location-in-the-database-option/') . '">' . __('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus') . '</a></strong>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2757,17 +2764,19 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
} elseif ('' == $old_home && preg_match('/^\# Home URL: (http(.*))$/', $buffer, $matches)) {
|
} elseif ('' == $old_home && preg_match('/^\# Home URL: (http(.*))$/', $buffer, $matches)) {
|
||||||
$old_home = untrailingslashit($matches[1]);
|
$old_home = untrailingslashit($matches[1]);
|
||||||
// Check for should-be migration
|
// Check for should-be migration
|
||||||
if (!$migration_warning && home_url() != $old_home) {
|
if ( ! $migration_warning && home_url() != $old_home) {
|
||||||
$migration_warning = true;
|
$migration_warning = true;
|
||||||
$powarn = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>', $old_home, $res);
|
$powarn = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>', $old_home, $res);
|
||||||
if (!empty($powarn)) { $warn[] = $powarn;
|
if ( ! empty($powarn)) {
|
||||||
|
$warn[] = $powarn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
|
} elseif ( ! isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
|
||||||
$info['created_by_version'] = trim($matches[1]);
|
$info['created_by_version'] = trim($matches[1]);
|
||||||
} elseif ('' == $old_wp_version && preg_match('/^\# WordPress Version: ([0-9]+(\.[0-9]+)+)(-[-a-z0-9]+,)?(.*)$/', $buffer, $matches)) {
|
} elseif ('' == $old_wp_version && preg_match('/^\# WordPress Version: ([0-9]+(\.[0-9]+)+)(-[-a-z0-9]+,)?(.*)$/', $buffer, $matches)) {
|
||||||
$old_wp_version = $matches[1];
|
$old_wp_version = $matches[1];
|
||||||
if (!empty($matches[3])) { $old_wp_version .= substr($matches[3], 0, strlen($matches[3])-1);
|
if ( ! empty($matches[3])) {
|
||||||
|
$old_wp_version .= substr($matches[3], 0, strlen($matches[3]) - 1);
|
||||||
}
|
}
|
||||||
if (version_compare($old_wp_version, $wp_version, '>')) {
|
if (version_compare($old_wp_version, $wp_version, '>')) {
|
||||||
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
||||||
|
@ -2791,7 +2800,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
if ('end' == $matches[1]) {
|
if ('end' == $matches[1]) {
|
||||||
$gathering_siteinfo = false;
|
$gathering_siteinfo = false;
|
||||||
// Sanity checks
|
// Sanity checks
|
||||||
if (isset($old_siteinfo['multisite']) && !$old_siteinfo['multisite'] && is_multisite()) {
|
if (isset($old_siteinfo['multisite']) && ! $old_siteinfo['multisite'] && is_multisite()) {
|
||||||
// Just need to check that you're crazy
|
// Just need to check that you're crazy
|
||||||
// if (!defined('UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE') || !UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE) {
|
// if (!defined('UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE') || !UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE) {
|
||||||
// $err[] = sprintf(__('Error: %s', 'updraftplus'), __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus'));
|
// $err[] = sprintf(__('Error: %s', 'updraftplus'), __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus'));
|
||||||
|
@ -2800,11 +2809,11 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$warn[] = __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus') . ' ' . __('It will be imported as a new site.', 'updraftplus') . ' <a href="https://updraftplus.com/information-on-importing-a-single-site-wordpress-backup-into-a-wordpress-network-i-e-multisite/">' . __('Please read this link for important information on this process.', 'updraftplus') . '</a>';
|
$warn[] = __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus') . ' ' . __('It will be imported as a new site.', 'updraftplus') . ' <a href="https://updraftplus.com/information-on-importing-a-single-site-wordpress-backup-into-a-wordpress-network-i-e-multisite/">' . __('Please read this link for important information on this process.', 'updraftplus') . '</a>';
|
||||||
// }
|
// }
|
||||||
// Got the needed code?
|
// Got the needed code?
|
||||||
if (!class_exists('UpdraftPlusAddOn_MultiSite') || !class_exists('UpdraftPlus_Addons_Migrator')) {
|
if ( ! class_exists('UpdraftPlusAddOn_MultiSite') || ! class_exists('UpdraftPlus_Addons_Migrator')) {
|
||||||
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('To import an ordinary WordPress site into a multisite installation requires %s.', 'updraftplus'), 'UpdraftPlus Premium'));
|
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('To import an ordinary WordPress site into a multisite installation requires %s.', 'updraftplus'), 'UpdraftPlus Premium'));
|
||||||
return array( $mess, $warn, $err, $info );
|
return array( $mess, $warn, $err, $info );
|
||||||
}
|
}
|
||||||
} elseif (isset($old_siteinfo['multisite']) && $old_siteinfo['multisite'] && !is_multisite()) {
|
} elseif (isset($old_siteinfo['multisite']) && $old_siteinfo['multisite'] && ! is_multisite()) {
|
||||||
$warn[] = __('Warning:', 'updraftplus') . ' ' . __('Your backup is of a WordPress multisite install; but this site is not. Only the first site of the network will be accessible.', 'updraftplus') . ' <a href="https://codex.wordpress.org/Create_A_Network">' . __('If you want to restore a multisite backup, you should first set up your WordPress installation as a multisite.', 'updraftplus') . '</a>';
|
$warn[] = __('Warning:', 'updraftplus') . ' ' . __('Your backup is of a WordPress multisite install; but this site is not. Only the first site of the network will be accessible.', 'updraftplus') . ' <a href="https://codex.wordpress.org/Create_A_Network">' . __('If you want to restore a multisite backup, you should first set up your WordPress installation as a multisite.', 'updraftplus') . '</a>';
|
||||||
}
|
}
|
||||||
} elseif (preg_match('/^([^=]+)=(.*)$/', $matches[1], $kvmatches)) {
|
} elseif (preg_match('/^([^=]+)=(.*)$/', $matches[1], $kvmatches)) {
|
||||||
|
@ -2812,7 +2821,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$val = $kvmatches[2];
|
$val = $kvmatches[2];
|
||||||
if ('multisite' == $key) {
|
if ('multisite' == $key) {
|
||||||
$info['multisite'] = $val ? true : false;
|
$info['multisite'] = $val ? true : false;
|
||||||
if ($val) { $mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
|
if ($val) {
|
||||||
|
$mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$old_siteinfo[ $key ] = $val;
|
$old_siteinfo[ $key ] = $val;
|
||||||
|
@ -2836,30 +2846,30 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$db_supported_charset_related_to_unsupported_collation = true;
|
$db_supported_charset_related_to_unsupported_collation = true;
|
||||||
}
|
}
|
||||||
} elseif ($processing_create) {
|
} elseif ($processing_create) {
|
||||||
if (!empty($db_supported_collations)) {
|
if ( ! empty($db_supported_collations)) {
|
||||||
if (preg_match('/ COLLATE=([^\s;]+)/i', $buffer, $collate_match)) {
|
if (preg_match('/ COLLATE=([^\s;]+)/i', $buffer, $collate_match)) {
|
||||||
$db_collates_found[] = $collate_match[1];
|
$db_collates_found[] = $collate_match[1];
|
||||||
if (!isset($db_supported_collations[ $collate_match[1] ])) {
|
if ( ! isset($db_supported_collations[ $collate_match[1] ])) {
|
||||||
$db_supported_charset_related_to_unsupported_collation = true;
|
$db_supported_charset_related_to_unsupported_collation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+),/i', $buffer, $collate_match)) {
|
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+),/i', $buffer, $collate_match)) {
|
||||||
$db_collates_found[] = $collate_match[1];
|
$db_collates_found[] = $collate_match[1];
|
||||||
if (!isset($db_supported_collations[ $collate_match[1] ])) {
|
if ( ! isset($db_supported_collations[ $collate_match[1] ])) {
|
||||||
$db_supported_charset_related_to_unsupported_collation = true;
|
$db_supported_charset_related_to_unsupported_collation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+) /i', $buffer, $collate_match)) {
|
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+) /i', $buffer, $collate_match)) {
|
||||||
$db_collates_found[] = $collate_match[1];
|
$db_collates_found[] = $collate_match[1];
|
||||||
if (!isset($db_supported_collations[ $collate_match[1] ])) {
|
if ( ! isset($db_supported_collations[ $collate_match[1] ])) {
|
||||||
$db_supported_charset_related_to_unsupported_collation = true;
|
$db_supported_charset_related_to_unsupported_collation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($db_supported_character_sets)) {
|
if ( ! empty($db_supported_character_sets)) {
|
||||||
if (preg_match('/ CHARSET=([^\s;]+)/i', $buffer, $charset_match)) {
|
if (preg_match('/ CHARSET=([^\s;]+)/i', $buffer, $charset_match)) {
|
||||||
$db_charsets_found[] = $charset_match[1];
|
$db_charsets_found[] = $charset_match[1];
|
||||||
if ($db_supported_charset_related_to_unsupported_collation && !in_array($charset_match[1], $db_supported_charsets_related_to_unsupported_collations)) {
|
if ($db_supported_charset_related_to_unsupported_collation && ! in_array($charset_match[1], $db_supported_charsets_related_to_unsupported_collations)) {
|
||||||
$db_supported_charsets_related_to_unsupported_collations[] = $charset_match[1];
|
$db_supported_charsets_related_to_unsupported_collations[] = $charset_match[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2869,7 +2879,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$db_supported_charset_related_to_unsupported_collation = false;
|
$db_supported_charset_related_to_unsupported_collation = false;
|
||||||
}
|
}
|
||||||
static $mysql_version_warned = false;
|
static $mysql_version_warned = false;
|
||||||
if (!$mysql_version_warned && version_compare($db_version, '5.2.0', '<') && preg_match('/(CHARSET|COLLATE)[= ]utf8mb4/', $buffer)) {
|
if ( ! $mysql_version_warned && version_compare($db_version, '5.2.0', '<') && preg_match('/(CHARSET|COLLATE)[= ]utf8mb4/', $buffer)) {
|
||||||
$mysql_version_warned = true;
|
$mysql_version_warned = true;
|
||||||
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('The database backup uses MySQL features not available in the old MySQL version (%s) that this site is running on.', 'updraftplus'), $db_version) . ' ' . __('You must upgrade MySQL to be able to use this database.', 'updraftplus'));
|
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('The database backup uses MySQL features not available in the old MySQL version (%s) that this site is running on.', 'updraftplus'), $db_version) . ' ' . __('You must upgrade MySQL to be able to use this database.', 'updraftplus'));
|
||||||
}
|
}
|
||||||
|
@ -2880,12 +2890,12 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
} else {
|
} else {
|
||||||
@gzclose($dbhandle);
|
@gzclose($dbhandle);
|
||||||
}
|
}
|
||||||
if (!empty($db_supported_character_sets)) {
|
if ( ! empty($db_supported_character_sets)) {
|
||||||
$db_charsets_found_unique = array_unique($db_charsets_found);
|
$db_charsets_found_unique = array_unique($db_charsets_found);
|
||||||
$db_unsupported_charset = array();
|
$db_unsupported_charset = array();
|
||||||
$db_charset_forbidden = false;
|
$db_charset_forbidden = false;
|
||||||
foreach ($db_charsets_found_unique as $db_charset) {
|
foreach ($db_charsets_found_unique as $db_charset) {
|
||||||
if (!isset($db_supported_character_sets[ $db_charset ])) {
|
if ( ! isset($db_supported_character_sets[ $db_charset ])) {
|
||||||
$db_unsupported_charset[] = $db_charset;
|
$db_unsupported_charset[] = $db_charset;
|
||||||
$db_charset_forbidden = true;
|
$db_charset_forbidden = true;
|
||||||
}
|
}
|
||||||
|
@ -2899,7 +2909,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$row = $GLOBALS['wpdb']->get_row('show variables like "character_set_database"');
|
$row = $GLOBALS['wpdb']->get_row('show variables like "character_set_database"');
|
||||||
$similar_type_charset = ( null !== $row ) ? $row->Value : '';
|
$similar_type_charset = ( null !== $row ) ? $row->Value : '';
|
||||||
}
|
}
|
||||||
if (empty($similar_type_charset) && !empty($db_supported_character_sets[0])) {
|
if (empty($similar_type_charset) && ! empty($db_supported_character_sets[0])) {
|
||||||
$similar_type_charset = $db_supported_character_sets[0];
|
$similar_type_charset = $db_supported_character_sets[0];
|
||||||
}
|
}
|
||||||
$charset_select_html = '<label>' . __('Your chosen character set to use instead:', 'updraftplus') . '</label> ';
|
$charset_select_html = '<label>' . __('Your chosen character set to use instead:', 'updraftplus') . '</label> ';
|
||||||
|
@ -2910,17 +2920,18 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$charset_select_html .= '</select>';
|
$charset_select_html .= '</select>';
|
||||||
if (empty($info['addui'])) { $info['addui'] = '';
|
if (empty($info['addui'])) {
|
||||||
|
$info['addui'] = '';
|
||||||
}
|
}
|
||||||
$info['addui'] .= $charset_select_html;
|
$info['addui'] .= $charset_select_html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($db_supported_collations)) {
|
if ( ! empty($db_supported_collations)) {
|
||||||
$db_collates_found_unique = array_unique($db_collates_found);
|
$db_collates_found_unique = array_unique($db_collates_found);
|
||||||
$db_unsupported_collate = array();
|
$db_unsupported_collate = array();
|
||||||
$db_collate_forbidden = false;
|
$db_collate_forbidden = false;
|
||||||
foreach ($db_collates_found_unique as $db_collate) {
|
foreach ($db_collates_found_unique as $db_collate) {
|
||||||
if (!isset($db_supported_collations[ $db_collate ])) {
|
if ( ! isset($db_supported_collations[ $db_collate ])) {
|
||||||
$db_unsupported_collate[] = $db_collate;
|
$db_unsupported_collate[] = $db_collate;
|
||||||
$db_collate_forbidden = true;
|
$db_collate_forbidden = true;
|
||||||
}
|
}
|
||||||
|
@ -2929,17 +2940,17 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$db_unsupported_collate_unique = array_unique($db_unsupported_collate);
|
$db_unsupported_collate_unique = array_unique($db_unsupported_collate);
|
||||||
$warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the collation (%s) used in the database which you are trying to import.", "The database server that this WordPress site is running on doesn't support multiple collations (%s) used in the database which you are trying to import.", count($db_unsupported_collate_unique), 'updraftplus'), implode(', ', $db_unsupported_collate_unique)) . ' ' . __('You can choose another suitable collation instead and continue with the restoration (at your own risk).', 'updraftplus');
|
$warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the collation (%s) used in the database which you are trying to import.", "The database server that this WordPress site is running on doesn't support multiple collations (%s) used in the database which you are trying to import.", count($db_unsupported_collate_unique), 'updraftplus'), implode(', ', $db_unsupported_collate_unique)) . ' ' . __('You can choose another suitable collation instead and continue with the restoration (at your own risk).', 'updraftplus');
|
||||||
$similar_type_collate = '';
|
$similar_type_collate = '';
|
||||||
if ($db_charset_forbidden && !empty($similar_type_charset)) {
|
if ($db_charset_forbidden && ! empty($similar_type_charset)) {
|
||||||
$similar_type_collate = $updraftplus->get_similar_collate_related_to_charset($db_supported_collations, $db_unsupported_collate_unique, $similar_type_charset);
|
$similar_type_collate = $updraftplus->get_similar_collate_related_to_charset($db_supported_collations, $db_unsupported_collate_unique, $similar_type_charset);
|
||||||
}
|
}
|
||||||
if (empty($similar_type_collate) && !empty($db_supported_charsets_related_to_unsupported_collations)) {
|
if (empty($similar_type_collate) && ! empty($db_supported_charsets_related_to_unsupported_collations)) {
|
||||||
$db_supported_collations_related_to_charset = array();
|
$db_supported_collations_related_to_charset = array();
|
||||||
foreach ($db_supported_collations as $db_supported_collation => $db_supported_collations_info_obj) {
|
foreach ($db_supported_collations as $db_supported_collation => $db_supported_collations_info_obj) {
|
||||||
if (isset($db_supported_collations_info_obj->Charset) && in_array($db_supported_collations_info_obj->Charset, $db_supported_charsets_related_to_unsupported_collations)) {
|
if (isset($db_supported_collations_info_obj->Charset) && in_array($db_supported_collations_info_obj->Charset, $db_supported_charsets_related_to_unsupported_collations)) {
|
||||||
$db_supported_collations_related_to_charset[] = $db_supported_collation;
|
$db_supported_collations_related_to_charset[] = $db_supported_collation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($db_supported_collations_related_to_charset)) {
|
if ( ! empty($db_supported_collations_related_to_charset)) {
|
||||||
$similar_type_collate = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_collate_unique, $db_supported_collations_related_to_charset, false);
|
$similar_type_collate = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_collate_unique, $db_supported_collations_related_to_charset, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2996,13 +3007,14 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
CREATE TABLE $wpdb->sitemeta (
|
CREATE TABLE $wpdb->sitemeta (
|
||||||
CREATE TABLE $wpdb->signups (
|
CREATE TABLE $wpdb->signups (
|
||||||
*/
|
*/
|
||||||
if (!isset($skipped_tables)) { $skipped_tables = array();
|
if ( ! isset($skipped_tables)) {
|
||||||
|
$skipped_tables = array();
|
||||||
}
|
}
|
||||||
$missing_tables = array();
|
$missing_tables = array();
|
||||||
if ($old_table_prefix) {
|
if ($old_table_prefix) {
|
||||||
if (!$header_only) {
|
if ( ! $header_only) {
|
||||||
foreach ($wanted_tables as $table) {
|
foreach ($wanted_tables as $table) {
|
||||||
if (!in_array($old_table_prefix . $table, $tables_found)) {
|
if ( ! in_array($old_table_prefix . $table, $tables_found)) {
|
||||||
$missing_tables[] = $table;
|
$missing_tables[] = $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3013,10 +3025,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($missing_tables)>0) {
|
if (count($missing_tables) > 0) {
|
||||||
$warn[] = sprintf(__('This database backup is missing core WordPress tables: %s', 'updraftplus'), implode(', ', $missing_tables));
|
$warn[] = sprintf(__('This database backup is missing core WordPress tables: %s', 'updraftplus'), implode(', ', $missing_tables));
|
||||||
}
|
}
|
||||||
if (count($skipped_tables)>0) {
|
if (count($skipped_tables) > 0) {
|
||||||
$warn[] = sprintf(__('This database backup has the following WordPress tables excluded: %s', 'updraftplus'), implode(', ', $skipped_tables));
|
$warn[] = sprintf(__('This database backup has the following WordPress tables excluded: %s', 'updraftplus'), implode(', ', $skipped_tables));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3186,9 +3198,11 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
|
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
|
||||||
|
|
||||||
$service_title = '';
|
$service_title = '';
|
||||||
if (!isset($backup['service'])) { $backup['service'] = array();
|
if ( ! isset($backup['service'])) {
|
||||||
|
$backup['service'] = array();
|
||||||
}
|
}
|
||||||
if (!is_array($backup['service'])) { $backup['service'] = array( $backup['service'] );
|
if ( ! is_array($backup['service'])) {
|
||||||
|
$backup['service'] = array( $backup['service'] );
|
||||||
}
|
}
|
||||||
foreach ($backup['service'] as $service) {
|
foreach ($backup['service'] as $service) {
|
||||||
if ('none' === $service || '' === $service || ( is_array($service) && ( empty($service) || array( 'none' ) === $service || array( '' ) === $service ) )) {
|
if ('none' === $service || '' === $service || ( is_array($service) && ( empty($service) || array( 'none' ) === $service || array( '' ) === $service ) )) {
|
||||||
|
@ -3220,7 +3234,8 @@ ENDHERE;
|
||||||
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
|
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
|
||||||
if ( class_exists( 'UpdraftPlus_Encryption')) {
|
if ( class_exists( 'UpdraftPlus_Encryption')) {
|
||||||
if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted')) {
|
if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted')) {
|
||||||
if (UpdraftPlus_Encryption::is_file_encrypted($db)) { $entities .= '/dbcrypted=1/';
|
if (UpdraftPlus_Encryption::is_file_encrypted($db)) {
|
||||||
|
$entities .= '/dbcrypted=1/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) {
|
} elseif ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) {
|
||||||
|
@ -4017,7 +4032,7 @@ ENDHERE;
|
||||||
|
|
||||||
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
||||||
$output = json_encode( $txt );
|
$output = json_encode( $txt );
|
||||||
else:
|
else :
|
||||||
$output = serialize( $txt );
|
$output = serialize( $txt );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
@ -4038,7 +4053,7 @@ ENDHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updraftplus_init() {
|
public function updraftplus_init() {
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4102,7 +4117,7 @@ ENDHERE;
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
|
|
||||||
function vulner_recheck() {
|
function vulner_recheck() {
|
||||||
$result = array();
|
$result = array();
|
||||||
$force = ( isset($_POST['force']) && !empty($_POST['force']) ) ? true : false;
|
$force = ( isset($_POST['force']) && ! empty($_POST['force']) ) ? true : false;
|
||||||
$result['plugin'] = $this->check_plugins($force);
|
$result['plugin'] = $this->check_plugins($force);
|
||||||
$result['wp'] = $this->check_wp($force);
|
$result['wp'] = $this->check_wp($force);
|
||||||
$result['theme'] = $this->check_themes($force);
|
$result['theme'] = $this->check_themes($force);
|
||||||
|
@ -66,15 +66,15 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
$result = array();
|
$result = array();
|
||||||
$active_plugins = get_option('active_plugins');
|
$active_plugins = get_option('active_plugins');
|
||||||
|
|
||||||
if( !empty($active_plugins) ){
|
if ( ! empty($active_plugins) ) {
|
||||||
foreach($active_plugins as $plug){
|
foreach ($active_plugins as $plug) {
|
||||||
|
|
||||||
$plugin_file = WP_CONTENT_DIR . '/plugins/' . $plug;
|
$plugin_file = WP_CONTENT_DIR . '/plugins/' . $plug;
|
||||||
$plugin_info = get_plugin_data($plugin_file);
|
$plugin_info = get_plugin_data($plugin_file);
|
||||||
$plugin_version = isset($plugin_info['Version']) ? $plugin_info['Version'] : '';
|
$plugin_version = isset($plugin_info['Version']) ? $plugin_info['Version'] : '';
|
||||||
$string = explode('/', $plug);
|
$string = explode('/', $plug);
|
||||||
$plug_vuln = get_transient('mainwp_vulnche_trans_plug_' . $string[0]);
|
$plug_vuln = get_transient('mainwp_vulnche_trans_plug_' . $string[0]);
|
||||||
if(false === $plug_vuln || $force) {
|
if (false === $plug_vuln || $force) {
|
||||||
$plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]);
|
$plug_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'plugins/' . $string[0]);
|
||||||
set_transient('mainwp_vulnche_trans_plug_' . $string[0], $plug_vuln, 1 * DAY_IN_SECONDS);
|
set_transient('mainwp_vulnche_trans_plug_' . $string[0], $plug_vuln, 1 * DAY_IN_SECONDS);
|
||||||
}
|
}
|
||||||
|
@ -85,14 +85,14 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
foreach ($plug_vuln as $slug => $pl_data) {
|
foreach ($plug_vuln as $slug => $pl_data) {
|
||||||
if (isset($pl_data['vulnerabilities']) && count($pl_data['vulnerabilities']) > 0) {
|
if (isset($pl_data['vulnerabilities']) && count($pl_data['vulnerabilities']) > 0) {
|
||||||
$plug_vulner_data = array();
|
$plug_vulner_data = array();
|
||||||
foreach($pl_data['vulnerabilities'] as $vuln_data) {
|
foreach ($pl_data['vulnerabilities'] as $vuln_data) {
|
||||||
if ( isset($vuln_data['fixed_in']) && version_compare( $plugin_version, $vuln_data['fixed_in'] ) >= 0 ) {
|
if ( isset($vuln_data['fixed_in']) && version_compare( $plugin_version, $vuln_data['fixed_in'] ) >= 0 ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$plug_vulner_data[] = $vuln_data;
|
$plug_vulner_data[] = $vuln_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($plug_vulner_data) == 0) {
|
if (count($plug_vulner_data) == 0) {
|
||||||
unset($plug_vuln_filter[ $slug ]);
|
unset($plug_vuln_filter[ $slug ]);
|
||||||
} else {
|
} else {
|
||||||
$plug_vuln_filter[ $slug ]['vulnerabilities'] = $plug_vulner_data;
|
$plug_vuln_filter[ $slug ]['vulnerabilities'] = $plug_vulner_data;
|
||||||
|
@ -123,7 +123,7 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
function check_wp( $force = false) {
|
function check_wp( $force = false) {
|
||||||
$wp_vuln = get_transient('mainwp_vulnche_trans_wp_json');
|
$wp_vuln = get_transient('mainwp_vulnche_trans_wp_json');
|
||||||
$wp_version = str_replace('.', '', get_bloginfo('version'));
|
$wp_version = str_replace('.', '', get_bloginfo('version'));
|
||||||
if(false === $wp_vuln || $force) {
|
if (false === $wp_vuln || $force) {
|
||||||
$wp_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'wordpresses/' . $wp_version);
|
$wp_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'wordpresses/' . $wp_version);
|
||||||
set_transient('mainwp_vulnche_trans_wp_json', $wp_vuln, 1 * DAY_IN_SECONDS);
|
set_transient('mainwp_vulnche_trans_wp_json', $wp_vuln, 1 * DAY_IN_SECONDS);
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,9 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
}
|
}
|
||||||
wp_reset_vars( array( 'theme', 'search' ) );
|
wp_reset_vars( array( 'theme', 'search' ) );
|
||||||
$result = array();
|
$result = array();
|
||||||
if(!empty($themes)){
|
if ( ! empty($themes)) {
|
||||||
foreach($themes as $th){
|
foreach ($themes as $th) {
|
||||||
if(empty($th['parent'])) {
|
if (empty($th['parent'])) {
|
||||||
$th_vuln = get_transient('mainwp_vulnche_trans_theme_' . $th['id']);
|
$th_vuln = get_transient('mainwp_vulnche_trans_theme_' . $th['id']);
|
||||||
if (false === $th_vuln || $force) {
|
if (false === $th_vuln || $force) {
|
||||||
$th_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'themes/' . $th['id']);
|
$th_vuln = $this->vulnche_get_content( $this->wpvulndb_api . 'themes/' . $th['id']);
|
||||||
|
@ -158,7 +158,7 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
if (isset($th_data['vulnerabilities']) && count($th_data['vulnerabilities']) > 0) {
|
if (isset($th_data['vulnerabilities']) && count($th_data['vulnerabilities']) > 0) {
|
||||||
|
|
||||||
$th_vulner_data = array();
|
$th_vulner_data = array();
|
||||||
foreach($th_data['vulnerabilities'] as $vuln_data) {
|
foreach ($th_data['vulnerabilities'] as $vuln_data) {
|
||||||
if (empty($vuln_data)) {
|
if (empty($vuln_data)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
$th_vulner_data[] = $vuln_data;
|
$th_vulner_data[] = $vuln_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($th_vulner_data) == 0) {
|
if (count($th_vulner_data) == 0) {
|
||||||
unset($th_vuln_filter[ $slug ]);
|
unset($th_vuln_filter[ $slug ]);
|
||||||
} else {
|
} else {
|
||||||
$th_vuln_filter[ $slug ]['vulnerabilities'] = $th_vulner_data;
|
$th_vuln_filter[ $slug ]['vulnerabilities'] = $th_vulner_data;
|
||||||
|
@ -237,9 +237,9 @@ class MainWP_Child_Vulnerability_Checker {
|
||||||
'Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)',
|
'Mozilla/4.01 (compatible; MSIE 6.0; Windows NT 5.1)',
|
||||||
);
|
);
|
||||||
|
|
||||||
srand( (float) microtime()*1000000);
|
srand( (float) microtime() * 1000000);
|
||||||
|
|
||||||
return $someUA[ rand(0, count($someUA)-1) ];
|
return $someUA[ rand(0, count($someUA) - 1) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class MainWP_Child_WooCommerce_Status {
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
$information = array();
|
$information = array();
|
||||||
if ( ! class_exists( 'WooCommerce' ) || !defined('WC_VERSION')) {
|
if ( ! class_exists( 'WooCommerce' ) || ! defined('WC_VERSION')) {
|
||||||
$information['error'] = 'NO_WOOCOMMERCE';
|
$information['error'] = 'NO_WOOCOMMERCE';
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,7 +590,7 @@ class MainWP_Child_Wordfence {
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
switch($section) {
|
switch ($section) {
|
||||||
case self::OPTIONS_TYPE_GLOBAL:
|
case self::OPTIONS_TYPE_GLOBAL:
|
||||||
$options = $general_opts;
|
$options = $general_opts;
|
||||||
break;
|
break;
|
||||||
|
@ -654,7 +654,8 @@ class MainWP_Child_Wordfence {
|
||||||
|
|
||||||
public function wordfence_init() {
|
public function wordfence_init() {
|
||||||
|
|
||||||
if ( ! $this->is_wordfence_installed ) { return;
|
if ( ! $this->is_wordfence_installed ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
|
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
|
||||||
|
@ -671,9 +672,11 @@ class MainWP_Child_Wordfence {
|
||||||
}
|
}
|
||||||
// ok
|
// ok
|
||||||
public function do_reports_log( $ext = '') {
|
public function do_reports_log( $ext = '') {
|
||||||
if ( $ext !== 'wordfence' ) { return;
|
if ( $ext !== 'wordfence' ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if ( ! $this->is_wordfence_installed ) { return;
|
if ( ! $this->is_wordfence_installed ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -699,7 +702,7 @@ class MainWP_Child_Wordfence {
|
||||||
|
|
||||||
if ($scan_time) {
|
if ($scan_time) {
|
||||||
$message = 'Wordfence scan completed';
|
$message = 'Wordfence scan completed';
|
||||||
foreach($scan_time as $ctime => $details) {
|
foreach ($scan_time as $ctime => $details) {
|
||||||
$sql = sprintf( "SELECT * FROM {$table_wfStatus} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $ctime, $ctime + 100 ); // to get nearest SUM_FINAL msg
|
$sql = sprintf( "SELECT * FROM {$table_wfStatus} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $ctime, $ctime + 100 ); // to get nearest SUM_FINAL msg
|
||||||
$sql .= " 'SUM_FINAL:Scan complete.%';";
|
$sql .= " 'SUM_FINAL:Scan complete.%';";
|
||||||
|
|
||||||
|
@ -887,7 +890,7 @@ SQL
|
||||||
$wfIssues = new wfIssues();
|
$wfIssues = new wfIssues();
|
||||||
$status = $_POST['status'];
|
$status = $_POST['status'];
|
||||||
$issueID = $_POST['id'];
|
$issueID = $_POST['id'];
|
||||||
if(! preg_match('/^(?:new|delete|ignoreP|ignoreC)$/', $status)){
|
if ( ! preg_match('/^(?:new|delete|ignoreP|ignoreC)$/', $status)) {
|
||||||
return array( 'errorMsg' => 'An invalid status was specified when trying to update that issue.' );
|
return array( 'errorMsg' => 'An invalid status was specified when trying to update that issue.' );
|
||||||
}
|
}
|
||||||
$wfIssues->updateIssue($issueID, $status);
|
$wfIssues->updateIssue($issueID, $status);
|
||||||
|
@ -1097,23 +1100,23 @@ SQL
|
||||||
|
|
||||||
function simple_crypt( $key, $data, $action = 'encrypt') {
|
function simple_crypt( $key, $data, $action = 'encrypt') {
|
||||||
$res = '';
|
$res = '';
|
||||||
if($action == 'encrypt'){
|
if ($action == 'encrypt') {
|
||||||
$string = base64_encode( serialize($data) );
|
$string = base64_encode( serialize($data) );
|
||||||
} else {
|
} else {
|
||||||
$string = $data;
|
$string = $data;
|
||||||
}
|
}
|
||||||
for( $i = 0; $i < strlen($string); $i++){
|
for ( $i = 0; $i < strlen($string); $i++) {
|
||||||
$c = ord(substr($string, $i));
|
$c = ord(substr($string, $i));
|
||||||
if($action == 'encrypt'){
|
if ($action == 'encrypt') {
|
||||||
$c += ord(substr($key, ( ( $i + 1 ) % strlen($key) )));
|
$c += ord(substr($key, ( ( $i + 1 ) % strlen($key) )));
|
||||||
$res .= chr($c & 0xFF);
|
$res .= chr($c & 0xFF);
|
||||||
}else{
|
} else {
|
||||||
$c -= ord(substr($key, ( ( $i + 1 ) % strlen($key) )));
|
$c -= ord(substr($key, ( ( $i + 1 ) % strlen($key) )));
|
||||||
$res .= chr(abs($c) & 0xFF);
|
$res .= chr(abs($c) & 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action !== 'encrypt'){
|
if ($action !== 'encrypt') {
|
||||||
$res = unserialize( base64_decode($res) );
|
$res = unserialize( base64_decode($res) );
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
|
@ -1131,7 +1134,7 @@ SQL
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
if ( is_array( $settings ) && count( $settings ) > 0 && count($saving_opts) > 0 ) {
|
if ( is_array( $settings ) && count( $settings ) > 0 && count($saving_opts) > 0 ) {
|
||||||
|
|
||||||
$reload = '';
|
$reload = '';
|
||||||
$opts = $settings;
|
$opts = $settings;
|
||||||
|
@ -1314,7 +1317,7 @@ SQL
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ( !empty( $apiKey ) && $existingAPIKey != $apiKey ) {
|
} elseif ( ! empty( $apiKey ) && $existingAPIKey != $apiKey ) {
|
||||||
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
|
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
|
||||||
try {
|
try {
|
||||||
$res = $api->call('check_api_key', array(), array( 'previousLicense' => $existingAPIKey ));
|
$res = $api->call('check_api_key', array(), array( 'previousLicense' => $existingAPIKey ));
|
||||||
|
@ -1332,7 +1335,7 @@ SQL
|
||||||
wfConfig::set('apiKey', $apiKey);
|
wfConfig::set('apiKey', $apiKey);
|
||||||
wfConfig::set('isPaid', $isPaid); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
wfConfig::set('isPaid', $isPaid); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
||||||
wordfence::licenseStatusChanged();
|
wordfence::licenseStatusChanged();
|
||||||
if (!$isPaid) {
|
if ( ! $isPaid) {
|
||||||
wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE);
|
wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1389,7 +1392,7 @@ SQL
|
||||||
|
|
||||||
wfConfig::set('keyType', $keyType);
|
wfConfig::set('keyType', $keyType);
|
||||||
|
|
||||||
if (!isset($result['apiKey'])) {
|
if ( ! isset($result['apiKey'])) {
|
||||||
$isPaid = ( $keyType == wfAPI::KEY_TYPE_FREE ) ? false : true;
|
$isPaid = ( $keyType == wfAPI::KEY_TYPE_FREE ) ? false : true;
|
||||||
$result['apiKey'] = $apiKey;
|
$result['apiKey'] = $apiKey;
|
||||||
$result['isPaid'] = $isPaid;
|
$result['isPaid'] = $isPaid;
|
||||||
|
@ -1602,15 +1605,12 @@ SQL
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'token' => $res['token'],
|
'token' => $res['token'],
|
||||||
);
|
);
|
||||||
}
|
} elseif ($res['err']) {
|
||||||
elseif ($res['err']) {
|
|
||||||
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $res['err'] );
|
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $res['err'] );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new Exception(__('Invalid response: ', 'wordfence') . var_export($res, true));
|
throw new Exception(__('Invalid response: ', 'wordfence') . var_export($res, true));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $e->getMessage() );
|
return array( 'errorExport' => __('An error occurred: ', 'wordfence') . $e->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1623,7 +1623,7 @@ SQL
|
||||||
if ($res['ok'] && $res['export']) {
|
if ($res['ok'] && $res['export']) {
|
||||||
$totalSet = 0;
|
$totalSet = 0;
|
||||||
$import = @json_decode($res['export'], true);
|
$import = @json_decode($res['export'], true);
|
||||||
if (!is_array($import)) {
|
if ( ! is_array($import)) {
|
||||||
return array( 'errorImport' => __('An error occurred: Invalid options format received.', 'wordfence') );
|
return array( 'errorImport' => __('An error occurred: Invalid options format received.', 'wordfence') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1668,15 +1668,12 @@ SQL
|
||||||
'totalSet' => $totalSet,
|
'totalSet' => $totalSet,
|
||||||
'settings' => $this->get_settings(),
|
'settings' => $this->get_settings(),
|
||||||
);
|
);
|
||||||
}
|
} elseif ($res['err']) {
|
||||||
elseif ($res['err']) {
|
|
||||||
return array( 'errorImport' => 'An error occurred: ' . $res['err'] );
|
return array( 'errorImport' => 'An error occurred: ' . $res['err'] );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new Exception('Invalid response: ' . var_export($res, true));
|
throw new Exception('Invalid response: ' . var_export($res, true));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
return array( 'errorImport' => 'An error occurred: ' . $e->getMessage() );
|
return array( 'errorImport' => 'An error occurred: ' . $e->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1684,7 +1681,7 @@ SQL
|
||||||
function get_settings() {
|
function get_settings() {
|
||||||
$keys = wfConfig::getExportableOptionsKeys();
|
$keys = wfConfig::getExportableOptionsKeys();
|
||||||
$settings = array();
|
$settings = array();
|
||||||
foreach($keys as $key){
|
foreach ($keys as $key) {
|
||||||
$settings[ $key ] = wfConfig::get($key, '');
|
$settings[ $key ] = wfConfig::get($key, '');
|
||||||
}
|
}
|
||||||
$settings['apiKey'] = wfConfig::get('apiKey'); //get more apiKey
|
$settings['apiKey'] = wfConfig::get('apiKey'); //get more apiKey
|
||||||
|
@ -1843,7 +1840,7 @@ SQL
|
||||||
// credit of Wordfence
|
// credit of Wordfence
|
||||||
private static function _getWAFData( $updated = null) {
|
private static function _getWAFData( $updated = null) {
|
||||||
// custom
|
// custom
|
||||||
if(!class_exists('wfWAF')) {
|
if ( ! class_exists('wfWAF')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// end if custom
|
// end if custom
|
||||||
|
@ -1914,17 +1911,17 @@ SQL
|
||||||
|
|
||||||
|
|
||||||
public function saveOptions() {
|
public function saveOptions() {
|
||||||
if (!empty($_POST['changes']) && ( $changes = json_decode(stripslashes($_POST['changes']), true) ) !== false) {
|
if ( ! empty($_POST['changes']) && ( $changes = json_decode(stripslashes($_POST['changes']), true) ) !== false) {
|
||||||
try {
|
try {
|
||||||
if (is_array($changes) && isset($changes['whitelistedURLParams']) && isset($changes['whitelistedURLParams']['add'])) {
|
if (is_array($changes) && isset($changes['whitelistedURLParams']) && isset($changes['whitelistedURLParams']['add'])) {
|
||||||
$user = wp_get_current_user();
|
$user = wp_get_current_user();
|
||||||
foreach($changes['whitelistedURLParams']['add'] as $key => &$value) :
|
foreach ($changes['whitelistedURLParams']['add'] as $key => &$value) :
|
||||||
if (isset($value['data'])) {
|
if (isset($value['data'])) {
|
||||||
|
|
||||||
if(isset($value['data']['userID'])) {
|
if (isset($value['data']['userID'])) {
|
||||||
$value['data']['userID'] = $user->ID;
|
$value['data']['userID'] = $user->ID;
|
||||||
}
|
}
|
||||||
if(isset($value['data']['username'])) {
|
if (isset($value['data']['username'])) {
|
||||||
$value['data']['username'] = $user->user_login;
|
$value['data']['username'] = $user->user_login;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1938,8 +1935,7 @@ SQL
|
||||||
return array(
|
return array(
|
||||||
'error' => sprintf(__('An error occurred while saving the configuration: %s', 'wordfence'), $errors[0]['error']),
|
'error' => sprintf(__('An error occurred while saving the configuration: %s', 'wordfence'), $errors[0]['error']),
|
||||||
);
|
);
|
||||||
}
|
} elseif (count($errors) > 1) {
|
||||||
elseif (count($errors) > 1) {
|
|
||||||
$compoundMessage = array();
|
$compoundMessage = array();
|
||||||
foreach ($errors as $e) {
|
foreach ($errors as $e) {
|
||||||
$compoundMessage[] = $e['error'];
|
$compoundMessage[] = $e['error'];
|
||||||
|
@ -1956,13 +1952,11 @@ SQL
|
||||||
|
|
||||||
wfConfig::save($changes);
|
wfConfig::save($changes);
|
||||||
return array( 'success' => true );
|
return array( 'success' => true );
|
||||||
}
|
} catch (wfWAFStorageFileException $e) {
|
||||||
catch (wfWAFStorageFileException $e) {
|
|
||||||
return array(
|
return array(
|
||||||
'error' => __('An error occurred while saving the configuration.', 'wordfence'),
|
'error' => __('An error occurred while saving the configuration.', 'wordfence'),
|
||||||
);
|
);
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
return array(
|
return array(
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
);
|
);
|
||||||
|
@ -2011,7 +2005,7 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveCountryBlocking() {
|
public static function saveCountryBlocking() {
|
||||||
if(! wfConfig::get('isPaid')){
|
if ( ! wfConfig::get('isPaid')) {
|
||||||
return array( 'error' => 'Sorry but this feature is only available for paid customers.' );
|
return array( 'error' => 'Sorry but this feature is only available for paid customers.' );
|
||||||
}
|
}
|
||||||
$settings = $_POST['settings'];
|
$settings = $_POST['settings'];
|
||||||
|
@ -2073,7 +2067,7 @@ SQL
|
||||||
|
|
||||||
public static function saveCacheConfig() {
|
public static function saveCacheConfig() {
|
||||||
$noEditHtaccess = '1';
|
$noEditHtaccess = '1';
|
||||||
if (isset($_POST['needToCheckFalconHtaccess']) && !empty($_POST['needToCheckFalconHtaccess'])) {
|
if (isset($_POST['needToCheckFalconHtaccess']) && ! empty($_POST['needToCheckFalconHtaccess'])) {
|
||||||
$checkHtaccess = self::checkFalconHtaccess();
|
$checkHtaccess = self::checkFalconHtaccess();
|
||||||
if (isset($checkHtaccess['ok'])) {
|
if (isset($checkHtaccess['ok'])) {
|
||||||
$noEditHtaccess = '0';
|
$noEditHtaccess = '0';
|
||||||
|
@ -2083,48 +2077,48 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheType = $_POST['cacheType'];
|
$cacheType = $_POST['cacheType'];
|
||||||
if($cacheType == 'falcon' || $cacheType == 'php'){
|
if ($cacheType == 'falcon' || $cacheType == 'php') {
|
||||||
$plugins = get_plugins();
|
$plugins = get_plugins();
|
||||||
$badPlugins = array();
|
$badPlugins = array();
|
||||||
foreach($plugins as $pluginFile => $data){
|
foreach ($plugins as $pluginFile => $data) {
|
||||||
if(is_plugin_active($pluginFile)){
|
if (is_plugin_active($pluginFile)) {
|
||||||
if($pluginFile == 'w3-total-cache/w3-total-cache.php'){
|
if ($pluginFile == 'w3-total-cache/w3-total-cache.php') {
|
||||||
$badPlugins[] = 'W3 Total Cache';
|
$badPlugins[] = 'W3 Total Cache';
|
||||||
} elseif($pluginFile == 'quick-cache/quick-cache.php'){
|
} elseif ($pluginFile == 'quick-cache/quick-cache.php') {
|
||||||
$badPlugins[] = 'Quick Cache';
|
$badPlugins[] = 'Quick Cache';
|
||||||
} elseif($pluginFile == 'wp-super-cache/wp-cache.php'){
|
} elseif ($pluginFile == 'wp-super-cache/wp-cache.php') {
|
||||||
$badPlugins[] = 'WP Super Cache';
|
$badPlugins[] = 'WP Super Cache';
|
||||||
} elseif($pluginFile == 'wp-fast-cache/wp-fast-cache.php'){
|
} elseif ($pluginFile == 'wp-fast-cache/wp-fast-cache.php') {
|
||||||
$badPlugins[] = 'WP Fast Cache';
|
$badPlugins[] = 'WP Fast Cache';
|
||||||
} elseif($pluginFile == 'wp-fastest-cache/wpFastestCache.php'){
|
} elseif ($pluginFile == 'wp-fastest-cache/wpFastestCache.php') {
|
||||||
$badPlugins[] = 'WP Fastest Cache';
|
$badPlugins[] = 'WP Fastest Cache';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count($badPlugins) > 0){
|
if (count($badPlugins) > 0) {
|
||||||
return array( 'errorMsg' => 'You can not enable caching in Wordfence with other caching plugins enabled. This may cause conflicts. You need to disable other caching plugins first. Wordfence caching is very fast and does not require other caching plugins to be active. The plugins you have that conflict are: ' . implode(', ', $badPlugins) . '. Disable these plugins, then return to this page and enable Wordfence caching.' );
|
return array( 'errorMsg' => 'You can not enable caching in Wordfence with other caching plugins enabled. This may cause conflicts. You need to disable other caching plugins first. Wordfence caching is very fast and does not require other caching plugins to be active. The plugins you have that conflict are: ' . implode(', ', $badPlugins) . '. Disable these plugins, then return to this page and enable Wordfence caching.' );
|
||||||
}
|
}
|
||||||
$siteURL = site_url();
|
$siteURL = site_url();
|
||||||
if(preg_match('/^https?:\/\/[^\/]+\/[^\/]+\/[^\/]+\/.+/i', $siteURL)){
|
if (preg_match('/^https?:\/\/[^\/]+\/[^\/]+\/[^\/]+\/.+/i', $siteURL)) {
|
||||||
return array( 'errorMsg' => "Wordfence caching currently does not support sites that are installed in a subdirectory and have a home page that is more than 2 directory levels deep. e.g. we don't support sites who's home page is http://example.com/levelOne/levelTwo/levelThree" );
|
return array( 'errorMsg' => "Wordfence caching currently does not support sites that are installed in a subdirectory and have a home page that is more than 2 directory levels deep. e.g. we don't support sites who's home page is http://example.com/levelOne/levelTwo/levelThree" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($cacheType == 'falcon'){
|
if ($cacheType == 'falcon') {
|
||||||
if(! get_option('permalink_structure', '')){
|
if ( ! get_option('permalink_structure', '')) {
|
||||||
return array( 'errorMsg' => 'You need to enable Permalinks for your site to use Falcon Engine. You can enable Permalinks in WordPress by going to the Settings - Permalinks menu and enabling it there. Permalinks change your site URL structure from something that looks like /p=123 to pretty URLs like /my-new-post-today/ that are generally more search engine friendly.' );
|
return array( 'errorMsg' => 'You need to enable Permalinks for your site to use Falcon Engine. You can enable Permalinks in WordPress by going to the Settings - Permalinks menu and enabling it there. Permalinks change your site URL structure from something that looks like /p=123 to pretty URLs like /my-new-post-today/ that are generally more search engine friendly.' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$warnHtaccess = false;
|
$warnHtaccess = false;
|
||||||
if($cacheType == 'disable' || $cacheType == 'php'){
|
if ($cacheType == 'disable' || $cacheType == 'php') {
|
||||||
$removeError = wfCache::addHtaccessCode('remove');
|
$removeError = wfCache::addHtaccessCode('remove');
|
||||||
$removeError2 = wfCache::updateBlockedIPs('remove');
|
$removeError2 = wfCache::updateBlockedIPs('remove');
|
||||||
if($removeError || $removeError2){
|
if ($removeError || $removeError2) {
|
||||||
$warnHtaccess = true;
|
$warnHtaccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($cacheType == 'php' || $cacheType == 'falcon'){
|
if ($cacheType == 'php' || $cacheType == 'falcon') {
|
||||||
$err = wfCache::cacheDirectoryTest();
|
$err = wfCache::cacheDirectoryTest();
|
||||||
if($err){
|
if ($err) {
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'heading' => 'Could not write to cache directory',
|
'heading' => 'Could not write to cache directory',
|
||||||
|
@ -2134,31 +2128,31 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mainly we clear the cache here so that any footer cache diagnostic comments are rebuilt. We could just leave it intact unless caching is being disabled.
|
//Mainly we clear the cache here so that any footer cache diagnostic comments are rebuilt. We could just leave it intact unless caching is being disabled.
|
||||||
if($cacheType != wfConfig::get('cacheType', false)){
|
if ($cacheType != wfConfig::get('cacheType', false)) {
|
||||||
wfCache::scheduleCacheClear();
|
wfCache::scheduleCacheClear();
|
||||||
}
|
}
|
||||||
$htMsg = '';
|
$htMsg = '';
|
||||||
if($warnHtaccess){
|
if ($warnHtaccess) {
|
||||||
$htMsg = " <strong style='color: #F00;'>Warning: We could not remove the caching code from your .htaccess file. you need to remove this manually yourself.</strong> ";
|
$htMsg = " <strong style='color: #F00;'>Warning: We could not remove the caching code from your .htaccess file. you need to remove this manually yourself.</strong> ";
|
||||||
}
|
}
|
||||||
if($cacheType == 'disable'){
|
if ($cacheType == 'disable') {
|
||||||
wfConfig::set('cacheType', false);
|
wfConfig::set('cacheType', false);
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'heading' => 'Caching successfully disabled.',
|
'heading' => 'Caching successfully disabled.',
|
||||||
'body' => "{$htMsg}Caching has been disabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>",
|
'body' => "{$htMsg}Caching has been disabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>",
|
||||||
);
|
);
|
||||||
} elseif($cacheType == 'php'){
|
} elseif ($cacheType == 'php') {
|
||||||
wfConfig::set('cacheType', 'php');
|
wfConfig::set('cacheType', 'php');
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'heading' => 'Wordfence Basic Caching Enabled',
|
'heading' => 'Wordfence Basic Caching Enabled',
|
||||||
'body' => "{$htMsg}Wordfence basic caching has been enabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>",
|
'body' => "{$htMsg}Wordfence basic caching has been enabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>",
|
||||||
);
|
);
|
||||||
} elseif($cacheType == 'falcon'){
|
} elseif ($cacheType == 'falcon') {
|
||||||
if($noEditHtaccess != '1'){
|
if ($noEditHtaccess != '1') {
|
||||||
$err = wfCache::addHtaccessCode('add');
|
$err = wfCache::addHtaccessCode('add');
|
||||||
if($err){
|
if ($err) {
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'heading' => 'Wordfence could not edit .htaccess',
|
'heading' => 'Wordfence could not edit .htaccess',
|
||||||
|
@ -2178,18 +2172,18 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkFalconHtaccess() {
|
public static function checkFalconHtaccess() {
|
||||||
if(wfUtils::isNginx()){
|
if (wfUtils::isNginx()) {
|
||||||
return array( 'nginx' => 1 );
|
return array( 'nginx' => 1 );
|
||||||
}
|
}
|
||||||
$file = wfCache::getHtaccessPath();
|
$file = wfCache::getHtaccessPath();
|
||||||
if(! $file){
|
if ( ! $file) {
|
||||||
return array(
|
return array(
|
||||||
'err' => 'We could not find your .htaccess file to modify it.',
|
'err' => 'We could not find your .htaccess file to modify it.',
|
||||||
'code' => wfCache::getHtaccessCode(),
|
'code' => wfCache::getHtaccessCode(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$fh = @fopen($file, 'r+');
|
$fh = @fopen($file, 'r+');
|
||||||
if(! $fh){
|
if ( ! $fh) {
|
||||||
$err = error_get_last();
|
$err = error_get_last();
|
||||||
return array(
|
return array(
|
||||||
'err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message'],
|
'err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message'],
|
||||||
|
@ -2204,15 +2198,15 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkHtaccess() {
|
public static function checkHtaccess() {
|
||||||
if(wfUtils::isNginx()){
|
if (wfUtils::isNginx()) {
|
||||||
return array( 'nginx' => 1 );
|
return array( 'nginx' => 1 );
|
||||||
}
|
}
|
||||||
$file = wfCache::getHtaccessPath();
|
$file = wfCache::getHtaccessPath();
|
||||||
if(! $file){
|
if ( ! $file) {
|
||||||
return array( 'err' => 'We could not find your .htaccess file to modify it.' );
|
return array( 'err' => 'We could not find your .htaccess file to modify it.' );
|
||||||
}
|
}
|
||||||
$fh = @fopen($file, 'r+');
|
$fh = @fopen($file, 'r+');
|
||||||
if(! $fh){
|
if ( ! $fh) {
|
||||||
$err = error_get_last();
|
$err = error_get_last();
|
||||||
return array( 'err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message'] );
|
return array( 'err' => 'We found your .htaccess file but could not open it for writing: ' . $err['message'] );
|
||||||
}
|
}
|
||||||
|
@ -2242,15 +2236,15 @@ SQL
|
||||||
|
|
||||||
public static function saveCacheOptions() {
|
public static function saveCacheOptions() {
|
||||||
$changed = false;
|
$changed = false;
|
||||||
if($_POST['allowHTTPSCaching'] != wfConfig::get('allowHTTPSCaching', false)){
|
if ($_POST['allowHTTPSCaching'] != wfConfig::get('allowHTTPSCaching', false)) {
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
wfConfig::set('allowHTTPSCaching', $_POST['allowHTTPSCaching'] == '1' ? 1 : 0);
|
wfConfig::set('allowHTTPSCaching', $_POST['allowHTTPSCaching'] == '1' ? 1 : 0);
|
||||||
//wfConfig::set('addCacheComment', $_POST['addCacheComment'] == 1 ? '1' : 0);
|
//wfConfig::set('addCacheComment', $_POST['addCacheComment'] == 1 ? '1' : 0);
|
||||||
wfConfig::set('clearCacheSched', $_POST['clearCacheSched'] == 1 ? '1' : 0);
|
wfConfig::set('clearCacheSched', $_POST['clearCacheSched'] == 1 ? '1' : 0);
|
||||||
if($changed && wfConfig::get('cacheType', false) == 'falcon'){
|
if ($changed && wfConfig::get('cacheType', false) == 'falcon') {
|
||||||
$err = wfCache::addHtaccessCode('add');
|
$err = wfCache::addHtaccessCode('add');
|
||||||
if($err){
|
if ($err) {
|
||||||
return array(
|
return array(
|
||||||
'updateErr' => 'Wordfence could not edit your .htaccess file. The error was: ' . $err,
|
'updateErr' => 'Wordfence could not edit your .htaccess file. The error was: ' . $err,
|
||||||
'code' => wfCache::getHtaccessCode(),
|
'code' => wfCache::getHtaccessCode(),
|
||||||
|
@ -2263,7 +2257,7 @@ SQL
|
||||||
|
|
||||||
public static function clearPageCache() {
|
public static function clearPageCache() {
|
||||||
$stats = wfCache::clearPageCache();
|
$stats = wfCache::clearPageCache();
|
||||||
if($stats['error']){
|
if ($stats['error']) {
|
||||||
$body = 'A total of ' . $stats['totalErrors'] . ' errors occurred while trying to clear your cache. The last error was: ' . $stats['error'];
|
$body = 'A total of ' . $stats['totalErrors'] . ' errors occurred while trying to clear your cache. The last error was: ' . $stats['error'];
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
|
@ -2272,8 +2266,8 @@ SQL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$body = 'A total of ' . $stats['filesDeleted'] . ' files were deleted and ' . $stats['dirsDeleted'] . ' directories were removed. We cleared a total of ' . $stats['totalData'] . 'KB of data in the cache.';
|
$body = 'A total of ' . $stats['filesDeleted'] . ' files were deleted and ' . $stats['dirsDeleted'] . ' directories were removed. We cleared a total of ' . $stats['totalData'] . 'KB of data in the cache.';
|
||||||
if($stats['totalErrors'] > 0){
|
if ($stats['totalErrors'] > 0) {
|
||||||
$body .= ' A total of ' . $stats['totalErrors'] . ' errors were encountered. This probably means that we could not remove some of the files or directories in the cache. Please use your CPanel or file manager to remove the rest of the files in the directory: ' . WP_CONTENT_DIR . '/wfcache/';
|
$body .= ' A total of ' . $stats['totalErrors'] . ' errors were encountered. This probably means that we could not remove some of the files or directories in the cache. Please use your CPanel or file manager to remove the rest of the files in the directory: ' . WP_CONTENT_DIR . '/wfcache/';
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
|
@ -2284,7 +2278,7 @@ SQL
|
||||||
|
|
||||||
public static function getCacheStats() {
|
public static function getCacheStats() {
|
||||||
$s = wfCache::getCacheStats();
|
$s = wfCache::getCacheStats();
|
||||||
if($s['files'] == 0){
|
if ($s['files'] == 0) {
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'heading' => 'Cache Stats',
|
'heading' => 'Cache Stats',
|
||||||
|
@ -2294,26 +2288,26 @@ SQL
|
||||||
$body = 'Total files in cache: ' . $s['files'] .
|
$body = 'Total files in cache: ' . $s['files'] .
|
||||||
'<br />Total directories in cache: ' . $s['dirs'] .
|
'<br />Total directories in cache: ' . $s['dirs'] .
|
||||||
'<br />Total data: ' . $s['data'] . 'KB';
|
'<br />Total data: ' . $s['data'] . 'KB';
|
||||||
if($s['compressedFiles'] > 0){
|
if ($s['compressedFiles'] > 0) {
|
||||||
$body .= '<br />Files: ' . $s['uncompressedFiles'] .
|
$body .= '<br />Files: ' . $s['uncompressedFiles'] .
|
||||||
'<br />Data: ' . $s['uncompressedKBytes'] . 'KB' .
|
'<br />Data: ' . $s['uncompressedKBytes'] . 'KB' .
|
||||||
'<br />Compressed files: ' . $s['compressedFiles'] .
|
'<br />Compressed files: ' . $s['compressedFiles'] .
|
||||||
'<br />Compressed data: ' . $s['compressedKBytes'] . 'KB';
|
'<br />Compressed data: ' . $s['compressedKBytes'] . 'KB';
|
||||||
}
|
}
|
||||||
if($s['largestFile'] > 0){
|
if ($s['largestFile'] > 0) {
|
||||||
$body .= '<br />Largest file: ' . $s['largestFile'] . 'KB';
|
$body .= '<br />Largest file: ' . $s['largestFile'] . 'KB';
|
||||||
}
|
}
|
||||||
if($s['oldestFile'] !== false){
|
if ($s['oldestFile'] !== false) {
|
||||||
$body .= '<br />Oldest file in cache created ';
|
$body .= '<br />Oldest file in cache created ';
|
||||||
if(time() - $s['oldestFile'] < 300){
|
if (time() - $s['oldestFile'] < 300) {
|
||||||
$body .= ( time() - $s['oldestFile'] ) . ' seconds ago';
|
$body .= ( time() - $s['oldestFile'] ) . ' seconds ago';
|
||||||
} else {
|
} else {
|
||||||
$body .= human_time_diff($s['oldestFile']) . ' ago.';
|
$body .= human_time_diff($s['oldestFile']) . ' ago.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($s['newestFile'] !== false){
|
if ($s['newestFile'] !== false) {
|
||||||
$body .= '<br />Newest file in cache created ';
|
$body .= '<br />Newest file in cache created ';
|
||||||
if(time() - $s['newestFile'] < 300){
|
if (time() - $s['newestFile'] < 300) {
|
||||||
$body .= ( time() - $s['newestFile'] ) . ' seconds ago';
|
$body .= ( time() - $s['newestFile'] ) . ' seconds ago';
|
||||||
} else {
|
} else {
|
||||||
$body .= human_time_diff($s['newestFile']) . ' ago.';
|
$body .= human_time_diff($s['newestFile']) . ' ago.';
|
||||||
|
@ -2329,7 +2323,7 @@ SQL
|
||||||
|
|
||||||
public static function addCacheExclusion() {
|
public static function addCacheExclusion() {
|
||||||
$ex = wfConfig::get('cacheExclusions', false);
|
$ex = wfConfig::get('cacheExclusions', false);
|
||||||
if($ex){
|
if ($ex) {
|
||||||
$ex = unserialize($ex);
|
$ex = unserialize($ex);
|
||||||
} else {
|
} else {
|
||||||
$ex = array();
|
$ex = array();
|
||||||
|
@ -2345,8 +2339,8 @@ SQL
|
||||||
}
|
}
|
||||||
wfConfig::set('cacheExclusions', serialize($ex));
|
wfConfig::set('cacheExclusions', serialize($ex));
|
||||||
wfCache::scheduleCacheClear();
|
wfCache::scheduleCacheClear();
|
||||||
if(wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $_POST['patternType'])){
|
if (wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $_POST['patternType'])) {
|
||||||
if(wfCache::addHtaccessCode('add')){ //rewrites htaccess rules
|
if (wfCache::addHtaccessCode('add')) { //rewrites htaccess rules
|
||||||
return array(
|
return array(
|
||||||
'errorMsg' => 'We added the rule you requested but could not modify your .htaccess file. Please delete this rule, check the permissions on your .htaccess file and then try again.',
|
'errorMsg' => 'We added the rule you requested but could not modify your .htaccess file. Please delete this rule, check the permissions on your .htaccess file and then try again.',
|
||||||
'ex' => $ex,
|
'ex' => $ex,
|
||||||
|
@ -2361,7 +2355,7 @@ SQL
|
||||||
|
|
||||||
public static function loadCacheExclusions() {
|
public static function loadCacheExclusions() {
|
||||||
$ex = wfConfig::get('cacheExclusions', false);
|
$ex = wfConfig::get('cacheExclusions', false);
|
||||||
if(! $ex){
|
if ( ! $ex) {
|
||||||
return array( 'ex' => false );
|
return array( 'ex' => false );
|
||||||
}
|
}
|
||||||
$ex = unserialize($ex);
|
$ex = unserialize($ex);
|
||||||
|
@ -2374,15 +2368,15 @@ SQL
|
||||||
public static function removeCacheExclusion() {
|
public static function removeCacheExclusion() {
|
||||||
$id = $_POST['id'];
|
$id = $_POST['id'];
|
||||||
$ex = wfConfig::get('cacheExclusions', false);
|
$ex = wfConfig::get('cacheExclusions', false);
|
||||||
if(! $ex){
|
if ( ! $ex) {
|
||||||
return array( 'ok' => 1 );
|
return array( 'ok' => 1 );
|
||||||
}
|
}
|
||||||
$ex = unserialize($ex);
|
$ex = unserialize($ex);
|
||||||
$rewriteHtaccess = false;
|
$rewriteHtaccess = false;
|
||||||
$removed = false;
|
$removed = false;
|
||||||
for($i = 0; $i < sizeof($ex); $i++){
|
for ($i = 0; $i < sizeof($ex); $i++) {
|
||||||
if( (string) $ex[ $i ]['id'] == (string) $id){
|
if ( (string) $ex[ $i ]['id'] == (string) $id) {
|
||||||
if(wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $ex[ $i ]['pt'])){
|
if (wfConfig::get('cacheType', false) == 'falcon' && preg_match('/^(?:uac|uaeq|cc)$/', $ex[ $i ]['pt'])) {
|
||||||
$rewriteHtaccess = true;
|
$rewriteHtaccess = true;
|
||||||
}
|
}
|
||||||
array_splice($ex, $i, 1);
|
array_splice($ex, $i, 1);
|
||||||
|
@ -2391,13 +2385,13 @@ SQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return = array( 'ex' => $ex );
|
$return = array( 'ex' => $ex );
|
||||||
if (!$removed) {
|
if ( ! $removed) {
|
||||||
$return['error'] = 'Not found the cache exclusion.';
|
$return['error'] = 'Not found the cache exclusion.';
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wfConfig::set('cacheExclusions', serialize($ex));
|
wfConfig::set('cacheExclusions', serialize($ex));
|
||||||
if($rewriteHtaccess && wfCache::addHtaccessCode('add')){ //rewrites htaccess rules
|
if ($rewriteHtaccess && wfCache::addHtaccessCode('add')) { //rewrites htaccess rules
|
||||||
$return['errorMsg'] = "We removed that rule but could not rewrite your .htaccess file. You're going to have to manually remove this rule from your .htaccess file. Please reload this page now.";
|
$return['errorMsg'] = "We removed that rule but could not rewrite your .htaccess file. You're going to have to manually remove this rule from your .htaccess file. Please reload this page now.";
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -2427,17 +2421,17 @@ SQL
|
||||||
|
|
||||||
<form id="wfConfigForm" style="overflow-x: auto;">
|
<form id="wfConfigForm" style="overflow-x: auto;">
|
||||||
<?php
|
<?php
|
||||||
foreach ($diagnostic->getResults() as $title => $tests):
|
foreach ($diagnostic->getResults() as $title => $tests) :
|
||||||
$key = sanitize_key('wf-diagnostics-' . $title);
|
$key = sanitize_key('wf-diagnostics-' . $title);
|
||||||
$hasFailingTest = false;
|
$hasFailingTest = false;
|
||||||
foreach ($tests['results'] as $result) {
|
foreach ($tests['results'] as $result) {
|
||||||
if (!$result['test']) {
|
if ( ! $result['test']) {
|
||||||
$hasFailingTest = true;
|
$hasFailingTest = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inEmail):
|
if ($inEmail) :
|
||||||
?>
|
?>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -2446,7 +2440,7 @@ SQL
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($tests['results'] as $result): ?>
|
<?php foreach ($tests['results'] as $result) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 75%;"
|
<td style="width: 75%;"
|
||||||
colspan="<?php echo $cols - 1; ?>">
|
colspan="<?php echo $cols - 1; ?>">
|
||||||
|
@ -2460,9 +2454,9 @@ SQL
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($result['test']): ?>
|
<?php if ($result['test']) : ?>
|
||||||
<div class="wf-result-success"><?php echo esc_html($result['message']); ?></div>
|
<div class="wf-result-success"><?php echo esc_html($result['message']); ?></div>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<div class="wf-result-error"><?php echo esc_html($result['message']); ?></div>
|
<div class="wf-result-error"><?php echo esc_html($result['message']); ?></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -2470,7 +2464,7 @@ SQL
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<div class="wf-block
|
<div class="wf-block
|
||||||
<?php
|
<?php
|
||||||
echo ( wfPersistenceController::shared()->isActive($key) ? ' wf-active' : '' ) .
|
echo ( wfPersistenceController::shared()->isActive($key) ? ' wf-active' : '' ) .
|
||||||
|
@ -2490,7 +2484,7 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix">
|
<div class="wf-block-content wf-clearfix">
|
||||||
<ul class="wf-block-list">
|
<ul class="wf-block-list">
|
||||||
<?php foreach ($tests['results'] as $result): ?>
|
<?php foreach ($tests['results'] as $result) : ?>
|
||||||
<li>
|
<li>
|
||||||
<div style="width: 75%;"
|
<div style="width: 75%;"
|
||||||
colspan="<?php echo $cols - 1; ?>">
|
colspan="<?php echo $cols - 1; ?>">
|
||||||
|
@ -2503,9 +2497,9 @@ SQL
|
||||||
))
|
))
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($result['test']): ?>
|
<?php if ($result['test']) : ?>
|
||||||
<div class="wf-result-success"><?php echo esc_html($result['message']); ?></div>
|
<div class="wf-result-success"><?php echo esc_html($result['message']); ?></div>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<div class="wf-result-error"><?php echo esc_html($result['message']); ?></div>
|
<div class="wf-result-error"><?php echo esc_html($result['message']); ?></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</li>
|
</li>
|
||||||
|
@ -2526,7 +2520,7 @@ SQL
|
||||||
'HTTP_X_REAL_IP' => 'X-Real-IP',
|
'HTTP_X_REAL_IP' => 'X-Real-IP',
|
||||||
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
|
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
|
||||||
) as $variable => $label) {
|
) as $variable => $label) {
|
||||||
if (!( $currentServerVarForIP && $currentServerVarForIP === $variable ) && $howGet === $variable) {
|
if ( ! ( $currentServerVarForIP && $currentServerVarForIP === $variable ) && $howGet === $variable) {
|
||||||
$howGetHasErrors = true;
|
$howGetHasErrors = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2546,7 +2540,7 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
|
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody class="thead">
|
<tbody class="thead">
|
||||||
<tr>
|
<tr>
|
||||||
<th>IPs</th>
|
<th>IPs</th>
|
||||||
|
@ -2563,13 +2557,13 @@ SQL
|
||||||
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
|
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
|
||||||
'HTTP_X_REAL_IP' => 'X-Real-IP',
|
'HTTP_X_REAL_IP' => 'X-Real-IP',
|
||||||
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
|
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
|
||||||
) as $variable => $label):
|
) as $variable => $label) :
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $label; ?></td>
|
<td><?php echo $label; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if (!array_key_exists($variable, $_SERVER)) {
|
if ( ! array_key_exists($variable, $_SERVER)) {
|
||||||
echo '(not set)';
|
echo '(not set)';
|
||||||
} else {
|
} else {
|
||||||
if (strpos($_SERVER[ $variable ], ',') !== false) {
|
if (strpos($_SERVER[ $variable ], ',') !== false) {
|
||||||
|
@ -2580,7 +2574,7 @@ SQL
|
||||||
$markedSelectedAddress = false;
|
$markedSelectedAddress = false;
|
||||||
foreach ($items as $index => $i) {
|
foreach ($items as $index => $i) {
|
||||||
foreach ($trustedProxies as $proxy) {
|
foreach ($trustedProxies as $proxy) {
|
||||||
if (!empty($proxy)) {
|
if ( ! empty($proxy)) {
|
||||||
if (wfUtils::subnetContainsIP($proxy, $i) && $index < count($items) - 1) {
|
if (wfUtils::subnetContainsIP($proxy, $i) && $index < count($items) - 1) {
|
||||||
$output = esc_html($i) . ', ' . $output;
|
$output = esc_html($i) . ', ' . $output;
|
||||||
continue 2;
|
continue 2;
|
||||||
|
@ -2588,7 +2582,7 @@ SQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$markedSelectedAddress) {
|
if ( ! $markedSelectedAddress) {
|
||||||
$output = '<strong>' . esc_html($i) . '</strong>, ' . $output;
|
$output = '<strong>' . esc_html($i) . '</strong>, ' . $output;
|
||||||
$markedSelectedAddress = true;
|
$markedSelectedAddress = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2603,11 +2597,11 @@ SQL
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<?php if ($currentServerVarForIP && $currentServerVarForIP === $variable): ?>
|
<?php if ($currentServerVarForIP && $currentServerVarForIP === $variable) : ?>
|
||||||
<td class="wf-result-success">In use</td>
|
<td class="wf-result-success">In use</td>
|
||||||
<?php elseif ($howGet === $variable): ?>
|
<?php elseif ($howGet === $variable) : ?>
|
||||||
<td class="wf-result-error">Configured, but not valid</td>
|
<td class="wf-result-error">Configured, but not valid</td>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<td></td>
|
<td></td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2631,7 +2625,7 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
require ABSPATH . 'wp-includes/version.php';
|
require ABSPATH . 'wp-includes/version.php';
|
||||||
|
@ -2785,7 +2779,7 @@ SQL
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($wordPressValues as $settingName => $settingData):
|
foreach ($wordPressValues as $settingName => $settingData) :
|
||||||
$escapedName = esc_html($settingName);
|
$escapedName = esc_html($settingName);
|
||||||
$escapedDescription = '';
|
$escapedDescription = '';
|
||||||
$escapedValue = '(not set)';
|
$escapedValue = '(not set)';
|
||||||
|
@ -2825,21 +2819,21 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($plugins as $plugin => $pluginData): ?>
|
<?php foreach ($plugins as $plugin => $pluginData) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo $cols - 1; ?>">
|
<td colspan="<?php echo $cols - 1; ?>">
|
||||||
<strong><?php echo esc_html($pluginData['Name']); ?></strong>
|
<strong><?php echo esc_html($pluginData['Name']); ?></strong>
|
||||||
<?php if (!empty($pluginData['Version'])): ?>
|
<?php if ( ! empty($pluginData['Version'])) : ?>
|
||||||
- Version <?php echo esc_html($pluginData['Version']); ?>
|
- Version <?php echo esc_html($pluginData['Version']); ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
<?php if (array_key_exists(trailingslashit(WP_PLUGIN_DIR) . $plugin, $activeNetworkPlugins)): ?>
|
<?php if (array_key_exists(trailingslashit(WP_PLUGIN_DIR) . $plugin, $activeNetworkPlugins)) : ?>
|
||||||
<td class="wf-result-success">Network Activated</td>
|
<td class="wf-result-success">Network Activated</td>
|
||||||
<?php elseif (array_key_exists($plugin, $activePlugins)): ?>
|
<?php elseif (array_key_exists($plugin, $activePlugins)) : ?>
|
||||||
<td class="wf-result-success">Active</td>
|
<td class="wf-result-success">Active</td>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<td class="wf-result-inactive">Inactive</td>
|
<td class="wf-result-inactive">Inactive</td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2861,14 +2855,14 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<?php if (!empty($muPlugins)): ?>
|
<?php if ( ! empty($muPlugins)) : ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($muPlugins as $plugin => $pluginData): ?>
|
<?php foreach ($muPlugins as $plugin => $pluginData) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo $cols - 1; ?>">
|
<td colspan="<?php echo $cols - 1; ?>">
|
||||||
<strong><?php echo esc_html($pluginData['Name']); ?></strong>
|
<strong><?php echo esc_html($pluginData['Name']); ?></strong>
|
||||||
<?php if (!empty($pluginData['Version'])): ?>
|
<?php if ( ! empty($pluginData['Version'])) : ?>
|
||||||
- Version <?php echo esc_html($pluginData['Version']); ?>
|
- Version <?php echo esc_html($pluginData['Version']); ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -2876,7 +2870,7 @@ SQL
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo $cols; ?>">No MU-Plugins</td>
|
<td colspan="<?php echo $cols; ?>">No MU-Plugins</td>
|
||||||
|
@ -2900,23 +2894,23 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<?php if (!empty($themes)): ?>
|
<?php if ( ! empty($themes)) : ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($themes as $theme => $themeData): ?>
|
<?php foreach ($themes as $theme => $themeData) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo $cols - 1; ?>">
|
<td colspan="<?php echo $cols - 1; ?>">
|
||||||
<strong><?php echo esc_html($themeData['Name']); ?></strong>
|
<strong><?php echo esc_html($themeData['Name']); ?></strong>
|
||||||
Version <?php echo esc_html($themeData['Version']); ?></td>
|
Version <?php echo esc_html($themeData['Version']); ?></td>
|
||||||
<?php if ($currentTheme instanceof WP_Theme && $theme === $currentTheme->get_stylesheet()): ?>
|
<?php if ($currentTheme instanceof WP_Theme && $theme === $currentTheme->get_stylesheet()) : ?>
|
||||||
<td class="wf-result-success">Active</td>
|
<td class="wf-result-success">Active</td>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<td class="wf-result-inactive">Inactive</td>
|
<td class="wf-result-inactive">Inactive</td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<?php else: ?>
|
<?php else : ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo $cols; ?>">No Themes</td>
|
<td colspan="<?php echo $cols; ?>">No Themes</td>
|
||||||
|
@ -2940,7 +2934,7 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$cron = _get_cron_array();
|
$cron = _get_cron_array();
|
||||||
|
@ -2976,7 +2970,7 @@ SQL
|
||||||
}
|
}
|
||||||
unset($t);
|
unset($t);
|
||||||
$q = $wfdb->querySelect('SHOW TABLE STATUS WHERE Name IN (' . implode(',', $tables) . ')');
|
$q = $wfdb->querySelect('SHOW TABLE STATUS WHERE Name IN (' . implode(',', $tables) . ')');
|
||||||
if ($q):
|
if ($q) :
|
||||||
$databaseCols = count($q[0]);
|
$databaseCols = count($q[0]);
|
||||||
?>
|
?>
|
||||||
<div class="wf-block<?php echo( wfPersistenceController::shared()->isActive('wf-diagnostics-database-tables') ? ' wf-active' : '' ); ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-database-tables'); ?>">
|
<div class="wf-block<?php echo( wfPersistenceController::shared()->isActive('wf-diagnostics-database-tables') ? ' wf-active' : '' ); ?>" data-persistence-key="<?php echo esc_attr('wf-diagnostics-database-tables'); ?>">
|
||||||
|
@ -2993,13 +2987,13 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<div style="max-width: 100%; overflow: auto; padding: 1px;">
|
<div style="max-width: 100%; overflow: auto; padding: 1px;">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody class="thead thead-subhead" style="font-size: 85%">
|
<tbody class="thead thead-subhead" style="font-size: 85%">
|
||||||
<?php
|
<?php
|
||||||
$val = wfUtils::array_first($q);
|
$val = wfUtils::array_first($q);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach ($val as $tkey => $tval): ?>
|
<?php foreach ($val as $tkey => $tval) : ?>
|
||||||
<th><?php echo esc_html($tkey); ?></th>
|
<th><?php echo esc_html($tkey); ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -3010,7 +3004,7 @@ SQL
|
||||||
foreach ($q as $val) {
|
foreach ($q as $val) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach ($val as $tkey => $tval): ?>
|
<?php foreach ($val as $tkey => $tval) : ?>
|
||||||
<td><?php echo esc_html($tval); ?></td>
|
<td><?php echo esc_html($tval); ?></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -3048,7 +3042,7 @@ SQL
|
||||||
</div>
|
</div>
|
||||||
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
<div class="wf-block-content wf-clearfix wf-padding-no-left wf-padding-no-right">
|
||||||
<div style="max-width: 100%; overflow: auto; padding: 1px;">
|
<div style="max-width: 100%; overflow: auto; padding: 1px;">
|
||||||
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
|
<table class="wf-striped-table"<?php echo ! empty($inEmail) ? ' border=1' : ''; ?>>
|
||||||
<tbody class="thead thead-subhead" style="font-size: 85%">
|
<tbody class="thead thead-subhead" style="font-size: 85%">
|
||||||
<tr>
|
<tr>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
|
@ -3058,14 +3052,14 @@ SQL
|
||||||
<tbody style="font-size: 85%">
|
<tbody style="font-size: 85%">
|
||||||
<?php
|
<?php
|
||||||
$errorLogs = wfErrorLogHandler::getErrorLogs();
|
$errorLogs = wfErrorLogHandler::getErrorLogs();
|
||||||
if (count($errorLogs) < 1):
|
if (count($errorLogs) < 1) :
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><em>No log files found.</em></td>
|
<td colspan="2"><em>No log files found.</em></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
else:
|
else :
|
||||||
foreach ($errorLogs as $log => $readable):
|
foreach ($errorLogs as $log => $readable) :
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 100%"><?php echo esc_html($log) . ' (' . wfUtils::formatBytes(filesize($log)) . ')'; ?></td>
|
<td style="width: 100%"><?php echo esc_html($log) . ' (' . wfUtils::formatBytes(filesize($log)) . ')'; ?></td>
|
||||||
|
|
|
@ -99,7 +99,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
'deferred_js_files' => array(),
|
'deferred_js_files' => array(),
|
||||||
'lazyload' => 0,
|
'lazyload' => 0,
|
||||||
'lazyload_iframes' => 0,
|
'lazyload_iframes' => 0,
|
||||||
'lazyload_youtube' =>0,
|
'lazyload_youtube' => 0,
|
||||||
'minify_css' => 0,
|
'minify_css' => 0,
|
||||||
// 'minify_css_key' => $minify_css_key,
|
// 'minify_css_key' => $minify_css_key,
|
||||||
'minify_concatenate_css' => 0,
|
'minify_concatenate_css' => 0,
|
||||||
|
@ -137,10 +137,10 @@ class MainWP_Child_WP_Rocket {
|
||||||
// ok
|
// ok
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
||||||
try{
|
try {
|
||||||
$data = array( 'rocket_boxes' => get_user_meta( $GLOBALS['current_user']->ID, 'rocket_boxes', true ) );
|
$data = array( 'rocket_boxes' => get_user_meta( $GLOBALS['current_user']->ID, 'rocket_boxes', true ) );
|
||||||
$information['syncWPRocketData'] = $data;
|
$information['syncWPRocketData'] = $data;
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $information;
|
return $information;
|
||||||
|
@ -192,7 +192,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MainWP_Helper::is_screen_with_update()) {
|
if ( ! MainWP_Helper::is_screen_with_update()) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
$information = $this->do_admin_post_rocket_purge_opcache();
|
$information = $this->do_admin_post_rocket_purge_opcache();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
$information = array( 'error' => $e->getMessage() );
|
$information = array( 'error' => $e->getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
rocket_clean_cache_busting();
|
rocket_clean_cache_busting();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'rocket_dismiss_boxes' ) && defined('WP_ROCKET_ADMIN_PATH')) {
|
if ( ! function_exists( 'rocket_dismiss_boxes' ) && defined('WP_ROCKET_ADMIN_PATH')) {
|
||||||
require_once WP_ROCKET_ADMIN_PATH . 'admin.php';
|
require_once WP_ROCKET_ADMIN_PATH . 'admin.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
|
|
||||||
update_option( WP_ROCKET_SLUG, $options );
|
update_option( WP_ROCKET_SLUG, $options );
|
||||||
|
|
||||||
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
if (isset($_POST['do_database_optimization']) && ! empty($_POST['do_database_optimization'])) {
|
||||||
$this->optimize_database();
|
$this->optimize_database();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
|
|
||||||
$items = array_filter( array_keys( $optimization->get_options() ), array( $options, 'get' ) );
|
$items = array_filter( array_keys( $optimization->get_options() ), array( $options, 'get' ) );
|
||||||
|
|
||||||
if ( !empty( $items ) ) {
|
if ( ! empty( $items ) ) {
|
||||||
$optimization->process_handler( $items );
|
$optimization->process_handler( $items );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ class MainWP_Child_WPvivid_BackupRestore {
|
||||||
public $is_plugin_installed = false;
|
public $is_plugin_installed = false;
|
||||||
public $public_intetface;
|
public $public_intetface;
|
||||||
static function Instance() {
|
static function Instance() {
|
||||||
if ( null === self::$instance )
|
if ( null === self::$instance ) {
|
||||||
{
|
|
||||||
self::$instance = new MainWP_Child_WPvivid_BackupRestore();
|
self::$instance = new MainWP_Child_WPvivid_BackupRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +15,11 @@ class MainWP_Child_WPvivid_BackupRestore {
|
||||||
|
|
||||||
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( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR'))
|
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR')) {
|
||||||
{
|
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->is_plugin_installed) {
|
if ( ! $this->is_plugin_installed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,19 +31,18 @@ class MainWP_Child_WPvivid_BackupRestore {
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncOthersData( $information, $data = array() ) {
|
function syncOthersData( $information, $data = array() ) {
|
||||||
try{
|
try {
|
||||||
|
|
||||||
if ( isset( $data['syncWPvividData'] ))
|
if ( isset( $data['syncWPvividData'] )) {
|
||||||
{
|
$information['syncWPvividData'] = 1;
|
||||||
$information['syncWPvividData']=1;
|
|
||||||
$data = WPvivid_Setting::get_sync_data();
|
$data = WPvivid_Setting::get_sync_data();
|
||||||
$information['syncWPvividSettingData']=$data['setting'];
|
$information['syncWPvividSettingData'] = $data['setting'];
|
||||||
$information['syncWPvividRemoteData']=$data['remote'];
|
$information['syncWPvividRemoteData'] = $data['remote'];
|
||||||
$information['syncWPvividScheduleData']=$data['schedule'];
|
$information['syncWPvividScheduleData'] = $data['schedule'];
|
||||||
$information['syncWPvividSetting'] = $data;
|
$information['syncWPvividSetting'] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,14 +51,12 @@ class MainWP_Child_WPvivid_BackupRestore {
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
$information = array();
|
$information = array();
|
||||||
if ( ! $this->is_plugin_installed )
|
if ( ! $this->is_plugin_installed ) {
|
||||||
{
|
|
||||||
$information['error'] = 'NO_WPVIVIDBACKUP';
|
$information['error'] = 'NO_WPVIVIDBACKUP';
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['mwp_action'] ) )
|
if ( isset( $_POST['mwp_action'] ) ) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
switch ($_POST['mwp_action']) {
|
switch ($_POST['mwp_action']) {
|
||||||
case 'prepare_backup':
|
case 'prepare_backup':
|
||||||
|
@ -139,7 +134,7 @@ class MainWP_Child_WPvivid_BackupRestore {
|
||||||
public function post_mainwp_data( $data) {
|
public function post_mainwp_data( $data) {
|
||||||
global $wpvivid_plugin;
|
global $wpvivid_plugin;
|
||||||
|
|
||||||
$ret =$wpvivid_plugin->wpvivid_handle_mainwp_action($data);
|
$ret = $wpvivid_plugin->wpvivid_handle_mainwp_action($data);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ class MainWP_Child {
|
||||||
'time_capsule' => 'time_capsule',
|
'time_capsule' => 'time_capsule',
|
||||||
'extra_excution' => 'extra_execution', // deprecated
|
'extra_excution' => 'extra_execution', // deprecated
|
||||||
'extra_execution' => 'extra_execution',
|
'extra_execution' => 'extra_execution',
|
||||||
'wpvivid_backuprestore' =>'wpvivid_backuprestore',
|
'wpvivid_backuprestore' => 'wpvivid_backuprestore',
|
||||||
);
|
);
|
||||||
|
|
||||||
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
||||||
|
@ -212,8 +212,9 @@ class MainWP_Child {
|
||||||
$this->update();
|
$this->update();
|
||||||
$this->load_all_options();
|
$this->load_all_options();
|
||||||
$this->filterFunction = function( $a) {
|
$this->filterFunction = function( $a) {
|
||||||
if ($a == null) { return false; }
|
if ($a == null) {
|
||||||
if (is_object($a) && property_exists($a, 'last_checked') && !property_exists($a, 'checked')) {
|
return false; }
|
||||||
|
if (is_object($a) && property_exists($a, 'last_checked') && ! property_exists($a, 'checked')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $a;
|
return $a;
|
||||||
|
@ -270,19 +271,19 @@ class MainWP_Child {
|
||||||
function load_all_options() {
|
function load_all_options() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
|
if ( ! defined( 'WP_INSTALLING' ) || ! is_multisite() ) {
|
||||||
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
||||||
} else {
|
} else {
|
||||||
$alloptions = false;
|
$alloptions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
|
if ( ! defined( 'WP_INSTALLING' ) || ! is_multisite() ) {
|
||||||
$notoptions = wp_cache_get( 'notoptions', 'options' );
|
$notoptions = wp_cache_get( 'notoptions', 'options' );
|
||||||
} else {
|
} else {
|
||||||
$notoptions = false;
|
$notoptions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset($alloptions['mainwp_db_version']) ) {
|
if ( ! isset($alloptions['mainwp_db_version']) ) {
|
||||||
$suppress = $wpdb->suppress_errors();
|
$suppress = $wpdb->suppress_errors();
|
||||||
$options = array(
|
$options = array(
|
||||||
'mainwp_child_auth',
|
'mainwp_child_auth',
|
||||||
|
@ -328,7 +329,8 @@ class MainWP_Child {
|
||||||
|
|
||||||
$alloptions_db = $wpdb->get_results( $query );
|
$alloptions_db = $wpdb->get_results( $query );
|
||||||
$wpdb->suppress_errors($suppress);
|
$wpdb->suppress_errors($suppress);
|
||||||
if ( !is_array( $alloptions ) ) { $alloptions = array();
|
if ( ! is_array( $alloptions ) ) {
|
||||||
|
$alloptions = array();
|
||||||
}
|
}
|
||||||
if ( is_array( $alloptions_db ) ) {
|
if ( is_array( $alloptions_db ) ) {
|
||||||
foreach ( (array) $alloptions_db as $o ) {
|
foreach ( (array) $alloptions_db as $o ) {
|
||||||
|
@ -475,7 +477,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($update_version) && version_compare($update_version, '1.4', '<=' ) ) { // 3.5.4
|
if ( ! empty($update_version) && version_compare($update_version, '1.4', '<=' ) ) { // 3.5.4
|
||||||
if ( ! is_array( get_option( 'mainwp_child_branding_settings' ) ) ) {
|
if ( ! is_array( get_option( 'mainwp_child_branding_settings' ) ) ) {
|
||||||
// to fix: reduce number of options
|
// to fix: reduce number of options
|
||||||
$brandingOptions = array(
|
$brandingOptions = array(
|
||||||
|
@ -594,7 +596,7 @@ class MainWP_Child {
|
||||||
$type = isset($_GET['_request_update_premiums_type']) ? $_GET['_request_update_premiums_type'] : '';
|
$type = isset($_GET['_request_update_premiums_type']) ? $_GET['_request_update_premiums_type'] : '';
|
||||||
if ( $type == 'plugin' || $type == 'theme' ) {
|
if ( $type == 'plugin' || $type == 'theme' ) {
|
||||||
$list = isset( $_GET['list'] ) ? $_GET['list'] : '';
|
$list = isset( $_GET['list'] ) ? $_GET['list'] : '';
|
||||||
if ( !empty($list) ) {
|
if ( ! empty($list) ) {
|
||||||
// to call function upgradePluginTheme(),
|
// to call function upgradePluginTheme(),
|
||||||
// will not get the response result
|
// will not get the response result
|
||||||
$_POST['type'] = $type;
|
$_POST['type'] = $type;
|
||||||
|
@ -701,7 +703,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
$remove_all_child_menu = false;
|
$remove_all_child_menu = false;
|
||||||
if ( isset($branding_opts['remove_setting']) && isset($branding_opts['remove_restore']) && isset($branding_opts['remove_server_info']) && $branding_opts['remove_setting'] && $branding_opts['remove_restore'] && $branding_opts['remove_server_info'] ) {
|
if ( isset($branding_opts['remove_setting']) && isset($branding_opts['remove_restore']) && isset($branding_opts['remove_server_info']) && $branding_opts['remove_setting'] && $branding_opts['remove_restore'] && $branding_opts['remove_server_info'] ) {
|
||||||
$remove_all_child_menu = true;
|
$remove_all_child_menu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,12 +732,12 @@ class MainWP_Child {
|
||||||
|
|
||||||
$all_subpages = apply_filters( 'mainwp-child-init-subpages', array() );
|
$all_subpages = apply_filters( 'mainwp-child-init-subpages', array() );
|
||||||
|
|
||||||
if ( !is_array( $all_subpages ) ) {
|
if ( ! is_array( $all_subpages ) ) {
|
||||||
$all_subpages = array();
|
$all_subpages = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !self::$subPagesLoaded ) {
|
if ( ! self::$subPagesLoaded ) {
|
||||||
foreach( $all_subpages as $page ) {
|
foreach ( $all_subpages as $page ) {
|
||||||
$slug = isset( $page['slug'] ) ? $page['slug'] : '';
|
$slug = isset( $page['slug'] ) ? $page['slug'] : '';
|
||||||
if ( empty( $slug ) ) {
|
if ( empty( $slug ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -745,10 +747,10 @@ class MainWP_Child {
|
||||||
$subpage['title'] = $page['title'];
|
$subpage['title'] = $page['title'];
|
||||||
$subpage['page'] = 'mainwp-' . str_replace( ' ', '-', strtolower( str_replace( '-', ' ', $slug ) ) );
|
$subpage['page'] = 'mainwp-' . str_replace( ' ', '-', strtolower( str_replace( '-', ' ', $slug ) ) );
|
||||||
if ( isset( $page['callback'] ) ) {
|
if ( isset( $page['callback'] ) ) {
|
||||||
$subpage['callback'] = $page['callback'];
|
$subpage['callback'] = $page['callback'];
|
||||||
$created_page = add_submenu_page( 'options-general.php', $subpage['title'], '<div class="mainwp-hidden">' . $subpage['title'] . '</div>', 'manage_options', $subpage['page'], $subpage['callback'] );
|
$created_page = add_submenu_page( 'options-general.php', $subpage['title'], '<div class="mainwp-hidden">' . $subpage['title'] . '</div>', 'manage_options', $subpage['page'], $subpage['callback'] );
|
||||||
if ( isset( $page['load_callback'] ) ) {
|
if ( isset( $page['load_callback'] ) ) {
|
||||||
$subpage['load_callback'] = $page['load_callback'];
|
$subpage['load_callback'] = $page['load_callback'];
|
||||||
add_action( 'load-' . $created_page, $subpage['load_callback'] );
|
add_action( 'load-' . $created_page, $subpage['load_callback'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,32 +783,32 @@ class MainWP_Child {
|
||||||
|
|
||||||
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
||||||
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
||||||
$hide_server_info = isset( $branding_opts['remove_server_info'] ) && $branding_opts['remove_server_info'] ? true : false;
|
$hide_server_info = isset( $branding_opts['remove_server_info'] ) && $branding_opts['remove_server_info'] ? true : false;
|
||||||
$hide_connection_detail = isset( $branding_opts['remove_connection_detail'] ) && $branding_opts['remove_connection_detail'] ? true : false;
|
$hide_connection_detail = isset( $branding_opts['remove_connection_detail'] ) && $branding_opts['remove_connection_detail'] ? true : false;
|
||||||
|
|
||||||
$hide_style = 'style="display:none"';
|
$hide_style = 'style="display:none"';
|
||||||
|
|
||||||
if ($shownPage == '') {
|
if ($shownPage == '') {
|
||||||
if (!$hide_settings ) {
|
if ( ! $hide_settings ) {
|
||||||
$shownPage = 'settings';
|
$shownPage = 'settings';
|
||||||
} elseif (!$hide_restore) {
|
} elseif ( ! $hide_restore) {
|
||||||
$shownPage = 'restore-clone';
|
$shownPage = 'restore-clone';
|
||||||
} elseif (!$hide_server_info) {
|
} elseif ( ! $hide_server_info) {
|
||||||
$shownPage = 'server-info';
|
$shownPage = 'server-info';
|
||||||
} elseif (!$hide_connection_detail) {
|
} elseif ( ! $hide_connection_detail) {
|
||||||
$shownPage = 'connection-detail';
|
$shownPage = 'connection-detail';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::render_header($shownPage, false);
|
self::render_header($shownPage, false);
|
||||||
?>
|
?>
|
||||||
<?php if (!$hide_settings ) { ?>
|
<?php if ( ! $hide_settings ) { ?>
|
||||||
<div class="mainwp-child-setting-tab settings" <?php echo ( 'settings' !== $shownPage ) ? $hide_style : ''; ?>>
|
<div class="mainwp-child-setting-tab settings" <?php echo ( 'settings' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||||
<?php $this->settings(); ?>
|
<?php $this->settings(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ( !$hide_restore ) { ?>
|
<?php if ( ! $hide_restore ) { ?>
|
||||||
<div class="mainwp-child-setting-tab restore-clone" <?php echo ( 'restore-clone' !== $shownPage ) ? $hide_style : ''; ?>>
|
<div class="mainwp-child-setting-tab restore-clone" <?php echo ( 'restore-clone' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||||
<?php
|
<?php
|
||||||
if ( '' === session_id() ) {
|
if ( '' === session_id() ) {
|
||||||
|
@ -827,14 +829,14 @@ class MainWP_Child {
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ( !$hide_server_info ) { ?>
|
<?php if ( ! $hide_server_info ) { ?>
|
||||||
<div class="mainwp-child-setting-tab server-info" <?php echo ( 'server-info' !== $shownPage ) ? $hide_style : ''; ?>>
|
<div class="mainwp-child-setting-tab server-info" <?php echo ( 'server-info' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||||
<?php MainWP_Child_Server_Information::renderPage(); ?>
|
<?php MainWP_Child_Server_Information::renderPage(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ( !$hide_connection_detail ) { ?>
|
<?php if ( ! $hide_connection_detail ) { ?>
|
||||||
<div class="mainwp-child-setting-tab connection-detail" <?php echo ( 'connection-detail' !== $shownPage ) ? $hide_style : ''; ?>>
|
<div class="mainwp-child-setting-tab connection-detail" <?php echo ( 'connection-detail' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||||
<?php MainWP_Child_Server_Information::renderConnectionDetails(); ?>
|
<?php MainWP_Child_Server_Information::renderConnectionDetails(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -856,7 +858,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
|
|
||||||
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
||||||
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
||||||
$hide_server_info = isset( $branding_opts['remove_server_info'] ) && $branding_opts['remove_server_info'] ? true : false;
|
$hide_server_info = isset( $branding_opts['remove_server_info'] ) && $branding_opts['remove_server_info'] ? true : false;
|
||||||
$hide_connection_detail = isset( $branding_opts['remove_connection_detail'] ) && $branding_opts['remove_connection_detail'] ? true : false;
|
$hide_connection_detail = isset( $branding_opts['remove_connection_detail'] ) && $branding_opts['remove_connection_detail'] ? true : false;
|
||||||
|
@ -920,26 +922,51 @@ class MainWP_Child {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><i class="fa fa-file"></i> <?php echo ( self::$brandingTitle === null ? 'MainWP Child' : self::$brandingTitle ); ?></h2>
|
<h2><i class="fa fa-file"></i> <?php echo ( self::$brandingTitle === null ? 'MainWP Child' : self::$brandingTitle ); ?></h2>
|
||||||
<div style="clear: both;"></div><br/>
|
<div style="clear: both;"></div><br/>
|
||||||
<div class="mainwp-tabs" id="mainwp-tabs">
|
<div class="mainwp-tabs" id="mainwp-tabs">
|
||||||
<?php if ( !$hide_settings ) { ?>
|
<?php if ( ! $hide_settings ) { ?>
|
||||||
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'settings' ) { echo 'nav-tab-active'; } ?>" tab-slug="settings" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=settings' : '#'; ?>" style="margin-left: 0 !important;"><?php _e( 'Settings', 'mainwp-child' ); ?></a>
|
<a class="nav-tab pos-nav-tab
|
||||||
|
<?php
|
||||||
|
if ( $shownPage === 'settings' ) {
|
||||||
|
echo 'nav-tab-active'; }
|
||||||
|
?>
|
||||||
|
" tab-slug="settings" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=settings' : '#'; ?>" style="margin-left: 0 !important;"><?php _e( 'Settings', 'mainwp-child' ); ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( !$hide_restore ) { ?>
|
<?php if ( ! $hide_restore ) { ?>
|
||||||
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'restore-clone' ) { echo 'nav-tab-active'; } ?>" tab-slug="restore-clone" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=restore-clone' : '#'; ?>"><?php echo ( 0 !== (int) $sitesToClone ) ? __( 'Restore / Clone', 'mainwp-child' ) : __( 'Restore', 'mainwp-child' ); ?></a>
|
<a class="nav-tab pos-nav-tab
|
||||||
|
<?php
|
||||||
|
if ( $shownPage === 'restore-clone' ) {
|
||||||
|
echo 'nav-tab-active'; }
|
||||||
|
?>
|
||||||
|
" tab-slug="restore-clone" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=restore-clone' : '#'; ?>"><?php echo ( 0 !== (int) $sitesToClone ) ? __( 'Restore / Clone', 'mainwp-child' ) : __( 'Restore', 'mainwp-child' ); ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (!$hide_server_info ) { ?>
|
<?php if ( ! $hide_server_info ) { ?>
|
||||||
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'server-info' ) { echo 'nav-tab-active'; } ?>" tab-slug="server-info" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=server-info' : '#'; ?>"><?php _e( 'Server information', 'mainwp-child' ); ?></a>
|
<a class="nav-tab pos-nav-tab
|
||||||
|
<?php
|
||||||
|
if ( $shownPage === 'server-info' ) {
|
||||||
|
echo 'nav-tab-active'; }
|
||||||
|
?>
|
||||||
|
" tab-slug="server-info" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=server-info' : '#'; ?>"><?php _e( 'Server information', 'mainwp-child' ); ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (!$hide_connection_detail ) { ?>
|
<?php if ( ! $hide_connection_detail ) { ?>
|
||||||
<a class="nav-tab pos-nav-tab <?php if ( $shownPage === 'connection-detail' ) { echo 'nav-tab-active'; } ?>" tab-slug="connection-detail" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=connection-detail' : '#'; ?>"><?php _e( 'Connection Details', 'mainwp-child' ); ?></a>
|
<a class="nav-tab pos-nav-tab
|
||||||
|
<?php
|
||||||
|
if ( $shownPage === 'connection-detail' ) {
|
||||||
|
echo 'nav-tab-active'; }
|
||||||
|
?>
|
||||||
|
" tab-slug="connection-detail" href="<?php echo $subpage ? 'options-general.php?page=mainwp_child_tab&tab=connection-detail' : '#'; ?>"><?php _e( 'Connection Details', 'mainwp-child' ); ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
|
if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
|
||||||
foreach ( self::$subPages as $subPage ) {
|
foreach ( self::$subPages as $subPage ) {
|
||||||
?>
|
?>
|
||||||
<a class="nav-tab pos-nav-tab <?php if ( $shownPage == $subPage['slug'] ) { echo 'nav-tab-active'; } ?>" tab-slug="<?php echo esc_attr($subPage['slug']); ?>" href="options-general.php?page=<?php echo rawurlencode($subPage['page']); ?>"><?php echo esc_html($subPage['title']); ?></a>
|
<a class="nav-tab pos-nav-tab
|
||||||
|
<?php
|
||||||
|
if ( $shownPage == $subPage['slug'] ) {
|
||||||
|
echo 'nav-tab-active'; }
|
||||||
|
?>
|
||||||
|
" tab-slug="<?php echo esc_attr($subPage['slug']); ?>" href="options-general.php?page=<?php echo rawurlencode($subPage['page']); ?>"><?php echo esc_html($subPage['title']); ?></a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1029,7 +1056,12 @@ class MainWP_Child {
|
||||||
<div style="margin: 1em 0 4em 0;">
|
<div style="margin: 1em 0 4em 0;">
|
||||||
<input name="requireUniqueSecurityId"
|
<input name="requireUniqueSecurityId"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="requireUniqueSecurityId" <?php if ( '' != get_option( 'mainwp_child_uniqueId' ) ) { echo 'checked'; } ?> />
|
id="requireUniqueSecurityId"
|
||||||
|
<?php
|
||||||
|
if ( '' != get_option( 'mainwp_child_uniqueId' ) ) {
|
||||||
|
echo 'checked'; }
|
||||||
|
?>
|
||||||
|
/>
|
||||||
<label for="requireUniqueSecurityId"
|
<label for="requireUniqueSecurityId"
|
||||||
style="font-size: 15px;"><?php esc_html_e( 'Require unique security ID', 'mainwp-child' ); ?></label>
|
style="font-size: 15px;"><?php esc_html_e( 'Require unique security ID', 'mainwp-child' ); ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1083,7 +1115,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_htaccess( $hard = false ) {
|
function update_htaccess( $hard = false ) {
|
||||||
if ( !$hard && defined( 'DOING_CRON' ) && DOING_CRON ) {
|
if ( ! $hard && defined( 'DOING_CRON' ) && DOING_CRON ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1169,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
$user = null;
|
$user = null;
|
||||||
|
|
||||||
if ( isset( $_POST['alt_user'] ) && !empty( $_POST['alt_user'] ) ) {
|
if ( isset( $_POST['alt_user'] ) && ! empty( $_POST['alt_user'] ) ) {
|
||||||
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
||||||
$auth_user = $_POST['alt_user'];
|
$auth_user = $_POST['alt_user'];
|
||||||
$user = get_user_by( 'login', $auth_user );
|
$user = get_user_by( 'login', $auth_user );
|
||||||
|
@ -1329,7 +1361,7 @@ class MainWP_Child {
|
||||||
$alter_login_required = false;
|
$alter_login_required = false;
|
||||||
$username = rawurldecode( $_REQUEST['user'] );
|
$username = rawurldecode( $_REQUEST['user'] );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['alt_user'] ) && !empty( $_REQUEST['alt_user'] ) ) {
|
if ( isset( $_REQUEST['alt_user'] ) && ! empty( $_REQUEST['alt_user'] ) ) {
|
||||||
$alter_login_required = $this->check_login_as( $_REQUEST['alt_user'] );
|
$alter_login_required = $this->check_login_as( $_REQUEST['alt_user'] );
|
||||||
|
|
||||||
if ( $alter_login_required ) {
|
if ( $alter_login_required ) {
|
||||||
|
@ -1461,7 +1493,7 @@ class MainWP_Child {
|
||||||
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
||||||
|
|
||||||
$user = null;
|
$user = null;
|
||||||
if ( isset( $_POST['alt_user'] ) && !empty( $_POST['alt_user'] ) ) {
|
if ( isset( $_POST['alt_user'] ) && ! empty( $_POST['alt_user'] ) ) {
|
||||||
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
||||||
$auth_user = $_POST['alt_user'];
|
$auth_user = $_POST['alt_user'];
|
||||||
$user = get_user_by( 'login', $auth_user );
|
$user = get_user_by( 'login', $auth_user );
|
||||||
|
@ -1542,7 +1574,7 @@ class MainWP_Child {
|
||||||
define( 'DOING_CRON', true );
|
define( 'DOING_CRON', true );
|
||||||
self::fix_for_custom_themes();
|
self::fix_for_custom_themes();
|
||||||
call_user_func( array( $this, $this->callableFunctionsNoAuth[ $_POST['function'] ] ) );
|
call_user_func( array( $this, $this->callableFunctionsNoAuth[ $_POST['function'] ] ) );
|
||||||
} elseif (isset( $_POST['function'] ) && isset( $_POST['mainwpsignature'] ) && !isset($this->callableFunctions[ $_POST['function'] ]) && !isset( $this->callableFunctionsNoAuth[ $_POST['function'] ]) ) {
|
} elseif (isset( $_POST['function'] ) && isset( $_POST['mainwpsignature'] ) && ! isset($this->callableFunctions[ $_POST['function'] ]) && ! isset( $this->callableFunctionsNoAuth[ $_POST['function'] ]) ) {
|
||||||
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,7 +1595,7 @@ class MainWP_Child {
|
||||||
// return true will try to login as alternative user
|
// return true will try to login as alternative user
|
||||||
function check_login_as( $alter_login ) {
|
function check_login_as( $alter_login ) {
|
||||||
|
|
||||||
if ( !empty( $alter_login ) ) {
|
if ( ! empty( $alter_login ) ) {
|
||||||
// check alternative admin existed
|
// check alternative admin existed
|
||||||
$user = get_user_by( 'login', $alter_login );
|
$user = get_user_by( 'login', $alter_login );
|
||||||
|
|
||||||
|
@ -1624,7 +1656,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
// to fix issue multi user session
|
// to fix issue multi user session
|
||||||
$user_id = wp_validate_auth_cookie();
|
$user_id = wp_validate_auth_cookie();
|
||||||
if ( $user_id && $user_id === $current_user->ID ) {
|
if ( $user_id && $user_id === $current_user->ID ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1659,7 +1691,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
public function http_request_reject_unsafe_urls( $r, $url ) {
|
public function http_request_reject_unsafe_urls( $r, $url ) {
|
||||||
$r['reject_unsafe_urls'] = false;
|
$r['reject_unsafe_urls'] = false;
|
||||||
if ( isset($_POST['wpadmin_user']) && !empty($_POST['wpadmin_user']) && isset($_POST['wpadmin_passwd']) && !empty($_POST['wpadmin_passwd']) ) {
|
if ( isset($_POST['wpadmin_user']) && ! empty($_POST['wpadmin_user']) && isset($_POST['wpadmin_passwd']) && ! empty($_POST['wpadmin_passwd']) ) {
|
||||||
$auth = base64_encode( $_POST['wpadmin_user'] . ':' . $_POST['wpadmin_passwd'] );
|
$auth = base64_encode( $_POST['wpadmin_user'] . ':' . $_POST['wpadmin_passwd'] );
|
||||||
$r['headers']['Authorization'] = "Basic $auth";
|
$r['headers']['Authorization'] = "Basic $auth";
|
||||||
}
|
}
|
||||||
|
@ -1959,7 +1991,7 @@ class MainWP_Child {
|
||||||
*/
|
*/
|
||||||
function upgradePluginTheme() {
|
function upgradePluginTheme() {
|
||||||
//Prevent disable/re-enable at upgrade
|
//Prevent disable/re-enable at upgrade
|
||||||
if (!defined( 'DOING_CRON') ) {
|
if ( ! defined( 'DOING_CRON') ) {
|
||||||
define( 'DOING_CRON', true );
|
define( 'DOING_CRON', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2061,10 +2093,10 @@ class MainWP_Child {
|
||||||
// try to fix if that is premiums update
|
// try to fix if that is premiums update
|
||||||
$api = apply_filters( 'plugins_api', false, 'plugin_information', array( 'slug' => $plugin ) );
|
$api = apply_filters( 'plugins_api', false, 'plugin_information', array( 'slug' => $plugin ) );
|
||||||
|
|
||||||
if ( !is_wp_error( $api ) && !empty($api)) {
|
if ( ! is_wp_error( $api ) && ! empty($api)) {
|
||||||
if ( isset($api->download_link) ) {
|
if ( isset($api->download_link) ) {
|
||||||
$res = $upgrader->install($api->download_link);
|
$res = $upgrader->install($api->download_link);
|
||||||
if ( !is_wp_error( $res ) && !( is_null( $res ) ) ) {
|
if ( ! is_wp_error( $res ) && ! ( is_null( $res ) ) ) {
|
||||||
$information['upgrades'][ $plugin ] = true;
|
$information['upgrades'][ $plugin ] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2328,8 +2360,8 @@ class MainWP_Child {
|
||||||
$pre = false;
|
$pre = false;
|
||||||
$cached_update_info = get_site_transient( 'mainwp_update_plugins_cached' );
|
$cached_update_info = get_site_transient( 'mainwp_update_plugins_cached' );
|
||||||
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
||||||
foreach( $cached_update_info as $slug => $info ) {
|
foreach ( $cached_update_info as $slug => $info ) {
|
||||||
if ( !isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
if ( ! isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
||||||
$_transient_data->response[ $slug ] = $info->update;
|
$_transient_data->response[ $slug ] = $info->update;
|
||||||
$pre = true;
|
$pre = true;
|
||||||
}
|
}
|
||||||
|
@ -2352,8 +2384,8 @@ class MainWP_Child {
|
||||||
$pre = false;
|
$pre = false;
|
||||||
$cached_update_info = get_site_transient( 'mainwp_update_themes_cached' );
|
$cached_update_info = get_site_transient( 'mainwp_update_themes_cached' );
|
||||||
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
||||||
foreach( $cached_update_info as $slug => $info ) {
|
foreach ( $cached_update_info as $slug => $info ) {
|
||||||
if ( !isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
if ( ! isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
||||||
$_transient_data->response[ $slug ] = $info->update;
|
$_transient_data->response[ $slug ] = $info->update;
|
||||||
$pre = true;
|
$pre = true;
|
||||||
}
|
}
|
||||||
|
@ -2427,7 +2459,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check SSL Requirement
|
//Check SSL Requirement
|
||||||
if ( !MainWP_Helper::isSSLEnabled() && ( !defined( 'MAINWP_ALLOW_NOSSL_CONNECT' ) || !MAINWP_ALLOW_NOSSL_CONNECT ) ) {
|
if ( ! MainWP_Helper::isSSLEnabled() && ( ! defined( 'MAINWP_ALLOW_NOSSL_CONNECT' ) || ! MAINWP_ALLOW_NOSSL_CONNECT ) ) {
|
||||||
MainWP_Helper::error( __( 'SSL is required on the child site to set up a secure connection.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'SSL is required on the child site to set up a secure connection.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2474,7 +2506,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
$others = array();
|
$others = array();
|
||||||
if ( isset( $_POST['featured_image_data'] ) && !empty($_POST['featured_image_data'])) {
|
if ( isset( $_POST['featured_image_data'] ) && ! empty($_POST['featured_image_data'])) {
|
||||||
$others['featured_image_data'] = unserialize(base64_decode( $_POST['featured_image_data'] ));
|
$others['featured_image_data'] = unserialize(base64_decode( $_POST['featured_image_data'] ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2604,7 +2636,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
if ( is_array($galleries) && isset($galleries['ids']) ) {
|
if ( is_array($galleries) && isset($galleries['ids']) ) {
|
||||||
$attached_images = explode( ',', $galleries['ids'] );
|
$attached_images = explode( ',', $galleries['ids'] );
|
||||||
foreach( $attached_images as $attachment_id ) {
|
foreach ( $attached_images as $attachment_id ) {
|
||||||
$attachment = get_post( $attachment_id );
|
$attachment = get_post( $attachment_id );
|
||||||
if ( $attachment ) {
|
if ( $attachment ) {
|
||||||
$post_gallery_images[] = array(
|
$post_gallery_images[] = array(
|
||||||
|
@ -2692,7 +2724,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
if ( is_array($galleries) && isset($galleries['ids']) ) {
|
if ( is_array($galleries) && isset($galleries['ids']) ) {
|
||||||
$attached_images = explode( ',', $galleries['ids'] );
|
$attached_images = explode( ',', $galleries['ids'] );
|
||||||
foreach( $attached_images as $attachment_id ) {
|
foreach ( $attached_images as $attachment_id ) {
|
||||||
$attachment = get_post( $attachment_id );
|
$attachment = get_post( $attachment_id );
|
||||||
if ( $attachment ) {
|
if ( $attachment ) {
|
||||||
$post_gallery_images[] = array(
|
$post_gallery_images[] = array(
|
||||||
|
@ -2749,15 +2781,15 @@ class MainWP_Child {
|
||||||
wp_update_user( $my_user );
|
wp_update_user( $my_user );
|
||||||
} elseif ( 'edit' === $action ) {
|
} elseif ( 'edit' === $action ) {
|
||||||
$user_data = $this->get_user_to_edit($userId);
|
$user_data = $this->get_user_to_edit($userId);
|
||||||
if (!empty($user_data)) {
|
if ( ! empty($user_data)) {
|
||||||
$information['user_data'] = $user_data;
|
$information['user_data'] = $user_data;
|
||||||
} else {
|
} else {
|
||||||
$failed = true;
|
$failed = true;
|
||||||
}
|
}
|
||||||
} elseif ( 'update_user' === $action ) {
|
} elseif ( 'update_user' === $action ) {
|
||||||
$my_user = $_POST['extra'];
|
$my_user = $_POST['extra'];
|
||||||
if (is_array($my_user)) {
|
if (is_array($my_user)) {
|
||||||
foreach($my_user as $idx => $val) {
|
foreach ($my_user as $idx => $val) {
|
||||||
if ($val === 'donotupdate' || ( empty($val) && $idx !== 'role' )) {
|
if ($val === 'donotupdate' || ( empty($val) && $idx !== 'role' )) {
|
||||||
unset($my_user[ $idx ]);
|
unset($my_user[ $idx ]);
|
||||||
}
|
}
|
||||||
|
@ -2777,9 +2809,9 @@ class MainWP_Child {
|
||||||
$information['status'] = 'FAIL';
|
$information['status'] = 'FAIL';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isset( $information['status'] ) && !isset($information['error']) ) {
|
if ( ! isset( $information['status'] ) && ! isset($information['error']) ) {
|
||||||
$information['status'] = 'SUCCESS';
|
$information['status'] = 'SUCCESS';
|
||||||
if ('update_user' === $action && isset($_POST['optimize']) && !empty($_POST['optimize'])) {
|
if ('update_user' === $action && isset($_POST['optimize']) && ! empty($_POST['optimize'])) {
|
||||||
$information['users'] = $this->get_all_users_int(500); // to fix
|
$information['users'] = $this->get_all_users_int(500); // to fix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2830,7 +2862,7 @@ class MainWP_Child {
|
||||||
$email = trim( $data['email'] );
|
$email = trim( $data['email'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $email ) ) {
|
if ( ! empty( $email ) ) {
|
||||||
$user->user_email = sanitize_text_field( wp_unslash( $email ) );
|
$user->user_email = sanitize_text_field( wp_unslash( $email ) );
|
||||||
} else {
|
} else {
|
||||||
$user->user_email = $userdata->user_email;
|
$user->user_email = $userdata->user_email;
|
||||||
|
@ -2852,7 +2884,7 @@ class MainWP_Child {
|
||||||
if ( isset( $data['last_name'] ) ) {
|
if ( isset( $data['last_name'] ) ) {
|
||||||
$user->last_name = sanitize_text_field( $data['last_name'] );
|
$user->last_name = sanitize_text_field( $data['last_name'] );
|
||||||
}
|
}
|
||||||
if ( isset( $data['nickname'] ) && !empty($data['nickname'])) {
|
if ( isset( $data['nickname'] ) && ! empty($data['nickname'])) {
|
||||||
$user->nickname = sanitize_text_field( $data['nickname'] );
|
$user->nickname = sanitize_text_field( $data['nickname'] );
|
||||||
}
|
}
|
||||||
if ( isset( $data['display_name'] ) ) {
|
if ( isset( $data['display_name'] ) ) {
|
||||||
|
@ -2871,7 +2903,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) );
|
do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) );
|
||||||
|
|
||||||
if (!empty($pass1) || !empty($pass2)) {
|
if ( ! empty($pass1) || ! empty($pass2)) {
|
||||||
// Check for blank password when adding a user.
|
// Check for blank password when adding a user.
|
||||||
if ( ! $update && empty( $pass1 ) ) {
|
if ( ! $update && empty( $pass1 ) ) {
|
||||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter a password.' ), array( 'form-field' => 'pass1' ) );
|
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter a password.' ), array( 'form-field' => 'pass1' ) );
|
||||||
|
@ -2887,7 +2919,7 @@ class MainWP_Child {
|
||||||
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
|
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $pass1 ) ) {
|
if ( ! empty( $pass1 ) ) {
|
||||||
$user->user_pass = $pass1;
|
$user->user_pass = $pass1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2904,9 +2936,9 @@ class MainWP_Child {
|
||||||
/* checking email address */
|
/* checking email address */
|
||||||
if ( empty( $user->user_email ) ) {
|
if ( empty( $user->user_email ) ) {
|
||||||
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
|
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
|
||||||
} elseif ( !is_email( $user->user_email ) ) {
|
} elseif ( ! is_email( $user->user_email ) ) {
|
||||||
$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ), array( 'form-field' => 'email' ) );
|
$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ), array( 'form-field' => 'email' ) );
|
||||||
} elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) {
|
} elseif ( ( $owner_id = email_exists($user->user_email) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) {
|
||||||
$errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
|
$errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2945,20 +2977,20 @@ class MainWP_Child {
|
||||||
$public_display['display_nickname'] = $profileuser->nickname;
|
$public_display['display_nickname'] = $profileuser->nickname;
|
||||||
$public_display['display_username'] = $profileuser->user_login;
|
$public_display['display_username'] = $profileuser->user_login;
|
||||||
|
|
||||||
if ( !empty($profileuser->first_name) ) {
|
if ( ! empty($profileuser->first_name) ) {
|
||||||
$public_display['display_firstname'] = $profileuser->first_name;
|
$public_display['display_firstname'] = $profileuser->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($profileuser->last_name) ) {
|
if ( ! empty($profileuser->last_name) ) {
|
||||||
$public_display['display_lastname'] = $profileuser->last_name;
|
$public_display['display_lastname'] = $profileuser->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
|
if ( ! empty($profileuser->first_name) && ! empty($profileuser->last_name) ) {
|
||||||
$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
|
$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
|
||||||
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
|
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere
|
if ( ! in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere
|
||||||
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
|
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2972,7 +3004,7 @@ class MainWP_Child {
|
||||||
foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
|
foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
|
||||||
$edit_data['contact_methods'][ $name ] = $profileuser->$name;
|
$edit_data['contact_methods'][ $name ] = $profileuser->$name;
|
||||||
}
|
}
|
||||||
$edit_data['description'] = $profileuser->description;
|
$edit_data['description'] = $profileuser->description;
|
||||||
}
|
}
|
||||||
return $edit_data;
|
return $edit_data;
|
||||||
}
|
}
|
||||||
|
@ -3068,7 +3100,7 @@ class MainWP_Child {
|
||||||
$send_password = $_POST['send_password'];
|
$send_password = $_POST['send_password'];
|
||||||
// check role existed
|
// check role existed
|
||||||
if (isset( $new_user['role'] )) {
|
if (isset( $new_user['role'] )) {
|
||||||
if ( !get_role( $new_user['role'] ) ) {
|
if ( ! get_role( $new_user['role'] ) ) {
|
||||||
$new_user['role'] = 'subscriber';
|
$new_user['role'] = 'subscriber';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3600,7 +3632,7 @@ class MainWP_Child {
|
||||||
// $information['file_perms'] = (!MainWP_Security::fix_file_permissions_ok() ? 'N' : 'Y');
|
// $information['file_perms'] = (!MainWP_Security::fix_file_permissions_ok() ? 'N' : 'Y');
|
||||||
$information['db_reporting'] = ( ! MainWP_Security::remove_database_reporting_ok() ? 'N' : 'Y' );
|
$information['db_reporting'] = ( ! MainWP_Security::remove_database_reporting_ok() ? 'N' : 'Y' );
|
||||||
$information['php_reporting'] = ( ! MainWP_Security::remove_php_reporting_ok() ? 'N' : 'Y' );
|
$information['php_reporting'] = ( ! MainWP_Security::remove_php_reporting_ok() ? 'N' : 'Y' );
|
||||||
$information['versions'] = ( ! MainWP_Security::remove_scripts_version_ok() || ! MainWP_Security::remove_styles_version_ok() || ! MainWP_Security::remove_generator_version_ok()
|
$information['versions'] = ( ! MainWP_Security::remove_scripts_version_ok() || ! MainWP_Security::remove_styles_version_ok() || ! MainWP_Security::remove_generator_version_ok()
|
||||||
? 'N' : 'Y' );
|
? 'N' : 'Y' );
|
||||||
$information['registered_versions'] = ( MainWP_Security::remove_registered_versions_ok() ? 'Y' : 'N' );
|
$information['registered_versions'] = ( MainWP_Security::remove_registered_versions_ok() ? 'Y' : 'N' );
|
||||||
$information['admin'] = ( MainWP_Security::admin_user_ok() ? 'Y' : 'N' );
|
$information['admin'] = ( MainWP_Security::admin_user_ok() ? 'Y' : 'N' );
|
||||||
|
@ -3667,7 +3699,7 @@ class MainWP_Child {
|
||||||
$information['version'] = self::$version;
|
$information['version'] = self::$version;
|
||||||
$information['wpversion'] = $wp_version;
|
$information['wpversion'] = $wp_version;
|
||||||
$information['siteurl'] = get_option( 'siteurl' );
|
$information['siteurl'] = get_option( 'siteurl' );
|
||||||
$information['wpe'] = MainWP_Helper::is_wp_engine() ? 1 : 0;
|
$information['wpe'] = MainWP_Helper::is_wp_engine() ? 1 : 0;
|
||||||
$theme_name = wp_get_theme()->get( 'Name' );
|
$theme_name = wp_get_theme()->get( 'Name' );
|
||||||
$information['site_info'] = array(
|
$information['site_info'] = array(
|
||||||
'wpversion' => $wp_version,
|
'wpversion' => $wp_version,
|
||||||
|
@ -3683,7 +3715,7 @@ class MainWP_Child {
|
||||||
//Try to switch to SSL if SSL is enabled in between!
|
//Try to switch to SSL if SSL is enabled in between!
|
||||||
$pubkey = get_option( 'mainwp_child_pubkey' );
|
$pubkey = get_option( 'mainwp_child_pubkey' );
|
||||||
$nossl = get_option( 'mainwp_child_nossl' );
|
$nossl = get_option( 'mainwp_child_nossl' );
|
||||||
if ( 1 == $nossl ) {
|
if ( 1 == $nossl ) {
|
||||||
if ( isset($pubkey) && MainWP_Helper::isSSLEnabled() ) {
|
if ( isset($pubkey) && MainWP_Helper::isSSLEnabled() ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_nossl', 0, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_nossl', 0, 'yes' );
|
||||||
$nossl = 0;
|
$nossl = 0;
|
||||||
|
@ -3801,7 +3833,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
// to fix incorrect info
|
// to fix incorrect info
|
||||||
if ( !property_exists( $plugin_update, 'update' ) || !property_exists( $plugin_update->update, 'new_version' ) || empty($plugin_update->update->new_version)) {
|
if ( ! property_exists( $plugin_update, 'update' ) || ! property_exists( $plugin_update->update, 'new_version' ) || empty($plugin_update->update->new_version)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3816,16 +3848,16 @@ class MainWP_Child {
|
||||||
// to fix premium plugs update
|
// to fix premium plugs update
|
||||||
$cached_plugins_update = get_site_transient( 'mainwp_update_plugins_cached' );
|
$cached_plugins_update = get_site_transient( 'mainwp_update_plugins_cached' );
|
||||||
if ( is_array( $cached_plugins_update ) && ( count( $cached_plugins_update ) > 0 ) ) {
|
if ( is_array( $cached_plugins_update ) && ( count( $cached_plugins_update ) > 0 ) ) {
|
||||||
if (!isset($information['plugin_updates'])) {
|
if ( ! isset($information['plugin_updates'])) {
|
||||||
$information['plugin_updates'] = array();
|
$information['plugin_updates'] = array();
|
||||||
}
|
}
|
||||||
foreach( $cached_plugins_update as $slug => $plugin_update ) {
|
foreach ( $cached_plugins_update as $slug => $plugin_update ) {
|
||||||
|
|
||||||
// to fix incorrect info
|
// to fix incorrect info
|
||||||
if ( !property_exists( $plugin_update, 'new_version' ) || empty( $plugin_update->new_version ) ) { // may do not need to check this?
|
if ( ! property_exists( $plugin_update, 'new_version' ) || empty( $plugin_update->new_version ) ) { // may do not need to check this?
|
||||||
// to fix for some premiums update info
|
// to fix for some premiums update info
|
||||||
if ( property_exists( $plugin_update, 'update' ) ) {
|
if ( property_exists( $plugin_update, 'update' ) ) {
|
||||||
if ( !property_exists( $plugin_update->update, 'new_version' ) || empty( $plugin_update->update->new_version ) ) {
|
if ( ! property_exists( $plugin_update->update, 'new_version' ) || empty( $plugin_update->update->new_version ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3834,7 +3866,7 @@ class MainWP_Child {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( $information['plugin_updates'][ $slug ] ) ) {
|
if ( ! isset( $information['plugin_updates'][ $slug ] ) ) {
|
||||||
$information['plugin_updates'][ $slug ] = $plugin_update;
|
$information['plugin_updates'][ $slug ] = $plugin_update;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3865,7 +3897,7 @@ class MainWP_Child {
|
||||||
// to fix premium themes update
|
// to fix premium themes update
|
||||||
$cached_themes_update = get_site_transient( 'mainwp_update_themes_cached' );
|
$cached_themes_update = get_site_transient( 'mainwp_update_themes_cached' );
|
||||||
if ( is_array( $cached_themes_update ) && ( count( $cached_themes_update ) > 0 ) ) {
|
if ( is_array( $cached_themes_update ) && ( count( $cached_themes_update ) > 0 ) ) {
|
||||||
if (!isset($information['theme_updates'])) {
|
if ( ! isset($information['theme_updates'])) {
|
||||||
$information['theme_updates'] = array();
|
$information['theme_updates'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3882,10 +3914,9 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation_updates = wp_get_translation_updates();
|
$translation_updates = wp_get_translation_updates();
|
||||||
if ( !empty( $translation_updates ) ) {
|
if ( ! empty( $translation_updates ) ) {
|
||||||
$information['translation_updates'] = array();
|
$information['translation_updates'] = array();
|
||||||
foreach ($translation_updates as $translation_update)
|
foreach ($translation_updates as $translation_update) {
|
||||||
{
|
|
||||||
$new_translation_update = array(
|
$new_translation_update = array(
|
||||||
'type' => $translation_update->type,
|
'type' => $translation_update->type,
|
||||||
'slug' => $translation_update->slug,
|
'slug' => $translation_update->slug,
|
||||||
|
@ -4008,7 +4039,7 @@ class MainWP_Child {
|
||||||
$information['users'] = $this->get_all_users_int(500); // to fix
|
$information['users'] = $this->get_all_users_int(500); // to fix
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['primaryBackup']) && !empty($_POST['primaryBackup'])) {
|
if (isset($_POST['primaryBackup']) && ! empty($_POST['primaryBackup'])) {
|
||||||
$primary_bk = $_POST['primaryBackup'];
|
$primary_bk = $_POST['primaryBackup'];
|
||||||
$information['primaryLasttimeBackup'] = MainWP_Helper::get_lasttime_backup($primary_bk);
|
$information['primaryLasttimeBackup'] = MainWP_Helper::get_lasttime_backup($primary_bk);
|
||||||
}
|
}
|
||||||
|
@ -4028,14 +4059,14 @@ class MainWP_Child {
|
||||||
if (isset( $_POST['user'] )) {
|
if (isset( $_POST['user'] )) {
|
||||||
$user = get_user_by( 'login', $_POST['user'] );
|
$user = get_user_by( 'login', $_POST['user'] );
|
||||||
if ( $user && property_exists($user, 'ID') && $user->ID) {
|
if ( $user && property_exists($user, 'ID') && $user->ID) {
|
||||||
$information['admin_nicename'] = $user->data->user_nicename;
|
$information['admin_nicename'] = $user->data->user_nicename;
|
||||||
$information['admin_useremail'] = $user->data->user_email;
|
$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) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4052,9 +4083,9 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
$information = apply_filters( 'mainwp-site-sync-others-data', $information, $othersData );
|
||||||
} catch(Exception $e) {
|
} catch (Exception $e) {
|
||||||
// do not exit
|
// do not exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4069,7 +4100,7 @@ class MainWP_Child {
|
||||||
function get_site_icon() {
|
function get_site_icon() {
|
||||||
$information = array();
|
$information = array();
|
||||||
$url = $this->get_favicon( true );
|
$url = $this->get_favicon( true );
|
||||||
if ( !empty( $url ) ) {
|
if ( ! empty( $url ) ) {
|
||||||
$information['faviIconUrl'] = $url;
|
$information['faviIconUrl'] = $url;
|
||||||
}
|
}
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
|
@ -4096,8 +4127,8 @@ class MainWP_Child {
|
||||||
$favi = 'favicon.png';
|
$favi = 'favicon.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $favi ) ) {
|
if ( ! empty( $favi ) ) {
|
||||||
$favi_url = $site_url . $favi;
|
$favi_url = $site_url . $favi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4118,7 +4149,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $favi ) ){
|
if ( ! empty( $favi ) ) {
|
||||||
if ( false === strpos( $favi, 'http' )) {
|
if ( false === strpos( $favi, 'http' )) {
|
||||||
if (0 === strpos( $favi, '//' )) {
|
if (0 === strpos( $favi, '//' )) {
|
||||||
if (0 === strpos( $site_url, 'https' )) {
|
if (0 === strpos( $site_url, 'https' )) {
|
||||||
|
@ -4135,7 +4166,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $favi_url ) ) {
|
if ( ! empty( $favi_url ) ) {
|
||||||
return $favi_url;
|
return $favi_url;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4291,7 +4322,7 @@ class MainWP_Child {
|
||||||
//$outPost['content'] = $post->post_content; // to fix overload memory
|
//$outPost['content'] = $post->post_content; // to fix overload memory
|
||||||
$outPost['comment_count'] = $post->comment_count;
|
$outPost['comment_count'] = $post->comment_count;
|
||||||
// to support extract urls extension
|
// to support extract urls extension
|
||||||
if ( isset( $extra['where_post_date'] ) && !empty( $extra['where_post_date'] ) ) {
|
if ( isset( $extra['where_post_date'] ) && ! empty( $extra['where_post_date'] ) ) {
|
||||||
$outPost['dts'] = strtotime( $post->post_date_gmt );
|
$outPost['dts'] = strtotime( $post->post_date_gmt );
|
||||||
} else {
|
} else {
|
||||||
$outPost['dts'] = strtotime( $post->post_modified_gmt );
|
$outPost['dts'] = strtotime( $post->post_modified_gmt );
|
||||||
|
@ -4540,7 +4571,7 @@ class MainWP_Child {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
add_filter( 'posts_where', array( &$this, 'posts_where' ) );
|
add_filter( 'posts_where', array( &$this, 'posts_where' ) );
|
||||||
$where_post_date = isset($_POST['where_post_date']) && !empty($_POST['where_post_date']) ? true : false;
|
$where_post_date = isset($_POST['where_post_date']) && ! empty($_POST['where_post_date']) ? true : false;
|
||||||
if ( isset( $_POST['postId'] ) ) {
|
if ( isset( $_POST['postId'] ) ) {
|
||||||
$this->posts_where_suffix .= " AND $wpdb->posts.ID = " . $_POST['postId'];
|
$this->posts_where_suffix .= " AND $wpdb->posts.ID = " . $_POST['postId'];
|
||||||
} elseif ( isset( $_POST['userId'] ) ) {
|
} elseif ( isset( $_POST['userId'] ) ) {
|
||||||
|
@ -4998,10 +5029,10 @@ class MainWP_Child {
|
||||||
$search_user_role = array();
|
$search_user_role = array();
|
||||||
$check_users_role = false;
|
$check_users_role = false;
|
||||||
|
|
||||||
if (isset($_POST['role']) && !empty($_POST['role'])) {
|
if (isset($_POST['role']) && ! empty($_POST['role'])) {
|
||||||
$check_users_role = true;
|
$check_users_role = true;
|
||||||
$all_users_role = $this->get_all_users(true);
|
$all_users_role = $this->get_all_users(true);
|
||||||
foreach($all_users_role as $user) {
|
foreach ($all_users_role as $user) {
|
||||||
$search_user_role[] = $user['id'];
|
$search_user_role[] = $user['id'];
|
||||||
}
|
}
|
||||||
unset($all_users_role);
|
unset($all_users_role);
|
||||||
|
@ -5026,7 +5057,7 @@ class MainWP_Child {
|
||||||
if ( ! empty( $user_query->results ) ) {
|
if ( ! empty( $user_query->results ) ) {
|
||||||
foreach ( $user_query->results as $new_user ) {
|
foreach ( $user_query->results as $new_user ) {
|
||||||
if ($check_users_role) {
|
if ($check_users_role) {
|
||||||
if (!in_array($new_user->ID, $search_user_role )){
|
if ( ! in_array($new_user->ID, $search_user_role )) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5241,8 +5272,8 @@ class MainWP_Child {
|
||||||
// to fix for window host, performance not good?
|
// to fix for window host, performance not good?
|
||||||
if ( class_exists( 'RecursiveIteratorIterator' ) ) {
|
if ( class_exists( 'RecursiveIteratorIterator' ) ) {
|
||||||
$size = 0;
|
$size = 0;
|
||||||
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){
|
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
|
||||||
$size+=$file->getSize();
|
$size += $file->getSize();
|
||||||
}
|
}
|
||||||
if ( $size && MainWP_Helper::ctype_digit( $size ) ) {
|
if ( $size && MainWP_Helper::ctype_digit( $size ) ) {
|
||||||
return $size / 1024 / 1024;
|
return $size / 1024 / 1024;
|
||||||
|
@ -5434,7 +5465,7 @@ class MainWP_Child {
|
||||||
$information['status'] = 'SUCCESS';
|
$information['status'] = 'SUCCESS';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $performed_what ) && has_action( 'mainwp_reports_maintenance' ) ) {
|
if ( ! empty( $performed_what ) && has_action( 'mainwp_reports_maintenance' ) ) {
|
||||||
$details = implode( ',', $performed_what );
|
$details = implode( ',', $performed_what );
|
||||||
$log_time = time();
|
$log_time = time();
|
||||||
$message = $result = 'Maintenance Performed';
|
$message = $result = 'Maintenance Performed';
|
||||||
|
@ -5609,16 +5640,16 @@ class MainWP_Child {
|
||||||
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
||||||
|
|
||||||
/** The config file resides in ABSPATH */
|
/** The config file resides in ABSPATH */
|
||||||
$config_file = ABSPATH . 'wp-config.php';
|
$config_file = ABSPATH . 'wp-config.php';
|
||||||
|
|
||||||
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
|
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
|
||||||
|
|
||||||
/** The config file resides one level above ABSPATH but is not part of another install */
|
/** The config file resides one level above ABSPATH but is not part of another install */
|
||||||
$config_file = dirname( ABSPATH ) . '/wp-config.php';
|
$config_file = dirname( ABSPATH ) . '/wp-config.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($config_file) ) {
|
if ( ! empty($config_file) ) {
|
||||||
$wpConfig = file_get_contents( $config_file );
|
$wpConfig = file_get_contents( $config_file );
|
||||||
|
|
||||||
if ( 'delete' === $action ) {
|
if ( 'delete' === $action ) {
|
||||||
|
@ -5791,7 +5822,8 @@ class MainWP_Child {
|
||||||
header( 'Cache-Control: must-revalidate' );
|
header( 'Cache-Control: must-revalidate' );
|
||||||
header( 'Pragma: public' );
|
header( 'Pragma: public' );
|
||||||
header( 'Content-Length: ' . filesize( $backupdir . $file ) );
|
header( 'Content-Length: ' . filesize( $backupdir . $file ) );
|
||||||
while ( @ob_end_flush() ) {;
|
while ( @ob_end_flush() ) {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
$this->readfile_chunked( $backupdir . $file, $offset );
|
$this->readfile_chunked( $backupdir . $file, $offset );
|
||||||
}
|
}
|
||||||
|
|
|
@ -654,7 +654,7 @@ class MainWP_Clone_Install {
|
||||||
// some unseriliased data cannot be re-serialised eg. SimpleXMLElements
|
// some unseriliased data cannot be re-serialised eg. SimpleXMLElements
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if ( is_string( $data ) && is_serialized( $data ) && !is_serialized_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
if ( is_string( $data ) && is_serialized( $data ) && ! is_serialized_string( $data ) && ( $unserialized = @unserialize( $data ) ) !== false ) {
|
||||||
$data = $this->recursive_unserialize_replace( $from, $to, $unserialized, true );
|
$data = $this->recursive_unserialize_replace( $from, $to, $unserialized, true );
|
||||||
} elseif ( is_array( $data ) ) {
|
} elseif ( is_array( $data ) ) {
|
||||||
$_tmp = array();
|
$_tmp = array();
|
||||||
|
@ -673,7 +673,7 @@ class MainWP_Clone_Install {
|
||||||
|
|
||||||
$data = $_tmp;
|
$data = $_tmp;
|
||||||
unset( $_tmp );
|
unset( $_tmp );
|
||||||
} elseif (is_serialized_string($data) && is_serialized($data)) {
|
} elseif (is_serialized_string($data) && is_serialized($data)) {
|
||||||
// TODO: apply solution like phpmyadmin project have!
|
// TODO: apply solution like phpmyadmin project have!
|
||||||
if ( ( $data = @unserialize( $data ) ) !== false ) {
|
if ( ( $data = @unserialize( $data ) ) !== false ) {
|
||||||
$data = str_replace( $from, $to, $data );
|
$data = str_replace( $from, $to, $data );
|
||||||
|
|
|
@ -518,8 +518,7 @@ class MainWP_Clone {
|
||||||
var child_security_nonces = [];
|
var child_security_nonces = [];
|
||||||
<?php
|
<?php
|
||||||
$security_nonces = self::get()->getSecurityNonces();
|
$security_nonces = self::get()->getSecurityNonces();
|
||||||
foreach ($security_nonces as $k => $v)
|
foreach ($security_nonces as $k => $v) {
|
||||||
{
|
|
||||||
echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n";
|
echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -67,7 +67,7 @@ class MainWP_Custom_Post_Type {
|
||||||
if ( empty( $data ) || ! is_array( $data ) || ! isset( $data['post'] ) ) {
|
if ( empty( $data ) || ! is_array( $data ) || ! isset( $data['post'] ) ) {
|
||||||
return array( 'error' => __( 'Cannot decode data', $this->plugin_translate ) );
|
return array( 'error' => __( 'Cannot decode data', $this->plugin_translate ) );
|
||||||
}
|
}
|
||||||
$edit_id = ( isset($_POST['post_id']) && !empty($_POST['post_id']) ) ? $_POST['post_id'] : 0;
|
$edit_id = ( isset($_POST['post_id']) && ! empty($_POST['post_id']) ) ? $_POST['post_id'] : 0;
|
||||||
$return = $this->_insert_post($data, $edit_id, $parent_id = 0);
|
$return = $this->_insert_post($data, $edit_id, $parent_id = 0);
|
||||||
if (isset($return['success']) && $return['success'] == 1) {
|
if (isset($return['success']) && $return['success'] == 1) {
|
||||||
if (isset($data['product_variation']) && is_array($data['product_variation'])) {
|
if (isset($data['product_variation']) && is_array($data['product_variation'])) {
|
||||||
|
@ -177,14 +177,14 @@ class MainWP_Custom_Post_Type {
|
||||||
//$data_insert['post_content'] = $this->_search_images( $data_insert['post_content'], $data['extras']['upload_dir'] );
|
//$data_insert['post_content'] = $this->_search_images( $data_insert['post_content'], $data['extras']['upload_dir'] );
|
||||||
|
|
||||||
$is_woocomerce = false;
|
$is_woocomerce = false;
|
||||||
if ( ( $data_insert['post_type'] == 'product' || $data_insert['post_type'] == 'product_variation' )&& function_exists( 'wc_product_has_unique_sku' ) ) {
|
if ( ( $data_insert['post_type'] == 'product' || $data_insert['post_type'] == 'product_variation' ) && function_exists( 'wc_product_has_unique_sku' ) ) {
|
||||||
$is_woocomerce = true;
|
$is_woocomerce = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$check_image_existed = false;
|
$check_image_existed = false;
|
||||||
|
|
||||||
// Support post_edit
|
// Support post_edit
|
||||||
if ( !empty( $edit_id ) ) {
|
if ( ! empty( $edit_id ) ) {
|
||||||
$old_post_id = (int) $edit_id;
|
$old_post_id = (int) $edit_id;
|
||||||
$old_post = get_post( $old_post_id, ARRAY_A );
|
$old_post = get_post( $old_post_id, ARRAY_A );
|
||||||
if ( is_null( $old_post ) ) {
|
if ( is_null( $old_post ) ) {
|
||||||
|
@ -215,7 +215,7 @@ class MainWP_Custom_Post_Type {
|
||||||
|
|
||||||
$data_insert['post_content'] = $this->_search_images( $data_insert['post_content'], $data['extras']['upload_dir'], $check_image_existed );
|
$data_insert['post_content'] = $this->_search_images( $data_insert['post_content'], $data['extras']['upload_dir'], $check_image_existed );
|
||||||
|
|
||||||
if (!empty($parent_id)) {
|
if ( ! empty($parent_id)) {
|
||||||
$data_insert['post_parent'] = $parent_id; // for product variation
|
$data_insert['post_parent'] = $parent_id; // for product variation
|
||||||
}
|
}
|
||||||
$post_id = wp_insert_post( $data_insert, true );
|
$post_id = wp_insert_post( $data_insert, true );
|
||||||
|
|
|
@ -5,7 +5,7 @@ class MainWP_Helper {
|
||||||
static function write( $val ) {
|
static function write( $val ) {
|
||||||
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
||||||
$output = self::safe_json_encode( $val );
|
$output = self::safe_json_encode( $val );
|
||||||
else:
|
else :
|
||||||
$output = serialize( $val );
|
$output = serialize( $val );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class MainWP_Helper {
|
||||||
|
|
||||||
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
if (isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] == true) :
|
||||||
$output = self::safe_json_encode( $val );
|
$output = self::safe_json_encode( $val );
|
||||||
else:
|
else :
|
||||||
$output = serialize( $val );
|
$output = serialize( $val );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
@ -81,48 +81,47 @@ class MainWP_Helper {
|
||||||
// Append the rest to $blocks
|
// Append the rest to $blocks
|
||||||
array_push($blocks[0], preg_replace('/@.+?\}[^\}]*?\}/ms', '', $css));
|
array_push($blocks[0], preg_replace('/@.+?\}[^\}]*?\}/ms', '', $css));
|
||||||
$ordered = array();
|
$ordered = array();
|
||||||
for($i=0;$i<count($blocks[0]);$i++){
|
for ($i = 0;$i < count($blocks[0]);$i++) {
|
||||||
// If @media-block, strip declaration and parenthesis
|
// If @media-block, strip declaration and parenthesis
|
||||||
if(substr($blocks[0][ $i ], 0, 6) === '@media')
|
if (substr($blocks[0][ $i ], 0, 6) === '@media') {
|
||||||
{
|
|
||||||
$ordered_key = preg_replace('/^(@media[^\{]+)\{.*\}$/ms', '$1', $blocks[0][ $i ]);
|
$ordered_key = preg_replace('/^(@media[^\{]+)\{.*\}$/ms', '$1', $blocks[0][ $i ]);
|
||||||
$ordered_value = preg_replace('/^@media[^\{]+\{(.*)\}$/ms', '$1', $blocks[0][ $i ]);
|
$ordered_value = preg_replace('/^@media[^\{]+\{(.*)\}$/ms', '$1', $blocks[0][ $i ]);
|
||||||
}
|
}
|
||||||
// Rule-blocks of the sort @import or @font-face
|
// Rule-blocks of the sort @import or @font-face
|
||||||
elseif(substr($blocks[0][ $i ], 0, 1) === '@')
|
elseif (substr($blocks[0][ $i ], 0, 1) === '@') {
|
||||||
{
|
|
||||||
$ordered_key = $blocks[0][ $i ];
|
$ordered_key = $blocks[0][ $i ];
|
||||||
$ordered_value = $blocks[0][ $i ];
|
$ordered_value = $blocks[0][ $i ];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$ordered_key = 'main';
|
$ordered_key = 'main';
|
||||||
$ordered_value = $blocks[0][ $i ];
|
$ordered_value = $blocks[0][ $i ];
|
||||||
}
|
}
|
||||||
// Split by parenthesis, ignoring those inside content-quotes
|
// Split by parenthesis, ignoring those inside content-quotes
|
||||||
$ordered[ $ordered_key ] = preg_split('/([^\'"\{\}]*?[\'"].*?(?<!\\\)[\'"][^\'"\{\}]*?)[\{\}]|([^\'"\{\}]*?)[\{\}]/', trim($ordered_value, " \r\n\t"), -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
|
$ordered[ $ordered_key ] = preg_split('/([^\'"\{\}]*?[\'"].*?(?<!\\\)[\'"][^\'"\{\}]*?)[\{\}]|([^\'"\{\}]*?)[\{\}]/', trim($ordered_value, " \r\n\t"), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beginning to rebuild new slim CSS-Array
|
// Beginning to rebuild new slim CSS-Array
|
||||||
foreach($ordered as $key => $val){
|
foreach ($ordered as $key => $val) {
|
||||||
$new = array();
|
$new = array();
|
||||||
for($i = 0; $i<count($val); $i++){
|
for ($i = 0; $i < count($val); $i++) {
|
||||||
// Split selectors and rules and split properties and values
|
// Split selectors and rules and split properties and values
|
||||||
$selector = trim($val[ $i ], " \r\n\t");
|
$selector = trim($val[ $i ], " \r\n\t");
|
||||||
|
|
||||||
if(!empty($selector)){
|
if ( ! empty($selector)) {
|
||||||
if(!isset($new[ $selector ])) { $new[ $selector ] = array();
|
if ( ! isset($new[ $selector ])) {
|
||||||
|
$new[ $selector ] = array();
|
||||||
}
|
}
|
||||||
$rules = explode(';', $val[ ++$i ]);
|
$rules = explode(';', $val[ ++$i ]);
|
||||||
foreach($rules as $rule){
|
foreach ($rules as $rule) {
|
||||||
$rule = trim($rule, " \r\n\t");
|
$rule = trim($rule, " \r\n\t");
|
||||||
if(!empty($rule)){
|
if ( ! empty($rule)) {
|
||||||
$rule = array_reverse(explode(':', $rule));
|
$rule = array_reverse(explode(':', $rule));
|
||||||
$property = trim(array_pop($rule), " \r\n\t");
|
$property = trim(array_pop($rule), " \r\n\t");
|
||||||
$value = implode(':', array_reverse($rule));
|
$value = implode(':', array_reverse($rule));
|
||||||
|
|
||||||
if(!isset($new[ $selector ][ $property ]) || !preg_match('/!important/', $new[ $selector ][ $property ])) { $new[ $selector ][ $property ] = $value;
|
if ( ! isset($new[ $selector ][ $property ]) || ! preg_match('/!important/', $new[ $selector ][ $property ])) {
|
||||||
} elseif(preg_match('/!important/', $new[ $selector ][ $property ]) && preg_match('/!important/', $value)) { $new[ $selector ][ $property ] = $value;
|
$new[ $selector ][ $property ] = $value;
|
||||||
|
} elseif (preg_match('/!important/', $new[ $selector ][ $property ]) && preg_match('/!important/', $value)) {
|
||||||
|
$new[ $selector ][ $property ] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,23 +132,23 @@ class MainWP_Helper {
|
||||||
$parsed = $ordered;
|
$parsed = $ordered;
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach($parsed as $media => $content){
|
foreach ($parsed as $media => $content) {
|
||||||
if(substr($media, 0, 6) === '@media'){
|
if (substr($media, 0, 6) === '@media') {
|
||||||
$output .= $media . " {\n";
|
$output .= $media . " {\n";
|
||||||
$prefix = "\t";
|
$prefix = "\t";
|
||||||
}
|
} else {
|
||||||
else { $prefix = '';
|
$prefix = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($content as $selector => $rules){
|
foreach ($content as $selector => $rules) {
|
||||||
$output .= $prefix . $selector . " {\n";
|
$output .= $prefix . $selector . " {\n";
|
||||||
foreach($rules as $property => $value){
|
foreach ($rules as $property => $value) {
|
||||||
$output .= $prefix . "\t" . $property . ': ' . $value;
|
$output .= $prefix . "\t" . $property . ': ' . $value;
|
||||||
$output .= ";\n";
|
$output .= ";\n";
|
||||||
}
|
}
|
||||||
$output .= $prefix . "}\n\n";
|
$output .= $prefix . "}\n\n";
|
||||||
}
|
}
|
||||||
if(substr($media, 0, 6) === '@media'){
|
if (substr($media, 0, 6) === '@media') {
|
||||||
$output .= "}\n\n";
|
$output .= "}\n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +158,7 @@ class MainWP_Helper {
|
||||||
// $check_file_existed: to support checking if file existed
|
// $check_file_existed: to support checking if file existed
|
||||||
// $parent_id: optional
|
// $parent_id: optional
|
||||||
static function uploadImage( $img_url, $img_data = array(), $check_file_existed = false, $parent_id = 0 ) {
|
static function uploadImage( $img_url, $img_data = array(), $check_file_existed = false, $parent_id = 0 ) {
|
||||||
if ( !is_array($img_data) ) {
|
if ( ! is_array($img_data) ) {
|
||||||
$img_data = array();
|
$img_data = array();
|
||||||
}
|
}
|
||||||
include_once ABSPATH . 'wp-admin/includes/file.php'; //Contains download_url
|
include_once ABSPATH . 'wp-admin/includes/file.php'; //Contains download_url
|
||||||
|
@ -231,9 +230,9 @@ class MainWP_Helper {
|
||||||
$wp_filetype = wp_check_filetype( basename( $img_url ), null ); //Get the filetype to set the mimetype
|
$wp_filetype = wp_check_filetype( basename( $img_url ), null ); //Get the filetype to set the mimetype
|
||||||
$attachment = array(
|
$attachment = array(
|
||||||
'post_mime_type' => $wp_filetype['type'],
|
'post_mime_type' => $wp_filetype['type'],
|
||||||
'post_title' => isset( $img_data['title'] ) && !empty( $img_data['title'] ) ? $img_data['title'] : preg_replace( '/\.[^.]+$/', '', basename( $img_url ) ),
|
'post_title' => isset( $img_data['title'] ) && ! empty( $img_data['title'] ) ? $img_data['title'] : preg_replace( '/\.[^.]+$/', '', basename( $img_url ) ),
|
||||||
'post_content' => isset( $img_data['description'] ) && !empty( $img_data['description'] ) ? $img_data['description'] : '',
|
'post_content' => isset( $img_data['description'] ) && ! empty( $img_data['description'] ) ? $img_data['description'] : '',
|
||||||
'post_excerpt' => isset( $img_data['caption'] ) && !empty( $img_data['caption'] ) ? $img_data['caption'] : '',
|
'post_excerpt' => isset( $img_data['caption'] ) && ! empty( $img_data['caption'] ) ? $img_data['caption'] : '',
|
||||||
'post_status' => 'inherit',
|
'post_status' => 'inherit',
|
||||||
'guid' => $local_img_url, // to fix
|
'guid' => $local_img_url, // to fix
|
||||||
);
|
);
|
||||||
|
@ -247,7 +246,7 @@ class MainWP_Helper {
|
||||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||||
$attach_data = wp_generate_attachment_metadata( $attach_id, $local_img_path );
|
$attach_data = wp_generate_attachment_metadata( $attach_id, $local_img_path );
|
||||||
wp_update_attachment_metadata( $attach_id, $attach_data ); //Update generated metadata
|
wp_update_attachment_metadata( $attach_id, $attach_data ); //Update generated metadata
|
||||||
if ( isset( $img_data['alt'] ) && !empty( $img_data['alt'] ) ) {
|
if ( isset( $img_data['alt'] ) && ! empty( $img_data['alt'] ) ) {
|
||||||
update_post_meta( $attach_id, '_wp_attachment_image_alt', $img_data['alt'] );
|
update_post_meta( $attach_id, '_wp_attachment_image_alt', $img_data['alt'] );
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
|
@ -500,7 +499,7 @@ class MainWP_Helper {
|
||||||
if ( isset( $_POST['post_gallery_images'] ) ) {
|
if ( isset( $_POST['post_gallery_images'] ) ) {
|
||||||
$post_gallery_images = unserialize(base64_decode( $_POST['post_gallery_images'] ));
|
$post_gallery_images = unserialize(base64_decode( $_POST['post_gallery_images'] ));
|
||||||
if (is_array($post_gallery_images)) {
|
if (is_array($post_gallery_images)) {
|
||||||
foreach($post_gallery_images as $gallery){
|
foreach ($post_gallery_images as $gallery) {
|
||||||
if (isset($gallery['src'])) {
|
if (isset($gallery['src'])) {
|
||||||
try {
|
try {
|
||||||
$upload = self::uploadImage( $gallery['src'], $gallery ); //Upload image to WP
|
$upload = self::uploadImage( $gallery['src'], $gallery ); //Upload image to WP
|
||||||
|
@ -519,13 +518,13 @@ class MainWP_Helper {
|
||||||
$idsToReplace = $match[1];
|
$idsToReplace = $match[1];
|
||||||
$idsToReplaceWith = '';
|
$idsToReplaceWith = '';
|
||||||
$originalIds = explode(',', $idsToReplace);
|
$originalIds = explode(',', $idsToReplace);
|
||||||
foreach($originalIds as $attached_id) {
|
foreach ($originalIds as $attached_id) {
|
||||||
if (!empty($originalIds) && isset($replaceAttachedIds[ $attached_id ])) {
|
if ( ! empty($originalIds) && isset($replaceAttachedIds[ $attached_id ])) {
|
||||||
$idsToReplaceWith .= $replaceAttachedIds[ $attached_id ] . ',';
|
$idsToReplaceWith .= $replaceAttachedIds[ $attached_id ] . ',';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$idsToReplaceWith = rtrim($idsToReplaceWith, ',');
|
$idsToReplaceWith = rtrim($idsToReplaceWith, ',');
|
||||||
if (!empty($idsToReplaceWith)) {
|
if ( ! empty($idsToReplaceWith)) {
|
||||||
$new_post['post_content'] = str_replace( '"' . $idsToReplace . '"', '"' . $idsToReplaceWith . '"', $new_post['post_content'] );
|
$new_post['post_content'] = str_replace( '"' . $idsToReplace . '"', '"' . $idsToReplaceWith . '"', $new_post['post_content'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +582,7 @@ class MainWP_Helper {
|
||||||
if ( $edit_post_id ) {
|
if ( $edit_post_id ) {
|
||||||
// check if post existed
|
// check if post existed
|
||||||
$current_post = get_post($edit_post_id);
|
$current_post = get_post($edit_post_id);
|
||||||
if ( $current_post && ( ( !isset( $new_post['post_type'] ) && $current_post->post_type == 'post' ) || ( isset( $new_post['post_type'] ) && $new_post['post_type'] == $current_post->post_type ) ) ) {
|
if ( $current_post && ( ( ! isset( $new_post['post_type'] ) && $current_post->post_type == 'post' ) || ( isset( $new_post['post_type'] ) && $new_post['post_type'] == $current_post->post_type ) ) ) {
|
||||||
$new_post['ID'] = $edit_post_id;
|
$new_post['ID'] = $edit_post_id;
|
||||||
}
|
}
|
||||||
$new_post['post_status'] = $post_status; // child reports: to logging as update post
|
$new_post['post_status'] = $post_status; // child reports: to logging as update post
|
||||||
|
@ -599,7 +598,7 @@ class MainWP_Helper {
|
||||||
return array( 'error' => 'Empty post id' );
|
return array( 'error' => 'Empty post id' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$edit_post_id ) {
|
if ( ! $edit_post_id ) {
|
||||||
wp_update_post( array(
|
wp_update_post( array(
|
||||||
'ID' => $new_post_id,
|
'ID' => $new_post_id,
|
||||||
'post_status' => $post_status,
|
'post_status' => $post_status,
|
||||||
|
@ -758,7 +757,7 @@ class MainWP_Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$featured_image_exist ) {
|
if ( ! $featured_image_exist ) {
|
||||||
delete_post_meta( $new_post_id, '_thumbnail_id' );
|
delete_post_meta( $new_post_id, '_thumbnail_id' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,7 +810,7 @@ class MainWP_Helper {
|
||||||
|
|
||||||
// to support custom post author
|
// to support custom post author
|
||||||
$custom_post_author = apply_filters('mainwp_create_post_custom_author', false, $new_post_id);
|
$custom_post_author = apply_filters('mainwp_create_post_custom_author', false, $new_post_id);
|
||||||
if ( !empty( $custom_post_author ) ) {
|
if ( ! empty( $custom_post_author ) ) {
|
||||||
wp_update_post( array(
|
wp_update_post( array(
|
||||||
'ID' => $new_post_id,
|
'ID' => $new_post_id,
|
||||||
'post_author' => $custom_post_author,
|
'post_author' => $custom_post_author,
|
||||||
|
@ -1053,7 +1052,7 @@ class MainWP_Helper {
|
||||||
//$agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
//$agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
||||||
$agent = 'Mozilla/5.0 (compatible; MainWP-Child/' . MainWP_Child::$version . '; +http://mainwp.com)';
|
$agent = 'Mozilla/5.0 (compatible; MainWP-Child/' . MainWP_Child::$version . '; +http://mainwp.com)';
|
||||||
|
|
||||||
if (!is_array( $postdata )) {
|
if ( ! is_array( $postdata )) {
|
||||||
$postdata = array();
|
$postdata = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1266,7 +1265,7 @@ class MainWP_Helper {
|
||||||
static function update_lasttime_backup( $by, $time ) {
|
static function update_lasttime_backup( $by, $time ) {
|
||||||
$backup_by = array( 'backupbuddy', 'backupwordpress', 'backwpup', 'updraftplus', 'wptimecapsule' );
|
$backup_by = array( 'backupbuddy', 'backupwordpress', 'backwpup', 'updraftplus', 'wptimecapsule' );
|
||||||
|
|
||||||
if (!in_array($by, $backup_by)) {
|
if ( ! in_array($by, $backup_by)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1282,29 +1281,29 @@ class MainWP_Helper {
|
||||||
if ($by == 'backupwp') { // to compatible
|
if ($by == 'backupwp') { // to compatible
|
||||||
$by = 'backupwordpress';
|
$by = 'backupwordpress';
|
||||||
}
|
}
|
||||||
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 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'backupwordpress':
|
case 'backupwordpress':
|
||||||
if ( !is_plugin_active( 'backupwordpress/backupwordpress.php' )) {
|
if ( ! is_plugin_active( 'backupwordpress/backupwordpress.php' )) {
|
||||||
return 0;
|
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 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'updraftplus':
|
case 'updraftplus':
|
||||||
if ( !is_plugin_active( 'updraftplus/updraftplus.php' )) {
|
if ( ! is_plugin_active( 'updraftplus/updraftplus.php' )) {
|
||||||
return 0;
|
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 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1478,7 +1477,8 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sanitize_filename( $filename ) {
|
public static function sanitize_filename( $filename ) {
|
||||||
if (!function_exists('mb_ereg_replace')) { return sanitize_file_name($filename);
|
if ( ! function_exists('mb_ereg_replace')) {
|
||||||
|
return sanitize_file_name($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove anything which isn't a word, whitespace, number
|
// Remove anything which isn't a word, whitespace, number
|
||||||
|
@ -1550,14 +1550,15 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isSSLEnabled() {
|
public static function isSSLEnabled() {
|
||||||
if ( defined( 'MAINWP_NOSSL' ) ) { return !MAINWP_NOSSL;
|
if ( defined( 'MAINWP_NOSSL' ) ) {
|
||||||
|
return ! MAINWP_NOSSL;
|
||||||
}
|
}
|
||||||
return function_exists( 'openssl_verify' );
|
return function_exists( 'openssl_verify' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function is_screen_with_update() {
|
public static function is_screen_with_update() {
|
||||||
|
|
||||||
if ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( defined('DOING_CRON') && DOING_CRON ) ) {
|
if ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( defined('DOING_CRON') && DOING_CRON ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1579,18 +1580,18 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
public static function check_files_exists( $files = array(), $return = false ) {
|
public static function check_files_exists( $files = array(), $return = false ) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($files)) {
|
if (is_array($files)) {
|
||||||
foreach($files as $name) {
|
foreach ($files as $name) {
|
||||||
if (!file_exists( $name )) {
|
if ( ! file_exists( $name )) {
|
||||||
$missing[] = $name;
|
$missing[] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!file_exists( $files )) {
|
if ( ! file_exists( $files )) {
|
||||||
$missing[] = $files;
|
$missing[] = $files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($missing)) {
|
if ( ! empty($missing)) {
|
||||||
$message = 'Missing file(s): ' . implode(',', $missing);
|
$message = 'Missing file(s): ' . implode(',', $missing);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -1604,18 +1605,18 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
public static function check_classes_exists( $classes = array(), $return = false) {
|
public static function check_classes_exists( $classes = array(), $return = false) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($classes)) {
|
if (is_array($classes)) {
|
||||||
foreach($classes as $name) {
|
foreach ($classes as $name) {
|
||||||
if (!class_exists( $name )) {
|
if ( ! class_exists( $name )) {
|
||||||
$missing[] = $name;
|
$missing[] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( !class_exists($classes) ) {
|
if ( ! class_exists($classes) ) {
|
||||||
$missing[] = $classes;
|
$missing[] = $classes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($missing) ) {
|
if ( ! empty($missing) ) {
|
||||||
$message = 'Missing classes: ' . implode(',', $missing);
|
$message = 'Missing classes: ' . implode(',', $missing);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -1630,19 +1631,19 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($methods)) {
|
if (is_array($methods)) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
foreach($methods as $name) {
|
foreach ($methods as $name) {
|
||||||
if ( !method_exists($object, $name) ) {
|
if ( ! method_exists($object, $name) ) {
|
||||||
$missing[] = $name;
|
$missing[] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($methods)) {
|
} elseif ( ! empty($methods)) {
|
||||||
if ( !method_exists($object, $methods) ) {
|
if ( ! method_exists($object, $methods) ) {
|
||||||
$missing[] = $methods;
|
$missing[] = $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($missing) ) {
|
if ( ! empty($missing) ) {
|
||||||
$message = 'Missing method: ' . implode(',', $missing);
|
$message = 'Missing method: ' . implode(',', $missing);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -1657,19 +1658,19 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
public static function check_properties( $object, $properties = array(), $return = false) {
|
public static function check_properties( $object, $properties = array(), $return = false) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($properties)) {
|
if (is_array($properties)) {
|
||||||
foreach($properties as $name) {
|
foreach ($properties as $name) {
|
||||||
if ( !property_exists($object, $name) ) {
|
if ( ! property_exists($object, $name) ) {
|
||||||
$missing[] = $name;
|
$missing[] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($properties)) {
|
} elseif ( ! empty($properties)) {
|
||||||
if ( !property_exists($object, $properties) ) {
|
if ( ! property_exists($object, $properties) ) {
|
||||||
$missing[] = $properties;
|
$missing[] = $properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($missing) ) {
|
if ( ! empty($missing) ) {
|
||||||
$message = 'Missing properties: ' . implode(',', $missing);
|
$message = 'Missing properties: ' . implode(',', $missing);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -1684,19 +1685,19 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
public static function check_functions( $funcs = array(), $return = false) {
|
public static function check_functions( $funcs = array(), $return = false) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($funcs)) {
|
if (is_array($funcs)) {
|
||||||
foreach($funcs as $name) {
|
foreach ($funcs as $name) {
|
||||||
if ( !function_exists( $name) ) {
|
if ( ! function_exists( $name) ) {
|
||||||
$missing[] = $name;
|
$missing[] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($funcs)) {
|
} elseif ( ! empty($funcs)) {
|
||||||
if ( !function_exists($funcs) ) {
|
if ( ! function_exists($funcs) ) {
|
||||||
$missing[] = $funcs;
|
$missing[] = $funcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($missing) ) {
|
if ( ! empty($missing) ) {
|
||||||
$message = 'Missing functions: ' . implode(',', $missing);
|
$message = 'Missing functions: ' . implode(',', $missing);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $message;
|
return $message;
|
||||||
|
@ -1720,10 +1721,9 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
function handle_shutdown() {
|
function handle_shutdown() {
|
||||||
// handle fatal errors and compile errors
|
// handle fatal errors and compile errors
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
if ( isset( $error['type'] ) && isset( $error['message'] ) &&
|
if ( isset( $error['type'] ) && isset( $error['message'] ) &&
|
||||||
( E_ERROR === $error['type'] || E_COMPILE_ERROR === $error['type'] )
|
( E_ERROR === $error['type'] || E_COMPILE_ERROR === $error['type'] )
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
self::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
|
self::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class MainWP_Keyword_Links {
|
||||||
|
|
||||||
|
|
||||||
public function keywordLinksJS() {
|
public function keywordLinksJS() {
|
||||||
if ( ! is_admin() && get_option( 'mainwp_kwl_enable_statistic' ) && !empty($this->keyword_links) ) {
|
if ( ! is_admin() && get_option( 'mainwp_kwl_enable_statistic' ) && ! empty($this->keyword_links) ) {
|
||||||
wp_enqueue_script( 'jquery' );
|
wp_enqueue_script( 'jquery' );
|
||||||
wp_enqueue_script( 'keywordLinks', plugins_url( '/js/keywordlinks.js', dirname( __FILE__ ) ) );
|
wp_enqueue_script( 'keywordLinks', plugins_url( '/js/keywordlinks.js', dirname( __FILE__ ) ) );
|
||||||
add_action( 'wp_head', array( $this, 'head_loading' ), 1 );
|
add_action( 'wp_head', array( $this, 'head_loading' ), 1 );
|
||||||
|
@ -388,7 +388,7 @@ class MainWP_Keyword_Links {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function usort_callback_func( $a, $b) {
|
private function usort_callback_func( $a, $b) {
|
||||||
return strlen($a)<strlen($b);
|
return strlen($a) < strlen($b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function keyword_mark( $matches ) {
|
public function keyword_mark( $matches ) {
|
||||||
|
|
|
@ -275,7 +275,7 @@ class MainWP_Security {
|
||||||
public static function remove_registered_versions() {
|
public static function remove_registered_versions() {
|
||||||
if ( self::get_security_option( 'registered_versions' ) ) {
|
if ( self::get_security_option( 'registered_versions' ) ) {
|
||||||
global $wp_styles;
|
global $wp_styles;
|
||||||
if ( $wp_styles instanceof WP_Styles ) {
|
if ( $wp_styles instanceof WP_Styles ) {
|
||||||
foreach ( $wp_styles->registered as $handle => $style ) {
|
foreach ( $wp_styles->registered as $handle => $style ) {
|
||||||
$wp_styles->registered[ $handle ]->ver = null;
|
$wp_styles->registered[ $handle ]->ver = null;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,8 @@ class MainWP_Security {
|
||||||
//Admin user name is not admin
|
//Admin user name is not admin
|
||||||
public static function admin_user_ok() {
|
public static function admin_user_ok() {
|
||||||
$user = get_user_by( 'login', 'admin' );
|
$user = get_user_by( 'login', 'admin' );
|
||||||
if ( ! $user ) { return true;
|
if ( ! $user ) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 10 !== $user->wp_user_level && ( ! isset( $user->user_level ) || 10 !== $user->user_level ) && ! user_can( $user, 'level_10' ) ) {
|
if ( 10 !== $user->wp_user_level && ( ! isset( $user->user_level ) || 10 !== $user->user_level ) && ! user_can( $user, 'level_10' ) ) {
|
||||||
|
@ -364,7 +365,7 @@ class MainWP_Security {
|
||||||
|
|
||||||
public static function update_security_option( $key, $value ) {
|
public static function update_security_option( $key, $value ) {
|
||||||
$security = get_option( 'mainwp_security' );
|
$security = get_option( 'mainwp_security' );
|
||||||
if ( !empty($key) ) {
|
if ( ! empty($key) ) {
|
||||||
$security[ $key ] = $value;
|
$security[ $key ] = $value;
|
||||||
}
|
}
|
||||||
MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' );
|
||||||
|
|
|
@ -175,12 +175,10 @@ class MainWP_Wordpress_SEO {
|
||||||
$rank = new WPSEO_Rank( WPSEO_Rank::NO_INDEX );
|
$rank = new WPSEO_Rank( WPSEO_Rank::NO_INDEX );
|
||||||
$title = __( 'Post is set to noindex.', 'wordpress-seo' );
|
$title = __( 'Post is set to noindex.', 'wordpress-seo' );
|
||||||
WPSEO_Meta::set_value( 'linkdex', 0, $post_id );
|
WPSEO_Meta::set_value( 'linkdex', 0, $post_id );
|
||||||
}
|
} elseif ( '' === WPSEO_Meta::get_value( 'focuskw', $post_id ) ) {
|
||||||
elseif ( '' === WPSEO_Meta::get_value( 'focuskw', $post_id ) ) {
|
|
||||||
$rank = new WPSEO_Rank( WPSEO_Rank::NO_FOCUS );
|
$rank = new WPSEO_Rank( WPSEO_Rank::NO_FOCUS );
|
||||||
$title = __( 'Focus keyword not set.', 'wordpress-seo' );
|
$title = __( 'Focus keyword not set.', 'wordpress-seo' );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$score = (int) WPSEO_Meta::get_value( 'linkdex', $post_id );
|
$score = (int) WPSEO_Meta::get_value( 'linkdex', $post_id );
|
||||||
$rank = WPSEO_Rank::from_numeric_score( $score );
|
$rank = WPSEO_Rank::from_numeric_score( $score );
|
||||||
$title = $rank->get_label();
|
$title = $rank->get_label();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue