Merge pull request #35 from mainwp/bogdan01-cf-autofix

Apply fixes from CodeFactor
This commit is contained in:
Bogdan Rapaić 2020-03-26 15:12:59 +01:00 committed by GitHub
commit b75fca88de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 960 additions and 793 deletions

View file

@ -158,7 +158,7 @@ class MainWP_Backup {
public function _zipFilePcl( $files, $archive ) {
//Zip this backup folder..
require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
$this->zip = new PclZip( $archive );
$error = false;
@ -336,7 +336,7 @@ class MainWP_Backup {
* @return bool
*/
public function createZipPclFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles ) {
require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
$this->zip = new PclZip( $filepath );
$nodes = glob( ABSPATH . '*' );
if ( ! $includeCoreFiles ) {
@ -531,7 +531,7 @@ class MainWP_Backup {
unset( $nodes );
//Zip this backup folder..
require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
$this->zip = new PclZip( $filepath );
$this->zip->create( $backupFolder, PCLZIP_OPT_REMOVE_PATH, $backupFolder );
if ( $addConfig ) {

View file

@ -105,8 +105,9 @@ class MainWP_Child_Back_Up_Buddy {
}
// ok
function do_reports_log( $ext = '') {
if ($ext !== 'backupbuddy')
if ($ext !== 'backupbuddy') {
return;
}
if (!$this->is_backupbuddy_installed) {
return;
@ -117,12 +118,14 @@ class MainWP_Child_Back_Up_Buddy {
MainWP_Helper::check_methods( 'pb_backupbuddy', array( 'plugin_path' ));
if ( ! class_exists( 'backupbuddy_core' ) ) {
if ( file_exists(pb_backupbuddy::plugin_path() . '/classes/core.php') )
require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
if ( file_exists(pb_backupbuddy::plugin_path() . '/classes/core.php') ) {
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
}
}
if (file_exists(pb_backupbuddy::plugin_path() . '/classes/fileoptions.php'))
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
if (file_exists(pb_backupbuddy::plugin_path() . '/classes/fileoptions.php')) {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
}
MainWP_Helper::check_classes_exists(array( 'backupbuddy_core', 'pb_backupbuddy_fileoptions' ));
MainWP_Helper::check_methods('backupbuddy_core', 'getLogDirectory');
@ -180,7 +183,7 @@ class MainWP_Child_Back_Up_Buddy {
}
if ( file_exists(pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php') ) {
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
MainWP_Helper::check_classes_exists(array( 'backupbuddy_live_periodic' ));
MainWP_Helper::check_methods('backupbuddy_live_periodic', 'get_stats');
@ -217,7 +220,7 @@ class MainWP_Child_Back_Up_Buddy {
}
if ( ! class_exists( 'backupbuddy_core' ) ) {
require_once( pb_backupbuddy::plugin_path() . '/classes/core.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
}
if ( !isset( pb_backupbuddy::$options ) ) {
@ -692,8 +695,9 @@ class MainWP_Child_Back_Up_Buddy {
function delete_profile() {
$profile_id = $_POST['profile_id'];
if (isset(pb_backupbuddy::$options['profiles'][$profile_id]))
if (isset(pb_backupbuddy::$options['profiles'][$profile_id])) {
unset(pb_backupbuddy::$options['profiles'][$profile_id]);
}
pb_backupbuddy::save();
$information['result'] = 'SUCCESS';
@ -764,8 +768,9 @@ class MainWP_Child_Back_Up_Buddy {
MainWP_Helper::check_methods('pb_backupbuddy', array( 'plugin_path' ) );
$plugin_path = pb_backupbuddy::plugin_path();
if (file_exists($plugin_path . '/classes/core.php'))
require_once( $plugin_path . '/classes/core.php' );
if (file_exists($plugin_path . '/classes/core.php')) {
require_once $plugin_path . '/classes/core.php';
}
}
MainWP_Helper::check_classes_exists(array( 'backupbuddy_core', 'backupbuddy_api' ));
@ -810,7 +815,7 @@ class MainWP_Child_Back_Up_Buddy {
}
function backup_list() {
require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$information = array();
$information['backup_list'] = $this->get_backup_list();
$information['recent_backup_list'] = $this->get_recent_backup_list();
@ -825,7 +830,7 @@ class MainWP_Child_Back_Up_Buddy {
function save_note() {
if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() );
}
$backup_file = $_POST['backup_file'];
@ -851,7 +856,7 @@ class MainWP_Child_Back_Up_Buddy {
// Even if we cannot save the note into the archive file, store it in internal settings.
$serial = backupbuddy_core::get_serial_from_file( $backup_file );
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status( 'details', 'Fileoptions instance #24.' );
$backup_options = new pb_backupbuddy_fileoptions( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' );
if ( true === ( $result = $backup_options->is_ok() ) ) {
@ -864,10 +869,11 @@ class MainWP_Child_Back_Up_Buddy {
function get_hash() {
$callback_data = $_POST['callback_data'];
$file = backupbuddy_core::getBackupDirectory() . $callback_data;
if (file_exists($file))
if (file_exists($file)) {
return array( 'result' =>'SUCCESS', 'hash' => md5_file( $file ) );
else
} else {
return array( 'error' =>'Not found the file' );
}
}
function zip_viewer() {
@ -883,7 +889,7 @@ class MainWP_Child_Back_Up_Buddy {
$serial = $_POST[ 'serial' ];
$alerts = array();
// The fileoptions file that contains the file tree information
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
$fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '-filetree.txt';
// Purge cache if too old.
@ -899,7 +905,7 @@ class MainWP_Child_Back_Up_Buddy {
// Either we are getting cached file tree information or we need to create afresh
if ( true !== ( $result = $fileoptions->is_ok() ) ) {
// Get file listing.
require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( ABSPATH, array(), 'unzip' );
$files = pb_backupbuddy::$classes['zipbuddy']->get_file_list( backupbuddy_core::getBackupDirectory() . str_replace( '\\/', '', $zip_viewer ) );
$fileoptions->options = $files;
@ -1112,7 +1118,7 @@ class MainWP_Child_Back_Up_Buddy {
$serial = backupbuddy_core::get_serial_from_file( $archive_file ); // serial of archive.
$temp_file = uniqid(); // temp filename to extract into.
require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
$zipbuddy = new pluginbuddy_zipbuddy( backupbuddy_core::getBackupDirectory() );
// Calculate temp directory & lock it down.
@ -1186,7 +1192,7 @@ class MainWP_Child_Back_Up_Buddy {
global $wp_version;
pb_backupbuddy::status( 'details', 'BackupBuddy v' . pb_backupbuddy::settings( 'version' ) . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.' );
require( pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php' );
require pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php';
ob_start();
$result = backupbuddy_restore_files::restore( backupbuddy_core::getBackupDirectory() . $archive_file, $files, $finalPath = ABSPATH );
@ -1229,7 +1235,7 @@ class MainWP_Child_Back_Up_Buddy {
$options = array();
if ( file_exists( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' ) ) {
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status( 'details', 'Fileoptions instance #33.' );
$backup_options = new pb_backupbuddy_fileoptions( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true ); // Will create file to hold integrity data if nothing exists.
} else {
@ -1375,7 +1381,7 @@ class MainWP_Child_Back_Up_Buddy {
foreach( $recentBackups_list as $backup_fileoptions ) {
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status( 'details', 'Fileoptions instance #1.' );
$backup = new pb_backupbuddy_fileoptions( $backup_fileoptions, $read_only = true );
if ( true !== ( $result = $backup->is_ok() ) ) {
@ -1555,7 +1561,7 @@ class MainWP_Child_Back_Up_Buddy {
$serial = str_replace( '/\\', '', $serial );
pb_backupbuddy::load();
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status( 'details', 'Fileoptions instance #27.' );
$optionsFile = backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt';
$backup_options = new pb_backupbuddy_fileoptions( $optionsFile, $read_only = true );
@ -1851,7 +1857,7 @@ class MainWP_Child_Back_Up_Buddy {
return array('error' => 'Invalid Profile. Not found.');
}
require_once( pb_backupbuddy::plugin_path() . '/classes/backup.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
$newBackup = new pb_backupbuddy_backup();
$profile_array = pb_backupbuddy::$options['profiles'][ $requested_profile ];
@ -1874,7 +1880,7 @@ class MainWP_Child_Back_Up_Buddy {
}
function start_backup() {
require_once( pb_backupbuddy::plugin_path() . '/classes/backup.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
$newBackup = new pb_backupbuddy_backup();
$data = $_POST['data'];
if (is_array($data) && isset($data['serial_override'])) {
@ -1968,7 +1974,7 @@ class MainWP_Child_Back_Up_Buddy {
function remote_delete() {
$destination_id = isset($_POST['destination_id']) ? $_POST['destination_id'] : null;
if ($destination_id !== null) {
require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$delete_response = pb_backupbuddy_destinations::delete_destination( $destination_id, true );
if ( $delete_response !== true ) {
@ -2026,7 +2032,7 @@ class MainWP_Child_Back_Up_Buddy {
// For Stash we will check the quota prior to initiating send.
if ( pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash' ) {
// Pass off to destination handler.
require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$send_result = pb_backupbuddy_destinations::get_info( 'stash' ); // Used to kick the Stash destination into life.
$stash_quota = pb_backupbuddy_destination_stash::get_quota( pb_backupbuddy::$options['remote_destinations'][$destination_id], true );
@ -2093,17 +2099,17 @@ class MainWP_Child_Back_Up_Buddy {
if ( 'cleanup_now' == $other_action ) {
$message = 'Performing cleanup procedures now trimming old files and data.';
require_once( pb_backupbuddy::plugin_path() . '/classes/housekeeping.php' );
require_once pb_backupbuddy::plugin_path() . '/classes/housekeeping.php';
backupbuddy_housekeeping::run_periodic( 0 ); // 0 cleans up everything even if not very old.
} else if ( 'delete_tempfiles_now' == $other_action) {
} elseif ( 'delete_tempfiles_now' == $other_action) {
$tempDir = backupbuddy_core::getTempDirectory();
$logDir = backupbuddy_core::getLogDirectory();
$message = 'Deleting all files contained within `' . $tempDir . '` and `' . $logDir . '`.';
pb_backupbuddy::$filesystem->unlink_recursive( $tempDir );
pb_backupbuddy::$filesystem->unlink_recursive( $logDir );
pb_backupbuddy::anti_directory_browsing( $logDir, $die = false ); // Put log dir back in place.
} else if ( 'reset_log' == $other_action ) {
} elseif ( 'reset_log' == $other_action ) {
$log_file = backupbuddy_core::getLogDirectory() . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
if ( file_exists( $log_file ) ) {
@unlink( $log_file );
@ -2113,13 +2119,13 @@ class MainWP_Child_Back_Up_Buddy {
} else { // Unlinked.
$message = 'Cleared log file.';
}
} else if ( 'reset_disalerts' == $other_action) {
} elseif ( 'reset_disalerts' == $other_action) {
pb_backupbuddy::$options['disalerts'] = array();
pb_backupbuddy::save();
$message = 'Dismissed alerts have been reset. They may now be visible again.';
} else if ( 'cancel_running_backups' == $other_action) {
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
} elseif ( 'cancel_running_backups' == $other_action) {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
$fileoptions_directory = backupbuddy_core::getLogDirectory() . 'fileoptions/';
$files = glob( $fileoptions_directory . '*.txt' );
@ -2470,9 +2476,9 @@ class MainWP_Child_Back_Up_Buddy {
$errors[] = 'You must enter your iThemes username & password to log in to BackupBuddy Stash Live.';
} else { // Username and password provided.
require_once( pb_backupbuddy::plugin_path() . '/destinations/stash2/class.itx_helper2.php' );
require_once( pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php' );
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/class.itx_helper2.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php';
global $wp_version;
$itxapi_username = strtolower( $_POST['live_username'] );
@ -2566,9 +2572,9 @@ class MainWP_Child_Back_Up_Buddy {
$data = $_POST['data'];
$new_destination_id = $_POST['destination_id'];
require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' );
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live.php' );
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
$destination_id = backupbuddy_live::getLiveID();
$destination_settings = isset(pb_backupbuddy::$options['remote_destinations'][$destination_id]) ? pb_backupbuddy::$options['remote_destinations'][$destination_id] : array();
@ -2611,7 +2617,7 @@ class MainWP_Child_Back_Up_Buddy {
unset( pb_backupbuddy::$options['remote_destinations'][ $liveDestinationID ] );
pb_backupbuddy::save();
// Clear cached Live credentials.
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php';
delete_transient( pb_backupbuddy_destination_live::LIVE_ACTION_TRANSIENT_NAME );
} else {
$error = 'Error: destination not found.';
@ -2621,8 +2627,9 @@ class MainWP_Child_Back_Up_Buddy {
$error = 'Error: Empty destination id.';
}
if (!empty($error))
if (!empty($error)) {
$return['error'] = $error;
}
return $return;
}
@ -2631,7 +2638,7 @@ class MainWP_Child_Back_Up_Buddy {
$action = $_POST['live_action'];
$error = $message = '';
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
$state = backupbuddy_live_periodic::get_stats();
$destination_id = backupbuddy_live::getLiveID();
@ -2646,20 +2653,20 @@ class MainWP_Child_Back_Up_Buddy {
$message = 'Log file cleared.';
}
} else if ( '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 )
} 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' );
$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' );
require pb_backupbuddy::plugin_path() . '/destinations/live/_manual_snapshot.php';
}
} else if ( 'pause_periodic' == $action ) {
} 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' ) );
$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.
} else if ( 'resume_periodic' == $action ) {
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
} elseif ( 'resume_periodic' == $action ) {
$launchNowText = ' ' . __( 'Unpaused but not running now.', 'it-l10n-backupbuddy' );
$start_run = false;
if ( '1' != pb_backupbuddy::_GET( 'skip_run_live_now' ) ) {
@ -2670,17 +2677,17 @@ 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 );
$message = __( 'Live File Backup has resumed.', 'it-l10n-backupbuddy' ) . $launchNowText;
include( pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php' ); // Recalculate stats.
} else if ( 'pause_continuous' == $action ) {
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.
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
//pb_backupbuddy::disalert( '', __( 'Live Database Backup paused.', 'it-l10n-backupbuddy' ) );
$message = __( 'Live Database Backup paused.', 'it-l10n-backupbuddy' );
} else if ( 'resume_continuous' == $action ) {
} 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.
include pb_backupbuddy::plugin_path() . '/destinations/live/_stats.php'; // Recalculate stats.
//pb_backupbuddy::disalert( '', __( 'Live Database Backup resumed.', 'it-l10n-backupbuddy' ) );
$message = __( 'Live Database Backup resumed.', 'it-l10n-backupbuddy' );
} else {
@ -2693,7 +2700,7 @@ class MainWP_Child_Back_Up_Buddy {
function download_troubleshooting() {
require( pb_backupbuddy::plugin_path() . '/destinations/live/_troubleshooting.php' );
require pb_backupbuddy::plugin_path() . '/destinations/live/_troubleshooting.php';
backupbuddy_live_troubleshooting::run();
$output = "**File best viewed with wordwrap OFF**\n\n" . print_r( backupbuddy_live_troubleshooting::get_raw_results(), true );
$backup_prefix = backupbuddy_core::backup_prefix();
@ -2703,12 +2710,12 @@ class MainWP_Child_Back_Up_Buddy {
function get_live_backups() {
$destination_id = $_POST['destination_id'];
// Load required files.
require_once( pb_backupbuddy::plugin_path() . '/destinations/s32/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/s32/init.php';
if ( ! isset( pb_backupbuddy::$options['remote_destinations'][ $destination_id ] ) ) {
return array( 'error' => 'Error #9828332: Destination not found with id `' . htmlentities( $destination_id ) . '`.' );
}
require_once( pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php';
$settings = &pb_backupbuddy::$options['remote_destinations'][ $destination_id ];
$settings = pb_backupbuddy_destination_stash2::_formatSettings( $settings );
@ -2778,7 +2785,7 @@ class MainWP_Child_Back_Up_Buddy {
$destination_id = $_POST['destination_id'];
// Load required files.
require_once( pb_backupbuddy::plugin_path() . '/destinations/s32/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/s32/init.php';
if ( ! isset( pb_backupbuddy::$options['remote_destinations'][ $destination_id ] ) ) {
return array( 'error' => 'Error #9828332: Destination not found with id `' . htmlentities( $destination_id ) . '`.' );
}
@ -2801,7 +2808,7 @@ class MainWP_Child_Back_Up_Buddy {
$destination_id = $_POST['destination_id'];
// Load required files.
require_once( pb_backupbuddy::plugin_path() . '/destinations/s32/init.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/s32/init.php';
if ( ! isset( pb_backupbuddy::$options['remote_destinations'][ $destination_id ] ) ) {
return array( 'error' => 'Error #9828332: Destination not found with id `' . htmlentities( $destination_id ) . '`.' );
}
@ -2856,7 +2863,7 @@ class MainWP_Child_Back_Up_Buddy {
if ( $time_since_last_activity > ( $detected_execution + backupbuddy_constants::TIMED_OUT_PROCESS_RESUME_WIGGLE_ROOM ) ) { // Enough time has passed to assume timed out.
require_once( pb_backupbuddy::plugin_path() . '/destinations/live/live.php' );
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php';
if ( false === ( $liveID = backupbuddy_live::getLiveID() ) ) {
die( '-1' );
}
@ -2900,11 +2907,11 @@ class MainWP_Child_Back_Up_Buddy {
$packages_name = array();
if (isset($GLOBALS['ithemes_updater_path'])) {
require_once( $GLOBALS['ithemes_updater_path'] . '/functions.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/api.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/keys.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
require_once $GLOBALS['ithemes_updater_path'] . '/api.php';
require_once $GLOBALS['ithemes_updater_path'] . '/keys.php';
require_once( $GLOBALS['ithemes_updater_path'] . '/packages.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
$details = Ithemes_Updater_Packages::get_full_details();
$packages = isset($details['packages']) ? $details['packages'] : array();
@ -2927,11 +2934,11 @@ class MainWP_Child_Back_Up_Buddy {
$return = array( 'ok' => 1 );
if (isset($GLOBALS['ithemes_updater_path'])) {
require_once( $GLOBALS['ithemes_updater_path'] . '/functions.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/api.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/keys.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
require_once $GLOBALS['ithemes_updater_path'] . '/api.php';
require_once $GLOBALS['ithemes_updater_path'] . '/keys.php';
require_once( $GLOBALS['ithemes_updater_path'] . '/packages.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
$response = Ithemes_Updater_API::activate_package( $username, $password, $packages );
@ -2954,17 +2961,19 @@ class MainWP_Child_Back_Up_Buddy {
$fail = array();
foreach ( $response['packages'] as $package => $data ) {
if ( preg_match( '/ \|\|\| \d+$/', $package ) )
if ( preg_match( '/ \|\|\| \d+$/', $package ) ) {
continue;
}
$name = Ithemes_Updater_Functions::get_package_name( $package );
if ( ! empty( $data['key'] ) )
if ( ! empty( $data['key'] ) ) {
$success[] = $name;
else if ( ! empty( $data['status'] ) && ( 'expired' == $data['status'] ) )
} elseif ( ! empty( $data['status'] ) && ( 'expired' == $data['status'] ) ) {
$warn[$name] = __( 'Your product subscription has expired', 'it-l10n-backupbuddy' );
else
} else {
$fail[$name] = $data['error']['message'];
}
}
if ( ! empty( $success ) ) {
@ -2973,14 +2982,16 @@ class MainWP_Child_Back_Up_Buddy {
}
if ( ! empty( $fail ) ) {
foreach ( $fail as $name => $reason )
foreach ( $fail as $name => $reason ) {
$errors[] = sprintf( __( 'Unable to license %1$s. Reason: %2$s', 'it-l10n-backupbuddy' ), $name, $reason );
}
$return['errors'] = $errors;
}
if ( ! empty( $warn ) ) {
foreach ( $warn as $name => $reason )
foreach ( $warn as $name => $reason ) {
$soft_errors[] = sprintf( __( 'Unable to license %1$s. Reason: %2$s', 'it-l10n-backupbuddy' ), $name, $reason );
}
$return['soft_errors'] = $soft_errors;
}
@ -2998,11 +3009,11 @@ class MainWP_Child_Back_Up_Buddy {
if (isset($GLOBALS['ithemes_updater_path'])) {
require_once( $GLOBALS['ithemes_updater_path'] . '/functions.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/api.php' );
require_once( $GLOBALS['ithemes_updater_path'] . '/keys.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
require_once $GLOBALS['ithemes_updater_path'] . '/api.php';
require_once $GLOBALS['ithemes_updater_path'] . '/keys.php';
require_once( $GLOBALS['ithemes_updater_path'] . '/packages.php' );
require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
$response = Ithemes_Updater_API::deactivate_package($username, $password, $packages );
@ -3024,17 +3035,19 @@ class MainWP_Child_Back_Up_Buddy {
$fail = array();
foreach ( $response['packages'] as $package => $data ) {
if ( preg_match( '/ \|\|\| \d+$/', $package ) )
if ( preg_match( '/ \|\|\| \d+$/', $package ) ) {
continue;
}
$name = Ithemes_Updater_Functions::get_package_name( $package );
if ( isset( $data['status'] ) && ( 'inactive' == $data['status'] ) )
if ( isset( $data['status'] ) && ( 'inactive' == $data['status'] ) ) {
$success[] = $name;
else if ( isset( $data['error'] ) && isset( $data['error']['message'] ) )
} elseif ( isset( $data['error'] ) && isset( $data['error']['message'] ) ) {
$fail[$name] = $data['error']['message'];
else
} else {
$fail[$name] = __( 'Unknown server error.', 'it-l10n-mainwp-backupbuddy' );
}
}
if ( ! empty( $success ) ) {
@ -3043,8 +3056,9 @@ class MainWP_Child_Back_Up_Buddy {
}
if ( ! empty( $fail ) ) {
foreach ( $fail as $name => $reason )
foreach ( $fail as $name => $reason ) {
$errors[] = sprintf( __( 'Unable to remove license from %1$s. Reason: %2$s', 'it-l10n-mainwp-backupbuddy' ), $name, $reason );
}
$return['errors'] = $errors;
}
@ -3078,10 +3092,11 @@ class MainWP_Child_Back_Up_Buddy {
}
if ( empty( $message ) ) {
if ( ! empty( $package ) )
if ( ! empty( $package ) ) {
$message = sprintf( __( 'An unknown error relating to the %1$s product occurred. Please contact iThemes support. Error details: %2$s', 'it-l10n-mainwp-backupbuddy' ), $package_name, $error->get_error_message() . " ($code)" );
else
} else {
$message = sprintf( __( 'An unknown error occurred. Please contact iThemes support. Error details: %s', 'it-l10n-mainwp-backupbuddy' ), $error->get_error_message() . " ($code)" );
}
}
return $message;

View file

@ -29,7 +29,7 @@ class MainWP_Child_Back_Up_Wordpress {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'backupwordpress/backupwordpress.php' ) ) {
$this->is_plugin_installed = true;
if ( version_compare( phpversion(), '5.3', '>=' ) ) {
@ -43,7 +43,8 @@ class MainWP_Child_Back_Up_Wordpress {
return;
}
if (!$this->is_plugin_installed) return;
if (!$this->is_plugin_installed) { return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -201,8 +202,10 @@ class MainWP_Child_Back_Up_Wordpress {
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'backupwordpress' ) return;
if (!$this->is_plugin_installed) return;
if ( $ext !== 'backupwordpress' ) { return;
}
if (!$this->is_plugin_installed) { return;
}
try {
MainWP_Helper::check_classes_exists('HM\BackUpWordPress\Schedules');
@ -314,14 +317,15 @@ class MainWP_Child_Back_Up_Wordpress {
$schedule_id = $this->check_schedule();
if (function_exists('hmbkp_run_schedule_async')) {
hmbkp_run_schedule_async($schedule_id);
} else if (function_exists('\HM\BackUpWordPress\run_schedule_async')) {
} elseif (function_exists('\HM\BackUpWordPress\run_schedule_async')) {
HM\BackUpWordPress\Path::get_instance()->cleanup();
// Fixes an issue on servers which only allow a single session per client
session_write_close();
$task = new \HM\Backdrop\Task( '\HM\BackUpWordPress\run_schedule_async', $schedule_id );
$task->schedule();
} else
} else {
return array( 'error' => __('Error while trying to trigger the schedule', 'mainwp-child') );
}
return array( 'result' => 'SUCCESS' );
}
@ -392,10 +396,11 @@ class MainWP_Child_Back_Up_Wordpress {
}
}
if (function_exists('HM\BackUpWordPress\Backup::get_home_path'))
if (function_exists('HM\BackUpWordPress\Backup::get_home_path')) {
$backups_path = str_replace( HM\BackUpWordPress\Backup::get_home_path(), '', hmbkp_path() );
else
} else {
$backups_path = str_replace( HM\BackUpWordPress\Path::get_home_path(), '', HM\BackUpWordPress\Path::get_path() );
}
$information['backups_path'] = $backups_path;
$information['send_back_schedules'] = $send_back_schedules;
@ -533,7 +538,7 @@ class MainWP_Child_Back_Up_Wordpress {
class="download-action"><?php esc_html_e( 'Download', 'backupwordpress' ); ?></a> |
<?php
};
} else if (function_exists('HM\BackUpWordPress\is_path_accessible') ) {
} elseif (function_exists('HM\BackUpWordPress\is_path_accessible') ) {
if (HM\BackUpWordPress\is_path_accessible(HM\BackUpWordPress\Path::get_path())) {
?>
<a href="#"
@ -618,10 +623,11 @@ class MainWP_Child_Back_Up_Wordpress {
<td>
<?php
if ($new_version)
if ($new_version) {
$is_default_rule = ( in_array( $exclude, $excludes->get_default_excludes() ) ) || ( HM\BackUpWordPress\Path::get_path() === trailingslashit( HM\BackUpWordPress\Path::get_root() ) . untrailingslashit( $exclude ) );
else
} else {
$is_default_rule = ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) );
}
if ( $is_default_rule ) :
?>
@ -676,8 +682,9 @@ class MainWP_Child_Back_Up_Wordpress {
$exclude_string = implode( '|', $excludes->get_excludes_for_regex() );
if (function_exists('HM\BackUpWordPress\list_directory_by_total_filesize'))
if (function_exists('HM\BackUpWordPress\list_directory_by_total_filesize')) {
$files = HM\BackUpWordPress\list_directory_by_total_filesize( $directory, $excludes );
}
} else {
$files = $schedule->list_directory_by_total_filesize( $directory );
@ -1071,8 +1078,9 @@ class MainWP_Child_Back_Up_Wordpress {
if (method_exists($excludes, 'get_user_excludes')) {
$schedule->set_excludes( array_diff( $excludes->get_user_excludes(), (array) $exclude_rule_to_remove ) );
} else
} else {
$schedule->set_excludes( array_diff( $excludes, $exclude_rule_to_remove ) );
}
$schedule->save();
@ -1103,8 +1111,9 @@ class MainWP_Child_Back_Up_Wordpress {
$excl_rule = trim($excl_rule);
$excl_rule = trim($excl_rule, '/');
if (empty($excl_rule))
if (empty($excl_rule)) {
continue;
}
$exclude_rule = ABSPATH . $excl_rule;
$path = realpath($exclude_rule);
@ -1125,8 +1134,9 @@ class MainWP_Child_Back_Up_Wordpress {
$exclude_rule_to_remove = trim($exclude_rule_to_remove);
$exclude_rule_to_remove = trim($exclude_rule_to_remove, '/');
if (empty($exclude_rule_to_remove))
if (empty($exclude_rule_to_remove)) {
continue;
}
$excludes = $schedule->get_excludes();
if (method_exists($excludes, 'get_user_excludes')) {
@ -1210,8 +1220,9 @@ class MainWP_Child_Back_Up_Wordpress {
$out = array();
foreach($schedules as $sch_id => $sch) {
if ( empty($sch_id) || !isset( $sch['options'] ) || ! is_array( $sch['options'] ) )
if ( empty($sch_id) || !isset( $sch['options'] ) || ! is_array( $sch['options'] ) ) {
continue;
}
$options = $sch['options'];
$filter_opts = array(
'type',

View file

@ -66,7 +66,7 @@ class MainWP_Child_Back_WP_Up {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
try {
@ -80,14 +80,14 @@ class MainWP_Child_Back_WP_Up {
}
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
require_once( $file_path1 );
require_once( $file_path2 );
require_once $file_path1;
require_once $file_path2;
$this->is_backwpup_installed = true;
$this->is_backwpup_pro = true;
} else if ( is_plugin_active( 'backwpup/backwpup.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../backwpup/backwpup.php' ) ) {
} elseif ( is_plugin_active( 'backwpup/backwpup.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../backwpup/backwpup.php' ) ) {
$file_path = plugin_dir_path( __FILE__ ) . '../../backwpup/backwpup.php';
MainWP_Helper::check_files_exists(array( $file_path ));
require_once( $file_path );
require_once $file_path;
$this->is_backwpup_installed = true;
}
@ -119,7 +119,7 @@ class MainWP_Child_Back_WP_Up {
$info = self::$information;
if ( isset( $error['type'] ) && E_ERROR === $error['type'] && isset( $error['message'] ) ) {
MainWP_Helper::write( array( 'error' => 'MainWP_Child fatal error : ' . $error['message'] . ' Line: ' . $error['line'] . ' File: ' . $error['file'] ) );
} else if ( ! empty( $info ) ) {
} elseif ( ! empty( $info ) ) {
MainWP_Helper::write( self::$information );
} else {
MainWP_Helper::write( array( 'error' => 'Missing information array inside fatal_error' ) );
@ -218,8 +218,9 @@ class MainWP_Child_Back_WP_Up {
public function init() {
if (!$this->is_backwpup_installed)
if (!$this->is_backwpup_installed) {
return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -238,9 +239,11 @@ class MainWP_Child_Back_WP_Up {
}
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'backwpup' ) return;
if (!$this->is_backwpup_installed)
if ( $ext !== 'backwpup' ) { return;
}
if (!$this->is_backwpup_installed) {
return;
}
try {
@ -269,8 +272,9 @@ class MainWP_Child_Back_WP_Up {
$log_items = array();
foreach ( $logfiles as $mtime => $logfile ) {
$meta = BackWPup_Job::read_logheader( $log_folder . '/' . $logfile );
if (!isset($meta['logtime']) || $meta['logtime'] < $lasttime_logged)
if (!isset($meta['logtime']) || $meta['logtime'] < $lasttime_logged) {
continue;
}
if (isset($meta['errors']) && !empty($meta['errors'])) {
continue; // do not logging backups have errors
@ -313,8 +317,9 @@ class MainWP_Child_Back_WP_Up {
$message = 'BackWPup backup finished (' . $backup_type . ')';
do_action( 'mainwp_reports_backwpup_backup', $message, $backup_type, $backup_time );
if ($new_lasttime_logged < $backup_time)
if ($new_lasttime_logged < $backup_time) {
$new_lasttime_logged = $backup_time;
}
}
if ($new_lasttime_logged > $lasttime_logged ) {
@ -744,7 +749,7 @@ class MainWP_Child_Back_WP_Up {
$temp_array['website_id'] = $website_id;
$array[] = $temp_array;
}
} else if ( $type == 'backups' ) {
} elseif ( $type == 'backups' ) {
$without_dupes = array();
foreach ( $output->items as $key ) {
$temp_array = $key;
@ -973,7 +978,7 @@ class MainWP_Child_Back_WP_Up {
}
if ( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}
}
@ -1136,9 +1141,9 @@ class MainWP_Child_Back_WP_Up {
if ( $dir = @opendir( $main_folder_name ) ) {
while ( ( $file = readdir( $dir ) ) !== false ) {
if ( ! in_array( $file, array(
'.',
'..',
) ) && is_dir( $main_folder_name . '/' . $file ) && ! in_array( trailingslashit( $main_folder_name . '/' . $file ), mainwp_backwpup_get_exclude_dirs( $main_folder_name ) )
'.',
'..',
) ) && is_dir( $main_folder_name . '/' . $file ) && ! in_array( trailingslashit( $main_folder_name . '/' . $file ), mainwp_backwpup_get_exclude_dirs( $main_folder_name ) )
) {
$folder_size = ' (' . size_format( BackWPup_File::get_folder_size( $main_folder_name . '/' . $file ), 2 ) . ')';
@ -1394,7 +1399,7 @@ class MainWP_Child_Back_WP_Up {
$url = BackWPup_Job::get_jobrun_url( 'runnowlink', $job_id );
BackWPup_Admin::message( sprintf( __( 'Changes for job <i>%s</i> saved.', 'backwpup' ), BackWPup_Option::get( $job_id, 'name' ) ) . ' <a href="' . network_admin_url( 'admin.php' ) . '?page=backwpupjobs">' . __( 'Jobs overview', 'backwpup' ) . '</a> | <a href="' . $url['url'] . '">' . __( 'Run now', 'backwpup' ) . '</a>' );
}
} else if ($settings['tab'] == 'dest-DROPBOX') {
} elseif ($settings['tab'] == 'dest-DROPBOX') {
unset($settings['value']); // do not save dropbox settings
BackWPup_Page_Editjob::save_post_form( $settings['tab'], $job_id );
} else {
@ -1436,7 +1441,7 @@ class MainWP_Child_Back_WP_Up {
if ( ! in_array( $key, $this->exclusions[ $settings['tab'] ] ) && strcmp( $temp_value, $val ) != 0 ) {
$changes_array[ $key ] = $temp_value;
}
} else if ( strcmp( $temp_value, $val ) != 0 ) {
} elseif ( strcmp( $temp_value, $val ) != 0 ) {
$changes_array[ $key ] = $temp_value;
}
}
@ -1518,7 +1523,7 @@ class MainWP_Child_Back_WP_Up {
if ( isset( $message['error'] ) ) {
return array( 'error' => implode( ', ', $message['error'] ) );
} else if ( isset( $message['updated'] ) ) {
} elseif ( isset( $message['updated'] ) ) {
return array( 'message' => $message['updated'] );
} else {
return array( 'error' => 'Generic error' );

View file

@ -66,8 +66,9 @@ class MainWP_Child_Branding {
$extra = array();
if (is_array($this->child_branding_options) && isset($this->child_branding_options['extra_settings'])) {
$extra = $this->child_branding_options['extra_settings'];
if (!is_array($extra))
if (!is_array($extra)) {
$extra = array();
}
}
return $extra;
@ -279,7 +280,7 @@ class MainWP_Child_Branding {
$information['error']['login_image'] = $e->getMessage();
}
}
} else if ( isset( $current_extra_setting['login_image'] ) ) {
} elseif ( isset( $current_extra_setting['login_image'] ) ) {
$extra_setting['login_image'] = $current_extra_setting['login_image'];
}
@ -302,7 +303,7 @@ class MainWP_Child_Branding {
$information['error']['favico_image'] = $e->getMessage();
}
}
} else if ( isset( $current_extra_setting['favico_image'] ) ) {
} elseif ( isset( $current_extra_setting['favico_image'] ) ) {
$extra_setting['favico_image'] = $current_extra_setting['favico_image'];
}
@ -347,7 +348,7 @@ 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
@ -382,7 +383,7 @@ class MainWP_Child_Branding {
if (is_admin()) {
// back end
add_action( 'in_admin_footer', array( $this, 'in_admin_footer' ) );
} else if (is_user_logged_in()) {
} elseif (is_user_logged_in()) {
// front end
add_action( 'wp_after_admin_bar_render', array( $this, 'after_admin_bar_render' ));
}
@ -474,7 +475,7 @@ class MainWP_Child_Branding {
function admin_menu() {
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
if ( $allow_contact ) {; // ok
} else if ( !current_user_can( 'administrator' ) ) {
} elseif ( !current_user_can( 'administrator' ) ) {
return false;
}
@ -805,8 +806,9 @@ class MainWP_Child_Branding {
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
global $current_user;
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
if (!empty($from))
if (!empty($from)) {
$headers .= 'From: "' . $from . '" <' . $from . ">\r\n";
}
$mail .= "<p>Support Email from: <a href='" . site_url() . "'>" . site_url() . "</a></p>\r\n\r\n";
$mail .= '<p>Sent from WordPress page: ' . ( ! empty( $_POST['mainwp_branding_send_from_page'] ) ? "<a href='" . esc_url( $_POST['mainwp_branding_send_from_page'] ) . "'>" . esc_url( $_POST['mainwp_branding_send_from_page'] ) . "</a></p>\r\n\r\n" : '' );
$mail .= '<p>Client Email: ' . $current_user->user_email . " </p>\r\n\r\n";
@ -892,12 +894,12 @@ class MainWP_Child_Branding {
<?php
remove_editor_styles(); // stop custom theme styling interfering with the editor
wp_editor( '', 'mainwp_branding_contact_message_content', array(
'textarea_name' => 'mainwp_branding_contact_message_content',
'textarea_rows' => 10,
'teeny' => true,
'wpautop' => true,
'media_buttons' => false,
)
'textarea_name' => 'mainwp_branding_contact_message_content',
'textarea_rows' => 10,
'teeny' => true,
'wpautop' => true,
'media_buttons' => false,
)
);
?>
</div>
@ -925,7 +927,7 @@ class MainWP_Child_Branding {
public function add_support_button_in_top_admin_bar( $wp_admin_bar ) {
$allow_contact = apply_filters('mainwp_branding_role_cap_enable_contact_form', false);
if ( $allow_contact ) {; // ok
} else if ( !current_user_can( 'administrator' ) ) {
} elseif ( !current_user_can( 'administrator' ) ) {
return false;
}
@ -995,15 +997,16 @@ class MainWP_Child_Branding {
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
if (!is_array($hide_slugs))
if (!is_array($hide_slugs)) {
$hide_slugs = array();
}
if (count($hide_slugs) == 0) {
return;
}
if (!function_exists('get_plugin_updates')) {
include_once( ABSPATH . '/wp-admin/includes/update.php' );
include_once ABSPATH . '/wp-admin/includes/update.php';
}
$count_hide = 0;
@ -1047,8 +1050,9 @@ class MainWP_Child_Branding {
$hide_slugs = apply_filters('mainwp_child_hide_update_notice', array());
if (!is_array($hide_slugs))
if (!is_array($hide_slugs)) {
$hide_slugs = array();
}
$count_hide = 0;

View file

@ -28,13 +28,14 @@ class MainWP_Child_iThemes_Security {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'better-wp-security/better-wp-security.php') || is_plugin_active( 'ithemes-security-pro/ithemes-security-pro.php' ) ) {
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
}
@ -130,8 +131,9 @@ class MainWP_Child_iThemes_Security {
}
public function ithemes_init() {
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
if ( get_option( 'mainwp_ithemes_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -177,7 +179,7 @@ class MainWP_Child_iThemes_Security {
function save_settings() {
if ( ! class_exists( 'ITSEC_Lib' ) ) {
require( ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php' );
require ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php';
}
$_itsec_modules = array(
@ -214,7 +216,7 @@ class MainWP_Child_iThemes_Security {
if (in_array($module, $_itsec_modules)) {
if ($module == 'wordpress-salts') {
$settings['last_generated'] = ITSEC_Modules::get_setting( $module, 'last_generated' ); // not update
} else if ($module == 'global') {
} elseif ($module == 'global') {
$keep_olds = array( 'did_upgrade', 'log_info', 'show_new_dashboard_notice', 'show_security_check', 'nginx_file' );
foreach($keep_olds as $key) {
$settings[$key] = ITSEC_Modules::get_setting( $module, $key ); // not update
@ -230,7 +232,7 @@ class MainWP_Child_iThemes_Security {
}
}
} else if ($module == 'backup') {
} elseif ($module == 'backup') {
if (!isset($settings['location']) || empty($settings['location']) ) {
$settings['location'] = ITSEC_Modules::get_setting( $module, 'location' );
} else {
@ -244,7 +246,7 @@ class MainWP_Child_iThemes_Security {
$settings['exclude'] = ITSEC_Modules::get_setting( $module, 'exclude' );
}
} else if ($module == 'hide-backend') {
} elseif ($module == 'hide-backend') {
if (isset($settings['enabled']) && !empty($settings['enabled'])) {
$permalink_structure = get_option( 'permalink_structure', false );
if ( empty( $permalink_structure ) && ! is_multisite() ) {
@ -253,7 +255,7 @@ class MainWP_Child_iThemes_Security {
$do_not_save = true;
}
}
} else if ($module == 'network-brute-force') {
} elseif ($module == 'network-brute-force') {
if ( isset( $settings['email'] ) ) {
$result = $this->activate_api_key($settings);
@ -275,7 +277,7 @@ class MainWP_Child_iThemes_Security {
}
}
$settings = $nbf_settings;
} else if ($module == 'notification-center') {
} elseif ($module == 'notification-center') {
$current_settings = ITSEC_Modules::get_settings( $module );
if (isset($settings['notifications'])) {
$update_fields = array( 'schedule', 'enabled', 'subject');
@ -310,7 +312,7 @@ class MainWP_Child_iThemes_Security {
update_site_option( 'itsec_active_modules', $current_val );
}
require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-config-file.php' );
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-config-file.php';
$values = array(
'permalink_structure' => get_option( 'permalink_structure' ),
@ -344,10 +346,11 @@ class MainWP_Child_iThemes_Security {
$return['extra_message'] = $errors;
}
if ($updated)
if ($updated) {
$return['result'] = 'success';
else
} else {
$return['error'] = __('Not Updated', 'mainwp-child' );
}
return $return;
}
@ -363,7 +366,7 @@ class MainWP_Child_iThemes_Security {
$results = ITSEC_Modules::set_settings( 'network-brute-force', $settings );
if ( is_wp_error( $results ) ) {
$information['error'] = 'Error: Active iThemes Network Brute Force Protection Api Key';
} else if ( $results['saved'] ) {
} 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>' );
@ -377,7 +380,7 @@ class MainWP_Child_iThemes_Security {
}
private function validate_directory( $name, $folder) {
require_once( ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-directory.php' );
require_once ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-directory.php';
$error = null;
if ( ! ITSEC_Lib_Directory::is_dir( $folder ) ) {
$result = ITSEC_Lib_Directory::create( $folder );
@ -401,7 +404,7 @@ class MainWP_Child_iThemes_Security {
private function activate_api_key( $settings) {
global $mainwp_itsec_modules_path;
require_once ( $mainwp_itsec_modules_path . 'ipcheck/utilities.php' );
require_once $mainwp_itsec_modules_path . 'ipcheck/utilities.php';
$key = ITSEC_Network_Brute_Force_Utilities::get_api_key( $settings['email'], $settings['updates_optin'] );
if ( is_wp_error( $key ) ) {
@ -495,7 +498,7 @@ class MainWP_Child_iThemes_Security {
global $itsec_backup, $mainwp_itsec_modules_path;
if ( ! isset( $itsec_backup ) ) {
require_once ( $mainwp_itsec_modules_path . 'backup/class-itsec-backup.php' );
require_once $mainwp_itsec_modules_path . 'backup/class-itsec-backup.php';
$itsec_backup = new ITSEC_Backup();
$itsec_backup->run();
}
@ -511,7 +514,7 @@ class MainWP_Child_iThemes_Security {
foreach ( $errors as $error ) {
$str_error .= $error . '<br />';
}
} else if ( is_string( $result ) ) {
} elseif ( is_string( $result ) ) {
$return['result'] = 'success';
$return['message'] = $result;
} else {
@ -529,7 +532,7 @@ class MainWP_Child_iThemes_Security {
private function wordpress_salts() {
global $mainwp_itsec_modules_path;
if ( ! class_exists( 'ITSEC_WordPress_Salts_Utilities' ) ) {
require( $mainwp_itsec_modules_path . 'salts/utilities.php' );
require $mainwp_itsec_modules_path . 'salts/utilities.php';
}
$result = ITSEC_WordPress_Salts_Utilities::generate_new_salts();
$str_error = '';
@ -552,7 +555,7 @@ class MainWP_Child_iThemes_Security {
}
private function file_permissions() {
require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-config-file.php' );
require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-config-file.php';
$wp_upload_dir = ITSEC_Core::get_wp_upload_dir();
@ -673,7 +676,7 @@ class MainWP_Child_iThemes_Security {
public function file_change() {
global $mainwp_itsec_modules_path;
if ( ! class_exists( 'ITSEC_File_Change_Scanner' ) ) {
require_once( $mainwp_itsec_modules_path . 'file-change/scanner.php' );
require_once $mainwp_itsec_modules_path . 'file-change/scanner.php';
}
$result = ITSEC_File_Change_Scanner::run_scan( false );
if ($result === false || $result === true || $result === -1) {
@ -687,8 +690,9 @@ class MainWP_Child_iThemes_Security {
$settings = $_POST['settings'];
if (!is_array($settings))
if (!is_array($settings)) {
$settings = array();
}
$new_username = isset( $settings['new_username'] ) ? $settings['new_username'] : '';
$change_id = isset( $settings['change_id'] ) && $settings['change_id'] ? true : false;
@ -696,7 +700,7 @@ class MainWP_Child_iThemes_Security {
//load utility functions
if ( ! class_exists( 'ITSEC_Lib' ) ) {
global $itsec_globals;
require( ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php' );
require ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php';
}
$username_exists = username_exists( 'admin' );
@ -706,7 +710,7 @@ class MainWP_Child_iThemes_Security {
global $current_user;
if ( ! $username_exists ) {
$msg = __( 'Admin user already changes.', 'mainwp-child' );
} else if ($current_user->user_login == 'admin') {
} elseif ($current_user->user_login == 'admin') {
$return['result'] = 'CHILD_ADMIN';
return $return;
}
@ -871,7 +875,7 @@ class MainWP_Child_iThemes_Security {
public function change_database_prefix() {
global $mainwp_itsec_modules_path;
require_once( $mainwp_itsec_modules_path . 'database-prefix/utility.php' );
require_once $mainwp_itsec_modules_path . 'database-prefix/utility.php';
$str_error = '';
$return = array();
@ -929,7 +933,7 @@ class MainWP_Child_iThemes_Security {
if ( $results['saved'] ) {
$information['result'] = 'success';
$information['nbf_settings'] = ITSEC_Modules::get_settings( 'network-brute-force');
} else if ( empty( $results['errors'] ) ) {
} elseif ( empty( $results['errors'] ) ) {
$information['error_reset_api'] = 1;
}
return $information;
@ -939,8 +943,8 @@ class MainWP_Child_iThemes_Security {
global $mainwp_itsec_modules_path;
if ( ! class_exists( 'ITSEC_Malware_Scanner' ) ) {
require_once( $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scanner.php' );
require_once( $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php' );
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scanner.php';
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php';
}
$response = array();
@ -958,8 +962,8 @@ class MainWP_Child_iThemes_Security {
global $mainwp_itsec_modules_path;
if ( ! class_exists( 'ITSEC_Malware_Scanner' ) ) {
require_once( $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scanner.php' );
require_once( $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php' );
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scanner.php';
require_once $mainwp_itsec_modules_path . 'malware/class-itsec-malware-scan-results-template.php';
}
$response = array();
$results= ITSEC_Malware_Scanner::scan();
@ -1061,7 +1065,7 @@ class MainWP_Child_iThemes_Security {
global $wpdb;
if ( ! class_exists( 'ITSEC_Lib' ) ) {
require( ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php' );
require ITSEC_Core::get_core_dir() . '/core/class-itsec-lib.php';
}
$lockout_ids = $_POST['lockout_ids'];
@ -1088,7 +1092,7 @@ class MainWP_Child_iThemes_Security {
if ( ! is_multisite() ) {
if ( ! function_exists( 'add_settings_error' ) ) {
require_once( ABSPATH . '/wp-admin/includes/template.php' );
require_once ABSPATH . '/wp-admin/includes/template.php';
}
add_settings_error( 'itsec', esc_attr( 'settings_updated' ), $message, $type );
@ -1103,8 +1107,9 @@ class MainWP_Child_iThemes_Security {
$active_modules = $_POST['active_modules'];
if (!is_array($active_modules))
if (!is_array($active_modules)) {
$active_modules = array();
}
$current_val = get_site_option( 'itsec_active_modules', array() );
foreach ($active_modules as $mod => $val) {
@ -1164,8 +1169,8 @@ class MainWP_Child_iThemes_Security {
private function security_site() {
global $mainwp_itsec_modules_path;
require_once( $mainwp_itsec_modules_path . 'security-check/scanner.php' );
require_once( $mainwp_itsec_modules_path . 'security-check/feedback-renderer.php' );
require_once $mainwp_itsec_modules_path . 'security-check/scanner.php';
require_once $mainwp_itsec_modules_path . 'security-check/feedback-renderer.php';
$results = ITSEC_Security_Check_Scanner::get_results();
ob_start();
ITSEC_Security_Check_Feedback_Renderer::render( $results );

View file

@ -27,13 +27,14 @@ class MainWP_Child_Links_Checker {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'broken-link-checker/broken-link-checker.php' ) ) {
$this->is_plugin_installed = true;
}
if ( !$this->is_plugin_installed )
if ( !$this->is_plugin_installed ) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
}
@ -222,14 +223,16 @@ class MainWP_Child_Links_Checker {
function get_sync_data( $strategy = '' ) {
$information = array();
$data = $this->get_count_links();
if (is_array($data))
if (is_array($data)) {
$information['data'] = $data;
}
return $information;
}
function get_links_data() {
if (!defined('BLC_DIRECTORY')) return;
if (!defined('BLC_DIRECTORY')) { return;
}
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
@ -251,9 +254,9 @@ class MainWP_Child_Links_Checker {
$offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
$params = array(
array( 'load_instances' => true ),
'max_results' => $max_results,
);
array( 'load_instances' => true ),
'max_results' => $max_results,
);
if (empty($offset)) {
$first_sync = true;
@ -288,7 +291,8 @@ class MainWP_Child_Links_Checker {
}
function get_count_links() {
if (!defined('BLC_DIRECTORY')) return;
if (!defined('BLC_DIRECTORY')) { return;
}
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
@ -638,7 +642,7 @@ class MainWP_Child_Links_Checker {
function ui_get_source( $container, $container_field = '' ) {
if ( 'comment' === $container->container_type ) {
return $this->ui_get_source_comment( $container, $container_field );
} else if ( $container instanceof blcAnyPostContainer ) {
} elseif ( $container instanceof blcAnyPostContainer ) {
return $this->ui_get_source_post( $container, $container_field );
}
@ -653,8 +657,9 @@ class MainWP_Child_Links_Checker {
$image = 'font-awesome/font-awesome-comment-alt.png';
}
if (true !== MainWP_Helper::check_methods($container, array( 'get_wrapped_object'), true ))
if (true !== MainWP_Helper::check_methods($container, array( 'get_wrapped_object'), true )) {
return false;
}
$comment = $container->get_wrapped_object();

View file

@ -29,13 +29,14 @@ class MainWP_Child_Pagespeed {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'google-pagespeed-insights/google-pagespeed-insights.php' ) ) {
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
@ -75,8 +76,9 @@ class MainWP_Child_Pagespeed {
}
public function init() {
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
if ( get_option( 'mainwp_pagespeed_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'hide_plugin' ) );

View file

@ -279,7 +279,7 @@ class MainWP_Child_Plugins_Check {
//Some of this code is lifted from class-wp-upgrader
//Get the WordPress current version to be polite in the API call
include( ABSPATH . WPINC . '/version.php' );
include ABSPATH . WPINC . '/version.php';
global $wp_version;

View file

@ -19,10 +19,11 @@ class MainWP_Child_Server_Information {
}
if ( $_POST['what'] == 'warning' ) {
if (isset($_POST['warnings']))
if (isset($_POST['warnings'])) {
$warnings = intval($_POST['warnings']);
else
} else {
$warnings = self::getWarnings();
}
$dismissWarnings['warnings'] = $warnings;
}
MainWP_Helper::update_option( 'mainwp_child_dismiss_warnings', $dismissWarnings );
@ -826,7 +827,7 @@ class MainWP_Child_Server_Information {
if ( $isBranding ) {
if ( $slug == 'mainwp-child/mainwp-child.php' ) {
$plugin['Name'] = esc_html( stripslashes( $branding_title ) );
} else if ($slug == 'mainwp-child-reports/mainwp-child-reports.php') {
} elseif ($slug == 'mainwp-child-reports/mainwp-child-reports.php') {
$plugin['Name'] = esc_html( stripslashes( $branding_title ) ) . ' reports';
}
}
@ -905,7 +906,7 @@ class MainWP_Child_Server_Information {
}
protected static function getMainwpVersion() {
include_once( ABSPATH . '/wp-admin/includes/plugin-install.php' );
include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
$api = plugins_api( 'plugin_information', array(
'slug' => 'mainwp-child',
'fields' => array( 'sections' => false ),
@ -966,8 +967,9 @@ class MainWP_Child_Server_Information {
protected static function checkDirectoryMainWPDirectory( $write = true ) {
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
if ($branding_title == '')
if ($branding_title == '') {
$branding_title = 'MainWP';
}
$branding_title .= ' Upload Directory';
@ -1052,9 +1054,9 @@ class MainWP_Child_Server_Information {
<td><?php echo( $currentVersion === true ? 'true' : $currentVersion ); ?></td>
<?php if ( $whatType == 'filesize' ) { ?>
<td><?php echo( self::filesize_compare( $currentVersion, $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType ) ); ?></td>
<?php } else if ( $whatType == 'curlssl' ) { ?>
<?php } elseif ( $whatType == 'curlssl' ) { ?>
<td><?php echo( self::curlssl_compare( $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType ) ); ?></td>
<?php } else if (($pGetter == 'getMaxInputTime' || $pGetter == 'getMaxExecutionTime') && $currentVersion == -1) { ?>
<?php } elseif (($pGetter == 'getMaxInputTime' || $pGetter == 'getMaxExecutionTime') && $currentVersion == -1) { ?>
<td><?php echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>'; ?></td>
<?php } else { ?>
<td><?php echo (version_compare($currentVersion, $pVersion, $pCompare) || (($pExtraCompare != null) && version_compare($currentVersion, $pExtraVersion, $pExtraCompare)) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType )); ?></td>
@ -1349,8 +1351,9 @@ class MainWP_Child_Server_Information {
}
if ( empty( $test_result ) ) {
_e( 'Response Test O.K.', 'mainwp-child' );
} else
} else {
echo $test_result;
}
}
@ -1624,42 +1627,43 @@ class MainWP_Child_Server_Information {
public static function renderConnectionDetails() {
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
if ($branding_title == '')
if ($branding_title == '') {
$branding_title = 'MainWP';
}
global $current_user;
$uniqueId = get_option('mainwp_child_uniqueId');
$details = array(
'siteurl' => array(
'title' => __('Site URL', 'mainwp-child'),
'value' => get_bloginfo( 'url' ),
'desc' => get_bloginfo( 'url' ),
),
'title' => __('Site URL', 'mainwp-child'),
'value' => get_bloginfo( 'url' ),
'desc' => get_bloginfo( 'url' ),
),
'adminuser' => array(
'title' => __('Administrator name', 'mainwp-child'),
'value' => $current_user->user_login,
'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child'),
),
'title' => __('Administrator name', 'mainwp-child'),
'value' => $current_user->user_login,
'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child'),
),
'friendly_name' => array(
'title' => __('Friendly site name', 'mainwp-child'),
'value' => get_bloginfo( 'name' ),
'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child'),
),
'title' => __('Friendly site name', 'mainwp-child'),
'value' => get_bloginfo( 'name' ),
'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child'),
),
'uniqueid' => array(
'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child'), stripslashes( $branding_title ) ),
),
'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
'desc' => sprintf(__('Child unique security id is not required, however, since you have enabled it, you need to add it to your %s dashboard.', 'mainwp-child'), stripslashes( $branding_title ) ),
),
'verify_ssl' => array(
'title' => __('Verify certificate', 'mainwp-child'),
'value' => __('Yes', 'mainwp-child'),
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'),
),
'title' => __('Verify certificate', 'mainwp-child'),
'value' => __('Yes', 'mainwp-child'),
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child'),
),
'ssl_version' => array(
'title' => __('SSL version', 'mainwp-child'),
'value' => __('Auto Detect', 'mainwp-child'),
'desc' => __('Auto Detect', 'mainwp-child'),
),
'title' => __('SSL version', 'mainwp-child'),
'value' => __('Auto Detect', 'mainwp-child'),
'desc' => __('Auto Detect', 'mainwp-child'),
),
);
?>

View file

@ -189,18 +189,21 @@ class MainWP_Child_Skeleton_Key {
public function save_settings() {
$settings = isset($_POST['settings']) ? $_POST['settings'] : array();
if (!is_array($settings) || empty($settings))
if (!is_array($settings) || empty($settings)) {
return array('error' => 'Invalid data. Please check and try again.');
}
$whitelist_options = array(
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
);
if ( !is_multisite() ) {
if ( !defined( 'WP_SITEURL' ) )
if ( !defined( 'WP_SITEURL' ) ) {
$whitelist_options['general'][] = 'siteurl';
if ( !defined( 'WP_HOME' ) )
}
if ( !defined( 'WP_HOME' ) ) {
$whitelist_options['general'][] = 'home';
}
$whitelist_options['general'][] = 'admin_email';
$whitelist_options['general'][] = 'users_can_register';
@ -212,7 +215,7 @@ class MainWP_Child_Skeleton_Key {
// Handle translation install.
if ( ! empty( $settings['WPLANG'] ) ) {
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
if ( wp_can_install_language_pack() ) {
$language = wp_download_language_pack( $settings['WPLANG'] );
if ( $language ) {
@ -224,16 +227,18 @@ class MainWP_Child_Skeleton_Key {
$updated = false;
foreach($settings as $option => $value) {
if (in_array($option, $whitelist_general)) {
if ( ! is_array( $value ) )
if ( ! is_array( $value ) ) {
$value = trim( $value );
}
$value = wp_unslash( $value );
update_option($option, $value);
$updated = true;
}
}
if (!$updated)
if (!$updated) {
return false;
}
return array('result' => 'ok');
}

View file

@ -29,26 +29,29 @@ class MainWP_Child_Staging {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'wp-staging/wp-staging.php' ) && defined('WPSTG_PLUGIN_DIR')) {
$this->is_plugin_installed = true;
} else if ( is_plugin_active( 'wp-staging-pro/wp-staging-pro.php' ) ) {
} elseif ( is_plugin_active( 'wp-staging-pro/wp-staging-pro.php' ) ) {
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
}
public function init() {
if ( get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y' )
if ( get_option( 'mainwp_wp_staging_ext_enabled' ) !== 'Y' ) {
return;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
if ( get_option( 'mainwp_wp_staging_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -299,9 +302,9 @@ class MainWP_Child_Staging {
$delete->setData();
$clone = $delete->getClone();
$result = array(
'clone' => $clone,
'deleteTables' => $delete->getTables(),
);
'clone' => $clone,
'deleteTables' => $delete->getTables(),
);
return $result;
}

View file

@ -125,7 +125,7 @@ class MainWP_Child_Themes_Check {
$themes_outdate = array();
}
if ( ! function_exists( 'wp_get_themes' ) ) {
require_once( ABSPATH . '/wp-admin/includes/theme.php' );
require_once ABSPATH . '/wp-admin/includes/theme.php';
}
$themes = wp_get_themes();
$update = false;
@ -144,7 +144,7 @@ class MainWP_Child_Themes_Check {
public function run_check() {
if ( ! function_exists( 'wp_get_themes' ) ) {
require_once( ABSPATH . '/wp-admin/includes/theme.php' );
require_once ABSPATH . '/wp-admin/includes/theme.php';
}
//Get our previous results
@ -177,7 +177,8 @@ class MainWP_Child_Themes_Check {
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
foreach ( $themes_to_scan as $slug => $v ) {
if ( in_array( $slug, $avoid_themes ) ) continue;
if ( in_array( $slug, $avoid_themes ) ) { continue;
}
$body = $this->try_get_response_body( $slug, false );
@ -226,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
include( ABSPATH . WPINC . '/version.php' );
include ABSPATH . WPINC . '/version.php';
$url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {

View file

@ -26,24 +26,27 @@ class MainWP_Child_Timecapsule {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'wp-time-capsule/wp-time-capsule.php' ) && defined('WPTC_CLASSES_DIR')) {
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
}
public function init() {
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' )
if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' ) {
return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
@ -240,8 +243,9 @@ class MainWP_Child_Timecapsule {
public function syncOthersData( $information, $data = array() ) {
if ( isset( $data['syncWPTimeCapsule'] ) && $data['syncWPTimeCapsule'] ) {
$information['syncWPTimeCapsule'] = $this->get_sync_data();
if (get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y')
if (get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y') {
MainWP_Helper::update_option( 'mainwp_time_capsule_ext_enabled', 'Y', 'yes' );
}
}
return $information;
}
@ -276,13 +280,13 @@ class MainWP_Child_Timecapsule {
}
$return = array(
'main_account_email' => $main_account_email_var,
'signed_in_repos' => $wptc_settings->get_connected_cloud_info(),
'plan_name' => $options_helper->get_plan_interval_from_subs_info(),
'plan_interval' => $options_helper->get_plan_interval_from_subs_info(),
'lastbackup_time' => !empty($last_backup_time) ? $last_backup_time : 0,
'is_user_logged_in' => $options_helper->get_is_user_logged_in(),
'backups_count' => $backups_count,
'main_account_email' => $main_account_email_var,
'signed_in_repos' => $wptc_settings->get_connected_cloud_info(),
'plan_name' => $options_helper->get_plan_interval_from_subs_info(),
'plan_interval' => $options_helper->get_plan_interval_from_subs_info(),
'lastbackup_time' => !empty($last_backup_time) ? $last_backup_time : 0,
'is_user_logged_in' => $options_helper->get_is_user_logged_in(),
'backups_count' => $backups_count,
);
return $return;
} catch ( Exception $e) {
@ -418,7 +422,7 @@ function start_restore_tc_callback_wptc() {
$request = $_POST['data'];
}
include_once ( WPTC_CLASSES_DIR . 'class-prepare-restore-bridge.php' );
include_once WPTC_CLASSES_DIR . 'class-prepare-restore-bridge.php';
new WPTC_Prepare_Restore_Bridge($request);
}
@ -508,7 +512,7 @@ function get_sibling_files_callback_wptc() {
return array( 'items' => $wpdb->get_results($query),
'totalitems' => $totalitems,
'perpage' => $perpage,
);
);
}
@ -556,8 +560,9 @@ function get_sibling_files_callback_wptc() {
function get_display_rows( $records) {
global $wpdb;
//Get the records registered in the prepare_items method
if (!is_array($records))
if (!is_array($records)) {
return '';
}
$i=0;
$limit = WPTC_Factory::get('config')->get_option('activity_log_lazy_load_limit');
@ -603,10 +608,10 @@ function get_sibling_files_callback_wptc() {
if (!(strpos($rec->type, 'backup') === false)) {
//Backup process
$msg = 'Backup Process';
} else if (!(strpos($rec->type, 'restore') === false)) {
} elseif (!(strpos($rec->type, 'restore') === false)) {
//Restore Process
$msg = 'Restore Process';
} else if (!(strpos($rec->type, 'staging') === false)) {
} elseif (!(strpos($rec->type, 'staging') === false)) {
//Restore Process
$msg = 'Staging Process';
} else {
@ -703,10 +708,12 @@ function get_sibling_files_callback_wptc() {
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'wptimecapsule' ) return;
if ( $ext !== 'wptimecapsule' ) { return;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
try {
MainWP_Helper::check_classes_exists(array( 'WPTC_Factory'));
@ -723,8 +730,9 @@ function get_sibling_files_callback_wptc() {
$last_time = time() - 24 * 7 * 2 * 60 * 60; // 2 weeks ago
$lasttime_logged = MainWP_Helper::get_lasttime_backup('wptimecapsule');
if (empty($lasttime_logged))
if (empty($lasttime_logged)) {
$last_time = time() - 24 * 7 * 8 * 60 * 60; // 8 weeks ago
}
$all_last_backups = $this->getBackups( $last_time );
@ -977,8 +985,9 @@ function get_sibling_files_callback_wptc() {
$config->set_option('schedule_time_str', $data['schedule_time_str']);
if(!empty($data['schedule_time_str']) && !empty($data['wptc_timezone']) ){
if (function_exists('wptc_modify_schedule_backup'))
if (function_exists('wptc_modify_schedule_backup')) {
wptc_modify_schedule_backup();
}
}
$notice = apply_filters('check_requirements_auto_backup_wptc', '');
@ -989,7 +998,7 @@ function get_sibling_files_callback_wptc() {
$saved = true;
} else if ( $tabName == 'backup_auto' ) { // update_auto_update_settings()
} elseif ( $tabName == 'backup_auto' ) { // update_auto_update_settings()
$config->set_option('backup_before_update_setting', $data['backup_before_update_setting']);
@ -1006,20 +1015,22 @@ function get_sibling_files_callback_wptc() {
$current['update_settings']['plugins']['status'] = $new['update_settings']['plugins']['status'];
if (!$is_general) {
if (isset($new['update_settings']['plugins']['included']))
if (isset($new['update_settings']['plugins']['included'])) {
$current['update_settings']['plugins']['included'] = $new['update_settings']['plugins']['included'];
else
} else {
$current['update_settings']['plugins']['included'] = array();
}
if (isset($new['update_settings']['themes']['included']))
if (isset($new['update_settings']['themes']['included'])) {
$current['update_settings']['themes']['included'] = $new['update_settings']['themes']['included'];
else
} else {
$current['update_settings']['themes']['included'] = array();
}
}
$config->set_option('wptc_auto_update_settings', serialize($current));
$saved = true;
} else if ( $tabName == 'vulns_update' ) {
} elseif ( $tabName == 'vulns_update' ) {
$current = $config->get_option('vulns_settings');
$current = unserialize($current);
$new = unserialize($data['vulns_settings']);
@ -1062,7 +1073,7 @@ function get_sibling_files_callback_wptc() {
$saved = true;
} else if ( $tabName == 'staging_opts' ) {
} elseif ( $tabName == 'staging_opts' ) {
$config->set_option('user_excluded_extenstions_staging', $data['user_excluded_extenstions_staging']);
$config->set_option('internal_staging_db_rows_copy_limit', $data['internal_staging_db_rows_copy_limit']);
$config->set_option('internal_staging_file_copy_limit', $data['internal_staging_file_copy_limit']);
@ -1169,10 +1180,11 @@ function get_sibling_files_callback_wptc() {
echo '<tr title=""><td>' . __( 'Current PHP user', 'wp-time-capsule' ) . '</td><td>' . esc_html( $php_user ) . '</td></tr>';
echo '<tr title="&gt;=30"><td>' . __( 'Maximum execution time', 'wp-time-capsule' ) . '</td><td>' . esc_html( ini_get( 'max_execution_time' ) ) . ' ' . __( 'seconds', 'wp-time-capsule' ) . '</td></tr>';
if ( defined( 'FS_CHMOD_DIR' ) )
if ( defined( 'FS_CHMOD_DIR' ) ) {
echo '<tr title="FS_CHMOD_DIR"><td>' . __( 'CHMOD Dir', 'wp-time-capsule' ) . '</td><td>' . esc_html( FS_CHMOD_DIR ) . '</td></tr>';
else
} else {
echo '<tr title="FS_CHMOD_DIR"><td>' . __( 'CHMOD Dir', 'wp-time-capsule' ) . '</td><td>0755</td></tr>';
}
$now = localtime( time(), true );
echo '<tr title=""><td>' . __( 'Server Time', 'wp-time-capsule' ) . '</td><td>' . esc_html( $now[ 'tm_hour' ] . ':' . $now[ 'tm_min' ] ) . '</td></tr>';

View file

@ -27,21 +27,23 @@ class MainWP_Child_Updraft_Plus_Backups {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'updraftplus/updraftplus.php' ) && defined('UPDRAFTPLUS_DIR')) {
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
add_filter('updraftplus_save_last_backup', array( __CLASS__, 'hookUpdraftplusSaveLastBackup' ));
}
public static function hookUpdraftplusSaveLastBackup( $last_backup) {
if (!is_array($last_backup))
if (!is_array($last_backup)) {
return $last_backup;
}
if (isset($last_backup['backup_time'])) {
$backup_time = $last_backup['backup_time'];
@ -242,8 +244,9 @@ class MainWP_Child_Updraft_Plus_Backups {
private function do_vault_connect() {
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
if ( is_array( $vault_settings ) && !empty( $vault_settings['token'] ) && !empty( $vault_settings['email'] ) )
if ( is_array( $vault_settings ) && !empty( $vault_settings['token'] ) && !empty( $vault_settings['email'] ) ) {
return array( 'connected' => true, 'html' => $this->connected_html() );
}
$connect = $this->vault_connect( $_REQUEST['email'], $_REQUEST['passwd'] );
if ( true === $connect ) {
@ -309,7 +312,8 @@ class MainWP_Child_Updraft_Plus_Backups {
)
);
if ( is_wp_error( $result ) || ( false === $result ) ) return $result;
if ( is_wp_error( $result ) || ( false === $result ) ) { return $result;
}
$response = json_decode( $result['body'], true );
@ -326,12 +330,14 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( !empty( $response['token'] ) ) {
// Store it
$vault_settings = UpdraftPlus_Options::get_updraft_option( 'updraft_updraftvault' );
if ( !is_array( $vault_settings ) ) $vault_settings = array();
if ( !is_array( $vault_settings ) ) { $vault_settings = array();
}
$vault_settings['email'] = $email;
$vault_settings['token'] = (string) $response['token'];
$vault_settings['quota'] = -1;
unset( $vault_settings['last_config'] );
if ( isset($response['quota'] ) ) $vault_settings['quota'] = $response['quota'];
if ( isset($response['quota'] ) ) { $vault_settings['quota'] = $response['quota'];
}
UpdraftPlus_Options::update_updraft_option( 'updraft_updraftvault', $vault_settings );
} elseif ( isset( $response['quota'] ) && !$response['quota'] ) {
return new WP_Error( 'no_quota', __( 'You do not currently have any UpdraftPlus Vault quota', 'updraftplus' ) );
@ -382,7 +388,8 @@ class MainWP_Child_Updraft_Plus_Backups {
'su' => base64_encode( home_url() ),
);
if ( !empty( $vault_settings['token'] ) ) $post_body['token'] = (string) $vault_settings['token'];
if ( !empty( $vault_settings['token'] ) ) { $post_body['token'] = (string) $vault_settings['token'];
}
// Use SSL to prevent snooping
wp_remote_post( $vault_mothership . '/?udm_action=vault_disconnect', array(
@ -395,11 +402,11 @@ class MainWP_Child_Updraft_Plus_Backups {
function required_files() {
if (defined('UPDRAFTPLUS_DIR')) {
if ( ! class_exists( 'UpdraftPlus' ) && file_exists( UPDRAFTPLUS_DIR . '/class-updraftplus.php') ) {
require_once( UPDRAFTPLUS_DIR . '/class-updraftplus.php' );
require_once UPDRAFTPLUS_DIR . '/class-updraftplus.php';
}
if ( ! class_exists( 'UpdraftPlus_Options' ) && file_exists( UPDRAFTPLUS_DIR . '/options.php' ) ) {
require_once( UPDRAFTPLUS_DIR . '/options.php' );
require_once UPDRAFTPLUS_DIR . '/options.php';
}
}
}
@ -417,8 +424,9 @@ class MainWP_Child_Updraft_Plus_Backups {
$settings_key = null;
if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
if (isset($settings['is_general']) && !empty($settings['is_general'])){
@ -438,7 +446,7 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_googledrive' === $key ) {
} elseif ( 'updraft_googledrive' === $key ) {
// do not saving from dashboard
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' );
// if (!is_array($opts))
@ -454,7 +462,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
// }
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_googlecloud' === $key ) {
} elseif ( 'updraft_googlecloud' === $key ) {
// do not saving from dashboard
// $opts = UpdraftPlus_Options::get_updraft_option( $key );
// if (!is_array($opts))
@ -476,7 +484,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// $opts['bucket_location'] = $settings[ $key ]['bucket_location'];
// }
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_onedrive' === $key ) {
} elseif ( 'updraft_onedrive' === $key ) {
// do not saving from dashboard
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' );
// if (!is_array($opts))
@ -493,7 +501,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// }
//
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_email' === $key ) {
} elseif ( 'updraft_email' === $key ) {
$value = $settings[ $key ];
// free version
if ( ! is_array( $value ) ) {
@ -502,10 +510,11 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
UpdraftPlus_Options::update_updraft_option( $key, $value );
} else if ( 'updraft_s3' === $key ) {
} elseif ( 'updraft_s3' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
$opts['settings'][$settings_key]['accesskey'] = $settings[ $key ]['accesskey'];
@ -532,10 +541,11 @@ class MainWP_Child_Updraft_Plus_Backups {
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_s3generic' === $key ) {
} elseif ( 'updraft_s3generic' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_s3generic' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
$opts['settings'][$settings_key]['endpoint'] = $settings[ $key ]['endpoint'];
@ -550,10 +560,11 @@ class MainWP_Child_Updraft_Plus_Backups {
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_dreamobjects' === $key ) {
} elseif ( 'updraft_dreamobjects' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dreamobjects' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
$opts['settings'][$settings_key]['path'] = $this->replace_tokens($settings[ $key ]['path']);
@ -563,10 +574,11 @@ class MainWP_Child_Updraft_Plus_Backups {
$opts['endpoint'] = $settings[ $key ]['endpoint'];
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_ftp' === $key ) {
} elseif ( 'updraft_ftp' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_ftp' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
if ( isset( $settings[ $key ]['path'] ) ) {
@ -587,10 +599,11 @@ class MainWP_Child_Updraft_Plus_Backups {
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_sftp_settings' === $key ) {
} elseif ( 'updraft_sftp_settings' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_sftp' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
if ( isset( $settings[ $key ]['path'] ) ) {
@ -614,10 +627,11 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
UpdraftPlus_Options::update_updraft_option( 'updraft_sftp', $opts );
} else if ('updraft_webdav_settings' == $key) {
} elseif ('updraft_webdav_settings' == $key) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_webdav' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if(is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
@ -625,10 +639,11 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
}
} else if ( 'updraft_backblaze' === $key ) {
} elseif ( 'updraft_backblaze' === $key ) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
if (!is_array($opts))
if (!is_array($opts)) {
$opts = array();
}
if (is_array($opts) && isset($opts['settings'])) {
$settings_key = key($opts['settings']);
$opts['settings'][$settings_key]['account_id'] = $settings[ $key ]['account_id'];
@ -701,7 +716,8 @@ class MainWP_Child_Updraft_Plus_Backups {
function addons_connect() {
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) require_once(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php');
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) { require_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
}
if ( ! defined( 'UDADDONS2_SLUG' ) ) {
return array( 'error' => 'NO_PREMIUM' );
}
@ -801,7 +817,7 @@ class MainWP_Child_Updraft_Plus_Backups {
if ( ! class_exists( 'UpdraftPlus_WPDB_OtherDB_Test' ) ) {
if ( file_exists( UPDRAFTPLUS_DIR . '/addons/moredatabase.php' ) ) {
require_once( UPDRAFTPLUS_DIR . '/addons/moredatabase.php' );
require_once UPDRAFTPLUS_DIR . '/addons/moredatabase.php';
}
}
@ -1232,7 +1248,7 @@ class MainWP_Child_Updraft_Plus_Backups {
if (method_exists($updraftplus, 'get_backup_history')) {
$backups = $updraftplus->get_backup_history();
} else if (class_exists('UpdraftPlus_Backup_History')) {
} elseif (class_exists('UpdraftPlus_Backup_History')) {
$backups = UpdraftPlus_Backup_History::get_history();
}
$timestamp = $_POST['backup_timestamp'];
@ -1321,7 +1337,7 @@ class MainWP_Child_Updraft_Plus_Backups {
continue;
}
if ( file_exists( UPDRAFTPLUS_DIR . "/methods/$service.php" ) ) {
require_once( UPDRAFTPLUS_DIR . "/methods/$service.php" );
require_once UPDRAFTPLUS_DIR . "/methods/$service.php";
}
$objname = 'UpdraftPlus_BackupModule_' . $service;
$deleted = - 1;
@ -1457,7 +1473,7 @@ class MainWP_Child_Updraft_Plus_Backups {
// Retrieve the information from our backup history
if (method_exists($updraftplus, 'get_backup_history')) {
$backup_history = $updraftplus->get_backup_history();
} else if (class_exists('UpdraftPlus_Backup_History')) {
} elseif (class_exists('UpdraftPlus_Backup_History')) {
$backup_history = UpdraftPlus_Backup_History::get_history();
}
@ -1583,7 +1599,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$method_include = UPDRAFTPLUS_DIR . '/methods/' . $service . '.php';
if ( file_exists( $method_include ) ) {
require_once( $method_include );
require_once $method_include;
}
$objname = "UpdraftPlus_BackupModule_${service}";
@ -1617,7 +1633,7 @@ class MainWP_Child_Updraft_Plus_Backups {
if (method_exists($updraftplus, 'get_backup_history')) {
$backups = $updraftplus->get_backup_history();
} else if (class_exists('UpdraftPlus_Backup_History')) {
} elseif (class_exists('UpdraftPlus_Backup_History')) {
$backups = UpdraftPlus_Backup_History::get_history();
}
@ -1767,7 +1783,7 @@ class MainWP_Child_Updraft_Plus_Backups {
global $updraftplus_admin, $updraftplus;
if ( empty( $updraftplus_admin ) ) {
require_once( UPDRAFTPLUS_DIR . '/admin.php' );
require_once UPDRAFTPLUS_DIR . '/admin.php';
}
ob_start();
$backup_success = $this->restore_backup( $_REQUEST['backup_timestamp'] );
@ -1934,7 +1950,7 @@ class MainWP_Child_Updraft_Plus_Backups {
uksort( $backup_set, array( $this, 'sort_restoration_entities' ) );
// We use a single object for each entity, because we want to store information about the backup set
require_once( UPDRAFTPLUS_DIR . '/restorer.php' );
require_once UPDRAFTPLUS_DIR . '/restorer.php';
global $updraftplus_restorer;
$updraftplus_restorer = new Updraft_Restorer( new Updraft_Restorer_Skin(), $backup_set );
@ -2142,7 +2158,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$updraftplus_restorer->clear_cache();
if ( ! function_exists( 'validate_current_theme' ) ) {
require_once( ABSPATH . WPINC . '/themes' );
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
@ -2319,7 +2335,7 @@ class MainWP_Child_Updraft_Plus_Backups {
$info = array();
global $updraftplus, $wp_version;
include( ABSPATH . WPINC . '/version.php' );
include ABSPATH . WPINC . '/version.php';
$updraft_dir = $updraftplus->backups_dir_location();
@ -2329,7 +2345,7 @@ class MainWP_Child_Updraft_Plus_Backups {
if (method_exists($updraftplus, 'get_backup_history')) {
$backup = $updraftplus->get_backup_history($timestamp);
} else if (class_exists('UpdraftPlus_Backup_History')) {
} elseif (class_exists('UpdraftPlus_Backup_History')) {
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
}
@ -2563,12 +2579,14 @@ class MainWP_Child_Updraft_Plus_Backups {
$updraftplus->get_max_packet_size();
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
if (!isset($backup['nonce']) || !isset($backup['db'])) return array($mess, $warn, $err, $info);
if (!isset($backup['nonce']) || !isset($backup['db'])) { return array($mess, $warn, $err, $info);
}
$db_file = (is_string($backup['db'])) ? $updraft_dir . '/' . $backup['db'] : $updraft_dir . '/' . $backup['db'][0];
}
if (!is_readable($db_file)) return array($mess, $warn, $err, $info);
if (!is_readable($db_file)) { return array($mess, $warn, $err, $info);
}
// Encrypted - decrypt it
if (UpdraftPlus_Encryption::is_file_encrypted($db_file)) {
@ -2712,13 +2730,15 @@ class MainWP_Child_Updraft_Plus_Backups {
if (!$migration_warning && home_url() != $old_home) {
$migration_warning = true;
$powarn = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>', $old_home, $res);
if (!empty($powarn)) $warn[] = $powarn;
if (!empty($powarn)) { $warn[] = $powarn;
}
}
} elseif (!isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
$info['created_by_version'] = trim($matches[1]);
} elseif ('' == $old_wp_version && preg_match('/^\# WordPress Version: ([0-9]+(\.[0-9]+)+)(-[-a-z0-9]+,)?(.*)$/', $buffer, $matches)) {
$old_wp_version = $matches[1];
if (!empty($matches[3])) $old_wp_version .= substr($matches[3], 0, strlen($matches[3])-1);
if (!empty($matches[3])) { $old_wp_version .= substr($matches[3], 0, strlen($matches[3])-1);
}
if (version_compare($old_wp_version, $wp_version, '>')) {
// $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);
@ -2762,7 +2782,8 @@ class MainWP_Child_Updraft_Plus_Backups {
$val = $kvmatches[2];
if ('multisite' == $key) {
$info['multisite'] = $val ? true : false;
if ($val) $mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
if ($val) { $mess[] = '<strong>' . __('Site information:', 'updraftplus') . '</strong> ' . 'backup is of a WordPress Network';
}
}
$old_siteinfo[$key] = $val;
}
@ -2859,7 +2880,8 @@ class MainWP_Child_Updraft_Plus_Backups {
}
}
$charset_select_html .= '</select>';
if (empty($info['addui'])) $info['addui'] = '';
if (empty($info['addui'])) { $info['addui'] = '';
}
$info['addui'] .= $charset_select_html;
}
}
@ -2944,7 +2966,8 @@ class MainWP_Child_Updraft_Plus_Backups {
CREATE TABLE $wpdb->sitemeta (
CREATE TABLE $wpdb->signups (
*/
if (!isset($skipped_tables)) $skipped_tables = array();
if (!isset($skipped_tables)) { $skipped_tables = array();
}
$missing_tables = array();
if ($old_table_prefix) {
if (!$header_only) {
@ -3133,8 +3156,10 @@ class MainWP_Child_Updraft_Plus_Backups {
$date_label = $this->date_label( $pretty_date, $key, $backup, $jobdata, $non );
$service_title = '';
if (!isset($backup['service'])) $backup['service'] = array();
if (!is_array($backup['service'])) $backup['service'] = array($backup['service']);
if (!isset($backup['service'])) { $backup['service'] = array();
}
if (!is_array($backup['service'])) { $backup['service'] = array($backup['service']);
}
foreach ($backup['service'] as $service) {
if ('none' === $service || '' === $service || (is_array($service) && (empty($service) || array('none') === $service || array('') === $service))) {
// Do nothing
@ -3164,9 +3189,11 @@ ENDHERE;
// Set a flag according to whether or not $backup['db'] ends in .crypt, then pick this up in the display of the decrypt field.
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
if ( class_exists( 'UpdraftPlus_Encryption')) {
if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted'))
if (UpdraftPlus_Encryption::is_file_encrypted($db)) $entities .= '/dbcrypted=1/';
} else if ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) {
if ( method_exists('UpdraftPlus_Encryption', 'is_file_encrypted')) {
if (UpdraftPlus_Encryption::is_file_encrypted($db)) { $entities .= '/dbcrypted=1/';
}
}
} elseif ( method_exists($updraftplus, 'is_db_encrypted') && $updraftplus->is_db_encrypted( $db ) ) {
$entities .= '/dbcrypted=1/';
}
@ -3378,8 +3405,9 @@ ENDHERE;
}
$fix_perfomance++;
if ($fix_perfomance > 50) // // to fix perfomance issue of response when too much backup files
if ($fix_perfomance > 50) { // // to fix perfomance issue of response when too much backup files
break;
}
}
}
}
@ -3433,7 +3461,7 @@ ENDHERE;
$messages = null;
if ( method_exists( $updraftplus, 'rebuild_backup_history' ) ) {
$messages = $updraftplus->rebuild_backup_history( $remotescan );
} else if ( method_exists( $updraftplus_admin, 'rebuild_backup_history' ) ) {
} elseif ( method_exists( $updraftplus_admin, 'rebuild_backup_history' ) ) {
$messages = $updraftplus_admin->rebuild_backup_history( $remotescan );
}
@ -3977,8 +4005,9 @@ ENDHERE;
}
public function updraftplus_init() {
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
if ( get_option( 'mainwp_updraftplus_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );

View file

@ -129,8 +129,8 @@ class MainWP_Child_Vulnerability_Checker {
function check_themes( $force = false) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
require_once ABSPATH . 'wp-admin/includes/misc.php';
require_once ABSPATH . 'wp-admin/includes/theme.php';
if ( current_user_can( 'switch_themes' ) ) {
$themes = wp_prepare_themes_for_js();
@ -156,8 +156,9 @@ class MainWP_Child_Vulnerability_Checker {
$th_vulner_data = array();
foreach($th_data['vulnerabilities'] as $vuln_data) {
if (empty($vuln_data))
if (empty($vuln_data)) {
continue;
}
if ( isset($vuln_data['fixed_in']) && version_compare( $th['version'], $vuln_data['fixed_in'] ) >= 0 ) {
continue;

View file

@ -64,7 +64,7 @@ class MainWP_Child_WooCommerce_Status {
global $wpdb;
$file = WP_PLUGIN_DIR . '/woocommerce/includes/admin/reports/class-wc-admin-report.php';
if ( file_exists( $file ) ) {
include_once( $file );
include_once $file;
} else {
return false;
}
@ -81,10 +81,10 @@ 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
AND posts.post_date <= %s
@ -103,10 +103,10 @@ 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'
AND posts.post_date >= %s
@ -180,7 +180,7 @@ class MainWP_Child_WooCommerce_Status {
global $wpdb;
$file = WP_PLUGIN_DIR . '/woocommerce/includes/admin/reports/class-wc-admin-report.php';
if ( file_exists( $file ) ) {
include_once( $file );
include_once $file;
} else {
return false;
}
@ -202,10 +202,10 @@ 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')
AND posts.post_date <= STR_TO_DATE(" . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s')
@ -224,10 +224,10 @@ 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'
AND posts.post_date >= STR_TO_DATE(" . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s')
@ -326,7 +326,7 @@ class MainWP_Child_WooCommerce_Status {
global $wpdb;
$file = WP_PLUGIN_DIR . '/woocommerce/includes/admin/reports/class-wc-admin-report.php';
if ( file_exists( $file ) ) {
include_once( $file );
include_once $file;
} else {
return false;
}
@ -341,10 +341,10 @@ class MainWP_Child_WooCommerce_Status {
$query['join'] = "INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id ";
$query['where'] = "WHERE posts.post_type IN ( '" . implode( "','", wc_get_order_types( 'reports' ) ) . "' ) ";
$query['where'] .= "AND posts.post_status IN ( 'wc-" . implode( "','wc-", apply_filters( 'woocommerce_reports_order_statuses', array(
'completed',
'processing',
'on-hold',
) ) ) . "' ) ";
'completed',
'processing',
'on-hold',
) ) ) . "' ) ";
$query['where'] .= "AND postmeta.meta_key = '_order_total' ";
$query['where'] .= 'AND posts.post_date >= STR_TO_DATE(' . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
$query['where'] .= 'AND posts.post_date <= STR_TO_DATE(' . $wpdb->prepare('%s', $end_date) . ", '%Y-%m-%d %H:%i:%s') ";
@ -360,10 +360,10 @@ class MainWP_Child_WooCommerce_Status {
$query['join'] .= "INNER JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id ";
$query['where'] = "WHERE posts.post_type IN ( '" . implode( "','", wc_get_order_types( 'order-count' ) ) . "' ) ";
$query['where'] .= "AND posts.post_status IN ( 'wc-" . implode( "','wc-", apply_filters( 'woocommerce_reports_order_statuses', array(
'completed',
'processing',
'on-hold',
) ) ) . "' ) ";
'completed',
'processing',
'on-hold',
) ) ) . "' ) ";
$query['where'] .= "AND order_item_meta.meta_key = '_qty' ";
$query['where'] .= "AND order_item_meta_2.meta_key = '_product_id' ";
$query['where'] .= 'AND posts.post_date >= STR_TO_DATE(' . $wpdb->prepare('%s', $start_date) . ", '%Y-%m-%d %H:%i:%s') ";
@ -441,7 +441,7 @@ class MainWP_Child_WooCommerce_Status {
}
private static function update_wc_db() {
include_once( WC()->plugin_path() . '/includes/class-wc-background-updater.php' );
include_once WC()->plugin_path() . '/includes/class-wc-background-updater.php';
$background_updater = new WC_Background_Updater();
$current_db_version = get_option( 'woocommerce_db_version' );

View file

@ -195,11 +195,11 @@ class MainWP_Child_Wordfence {
public function __construct() {
add_action( 'mainwp_child_deactivation', array( $this, 'deactivation' ) );
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
// ok
if ( is_plugin_active( 'wordfence/wordfence.php' ) && file_exists( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' ) ) {
require_once( plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php' );
require_once plugin_dir_path( __FILE__ ) . '../../wordfence/wordfence.php';
$this->is_wordfence_installed = true;
}
@ -619,8 +619,9 @@ class MainWP_Child_Wordfence {
private function start_scan() {
$information = wordfence::ajax_scan_callback();
if ( is_array($information) && isset($information['ok']) )
if ( is_array($information) && isset($information['ok']) ) {
$information['result'] = 'SUCCESS';
}
return $information;
}
@ -653,7 +654,8 @@ class MainWP_Child_Wordfence {
public function wordfence_init() {
if ( ! $this->is_wordfence_installed ) return;
if ( ! $this->is_wordfence_installed ) { return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
if ( get_option( 'mainwp_wordfence_hide_plugin' ) === 'hide' ) {
@ -669,8 +671,10 @@ class MainWP_Child_Wordfence {
}
// ok
public function do_reports_log( $ext = '') {
if ( $ext !== 'wordfence' ) return;
if ( ! $this->is_wordfence_installed ) return;
if ( $ext !== 'wordfence' ) { return;
}
if ( ! $this->is_wordfence_installed ) { return;
}
global $wpdb;
@ -868,9 +872,9 @@ SQL
$i = new wfIssues();
if ( 'deleteIgnored' === $op ) {
$i->deleteIgnored();
} else if ( 'deleteNew' === $op ) {
} elseif ( 'deleteNew' === $op ) {
$i->deleteNew();
} else if ( 'ignoreAllNew' === $op ) {
} elseif ( 'ignoreAllNew' === $op ) {
$i->ignoreAllNew();
} else {
return array( 'errorMsg' => 'An invalid operation was called.' );
@ -893,7 +897,7 @@ SQL
return array(
'ok' => 1,
'issueCounts' => $counts,
);
);
}
function update_issues_status() {
@ -944,13 +948,13 @@ SQL
$err = error_get_last();
$errors[] = 'Could not delete file ' . htmlentities( $file ) . '. Error was: ' . htmlentities( $err['message'] );
}
} else if ( 'repair' === $op ) {
} elseif ( 'repair' === $op ) {
$dat = $issue['data'];
$result = wordfence::getWPFileContent( $dat['file'], $dat['cType'], $dat['cName'], $dat['cVersion'] );
if ( $result['cerrorMsg'] ) {
$errors[] = $result['cerrorMsg'];
continue;
} else if ( ! $result['fileContent'] ) {
} elseif ( ! $result['fileContent'] ) {
$errors[] = 'We could not get the original file of ' . htmlentities( $file ) . ' to do a repair.';
continue;
}
@ -989,10 +993,10 @@ SQL
if ( $filesWorkedOn > 0 && count( $errors ) > 0 ) {
$headMsg = "$verb some files with errors";
$bodyMsg = "$verb $filesWorkedOn files but we encountered the following errors with other files: " . implode( '<br />', $errors );
} else if ( $filesWorkedOn > 0 ) {
} elseif ( $filesWorkedOn > 0 ) {
$headMsg = "$verb $filesWorkedOn files successfully";
$bodyMsg = "$verb $filesWorkedOn files successfully. No errors were encountered.";
} else if ( count( $errors ) > 0 ) {
} elseif ( count( $errors ) > 0 ) {
$headMsg = "Could not $verb2 files";
$bodyMsg = "We could not $verb2 any of the files you selected. We encountered the following errors: " . implode( '<br />', $errors );
} else {
@ -1053,7 +1057,7 @@ SQL
$file = $dat['file'];
if ( isset( $result['cerrorMsg'] ) && $result['cerrorMsg'] ) {
return $result;
} else if ( ! $result['fileContent'] ) {
} elseif ( ! $result['fileContent'] ) {
return array( 'cerrorMsg' => 'We could not get the original file to do a repair.' );
}
@ -1112,9 +1116,9 @@ SQL
}
function save_settings_new() {
if (isset($_POST['encrypted']))
if (isset($_POST['encrypted'])) {
$settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
else {
} else {
$settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
}
@ -1224,7 +1228,7 @@ SQL
if (in_array('autoUpdate', $saving_opts)) {
if ( '1' === $opts['autoUpdate'] ) {
wfConfig::enableAutoUpdate();
} else if ( '0' === $opts['autoUpdate'] ) {
} elseif ( '0' === $opts['autoUpdate'] ) {
wfConfig::disableAutoUpdate();
}
}
@ -1306,7 +1310,7 @@ SQL
return $result;
}
} else if ( !empty( $apiKey ) && $existingAPIKey != $apiKey ) {
} elseif ( !empty( $apiKey ) && $existingAPIKey != $apiKey ) {
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
try {
$res = $api->call('check_api_key', array(), array('previousLicense' => $existingAPIKey));
@ -1411,9 +1415,9 @@ SQL
}
function save_setting() {
if (isset($_POST['encrypted']))
if (isset($_POST['encrypted'])) {
$settings = $this->simple_crypt( 'thisisakey', $_POST['settings'], 'decrypt' ); // to fix pass through sec rules of Dreamhost
else {
} else {
$settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
}
@ -1470,7 +1474,7 @@ SQL
if ( '1' === $opts['autoUpdate'] ) {
wfConfig::enableAutoUpdate();
} else if ( '0' === $opts['autoUpdate'] ) {
} elseif ( '0' === $opts['autoUpdate'] ) {
wfConfig::disableAutoUpdate();
}
@ -1528,7 +1532,7 @@ SQL
return $result;
}
} else if ( wfConfig::get( 'apiKey' ) !== $apiKey ) {
} elseif ( wfConfig::get( 'apiKey' ) !== $apiKey ) {
$api = new wfAPI( $apiKey, wfUtils::getWPVersion() );
try {
$res = $api->call( 'check_api_key', array(), array() );
@ -1592,7 +1596,7 @@ SQL
'token' => $res['token'],
);
}
else if ($res['err']) {
elseif ($res['err']) {
return array('errorExport' => __('An error occurred: ', 'wordfence') . $res['err']);
}
else {
@ -1658,7 +1662,7 @@ SQL
'settings' => $this->get_settings(),
);
}
else if ($res['err']) {
elseif ($res['err']) {
return array('errorImport' => 'An error occurred: ' . $res['err']);
}
else {
@ -1704,10 +1708,10 @@ SQL
$listType = 'logins';
}
$events = wordfence::getLog()->getHits( $listType, $type, $newestEventTime );
} else if ( 'perfStats' === $alsoGet ) {
} elseif ( 'perfStats' === $alsoGet ) {
$newestEventTime = $_POST['otherParams'];
$events = wordfence::getLog()->getPerfStats( $newestEventTime );
} else if ($alsoGet == 'liveTraffic') {
} elseif ($alsoGet == 'liveTraffic') {
if (get_site_option('wordfence_syncAttackDataAttempts') > 10) {
wordfence::syncAttackData(false);
}
@ -1832,8 +1836,9 @@ SQL
// credit of Wordfence
private static function _getWAFData( $updated = null) {
// custom
if(!class_exists('wfWAF'))
if(!class_exists('wfWAF')) {
return false;
}
// end if custom
$data['learningMode'] = wfWAF::getInstance()->isInLearningMode();
@ -1924,7 +1929,7 @@ SQL
'error' => sprintf(__('An error occurred while saving the configuration: %s', 'wordfence'), $errors[0]['error']),
);
}
else if (count($errors) > 1) {
elseif (count($errors) > 1) {
$compoundMessage = array();
foreach ($errors as $e) {
$compoundMessage[] = $e['error'];
@ -2017,11 +2022,11 @@ SQL
$wfLog = wordfence::getLog();
if ( 'topScanners' === $mode || 'topLeechers' === $mode ) {
$results = $wfLog->getLeechers( $mode );
} else if ( 'blockedIPs' === $mode ) {
} elseif ( 'blockedIPs' === $mode ) {
$results = $wfLog->getBlockedIPs();
} else if ( 'lockedOutIPs' === $mode ) {
} elseif ( 'lockedOutIPs' === $mode ) {
$results = $wfLog->getLockedOutIPs();
} else if ( 'throttledIPs' === $mode ) {
} elseif ( 'throttledIPs' === $mode ) {
$results = $wfLog->getThrottledIPs();
}
@ -2057,9 +2062,10 @@ SQL
$noEditHtaccess = '1';
if (isset($_POST['needToCheckFalconHtaccess']) && !empty($_POST['needToCheckFalconHtaccess'])) {
$checkHtaccess = self::checkFalconHtaccess();
if (isset($checkHtaccess['ok']))
if (isset($checkHtaccess['ok'])) {
$noEditHtaccess = '0';
} else if (isset($_POST['noEditHtaccess'])) {
}
} elseif (isset($_POST['noEditHtaccess'])) {
$noEditHtaccess = $_POST['noEditHtaccess'];
}
@ -2071,13 +2077,13 @@ SQL
if(is_plugin_active($pluginFile)){
if($pluginFile == 'w3-total-cache/w3-total-cache.php'){
$badPlugins[] = 'W3 Total Cache';
} else if($pluginFile == 'quick-cache/quick-cache.php'){
} elseif($pluginFile == 'quick-cache/quick-cache.php'){
$badPlugins[] = 'Quick Cache';
} else if($pluginFile == 'wp-super-cache/wp-cache.php'){
} elseif($pluginFile == 'wp-super-cache/wp-cache.php'){
$badPlugins[] = 'WP Super Cache';
} else if($pluginFile == 'wp-fast-cache/wp-fast-cache.php'){
} elseif($pluginFile == 'wp-fast-cache/wp-fast-cache.php'){
$badPlugins[] = 'WP Fast Cache';
} else if($pluginFile == 'wp-fastest-cache/wpFastestCache.php'){
} elseif($pluginFile == 'wp-fastest-cache/wpFastestCache.php'){
$badPlugins[] = 'WP Fastest Cache';
}
}
@ -2121,10 +2127,10 @@ SQL
if($cacheType == 'disable'){
wfConfig::set('cacheType', false);
return array('ok' => 1, 'heading' => 'Caching successfully disabled.', 'body' => "{$htMsg}Caching has been disabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>");
} else if($cacheType == 'php'){
} elseif($cacheType == 'php'){
wfConfig::set('cacheType', 'php');
return array('ok' => 1, 'heading' => 'Wordfence Basic Caching Enabled', 'body' => "{$htMsg}Wordfence basic caching has been enabled on your system.<br /><br /><center><input type='button' name='wfReload' value='Click here now to refresh this page' onclick='window.location.reload(true);' /></center>");
} else if($cacheType == 'falcon'){
} elseif($cacheType == 'falcon'){
if($noEditHtaccess != '1'){
$err = wfCache::addHtaccessCode('add');
if($err){
@ -2376,11 +2382,11 @@ SQL
colspan="<?php echo $cols - 1; ?>">
<?php
echo wp_kses($result['label'], array(
'code' => array(),
'strong' => array(),
'em' => array(),
'a' => array('href' => true),
))
'code' => array(),
'strong' => array(),
'em' => array(),
'a' => array('href' => true),
))
?>
</td>
<td>
@ -2420,11 +2426,11 @@ SQL
colspan="<?php echo $cols - 1; ?>">
<?php
echo wp_kses($result['label'], array(
'code' => array(),
'strong' => array(),
'em' => array(),
'a' => array('href' => true),
))
'code' => array(),
'strong' => array(),
'em' => array(),
'a' => array('href' => true),
))
?>
</div>
<?php if ($result['test']): ?>
@ -2445,11 +2451,11 @@ SQL
list($currentIP, $currentServerVarForIP) = wfUtils::getIPAndServerVariable();
$howGetHasErrors = false;
foreach (array(
'REMOTE_ADDR' => 'REMOTE_ADDR',
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
'HTTP_X_REAL_IP' => 'X-Real-IP',
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
) as $variable => $label) {
'REMOTE_ADDR' => 'REMOTE_ADDR',
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
'HTTP_X_REAL_IP' => 'X-Real-IP',
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
) as $variable => $label) {
if (!($currentServerVarForIP && $currentServerVarForIP === $variable) && $howGet === $variable) {
$howGetHasErrors = true;
break;
@ -2483,11 +2489,11 @@ SQL
$howGet = wfConfig::get('howGetIPs', false);
list($currentIP, $currentServerVarForIP) = wfUtils::getIPAndServerVariable();
foreach (array(
'REMOTE_ADDR' => 'REMOTE_ADDR',
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
'HTTP_X_REAL_IP' => 'X-Real-IP',
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
) as $variable => $label):
'REMOTE_ADDR' => 'REMOTE_ADDR',
'HTTP_CF_CONNECTING_IP' => 'CF-Connecting-IP',
'HTTP_X_REAL_IP' => 'X-Real-IP',
'HTTP_X_FORWARDED_FOR' => 'X-Forwarded-For',
) as $variable => $label):
?>
<tr>
<td><?php echo $label; ?></td>
@ -2558,7 +2564,7 @@ SQL
<table class="wf-striped-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>>
<tbody>
<?php
require(ABSPATH . 'wp-includes/version.php');
require ABSPATH . 'wp-includes/version.php';
$postRevisions = (defined('WP_POST_REVISIONS') ? WP_POST_REVISIONS : true);
$wordPressValues = array(
'WordPress Version' => array('description' => '', 'value' => $wp_version),

View file

@ -56,82 +56,82 @@ class MainWP_Child_WP_Rocket {
function get_rocket_default_options() {
return array(
'cache_mobile' => 1,
'do_caching_mobile_files' => 0,
'cache_logged_user' => 0,
'cache_ssl' => 0,
'emoji' => 0,
'embeds' => 1,
'control_heartbeat' => 0,
'heartbeat_site_behavior' => 'reduce_periodicity',
'heartbeat_admin_behavior' => 'reduce_periodicity',
'heartbeat_editor_behavior' => 'reduce_periodicity',
'varnish_auto_purge' => 0,
'manual_preload' => 0,
'automatic_preload' => 0,
'sitemap_preload' => 0,
'sitemap_preload_url_crawl' => 500000,
'sitemaps' => array(),
'database_revisions' => 0,
'database_auto_drafts' => 0,
'database_trashed_posts' => 0,
'database_spam_comments' => 0,
'database_trashed_comments' => 0,
'database_expired_transients' => 0,
'database_all_transients' => 0,
'database_optimize_tables' => 0,
'schedule_automatic_cleanup' => 0,
'automatic_cleanup_frequency' => '',
'cache_reject_uri' => array(),
'cache_reject_cookies' => array(),
'cache_reject_ua' => array(),
'cache_query_strings' => array(),
'cache_purge_pages' => array(),
'purge_cron_interval' => 10,
'purge_cron_unit' => 'HOUR_IN_SECONDS',
'exclude_css' => array(),
'exclude_js' => array(),
'exclude_inline_js' => array(),
'async_css' => 0,
'defer_all_js' => 0,
'defer_all_js_safe' => 1,
'critical_css' => '',
'deferred_js_files' => array(),
'lazyload' => 0,
'lazyload_iframes' => 0,
'lazyload_youtube' =>0,
'minify_css' => 0,
// 'minify_css_key' => $minify_css_key,
'minify_concatenate_css' => 0,
//'minify_css_combine_all' => 0,
'minify_css_legacy' => 0,
'minify_js' => 0,
// '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_google_fonts' => 0,
'minify_html' => 0,
'remove_query_strings' => 0,
'dns_prefetch' => 0,
'cdn' => 0,
'cdn_cnames' => array(),
'cdn_zone' => array(),
//'cdn_ssl' => 0,
'cdn_reject_files' => array(),
'do_cloudflare' => 0,
'cloudflare_email' => '',
'cloudflare_api_key' => '',
'cloudflare_domain' => '',
//'cloudflare_zone_id' => '',
'cloudflare_devmode' => 0,
'cloudflare_protocol_rewrite' => 0,
'cloudflare_auto_settings' => 0,
'cloudflare_old_settings' => 0,
'do_beta' => 0,
'analytics_enabled' => 1,
);
'cache_mobile' => 1,
'do_caching_mobile_files' => 0,
'cache_logged_user' => 0,
'cache_ssl' => 0,
'emoji' => 0,
'embeds' => 1,
'control_heartbeat' => 0,
'heartbeat_site_behavior' => 'reduce_periodicity',
'heartbeat_admin_behavior' => 'reduce_periodicity',
'heartbeat_editor_behavior' => 'reduce_periodicity',
'varnish_auto_purge' => 0,
'manual_preload' => 0,
'automatic_preload' => 0,
'sitemap_preload' => 0,
'sitemap_preload_url_crawl' => 500000,
'sitemaps' => array(),
'database_revisions' => 0,
'database_auto_drafts' => 0,
'database_trashed_posts' => 0,
'database_spam_comments' => 0,
'database_trashed_comments' => 0,
'database_expired_transients' => 0,
'database_all_transients' => 0,
'database_optimize_tables' => 0,
'schedule_automatic_cleanup' => 0,
'automatic_cleanup_frequency' => '',
'cache_reject_uri' => array(),
'cache_reject_cookies' => array(),
'cache_reject_ua' => array(),
'cache_query_strings' => array(),
'cache_purge_pages' => array(),
'purge_cron_interval' => 10,
'purge_cron_unit' => 'HOUR_IN_SECONDS',
'exclude_css' => array(),
'exclude_js' => array(),
'exclude_inline_js' => array(),
'async_css' => 0,
'defer_all_js' => 0,
'defer_all_js_safe' => 1,
'critical_css' => '',
'deferred_js_files' => array(),
'lazyload' => 0,
'lazyload_iframes' => 0,
'lazyload_youtube' =>0,
'minify_css' => 0,
// 'minify_css_key' => $minify_css_key,
'minify_concatenate_css' => 0,
//'minify_css_combine_all' => 0,
'minify_css_legacy' => 0,
'minify_js' => 0,
// '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_google_fonts' => 0,
'minify_html' => 0,
'remove_query_strings' => 0,
'dns_prefetch' => 0,
'cdn' => 0,
'cdn_cnames' => array(),
'cdn_zone' => array(),
//'cdn_ssl' => 0,
'cdn_reject_files' => array(),
'do_cloudflare' => 0,
'cloudflare_email' => '',
'cloudflare_api_key' => '',
'cloudflare_domain' => '',
//'cloudflare_zone_id' => '',
'cloudflare_devmode' => 0,
'cloudflare_protocol_rewrite' => 0,
'cloudflare_auto_settings' => 0,
'cloudflare_old_settings' => 0,
'do_beta' => 0,
'analytics_enabled' => 1,
);
}
// ok
@ -340,7 +340,7 @@ class MainWP_Child_WP_Rocket {
}
// to fix
include_once( ABSPATH . '/wp-admin/includes/template.php' );
include_once ABSPATH . '/wp-admin/includes/template.php';
// Generate a new random key for minify cache file
$options = get_option( WP_ROCKET_SLUG );
@ -379,7 +379,7 @@ class MainWP_Child_WP_Rocket {
'WP_Rocket\Optimization\CSS\Critical_CSS_Generation',
'WP_Rocket\Admin\Options',
'WP_Rocket\Admin\Options_Data',
));
));
$critical_css = new WP_Rocket\Optimization\CSS\Critical_CSS( new WP_Rocket\Optimization\CSS\Critical_CSS_Generation() );
$options_api = new WP_Rocket\Admin\Options( 'wp_rocket_' );
@ -425,7 +425,7 @@ class MainWP_Child_WP_Rocket {
'WP_Rocket\Admin\Database\Optimization_Process',
'WP_Rocket\Admin\Options',
'WP_Rocket\Admin\Options_Data',
));
));
$process = new WP_Rocket\Admin\Database\Optimization_Process();
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );
@ -448,7 +448,7 @@ class MainWP_Child_WP_Rocket {
MainWP_Helper::check_classes_exists( array( 'WP_Rocket\Admin\Database\Optimization',
'WP_Rocket\Admin\Database\Optimization_Process',
));
));
$process = new WP_Rocket\Admin\Database\Optimization_Process();
$optimization = new WP_Rocket\Admin\Database\Optimization( $process );

View file

@ -15,14 +15,15 @@ class MainWP_Child_WPvivid_BackupRestore {
}
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'wpvivid-backuprestore/wpvivid-backuprestore.php' ) && defined('WPVIVID_PLUGIN_DIR'))
{
$this->is_plugin_installed = true;
}
if (!$this->is_plugin_installed)
if (!$this->is_plugin_installed) {
return;
}
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
$this->public_intetface = new WPvivid_Public_Interface();

File diff suppressed because it is too large Load diff

View file

@ -12,16 +12,16 @@ class MainWP_Clone_Install {
* @param string $file The zip backup file path
*/
public function __construct( $file ) {
require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php' );
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
$this->file = $file;
if ( '.zip' === substr( $this->file, - 4 ) ) {
$this->archiver = null;
} else if ( '.tar.gz' === substr( $this->file, - 7 ) ) {
} elseif ( '.tar.gz' === substr( $this->file, - 7 ) ) {
$this->archiver = new Tar_Archiver( null, 'tar.gz' );
} else if ( '.tar.bz2' === substr( $this->file, - 8 ) ) {
} elseif ( '.tar.bz2' === substr( $this->file, - 8 ) ) {
$this->archiver = new Tar_Archiver( null, 'tar.bz2' );
} else if ( '.tar' === substr( $this->file, - 4 ) ) {
} elseif ( '.tar' === substr( $this->file, - 4 ) ) {
$this->archiver = new Tar_Archiver( null, 'tar' );
}
}
@ -58,9 +58,9 @@ class MainWP_Clone_Install {
if ( null !== $this->archiver ) {
} else if ( $this->checkZipConsole() ) {
} elseif ( $this->checkZipConsole() ) {
//todo: implement
} else if ( $this->checkZipSupport() ) {
} elseif ( $this->checkZipSupport() ) {
$zip = new ZipArchive();
$zipRes = $zip->open( $this->file );
if ( $zipRes ) {
@ -114,9 +114,9 @@ class MainWP_Clone_Install {
}
return $this->archiver->file_exists( $file );
} else if ( $this->checkZipConsole() ) {
} elseif ( $this->checkZipConsole() ) {
//todo: implement
} else if ( $this->checkZipSupport() ) {
} elseif ( $this->checkZipSupport() ) {
$zip = new ZipArchive();
$zipRes = $zip->open( $this->file );
if ( $zipRes ) {
@ -374,7 +374,7 @@ class MainWP_Clone_Install {
} else {
if ( $this->checkZipConsole() ) {
//todo: implement
} else if ( $this->checkZipSupport() ) {
} elseif ( $this->checkZipSupport() ) {
$zip = new ZipArchive();
$zipRes = $zip->open( $this->file );
if ( $zipRes ) {
@ -419,13 +419,13 @@ class MainWP_Clone_Install {
}
return $this->archiver->extractTo( ABSPATH );
} else if ( ( filesize( $this->file ) >= 50000000 ) && $this->checkWPZip() ) {
} elseif ( ( filesize( $this->file ) >= 50000000 ) && $this->checkWPZip() ) {
return $this->extractWPZipBackup();
} else if ( $this->checkZipConsole() ) {
} elseif ( $this->checkZipConsole() ) {
return $this->extractZipConsoleBackup();
} else if ( $this->checkZipSupport() ) {
} elseif ( $this->checkZipSupport() ) {
return $this->extractZipBackup();
} else if ( ( filesize( $this->file ) < 50000000 ) && $this->checkWPZip() ) {
} elseif ( ( filesize( $this->file ) < 50000000 ) && $this->checkWPZip() ) {
return $this->extractWPZipBackup();
} else {
return $this->extractZipPclBackup();

View file

@ -18,7 +18,7 @@ class MainWP_Clone {
}
if ( ! function_exists( 'wp_create_nonce' ) ) {
include_once( ABSPATH . WPINC . '/pluggable.php' );
include_once ABSPATH . WPINC . '/pluggable.php';
}
$this->security_nonces[ $action ] = wp_create_nonce( $action );
}
@ -112,7 +112,7 @@ class MainWP_Clone {
if ( isset( $_REQUEST['upload'] ) && wp_verify_nonce( $_POST['_nonce'], 'cloneRestore' ) ) {
if ( isset( $_FILES['file'] ) ) {
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$uploadedfile = $_FILES['file'];
$upload_overrides = array( 'test_form' => false );
@ -254,7 +254,7 @@ class MainWP_Clone {
if ( isset( $_REQUEST['upload'] ) && wp_verify_nonce( $_POST['_nonce'], 'cloneRestore' ) ) {
if ( isset( $_FILES['file'] ) ) {
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$uploadedfile = $_FILES['file'];
$upload_overrides = array( 'test_form' => false );
@ -1414,7 +1414,7 @@ class MainWP_Clone {
throw new Exception( __( 'No download file found', 'mainwp-child' ) );
}
$file = $archiveFile;
} else if ( file_exists( $file ) ) {
} elseif ( file_exists( $file ) ) {
$testFull = true;
} else {
$file = ABSPATH . $file;

View file

@ -114,7 +114,7 @@ class MainWP_Custom_Post_Type {
$serverHref = 'href="' . $serverHost;
$replaceServerHref = 'href="' . parse_url( $localUrl, PHP_URL_SCHEME ) . '://' . parse_url( $localUrl, PHP_URL_HOST );
$post_content = str_replace( $serverHref, $replaceServerHref, $post_content );
} else if ( strpos( $hrefLink, 'http' ) !== false ) {
} elseif ( strpos( $hrefLink, 'http' ) !== false ) {
$lnkToReplace = dirname( $hrefLink );
if ( 'http:' !== $lnkToReplace && 'https:' !== $lnkToReplace ) {
$post_content = str_replace( $lnkToReplace, $linkToReplaceWith, $post_content );
@ -286,7 +286,7 @@ class MainWP_Custom_Post_Type {
// MainWP Categories
if ( ! empty( $data['categories'] ) && is_array( $data['categories'] ) ) {
// Contains wp_create_categories
include_once( ABSPATH . 'wp-admin/includes/taxonomy.php' );
include_once ABSPATH . 'wp-admin/includes/taxonomy.php';
$categories = $data['categories'];
if ( $data['post_only_existing'] == '0' ) {
$post_category = wp_create_categories( $categories, $post_id );

View file

@ -21,7 +21,7 @@ class MainWP_Debug {
$_POST['excludenonwp'] = '1';
$_POST['ext'] = 'tar.gz';
print_r( $mainwpChild->backup( false ) );
} else if ( 'test' == $_GET['mainwpdebug'] ) {
} elseif ( 'test' == $_GET['mainwpdebug'] ) {
print_r( get_included_files() );
} else {
print_r( $mainwpChild->getSiteStats( array(), false ) );

View file

@ -58,8 +58,9 @@ class MainWP_Helper {
static function error( $error, $code = null ) {
$information['error'] = $error;
if (null !== $code)
if (null !== $code) {
$information['error_code'] = $code;
}
self::write( $information );
}
@ -110,7 +111,8 @@ class MainWP_Helper {
$selector = trim($val[$i], " \r\n\t");
if(!empty($selector)){
if(!isset($new[$selector])) $new[$selector] = array();
if(!isset($new[$selector])) { $new[$selector] = array();
}
$rules = explode(';', $val[++$i]);
foreach($rules as $rule){
$rule = trim($rule, " \r\n\t");
@ -119,8 +121,9 @@ class MainWP_Helper {
$property = trim(array_pop($rule), " \r\n\t");
$value = implode(':', array_reverse($rule));
if(!isset($new[$selector][$property]) || !preg_match('/!important/', $new[$selector][$property])) $new[$selector][$property] = $value;
elseif(preg_match('/!important/', $new[$selector][$property]) && preg_match('/!important/', $value)) $new[$selector][$property] = $value;
if(!isset($new[$selector][$property]) || !preg_match('/!important/', $new[$selector][$property])) { $new[$selector][$property] = $value;
} elseif(preg_match('/!important/', $new[$selector][$property]) && preg_match('/!important/', $value)) { $new[$selector][$property] = $value;
}
}
}
}
@ -135,7 +138,8 @@ class MainWP_Helper {
$output .= $media . " {\n";
$prefix = "\t";
}
else $prefix = '';
else { $prefix = '';
}
foreach($content as $selector => $rules){
$output .= $prefix . $selector . " {\n";
@ -155,9 +159,10 @@ class MainWP_Helper {
// $check_file_existed: to support checking if file existed
// $parent_id: optional
static function uploadImage( $img_url, $img_data = array(), $check_file_existed = false, $parent_id = 0 ) {
if ( !is_array($img_data) )
if ( !is_array($img_data) ) {
$img_data = array();
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
$temporary_file = download_url( $img_url );
@ -233,11 +238,12 @@ class MainWP_Helper {
}
$attach_id = wp_insert_attachment( $attachment, $local_img_path ); //Insert the image in the database
require_once( ABSPATH . 'wp-admin/includes/image.php' );
require_once ABSPATH . 'wp-admin/includes/image.php';
$attach_data = wp_generate_attachment_metadata( $attach_id, $local_img_path );
wp_update_attachment_metadata( $attach_id, $attach_data ); //Update generated metadata
if ( isset( $img_data['alt'] ) && !empty( $img_data['alt'] ) )
if ( isset( $img_data['alt'] ) && !empty( $img_data['alt'] ) ) {
update_post_meta( $attach_id, '_wp_attachment_image_alt', $img_data['alt'] );
}
return array( 'id' => $attach_id, 'url' => $local_img_url );
}
}
@ -364,7 +370,7 @@ class MainWP_Helper {
if ( $is_robot_post ) { // retirement soon
if ( 1 === $post_author ) {
$new_post['post_author'] = $current_uid;
} else if ( ! is_numeric( $post_author ) ) {
} elseif ( ! is_numeric( $post_author ) ) {
$user_author = get_user_by( 'login', $post_author );
if ( $user_author ) {
$post_author = $user_author->ID;
@ -373,7 +379,7 @@ class MainWP_Helper {
$post_author = wp_create_user( $post_author, $random_password, $post_author . '@asdf.com' );
}
}
} else if ( isset( $new_post['custom_post_author'] ) && ! empty( $new_post['custom_post_author'] ) ) {
} elseif ( isset( $new_post['custom_post_author'] ) && ! empty( $new_post['custom_post_author'] ) ) {
$_author = get_user_by( 'login', $new_post['custom_post_author'] );
if ( ! empty( $_author ) ) {
$new_post['post_author'] = $_author->ID;
@ -410,7 +416,7 @@ class MainWP_Helper {
if ( isset( $post_custom['_mainwp_edit_post_id'] ) && $post_custom['_mainwp_edit_post_id'] ) {
$edit_post_id = current($post_custom['_mainwp_edit_post_id']);
} else if (isset( $new_post['ID'] ) && $new_post['ID']) {
} elseif (isset( $new_post['ID'] ) && $new_post['ID']) {
$edit_post_id = $new_post['ID'];
}
@ -424,8 +430,9 @@ class MainWP_Helper {
}
$check_image_existed = false;
if ( $edit_post_id )
if ( $edit_post_id ) {
$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
@ -583,8 +590,9 @@ class MainWP_Helper {
return array( 'error' => 'Empty post id');
}
if ( !$edit_post_id )
if ( !$edit_post_id ) {
wp_update_post( array( 'ID' => $new_post_id, 'post_status' => $post_status ) );
}
if ( ! empty( $terms ) ) {
wp_set_object_terms( $new_post_id, array_map( intval, $terms ), 'category' );
@ -641,8 +649,9 @@ class MainWP_Helper {
foreach ( $post_custom as $meta_key => $meta_values ) {
if ( ! in_array( $meta_key, $not_allowed ) ) {
foreach ( $meta_values as $meta_value ) {
if (strpos($meta_key, '_mainwp_spinner_') === 0)
if (strpos($meta_key, '_mainwp_spinner_') === 0) {
continue; // not save
}
if ( ! $seo_ext_activated ) {
// if WordPress SEO plugin is not activated do not save yoast post meta
@ -653,13 +662,13 @@ class MainWP_Helper {
update_post_meta( $new_post_id, $meta_key, $meta_value );
}
}
} else if ( '_sticky' === $meta_key ) {
} elseif ( '_sticky' === $meta_key ) {
foreach ( $meta_values as $meta_value ) {
if ( 'sticky' === base64_decode( $meta_value ) ) {
stick_post( $new_post_id );
}
}
} else if ( '_post_to_only_existing_categories' === $meta_key ) {
} elseif ( '_post_to_only_existing_categories' === $meta_key ) {
if ( isset( $meta_values[0] ) && $meta_values[0] ) {
$post_to_only_existing_categories = true;
}
@ -692,7 +701,7 @@ 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
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 ) {
@ -727,7 +736,7 @@ class MainWP_Helper {
'post_excerpt' => $_image_data['caption'],
'post_content' => $_image_data['description'],
'post_title' => $_image_data['title'],
)
)
);
}
}
@ -923,10 +932,10 @@ class MainWP_Helper {
// 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' );
include_once ABSPATH . '/wp-admin/includes/screen.php';
}
if ( file_exists( ABSPATH . '/wp-admin/includes/template.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/template.php' );
include_once ABSPATH . '/wp-admin/includes/template.php';
}
$creds = request_filesystem_credentials( 'test' );
ob_end_clean();
@ -964,7 +973,7 @@ class MainWP_Helper {
if ( ! $showHttp ) {
$url = substr( $url, 7 );
}
} else if ( self::startsWith( $pUrl, 'https://' ) ) {
} elseif ( self::startsWith( $pUrl, 'https://' ) ) {
if ( ! $showHttp ) {
$url = substr( $url, 8 );
}
@ -1022,8 +1031,9 @@ class MainWP_Helper {
//$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 ))
if (!is_array( $postdata )) {
$postdata = array();
}
$postdata['json_result'] = true; // forced all response in json format
@ -1041,14 +1051,14 @@ class MainWP_Helper {
if ( ( false === $data ) && ( 0 === $http_status ) ) {
throw new Exception( 'Http Error: ' . $err );
} else if ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $data, $results ) > 0 ) {
} elseif ( preg_match( '/<mainwp>(.*)<\/mainwp>/', $data, $results ) > 0 ) {
$result = $results[1];
$result_base = base64_decode( $result );
//$information = maybe_unserialize( $result_base );
$information = json_decode( $result_base, true ); // it is json_encode result
return $information;
} else if ( '' === $data ) {
} elseif ( '' === $data ) {
throw new Exception( __( 'Something went wrong while contacting the child site. Please check if there is an error on the child site. This error could also be caused by trying to clone or restore a site to large for your server settings.', 'mainwp-child' ) );
} else {
throw new Exception( __( 'Child plugin is disabled or the security key is incorrect. Please resync with your main installation.', 'mainwp-child' ) );
@ -1234,8 +1244,9 @@ class MainWP_Helper {
static function update_lasttime_backup( $by, $time ) {
$backup_by = array('backupbuddy', 'backupwordpress', 'backwpup', 'updraftplus', 'wptimecapsule');
if (!in_array($by, $backup_by))
if (!in_array($by, $backup_by)) {
return false;
}
$lasttime = get_option('mainwp_lasttime_backup_' . $by);
if ( $time > $lasttime ) {
@ -1246,8 +1257,9 @@ class MainWP_Helper {
}
static function get_lasttime_backup( $by ) {
if ($by == 'backupwp') // to compatible
if ($by == 'backupwp') { // to compatible
$by = 'backupwordpress';
}
switch($by) {
case 'backupbuddy':
if ( !is_plugin_active( 'backupbuddy/backupbuddy.php' ) && !is_plugin_active( 'Backupbuddy/backupbuddy.php' )) {
@ -1356,9 +1368,9 @@ class MainWP_Helper {
if ( self::startsWith( $value, substr( $exclude, 0, strlen( $exclude ) - 1 ) ) ) {
return true;
}
} else if ( $value == $exclude ) {
} elseif ( $value == $exclude ) {
return true;
} else if ( self::startsWith( $value, $exclude . '/' ) ) {
} elseif ( self::startsWith( $value, $exclude . '/' ) ) {
return true;
}
}
@ -1444,7 +1456,8 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
public static function sanitize_filename( $filename ) {
if (!function_exists('mb_ereg_replace')) return sanitize_file_name($filename);
if (!function_exists('mb_ereg_replace')) { return sanitize_file_name($filename);
}
// Remove anything which isn't a word, whitespace, number
// or any of the following caracters -_~,;:[]().
@ -1515,14 +1528,16 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
public static function isSSLEnabled() {
if ( defined( 'MAINWP_NOSSL' ) ) return !MAINWP_NOSSL;
if ( defined( 'MAINWP_NOSSL' ) ) { return !MAINWP_NOSSL;
}
return function_exists( 'openssl_verify' );
}
public static function is_screen_with_update() {
if ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( defined('DOING_CRON') && DOING_CRON ) )
if ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( defined('DOING_CRON') && DOING_CRON ) ) {
return false;
}
if (function_exists('get_current_screen')) {
$screen = get_current_screen();
@ -1555,10 +1570,11 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
if (!empty($missing)) {
$message = 'Missing file(s): ' . implode(',', $missing);
if ($return)
if ($return) {
return $message;
else
} else {
throw new Exception( $message );
}
}
return true;
}
@ -1572,8 +1588,9 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
}
} else {
if ( !class_exists($classes) )
if ( !class_exists($classes) ) {
$missing[] = $classes;
}
}
if ( !empty($missing) ) {
@ -1596,9 +1613,10 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
$missing[] = $name;
}
}
} else if (!empty($methods)) {
if ( !method_exists($object, $methods) )
} elseif (!empty($methods)) {
if ( !method_exists($object, $methods) ) {
$missing[] = $methods;
}
}
@ -1622,9 +1640,10 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
$missing[] = $name;
}
}
} else if (!empty($properties)) {
if ( !property_exists($object, $properties) )
} elseif (!empty($properties)) {
if ( !property_exists($object, $properties) ) {
$missing[] = $properties;
}
}
@ -1648,9 +1667,10 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
$missing[] = $name;
}
}
} else if (!empty($funcs)) {
if ( !function_exists($funcs) )
} elseif (!empty($funcs)) {
if ( !function_exists($funcs) ) {
$missing[] = $funcs;
}
}

View file

@ -95,13 +95,13 @@ class MainWP_Keyword_Links {
function update_htaccess( $force_update = false, $force_clear = false ) {
if ( $force_clear ) {
$this->do_update_htaccess( true );
} else if ( $force_update ) {
} elseif ( $force_update ) {
return $this->do_update_htaccess();
} else {
if ( '' == get_option( 'permalink_structure' ) && 'yes' !== get_option( 'mainwp_keyword_links_htaccess_set' ) ) {
$this->do_update_htaccess();
} // need to update
else if ( '' != get_option( 'permalink_structure' ) && 'yes' === get_option( 'mainwp_keyword_links_htaccess_set' ) ) {
elseif ( '' != get_option( 'permalink_structure' ) && 'yes' === get_option( 'mainwp_keyword_links_htaccess_set' ) ) {
$this->do_update_htaccess();
} // need to update
}
@ -110,7 +110,7 @@ class MainWP_Keyword_Links {
}
public static function clear_htaccess() {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
$home_path = ABSPATH;
$htaccess_file = $home_path . '.htaccess';
if ( function_exists( 'save_mod_rewrite_rules' ) ) {
@ -125,8 +125,8 @@ class MainWP_Keyword_Links {
self::clear_htaccess();
return true;
} else if ( '' === get_option( 'permalink_structure' ) ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
} elseif ( '' === get_option( 'permalink_structure' ) ) {
include_once ABSPATH . '/wp-admin/includes/misc.php';
$redirection_folder = $this->get_option( 'redirection_folder', '' );
if ( empty( $redirection_folder ) ) {
$rules = $this->get_cloak_rules();
@ -534,7 +534,7 @@ class MainWP_Keyword_Links {
} else {
$links[] = $link;
}
} else if ( $spec_link_id && $spec_link_id === $link->id ) { // type 2 is specific link
} elseif ( $spec_link_id && $spec_link_id === $link->id ) { // type 2 is specific link
if ( $link->check_post_date ) {
if ( $post_timestamp < $link->check_post_date ) {
$links[] = $link;
@ -741,7 +741,7 @@ class MainWP_Keyword_Links {
if ( $remove_settings ) {
$this->clear_settings();
$return['status'] = 'SUCCESS';
} else if ( is_array( $remove_kws ) && is_array( $this->keyword_links ) ) {
} elseif ( is_array( $remove_kws ) && is_array( $this->keyword_links ) ) {
$new_keyword_links = array();
foreach ( $this->keyword_links as $link_id => $link ) {
$lnk_kws = $link->keyword;
@ -853,7 +853,7 @@ class MainWP_Keyword_Links {
if ( 3 === (int) $clear_link->type ) {
$clear_link->type = 2;
$cleared = $this->set_link( $clear_link->id, $clear_link );
} else if ( 1 === (int) $clear_link->type ) {
} elseif ( 1 === (int) $clear_link->type ) {
$cleared = $this->set_link( $clear_link->id, '' ); // delete link
}
$this->update_htaccess_for_change_cloak_links( $clear_link );
@ -901,7 +901,7 @@ class MainWP_Keyword_Links {
if ( 2 === (int) $link->type || 3 === (int) $link->type ) {
if ( intval( $_POST['post_id'] ) ) {
$link->post_id = intval( $_POST['post_id'] );
} else if ( $old && $old->post_id ) {
} elseif ( $old && $old->post_id ) {
$link->post_id = $old->post_id;
}
if ( $link->post_id ) {

View file

@ -320,8 +320,9 @@ class MainWP_Security {
public static function remove_readme( $force = false ) {
// to prevent remove readme.html file on WPE hosts
if ( MainWP_Helper::is_wp_engine() )
if ( MainWP_Helper::is_wp_engine() ) {
return true;
}
if ( $force || self::get_security_option( 'readme' ) ) {
if ( @file_exists( ABSPATH . 'readme.html' ) ) {
@ -351,7 +352,8 @@ class MainWP_Security {
//Admin user name is not admin
public static function admin_user_ok() {
$user = get_user_by( 'login', 'admin' );
if ( ! $user ) return true;
if ( ! $user ) { return true;
}
if ( 10 !== $user->wp_user_level && ( ! isset( $user->user_level ) || 10 !== $user->user_level ) && ! user_can( $user, 'level_10' ) ) {
return true;
@ -362,8 +364,9 @@ class MainWP_Security {
public static function update_security_option( $key, $value ) {
$security = get_option( 'mainwp_security' );
if ( !empty($key) )
if ( !empty($key) ) {
$security[$key] = $value;
}
MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' );
}
}

View file

@ -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 ) ) {
@ -78,7 +78,7 @@ class MainWP_Wordpress_SEO {
unlink( $temporary_file );
}
} else if ( isset( $_POST['settings'] ) ) {
} elseif ( isset( $_POST['settings'] ) ) {
try {
$settings = base64_decode( $_POST['settings'] );
// @codingStandardsIgnoreLine

View file

@ -176,7 +176,7 @@ class Tar_Archiver {
foreach ( $nodes as $key => $node ) {
if ( MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) {
unset( $nodes[ $key ] );
} else if ( MainWP_Helper::startsWith( $node, ABSPATH . basename( admin_url( '' ) ) ) ) {
} elseif ( MainWP_Helper::startsWith( $node, ABSPATH . basename( admin_url( '' ) ) ) ) {
unset( $nodes[ $key ] );
} else {
foreach ( $coreFiles as $coreFile ) {
@ -209,7 +209,7 @@ class Tar_Archiver {
if ( ! MainWP_Helper::inExcludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) {
if ( is_dir( $node ) ) {
$this->addDir( $node, $excludes );
} else if ( is_file( $node ) ) {
} elseif ( is_file( $node ) ) {
$this->addFile( $node, str_replace( ABSPATH, '', $node ) );
}
}
@ -333,7 +333,7 @@ class Tar_Archiver {
throw new Exception( 'Could not write to archive' );
}
//@fflush($this->archive);
} else if ( 'tar.bz2' == $this->type ) {
} elseif ( 'tar.bz2' == $this->type ) {
if ( false === @bzwrite( $this->archive, $data, strlen( $data ) ) ) {
throw new Exception( 'Could not write to archive' );
}
@ -365,7 +365,7 @@ class Tar_Archiver {
throw new Exception( 'Could not write to archive' );
}
@fflush( $this->archive );
} else if ( 'tar.bz2' == $this->type ) {
} elseif ( 'tar.bz2' == $this->type ) {
if ( false === @bzwrite( $this->archive, $this->chunk, strlen( $len ) ) ) {
throw new Exception( 'Could not write to archive' );
}
@ -741,14 +741,14 @@ class Tar_Archiver {
$startOffset = $rslt['startOffset'];
@fseek( $this->archive, $startOffset );
@ftruncate( $this->archive, $startOffset );
} else if ( 'tar.gz' == $this->type ) {
} elseif ( 'tar.gz' == $this->type ) {
$readOffset = $rslt['readOffset'];
$bytesRead = $rslt['bytesRead'];
//@fseek($this->archive, $readOffset + $bytesRead);
$out = array( 'bytesRead' => $bytesRead );
}
} else if ( false === $rslt ) {
} elseif ( false === $rslt ) {
if ( 'tar' == $this->type ) {
@fseek( $this->archive, 0, SEEK_END );
}
@ -820,7 +820,7 @@ class Tar_Archiver {
} else {
throw new Exception( 'Unexpected directory [' . $file['name'] . ']' );
}
} else if ( 0 == $file['type'] ) {
} elseif ( 0 == $file['type'] ) {
if ( 0 == strcmp( trim( $file['name'] ), trim( $entryName ) ) ) {
$previousFtell = @ftell( $this->archive );
@ -862,7 +862,7 @@ class Tar_Archiver {
return $rslt;
}
} else if ( ( 'tar' == $this->type ) && ( ( false === $ftell ) || ( -1 == $ftell ) ) ) {
} elseif ( ( 'tar' == $this->type ) && ( ( false === $ftell ) || ( -1 == $ftell ) ) ) {
$this->log( 'Will append this: ' . print_r( $rslt, 1 ) );
return $rslt;
@ -906,7 +906,7 @@ class Tar_Archiver {
if ( 'tar.gz' == $this->type ) {
//$this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
$this->archive = @gzopen( $filepath, 'wb' );
} else if ( 'tar.bz2' == $this->type ) {
} elseif ( 'tar.bz2' == $this->type ) {
$this->archive = @bzopen( $filepath, 'w' );
} else {
$this->archive = @fopen( $filepath, 'wb+' );
@ -928,7 +928,7 @@ class Tar_Archiver {
if ( 'tar.gz' == $this->type ) {
//$this->archive = @fopen('compress.zlib://' . $filepath, 'ab');
$this->archive = @gzopen( $filepath, 'ab' );
} else if ( $this->type == 'tar.bz2' ) {
} elseif ( $this->type == 'tar.bz2' ) {
$this->archive = @bzopen( $filepath, 'a' );
} else {
$this->archive = @fopen( $filepath, 'ab+' );
@ -992,7 +992,7 @@ class Tar_Archiver {
$this->type = 'tar.gz';
// $this->archive = @fopen('compress.zlib://' . $filepath, 'rb');
$this->archive = @gzopen( $filepath, 'r' );
} else if ( 'tar.bz2' == substr( $filepath, - 7 ) ) {
} elseif ( 'tar.bz2' == substr( $filepath, - 7 ) ) {
$this->type = 'tar.bz2';
$this->archive = @bzopen( $filepath, 'r' );
} else {
@ -1022,7 +1022,7 @@ class Tar_Archiver {
if ( 'tar.gz' == $this->type ) {
//@fclose($this->archive);
@gzclose( $this->archive );
} else if ( 'tar.bz2' == $this->type ) {
} elseif ( 'tar.bz2' == $this->type ) {
@bzclose( $this->archive );
} else {
@fclose( $this->archive );
@ -1065,7 +1065,7 @@ class Tar_Archiver {
if ( $file['checksum'] == 0x00000000 ) {
break;
} else if ( substr( $file['magic'], 0, 5 ) != 'ustar' ) {
} elseif ( substr( $file['magic'], 0, 5 ) != 'ustar' ) {
// $this->error[] = "This script does not support extracting this type of tar file.";
break;
}
@ -1134,7 +1134,7 @@ class Tar_Archiver {
if ( $file['checksum'] == 0x00000000 ) {
break;
} else if ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
} elseif ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
// $this->error[] = "This script does not support extracting this type of tar file.";
break;
}
@ -1151,7 +1151,7 @@ class Tar_Archiver {
if ( 0 == strcmp( trim( $file['name'] ), trim( $entryName ) ) ) {
return true;
}
} else if ( 0 == $file['type'] ) {
} elseif ( 0 == $file['type'] ) {
if ( 0 == strcmp( trim( $file['name'] ), trim( $entryName ) ) ) {
return true;
} else {
@ -1198,7 +1198,7 @@ class Tar_Archiver {
if ( $file['checksum'] == 0x00000000 ) {
break;
} else if ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
} elseif ( 'ustar' != substr( $file['magic'], 0, 5 ) ) {
// $this->error[] = "This script does not support extracting this type of tar file.";
break;
}
@ -1217,7 +1217,7 @@ class Tar_Archiver {
mkdir( $to . $file['name'], 0777, true );
}
}
} else if ( 0 == $file['type'] ) {
} elseif ( 0 == $file['type'] ) {
if ( ! is_dir( dirname( $to . $file['name'] ) ) ) {
if ( ! empty( $wp_filesystem ) ) {
$wp_filesystem->mkdir( dirname( $to . $file['name'] ), FS_CHMOD_DIR );
@ -1306,16 +1306,16 @@ if ( class_exists( 'SplHeap' ) ) {
if ( dirname( $pathA ) == dirname( $pathB ) ) {
if ( is_file( $pathA ) && ! is_file( $pathB ) ) {
return - 1;
} else if ( ! is_file( $pathA ) && is_file( $pathB ) ) {
} elseif ( ! is_file( $pathA ) && is_file( $pathB ) ) {
return 1;
}
return strcmp( $pathA, $pathB );
} else if ( $dirnameA == $dirnameB ) {
} elseif ( $dirnameA == $dirnameB ) {
return strcmp( $pathA, $pathB );
} else if ( MainWP_Helper::startsWith( $dirnameA, $dirnameB ) ) {
} elseif ( MainWP_Helper::startsWith( $dirnameA, $dirnameB ) ) {
return 1;
} else if ( MainWP_Helper::startsWith( $dirnameB, $dirnameA ) ) {
} elseif ( MainWP_Helper::startsWith( $dirnameB, $dirnameA ) ) {
return - 1;
} else {
$cmp = strcmp( $dirnameA, $dirnameB );

View file

@ -8,7 +8,7 @@
Text Domain: mainwp-child
Version: 4.0.7
*/
include_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 );
@ -25,7 +25,7 @@ function mainwp_child_autoload( $class_name ) {
$autoload_path = sprintf( '%sclass-%s.php', $autoload_dir, strtolower( str_replace( '_', '-', $class_name ) ) );
if ( file_exists( $autoload_path ) ) {
require_once( $autoload_path );
require_once $autoload_path;
}
}