mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-04 07:53:31 +08:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
6b31a10814
commit
579c61e6d2
30 changed files with 1127 additions and 1130 deletions
|
@ -69,7 +69,7 @@ class MainWP_Backup {
|
|||
}
|
||||
|
||||
if ( ( false !== $fileSuffix ) && ! empty( $fileSuffix ) ) {
|
||||
//Append already contains extension!
|
||||
// Append already contains extension!
|
||||
$file = $fileSuffix . ( true === $append ? '' : $ext );
|
||||
} else {
|
||||
$file = 'backup-' . $filePrefix . $timestamp . $ext;
|
||||
|
@ -157,7 +157,7 @@ class MainWP_Backup {
|
|||
}
|
||||
|
||||
public function _zipFilePcl( $files, $archive ) {
|
||||
//Zip this backup folder..
|
||||
// Zip this backup folder..
|
||||
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
|
||||
$this->zip = new PclZip( $archive );
|
||||
|
||||
|
@ -469,16 +469,16 @@ class MainWP_Backup {
|
|||
}
|
||||
|
||||
public function createZipPclFullBackup2( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
//Create backup folder
|
||||
// Create backup folder
|
||||
$backupFolder = dirname( $filepath ) . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR;
|
||||
// @codingStandardsIgnoreStart
|
||||
@mkdir( $backupFolder );
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
//Create DB backup
|
||||
// Create DB backup
|
||||
$db_files = $this->createBackupDB( $backupFolder . 'dbBackup' );
|
||||
|
||||
//Copy installation to backup folder
|
||||
// Copy installation to backup folder
|
||||
$nodes = glob( ABSPATH . '*' );
|
||||
if ( ! $includeCoreFiles ) {
|
||||
$coreFiles = array(
|
||||
|
@ -530,7 +530,7 @@ class MainWP_Backup {
|
|||
// @codingStandardsIgnoreEnd
|
||||
unset( $nodes );
|
||||
|
||||
//Zip this backup folder..
|
||||
// Zip this backup folder..
|
||||
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
|
||||
$this->zip = new PclZip( $filepath );
|
||||
$this->zip->create( $backupFolder, PCLZIP_OPT_REMOVE_PATH, $backupFolder );
|
||||
|
@ -546,7 +546,7 @@ class MainWP_Backup {
|
|||
|
||||
$this->addFileFromStringToPCLZip( 'clone/config.txt', $string, $filepath );
|
||||
}
|
||||
//Remove backup folder
|
||||
// Remove backup folder
|
||||
MainWP_Helper::delete_dir( $backupFolder );
|
||||
|
||||
return true;
|
||||
|
@ -660,7 +660,7 @@ class MainWP_Backup {
|
|||
$this->zipArchiveSizeCount += filesize( $path );
|
||||
$this->gcCnt ++;
|
||||
|
||||
//5 mb limit!
|
||||
// 5 mb limit!
|
||||
if ( ! $this->loadFilesBeforeZip || ( filesize( $path ) > 5 * 1024 * 1024 ) ) {
|
||||
$this->zipArchiveFileCount ++;
|
||||
$added = $this->zip->addFile( $path, $zipEntryName );
|
||||
|
@ -686,7 +686,7 @@ class MainWP_Backup {
|
|||
$this->gcCnt = 0;
|
||||
}
|
||||
|
||||
//Over limits?
|
||||
// Over limits?
|
||||
if ( ( ( $this->file_descriptors > 0 ) && ( $this->zipArchiveFileCount > $this->file_descriptors ) ) ) { // || $this->zipArchiveSizeCount >= (31457280 * 2))
|
||||
$this->zip->close();
|
||||
$this->zip = null;
|
||||
|
@ -725,7 +725,7 @@ class MainWP_Backup {
|
|||
global $wpdb;
|
||||
|
||||
$db_files = array();
|
||||
//Get all the tables
|
||||
// Get all the tables
|
||||
$tables_db = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
||||
foreach ( $tables_db as $curr_table ) {
|
||||
if ( null !== $archiver ) {
|
||||
|
@ -739,11 +739,11 @@ class MainWP_Backup {
|
|||
if ( file_exists( $currentfile ) ) {
|
||||
continue;
|
||||
}
|
||||
$fh = fopen( $currentfile . '.tmp', 'w' ); //or error;
|
||||
$fh = fopen( $currentfile . '.tmp', 'w' ); // or error;
|
||||
|
||||
fwrite( $fh, "\n\n" . 'DROP TABLE IF EXISTS ' . $table . ';' );
|
||||
//todo fix this
|
||||
//$table_create = $wpdb->get_row( $wpdb->prepare( 'SHOW CREATE TABLE %s', $table ), ARRAY_N );
|
||||
// todo fix this
|
||||
// $table_create = $wpdb->get_row( $wpdb->prepare( 'SHOW CREATE TABLE %s', $table ), ARRAY_N );
|
||||
$table_create = $wpdb->get_row( 'SHOW CREATE TABLE ' . $table, ARRAY_N );
|
||||
fwrite( $fh, "\n" . $table_create[1] . ";\n\n" );
|
||||
|
||||
|
@ -804,7 +804,7 @@ class MainWP_Backup {
|
|||
@unlink( $db_file );
|
||||
}
|
||||
} else {
|
||||
//todo: throw exception!
|
||||
// todo: throw exception!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
|
||||
public function __construct() {
|
||||
// To fix bug run dashboard on local machine
|
||||
//if ( is_plugin_active( 'backupbuddy/backupbuddy.php' )) {
|
||||
// if ( is_plugin_active( 'backupbuddy/backupbuddy.php' )) {
|
||||
if ( class_exists('pb_backupbuddy')) {
|
||||
$this->is_backupbuddy_installed = true;
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
$information = array();
|
||||
$information['backup_list'] = $this->get_backup_list();
|
||||
$information['recent_backup_list'] = $this->get_recent_backup_list();
|
||||
//$information['destinations_list'] = pb_backupbuddy_destinations::get_destinations_list();
|
||||
// $information['destinations_list'] = pb_backupbuddy_destinations::get_destinations_list();
|
||||
$backup_directory = backupbuddy_core::getBackupDirectory();
|
||||
$backup_directory = str_replace( '\\', '/', $backup_directory );
|
||||
$backup_directory = rtrim( $backup_directory, '/\\' ) . '/';
|
||||
|
@ -847,7 +847,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
$comment = backupbuddy_core::normalize_comment_data( $old_comment );
|
||||
$comment['note'] = $note;
|
||||
|
||||
//$new_comment = base64_encode( serialize( $comment ) );
|
||||
// $new_comment = base64_encode( serialize( $comment ) );
|
||||
|
||||
$comment_result = pb_backupbuddy::$classes['zipbuddy']->set_comment( $backup_file, $comment );
|
||||
|
||||
|
@ -1149,16 +1149,16 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
unset( $temp_dir );
|
||||
|
||||
$message = 'Extracting "' . $file . '" from archive "' . $archive_file . '" into temporary file "' . $destination . '". ';
|
||||
//echo '<!-- ';
|
||||
// echo '<!-- ';
|
||||
pb_backupbuddy::status( 'details', $message );
|
||||
//echo $message;
|
||||
// echo $message;
|
||||
|
||||
$file_content = '';
|
||||
|
||||
$extractions = array( $file => $temp_file );
|
||||
$extract_result = $zipbuddy->extract( backupbuddy_core::getBackupDirectory() . $archive_file, $destination, $extractions );
|
||||
if ( false === $extract_result ) { // failed.
|
||||
//echo ' -->';
|
||||
// echo ' -->';
|
||||
$error = 'Error #584984458. Unable to extract.';
|
||||
pb_backupbuddy::status( 'error', $error );
|
||||
return array( 'error' => $error );
|
||||
|
@ -1539,7 +1539,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
<?php
|
||||
foreach ( (array) $lines as $rawline ) {
|
||||
$line = json_decode( $rawline, true );
|
||||
//print_r( $line );
|
||||
// print_r( $line );
|
||||
if ( is_array( $line ) ) {
|
||||
$u = '';
|
||||
if ( isset( $line['u'] ) ) { // As off v4.2.15.6. TODO: Remove this in a couple of versions once old logs without this will have cycled out.
|
||||
|
@ -1598,7 +1598,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
}
|
||||
}
|
||||
|
||||
//***** BEGIN TESTS AND RESULTS.
|
||||
// ***** BEGIN TESTS AND RESULTS.
|
||||
if ( isset( $integrity['status_details'] ) ) { // $integrity['status_details'] is NOT array (old, pre-3.1.9).
|
||||
echo '<h3>Integrity Technical Details</h3>';
|
||||
echo '<textarea style="width: 100%; height: 175px;" wrap="off">';
|
||||
|
@ -1662,7 +1662,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
|
||||
} // end $integrity['status_details'] is an array.
|
||||
echo '<br><br>';
|
||||
//***** END TESTS AND RESULTS.
|
||||
// ***** END TESTS AND RESULTS.
|
||||
|
||||
// Output meta info table (if any).
|
||||
$metaInfo = array();
|
||||
|
@ -1679,7 +1679,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
}
|
||||
echo '<br><br>';
|
||||
|
||||
//***** BEGIN STEPS.
|
||||
// ***** BEGIN STEPS.
|
||||
$steps = array();
|
||||
$steps[] = array( 'Start Time', $start_time, '' );
|
||||
if ( isset( $backup_options->options['steps'] ) ) {
|
||||
|
@ -1776,7 +1776,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
);
|
||||
}
|
||||
echo '<br><br>';
|
||||
//***** END STEPS.
|
||||
// ***** END STEPS.
|
||||
|
||||
if ( isset( $backup_options->options['trigger'] ) ) {
|
||||
$trigger = $backup_options->options['trigger'];
|
||||
|
@ -2229,7 +2229,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
delete_transient( 'pb_backupbuddy_malwarescan' );
|
||||
}
|
||||
|
||||
//echo '<br />Scanning `' . $url . '`.<br /><br />';
|
||||
// echo '<br />Scanning `' . $url . '`.<br /><br />';
|
||||
if ( ! defined( 'pluginbuddy_importbuddy' ) ) {
|
||||
$scan = get_transient( 'pb_backupbuddy_malwarescan' );
|
||||
} else {
|
||||
|
@ -2272,9 +2272,9 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
$continue_2 = false;
|
||||
} else {
|
||||
$scan = maybe_unserialize( $scan );
|
||||
//echo '<pre>';
|
||||
//print_r( $scan );
|
||||
//echo '</pre>';
|
||||
// echo '<pre>';
|
||||
// print_r( $scan );
|
||||
// echo '</pre>';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2294,7 +2294,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
$array[ $array_key ] = lined_array( $array_item );
|
||||
}
|
||||
}
|
||||
//return implode( '<br />', $array );
|
||||
// return implode( '<br />', $array );
|
||||
$return = '';
|
||||
foreach ( $array as $array_item ) {
|
||||
$return .= $array_item . '<br />';
|
||||
|
@ -2653,7 +2653,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
}
|
||||
|
||||
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.
|
||||
|
||||
backupbuddy_live::send_trim_settings();
|
||||
|
@ -2713,7 +2713,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
|
||||
} elseif ( 'create_snapshot' == $action ) { // < 100% backed up _OR_ ( we are on a step other than daily_init and the last_activity is more recent than the php runtime )
|
||||
if ( true === backupbuddy_api::runLiveSnapshot() ) {
|
||||
//pb_backupbuddy::alert( '<h3>' . __( 'Verifying everything is up to date before Snapshot', 'it-l10n-backupbuddy' ) . '</h3><p class="description" style="max-width: 700px; display: inline-block;">' . __( 'Please wait while we verify your backup is completely up to date before we create the Snapshot. This may take a few minutes...', 'it-l10n-backupbuddy' ) . '</p>', false, '', 'backupbuddy_live_snapshot_verify_uptodate' );
|
||||
// pb_backupbuddy::alert( '<h3>' . __( 'Verifying everything is up to date before Snapshot', 'it-l10n-backupbuddy' ) . '</h3><p class="description" style="max-width: 700px; display: inline-block;">' . __( 'Please wait while we verify your backup is completely up to date before we create the Snapshot. This may take a few minutes...', 'it-l10n-backupbuddy' ) . '</p>', false, '', 'backupbuddy_live_snapshot_verify_uptodate' );
|
||||
$message = '<h3>' . __( 'Verifying everything is up to date before Snapshot', 'it-l10n-backupbuddy' ) . '</h3><p class="description" style="max-width: 700px; display: inline-block;">' . __( 'Please wait while we verify your backup is completely up to date before we create the Snapshot. This may take a few minutes...', 'it-l10n-backupbuddy' ) . '</p>';
|
||||
require pb_backupbuddy::plugin_path() . '/destinations/live/_manual_snapshot.php';
|
||||
}
|
||||
|
@ -2721,7 +2721,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
} elseif ( 'pause_periodic' == $action ) {
|
||||
backupbuddy_api::setLiveStatus( $pause_continuous = '', $pause_periodic = true );
|
||||
$destination = pb_backupbuddy::$options['remote_destinations'][ $destination_id ]; // Update local var.
|
||||
//pb_backupbuddy::disalert( '', __( 'Live File Backup paused. It may take a moment for current processes to finish.', 'it-l10n-backupbuddy' ) );
|
||||
// pb_backupbuddy::disalert( '', __( 'Live File Backup paused. It may take a moment for current processes to finish.', 'it-l10n-backupbuddy' ) );
|
||||
$message = __( 'Live File Backup paused. It may take a moment for current processes to finish.', 'it-l10n-backupbuddy' );
|
||||
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
|
||||
} elseif ( 'resume_periodic' == $action ) {
|
||||
|
@ -2733,20 +2733,20 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
}
|
||||
|
||||
backupbuddy_api::setLiveStatus( $pause_continuous = '', $pause_periodic = false, $start_run );
|
||||
//pb_backupbuddy::disalert( '', __( 'Live File Backup has resumed.', 'it-l10n-backupbuddy' ) . $launchNowText );
|
||||
// pb_backupbuddy::disalert( '', __( 'Live File Backup has resumed.', 'it-l10n-backupbuddy' ) . $launchNowText );
|
||||
$message = __( 'Live File Backup has resumed.', 'it-l10n-backupbuddy' ) . $launchNowText;
|
||||
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
|
||||
} elseif ( 'pause_continuous' == $action ) {
|
||||
backupbuddy_api::setLiveStatus( $pause_continuous = true, $pause_periodic = '' );
|
||||
$destination = pb_backupbuddy::$options['remote_destinations'][ $destination_id ]; // Update local var.
|
||||
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
|
||||
//pb_backupbuddy::disalert( '', __( 'Live Database Backup paused.', 'it-l10n-backupbuddy' ) );
|
||||
// pb_backupbuddy::disalert( '', __( 'Live Database Backup paused.', 'it-l10n-backupbuddy' ) );
|
||||
$message = __( 'Live Database Backup paused.', 'it-l10n-backupbuddy' );
|
||||
} elseif ( 'resume_continuous' == $action ) {
|
||||
backupbuddy_api::setLiveStatus( $pause_continuous = false, $pause_periodic = '' );
|
||||
$destination = pb_backupbuddy::$options['remote_destinations'][ $destination_id ]; // Update local var.
|
||||
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
|
||||
//pb_backupbuddy::disalert( '', __( 'Live Database Backup resumed.', 'it-l10n-backupbuddy' ) );
|
||||
// pb_backupbuddy::disalert( '', __( 'Live Database Backup resumed.', 'it-l10n-backupbuddy' ) );
|
||||
$message = __( 'Live Database Backup resumed.', 'it-l10n-backupbuddy' );
|
||||
} else {
|
||||
$error = 'Error #1000. Invalid request.';
|
||||
|
@ -2795,7 +2795,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
$site_only = true;
|
||||
}
|
||||
|
||||
$files = pb_backupbuddy_destination_stash2::listFiles( $settings, '', $site_only ); //2nd param was $remotePath.
|
||||
$files = pb_backupbuddy_destination_stash2::listFiles( $settings, '', $site_only ); // 2nd param was $remotePath.
|
||||
if ( ! is_array( $files ) ) {
|
||||
return array( 'error' => 'Error #892329c: ' . $files );
|
||||
}
|
||||
|
|
|
@ -586,7 +586,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
?>
|
||||
<div class="hmbkp-exclude-settings">
|
||||
|
||||
<?php //if ( $schedule->get_excludes() ) : ?>
|
||||
<?php // if ( $schedule->get_excludes() ) : ?>
|
||||
|
||||
<h3>
|
||||
<?php esc_html_e( 'Currently Excluded', 'backupwordpress' ); ?>
|
||||
|
@ -658,7 +658,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
</table>
|
||||
|
||||
<?php //endif; ?>
|
||||
<?php // endif; ?>
|
||||
|
||||
<h3 id="directory-listing"><?php esc_html_e( 'Your Site', 'backupwordpress' ); ?></h3>
|
||||
|
||||
|
@ -889,7 +889,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
<?php
|
||||
} elseif ( $file->isDir() ) {
|
||||
//echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) );
|
||||
// echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) );
|
||||
?>
|
||||
<code title="<?php echo esc_attr( $file->getRealPath() ); ?>"><a
|
||||
href="#"
|
||||
|
@ -1163,11 +1163,11 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
return array( 'error' => 'Error: Schedule data' );
|
||||
}
|
||||
|
||||
// $current_value = get_option( 'hmbkp_schedule_' . $sch_id );
|
||||
// if ( is_array( $current_value ) && isset( $current_value['excludes'] ) ) {
|
||||
// // do not update 'excludes' value
|
||||
// $options['excludes'] = $current_value['excludes'];
|
||||
// }
|
||||
// $current_value = get_option( 'hmbkp_schedule_' . $sch_id );
|
||||
// if ( is_array( $current_value ) && isset( $current_value['excludes'] ) ) {
|
||||
// do not update 'excludes' value
|
||||
// $options['excludes'] = $current_value['excludes'];
|
||||
// }
|
||||
|
||||
$filter_opts = array(
|
||||
'type',
|
||||
|
|
|
@ -96,7 +96,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
MainWP_Helper::check_methods('get_instance');
|
||||
BackWPup::get_instance();
|
||||
|
||||
//add_action( 'wp_ajax_mainwp_backwpup_download_backup', array( $this, 'download_backup' ) );
|
||||
// add_action( 'wp_ajax_mainwp_backwpup_download_backup', array( $this, 'download_backup' ) );
|
||||
add_action( 'admin_init', array( $this, 'init_download_backup' ) );
|
||||
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
$log_folder = BackWPup_File::get_absolute_path( $log_folder );
|
||||
$log_folder = untrailingslashit( $log_folder );
|
||||
|
||||
//load logs
|
||||
// load logs
|
||||
$logfiles = array();
|
||||
if ( is_readable( $log_folder ) && $dir = opendir( $log_folder ) ) {
|
||||
while ( ( $file = readdir( $dir ) ) !== false ) {
|
||||
|
@ -518,7 +518,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
echo '<tr title="WP_MEMORY_LIMIT"><td>' . __( 'WP memory limit', 'backwpup' ) . '</td><td>' . esc_html( WP_MEMORY_LIMIT ) . '</td></tr>';
|
||||
echo '<tr title="WP_MAX_MEMORY_LIMIT"><td>' . __( 'WP maximum memory limit', 'backwpup' ) . '</td><td>' . esc_html( WP_MAX_MEMORY_LIMIT ) . '</td></tr>';
|
||||
echo '<tr title=""><td>' . __( 'Memory in use', 'backwpup' ) . '</td><td>' . esc_html( size_format( @memory_get_usage( true ), 2 ) ) . '</td></tr>';
|
||||
//disabled PHP functions
|
||||
// disabled PHP functions
|
||||
$disabled = ini_get( 'disable_functions' );
|
||||
if ( ! empty( $disabled ) ) {
|
||||
$disabledarry = explode( ',', $disabled );
|
||||
|
@ -526,7 +526,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
echo esc_html( implode( ', ', $disabledarry ) );
|
||||
echo '</td></tr>';
|
||||
}
|
||||
//Loaded PHP Extensions
|
||||
// Loaded PHP Extensions
|
||||
echo '<tr title=""><td>' . __( 'Loaded PHP Extensions:', 'backwpup' ) . '</td><td>';
|
||||
$extensions = get_loaded_extensions();
|
||||
sort( $extensions );
|
||||
|
@ -1049,7 +1049,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
|
||||
// From BackWPup_Destination_Email::edit_ajax
|
||||
if ( $emailmethod ) {
|
||||
//do so if i'm the wp_mail to get the settings
|
||||
// do so if i'm the wp_mail to get the settings
|
||||
global $phpmailer;
|
||||
// (Re)create it, if it's gone missing
|
||||
if ( ! is_object( $phpmailer ) || ! $phpmailer instanceof PHPMailer ) {
|
||||
|
@ -1057,10 +1057,10 @@ class MainWP_Child_Back_WP_Up {
|
|||
require_once ABSPATH . WPINC . '/class-smtp.php';
|
||||
$phpmailer = new PHPMailer( true );
|
||||
}
|
||||
//only if PHPMailer really used
|
||||
// only if PHPMailer really used
|
||||
if ( is_object( $phpmailer ) ) {
|
||||
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
|
||||
//get settings from PHPMailer
|
||||
// get settings from PHPMailer
|
||||
$emailmethod = $phpmailer->Mailer;
|
||||
$emailsendmail = $phpmailer->Sendmail;
|
||||
$emailhost = $phpmailer->Host;
|
||||
|
@ -1071,7 +1071,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
}
|
||||
}
|
||||
|
||||
//Generate mail with Swift Mailer
|
||||
// Generate mail with Swift Mailer
|
||||
if ( ! class_exists( 'Swift', false ) ) {
|
||||
require BackWPup::get_plugin_data( 'plugindir' ) . '/vendor/SwiftMailer/swift_required.php';
|
||||
}
|
||||
|
@ -1430,7 +1430,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
if ( $settings['job_id'] > 0 ) {
|
||||
$job_id = intval( $settings['job_id'] );
|
||||
} else {
|
||||
//generate jobid if not exists
|
||||
// generate jobid if not exists
|
||||
$newjobid = BackWPup_Option::get_job_ids();
|
||||
sort( $newjobid );
|
||||
$job_id = end( $newjobid ) + 1;
|
||||
|
@ -1452,7 +1452,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
if ($settings['tab'] == 'jobtype-FILE') {
|
||||
// to fix
|
||||
$this->edit_form_post_save($settings['value'], $job_id);
|
||||
//saved message
|
||||
// saved message
|
||||
$messages = BackWPup_Admin::get_messages();
|
||||
if ( empty( $messages['error'] ) ) {
|
||||
$url = BackWPup_Job::get_jobrun_url( 'runnowlink', $job_id );
|
||||
|
|
|
@ -110,7 +110,7 @@ class MainWP_Child_Branding {
|
|||
'mainwp_branding_remove_wp_tools',
|
||||
'mainwp_branding_remove_wp_setting',
|
||||
'mainwp_branding_remove_permalink',
|
||||
//'mainwp_branding_plugin_header', // don't remove header
|
||||
// 'mainwp_branding_plugin_header', // don't remove header
|
||||
'mainwp_branding_button_contact_label',
|
||||
'mainwp_branding_send_email_message',
|
||||
'mainwp_branding_message_return_sender',
|
||||
|
@ -136,7 +136,7 @@ class MainWP_Child_Branding {
|
|||
'remove_wp_tools',
|
||||
'remove_wp_setting',
|
||||
'remove_permalink',
|
||||
//'branding_header', // don't remove header
|
||||
// 'branding_header', // don't remove header
|
||||
'contact_label',
|
||||
'email_message',
|
||||
'message_return_sender',
|
||||
|
@ -174,7 +174,7 @@ class MainWP_Child_Branding {
|
|||
$current_settings = $this->child_branding_options;
|
||||
$current_extra_setting = $this->child_branding_options['extra_settings'];
|
||||
|
||||
//MainWP_Helper::update_option( 'mainwp_branding_ext_enabled', 'Y' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_ext_enabled', 'Y' );
|
||||
$current_settings['branding_ext_enabled'] = 'Y';
|
||||
|
||||
$header = array(
|
||||
|
@ -187,22 +187,22 @@ class MainWP_Child_Branding {
|
|||
|
||||
MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'], 'yes' ); // to compatible with old version of child report plugin
|
||||
MainWP_Helper::update_option( 'mainwp_branding_plugin_header', $header, 'yes' ); // to compatible
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_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'] ) ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
||||
// }
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_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'] ) ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
||||
// }
|
||||
|
||||
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
||||
$current_settings['branding_header'] = $header;
|
||||
|
@ -266,7 +266,7 @@ class MainWP_Child_Branding {
|
|||
$extra_setting['login_image'] = array();
|
||||
} else {
|
||||
try {
|
||||
$upload = $this->uploadImage( $settings['child_login_image_url'] ); //Upload image to WP
|
||||
$upload = $this->uploadImage( $settings['child_login_image_url'] ); // Upload image to WP
|
||||
if ( null !== $upload ) {
|
||||
$extra_setting['login_image'] = array(
|
||||
'path' => $upload['path'],
|
||||
|
@ -292,7 +292,7 @@ class MainWP_Child_Branding {
|
|||
$extra_setting['favico_image'] = array();
|
||||
} else {
|
||||
try {
|
||||
$upload = $this->uploadImage( $settings['child_favico_image_url'] ); //Upload image to WP
|
||||
$upload = $this->uploadImage( $settings['child_favico_image_url'] ); // Upload image to WP
|
||||
if ( null !== $upload ) {
|
||||
$extra_setting['favico_image'] = array(
|
||||
'path' => $upload['path'],
|
||||
|
@ -313,7 +313,7 @@ class MainWP_Child_Branding {
|
|||
$extra_setting['favico_image'] = $current_extra_setting['favico_image'];
|
||||
}
|
||||
|
||||
//MainWP_Helper::update_option( 'mainwp_branding_extra_settings', $extra_setting, 'yes' );
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_extra_settings', $extra_setting, 'yes' );
|
||||
$current_settings['extra_settings'] = $extra_setting;
|
||||
|
||||
// keep it to compatible with old version of child reports plugin
|
||||
|
@ -323,23 +323,23 @@ class MainWP_Child_Branding {
|
|||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', '' );
|
||||
}
|
||||
//
|
||||
// if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_show_support', '' );
|
||||
// }
|
||||
// if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_show_support', '' );
|
||||
// }
|
||||
|
||||
// if ( $settings['child_disable_change'] ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' );
|
||||
// }
|
||||
// if ( $settings['child_disable_change'] ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' );
|
||||
// }
|
||||
|
||||
// if ( $settings['child_disable_switching_theme'] ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' );
|
||||
// }
|
||||
// if ( $settings['child_disable_switching_theme'] ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' );
|
||||
// } else {
|
||||
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' );
|
||||
// }
|
||||
|
||||
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
||||
$current_settings['show_support'] = ( $settings['child_show_support_button'] && ! empty($settings['child_support_email']) ) ? 'T' : '';
|
||||
|
@ -354,10 +354,10 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
|
||||
static function uploadImage( $img_url ) {
|
||||
include_once ABSPATH . 'wp-admin/includes/file.php'; //Contains download_url
|
||||
include_once ABSPATH . 'wp-admin/includes/file.php'; // Contains download_url
|
||||
global $mainWPChild;
|
||||
add_filter( 'http_request_args', array( $mainWPChild, 'http_request_reject_unsafe_urls' ), 99, 2 );
|
||||
//Download $img_url
|
||||
// Download $img_url
|
||||
$temporary_file = download_url( $img_url );
|
||||
remove_filter( 'http_request_args', array( $mainWPChild, 'http_request_reject_unsafe_urls' ), 99, 2 );
|
||||
|
||||
|
@ -365,7 +365,7 @@ class MainWP_Child_Branding {
|
|||
throw new Exception( 'Error: ' . $temporary_file->get_error_message() );
|
||||
} else {
|
||||
$upload_dir = wp_upload_dir();
|
||||
$local_img_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . basename( $img_url ); //Local name
|
||||
$local_img_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . basename( $img_url ); // Local name
|
||||
$local_img_path = dirname( $local_img_path ) . '/' . wp_unique_filename( dirname( $local_img_path ), basename( $local_img_path ) );
|
||||
$local_img_url = $upload_dir['url'] . '/' . basename( $local_img_path );
|
||||
$moved = @rename( $temporary_file, $local_img_path );
|
||||
|
@ -444,8 +444,7 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
|
||||
// to fix
|
||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );//
|
||||
if ( ! isset($opts['disable_wp_branding']) || $opts['disable_wp_branding'] !== 'Y' ) {
|
||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) ); if ( ! isset($opts['disable_wp_branding']) || $opts['disable_wp_branding'] !== 'Y' ) {
|
||||
add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 );
|
||||
add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 );
|
||||
// branding site generator
|
||||
|
@ -461,7 +460,7 @@ class MainWP_Child_Branding {
|
|||
add_filter( 'login_headertext', array( &$this, 'custom_login_headertitle' ) );
|
||||
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
||||
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
||||
//remove_filter( 'update_footer', 'core_update_footer' );
|
||||
// remove_filter( 'update_footer', 'core_update_footer' );
|
||||
add_filter( 'update_footer', array( &$this, 'core_update_footer' ), 14 );
|
||||
add_filter( 'admin_footer_text', array( &$this, 'admin_footer_text' ), 14 );
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class MainWP_Child_DB {
|
||||
//Support old & new versions of WordPress (3.9+)
|
||||
// Support old & new versions of WordPress (3.9+)
|
||||
public static function use_mysqli() {
|
||||
/** @var $wpdb wpdb */
|
||||
if ( ! function_exists( 'mysqli_connect' ) ) {
|
||||
|
|
|
@ -194,14 +194,14 @@ class MainWP_Child_iThemes_Security {
|
|||
'404-detection',
|
||||
'network-brute-force',
|
||||
'ssl',
|
||||
//'strong-passwords',
|
||||
// 'strong-passwords',
|
||||
'password-requirements',
|
||||
'system-tweaks',
|
||||
'wordpress-tweaks',
|
||||
'multisite-tweaks',
|
||||
'notification-center',
|
||||
//'salts',
|
||||
//'content-directory',
|
||||
// 'salts',
|
||||
// 'content-directory',
|
||||
);
|
||||
|
||||
$require_permalinks = false;
|
||||
|
@ -369,7 +369,7 @@ class MainWP_Child_iThemes_Security {
|
|||
} elseif ( $results['saved'] ) {
|
||||
ITSEC_Modules::activate( 'network-brute-force' );
|
||||
$nbf_settings = ITSEC_Modules::get_settings( 'network-brute-force' );
|
||||
// ITSEC_Response::set_response( '<p>' . __( 'Your site is now using Network Brute Force Protection.', 'better-wp-security' ) . '</p>' );
|
||||
// ITSEC_Response::set_response( '<p>' . __( 'Your site is now using Network Brute Force Protection.', 'better-wp-security' ) . '</p>' );
|
||||
}
|
||||
}
|
||||
if ($nbf_settings !== null) {
|
||||
|
@ -409,15 +409,15 @@ class MainWP_Child_iThemes_Security {
|
|||
$key = ITSEC_Network_Brute_Force_Utilities::get_api_key( $settings['email'], $settings['updates_optin'] );
|
||||
if ( is_wp_error( $key ) ) {
|
||||
return false;
|
||||
// $this->set_can_save( false );
|
||||
// $this->add_error( $key );
|
||||
// $this->set_can_save( false );
|
||||
// $this->add_error( $key );
|
||||
} else {
|
||||
$secret = ITSEC_Network_Brute_Force_Utilities::activate_api_key( $key );
|
||||
|
||||
if ( is_wp_error( $secret ) ) {
|
||||
return false;
|
||||
// $this->set_can_save( false );
|
||||
// $this->add_error( $secret );
|
||||
// $this->set_can_save( false );
|
||||
// $this->add_error( $secret );
|
||||
} else {
|
||||
$settings['api_key'] = $key;
|
||||
$settings['api_secret'] = $secret;
|
||||
|
@ -697,7 +697,7 @@ class MainWP_Child_iThemes_Security {
|
|||
$new_username = isset( $settings['new_username'] ) ? $settings['new_username'] : '';
|
||||
$change_id = isset( $settings['change_id'] ) && $settings['change_id'] ? true : false;
|
||||
|
||||
//load utility functions
|
||||
// load utility functions
|
||||
if ( ! class_exists( 'ITSEC_Lib' ) ) {
|
||||
global $itsec_globals;
|
||||
require ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php';
|
||||
|
@ -723,13 +723,13 @@ class MainWP_Child_iThemes_Security {
|
|||
$msg .= __( 'Admin user ID already changes.', 'mainwp-child' );
|
||||
}
|
||||
|
||||
// if ( $change_id ) {
|
||||
// $user = get_user_by( 'login', $new_username );
|
||||
// if ( $user && 1 === (int) $user->ID ) {
|
||||
// $return['result'] = 'CHILD_ADMIN';
|
||||
// return $return;
|
||||
// }
|
||||
// }
|
||||
// if ( $change_id ) {
|
||||
// $user = get_user_by( 'login', $new_username );
|
||||
// if ( $user && 1 === (int) $user->ID ) {
|
||||
// $return['result'] = 'CHILD_ADMIN';
|
||||
// return $return;
|
||||
// }
|
||||
// }
|
||||
|
||||
$admin_success = true;
|
||||
$return = array();
|
||||
|
@ -755,26 +755,26 @@ class MainWP_Child_iThemes_Security {
|
|||
$itsec_files = ITSEC_Core::get_itsec_files();
|
||||
|
||||
// do not need to check this
|
||||
//if ( $itsec_files->get_file_lock( 'admin_user' ) ) { //make sure it isn't already running
|
||||
// if ( $itsec_files->get_file_lock( 'admin_user' ) ) { //make sure it isn't already running
|
||||
|
||||
//sanitize the username
|
||||
// sanitize the username
|
||||
$new_user = sanitize_text_field( $username );
|
||||
|
||||
//Get the full user object
|
||||
// Get the full user object
|
||||
$user_object = get_user_by( 'id', '1' );
|
||||
|
||||
if ( null !== $username && validate_username( $new_user ) && false === username_exists( $new_user ) ) { //there is a valid username to change
|
||||
if ( null !== $username && validate_username( $new_user ) && false === username_exists( $new_user ) ) { // there is a valid username to change
|
||||
|
||||
if ( true === $id ) { //we're changing the id too so we'll set the username
|
||||
if ( true === $id ) { // we're changing the id too so we'll set the username
|
||||
|
||||
$user_login = $new_user;
|
||||
|
||||
} else { // we're only changing the username
|
||||
|
||||
//query main user table
|
||||
// query main user table
|
||||
$wpdb->query( 'UPDATE `' . $wpdb->users . "` SET user_login = '" . esc_sql( $new_user ) . "' WHERE user_login='admin';" );
|
||||
|
||||
if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation
|
||||
if ( is_multisite() ) { // process sitemeta if we're in a multi-site situation
|
||||
|
||||
$oldAdmins = $wpdb->get_var( 'SELECT meta_value FROM `' . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" );
|
||||
$newAdmins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . esc_sql( $new_user ) . '"', $oldAdmins );
|
||||
|
@ -787,19 +787,19 @@ class MainWP_Child_iThemes_Security {
|
|||
return true;
|
||||
|
||||
}
|
||||
} elseif ( null !== $username ) { //username didn't validate
|
||||
} elseif ( null !== $username ) { // username didn't validate
|
||||
|
||||
$itsec_files->release_file_lock( 'admin_user' );
|
||||
|
||||
return false;
|
||||
|
||||
} else { //only changing the id
|
||||
} else { // only changing the id
|
||||
|
||||
$user_login = $user_object->user_login;
|
||||
|
||||
}
|
||||
|
||||
if ( true === $id ) { //change the user id
|
||||
if ( true === $id ) { // change the user id
|
||||
|
||||
$wpdb->query( 'DELETE FROM `' . $wpdb->users . '` WHERE ID = 1;' );
|
||||
|
||||
|
@ -815,7 +815,7 @@ class MainWP_Child_iThemes_Security {
|
|||
'display_name' => $user_object->display_name,
|
||||
) );
|
||||
|
||||
if ( is_multisite() && null !== $username && validate_username( $new_user ) ) { //process sitemeta if we're in a multi-site situation
|
||||
if ( is_multisite() && null !== $username && validate_username( $new_user ) ) { // process sitemeta if we're in a multi-site situation
|
||||
|
||||
$oldAdmins = $wpdb->get_var( 'SELECT meta_value FROM `' . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" );
|
||||
$newAdmins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . esc_sql( $new_user ) . '"', $oldAdmins );
|
||||
|
@ -836,13 +836,13 @@ class MainWP_Child_iThemes_Security {
|
|||
return true;
|
||||
|
||||
}
|
||||
//}
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function build_wpconfig_rules( $rules_array, $input = null ) {
|
||||
//Get the rules from the database if input wasn't sent
|
||||
// Get the rules from the database if input wasn't sent
|
||||
if ( null === $input ) {
|
||||
return $rules_array;
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ class MainWP_Child_Links_Checker {
|
|||
global $wpdb;
|
||||
/** @var wpdb $wpdb */
|
||||
|
||||
//Delete all discovered instances
|
||||
// Delete all discovered instances
|
||||
$wpdb->query( "TRUNCATE {$wpdb->prefix}blc_instances" );
|
||||
|
||||
//Delete all discovered links
|
||||
// Delete all discovered links
|
||||
$wpdb->query( "TRUNCATE {$wpdb->prefix}blc_links" );
|
||||
|
||||
//Mark all posts, custom fields and bookmarks for processing.
|
||||
// Mark all posts, custom fields and bookmarks for processing.
|
||||
blc_resynch( true );
|
||||
}
|
||||
|
||||
|
@ -158,18 +158,18 @@ class MainWP_Child_Links_Checker {
|
|||
}
|
||||
blc_init();
|
||||
|
||||
//Get the container type matching the type of the deleted post
|
||||
// Get the container type matching the type of the deleted post
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post ) {
|
||||
return;
|
||||
}
|
||||
//Get the associated container object
|
||||
// Get the associated container object
|
||||
$post_container = blcContainerHelper::get_container( array( $post->post_type, intval( $post_id ) ) );
|
||||
|
||||
if ( $post_container ) {
|
||||
//Delete it
|
||||
// Delete it
|
||||
$post_container->delete();
|
||||
//Clean up any dangling links
|
||||
// Clean up any dangling links
|
||||
blc_cleanup_links();
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ class MainWP_Child_Links_Checker {
|
|||
'last_success',
|
||||
'may_recheck',
|
||||
'false_positive',
|
||||
//'result_hash',
|
||||
// 'result_hash',
|
||||
'dismissed',
|
||||
'status_text',
|
||||
'status_code',
|
||||
|
@ -374,7 +374,7 @@ class MainWP_Child_Links_Checker {
|
|||
|
||||
$days_broken = 0;
|
||||
if ( $link->broken ) {
|
||||
//Add a highlight to broken links that appear to be permanently broken
|
||||
// Add a highlight to broken links that appear to be permanently broken
|
||||
$days_broken = intval( ( time() - $link->first_failure ) / ( 3600 * 24 ) );
|
||||
if ( $days_broken >= $blc_option['failure_duration_threshold'] ) {
|
||||
$extra_info['permanently_broken'] = 1;
|
||||
|
@ -433,7 +433,7 @@ class MainWP_Child_Links_Checker {
|
|||
$link_texts = $can_edit_text ? $editable_link_texts : $non_editable_link_texts;
|
||||
$data_link_text = '';
|
||||
if ( count( $link_texts ) === 1 ) {
|
||||
//All instances have the same text - use it.
|
||||
// All instances have the same text - use it.
|
||||
$link_text = key( $link_texts );
|
||||
$data_link_text = esc_attr( $link_text );
|
||||
}
|
||||
|
@ -462,14 +462,14 @@ class MainWP_Child_Links_Checker {
|
|||
|
||||
return $information;
|
||||
}
|
||||
//Load the link
|
||||
// Load the link
|
||||
$link = new blcLink( intval( $_POST['link_id'] ) );
|
||||
if ( ! $link->valid() ) {
|
||||
$information['error'] = 'NOTFOUNDLINK'; // Oops, I can't find the link
|
||||
return $information;
|
||||
}
|
||||
|
||||
//Validate the new URL.
|
||||
// Validate the new URL.
|
||||
$new_url = stripslashes( $_POST['new_url'] );
|
||||
$parsed = @parse_url( $new_url );
|
||||
if ( ! $parsed ) {
|
||||
|
@ -482,7 +482,7 @@ class MainWP_Child_Links_Checker {
|
|||
$new_text = null;
|
||||
}
|
||||
if ( ! empty( $new_text ) && ! current_user_can( 'unfiltered_html' ) ) {
|
||||
$new_text = stripslashes( wp_filter_post_kses( addslashes( $new_text ) ) ); //wp_filter_post_kses expects slashed data.
|
||||
$new_text = stripslashes( wp_filter_post_kses( addslashes( $new_text ) ) ); // wp_filter_post_kses expects slashed data.
|
||||
}
|
||||
|
||||
$rez = $link->edit( $new_url, $new_text );
|
||||
|
@ -515,7 +515,7 @@ class MainWP_Child_Links_Checker {
|
|||
'ui_link_text' => isset( $new_text ) ? $ui_link_text : null,
|
||||
'errors' => array(),
|
||||
);
|
||||
//url, status text, status code, link text, editable link text
|
||||
// url, status text, status code, link text, editable link text
|
||||
|
||||
foreach ( $rez['errors'] as $error ) {
|
||||
/** @var $error WP_Error */
|
||||
|
@ -535,7 +535,7 @@ class MainWP_Child_Links_Checker {
|
|||
}
|
||||
|
||||
if ( isset( $_POST['link_id'] ) ) {
|
||||
//Load the link
|
||||
// Load the link
|
||||
$link = new blcLink( intval( $_POST['link_id'] ) );
|
||||
|
||||
if ( ! $link->valid() ) {
|
||||
|
@ -543,7 +543,7 @@ class MainWP_Child_Links_Checker {
|
|||
return $information;
|
||||
}
|
||||
|
||||
//Try and unlink it
|
||||
// Try and unlink it
|
||||
$rez = $link->unlink();
|
||||
|
||||
if ( false === $rez ) {
|
||||
|
@ -580,7 +580,7 @@ class MainWP_Child_Links_Checker {
|
|||
}
|
||||
|
||||
if ( isset( $_POST['link_id'] ) ) {
|
||||
//Load the link
|
||||
// Load the link
|
||||
$link = new blcLink( intval( $_POST['link_id'] ) );
|
||||
|
||||
if ( ! $link->valid() ) {
|
||||
|
@ -590,7 +590,7 @@ class MainWP_Child_Links_Checker {
|
|||
|
||||
$link->dismissed = $dismiss;
|
||||
|
||||
//Save the changes
|
||||
// Save the changes
|
||||
if ( $link->save() ) {
|
||||
$information = 'OK';
|
||||
} else {
|
||||
|
@ -613,7 +613,7 @@ class MainWP_Child_Links_Checker {
|
|||
return $information;
|
||||
}
|
||||
if ( isset( $_POST['link_id'] ) ) {
|
||||
//Load the link
|
||||
// Load the link
|
||||
$link = new blcLink( intval( $_POST['link_id'] ) );
|
||||
|
||||
if ( ! $link->valid() ) {
|
||||
|
@ -621,13 +621,13 @@ class MainWP_Child_Links_Checker {
|
|||
return $information;
|
||||
}
|
||||
|
||||
//Make it appear "not broken"
|
||||
// Make it appear "not broken"
|
||||
$link->broken = false;
|
||||
$link->false_positive = true;
|
||||
$link->last_check_attempt = time();
|
||||
$link->log = __( 'This link was manually marked as working by the user.', 'mainwp-child' );
|
||||
|
||||
//Save the changes
|
||||
// Save the changes
|
||||
if ( $link->save() ) {
|
||||
$information['status'] = 'OK';
|
||||
$information['last_check_attempt'] = $link->last_check_attempt;
|
||||
|
@ -652,7 +652,7 @@ class MainWP_Child_Links_Checker {
|
|||
}
|
||||
|
||||
function ui_get_source_comment( $container, $container_field = '' ) {
|
||||
//Display a comment icon.
|
||||
// Display a comment icon.
|
||||
if ( 'comment_author_url' === $container_field ) {
|
||||
$image = 'font-awesome/font-awesome-user.png';
|
||||
} else {
|
||||
|
@ -665,7 +665,7 @@ class MainWP_Child_Links_Checker {
|
|||
|
||||
$comment = $container->get_wrapped_object();
|
||||
|
||||
//Display a small text sample from the comment
|
||||
// Display a small text sample from the comment
|
||||
$text_sample = strip_tags( $comment->comment_content );
|
||||
$text_sample = blcUtility::truncate( $text_sample, 65 );
|
||||
|
||||
|
|
|
@ -240,17 +240,17 @@ class MainWP_Child_Pagespeed {
|
|||
|
||||
$result = $this->get_sync_data( $strategy );
|
||||
|
||||
// if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
||||
// if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
||||
// $recheck = true;
|
||||
// } else {
|
||||
// $recheck = false;
|
||||
// }
|
||||
// if ( isset( $_POST['doaction'] ) && ( 'check_new_pages' === $_POST['doaction'] || 'recheck_all_pages' === $_POST['doaction'] ) ) {
|
||||
// if ( 'recheck_all_pages' === $_POST['doaction'] ) {
|
||||
// $recheck = true;
|
||||
// } else {
|
||||
// $recheck = false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if ($this->do_check_pages($recheck))
|
||||
// $information['checked_pages'] = 1;
|
||||
// }
|
||||
// if ($this->do_check_pages($recheck))
|
||||
// $information['checked_pages'] = 1;
|
||||
// }
|
||||
$information['data'] = $result['data'];
|
||||
return $information;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ class MainWP_Child_Pagespeed {
|
|||
if ( $checkstatus ) {
|
||||
$information['error'] = __( 'The API is busy checking other pages, please try again later.', 'gpagespeedi' );
|
||||
} else {
|
||||
//do_action( 'googlepagespeedinsightsworker', array(), $forceRecheck );
|
||||
// do_action( 'googlepagespeedinsightsworker', array(), $forceRecheck );
|
||||
do_action( 'run_gpi', $forceRecheck ); // to fix
|
||||
$information['checked_pages'] = 1;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ class MainWP_Child_Pagespeed {
|
|||
}
|
||||
|
||||
$score_column = $strategy . '_score';
|
||||
//$page_stats_column = $strategy . '_page_stats';
|
||||
// $page_stats_column = $strategy . '_page_stats';
|
||||
|
||||
$data_typestocheck = self::get_filter_options( 'all' );
|
||||
|
||||
|
@ -400,9 +400,9 @@ class MainWP_Child_Pagespeed {
|
|||
// Not Null check for Report List scores
|
||||
switch ( $strategy ) {
|
||||
|
||||
// case 'both':
|
||||
// $nullcheck = 'desktop_score IS NOT NULL AND mobile_score IS NOT NULL';
|
||||
// break;
|
||||
// case 'both':
|
||||
// $nullcheck = 'desktop_score IS NOT NULL AND mobile_score IS NOT NULL';
|
||||
// break;
|
||||
|
||||
case 'mobile':
|
||||
$nullcheck = 'mobile_score IS NOT NULL';
|
||||
|
|
|
@ -45,7 +45,7 @@ class MainWP_Child_Plugins_Check {
|
|||
|
||||
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
||||
|
||||
//add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
||||
// add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
||||
|
||||
add_filter( 'plugins_api_args', array( $this, 'modify_plugin_api_search_query' ), 10, 2 );
|
||||
|
||||
|
@ -97,7 +97,7 @@ class MainWP_Child_Plugins_Check {
|
|||
$last_run = new \DateTime( '@' . $last_run );
|
||||
}
|
||||
|
||||
//Get now
|
||||
// Get now
|
||||
$now = new \DateTime();
|
||||
|
||||
if ( false === $last_run || (int) $now->diff( $last_run )->format( '%h' ) >= 24 ) {
|
||||
|
@ -112,10 +112,10 @@ class MainWP_Child_Plugins_Check {
|
|||
}
|
||||
|
||||
public function schedule_watchdog() {
|
||||
//For testing
|
||||
//$this->cleanup_deactivation();
|
||||
// For testing
|
||||
// $this->cleanup_deactivation();
|
||||
|
||||
//Schedule a global watching cron just in case both other crons get killed
|
||||
// Schedule a global watching cron just in case both other crons get killed
|
||||
if ( ! wp_next_scheduled( $this->cron_name_watcher ) ) {
|
||||
wp_schedule_event( time(), 'hourly', $this->cron_name_watcher );
|
||||
}
|
||||
|
@ -146,31 +146,31 @@ class MainWP_Child_Plugins_Check {
|
|||
|
||||
// for testing
|
||||
public function change_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
||||
//Grab our previously stored array of known last modified dates
|
||||
//Requires WP 2.8.0
|
||||
// Grab our previously stored array of known last modified dates
|
||||
// Requires WP 2.8.0
|
||||
$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 ) ) {
|
||||
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 ) ) {
|
||||
//Get now
|
||||
// Get now
|
||||
$now = new \DateTime();
|
||||
$last_updated = $plugin_info[ $plugin_file ]['last_updated'];
|
||||
|
||||
//Last updated is stored as timestamp, get a real date
|
||||
// Last updated is stored as timestamp, get a real date
|
||||
$plugin_last_updated_date = new \DateTime( '@' . $last_updated );
|
||||
|
||||
//Compute days between now and plugin last updated
|
||||
// Compute days between now and plugin last updated
|
||||
$diff_in_days = $now->diff( $plugin_last_updated_date )->format( '%a' );
|
||||
|
||||
//Customizable number of days for tolerance
|
||||
// Customizable number of days for tolerance
|
||||
$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 ) {
|
||||
$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 {
|
||||
|
@ -186,17 +186,17 @@ class MainWP_Child_Plugins_Check {
|
|||
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
//Get our previous results
|
||||
// Get our previous results
|
||||
$responses = get_transient( $this->tran_name_plugin_timestamps );
|
||||
|
||||
if ( false === $responses || ! is_array( $responses ) ) {
|
||||
$responses = array();
|
||||
}
|
||||
|
||||
//Get our previous cache of plugins for batching
|
||||
// Get our previous cache of plugins for batching
|
||||
$all_plugins = get_transient( $this->tran_name_plugins_to_batch );
|
||||
|
||||
//If there wasn't a previous cache
|
||||
// If there wasn't a previous cache
|
||||
if ( false === $all_plugins || ! is_array( $all_plugins ) ) {
|
||||
$plugins = get_plugins();
|
||||
if ( is_array( $plugins ) ) {
|
||||
|
@ -215,29 +215,29 @@ class MainWP_Child_Plugins_Check {
|
|||
}
|
||||
|
||||
$avoid_plugins = array( 'sitepress-multilingual-cms/sitepress.php' );
|
||||
//Grab a small number of plugins to scan
|
||||
// Grab a small number of plugins to scan
|
||||
$plugins_to_scan = array_splice( $all_plugins, 0, apply_filters( 'mainwp_child_plugin_health_check_max_plugins_to_batch', 10 ) );
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
//Loop through each known plugin
|
||||
// Loop through each known plugin
|
||||
foreach ( $plugins_to_scan as $slug => $v ) {
|
||||
if ( in_array( $slug, $avoid_plugins ) ) {
|
||||
continue;
|
||||
}
|
||||
//Try to get the raw information for this plugin
|
||||
// Try to get the raw information for this plugin
|
||||
$body = $this->try_get_response_body( $slug, false );
|
||||
|
||||
//We couldn't get any information, skip this plugin
|
||||
// We couldn't get any information, skip this plugin
|
||||
if ( false === $body ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Deserialize the response
|
||||
// Deserialize the response
|
||||
$obj = maybe_unserialize( $body );
|
||||
|
||||
$now = new \DateTime();
|
||||
|
||||
//Sanity check that deserialization worked and that our property exists
|
||||
// Sanity check that deserialization worked and that our property exists
|
||||
if ( false !== $obj && is_object( $obj ) && property_exists( $obj, 'last_updated' ) ) {
|
||||
if ( version_compare( $v['Version'], $obj->version, '>' ) ) {
|
||||
continue;
|
||||
|
@ -259,7 +259,7 @@ class MainWP_Child_Plugins_Check {
|
|||
define( 'DAY_IN_SECONDS', 24 * 60 * 60 );
|
||||
}
|
||||
|
||||
//Store the master response for usage in the plugin table
|
||||
// Store the master response for usage in the plugin table
|
||||
set_transient( $this->tran_name_plugin_timestamps, $responses, DAY_IN_SECONDS );
|
||||
|
||||
if ( 0 === count( $all_plugins ) ) {
|
||||
|
@ -271,26 +271,26 @@ class MainWP_Child_Plugins_Check {
|
|||
}
|
||||
|
||||
private function try_get_response_body( $plugin, $second_pass ) {
|
||||
//Some of this code is lifted from class-wp-upgrader
|
||||
// Some of this code is lifted from class-wp-upgrader
|
||||
|
||||
//Get the WordPress current version to be polite in the API call
|
||||
// Get the WordPress current version to be polite in the API call
|
||||
include ABSPATH . WPINC . '/version.php';
|
||||
|
||||
global $wp_version;
|
||||
|
||||
//General options to be passed to wp_remote_get
|
||||
// General options to be passed to wp_remote_get
|
||||
$options = array(
|
||||
'timeout' => 60 * 60, //HOUR_IN_SECONDS
|
||||
'timeout' => 60 * 60, // HOUR_IN_SECONDS
|
||||
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ),
|
||||
);
|
||||
|
||||
//The URL for the endpoint
|
||||
// The URL for the endpoint
|
||||
$url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
|
||||
|
||||
//If we support SSL
|
||||
//Requires WP 3.2.0
|
||||
// If we support SSL
|
||||
// Requires WP 3.2.0
|
||||
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
|
||||
//Requires WP 3.4.0
|
||||
// Requires WP 3.4.0
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
|
@ -299,27 +299,27 @@ class MainWP_Child_Plugins_Check {
|
|||
$plugin_dir = dirname( $plugin );
|
||||
}
|
||||
|
||||
//Try to get the response (usually the SSL version)
|
||||
//Requires WP 2.7.0
|
||||
// Try to get the response (usually the SSL version)
|
||||
// Requires WP 2.7.0
|
||||
$raw_response = wp_remote_get( $url . $plugin_dir, $options );
|
||||
|
||||
//If we don't have an error and we received a valid response code
|
||||
//Requires WP 2.7.0
|
||||
// If we don't have an error and we received a valid response code
|
||||
// Requires WP 2.7.0
|
||||
if ( ! is_wp_error( $raw_response ) && 200 === (int) wp_remote_retrieve_response_code( $raw_response ) ) {
|
||||
//Get the actual body
|
||||
//Requires WP 2.7.0
|
||||
// Get the actual body
|
||||
// Requires WP 2.7.0
|
||||
$body = wp_remote_retrieve_body( $raw_response );
|
||||
|
||||
//Make sure that it isn't empty and also not an empty serialized object
|
||||
// Make sure that it isn't empty and also not an empty serialized object
|
||||
if ( '' !== $body && 'N;' !== $body ) {
|
||||
//If valid, return that
|
||||
// If valid, return that
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
|
||||
//The above valid
|
||||
//If we previously tried an SSL version try without SSL
|
||||
//Code below same as above block
|
||||
// The above valid
|
||||
// If we previously tried an SSL version try without SSL
|
||||
// Code below same as above block
|
||||
if ( $ssl ) {
|
||||
$raw_response = wp_remote_get( $http_url . $plugin, $options );
|
||||
if ( ! is_wp_error( $raw_response ) && 200 === (int) wp_remote_retrieve_response_code( $raw_response ) ) {
|
||||
|
@ -330,22 +330,22 @@ class MainWP_Child_Plugins_Check {
|
|||
}
|
||||
}
|
||||
|
||||
//The above failed
|
||||
//If we're on a second pass already then there's nothing left to do but bail
|
||||
// The above failed
|
||||
// If we're on a second pass already then there's nothing left to do but bail
|
||||
if ( true === $second_pass ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//We're still on the first pass, try to get just the name of the directory of the plugin
|
||||
// We're still on the first pass, try to get just the name of the directory of the plugin
|
||||
$parts = explode( '/', $plugin );
|
||||
|
||||
//Sanity check that we have two parts, a directory and a file name
|
||||
// Sanity check that we have two parts, a directory and a file name
|
||||
if ( 2 === count( $parts ) ) {
|
||||
//Try this entire function using just the directory name
|
||||
// Try this entire function using just the directory name
|
||||
return $this->try_get_response_body( $parts[0], true );
|
||||
}
|
||||
|
||||
//Everything above failed, bail
|
||||
// Everything above failed, bail
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ class MainWP_Child_Server_Information {
|
|||
if ( ! self::check( '>=', '10000', 'getOutputBufferSize' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
// if (!self::check('=', true, 'getSSLSupport')) $i++;
|
||||
// if (!self::check('=', true, 'getSSLSupport')) $i++;
|
||||
|
||||
if ( ! self::checkDirectoryMainWPDirectory( false ) ) {
|
||||
$i ++;
|
||||
|
@ -879,7 +879,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
public static function mainwpRequiredFunctions() {
|
||||
//error_reporting(E_ALL);
|
||||
// error_reporting(E_ALL);
|
||||
$disabled_functions = ini_get( 'disable_functions' );
|
||||
if ( '' !== $disabled_functions ) {
|
||||
$arr = explode( ',', $disabled_functions );
|
||||
|
|
|
@ -23,9 +23,9 @@ class MainWP_Child_Skeleton_Key {
|
|||
MainWP_Helper::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
|
||||
}
|
||||
// to fix issue double <mainwp></mainwp> header in response
|
||||
// else {
|
||||
// MainWP_Helper::write( MainWP_Child_Skeleton_Key::$information );
|
||||
// }
|
||||
// else {
|
||||
// MainWP_Helper::write( MainWP_Child_Skeleton_Key::$information );
|
||||
// }
|
||||
}
|
||||
|
||||
register_shutdown_function( 'mainwp_skeleton_key_handle_fatal_error' );
|
||||
|
@ -42,7 +42,7 @@ class MainWP_Child_Skeleton_Key {
|
|||
}
|
||||
|
||||
MainWP_Helper::write( $information );
|
||||
//MainWP_Child_Skeleton_Key::$information = $information;
|
||||
// MainWP_Child_Skeleton_Key::$information = $information;
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ class MainWP_Child_Skeleton_Key {
|
|||
$whitelist_options['general'][] = 'default_role';
|
||||
}
|
||||
|
||||
//$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
||||
// $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
||||
$whitelist_general = $whitelist_options['general'];
|
||||
|
||||
// Handle translation install.
|
||||
|
|
|
@ -167,12 +167,12 @@ class MainWP_Child_Staging {
|
|||
'disableAdminLogin',
|
||||
'querySRLimit',
|
||||
'maxFileSize',
|
||||
//'wpSubDirectory', // removed
|
||||
// 'wpSubDirectory', // removed
|
||||
'debugMode',
|
||||
'unInstallOnDelete',
|
||||
'checkDirectorySize',
|
||||
'optimizer',
|
||||
//'loginSlug' // removed
|
||||
// 'loginSlug' // removed
|
||||
);
|
||||
|
||||
$save_fields = array();
|
||||
|
|
|
@ -95,7 +95,7 @@ class MainWP_Child_Themes_Check {
|
|||
$last_run = new \DateTime( '@' . $last_run );
|
||||
}
|
||||
|
||||
//Get now
|
||||
// Get now
|
||||
$now = new \DateTime();
|
||||
|
||||
if ( false === $last_run || (int) $now->diff( $last_run )->format( '%h' ) >= 24 ) {
|
||||
|
@ -110,10 +110,10 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
|
||||
public function schedule_watchdog() {
|
||||
//For testing
|
||||
//$this->cleanup_deactivation();
|
||||
// For testing
|
||||
// $this->cleanup_deactivation();
|
||||
|
||||
//Schedule a global watching cron just in case both other crons get killed
|
||||
// Schedule a global watching cron just in case both other crons get killed
|
||||
if ( ! wp_next_scheduled( $this->cron_name_watcher ) ) {
|
||||
wp_schedule_event( time(), 'hourly', $this->cron_name_watcher );
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class MainWP_Child_Themes_Check {
|
|||
require_once ABSPATH . '/wp-admin/includes/theme.php';
|
||||
}
|
||||
|
||||
//Get our previous results
|
||||
// Get our previous results
|
||||
$responses = get_transient( $this->tran_name_theme_timestamps );
|
||||
|
||||
if ( false === $responses || ! is_array( $responses ) ) {
|
||||
|
@ -155,7 +155,7 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
|
||||
$all_themes = get_transient( $this->tran_name_themes_to_batch );
|
||||
//If there wasn't a previous cache
|
||||
// If there wasn't a previous cache
|
||||
if ( false === $all_themes || ! is_array( $all_themes ) ) {
|
||||
$all_themes = array();
|
||||
$themes = wp_get_themes();
|
||||
|
@ -187,12 +187,12 @@ class MainWP_Child_Themes_Check {
|
|||
continue;
|
||||
}
|
||||
|
||||
//Deserialize the response
|
||||
// Deserialize the response
|
||||
$obj = maybe_unserialize( $body );
|
||||
|
||||
$now = new \DateTime();
|
||||
|
||||
//Sanity check that deserialization worked and that our property exists
|
||||
// Sanity check that deserialization worked and that our property exists
|
||||
if ( false !== $obj && is_object( $obj ) && property_exists( $obj, 'last_updated' ) ) {
|
||||
$last_updated = strtotime( $obj->last_updated );
|
||||
$theme_last_updated_date = new \DateTime( '@' . $last_updated );
|
||||
|
@ -213,7 +213,7 @@ class MainWP_Child_Themes_Check {
|
|||
define( 'DAY_IN_SECONDS', 24 * 60 * 60 );
|
||||
}
|
||||
|
||||
//Store the master response for usage in the plugin table
|
||||
// Store the master response for usage in the plugin table
|
||||
set_transient( $this->tran_name_theme_timestamps, $responses, DAY_IN_SECONDS );
|
||||
|
||||
if ( 0 === count( $all_themes ) ) {
|
||||
|
@ -227,7 +227,7 @@ class MainWP_Child_Themes_Check {
|
|||
|
||||
|
||||
private function try_get_response_body( $theme ) {
|
||||
//Get the WordPress current version to be polite in the API call
|
||||
// Get the WordPress current version to be polite in the API call
|
||||
include ABSPATH . WPINC . '/version.php';
|
||||
|
||||
$url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
|
||||
|
@ -254,20 +254,20 @@ class MainWP_Child_Themes_Check {
|
|||
$raw_response = wp_remote_post( $url, $http_args );
|
||||
|
||||
if ( ! is_wp_error( $raw_response ) && 200 === (int) wp_remote_retrieve_response_code( $raw_response ) ) {
|
||||
//Get the actual body
|
||||
//Requires WP 2.7.0
|
||||
// Get the actual body
|
||||
// Requires WP 2.7.0
|
||||
$body = wp_remote_retrieve_body( $raw_response );
|
||||
|
||||
//Make sure that it isn't empty and also not an empty serialized object
|
||||
// Make sure that it isn't empty and also not an empty serialized object
|
||||
if ( '' !== $body && 'N;' !== $body ) {
|
||||
//If valid, return that
|
||||
// If valid, return that
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
|
||||
//The above valid
|
||||
//If we previously tried an SSL version try without SSL
|
||||
//Code below same as above block
|
||||
// The above valid
|
||||
// If we previously tried an SSL version try without SSL
|
||||
// Code below same as above block
|
||||
if ( $ssl ) {
|
||||
$raw_response = wp_remote_post( $http_url, $http_args );
|
||||
|
||||
|
@ -279,7 +279,7 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
}
|
||||
|
||||
//Everything above failed, bail
|
||||
// Everything above failed, bail
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ class MainWP_Child_Timecapsule {
|
|||
}
|
||||
|
||||
function get_sibling_files_callback_wptc() {
|
||||
//note that we are getting the ajax function data via $_POST.
|
||||
// note that we are getting the ajax function data via $_POST.
|
||||
$file_name = $_POST['data']['file_name'];
|
||||
$file_name = wp_normalize_path($file_name);
|
||||
$backup_id = $_POST['data']['backup_id'];
|
||||
|
@ -487,7 +487,7 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
/*
|
||||
-- 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';
|
||||
$order = ! empty($_POST['order']) ? mysql_real_escape_string($_POST['order']) : 'DESC';
|
||||
if ( ! empty($orderby) & ! empty($order)) {
|
||||
|
@ -495,17 +495,17 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
/*
|
||||
-- Pagination parameters -- */
|
||||
//Number of elements in your table?
|
||||
$totalitems = $wpdb->query($query); //return the total number of affected rows
|
||||
//How many to display per page?
|
||||
// Number of elements in your table?
|
||||
$totalitems = $wpdb->query($query); // return the total number of affected rows
|
||||
// How many to display per page?
|
||||
$perpage = 20;
|
||||
//Which page is this?
|
||||
// Which page is this?
|
||||
$paged = ! empty($_POST['paged']) ? $_POST['paged'] : '';
|
||||
if (empty($paged) || ! is_numeric($paged) || $paged <= 0) {
|
||||
$paged = 1;} //Page Number
|
||||
//How many pages do we have in total?
|
||||
$totalpages = ceil($totalitems / $perpage); //Total number of pages
|
||||
//adjust the query to take pagination into account
|
||||
// How many pages do we have in total?
|
||||
$totalpages = ceil($totalitems / $perpage); // Total number of pages
|
||||
// adjust the query to take pagination into account
|
||||
if ( ! empty($paged) && ! empty($perpage)) {
|
||||
$offset = ( $paged - 1 ) * $perpage;
|
||||
$query .= ' LIMIT ' . (int) $offset . ',' . (int) $perpage;
|
||||
|
@ -556,20 +556,20 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
return array( 'result' => $detailed );
|
||||
|
||||
//die($detailed);
|
||||
// die($detailed);
|
||||
}
|
||||
|
||||
|
||||
function get_display_rows( $records) {
|
||||
global $wpdb;
|
||||
//Get the records registered in the prepare_items method
|
||||
// Get the records registered in the prepare_items method
|
||||
if ( ! is_array($records)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$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();
|
||||
$timezone = WPTC_Factory::get('config')->get_option('wptc_timezone');
|
||||
if (count($records) > 0) {
|
||||
|
@ -598,7 +598,7 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
}
|
||||
}
|
||||
//Open the line
|
||||
// Open the line
|
||||
$html .= '<tr class="act-tr">';
|
||||
$Ldata = unserialize($rec->log_data);
|
||||
$user_time = WPTC_Factory::get('config')->cnvt_UTC_to_usrTime($Ldata['log_time']);
|
||||
|
@ -609,13 +609,13 @@ class MainWP_Child_Timecapsule {
|
|||
$user_tz_now = date('M d, Y @ g:i:s a', $user_time);
|
||||
$msg = '';
|
||||
if ( ! ( strpos($rec->type, 'backup') === false )) {
|
||||
//Backup process
|
||||
// Backup process
|
||||
$msg = 'Backup Process';
|
||||
} elseif ( ! ( strpos($rec->type, 'restore') === false )) {
|
||||
//Restore Process
|
||||
// Restore Process
|
||||
$msg = 'Restore Process';
|
||||
} elseif ( ! ( strpos($rec->type, 'staging') === false )) {
|
||||
//Restore Process
|
||||
// Restore Process
|
||||
$msg = 'Staging Process';
|
||||
} else {
|
||||
if ($row_count < 2) {
|
||||
|
@ -636,7 +636,7 @@ class MainWP_Child_Timecapsule {
|
|||
} else {
|
||||
$html .= '</td>';
|
||||
}
|
||||
//Close the line
|
||||
// Close the line
|
||||
$html .= '</tr>';
|
||||
|
||||
$display_rows[ $key ] = $html;
|
||||
|
@ -674,7 +674,7 @@ class MainWP_Child_Timecapsule {
|
|||
}
|
||||
|
||||
function stop_fresh_backup_tc_callback_wptc() {
|
||||
//for backup during update
|
||||
// for backup during update
|
||||
$deactivated_plugin = null;
|
||||
$backup = new WPTC_BackupController();
|
||||
$backup->stop($deactivated_plugin);
|
||||
|
@ -1208,7 +1208,7 @@ class MainWP_Child_Timecapsule {
|
|||
echo '<tr title="WP_MAX_MEMORY_LIMIT"><td>' . __( 'WP maximum memory limit', 'wp-time-capsule' ) . '</td><td>' . esc_html( WP_MAX_MEMORY_LIMIT ) . '</td></tr>';
|
||||
echo '<tr title=""><td>' . __( 'Memory in use', 'wp-time-capsule' ) . '</td><td>' . size_format( @memory_get_usage( true ), 2 ) . '</td></tr>';
|
||||
|
||||
//disabled PHP functions
|
||||
// disabled PHP functions
|
||||
$disabled = esc_html( ini_get( 'disable_functions' ) );
|
||||
if ( ! empty( $disabled ) ) {
|
||||
$disabledarry = explode( ',', $disabled );
|
||||
|
@ -1217,7 +1217,7 @@ class MainWP_Child_Timecapsule {
|
|||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
//Loaded PHP Extensions
|
||||
// Loaded PHP Extensions
|
||||
echo '<tr title=""><td>' . __( 'Loaded PHP Extensions:', 'wp-time-capsule' ) . '</td><td>';
|
||||
$extensions = get_loaded_extensions();
|
||||
sort( $extensions );
|
||||
|
|
|
@ -188,7 +188,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
'updraft_retain',
|
||||
'updraft_retain_db',
|
||||
'updraft_encryptionphrase',
|
||||
//'updraft_service', // will check override to save
|
||||
// 'updraft_service', // will check override to save
|
||||
'updraft_dir',
|
||||
'updraft_email',
|
||||
'updraft_delete_local',
|
||||
|
@ -215,7 +215,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
'updraft_disable_ping',
|
||||
'updraft_openstack',
|
||||
'updraft_bitcasa',
|
||||
//'updraft_cloudfiles',
|
||||
// 'updraft_cloudfiles',
|
||||
'updraft_ssl_useservercerts',
|
||||
'updraft_ssl_disableverify',
|
||||
'updraft_report_warningsonly',
|
||||
|
@ -233,10 +233,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
'updraft_sftp_settings',
|
||||
'updraft_webdav_settings',
|
||||
'updraft_dreamobjects',
|
||||
//'updraft_onedrive', // disalbed
|
||||
//'updraft_azure', // disabled
|
||||
// 'updraft_onedrive', // disalbed
|
||||
// 'updraft_azure', // disabled
|
||||
'updraft_googlecloud',
|
||||
//'updraft_updraftvault',
|
||||
// 'updraft_updraftvault',
|
||||
'updraft_retain_extrarules',
|
||||
'updraft_backblaze',
|
||||
);
|
||||
|
@ -444,75 +444,75 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
if (isset($settings['is_general']) && ! empty($settings['is_general'])) {
|
||||
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
} else {
|
||||
// $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey'];
|
||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['appkey'] = $settings[ $key ]['appkey'];
|
||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
$opts['settings'][ $settings_key ]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
}
|
||||
} else {
|
||||
if (isset($settings['is_general']) && ! empty($settings['is_general'])) {
|
||||
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
} else {
|
||||
// $opts['appkey'] = $settings[ $key ]['appkey'];
|
||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['appkey'] = $settings[ $key ]['appkey'];
|
||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
}
|
||||
}
|
||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
} elseif ( 'updraft_googledrive' === $key ) {
|
||||
// do not saving from dashboard
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// } else {
|
||||
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// }
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// } else {
|
||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// }
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
} elseif ( 'updraft_googlecloud' === $key ) {
|
||||
// do not saving from dashboard
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( $key );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
//// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id'];
|
||||
//// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||
// $opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class'];
|
||||
// $opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||
// } else {
|
||||
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
//// $opts['project_id'] = $settings[ $key ]['project_id'];
|
||||
//// $opts['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||
// $opts['storage_class'] = $settings[ $key ]['storage_class'];
|
||||
// $opts['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||
// }
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( $key );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id'];
|
||||
// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||
// $opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class'];
|
||||
// $opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||
// } else {
|
||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['project_id'] = $settings[ $key ]['project_id'];
|
||||
// $opts['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||
// $opts['storage_class'] = $settings[ $key ]['storage_class'];
|
||||
// $opts['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||
// }
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
} elseif ( 'updraft_onedrive' === $key ) {
|
||||
// do not saving from dashboard
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// } else {
|
||||
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// }
|
||||
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' );
|
||||
// if (!is_array($opts))
|
||||
// $opts = array();
|
||||
// if(is_array($opts) && isset($opts['settings'])) {
|
||||
// $settings_key = key($opts['settings']);
|
||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// } else {
|
||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
||||
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||
// }
|
||||
//
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||
} elseif ( 'updraft_email' === $key ) {
|
||||
$value = $settings[ $key ];
|
||||
// free version
|
||||
|
@ -773,7 +773,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
// Funnelling through here a) allows for future flexibility and b) allows us to migrate elegantly from the previous non-MU-friendly setup
|
||||
public function addons2_get_option( $option ) {
|
||||
$val = get_site_option( $option );
|
||||
# On multisite, migrate options into the site options
|
||||
// On multisite, migrate options into the site options
|
||||
if ( false === $val && is_multisite() ) {
|
||||
$blog_id = get_current_blog_id();
|
||||
if ( $blog_id > 1 ) {
|
||||
|
@ -785,7 +785,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
return $val;
|
||||
}
|
||||
}
|
||||
# $val is still false
|
||||
// $val is still false
|
||||
switch_to_blog( 1 );
|
||||
$val = get_option( $option );
|
||||
if ( false !== $val ) {
|
||||
|
@ -803,7 +803,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
}
|
||||
|
||||
public function options_validate( $input ) {
|
||||
# See: http://codex.wordpress.org/Function_Reference/add_settings_error
|
||||
// See: http://codex.wordpress.org/Function_Reference/add_settings_error
|
||||
|
||||
// When the options are re-saved, clear any previous cache of the connection status
|
||||
$ehash = substr( md5( $input['email'] ), 0, 23 );
|
||||
|
@ -897,7 +897,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$ret_info = '';
|
||||
if ( ! $failed ) {
|
||||
$all_tables = $wpdb_obj->get_results( 'SHOW TABLES', ARRAY_N );
|
||||
//$all_tables = array_map( create_function( '$a', 'return $a[0];' ), $all_tables );
|
||||
// $all_tables = array_map( create_function( '$a', 'return $a[0];' ), $all_tables );
|
||||
$all_tables = array_map(array( $this, 'cb_get_name_base_type' ), $all_tables);
|
||||
|
||||
if ( empty( $_POST['prefix'] ) ) {
|
||||
|
@ -975,24 +975,24 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
|
||||
do_action( $event, apply_filters( 'updraft_backupnow_options', $options, array() ) );
|
||||
|
||||
//return $msg;
|
||||
// return $msg;
|
||||
|
||||
// Control returns when the backup finished; but, the browser connection should have been closed before
|
||||
die;
|
||||
|
||||
// not used anymore
|
||||
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {
|
||||
// $updraftplus->log("A backup run failed to schedule");
|
||||
// //echo __("Failed.", 'updraftplus')."</div>";
|
||||
// $result = 'FAILED';
|
||||
// } else {
|
||||
// $result = 'OK';
|
||||
// //echo htmlspecialchars(__('OK. You should soon see activity in the "Last log message" field below.','updraftplus'))." <a href=\"http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/\"><br>".__('Nothing happening? Follow this link for help.','updraftplus')."</a></div>";
|
||||
// $updraftplus->log("A backup run has been scheduled");
|
||||
// }
|
||||
// $out = array( 'result' => 'OK' );
|
||||
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {
|
||||
// $updraftplus->log("A backup run failed to schedule");
|
||||
// echo __("Failed.", 'updraftplus')."</div>";
|
||||
// $result = 'FAILED';
|
||||
// } else {
|
||||
// $result = 'OK';
|
||||
// echo htmlspecialchars(__('OK. You should soon see activity in the "Last log message" field below.','updraftplus'))." <a href=\"http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/\"><br>".__('Nothing happening? Follow this link for help.','updraftplus')."</a></div>";
|
||||
// $updraftplus->log("A backup run has been scheduled");
|
||||
// }
|
||||
// $out = array( 'result' => 'OK' );
|
||||
//
|
||||
// return $out;
|
||||
// return $out;
|
||||
}
|
||||
|
||||
function activejobs_list() {
|
||||
|
@ -1000,7 +1000,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$download_status = array();
|
||||
if ( ! empty( $_REQUEST['downloaders'] ) ) {
|
||||
foreach ( explode( ':', $_REQUEST['downloaders'] ) as $downloader ) {
|
||||
# prefix, timestamp, entity, index
|
||||
// prefix, timestamp, entity, index
|
||||
if ( preg_match( '/^([^,]+),(\d+),([-a-z]+|db[0-9]+),(\d+)$/', $downloader, $matches ) ) {
|
||||
$updraftplus->nonce = $matches[2];
|
||||
$status = $this->download_status( $matches[2], $matches[3], $matches[4] );
|
||||
|
@ -1194,7 +1194,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
|
||||
// Convert to blog time zone
|
||||
$next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
|
||||
// $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup);
|
||||
// $next_scheduled_backup = date_i18n('D, F j, Y H:i', $next_scheduled_backup);
|
||||
} else {
|
||||
$next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
|
||||
$files_not_scheduled = true;
|
||||
|
@ -1215,7 +1215,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
|
||||
// Convert to blog time zone
|
||||
$next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
|
||||
// $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database);
|
||||
// $next_scheduled_backup_database = date_i18n('D, F j, Y H:i', $next_scheduled_backup_database);
|
||||
} else {
|
||||
$next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
|
||||
$database_not_scheduled = true;
|
||||
|
@ -1345,7 +1345,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$remote_deleted = 0;
|
||||
add_action( 'http_request_args', array( $updraftplus, 'modify_http_options' ) );
|
||||
foreach ( $files_to_delete as $key => $files ) {
|
||||
# Local deletion
|
||||
// Local deletion
|
||||
if ( is_string( $files ) ) {
|
||||
$files = array( $files );
|
||||
}
|
||||
|
@ -1367,12 +1367,12 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$objname = 'UpdraftPlus_BackupModule_' . $service;
|
||||
$deleted = - 1;
|
||||
if ( class_exists( $objname ) ) {
|
||||
# TODO: Re-use the object (i.e. prevent repeated connection setup/teardown)
|
||||
// TODO: Re-use the object (i.e. prevent repeated connection setup/teardown)
|
||||
$remote_obj = new $objname();
|
||||
$deleted = $remote_obj->delete( $files );
|
||||
}
|
||||
if ( $deleted === - 1 ) {
|
||||
//echo __('Did not know how to delete from this cloud service.', 'updraftplus');
|
||||
// echo __('Did not know how to delete from this cloud service.', 'updraftplus');
|
||||
} elseif ( $deleted !== false ) {
|
||||
$remote_deleted = $remote_deleted + count( $files );
|
||||
} else {
|
||||
|
@ -1554,7 +1554,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$needs_downloading = false;
|
||||
|
||||
if ( ! file_exists( $fullpath ) ) {
|
||||
//if the file doesn't exist and they're using one of the cloud options, fetch it down from the cloud.
|
||||
// if the file doesn't exist and they're using one of the cloud options, fetch it down from the cloud.
|
||||
$needs_downloading = true;
|
||||
$updraftplus->log( 'File does not yet exist locally - needs downloading' );
|
||||
} elseif ( $known_size > 0 && filesize( $fullpath ) < $known_size ) {
|
||||
|
@ -1616,7 +1616,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
return array( 'result' => 'OK' );
|
||||
}
|
||||
|
||||
# Pass only a single service, as a string, into this function
|
||||
// Pass only a single service, as a string, into this function
|
||||
private function download_file( $file, $service ) {
|
||||
|
||||
global $updraftplus;
|
||||
|
@ -1728,7 +1728,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
if ( ! is_array( $foreign_known ) || empty( $foreign_known[ $backups[ $timestamp ]['meta_foreign'] ] ) ) {
|
||||
$err[] = sprintf( __( 'Backup created by unknown source (%s) - cannot be restored.', 'updraftplus' ), $backups[ $timestamp ]['meta_foreign'] );
|
||||
} else {
|
||||
# For some reason, on PHP 5.5 passing by reference in a single array stopped working with apply_filters_ref_array (though not with do_action_ref_array).
|
||||
// For some reason, on PHP 5.5 passing by reference in a single array stopped working with apply_filters_ref_array (though not with do_action_ref_array).
|
||||
$backupable_plus_db = apply_filters_ref_array( 'updraftplus_importforeign_backupable_plus_db', array(
|
||||
$backupable_plus_db,
|
||||
array( $foreign_known[ $backups[ $timestamp ]['meta_foreign'] ], &$mess, &$warn, &$err ),
|
||||
|
@ -1776,7 +1776,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$expected_index ++;
|
||||
}
|
||||
do_action_ref_array( "updraftplus_checkzip_end_$type", array( &$mess, &$warn, &$err ) );
|
||||
# Detect missing archives where they are missing from the end of the set
|
||||
// Detect missing archives where they are missing from the end of the set
|
||||
if ( $outof > 0 && $expected_index < $outof ) {
|
||||
for ( $j = $expected_index; $j < $outof; $j ++ ) {
|
||||
$missing .= ( '' === $missing ) ? ( 1 + $j ) : ',' . ( 1 + $j );
|
||||
|
@ -1835,7 +1835,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
}
|
||||
}
|
||||
$pval = ( $updraftplus->have_addons ) ? 1 : 0;
|
||||
//echo '<strong>'.__('Actions','updraftplus').':</strong> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&updraft_restore_success='.$s_val.'&pval='.$pval.'">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
// echo '<strong>'.__('Actions','updraftplus').':</strong> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus&updraft_restore_success='.$s_val.'&pval='.$pval.'">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
|
||||
} elseif ( is_wp_error( $backup_success ) ) {
|
||||
echo '<p>';
|
||||
|
@ -1844,10 +1844,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$updraftplus->log_wp_error( $backup_success );
|
||||
$updraftplus->log( 'Restore failed' );
|
||||
$updraftplus->list_errors();
|
||||
//echo '<strong>'.__('Actions','updraftplus').':</strong> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
// echo '<strong>'.__('Actions','updraftplus').':</strong> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
|
||||
} elseif ( false === $backup_success ) {
|
||||
# This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
|
||||
// This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
|
||||
|
||||
}
|
||||
|
||||
|
@ -1863,7 +1863,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
@set_time_limit( 900 );
|
||||
|
||||
global $wp_filesystem, $updraftplus;
|
||||
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
||||
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
||||
$backup_history = UpdraftPlus_Backup_History::get_history();
|
||||
if ( ! is_array( $backup_history[ $timestamp ] ) ) {
|
||||
echo wp_kses_post( '<p>' . esc_html__( 'This backup does not exist in the backup history - restoration aborted. Timestamp:', 'updraftplus' ) . " $timestamp</p><br/>" );
|
||||
|
@ -1897,20 +1897,20 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
exit;
|
||||
}
|
||||
|
||||
# Set up logging
|
||||
// Set up logging
|
||||
$updraftplus->backup_time_nonce();
|
||||
$updraftplus->jobdata_set( 'job_type', 'restore' );
|
||||
$updraftplus->jobdata_set( 'job_time_ms', $updraftplus->job_time_ms );
|
||||
$updraftplus->logfile_open( $updraftplus->nonce );
|
||||
|
||||
# Provide download link for the log file
|
||||
// Provide download link for the log file
|
||||
|
||||
#echo '<p><a target="_new" href="?action=downloadlog&page=updraftplus&updraftplus_backup_nonce='.htmlspecialchars($updraftplus->nonce).'">'.__('Follow this link to download the log file for this restoration.', 'updraftplus').'</a></p>';
|
||||
// echo '<p><a target="_new" href="?action=downloadlog&page=updraftplus&updraftplus_backup_nonce='.htmlspecialchars($updraftplus->nonce).'">'.__('Follow this link to download the log file for this restoration.', 'updraftplus').'</a></p>';
|
||||
|
||||
# TODO: Automatic purging of old log files
|
||||
# TODO: Provide option to auto-email the log file
|
||||
// TODO: Automatic purging of old log files
|
||||
// TODO: Provide option to auto-email the log file
|
||||
|
||||
//if we make it this far then WP_Filesystem has been instantiated and is functional (tested with ftpext, what about suPHP and other situations where direct may work?)
|
||||
// if we make it this far then WP_Filesystem has been instantiated and is functional (tested with ftpext, what about suPHP and other situations where direct may work?)
|
||||
echo '<h1>' . esc_html__( 'UpdraftPlus Restoration: Progress', 'updraftplus' ) . '</h1><div id="updraft-restore-progress">';
|
||||
$this->show_admin_warning( '<a href="#" onclick="event.preventDefault(); mainwp_updraft_popuplog(\'' . htmlspecialchars( $updraftplus->nonce ) . '\', this);" >' . __( 'Follow this link to download the log file for this restoration (needed for any support requests).', 'updraftplus' ) . '</a>' );
|
||||
|
||||
|
@ -2023,8 +2023,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
if ( 'wpcore' === $type && is_multisite() && 0 === $updraftplus_restorer->ud_backup_is_multisite ) {
|
||||
echo wp_kses_post( "<p>$type: <strong>" );
|
||||
esc_html_e( 'Skipping restoration of WordPress core when importing a single site into a multisite installation. If you had anything necessary in your WordPress directory then you will need to re-add it manually from the zip file.', 'updraftplus' );
|
||||
#TODO
|
||||
#$updraftplus->log_e('Skipping restoration of WordPress core when importing a single site into a multisite installation. If you had anything necessary in your WordPress directory then you will need to re-add it manually from the zip file.');
|
||||
// TODO
|
||||
// $updraftplus->log_e('Skipping restoration of WordPress core when importing a single site into a multisite installation. If you had anything necessary in your WordPress directory then you will need to re-add it manually from the zip file.');
|
||||
echo '</strong></p>';
|
||||
continue;
|
||||
}
|
||||
|
@ -2101,12 +2101,12 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$this->print_delete_old_dirs_form();
|
||||
}
|
||||
}
|
||||
echo '</div>'; //close the updraft_restore_progress div even if we error
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error
|
||||
restore_error_handler();
|
||||
|
||||
return $val;
|
||||
} elseif ( false === $val ) {
|
||||
echo '</div>'; //close the updraft_restore_progress div even if we error
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error
|
||||
restore_error_handler();
|
||||
|
||||
return false;
|
||||
|
@ -2135,7 +2135,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
// Second loop: now actually do the restoration
|
||||
uksort( $second_loop, array( $this, 'sort_restoration_entities' ) );
|
||||
foreach ( $second_loop as $type => $files ) {
|
||||
# Types: uploads, themes, plugins, others, db
|
||||
// Types: uploads, themes, plugins, others, db
|
||||
$info = ( isset( $backupable_entities[ $type ] ) ) ? $backupable_entities[ $type ] : array();
|
||||
|
||||
echo ( 'db' === $type ) ? '<h2>' . esc_html__( 'Database', 'updraftplus' ) . '</h2>' : '<h2>' . esc_html( $info['description'] ) . '</h2>';
|
||||
|
@ -2167,12 +2167,12 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
}
|
||||
}
|
||||
}
|
||||
echo '</div>'; //close the updraft_restore_progress div even if we error
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error
|
||||
restore_error_handler();
|
||||
|
||||
return $val;
|
||||
} elseif ( false === $val ) {
|
||||
echo '</div>'; //close the updraft_restore_progress div even if we error
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error
|
||||
restore_error_handler();
|
||||
|
||||
return false;
|
||||
|
@ -2186,14 +2186,14 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
add_filter( 'pre_option_' . $opt, array( $this, 'option_filter_' . $opt ) );
|
||||
}
|
||||
|
||||
# Clear any cached pages after the restore
|
||||
// Clear any cached pages after the restore
|
||||
$updraftplus_restorer->clear_cache();
|
||||
|
||||
if ( ! function_exists( 'validate_current_theme' ) ) {
|
||||
require_once ABSPATH . WPINC . '/themes';
|
||||
}
|
||||
|
||||
# Have seen a case where the current theme in the DB began with a capital, but not on disk - and this breaks migrating from Windows to a case-sensitive system
|
||||
// Have seen a case where the current theme in the DB began with a capital, but not on disk - and this breaks migrating from Windows to a case-sensitive system
|
||||
$template = get_option( 'template' );
|
||||
echo esc_html( $template );
|
||||
if ( ! empty( $template ) && WP_DEFAULT_THEME !== $template && strtolower( $template ) !== $template ) {
|
||||
|
@ -2213,11 +2213,11 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$updraftplus->log_e( 'The current theme was not found; to prevent this stopping the site from loading, your theme has been reverted to the default theme' );
|
||||
echo '</strong>';
|
||||
}
|
||||
#foreach (array('template', 'stylesheet', 'template_root', 'stylesheet_root') as $opt) {
|
||||
# remove_filter('pre_option_'.$opt, array($this, 'option_filter_'.$opt));
|
||||
#}
|
||||
// foreach (array('template', 'stylesheet', 'template_root', 'stylesheet_root') as $opt) {
|
||||
// remove_filter('pre_option_'.$opt, array($this, 'option_filter_'.$opt));
|
||||
// }
|
||||
|
||||
echo '</div>'; //close the updraft_restore_progress div
|
||||
echo '</div>'; // close the updraft_restore_progress div
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
|
@ -2265,7 +2265,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
} else {
|
||||
echo '<p>', esc_html__( 'Old directory removal failed for some reason. You may want to do this manually.', 'updraftplus' ) . '</p><br/>';
|
||||
}
|
||||
//if ($show_return) echo '<b>'.__('Actions','updraftplus').':</b> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
// if ($show_return) echo '<b>'.__('Actions','updraftplus').':</b> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus Configuration','updraftplus').'</a>';
|
||||
|
||||
$output = ob_get_clean();
|
||||
|
||||
|
@ -2275,7 +2275,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
);
|
||||
}
|
||||
|
||||
//deletes the -old directories that are created when a backup is restored.
|
||||
// deletes the -old directories that are created when a backup is restored.
|
||||
private function delete_old_dirs() {
|
||||
global $wp_filesystem, $updraftplus;
|
||||
$credentials = request_filesystem_credentials( wp_nonce_url( UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraft_delete_old_dirs', 'updraftplus-credentialtest-nonce' ) );
|
||||
|
@ -2296,7 +2296,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$ret4 = true;
|
||||
}
|
||||
|
||||
// $ret2 = $this->delete_old_dirs_dir($wp_filesystem->abspath());
|
||||
// $ret2 = $this->delete_old_dirs_dir($wp_filesystem->abspath());
|
||||
$plugs = untrailingslashit( $wp_filesystem->wp_plugins_dir() );
|
||||
if ( $wp_filesystem->is_dir( $plugs . '-old' ) ) {
|
||||
print '<strong>' . esc_html__( 'Delete', 'updraftplus' ) . ': </strong>plugins-old: ';
|
||||
|
@ -2333,7 +2333,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
foreach ( $list as $item ) {
|
||||
$name = ( is_array( $item ) ) ? $item['name'] : $item;
|
||||
if ( '-old' == substr( $name, - 4, 4 ) ) {
|
||||
//recursively delete
|
||||
// recursively delete
|
||||
print '<strong>' . esc_html__( 'Delete', 'updraftplus' ) . ': </strong>' . htmlspecialchars( $name ) . ': ';
|
||||
|
||||
if ( $wpfs ) {
|
||||
|
@ -2375,7 +2375,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$updraft_dir = $updraftplus->backups_dir_location();
|
||||
|
||||
if ( false === $db_file ) {
|
||||
# This attempts to raise the maximum packet size. This can't be done within the session, only globally. Therefore, it has to be done before the session starts; in our case, during the pre-analysis.
|
||||
// This attempts to raise the maximum packet size. This can't be done within the session, only globally. Therefore, it has to be done before the session starts; in our case, during the pre-analysis.
|
||||
$updraftplus->get_max_packet_size();
|
||||
|
||||
if (method_exists($updraftplus, 'get_backup_history')) {
|
||||
|
@ -2427,7 +2427,7 @@ 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 ) {
|
||||
$err[] = sprintf( __( 'The database is too small to be a valid WordPress database (size: %s Kb).', 'updraftplus' ), round( filesize( $db_file ) / 1024, 1 ) );
|
||||
|
||||
|
@ -2443,7 +2443,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
return array( $mess, $warn, $err, $info );
|
||||
}
|
||||
|
||||
# Analyse the file, print the results.
|
||||
// Analyse the file, print the results.
|
||||
|
||||
$line = 0;
|
||||
$old_siteurl = '';
|
||||
|
@ -2474,7 +2474,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
|
||||
$migration_warning = false;
|
||||
|
||||
# Don't set too high - we want a timely response returned to the browser
|
||||
// Don't set too high - we want a timely response returned to the browser
|
||||
@set_time_limit( 90 );
|
||||
|
||||
while ( ( ( $is_plain && ! feof( $dbhandle ) ) || ( ! $is_plain && ! gzeof( $dbhandle ) ) ) && ( $line < 100 || ( ! $header_only && count( $wanted_tables ) > 0 ) ) ) {
|
||||
|
@ -2510,20 +2510,20 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
$old_wp_version .= substr( $matches[3], 0, strlen( $matches[3] ) - 1 );
|
||||
}
|
||||
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);
|
||||
$warn[] = sprintf( __( 'You are importing from a newer version of WordPress (%1$s) into an older one (%2$s). There are no guarantees that WordPress can handle this.', 'updraftplus' ), $old_wp_version, $wp_version );
|
||||
}
|
||||
if ( preg_match( '/running on PHP ([0-9]+\.[0-9]+)(\s|\.)/', $matches[4], $nmatches ) && preg_match( '/^([0-9]+\.[0-9]+)(\s|\.)/', PHP_VERSION, $cmatches ) ) {
|
||||
$old_php_version = $nmatches[1];
|
||||
$current_php_version = $cmatches[1];
|
||||
if ( version_compare( $old_php_version, $current_php_version, '>' ) ) {
|
||||
//$mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
||||
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
||||
$warn[] = sprintf( __( 'The site in this backup was running on a webserver with version %1$s of %2$s. ', 'updraftplus' ), $old_php_version, 'PHP' ) . ' ' . sprintf( __( 'This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus' ), PHP_VERSION ) . ' ' . sprintf( __( 'You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus' ), 'PHP' ) . ' ' . sprintf( __( 'Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus' ), 'PHP' );
|
||||
}
|
||||
}
|
||||
} elseif ( '' === $old_table_prefix && ( preg_match( '/^\# Table prefix: (\S+)$/', $buffer, $matches ) || preg_match( '/^-- Table prefix: (\S+)$/i', $buffer, $matches ) ) ) {
|
||||
$old_table_prefix = $matches[1];
|
||||
// echo '<strong>'.__('Old table prefix:', 'updraftplus').'</strong> '.htmlspecialchars($old_table_prefix).'<br>';
|
||||
// echo '<strong>'.__('Old table prefix:', 'updraftplus').'</strong> '.htmlspecialchars($old_table_prefix).'<br>';
|
||||
} elseif ( empty( $info['label'] ) && preg_match( '/^\# Label: (.*)$/', $buffer, $matches ) ) {
|
||||
$info['label'] = $matches[1];
|
||||
$mess[] = __( 'Backup label:', 'updraftplus' ) . ' ' . htmlspecialchars( $info['label'] );
|
||||
|
@ -3070,7 +3070,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
if ( false === ( $bytes = gzread( $dbhandle, 3 ) ) ) {
|
||||
return false;
|
||||
}
|
||||
# Double-gzipped?
|
||||
// Double-gzipped?
|
||||
if ( 'H4sI' !== base64_encode( $bytes ) ) {
|
||||
if ( 0 === gzseek( $dbhandle, 0 ) ) {
|
||||
return $dbhandle;
|
||||
|
@ -3080,7 +3080,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
return gzopen( $file, 'r' );
|
||||
}
|
||||
}
|
||||
# Yes, it's double-gzipped
|
||||
// Yes, it's double-gzipped
|
||||
|
||||
$what_to_return = false;
|
||||
$mess = __( 'The database file appears to have been compressed twice - probably the website you downloaded it from had a mis-configured webserver.', 'updraftplus' );
|
||||
|
@ -3112,7 +3112,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
|
||||
gzclose( $dbhandle );
|
||||
fclose( $fnew );
|
||||
# On some systems (all Windows?) you can't rename a gz file whilst it's gzopened
|
||||
// On some systems (all Windows?) you can't rename a gz file whilst it's gzopened
|
||||
if ( ! rename( $file . '.tmp', $file ) ) {
|
||||
$err_msg = __( 'The attempt to undo the double-compression failed.', 'updraftplus' );
|
||||
} else {
|
||||
|
@ -3168,10 +3168,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
krsort( $backup_history );
|
||||
foreach ( $backup_history as $key => $backup ) {
|
||||
|
||||
# https://core.trac.wordpress.org/ticket/25331 explains why the following line is wrong
|
||||
# $pretty_date = date_i18n('Y-m-d G:i',$key);
|
||||
// https://core.trac.wordpress.org/ticket/25331 explains why the following line is wrong
|
||||
// $pretty_date = date_i18n('Y-m-d G:i',$key);
|
||||
// Convert to blog time zone
|
||||
// $pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int)$key), 'Y-m-d G:i');
|
||||
// $pretty_date = get_date_from_gmt(gmdate('Y-m-d H:i:s', (int)$key), 'Y-m-d G:i');
|
||||
$pretty_date = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', (int) $key ), 'M d, Y G:i' );
|
||||
|
||||
$esc_pretty_date = esc_attr( $pretty_date );
|
||||
|
@ -3179,17 +3179,17 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
|
||||
$non = $backup['nonce'];
|
||||
|
||||
// $rawbackup = "<h2>$esc_pretty_date ($key)</h2><pre><p>" . esc_attr( print_r( $backup, true ) );
|
||||
// if ( ! empty( $non ) ) {
|
||||
// $jd = $updraftplus->jobdata_getarray( $non );
|
||||
// if ( ! empty( $jd ) && is_array( $jd ) ) {
|
||||
// $rawbackup .= '</p><p>' . esc_attr( print_r( $jd, true ) );
|
||||
// }
|
||||
// }
|
||||
// $rawbackup .= '</p></pre>';
|
||||
// $rawbackup = "<h2>$esc_pretty_date ($key)</h2><pre><p>" . esc_attr( print_r( $backup, true ) );
|
||||
// if ( ! empty( $non ) ) {
|
||||
// $jd = $updraftplus->jobdata_getarray( $non );
|
||||
// if ( ! empty( $jd ) && is_array( $jd ) ) {
|
||||
// $rawbackup .= '</p><p>' . esc_attr( print_r( $jd, true ) );
|
||||
// }
|
||||
// }
|
||||
// $rawbackup .= '</p></pre>';
|
||||
|
||||
// to fix
|
||||
$rawbackup = ''; //$updraftplus_admin->raw_backup_info($backup_history, $key, $non);
|
||||
$rawbackup = ''; // $updraftplus_admin->raw_backup_info($backup_history, $key, $non);
|
||||
|
||||
$jobdata = $updraftplus->jobdata_getarray( $non );
|
||||
|
||||
|
@ -3208,7 +3208,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
if ('none' === $service || '' === $service || ( is_array($service) && ( empty($service) || array( 'none' ) === $service || array( '' ) === $service ) )) {
|
||||
// Do nothing
|
||||
} else {
|
||||
// $image_url = file_exists($image_folder.$service.'.png') ? $image_folder_url.$service.'.png' : $image_folder_url.'folder.png';
|
||||
// $image_url = file_exists($image_folder.$service.'.png') ? $image_folder_url.$service.'.png' : $image_folder_url.'folder.png';
|
||||
|
||||
$remote_storage = ( 'remotesend' === $service ) ? __('remote site', 'updraftplus') : $updraftplus->backup_methods[ $service ];
|
||||
|
||||
|
@ -3245,7 +3245,7 @@ ENDHERE;
|
|||
$ret .= $this->download_db_button( 'db', $key, $esc_pretty_date, $nonce_field, $backup, $accept );
|
||||
}
|
||||
|
||||
# External databases
|
||||
// External databases
|
||||
foreach ( $backup as $bkey => $binfo ) {
|
||||
if ( 'db' === $bkey || 'db' !== substr( $bkey, 0, 2 ) || '-size' === substr( $bkey, - 5, 5 ) ) {
|
||||
continue;
|
||||
|
@ -3253,7 +3253,7 @@ ENDHERE;
|
|||
$ret .= $this->download_db_button( $bkey, $key, $esc_pretty_date, $nonce_field, $backup );
|
||||
}
|
||||
} else {
|
||||
# Foreign without separate db
|
||||
// Foreign without separate db
|
||||
$entities = '/db=0/meta_foreign=1/';
|
||||
}
|
||||
|
||||
|
@ -3265,13 +3265,13 @@ ENDHERE;
|
|||
|
||||
$ret .= $download_buttons;
|
||||
|
||||
// $ret .="</td>";
|
||||
// $ret .="</td>";
|
||||
|
||||
// No logs expected for foreign backups
|
||||
if ( empty( $backup['meta_foreign'] ) ) {
|
||||
// $ret .= '<td>';
|
||||
// $ret .= $this->log_button($backup);
|
||||
// $ret .= "</td>";
|
||||
// $ret .= '<td>';
|
||||
// $ret .= $this->log_button($backup);
|
||||
// $ret .= "</td>";
|
||||
}
|
||||
|
||||
$ret .= '</td>';
|
||||
|
@ -3305,7 +3305,7 @@ ENDHERE;
|
|||
if ( isset( $backup['native'] ) && false === $backup['native'] ) {
|
||||
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
||||
}
|
||||
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
||||
// jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
||||
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="ui green button mwp-updraftplus-restore-btn" >' . __( 'Restore', 'updraftplus' ) . '</button>';
|
||||
}
|
||||
$ret .= "</form></div>\n";
|
||||
|
@ -3542,7 +3542,7 @@ ENDHERE;
|
|||
} else {
|
||||
$backupable_entities = $updraftplus->get_backupable_file_entities( true, false );
|
||||
if ( ! empty( $backupable_entities[ $_POST['entity'] ] ) ) {
|
||||
# Might be an array
|
||||
// Might be an array
|
||||
$basedir = $backupable_entities[ $_POST['entity'] ];
|
||||
$dirs = apply_filters( 'updraftplus_dirlist_' . $_POST['entity'], $basedir );
|
||||
$out['diskspaceused'] = $this->recursive_directory_size( $dirs, $updraftplus->get_exclude( $_POST['entity'] ), $basedir );
|
||||
|
@ -3555,7 +3555,7 @@ ENDHERE;
|
|||
}
|
||||
|
||||
|
||||
# If $basedirs is passed as an array, then $directorieses must be too
|
||||
// If $basedirs is passed as an array, then $directorieses must be too
|
||||
private function recursive_directory_size( $directorieses, $exclude = array(), $basedirs = '' ) {
|
||||
|
||||
$size = 0;
|
||||
|
@ -3627,7 +3627,7 @@ ENDHERE;
|
|||
$handlesize = $this->recursive_directory_size_raw( $prefix_directory, $exclude, $suffix_directory . ( '' === $suffix_directory ? '' : '/' ) . $file );
|
||||
if ( $handlesize >= 0 ) {
|
||||
$size += $handlesize;
|
||||
}# else { return -1; }
|
||||
}// else { return -1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3666,14 +3666,14 @@ ENDHERE;
|
|||
// A value for $this_job_only also causes something to always be returned (to allow detection of the job having started on the front-end)
|
||||
private function print_active_jobs( $this_job_only = false ) {
|
||||
$cron = $this->get_cron();
|
||||
// $found_jobs = 0;
|
||||
// $found_jobs = 0;
|
||||
$ret = '';
|
||||
|
||||
foreach ( $cron as $time => $job ) {
|
||||
if ( isset( $job['updraft_backup_resume'] ) ) {
|
||||
foreach ( $job['updraft_backup_resume'] as $hook => $info ) {
|
||||
if ( isset( $info['args'][1] ) ) {
|
||||
// $found_jobs++;
|
||||
// $found_jobs++;
|
||||
$job_id = $info['args'][1];
|
||||
if ( false === $this_job_only || $job_id === $this_job_only ) {
|
||||
$ret .= $this->print_active_job( $job_id, false, $time, $info['args'][0] );
|
||||
|
@ -3692,7 +3692,7 @@ ENDHERE;
|
|||
}
|
||||
}
|
||||
|
||||
// if (0 == $found_jobs) $ret .= '<p><em>'.__('(None)', 'updraftplus').'</em></p>';
|
||||
// if (0 == $found_jobs) $ret .= '<p><em>'.__('(None)', 'updraftplus').'</em></p>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -3707,7 +3707,7 @@ ENDHERE;
|
|||
return '';
|
||||
}
|
||||
|
||||
#if (!is_array($jobdata)) $jobdata = array();
|
||||
// if (!is_array($jobdata)) $jobdata = array();
|
||||
if ( ! isset( $jobdata['backup_time'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
@ -3719,11 +3719,11 @@ ENDHERE;
|
|||
$jobstatus = empty( $jobdata['jobstatus'] ) ? 'unknown' : $jobdata['jobstatus'];
|
||||
$stage = 0;
|
||||
switch ( $jobstatus ) {
|
||||
# Stage 0
|
||||
// Stage 0
|
||||
case 'begun':
|
||||
$curstage = __( 'Backup begun', 'updraftplus' );
|
||||
break;
|
||||
# Stage 1
|
||||
// Stage 1
|
||||
case 'filescreating':
|
||||
$stage = 1;
|
||||
$curstage = __( 'Creating file backup zips', 'updraftplus' );
|
||||
|
@ -3744,7 +3744,7 @@ ENDHERE;
|
|||
$curstage = __( 'Created file backup zips', 'updraftplus' );
|
||||
break;
|
||||
|
||||
# Stage 4
|
||||
// Stage 4
|
||||
case 'clouduploading':
|
||||
$stage = 4;
|
||||
$curstage = __( 'Uploading files to remote storage', 'updraftplus' );
|
||||
|
@ -3765,13 +3765,13 @@ ENDHERE;
|
|||
$stage = - 1;
|
||||
$curstage = __( 'Waiting until scheduled time to retry because of errors', 'updraftplus' );
|
||||
break;
|
||||
# Stage 6
|
||||
// Stage 6
|
||||
case 'finished':
|
||||
$stage = 6;
|
||||
$curstage = __( 'Backup finished', 'updraftplus' );
|
||||
break;
|
||||
default:
|
||||
# Database creation and encryption occupies the space from 2 to 4. Databases are created then encrypted, then the next databae is created/encrypted, etc.
|
||||
// Database creation and encryption occupies the space from 2 to 4. Databases are created then encrypted, then the next databae is created/encrypted, etc.
|
||||
if ( 'dbcreated' === substr( $jobstatus, 0, 9 ) ) {
|
||||
$jobstatus = 'dbcreated';
|
||||
$whichdb = substr( $jobstatus, 9 );
|
||||
|
|
|
@ -81,9 +81,9 @@ class MainWP_Child_WooCommerce_Status {
|
|||
AND posts.post_status = 'publish'
|
||||
AND tax.taxonomy = 'shop_order_status'
|
||||
AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array(
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
) ) ) . "' )
|
||||
AND postmeta.meta_key = '_order_total'
|
||||
AND posts.post_date >= %s
|
||||
|
@ -103,9 +103,9 @@ class MainWP_Child_WooCommerce_Status {
|
|||
AND posts.post_status = 'publish'
|
||||
AND tax.taxonomy = 'shop_order_status'
|
||||
AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array(
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
) ) ) . "' )
|
||||
AND order_item_meta.meta_key = '_qty'
|
||||
AND order_item_meta_2.meta_key = '_product_id'
|
||||
|
@ -202,9 +202,9 @@ class MainWP_Child_WooCommerce_Status {
|
|||
AND posts.post_status = 'publish'
|
||||
AND tax.taxonomy = 'shop_order_status'
|
||||
AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array(
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
) ) ) . "' )
|
||||
AND postmeta.meta_key = '_order_total'
|
||||
AND posts.post_date >= STR_TO_DATE(" . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s')
|
||||
|
@ -224,9 +224,9 @@ class MainWP_Child_WooCommerce_Status {
|
|||
AND posts.post_status = 'publish'
|
||||
AND tax.taxonomy = 'shop_order_status'
|
||||
AND term.slug IN ( '" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array(
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
'completed',
|
||||
'processing',
|
||||
'on-hold',
|
||||
) ) ) . "' )
|
||||
AND order_item_meta.meta_key = '_qty'
|
||||
AND order_item_meta_2.meta_key = '_product_id'
|
||||
|
|
|
@ -81,7 +81,7 @@ class MainWP_Child_Wordfence {
|
|||
'scansEnabled_fileContents',
|
||||
'scansEnabled_fileContentsGSB',
|
||||
'scan_include_extra',
|
||||
//'scansEnabled_heartbleed',
|
||||
// 'scansEnabled_heartbleed',
|
||||
'scansEnabled_checkHowGetIPs',
|
||||
'scansEnabled_highSense',
|
||||
'lowResourceScansEnabled',
|
||||
|
@ -96,7 +96,7 @@ class MainWP_Child_Wordfence {
|
|||
'scansEnabled_themes',
|
||||
'scheduledScansEnabled',
|
||||
'securityLevel',
|
||||
//'scheduleScan' // NOTE: filtered, not save
|
||||
// 'scheduleScan' // NOTE: filtered, not save
|
||||
'blockFakeBots',
|
||||
'neverBlockBG',
|
||||
'maxGlobalRequests',
|
||||
|
@ -134,15 +134,15 @@ class MainWP_Child_Wordfence {
|
|||
'disableCookies',
|
||||
'liveActivityPauseEnabled',
|
||||
'startScansRemotely',
|
||||
//'disableConfigCaching',
|
||||
//'addCacheComment', // removed
|
||||
// 'disableConfigCaching',
|
||||
// 'addCacheComment', // removed
|
||||
'disableCodeExecutionUploads',
|
||||
//'isPaid',
|
||||
// 'isPaid',
|
||||
'advancedCommentScanning',
|
||||
'scansEnabled_checkGSB',
|
||||
'checkSpamIP',
|
||||
'spamvertizeCheck',
|
||||
//'scansEnabled_public',
|
||||
// 'scansEnabled_public',
|
||||
'email_summary_enabled',
|
||||
'email_summary_dashboard_widget_enabled',
|
||||
'ssl_verify',
|
||||
|
@ -151,8 +151,8 @@ class MainWP_Child_Wordfence {
|
|||
'allowed404s',
|
||||
'wafAlertWhitelist',
|
||||
'wafAlertOnAttacks',
|
||||
//'ajaxWatcherDisabled_front', // do not update those values when save settings
|
||||
//'ajaxWatcherDisabled_admin' // those values saved in the ['changes'] in the saveOptions function
|
||||
// 'ajaxWatcherDisabled_front', // do not update those values when save settings
|
||||
// 'ajaxWatcherDisabled_admin' // those values saved in the ['changes'] in the saveOptions function
|
||||
'howGetIPs_trusted_proxies',
|
||||
'other_bypassLitespeedNoabort',
|
||||
'disableWAFIPBlocking',
|
||||
|
@ -168,11 +168,11 @@ class MainWP_Child_Wordfence {
|
|||
|
||||
// for separated saving this values
|
||||
public static $diagnosticParams = array(
|
||||
//'addCacheComment',
|
||||
// 'addCacheComment',
|
||||
'debugOn',
|
||||
'startScansRemotely',
|
||||
'ssl_verify',
|
||||
//'disableConfigCaching',
|
||||
// 'disableConfigCaching',
|
||||
'betaThreatDefenseFeed',
|
||||
);
|
||||
|
||||
|
@ -542,8 +542,8 @@ class MainWP_Child_Wordfence {
|
|||
);
|
||||
|
||||
$scan_opts = array(
|
||||
'scansEnabled_checkGSB', //paid
|
||||
'spamvertizeCheck', //paid
|
||||
'scansEnabled_checkGSB', // paid
|
||||
'spamvertizeCheck', // paid
|
||||
'checkSpamIP', // paid
|
||||
'scansEnabled_checkHowGetIPs',
|
||||
'scansEnabled_checkReadableConfig',
|
||||
|
@ -629,7 +629,7 @@ class MainWP_Child_Wordfence {
|
|||
private function kill_scan() {
|
||||
wordfence::status(1, 'info', 'Scan kill request received.');
|
||||
wordfence::status(10, 'info', 'SUM_KILLED:A request was received to kill the previous scan.');
|
||||
wfUtils::clearScanLock(); //Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
|
||||
wfUtils::clearScanLock(); // Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
|
||||
wfScanEngine::requestKill();
|
||||
return array(
|
||||
'ok' => 1,
|
||||
|
@ -1183,40 +1183,40 @@ SQL
|
|||
}
|
||||
}
|
||||
|
||||
// $to_fix_boolean_values = array(
|
||||
// 'scansEnabled_checkGSB',
|
||||
// 'spamvertizeCheck',
|
||||
// 'checkSpamIP',
|
||||
// 'scansEnabled_checkHowGetIPs',
|
||||
// 'scansEnabled_checkReadableConfig',
|
||||
// 'scansEnabled_suspectedFiles',
|
||||
// 'scansEnabled_core',
|
||||
// 'scansEnabled_themes',
|
||||
// 'scansEnabled_plugins',
|
||||
// 'scansEnabled_coreUnknown',
|
||||
// 'scansEnabled_malware',
|
||||
// 'scansEnabled_fileContents',
|
||||
// 'scansEnabled_fileContentsGSB',
|
||||
// 'scansEnabled_posts',
|
||||
// 'scansEnabled_comments',
|
||||
// 'scansEnabled_suspiciousOptions',
|
||||
// 'scansEnabled_oldVersions',
|
||||
// 'scansEnabled_suspiciousAdminUsers',
|
||||
// 'scansEnabled_passwds',
|
||||
// 'scansEnabled_diskSpace',
|
||||
// 'scansEnabled_dns',
|
||||
// 'other_scanOutside',
|
||||
// 'scansEnabled_scanImages',
|
||||
// 'scansEnabled_highSense',
|
||||
// 'scheduledScansEnabled',
|
||||
// 'lowResourceScansEnabled',
|
||||
// );
|
||||
// $to_fix_boolean_values = array(
|
||||
// 'scansEnabled_checkGSB',
|
||||
// 'spamvertizeCheck',
|
||||
// 'checkSpamIP',
|
||||
// 'scansEnabled_checkHowGetIPs',
|
||||
// 'scansEnabled_checkReadableConfig',
|
||||
// 'scansEnabled_suspectedFiles',
|
||||
// 'scansEnabled_core',
|
||||
// 'scansEnabled_themes',
|
||||
// 'scansEnabled_plugins',
|
||||
// 'scansEnabled_coreUnknown',
|
||||
// 'scansEnabled_malware',
|
||||
// 'scansEnabled_fileContents',
|
||||
// 'scansEnabled_fileContentsGSB',
|
||||
// 'scansEnabled_posts',
|
||||
// 'scansEnabled_comments',
|
||||
// 'scansEnabled_suspiciousOptions',
|
||||
// 'scansEnabled_oldVersions',
|
||||
// 'scansEnabled_suspiciousAdminUsers',
|
||||
// 'scansEnabled_passwds',
|
||||
// 'scansEnabled_diskSpace',
|
||||
// 'scansEnabled_dns',
|
||||
// 'other_scanOutside',
|
||||
// 'scansEnabled_scanImages',
|
||||
// 'scansEnabled_highSense',
|
||||
// 'scheduledScansEnabled',
|
||||
// 'lowResourceScansEnabled',
|
||||
// );
|
||||
//
|
||||
// save the settings
|
||||
foreach ( $opts as $key => $val ) {
|
||||
// check saving section fields
|
||||
if ( in_array( $key, $saving_opts ) ) {
|
||||
if ( 'apiKey' == $key ) { //Don't save API key yet
|
||||
if ( 'apiKey' == $key ) { // Don't save API key yet
|
||||
continue;
|
||||
}
|
||||
if (in_array( $key, self::$firewall_options_filter ) ) {
|
||||
|
@ -1283,7 +1283,7 @@ SQL
|
|||
}
|
||||
|
||||
// Finished saving settings
|
||||
/////////////////////
|
||||
//
|
||||
|
||||
$result['cacheType'] = wfConfig::get( 'cacheType' );
|
||||
$result['paidKeyMsg'] = false;
|
||||
|
@ -1323,17 +1323,17 @@ SQL
|
|||
$res = $api->call('check_api_key', array(), array( 'previousLicense' => $existingAPIKey ));
|
||||
if ( $res['ok'] && isset( $res['isPaid'] ) ) {
|
||||
|
||||
// wfConfig::set( 'apiKey', $apiKey );
|
||||
// wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
||||
// $result['apiKey'] = $apiKey;
|
||||
// $result['isPaid'] = $res['isPaid'];
|
||||
// if ( $res['isPaid'] ) {
|
||||
// $result['paidKeyMsg'] = true;
|
||||
// }
|
||||
// wfConfig::set( 'apiKey', $apiKey );
|
||||
// wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
||||
// $result['apiKey'] = $apiKey;
|
||||
// $result['isPaid'] = $res['isPaid'];
|
||||
// if ( $res['isPaid'] ) {
|
||||
// $result['paidKeyMsg'] = true;
|
||||
// }
|
||||
|
||||
$isPaid = wfUtils::truthyToBoolean($res['isPaid']);
|
||||
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();
|
||||
if ( ! $isPaid) {
|
||||
wfConfig::set('keyType', wfAPI::KEY_TYPE_FREE);
|
||||
|
@ -1472,7 +1472,7 @@ SQL
|
|||
|
||||
foreach ( $opts as $key => $val ) {
|
||||
if ( in_array( $key, self::$options_filter ) ) {
|
||||
if ( 'apiKey' !== $key ) { //Don't save API key yet
|
||||
if ( 'apiKey' !== $key ) { // Don't save API key yet
|
||||
wfConfig::set( $key, $val );
|
||||
}
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ SQL
|
|||
$result['cacheType'] = wfConfig::get( 'cacheType' );
|
||||
$result['paidKeyMsg'] = false;
|
||||
$apiKey = trim( $_POST['apiKey'] );
|
||||
if ( ! $apiKey ) { //Empty API key (after trim above), then try to get one.
|
||||
if ( ! $apiKey ) { // Empty API key (after trim above), then try to get one.
|
||||
$api = new wfAPI( '', wfUtils::getWPVersion() );
|
||||
try {
|
||||
$keyData = $api->call( 'get_anon_api_key' );
|
||||
|
@ -1548,7 +1548,7 @@ SQL
|
|||
$res = $api->call( 'check_api_key', array(), array() );
|
||||
if ( $res['ok'] && isset( $res['isPaid'] ) ) {
|
||||
wfConfig::set( 'apiKey', $apiKey );
|
||||
wfConfig::set( 'isPaid', $res['isPaid'] ); //res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
||||
wfConfig::set( 'isPaid', $res['isPaid'] ); // res['isPaid'] is boolean coming back as JSON and turned back into PHP struct. Assuming JSON to PHP handles bools.
|
||||
$result['apiKey'] = $apiKey;
|
||||
$result['isPaid'] = $res['isPaid'];
|
||||
if ( $res['isPaid'] ) {
|
||||
|
@ -1584,19 +1584,19 @@ SQL
|
|||
|
||||
$export = array();
|
||||
|
||||
//Basic Options
|
||||
// Basic Options
|
||||
$keys = wfConfig::getExportableOptionsKeys();
|
||||
foreach ($keys as $key) {
|
||||
$export[ $key ] = wfConfig::get($key, '');
|
||||
}
|
||||
|
||||
//Serialized Options
|
||||
// Serialized Options
|
||||
$export['scanSched'] = wfConfig::get_ser('scanSched', array());
|
||||
|
||||
//Table-based Options
|
||||
// Table-based Options
|
||||
$export['blocks'] = wfBlock::exportBlocks();
|
||||
|
||||
//Make the API call
|
||||
// Make the API call
|
||||
try {
|
||||
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
|
||||
$res = $api->call('export_options', array(), array( 'export' => json_encode($export) ));
|
||||
|
@ -1627,7 +1627,7 @@ SQL
|
|||
return array( 'errorImport' => __('An error occurred: Invalid options format received.', 'wordfence') );
|
||||
}
|
||||
|
||||
//Basic Options
|
||||
// Basic Options
|
||||
$keys = wfConfig::getExportableOptionsKeys();
|
||||
$toSet = array();
|
||||
foreach ($keys as $key) {
|
||||
|
@ -1650,14 +1650,14 @@ SQL
|
|||
wfConfig::save(wfConfig::clean($toSet));
|
||||
}
|
||||
|
||||
//Serialized Options
|
||||
// Serialized Options
|
||||
if (isset($import['scanSched']) && is_array($import['scanSched'])) {
|
||||
wfConfig::set_ser('scanSched', $import['scanSched']);
|
||||
wfScanner::shared()->scheduleScans();
|
||||
$totalSet++;
|
||||
}
|
||||
|
||||
//Table-based Options
|
||||
// Table-based Options
|
||||
if (isset($import['blocks']) && is_array($import['blocks'])) {
|
||||
wfBlock::importBlocks($import['blocks']);
|
||||
$totalSet += count($import['blocks']);
|
||||
|
@ -1684,7 +1684,7 @@ SQL
|
|||
foreach ($keys as $key) {
|
||||
$settings[ $key ] = wfConfig::get($key, '');
|
||||
}
|
||||
$settings['apiKey'] = wfConfig::get('apiKey'); //get more apiKey
|
||||
$settings['apiKey'] = wfConfig::get('apiKey'); // get more apiKey
|
||||
$settings['isPaid'] = wfConfig::get('isPaid');
|
||||
return $settings;
|
||||
}
|
||||
|
@ -1726,7 +1726,7 @@ SQL
|
|||
}
|
||||
}
|
||||
$jsonData['events'] = $events;
|
||||
$jsonData['alsoGet'] = $alsoGet; //send it back so we don't load data if panel has changed
|
||||
$jsonData['alsoGet'] = $alsoGet; // send it back so we don't load data if panel has changed
|
||||
$jsonData['cacheType'] = wfConfig::get( 'cacheType' );
|
||||
return $jsonData;
|
||||
}
|
||||
|
@ -2050,7 +2050,7 @@ SQL
|
|||
wfConfig::set( 'isPaid', 0 );
|
||||
$return['apiKey'] = $keyData['apiKey'];
|
||||
$return['isPaid'] = 0;
|
||||
//When downgrading we must disable all two factor authentication because it can lock an admin out if we don't.
|
||||
// When downgrading we must disable all two factor authentication because it can lock an admin out if we don't.
|
||||
wfConfig::set_ser( 'twoFactorUsers', array() );
|
||||
} else {
|
||||
throw new Exception( 'Could not understand the response we received from the Wordfence servers when applying for a free API key.' );
|
||||
|
@ -2127,7 +2127,7 @@ 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)) {
|
||||
wfCache::scheduleCacheClear();
|
||||
}
|
||||
|
@ -2161,7 +2161,7 @@ SQL
|
|||
}
|
||||
}
|
||||
wfConfig::set('cacheType', 'falcon');
|
||||
wfCache::scheduleUpdateBlockedIPs(); //Runs every 5 mins until we change cachetype
|
||||
wfCache::scheduleUpdateBlockedIPs(); // Runs every 5 mins until we change cachetype
|
||||
return array(
|
||||
'ok' => 1,
|
||||
'heading' => 'Wordfence Falcon Engine Activated!',
|
||||
|
@ -2240,7 +2240,7 @@ SQL
|
|||
$changed = true;
|
||||
}
|
||||
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);
|
||||
if ($changed && wfConfig::get('cacheType', false) == 'falcon') {
|
||||
$err = wfCache::addHtaccessCode('add');
|
||||
|
@ -2340,7 +2340,7 @@ SQL
|
|||
wfConfig::set('cacheExclusions', serialize($ex));
|
||||
wfCache::scheduleCacheClear();
|
||||
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(
|
||||
'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,
|
||||
|
@ -2380,7 +2380,7 @@ SQL
|
|||
$rewriteHtaccess = true;
|
||||
}
|
||||
array_splice($ex, $i, 1);
|
||||
//Dont break in case of dups
|
||||
// Dont break in case of dups
|
||||
$removed = true;
|
||||
}
|
||||
}
|
||||
|
@ -2391,7 +2391,7 @@ SQL
|
|||
}
|
||||
|
||||
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 $return;
|
||||
}
|
||||
|
@ -2962,7 +2962,7 @@ SQL
|
|||
<?php
|
||||
global $wpdb;
|
||||
$wfdb = new wfDB();
|
||||
//This must be done this way because MySQL with InnoDB tables does a full regeneration of all metadata if we don't. That takes a long time with a large table count.
|
||||
// This must be done this way because MySQL with InnoDB tables does a full regeneration of all metadata if we don't. That takes a long time with a large table count.
|
||||
$tables = $wfdb->querySelect('SELECT SQL_CALC_FOUND_ROWS TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() ORDER BY TABLE_NAME ASC LIMIT 250');
|
||||
$total = $wfdb->querySingle('SELECT FOUND_ROWS()');
|
||||
foreach ($tables as &$t) {
|
||||
|
@ -3130,7 +3130,7 @@ SQL
|
|||
$event->setWaf(wfWAF::getInstance());
|
||||
$event->fire();
|
||||
$isPaid = (bool) wfConfig::get('isPaid', 0);
|
||||
//return self::_getWAFData();
|
||||
// return self::_getWAFData();
|
||||
return array(
|
||||
'ok' => 1,
|
||||
'isPaid' => $isPaid,
|
||||
|
|
|
@ -34,9 +34,9 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
|
||||
public function init() {
|
||||
// if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( get_option( 'mainwp_wprocket_ext_enabled' ) !== 'Y' ) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ( ! $this->is_plugin_installed ) {
|
||||
return;
|
||||
|
@ -101,16 +101,16 @@ class MainWP_Child_WP_Rocket {
|
|||
'lazyload_iframes' => 0,
|
||||
'lazyload_youtube' => 0,
|
||||
'minify_css' => 0,
|
||||
// 'minify_css_key' => $minify_css_key,
|
||||
// 'minify_css_key' => $minify_css_key,
|
||||
'minify_concatenate_css' => 0,
|
||||
//'minify_css_combine_all' => 0,
|
||||
// 'minify_css_combine_all' => 0,
|
||||
'minify_css_legacy' => 0,
|
||||
'minify_js' => 0,
|
||||
// 'minify_js_key' => $minify_js_key,
|
||||
// 'minify_js_key' => $minify_js_key,
|
||||
'minify_js_in_footer' => array(),
|
||||
'minify_concatenate_js' => 0,
|
||||
'minify_js_combine_all' => 0,
|
||||
//'minify_js_legacy' => 0,
|
||||
// 'minify_js_legacy' => 0,
|
||||
'minify_google_fonts' => 0,
|
||||
'minify_html' => 0,
|
||||
'remove_query_strings' => 0,
|
||||
|
@ -118,13 +118,13 @@ class MainWP_Child_WP_Rocket {
|
|||
'cdn' => 0,
|
||||
'cdn_cnames' => array(),
|
||||
'cdn_zone' => array(),
|
||||
//'cdn_ssl' => 0,
|
||||
// 'cdn_ssl' => 0,
|
||||
'cdn_reject_files' => array(),
|
||||
'do_cloudflare' => 0,
|
||||
'cloudflare_email' => '',
|
||||
'cloudflare_api_key' => '',
|
||||
'cloudflare_domain' => '',
|
||||
//'cloudflare_zone_id' => '',
|
||||
// 'cloudflare_zone_id' => '',
|
||||
'cloudflare_devmode' => 0,
|
||||
'cloudflare_protocol_rewrite' => 0,
|
||||
'cloudflare_auto_settings' => 0,
|
||||
|
@ -207,9 +207,9 @@ class MainWP_Child_WP_Rocket {
|
|||
if ( ! $this->is_plugin_installed ) {
|
||||
return false;
|
||||
}
|
||||
// if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) {
|
||||
// return false;
|
||||
// }
|
||||
// if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_SLUG' ) ) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class MainWP_Child_WP_Rocket {
|
|||
$information = array();
|
||||
|
||||
if ( isset( $_POST['mwp_action'] ) ) {
|
||||
// MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
||||
// MainWP_Helper::update_option( 'mainwp_wprocket_ext_enabled', 'Y' );
|
||||
try {
|
||||
switch ( $_POST['mwp_action'] ) {
|
||||
case 'set_showhide':
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,8 +41,8 @@ class MainWP_Clone_Install {
|
|||
* @return bool
|
||||
*/
|
||||
public function checkZipConsole() {
|
||||
//todo: implement
|
||||
// return function_exists('system');
|
||||
// todo: implement
|
||||
// return function_exists('system');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class MainWP_Clone_Install {
|
|||
if ( null !== $this->archiver ) {
|
||||
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
//todo: implement
|
||||
// todo: implement
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
|
@ -73,7 +73,7 @@ class MainWP_Clone_Install {
|
|||
|
||||
return false;
|
||||
} else {
|
||||
//use pclzip
|
||||
// use pclzip
|
||||
$zip = new PclZip( $this->file );
|
||||
$list = $zip->delete( PCLZIP_OPT_BY_NAME, 'wp-config.php' );
|
||||
$list2 = $zip->delete( PCLZIP_OPT_BY_NAME, 'clone' );
|
||||
|
@ -115,7 +115,7 @@ class MainWP_Clone_Install {
|
|||
|
||||
return $this->archiver->file_exists( $file );
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
//todo: implement
|
||||
// todo: implement
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
|
@ -236,7 +236,7 @@ class MainWP_Clone_Install {
|
|||
$readline = '';
|
||||
while ( ( $line = fgets( $handle, 81920 ) ) !== false ) {
|
||||
if ( time() - $lastRun > 20 ) {
|
||||
@set_time_limit( 0 ); //reset timer..
|
||||
@set_time_limit( 0 ); // reset timer..
|
||||
$lastRun = time();
|
||||
}
|
||||
|
||||
|
@ -373,14 +373,14 @@ class MainWP_Clone_Install {
|
|||
return $content;
|
||||
} else {
|
||||
if ( $this->checkZipConsole() ) {
|
||||
//todo: implement
|
||||
// todo: implement
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
if ( $zipRes ) {
|
||||
$content = $zip->getFromName( 'clone/config.txt' );
|
||||
// $zip->deleteName('clone/config.txt');
|
||||
// $zip->deleteName('clone/');
|
||||
// $zip->deleteName('clone/config.txt');
|
||||
// $zip->deleteName('clone/');
|
||||
$zip->close();
|
||||
|
||||
return $content;
|
||||
|
@ -388,7 +388,7 @@ class MainWP_Clone_Install {
|
|||
|
||||
return false;
|
||||
} else {
|
||||
//use pclzip
|
||||
// use pclzip
|
||||
$zip = new PclZip( $this->file );
|
||||
$content = $zip->extract( PCLZIP_OPT_BY_NAME, 'clone/config.txt',
|
||||
PCLZIP_OPT_EXTRACT_AS_STRING );
|
||||
|
@ -484,8 +484,8 @@ class MainWP_Clone_Install {
|
|||
* @return bool
|
||||
*/
|
||||
public function extractZipConsoleBackup() {
|
||||
//todo implement
|
||||
//system('zip');
|
||||
// todo implement
|
||||
// system('zip');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class MainWP_Clone {
|
|||
$ajaxPosts = array();
|
||||
}
|
||||
|
||||
//If already processed, just quit!
|
||||
// If already processed, just quit!
|
||||
if ( isset( $ajaxPosts[ $action ] ) && ( $ajaxPosts[ $action ] == $_POST['dts'] ) ) {
|
||||
die( json_encode( array( 'error' => __( 'Double request!', 'mainwp-child' ) ) ) );
|
||||
}
|
||||
|
@ -1205,7 +1205,7 @@ class MainWP_Clone {
|
|||
$key = $siteToClone['extauth'];
|
||||
|
||||
MainWP_Helper::endSession();
|
||||
//Send request to the childsite!
|
||||
// Send request to the childsite!
|
||||
global $wp_version;
|
||||
$method = ( function_exists( 'gzopen' ) ? 'tar.gz' : 'zip' );
|
||||
$result = MainWP_Helper::fetchUrl( $url, array(
|
||||
|
@ -1257,7 +1257,7 @@ class MainWP_Clone {
|
|||
$key = $siteToClone['extauth'];
|
||||
|
||||
MainWP_Helper::endSession();
|
||||
//Send request to the childsite!
|
||||
// Send request to the childsite!
|
||||
$result = MainWP_Helper::fetchUrl( $url, array(
|
||||
'cloneFunc' => 'createCloneBackupPoll',
|
||||
'key' => $key,
|
||||
|
@ -1273,7 +1273,7 @@ class MainWP_Clone {
|
|||
} catch ( Exception $e ) {
|
||||
$output = array( 'error' => $e->getMessage() );
|
||||
}
|
||||
//Return size in kb
|
||||
// Return size in kb
|
||||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1284,7 @@ class MainWP_Clone {
|
|||
if ( ! isset( $_POST['file'] ) ) {
|
||||
throw new Exception( __( 'No download link given', 'mainwp-child' ) );
|
||||
}
|
||||
// if (!isset($_POST['siteId'])) throw new Exception(__('No site given','mainwp-child'));
|
||||
// if (!isset($_POST['siteId'])) throw new Exception(__('No site given','mainwp-child'));
|
||||
|
||||
$file = $_POST['file'];
|
||||
if ( isset( $_POST['siteId'] ) ) {
|
||||
|
@ -1304,7 +1304,7 @@ class MainWP_Clone {
|
|||
$url = $file;
|
||||
}
|
||||
MainWP_Helper::endSession();
|
||||
//Send request to the childsite!
|
||||
// Send request to the childsite!
|
||||
$split = explode( '=', $file );
|
||||
$file = urldecode( $split[ count( $split ) - 1 ] );
|
||||
$filename = 'download-' . basename( $file );
|
||||
|
@ -1342,7 +1342,7 @@ class MainWP_Clone {
|
|||
|
||||
$output = array( 'done' => $filename );
|
||||
|
||||
//Delete backup on child
|
||||
// Delete backup on child
|
||||
try {
|
||||
if ( isset( $_POST['siteId'] ) ) {
|
||||
$siteId = $_POST['siteId'];
|
||||
|
@ -1392,7 +1392,7 @@ class MainWP_Clone {
|
|||
} catch ( Exception $e ) {
|
||||
$output = array( 'error' => $e->getMessage() );
|
||||
}
|
||||
//return size in kb
|
||||
// return size in kb
|
||||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
|
@ -1429,10 +1429,10 @@ class MainWP_Clone {
|
|||
}
|
||||
$testFull = true;
|
||||
}
|
||||
//return size in kb
|
||||
// return size in kb
|
||||
$cloneInstall = new MainWP_Clone_Install( $file );
|
||||
|
||||
//todo: RS: refactor to get those plugins after install (after .18 release)
|
||||
// todo: RS: refactor to get those plugins after install (after .18 release)
|
||||
$cloneInstall->readConfigurationFile();
|
||||
|
||||
$plugins = get_option( 'mainwp_temp_clone_plugins' );
|
||||
|
@ -1454,14 +1454,14 @@ class MainWP_Clone {
|
|||
|
||||
$cloneInstall->install();
|
||||
|
||||
// $cloneInstall->update_option('mainwp_child_pubkey', $pubkey);
|
||||
// $cloneInstall->update_option('mainwp_child_uniqueId', $uniqueId);
|
||||
// $cloneInstall->update_option('mainwp_child_server', $server);
|
||||
// $cloneInstall->update_option('mainwp_child_nonce', $nonce);
|
||||
// $cloneInstall->update_option('mainwp_child_nossl', $nossl);
|
||||
// $cloneInstall->update_option('mainwp_child_nossl_key', $nossl_key);
|
||||
// $cloneInstall->update_option('mainwp_child_clone_sites', $sitesToClone);
|
||||
// $cloneInstall->update_option('mainwp_child_clone_permalink', true);
|
||||
// $cloneInstall->update_option('mainwp_child_pubkey', $pubkey);
|
||||
// $cloneInstall->update_option('mainwp_child_uniqueId', $uniqueId);
|
||||
// $cloneInstall->update_option('mainwp_child_server', $server);
|
||||
// $cloneInstall->update_option('mainwp_child_nonce', $nonce);
|
||||
// $cloneInstall->update_option('mainwp_child_nossl', $nossl);
|
||||
// $cloneInstall->update_option('mainwp_child_nossl_key', $nossl_key);
|
||||
// $cloneInstall->update_option('mainwp_child_clone_sites', $sitesToClone);
|
||||
// $cloneInstall->update_option('mainwp_child_clone_permalink', true);
|
||||
|
||||
// to fix update values
|
||||
delete_option('mainwp_child_pubkey');
|
||||
|
@ -1533,14 +1533,14 @@ class MainWP_Clone {
|
|||
delete_option( 'mainwp_temp_clone_themes' );
|
||||
}
|
||||
$output = array( 'result' => 'ok' );
|
||||
//todo: remove old tables if other prefix?
|
||||
// todo: remove old tables if other prefix?
|
||||
|
||||
wp_logout();
|
||||
wp_set_current_user( 0 );
|
||||
} catch ( Exception $e ) {
|
||||
$output = array( 'error' => $e->getMessage() );
|
||||
}
|
||||
//return size in kb
|
||||
// return size in kb
|
||||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ class MainWP_Custom_Post_Type {
|
|||
$error = error_get_last();
|
||||
if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) {
|
||||
$data = array( 'error' => 'MainWPChild fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] );
|
||||
// die( '<mainwp>' . base64_encode( serialize( ) ) . '</mainwp>' );
|
||||
// die( '<mainwp>' . base64_encode( serialize( ) ) . '</mainwp>' );
|
||||
} else {
|
||||
$data = self::$information;
|
||||
// die( '<mainwp>' . base64_encode( serialize( MainWP_Custom_Post_Type::$information ) ) . '</mainwp>' );
|
||||
// die( '<mainwp>' . base64_encode( serialize( MainWP_Custom_Post_Type::$information ) ) . '</mainwp>' );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['json_result'] ) && $_REQUEST['json_result'] ) {
|
||||
|
@ -174,7 +174,7 @@ class MainWP_Custom_Post_Type {
|
|||
return array( 'error' => __( 'Please install', $this->plugin_translate ) . ' ' . $data_insert['post_type'] . ' ' . __( 'on child and try again', $this->plugin_translate ) );
|
||||
}
|
||||
|
||||
//$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;
|
||||
if ( ( $data_insert['post_type'] == 'product' || $data_insert['post_type'] == 'product_variation' ) && function_exists( 'wc_product_has_unique_sku' ) ) {
|
||||
|
@ -303,7 +303,7 @@ class MainWP_Custom_Post_Type {
|
|||
}
|
||||
}
|
||||
|
||||
//Insert post terms except categories
|
||||
// Insert post terms except categories
|
||||
if ( ! empty( $data['terms'] ) && is_array( $data['terms'] ) ) {
|
||||
foreach ( $data['terms'] as $key ) {
|
||||
if ( ! taxonomy_exists( $key['taxonomy'] ) ) {
|
||||
|
|
|
@ -13,7 +13,7 @@ class MainWP_Debug {
|
|||
$start = microtime( true );
|
||||
|
||||
if ( 'fullbackup' == $_GET['mainwpdebug'] ) {
|
||||
//Full backup
|
||||
// Full backup
|
||||
$_POST['type'] = 'full';
|
||||
$_POST['excludebackup'] = '1';
|
||||
$_POST['excludecache'] = '1';
|
||||
|
|
|
@ -161,16 +161,16 @@ class MainWP_Helper {
|
|||
if ( ! is_array($img_data) ) {
|
||||
$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
|
||||
$upload_dir = wp_upload_dir();
|
||||
//Download $img_url
|
||||
// Download $img_url
|
||||
$temporary_file = download_url( $img_url );
|
||||
|
||||
if ( is_wp_error( $temporary_file ) ) {
|
||||
throw new Exception( 'Error: ' . $temporary_file->get_error_message() );
|
||||
} else {
|
||||
$filename = basename( $img_url );
|
||||
$local_img_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . $filename; //Local name
|
||||
$local_img_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . $filename; // Local name
|
||||
$local_img_url = $upload_dir['url'] . '/' . basename( $local_img_path );
|
||||
|
||||
$gen_unique_fn = true;
|
||||
|
@ -227,7 +227,7 @@ class MainWP_Helper {
|
|||
$moved = @rename( $temporary_file, $local_img_path );
|
||||
|
||||
if ( $moved ) {
|
||||
$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(
|
||||
'post_mime_type' => $wp_filetype['type'],
|
||||
'post_title' => isset( $img_data['title'] ) && ! empty( $img_data['title'] ) ? $img_data['title'] : preg_replace( '/\.[^.]+$/', '', basename( $img_url ) ),
|
||||
|
@ -242,10 +242,10 @@ class MainWP_Helper {
|
|||
$attachment['post_parent'] = $parent_id;
|
||||
}
|
||||
|
||||
$attach_id = wp_insert_attachment( $attachment, $local_img_path ); //Insert the image in the database
|
||||
$attach_id = wp_insert_attachment( $attachment, $local_img_path ); // Insert the image in the database
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
$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'] ) ) {
|
||||
update_post_meta( $attach_id, '_wp_attachment_image_alt', $img_data['alt'] );
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ class MainWP_Helper {
|
|||
$file_name = sanitize_file_name( $file_name );
|
||||
}
|
||||
|
||||
$full_file_name = $path . DIRECTORY_SEPARATOR . $file_name; //Local name
|
||||
$full_file_name = $path . DIRECTORY_SEPARATOR . $file_name; // Local name
|
||||
|
||||
$response = wp_remote_get( $file_url, array(
|
||||
'timeout' => 10 * 60 * 60,
|
||||
|
@ -365,9 +365,9 @@ class MainWP_Helper {
|
|||
|
||||
// current user may be connected admin or alternative admin
|
||||
$current_uid = $current_user->ID;
|
||||
//Set up a new post (adding addition information)
|
||||
//$usr = get_user_by( 'login', $_POST['user'] );
|
||||
//$new_post['post_author'] = $current_user->ID;
|
||||
// Set up a new post (adding addition information)
|
||||
// $usr = get_user_by( 'login', $_POST['user'] );
|
||||
// $new_post['post_author'] = $current_user->ID;
|
||||
|
||||
$is_robot_post = false; // retirement soon
|
||||
if ( isset( $_POST['isMainWPRobot'] ) && ! empty( $_POST['isMainWPRobot'] ) ) {
|
||||
|
@ -411,11 +411,11 @@ class MainWP_Helper {
|
|||
if ( isset( $new_post['post_date_gmt'] ) && ! empty( $new_post['post_date_gmt'] ) && $new_post['post_date_gmt'] != '0000-00-00 00:00:00' ) {
|
||||
$post_date_timestamp = strtotime( $new_post['post_date_gmt'] ) + get_option( 'gmt_offset' ) * 60 * 60;
|
||||
$new_post['post_date'] = date( 'Y-m-d H:i:s', $post_date_timestamp );
|
||||
//$new_post['post_status'] = ( $post_date_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future';
|
||||
// $new_post['post_status'] = ( $post_date_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future';
|
||||
}
|
||||
// else {
|
||||
// $new_post['post_status'] = 'publish';
|
||||
// }
|
||||
// else {
|
||||
// $new_post['post_status'] = 'publish';
|
||||
// }
|
||||
}
|
||||
|
||||
$wpr_options = isset( $_POST['wpr_options'] ) ? $_POST['wpr_options'] : array();
|
||||
|
@ -442,11 +442,11 @@ class MainWP_Helper {
|
|||
$check_image_existed = true; // if editing post then will check if image existed
|
||||
}
|
||||
|
||||
//Search for all the images added to the new post
|
||||
//some images have a href tag to click to navigate to the image.. we need to replace this too
|
||||
// Search for all the images added to the new post
|
||||
// some images have a href tag to click to navigate to the image.. we need to replace this too
|
||||
$foundMatches = preg_match_all( '/(<a[^>]+href=\"(.*?)\"[^>]*>)?(<img[^>\/]*src=\"((.*?)(png|gif|jpg|jpeg))\")/ix', $new_post['post_content'], $matches, PREG_SET_ORDER );
|
||||
if ( ( $foundMatches > 0 || ( $is_robot_post && isset( $wpr_options['wpr_save_images'] ) && 'Yes' === $wpr_options['wpr_save_images'] ) ) && ( ! $is_ezine_post ) ) {
|
||||
//We found images, now to download them so we can start balbal
|
||||
// We found images, now to download them so we can start balbal
|
||||
foreach ( $matches as $match ) {
|
||||
$hrefLink = $match[2];
|
||||
$imgUrl = $match[4];
|
||||
|
@ -476,12 +476,12 @@ class MainWP_Helper {
|
|||
$new_post['post_content'] = str_replace( $serverHref, $replaceServerHref, $new_post['post_content'] );
|
||||
}
|
||||
// To fix bug
|
||||
// else if ( strpos( $hrefLink, 'http' ) !== false ) {
|
||||
// $lnkToReplace = dirname( $hrefLink );
|
||||
// if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) {
|
||||
// $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] );
|
||||
// }
|
||||
// }
|
||||
// else if ( strpos( $hrefLink, 'http' ) !== false ) {
|
||||
// $lnkToReplace = dirname( $hrefLink );
|
||||
// if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) {
|
||||
// $new_post['post_content'] = str_replace( $lnkToReplace, $linkToReplaceWith, $new_post['post_content'] );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
$lnkToReplace = dirname( $imgUrl );
|
||||
if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) {
|
||||
|
@ -502,7 +502,7 @@ class MainWP_Helper {
|
|||
foreach ($post_gallery_images as $gallery) {
|
||||
if (isset($gallery['src'])) {
|
||||
try {
|
||||
$upload = self::uploadImage( $gallery['src'], $gallery ); //Upload image to WP
|
||||
$upload = self::uploadImage( $gallery['src'], $gallery ); // Upload image to WP
|
||||
if ( null !== $upload ) {
|
||||
$replaceAttachedIds[ $gallery['id'] ] = $upload['id'];
|
||||
}
|
||||
|
@ -563,8 +563,8 @@ class MainWP_Helper {
|
|||
}
|
||||
|
||||
$random_timestamp = rand( $random_date_from, $random_date_to );
|
||||
// $post_status = ( $random_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future';
|
||||
// $new_post['post_status'] = $post_status;
|
||||
// $post_status = ( $random_timestamp <= current_time( 'timestamp' ) ) ? 'publish' : 'future';
|
||||
// $new_post['post_status'] = $post_status;
|
||||
$new_post['post_date'] = date( 'Y-m-d H:i:s', $random_timestamp );
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ class MainWP_Helper {
|
|||
$new_post['tags_input'] = $post_tags;
|
||||
}
|
||||
|
||||
//Save the post to the wp
|
||||
// Save the post to the wp
|
||||
remove_filter( 'content_save_pre', 'wp_filter_post_kses' ); // to fix brake scripts or html
|
||||
$post_status = $new_post['post_status'];
|
||||
$new_post['post_status'] = 'auto-draft'; // child reports: to logging as created post
|
||||
|
@ -590,7 +590,7 @@ class MainWP_Helper {
|
|||
|
||||
$new_post_id = wp_insert_post( $new_post, $wp_error );
|
||||
|
||||
//Show errors if something went wrong
|
||||
// Show errors if something went wrong
|
||||
if ( is_wp_error( $wp_error ) ) {
|
||||
return $wp_error->get_error_message();
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ class MainWP_Helper {
|
|||
$seo_ext_activated = true;
|
||||
}
|
||||
|
||||
//Set custom fields
|
||||
// Set custom fields
|
||||
$not_allowed = array(
|
||||
'_slug',
|
||||
'_tags',
|
||||
|
@ -700,9 +700,9 @@ class MainWP_Helper {
|
|||
// upload image if it on the server
|
||||
if ( ! empty( $_seo_opengraph_image ) && strpos( $_seo_opengraph_image, $_server_domain ) !== false ) {
|
||||
try {
|
||||
$upload = self::uploadImage( $_seo_opengraph_image ); //Upload image to WP
|
||||
$upload = self::uploadImage( $_seo_opengraph_image ); // Upload image to WP
|
||||
if ( null !== $upload ) {
|
||||
update_post_meta( $new_post_id, WPSEO_Meta::$meta_prefix . 'opengraph-image', $upload['url'] ); //Add the image to the post!
|
||||
update_post_meta( $new_post_id, WPSEO_Meta::$meta_prefix . 'opengraph-image', $upload['url'] ); // Add the image to the post!
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
|
||||
|
@ -711,8 +711,8 @@ class MainWP_Helper {
|
|||
}
|
||||
}
|
||||
|
||||
//If categories exist, create them (second parameter of wp_create_categories adds the categories to the post)
|
||||
include_once ABSPATH . 'wp-admin/includes/taxonomy.php'; //Contains wp_create_categories
|
||||
// If categories exist, create them (second parameter of wp_create_categories adds the categories to the post)
|
||||
include_once ABSPATH . 'wp-admin/includes/taxonomy.php'; // Contains wp_create_categories
|
||||
if ( isset( $post_category ) && '' !== $post_category ) {
|
||||
$categories = explode( ',', $post_category );
|
||||
if ( count( $categories ) > 0 ) {
|
||||
|
@ -733,12 +733,12 @@ class MainWP_Helper {
|
|||
}
|
||||
|
||||
$featured_image_exist = false;
|
||||
//If featured image exists - set it
|
||||
// If featured image exists - set it
|
||||
if ( null !== $post_featured_image ) {
|
||||
try {
|
||||
$upload = self::uploadImage( $post_featured_image, array(), $check_image_existed, $new_post_id); //Upload image to WP
|
||||
$upload = self::uploadImage( $post_featured_image, array(), $check_image_existed, $new_post_id); // Upload image to WP
|
||||
if ( null !== $upload ) {
|
||||
update_post_meta( $new_post_id, '_thumbnail_id', $upload['id'] ); //Add the thumbnail to the post!
|
||||
update_post_meta( $new_post_id, '_thumbnail_id', $upload['id'] ); // Add the thumbnail to the post!
|
||||
$featured_image_exist = true;
|
||||
if (isset($others['featured_image_data'])) {
|
||||
$_image_data = $others['featured_image_data'];
|
||||
|
@ -949,9 +949,9 @@ class MainWP_Helper {
|
|||
|
||||
if ( empty( $wp_filesystem ) ) {
|
||||
ob_start();
|
||||
// if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) {
|
||||
// include_once( ABSPATH . '/wp-admin/includes/deprecated.php' );
|
||||
// }
|
||||
// if ( file_exists( ABSPATH . '/wp-admin/includes/deprecated.php' ) ) {
|
||||
// include_once( ABSPATH . '/wp-admin/includes/deprecated.php' );
|
||||
// }
|
||||
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
||||
include_once ABSPATH . '/wp-admin/includes/screen.php';
|
||||
}
|
||||
|
@ -1049,7 +1049,7 @@ class MainWP_Helper {
|
|||
}
|
||||
|
||||
public static function _fetchUrl( $url, $postdata ) {
|
||||
//$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)';
|
||||
|
||||
if ( ! is_array( $postdata )) {
|
||||
|
@ -1075,7 +1075,7 @@ class MainWP_Helper {
|
|||
} elseif ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $data, $results ) > 0 ) {
|
||||
$result = $results[1];
|
||||
$result_base = base64_decode( $result );
|
||||
//$information = maybe_unserialize( $result_base );
|
||||
// $information = maybe_unserialize( $result_base );
|
||||
$information = json_decode( $result_base, true ); // it is json_encode result
|
||||
|
||||
return $information;
|
||||
|
|
|
@ -31,7 +31,7 @@ class MainWP_Keyword_Links {
|
|||
if ( empty( $this->keyword_links ) ) {
|
||||
$this->keyword_links = array();
|
||||
}
|
||||
//print_r($this->keyword_links);
|
||||
// print_r($this->keyword_links);
|
||||
$this->siteurl = get_option( 'home' );
|
||||
add_action( 'permalink_structure_changed', array( &$this, 'permalinkChanged' ), 10, 2 );
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class MainWP_Keyword_Links {
|
|||
$rules .= "RewriteEngine On\n";
|
||||
$rules .= "RewriteBase $home_root\n";
|
||||
|
||||
//add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
|
||||
// add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
|
||||
foreach ( $pRules as $match => $query ) {
|
||||
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
|
||||
$match = str_replace( '.+?', '.+', $match );
|
||||
|
@ -131,9 +131,9 @@ class MainWP_Keyword_Links {
|
|||
if ( empty( $redirection_folder ) ) {
|
||||
$rules = $this->get_cloak_rules();
|
||||
$rules = $this->mod_rewrite_rules( $rules );
|
||||
//self::clear_htaccess();
|
||||
// self::clear_htaccess();
|
||||
} else {
|
||||
//Create rewrite ruler
|
||||
// Create rewrite ruler
|
||||
$rules = $this->mod_rewrite_rules( array( $redirection_folder . '/' => 'index.php' ) );
|
||||
}
|
||||
$home_path = ABSPATH;
|
||||
|
@ -297,7 +297,7 @@ class MainWP_Keyword_Links {
|
|||
if ( is_array( $specific_link ) && count( $specific_link ) > 0 ) {
|
||||
$specific_link = current( $specific_link );
|
||||
$specific_link->post_id = $post->ID;
|
||||
//update_post_meta($post->ID, '_mainwp_kwl_specific_link_save', array($specific_link->id => $specific_link));
|
||||
// update_post_meta($post->ID, '_mainwp_kwl_specific_link_save', array($specific_link->id => $specific_link));
|
||||
update_post_meta( $post->ID, '_mainwp_kwl_specific_link_id', $specific_link->id );
|
||||
if ( $this->set_link( $specific_link->id, $specific_link ) ) {
|
||||
update_post_meta( $post->ID, '_mainwp_kwl_specific_link', '<saved>' );
|
||||
|
@ -312,11 +312,11 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
|
||||
// print_r($this->keyword_links);
|
||||
// if ($post->ID == 751) {
|
||||
// //print_r($links);
|
||||
// $custom = get_post_custom($post->ID);
|
||||
// print_r($custom);
|
||||
// }
|
||||
// if ($post->ID == 751) {
|
||||
// print_r($links);
|
||||
// $custom = get_post_custom($post->ID);
|
||||
// print_r($custom);
|
||||
// }
|
||||
|
||||
if ( empty( $links ) ) {
|
||||
return $content;
|
||||
|
@ -343,10 +343,10 @@ class MainWP_Keyword_Links {
|
|||
$this->link_exact_match = $link->exact_match;
|
||||
$this->link_case_sensitive = $link->case_sensitive;
|
||||
$keywords = $this->explode_multi( $link->keyword );
|
||||
//usort( $keywords, create_function( '$a,$b', 'return strlen($a)<strlen($b);' ) );
|
||||
// usort( $keywords, create_function( '$a,$b', 'return strlen($a)<strlen($b);' ) );
|
||||
usort( $keywords, array( $this, 'usort_callback_func' ) );
|
||||
$replace_cs = $link->case_sensitive ? 's' : 'is';
|
||||
//print_r($keywords);
|
||||
// print_r($keywords);
|
||||
foreach ( $keywords as $keyword ) {
|
||||
$keyword = trim( $keyword );
|
||||
if ( empty( $keyword ) ) {
|
||||
|
@ -361,15 +361,15 @@ class MainWP_Keyword_Links {
|
|||
$keyword = preg_replace( '/([$^\/?+.*\]\[)(}{])/is', '\\\\\1', $keyword );
|
||||
|
||||
if ( ( $link->case_sensitive && strpos( $content, $keyword ) !== false ) || ( ! $link->case_sensitive && stripos( $content, $keyword ) !== false ) ) {
|
||||
//Replace keyword in H tag
|
||||
// Replace keyword in H tag
|
||||
if ( $this->get_option( 'replace_keyword_in_h_tag' ) ) {
|
||||
//$content = preg_replace_callback('/(<a[^>]*>.*?'.$keyword.'.*?<\/a>|<[^>]*'.$keyword.'[^>]*>|\{[^}]*'.$keyword.'[^}]*\}|\w*('.$keyword.')\w*)/is', array(&$this, 'keyword_mark'), $content);
|
||||
// $content = preg_replace_callback('/(<a[^>]*>.*?'.$keyword.'.*?<\/a>|<[^>]*'.$keyword.'[^>]*>|\{[^}]*'.$keyword.'[^}]*\}|\w*('.$keyword.')\w*)/is', array(&$this, 'keyword_mark'), $content);
|
||||
$content = preg_replace_callback( '/(<a[^>]*>[^<]*?' . $keyword . '[^<]*?<\/a>|<[^>]*' . $keyword . '[^>]*>|\{[^\}]*' . $keyword . '[^\}]*\}|\w*(' . $keyword . ')\w*)/' . $replace_cs, array(
|
||||
&$this,
|
||||
'keyword_mark',
|
||||
), $content );
|
||||
} else {
|
||||
//$content = preg_replace_callback('/(<h[123456][^>]*>.*?'.$keyword.'.*?<\/h[123456]>|<a[^>]*>.*?'.$keyword.'.*?<\/a>|<[^>]*'.$keyword.'[^>]*>|\{[^}]*'.$keyword.'[^}]*\}|\w*('.$keyword.')\w*)/is', array(&$this, 'keyword_mark'), $content);
|
||||
// $content = preg_replace_callback('/(<h[123456][^>]*>.*?'.$keyword.'.*?<\/h[123456]>|<a[^>]*>.*?'.$keyword.'.*?<\/a>|<[^>]*'.$keyword.'[^>]*>|\{[^}]*'.$keyword.'[^}]*\}|\w*('.$keyword.')\w*)/is', array(&$this, 'keyword_mark'), $content);
|
||||
$content = preg_replace_callback( '/(<h[123456][^>]*>[^<]*?' . $keyword . '[^<]*?<\/h[123456]>|<a[^>]*>[^<]*?' . $keyword . '[^<]*?<\/a>|<[^>]*' . $keyword . '[^>]*>|\{[^\}]*' . $keyword . '[^\}]*\}|\w*(' . $keyword . ')\w*)/' . $replace_cs, array(
|
||||
&$this,
|
||||
'keyword_mark',
|
||||
|
@ -378,7 +378,7 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
}
|
||||
}
|
||||
//$content = preg_replace_callback('/\{MAINWP_LINK +HREF="(.*?)" +TARGET="(.*?)" +REL="(.*?)" +LINK-ID="(.*?)" +CLASS="(.*?)" +TEXT="(.*?)" *\}/is', array(&$this, 'keyword_replace'), $content);
|
||||
// $content = preg_replace_callback('/\{MAINWP_LINK +HREF="(.*?)" +TARGET="(.*?)" +REL="(.*?)" +LINK-ID="(.*?)" +CLASS="(.*?)" +TEXT="(.*?)" *\}/is', array(&$this, 'keyword_replace'), $content);
|
||||
$content = preg_replace_callback( '/\{MAINWP_LINK +HREF="(.*?)" +TARGET="(.*?)" +REL="(.*?)" +LINK-ID="(.*?)" +CLASS="(.*?)" +TEXT="(.*?)" +FULL_TEXT="(.*?)" *\}/is', array(
|
||||
&$this,
|
||||
'keyword_replace',
|
||||
|
@ -415,19 +415,19 @@ class MainWP_Keyword_Links {
|
|||
$this->link_count_each_temp --;
|
||||
}
|
||||
|
||||
// if (isset($this->link_temp->type) && $this->link_temp->type == 'post_type') {
|
||||
//// $post = get_post($this->link_temp->id);
|
||||
//// if ($post) {
|
||||
//// $disable_linking = $this->get_option('disable_linking_automatically', array());
|
||||
//// if (in_array($post->post_name, $disable_linking[$post->post_type]))
|
||||
//// return $matches[1]; // do not link to this post
|
||||
//// }
|
||||
// $link_target = get_post_meta($this->link_temp->id, '_mainwp_kl_link_newtab', true);
|
||||
// $this->link_temp->link_target = ( $link_target != -1 && $link_target == 1 ? '_blank' : '' );
|
||||
// $link_rel = get_post_meta($this->link_temp->id, '_mainwp_kl_link_nofollow', true);
|
||||
// $this->link_temp->link_rel = ( $link_rel != -1 && $link_rel == 1 ? 'nofollow' : '' );
|
||||
// $this->link_temp->link_class = get_post_meta($this->link_temp->id, '_mainwp_kl_link_class', true);
|
||||
// }
|
||||
// if (isset($this->link_temp->type) && $this->link_temp->type == 'post_type') {
|
||||
// $post = get_post($this->link_temp->id);
|
||||
// if ($post) {
|
||||
// $disable_linking = $this->get_option('disable_linking_automatically', array());
|
||||
// if (in_array($post->post_name, $disable_linking[$post->post_type]))
|
||||
// return $matches[1]; // do not link to this post
|
||||
// }
|
||||
// $link_target = get_post_meta($this->link_temp->id, '_mainwp_kl_link_newtab', true);
|
||||
// $this->link_temp->link_target = ( $link_target != -1 && $link_target == 1 ? '_blank' : '' );
|
||||
// $link_rel = get_post_meta($this->link_temp->id, '_mainwp_kl_link_nofollow', true);
|
||||
// $this->link_temp->link_rel = ( $link_rel != -1 && $link_rel == 1 ? 'nofollow' : '' );
|
||||
// $this->link_temp->link_class = get_post_meta($this->link_temp->id, '_mainwp_kl_link_class', true);
|
||||
// }
|
||||
if ( '-1' !== $this->link_temp->link_target ) {
|
||||
$target = $this->link_temp->link_target;
|
||||
} else {
|
||||
|
@ -456,7 +456,7 @@ class MainWP_Keyword_Links {
|
|||
$class .= ' kwl-regular-link';
|
||||
}
|
||||
|
||||
//return '{MAINWP_LINK HREF="' . ( $this->link_temp->cloak_path ? $this->siteurl . $redirection_folder . '/' . $this->link_temp->cloak_path : $this->link_temp->destination_url) . '" TARGET="' . $target . '" REL="' . $rel . '" LINK-ID="' . (isset($this->link_temp->id) ? $this->link_temp->id : 0) . '" CLASS="' . $class . '" TEXT="' . $matches[1] . '"}';
|
||||
// return '{MAINWP_LINK HREF="' . ( $this->link_temp->cloak_path ? $this->siteurl . $redirection_folder . '/' . $this->link_temp->cloak_path : $this->link_temp->destination_url) . '" TARGET="' . $target . '" REL="' . $rel . '" LINK-ID="' . (isset($this->link_temp->id) ? $this->link_temp->id : 0) . '" CLASS="' . $class . '" TEXT="' . $matches[1] . '"}';
|
||||
return '{MAINWP_LINK HREF="' . ( $this->link_temp->cloak_path ? $this->siteurl . $redirection_folder . '/' . $this->link_temp->cloak_path : $this->link_temp->destination_url ) . '" TARGET="' . $target . '" REL="' . $rel . '" LINK-ID="' . ( isset( $this->link_temp->id ) ? $this->link_temp->id : 0 ) . '" CLASS="' . $class . '" TEXT="' . $matches[2] . '" FULL_TEXT="' . $matches[1] . '"}';
|
||||
}
|
||||
|
||||
|
@ -483,16 +483,16 @@ class MainWP_Keyword_Links {
|
|||
$post = get_post( $post_id );
|
||||
}
|
||||
$links = array();
|
||||
// $disable_add_links = $this->get_option('disable_add_links_automatically');
|
||||
// // if disabled add links automatically in this post, avoid
|
||||
// if (in_array($post->post_name, (array) $disable_add_links[$post->post_type])) {
|
||||
// return $links;
|
||||
// }
|
||||
// $disable_add_links = $this->get_option('disable_add_links_automatically');
|
||||
// if disabled add links automatically in this post, avoid
|
||||
// if (in_array($post->post_name, (array) $disable_add_links[$post->post_type])) {
|
||||
// return $links;
|
||||
// }
|
||||
|
||||
// Check if this post was disabled with this function, come back
|
||||
// $disable = get_post_meta($post->ID, '_mainwp_kl_disable', true);
|
||||
// if ($disable == 1)
|
||||
// return $links;
|
||||
// $disable = get_post_meta($post->ID, '_mainwp_kl_disable', true);
|
||||
// if ($disable == 1)
|
||||
// return $links;
|
||||
// count replace max and max keyword allowed.
|
||||
$replace_max = intval( $this->get_option( 'replace_max' ) );
|
||||
$replace_max_keyword = intval( $this->get_option( 'replace_max_keyword' ) );
|
||||
|
@ -514,7 +514,7 @@ class MainWP_Keyword_Links {
|
|||
} else {
|
||||
$links_post_type = (array) $this->get_post_keywords( $post_type );
|
||||
}
|
||||
//print_r($links_post_type);
|
||||
// print_r($links_post_type);
|
||||
if ( count( $links_post_type ) > 0 ) {
|
||||
$links = array_merge( $links, $links_post_type );
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ class MainWP_Keyword_Links {
|
|||
$join = "JOIN $wpdb->term_relationships tr ON tr.object_id = p.ID";
|
||||
$where = " AND (tr.term_taxonomy_id = '" . implode( "' OR tr.term_taxonomy_id = '", $cats ) . "')";
|
||||
}
|
||||
//$results = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->posts as p LEFT JOIN $wpdb->postmeta as pm ON p.ID=pm.post_id $join WHERE p.post_status='publish' AND p.post_type='%s' AND pm.meta_key='_mainwp_kl_post_keyword' $where", $post_type));
|
||||
// $results = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->posts as p LEFT JOIN $wpdb->postmeta as pm ON p.ID=pm.post_id $join WHERE p.post_status='publish' AND p.post_type='%s' AND pm.meta_key='_mainwp_kl_post_keyword' $where", $post_type));
|
||||
$results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts as p $join WHERE p.post_status='publish' AND p.post_type= %s $where", $post_type ) );
|
||||
$links = array();
|
||||
if ( ! is_array( $results ) ) {
|
||||
|
@ -573,12 +573,12 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
$link = new stdClass();
|
||||
// This is on-fly link so have not ID
|
||||
//$link->id = $result->ID;
|
||||
// $link->id = $result->ID;
|
||||
$link->name = $result->post_title;
|
||||
//if ($result->post_type == 'page')
|
||||
// $link->destination_url = get_permalink($result->ID);
|
||||
//else
|
||||
// $link->destination_url = $result->guid;
|
||||
// if ($result->post_type == 'page')
|
||||
// $link->destination_url = get_permalink($result->ID);
|
||||
// else
|
||||
// $link->destination_url = $result->guid;
|
||||
$link->destination_url = get_permalink( $result->ID );
|
||||
$link->cloak_path = '';
|
||||
$link->keyword = ( 1 === (int) $this->get_option( 'post_match_title' ) ? $result->post_title : '' );
|
||||
|
@ -625,7 +625,7 @@ class MainWP_Keyword_Links {
|
|||
$redirection_folder = $this->get_option( 'redirection_folder', '' );
|
||||
|
||||
if ( ! empty( $redirection_folder ) ) {
|
||||
//if the request doesn't' containt the redirection folder we will return immediately
|
||||
// if the request doesn't' containt the redirection folder we will return immediately
|
||||
if ( strpos( $filter_request, $redirection_folder . '/' ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
@ -677,21 +677,21 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
}
|
||||
|
||||
// public function get_statistic() {
|
||||
// global $wpdb;
|
||||
// $link_id = $_POST['link_id'];
|
||||
// if ($link_id) {
|
||||
// $stat_data = get_option('mainwp_kwl_statistic_data_' . $link_id, array());
|
||||
// if ($stat_data) {
|
||||
// $return['stat_data'] = $stat_data;
|
||||
// //$wpdb->query("UPDATE {$wpdb->prefix}options SET option_name = 'mainwp_kwl_statistic_data_done_" . $link_id . "' WHERE option_name = 'mainwp_kwl_statistic_data_" . $link_id . "'");
|
||||
// update_option('mainwp_kwl_statistic_data_' . $link_id, '');
|
||||
// } else
|
||||
// $return['stat_data'] = 'EMPTY';
|
||||
// $return['status'] = 'SUCCESS';
|
||||
// }
|
||||
// return $return;
|
||||
// }
|
||||
// public function get_statistic() {
|
||||
// global $wpdb;
|
||||
// $link_id = $_POST['link_id'];
|
||||
// if ($link_id) {
|
||||
// $stat_data = get_option('mainwp_kwl_statistic_data_' . $link_id, array());
|
||||
// if ($stat_data) {
|
||||
// $return['stat_data'] = $stat_data;
|
||||
// $wpdb->query("UPDATE {$wpdb->prefix}options SET option_name = 'mainwp_kwl_statistic_data_done_" . $link_id . "' WHERE option_name = 'mainwp_kwl_statistic_data_" . $link_id . "'");
|
||||
// update_option('mainwp_kwl_statistic_data_' . $link_id, '');
|
||||
// } else
|
||||
// $return['stat_data'] = 'EMPTY';
|
||||
// $return['status'] = 'SUCCESS';
|
||||
// }
|
||||
// return $return;
|
||||
// }
|
||||
|
||||
public function action() {
|
||||
$result = array();
|
||||
|
|
|
@ -5,9 +5,9 @@ class MainWP_Security {
|
|||
self::remove_wp_version();
|
||||
self::remove_rsd();
|
||||
self::remove_wlw();
|
||||
// MainWP_Security::remove_core_update();
|
||||
// MainWP_Security::remove_plugin_update();
|
||||
// MainWP_Security::remove_theme_update();
|
||||
// MainWP_Security::remove_core_update();
|
||||
// MainWP_Security::remove_plugin_update();
|
||||
// MainWP_Security::remove_theme_update();
|
||||
self::remove_php_reporting();
|
||||
self::remove_registered_versions();
|
||||
self::remove_generator_version();
|
||||
|
@ -19,7 +19,7 @@ class MainWP_Security {
|
|||
add_filter( 'script_loader_src', array( 'MainWP_Security', 'remove_theme_versions' ), PHP_INT_MAX );
|
||||
}
|
||||
|
||||
//Prevent listing wp-content, wp-content/plugins, wp-content/themes, wp-content/uploads
|
||||
// Prevent listing wp-content, wp-content/plugins, wp-content/themes, wp-content/uploads
|
||||
private static $listingDirectories = null;
|
||||
|
||||
private static function init_listingDirectories() {
|
||||
|
@ -66,7 +66,7 @@ class MainWP_Security {
|
|||
return ! empty( $security ) && isset( $security[ $option ] ) && ( true === $security[ $option ] );
|
||||
}
|
||||
|
||||
//Removed wp-version
|
||||
// Removed wp-version
|
||||
public static function remove_wp_version_ok() {
|
||||
return ! ( has_action( 'wp_head', 'wp_generator' ) || has_filter( 'wp_head', 'wp_generator' ) );
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class MainWP_Security {
|
|||
}
|
||||
}
|
||||
|
||||
//Removed Really Simple Discovery meta tag
|
||||
// Removed Really Simple Discovery meta tag
|
||||
public static function remove_rsd_ok() {
|
||||
return ( ! has_action( 'wp_head', 'rsd_link' ) );
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class MainWP_Security {
|
|||
}
|
||||
}
|
||||
|
||||
//Removed Windows Live Writer meta tag
|
||||
// Removed Windows Live Writer meta tag
|
||||
public static function remove_wlw_ok() {
|
||||
return ( ! has_action( 'wp_head', 'wlwmanifest_link' ) );
|
||||
}
|
||||
|
@ -100,82 +100,82 @@ class MainWP_Security {
|
|||
}
|
||||
}
|
||||
|
||||
//Removed core update information for non-admins
|
||||
// public static function remove_core_update_ok()
|
||||
// {
|
||||
// return self::get_security_option('core_updates');
|
||||
// }
|
||||
// Removed core update information for non-admins
|
||||
// public static function remove_core_update_ok()
|
||||
// {
|
||||
// return self::get_security_option('core_updates');
|
||||
// }
|
||||
|
||||
// public static function remove_core_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('core_updates'))
|
||||
// {
|
||||
// if (!current_user_can('update_plugins'))
|
||||
// {
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_notices', 'maintenance_nag' );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_notices', 'update_nag', 3 );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', '_maybe_update_core' );"));
|
||||
// add_action('init', create_function('$a', "remove_action( 'init', 'wp_version_check' );"));
|
||||
// add_filter('pre_option_update_core', create_function('$a', "return null;"));
|
||||
// remove_action('wp_version_check', 'wp_version_check');
|
||||
// remove_action('admin_init', '_maybe_update_core');
|
||||
// add_filter('pre_transient_update_core', create_function('$a', "return null;"));
|
||||
// add_filter('pre_site_transient_update_core', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public static function remove_core_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('core_updates'))
|
||||
// {
|
||||
// if (!current_user_can('update_plugins'))
|
||||
// {
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_notices', 'maintenance_nag' );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_notices', 'update_nag', 3 );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', '_maybe_update_core' );"));
|
||||
// add_action('init', create_function('$a', "remove_action( 'init', 'wp_version_check' );"));
|
||||
// add_filter('pre_option_update_core', create_function('$a', "return null;"));
|
||||
// remove_action('wp_version_check', 'wp_version_check');
|
||||
// remove_action('admin_init', '_maybe_update_core');
|
||||
// add_filter('pre_transient_update_core', create_function('$a', "return null;"));
|
||||
// add_filter('pre_site_transient_update_core', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//Removed plugin-update information for non-admins
|
||||
// public static function remove_plugin_update_ok()
|
||||
// {
|
||||
// return self:get_security_option('plugin_updates');
|
||||
// }
|
||||
// Removed plugin-update information for non-admins
|
||||
// public static function remove_plugin_update_ok()
|
||||
// {
|
||||
// return self:get_security_option('plugin_updates');
|
||||
// }
|
||||
|
||||
// public static function remove_plugin_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('plugin_updates'))
|
||||
// {
|
||||
// if (!current_user_can('update_plugins'))
|
||||
// {
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', 'wp_plugin_update_rows' );"), 2);
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', '_maybe_update_plugins' );"), 2);
|
||||
// add_action('admin_menu', create_function('$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2);
|
||||
// add_action('init', create_function('$a', "remove_action( 'init', 'wp_update_plugins' );"), 2);
|
||||
// add_filter('pre_option_update_plugins', create_function('$a', "return null;"));
|
||||
// remove_action('load-plugins.php', 'wp_update_plugins');
|
||||
// remove_action('load-update.php', 'wp_update_plugins');
|
||||
// remove_action('admin_init', '_maybe_update_plugins');
|
||||
// remove_action('wp_update_plugins', 'wp_update_plugins');
|
||||
// remove_action('load-update-core.php', 'wp_update_plugins');
|
||||
// add_filter('pre_transient_update_plugins', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public static function remove_plugin_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('plugin_updates'))
|
||||
// {
|
||||
// if (!current_user_can('update_plugins'))
|
||||
// {
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', 'wp_plugin_update_rows' );"), 2);
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', '_maybe_update_plugins' );"), 2);
|
||||
// add_action('admin_menu', create_function('$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );"));
|
||||
// add_action('admin_init', create_function('$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2);
|
||||
// add_action('init', create_function('$a', "remove_action( 'init', 'wp_update_plugins' );"), 2);
|
||||
// add_filter('pre_option_update_plugins', create_function('$a', "return null;"));
|
||||
// remove_action('load-plugins.php', 'wp_update_plugins');
|
||||
// remove_action('load-update.php', 'wp_update_plugins');
|
||||
// remove_action('admin_init', '_maybe_update_plugins');
|
||||
// remove_action('wp_update_plugins', 'wp_update_plugins');
|
||||
// remove_action('load-update-core.php', 'wp_update_plugins');
|
||||
// add_filter('pre_transient_update_plugins', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//Removed theme-update information for non-admins
|
||||
// public static function remove_theme_update_ok()
|
||||
// {
|
||||
// return self::get_security_option('theme_updates');
|
||||
// }
|
||||
// Removed theme-update information for non-admins
|
||||
// public static function remove_theme_update_ok()
|
||||
// {
|
||||
// return self::get_security_option('theme_updates');
|
||||
// }
|
||||
|
||||
// public static function remove_theme_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('theme_updates'))
|
||||
// {
|
||||
// if (!current_user_can('edit_themes'))
|
||||
// {
|
||||
// remove_action('load-themes.php', 'wp_update_themes');
|
||||
// remove_action('load-update.php', 'wp_update_themes');
|
||||
// remove_action('admin_init', '_maybe_update_themes');
|
||||
// remove_action('wp_update_themes', 'wp_update_themes');
|
||||
// remove_action('load-update-core.php', 'wp_update_themes');
|
||||
// add_filter('pre_transient_update_themes', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public static function remove_theme_update($force = false)
|
||||
// {
|
||||
// if ($force || self::get_security_option('theme_updates'))
|
||||
// {
|
||||
// if (!current_user_can('edit_themes'))
|
||||
// {
|
||||
// remove_action('load-themes.php', 'wp_update_themes');
|
||||
// remove_action('load-update.php', 'wp_update_themes');
|
||||
// remove_action('admin_init', '_maybe_update_themes');
|
||||
// remove_action('wp_update_themes', 'wp_update_themes');
|
||||
// remove_action('load-update-core.php', 'wp_update_themes');
|
||||
// add_filter('pre_transient_update_themes', create_function('$a', "return null;"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//File permissions not secure
|
||||
// File permissions not secure
|
||||
private static $permission_checks = null;
|
||||
|
||||
private static function init_permission_checks() {
|
||||
|
@ -194,38 +194,38 @@ class MainWP_Security {
|
|||
}
|
||||
}
|
||||
|
||||
// public static function fix_file_permissions_ok()
|
||||
// {
|
||||
// MainWP_Security::init_permission_checks();
|
||||
// public static function fix_file_permissions_ok()
|
||||
// {
|
||||
// MainWP_Security::init_permission_checks();
|
||||
//
|
||||
// $perms_issues = 0;
|
||||
// $perms_issues = 0;
|
||||
//
|
||||
// foreach (MainWP_Security::$permission_checks as $dir => $needed_perms)
|
||||
// {
|
||||
// if (!file_exists($dir)) continue;
|
||||
// foreach (MainWP_Security::$permission_checks as $dir => $needed_perms)
|
||||
// {
|
||||
// if (!file_exists($dir)) continue;
|
||||
//
|
||||
// $perms = substr(sprintf('%o', fileperms($dir)), -4);
|
||||
// if ($perms != $needed_perms)
|
||||
// {
|
||||
// $perms_issues++;
|
||||
// }
|
||||
// }
|
||||
// return ($perms_issues == 0);
|
||||
// }
|
||||
// $perms = substr(sprintf('%o', fileperms($dir)), -4);
|
||||
// if ($perms != $needed_perms)
|
||||
// {
|
||||
// $perms_issues++;
|
||||
// }
|
||||
// }
|
||||
// return ($perms_issues == 0);
|
||||
// }
|
||||
|
||||
// public static function fix_file_permissions()
|
||||
// {
|
||||
// MainWP_Security::init_permission_checks();
|
||||
// $success = true;
|
||||
// foreach (MainWP_Security::$permission_checks as $dir => $needed_perms)
|
||||
// {
|
||||
// if (!file_exists($dir)) continue;
|
||||
// $success == $success && chmod($dir, $needed_perms);
|
||||
// }
|
||||
// return $success;
|
||||
// }
|
||||
// public static function fix_file_permissions()
|
||||
// {
|
||||
// MainWP_Security::init_permission_checks();
|
||||
// $success = true;
|
||||
// foreach (MainWP_Security::$permission_checks as $dir => $needed_perms)
|
||||
// {
|
||||
// if (!file_exists($dir)) continue;
|
||||
// $success == $success && chmod($dir, $needed_perms);
|
||||
// }
|
||||
// return $success;
|
||||
// }
|
||||
|
||||
//Database error reporting turned on/off
|
||||
// Database error reporting turned on/off
|
||||
public static function remove_database_reporting_ok() {
|
||||
global $wpdb;
|
||||
|
||||
|
@ -239,7 +239,7 @@ class MainWP_Security {
|
|||
$wpdb->suppress_errors();
|
||||
}
|
||||
|
||||
//PHP error reporting turned on/off
|
||||
// PHP error reporting turned on/off
|
||||
public static function remove_php_reporting_ok() {
|
||||
return ! ( ( ( 0 != ini_get( 'display_errors' ) ) && ( 'off' != ini_get( 'display_errors' ) ) ) || ( ( 0 != ini_get( 'display_startup_errors' ) ) && ( 'off' != ini_get( 'display_startup_errors' ) ) ) );
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class MainWP_Security {
|
|||
}
|
||||
}
|
||||
|
||||
//Removed version information for scripts/stylesheets
|
||||
// Removed version information for scripts/stylesheets
|
||||
public static function remove_scripts_version_ok() {
|
||||
return self::get_security_option( 'scripts_version' );
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ class MainWP_Security {
|
|||
return self::get_security_option( 'styles_version' );
|
||||
}
|
||||
|
||||
//Admin user name is not admin
|
||||
// Admin user name is not admin
|
||||
public static function admin_user_ok() {
|
||||
$user = get_user_by( 'login', 'admin' );
|
||||
if ( ! $user ) {
|
||||
|
|
|
@ -58,7 +58,7 @@ class MainWP_Wordpress_SEO {
|
|||
$file_url = base64_decode( $_POST['file_url'] );
|
||||
$temporary_file = '';
|
||||
try {
|
||||
include_once ABSPATH . 'wp-admin/includes/file.php'; //Contains download_url
|
||||
include_once ABSPATH . 'wp-admin/includes/file.php'; // Contains download_url
|
||||
$temporary_file = download_url( $file_url );
|
||||
|
||||
if ( is_wp_error( $temporary_file ) ) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
//todo: BZ2; support fseek!
|
||||
// todo: BZ2; support fseek!
|
||||
|
||||
class Tar_Archiver {
|
||||
const IDLE = 0;
|
||||
|
@ -16,16 +16,16 @@ class Tar_Archiver {
|
|||
|
||||
protected $debug;
|
||||
|
||||
protected $chunk = ''; //1024 * 1024 * 4
|
||||
protected $chunkSize = 4194304; //1024 * 1024 * 4
|
||||
protected $chunk = ''; // 1024 * 1024 * 4
|
||||
protected $chunkSize = 4194304; // 1024 * 1024 * 4
|
||||
|
||||
/** @var $backup MainWP_Backup */
|
||||
protected $backup;
|
||||
|
||||
protected $type;
|
||||
protected $pidFile; //filepath of pid file
|
||||
protected $pidContent; //content of pid file
|
||||
protected $pidUpdated; //last updated pid file
|
||||
protected $pidFile; // filepath of pid file
|
||||
protected $pidContent; // content of pid file
|
||||
protected $pidUpdated; // last updated pid file
|
||||
|
||||
protected $mode = self::IDLE;
|
||||
|
||||
|
@ -127,19 +127,19 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
public function createFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp, $append = false ) {
|
||||
//$this->logHandle = fopen($filepath . ".log", "a+");
|
||||
// $this->logHandle = fopen($filepath . ".log", "a+");
|
||||
$this->createPidFile( $filepath );
|
||||
|
||||
$this->excludeZip = $excludezip;
|
||||
|
||||
$this->archivePath = $filepath;
|
||||
|
||||
// if (!file_exists($filepath))
|
||||
// {
|
||||
// $this->limit = true;
|
||||
// }
|
||||
// if (!file_exists($filepath))
|
||||
// {
|
||||
// $this->limit = true;
|
||||
// }
|
||||
|
||||
if ( $append && @file_exists( $filepath ) ) { //todo: use wpFS
|
||||
if ( $append && @file_exists( $filepath ) ) { // todo: use wpFS
|
||||
$this->mode = self::APPEND;
|
||||
$this->prepareAppend( $filepath );
|
||||
} else {
|
||||
|
@ -255,9 +255,9 @@ class Tar_Archiver {
|
|||
'themes' => $themes,
|
||||
) ) );
|
||||
|
||||
// $configFile = dirname($filepath) . DIRECTORY_SEPARATOR . time() . 'config.txt';
|
||||
// $fh = fopen($filepath, 'w'); //or error;
|
||||
// dirname($filepath) . DIRECTORY_SEPARATOR
|
||||
// $configFile = dirname($filepath) . DIRECTORY_SEPARATOR . time() . 'config.txt';
|
||||
// $fh = fopen($filepath, 'w'); //or error;
|
||||
// dirname($filepath) . DIRECTORY_SEPARATOR
|
||||
$this->addEmptyDirectory( 'clone', 0, 0, 0, time() );
|
||||
$this->addFileFromString( 'clone/config.txt', $string );
|
||||
}
|
||||
|
@ -328,11 +328,11 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
if ( 'tar.gz' == $this->type ) {
|
||||
//if (@fwrite($this->archive, $data, strlen($data)) === false)
|
||||
// if (@fwrite($this->archive, $data, strlen($data)) === false)
|
||||
if ( false === @gzwrite( $this->archive, $data, strlen( $data ) ) ) {
|
||||
throw new Exception( 'Could not write to archive' );
|
||||
}
|
||||
//@fflush($this->archive);
|
||||
// @fflush($this->archive);
|
||||
} elseif ( 'tar.bz2' == $this->type ) {
|
||||
if ( false === @bzwrite( $this->archive, $data, strlen( $data ) ) ) {
|
||||
throw new Exception( 'Could not write to archive' );
|
||||
|
@ -351,12 +351,12 @@ class Tar_Archiver {
|
|||
return;
|
||||
}
|
||||
|
||||
// if ($this->cnt++ > 3)
|
||||
// {
|
||||
// $this->log('error?');
|
||||
// $this->cnt = 0;
|
||||
// throw new Exception('error!');
|
||||
// }
|
||||
// if ($this->cnt++ > 3)
|
||||
// {
|
||||
// $this->log('error?');
|
||||
// $this->cnt = 0;
|
||||
// throw new Exception('error!');
|
||||
// }
|
||||
|
||||
if ( 'tar.gz' == $this->type ) {
|
||||
$this->log( 'writing & flushing ' . $len );
|
||||
|
@ -467,7 +467,7 @@ class Tar_Archiver {
|
|||
protected $tempContent;
|
||||
protected $gcCnt = 0;
|
||||
|
||||
// protected $limit;
|
||||
// protected $limit;
|
||||
protected $cnt = 0;
|
||||
|
||||
private function addFile( $path, $entryName ) {
|
||||
|
@ -483,12 +483,12 @@ class Tar_Archiver {
|
|||
|
||||
$this->log( 'Adding ' . $path );
|
||||
|
||||
// if ($this->limit)
|
||||
// {
|
||||
// $this->cnt++;
|
||||
// if ($this->limit)
|
||||
// {
|
||||
// $this->cnt++;
|
||||
//
|
||||
// if ($this->cnt > 250) throw new Exception('Some error..' . $this->archivePath);
|
||||
// }
|
||||
// if ($this->cnt > 250) throw new Exception('Some error..' . $this->archivePath);
|
||||
// }
|
||||
|
||||
$this->updatePidFile();
|
||||
|
||||
|
@ -519,7 +519,7 @@ class Tar_Archiver {
|
|||
$stat = @stat( $path );
|
||||
$fp = @fopen( $path, 'rb' );
|
||||
if ( ! $fp ) {
|
||||
//todo: add some error feedback!
|
||||
// todo: add some error feedback!
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
while ( ! feof( $fp ) ) {
|
||||
//0.1MB = 1024 000
|
||||
// 0.1MB = 1024 000
|
||||
$this->tempContent = fread( $fp, 1024000 * 5 );
|
||||
|
||||
$read = strlen( $this->tempContent );
|
||||
|
@ -630,7 +630,7 @@ class Tar_Archiver {
|
|||
|
||||
$this->updatePidFile();
|
||||
|
||||
// if ($this->limit) throw new Exception('Some error..' . $entryName);
|
||||
// if ($this->limit) throw new Exception('Some error..' . $entryName);
|
||||
}
|
||||
|
||||
@fclose( $fp );
|
||||
|
@ -725,14 +725,14 @@ class Tar_Archiver {
|
|||
private function checkBeforeAppend( $entryName ) {
|
||||
$rslt = $this->isNextFile( $entryName );
|
||||
|
||||
//Correct file
|
||||
// Correct file
|
||||
if ( true === $rslt ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$out = false;
|
||||
|
||||
//close, reopen with append & ftruncate
|
||||
// close, reopen with append & ftruncate
|
||||
$this->close( false );
|
||||
$this->log( 'Reopen archive to append from here' );
|
||||
$this->append( $this->archivePath );
|
||||
|
@ -744,7 +744,7 @@ class Tar_Archiver {
|
|||
} elseif ( 'tar.gz' == $this->type ) {
|
||||
$readOffset = $rslt['readOffset'];
|
||||
$bytesRead = $rslt['bytesRead'];
|
||||
//@fseek($this->archive, $readOffset + $bytesRead);
|
||||
// @fseek($this->archive, $readOffset + $bytesRead);
|
||||
|
||||
$out = array( 'bytesRead' => $bytesRead );
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ class Tar_Archiver {
|
|||
@fseek( $this->archive, 0, SEEK_END );
|
||||
}
|
||||
} else {
|
||||
//todo: check for tar.gz & tar!
|
||||
// todo: check for tar.gz & tar!
|
||||
@fseek( $this->archive, $rslt );
|
||||
@ftruncate( $this->archive, $rslt );
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
$temp = unpack( 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp', $block );
|
||||
//Check for long file!!
|
||||
// Check for long file!!
|
||||
if ( 'L' == $temp['type'] ) {
|
||||
$fname = trim( @fread( $this->archive, 512 ) );
|
||||
$block = @fread( $this->archive, 512 );
|
||||
|
@ -904,7 +904,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
if ( 'tar.gz' == $this->type ) {
|
||||
//$this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
|
||||
// $this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
|
||||
$this->archive = @gzopen( $filepath, 'wb' );
|
||||
} elseif ( 'tar.bz2' == $this->type ) {
|
||||
$this->archive = @bzopen( $filepath, 'w' );
|
||||
|
@ -926,7 +926,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
if ( 'tar.gz' == $this->type ) {
|
||||
//$this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
|
||||
// $this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
|
||||
$this->archive = @gzopen( $filepath, 'ab' );
|
||||
} elseif ( $this->type == 'tar.bz2' ) {
|
||||
$this->archive = @bzopen( $filepath, 'a' );
|
||||
|
@ -942,9 +942,9 @@ class Tar_Archiver {
|
|||
function prepareAppend( $filepath ) {
|
||||
if ( $this->debug ) {
|
||||
if ( 'tar.gz' == substr( $filepath, - 6 ) ) {
|
||||
$text = chr( 31 ) . chr( 139 ) . chr( 8 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ); //magic header!!
|
||||
$text = chr( 31 ) . chr( 139 ) . chr( 8 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ); // magic header!!
|
||||
|
||||
//Check if valid, if not, crop to valid!
|
||||
// Check if valid, if not, crop to valid!
|
||||
$fh = @fopen( $filepath, 'rb' );
|
||||
$read = '';
|
||||
$lastCorrect = 0;
|
||||
|
@ -972,7 +972,7 @@ class Tar_Archiver {
|
|||
@fclose( $fh );
|
||||
} catch ( Exception $e ) {
|
||||
@fclose( $fh );
|
||||
//reopen & truncate
|
||||
// reopen & truncate
|
||||
$fh = @fopen( $filepath, 'ab+' );
|
||||
@fseek( $fh, $lastCorrect );
|
||||
@ftruncate( $fh, $lastCorrect );
|
||||
|
@ -990,7 +990,7 @@ class Tar_Archiver {
|
|||
|
||||
if ( 'tar.gz' == substr( $filepath, - 6 ) ) {
|
||||
$this->type = 'tar.gz';
|
||||
// $this->archive = @fopen('compress.zlib://' . $filepath, 'rb');
|
||||
// $this->archive = @fopen('compress.zlib://' . $filepath, 'rb');
|
||||
$this->archive = @gzopen( $filepath, 'r' );
|
||||
} elseif ( 'tar.bz2' == substr( $filepath, - 7 ) ) {
|
||||
$this->type = 'tar.bz2';
|
||||
|
@ -1009,7 +1009,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
function close( $closeLog = true ) {
|
||||
//Write chunk if it's not empty..
|
||||
// Write chunk if it's not empty..
|
||||
$this->writeChunk();
|
||||
|
||||
$this->log( 'Closing archive' );
|
||||
|
@ -1020,7 +1020,7 @@ class Tar_Archiver {
|
|||
|
||||
if ( $this->archive ) {
|
||||
if ( 'tar.gz' == $this->type ) {
|
||||
//@fclose($this->archive);
|
||||
// @fclose($this->archive);
|
||||
@gzclose( $this->archive );
|
||||
} elseif ( 'tar.bz2' == $this->type ) {
|
||||
@bzclose( $this->archive );
|
||||
|
@ -1041,7 +1041,7 @@ class Tar_Archiver {
|
|||
@fseek( $this->archive, 0 );
|
||||
while ( $block = @fread( $this->archive, 512 ) ) {
|
||||
$temp = unpack( 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp', $block );
|
||||
//Check for long file!!
|
||||
// Check for long file!!
|
||||
if ( 'L' == $temp['type'] ) {
|
||||
$fname = trim( @fread( $this->archive, 512 ) );
|
||||
$block = @fread( $this->archive, 512 );
|
||||
|
@ -1066,7 +1066,7 @@ class Tar_Archiver {
|
|||
if ( $file['checksum'] == 0x00000000 ) {
|
||||
break;
|
||||
} elseif ( substr( $file['magic'], 0, 5 ) != 'ustar' ) {
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1075,8 +1075,8 @@ class Tar_Archiver {
|
|||
for ( $i = 0; $i < 512; $i ++ ) {
|
||||
$checksum += ord( substr( $block, $i, 1 ) );
|
||||
}
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
|
||||
if ( 0 == $file['type'] ) {
|
||||
if ( 0 == strcmp( trim( $file['name'] ), trim( $entryName ) ) ) {
|
||||
|
@ -1110,7 +1110,7 @@ class Tar_Archiver {
|
|||
@fseek( $this->archive, 0 );
|
||||
while ( $block = @fread( $this->archive, 512 ) ) {
|
||||
$temp = unpack( 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp', $block );
|
||||
//Check for long file!!
|
||||
// Check for long file!!
|
||||
if ( 'L' == $temp['type'] ) {
|
||||
$fname = trim( @fread( $this->archive, 512 ) );
|
||||
$block = @fread( $this->archive, 512 );
|
||||
|
@ -1135,7 +1135,7 @@ class Tar_Archiver {
|
|||
if ( $file['checksum'] == 0x00000000 ) {
|
||||
break;
|
||||
} elseif ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1144,8 +1144,8 @@ class Tar_Archiver {
|
|||
for ( $i = 0; $i < 512; $i ++ ) {
|
||||
$checksum += ord( substr( $block, $i, 1 ) );
|
||||
}
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
|
||||
if ( 5 == $file['type'] ) {
|
||||
if ( 0 == strcmp( trim( $file['name'] ), trim( $entryName ) ) ) {
|
||||
|
@ -1174,7 +1174,7 @@ class Tar_Archiver {
|
|||
@fseek( $this->archive, 0 );
|
||||
while ( $block = fread( $this->archive, 512 ) ) {
|
||||
$temp = unpack( 'a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp', $block );
|
||||
//Check for long file!!
|
||||
// Check for long file!!
|
||||
if ( 'L' == $temp['type'] ) {
|
||||
$fname = trim( @fread( $this->archive, 512 ) );
|
||||
$block = @fread( $this->archive, 512 );
|
||||
|
@ -1199,7 +1199,7 @@ class Tar_Archiver {
|
|||
if ( $file['checksum'] == 0x00000000 ) {
|
||||
break;
|
||||
} elseif ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
// $this->error[] = "This script does not support extracting this type of tar file.";
|
||||
break;
|
||||
}
|
||||
$block = substr_replace( $block, ' ', 148, 8 );
|
||||
|
@ -1207,8 +1207,8 @@ class Tar_Archiver {
|
|||
for ( $i = 0; $i < 512; $i ++ ) {
|
||||
$checksum += ord( substr( $block, $i, 1 ) );
|
||||
}
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
// if ($file['checksum'] != $checksum)
|
||||
// $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||
if ( 5 == $file['type'] ) {
|
||||
if ( ! is_dir( $to . $file['name'] ) ) {
|
||||
if ( ! empty( $wp_filesystem ) ) {
|
||||
|
@ -1302,7 +1302,7 @@ if ( class_exists( 'SplHeap' ) ) {
|
|||
$dirnameA = ( is_file( $pathA ) ? dirname( $pathA ) : $pathA );
|
||||
$dirnameB = ( is_file( $pathB ) ? dirname( $pathB ) : $pathB );
|
||||
|
||||
//if both are in the same folder, first show the files, then the directories
|
||||
// if both are in the same folder, first show the files, then the directories
|
||||
if ( dirname( $pathA ) == dirname( $pathB ) ) {
|
||||
if ( is_file( $pathA ) && ! is_file( $pathB ) ) {
|
||||
return - 1;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
Text Domain: mainwp-child
|
||||
Version: 4.0.7
|
||||
*/
|
||||
require_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php'; //Version information from WordPress
|
||||
require_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php'; // Version information from WordPress
|
||||
|
||||
define( 'MAINWP_DEBUG', false );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue