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,11 +869,12 @@ 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,7 +2099,7 @@ 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.
} elseif ( 'delete_tempfiles_now' == $other_action) {
@ -2119,7 +2125,7 @@ class MainWP_Child_Back_Up_Buddy {
$message = 'Dismissed alerts have been reset. They may now be visible again.';
} elseif ( 'cancel_running_backups' == $other_action) {
require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
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();
@ -2650,7 +2657,7 @@ class MainWP_Child_Back_Up_Buddy {
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';
}
} elseif ( 'pause_periodic' == $action ) {
@ -2658,7 +2665,7 @@ class MainWP_Child_Back_Up_Buddy {
$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.
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;
@ -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.
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' );
} 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');
@ -320,8 +323,9 @@ class MainWP_Child_Back_Up_Wordpress {
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;
@ -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;
} 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;
}
@ -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,9 +317,10 @@ 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 ) {
MainWP_Helper::update_lasttime_backup( 'backwpup', $new_lasttime_logged ); // to support backup before update feature
@ -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';
}
}

View file

@ -66,9 +66,10 @@ 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;
}
@ -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
@ -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";
@ -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(
@ -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;
}
@ -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();
}
@ -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' );
@ -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();
@ -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';
@ -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';
@ -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 );
@ -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';
@ -1349,9 +1351,10 @@ class MainWP_Child_Server_Information {
}
if ( empty( $test_result ) ) {
_e( 'Response Test O.K.', 'mainwp-child' );
} else
} else {
echo $test_result;
}
}
protected static function getRemoteAddress() {
@ -1624,8 +1627,9 @@ 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');

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;
} 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' ) );

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;
}
@ -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);
}
@ -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');
@ -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,9 +985,10 @@ 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', '');
@ -1006,16 +1015,18 @@ 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;
@ -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'])){
@ -504,8 +512,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( $key, $value );
} 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'];
@ -534,8 +543,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} 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'];
@ -552,8 +562,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} 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']);
@ -565,8 +576,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} 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'] ) ) {
@ -589,8 +601,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} 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'] ) ) {
@ -616,8 +629,9 @@ class MainWP_Child_Updraft_Plus_Backups {
UpdraftPlus_Options::update_updraft_option( 'updraft_sftp', $opts );
} 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']);
@ -627,8 +641,9 @@ class MainWP_Child_Updraft_Plus_Backups {
} 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';
}
}
@ -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;
@ -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}";
@ -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();
@ -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,8 +3189,10 @@ 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/';
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,11 +3405,12 @@ 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;
}
}
}
}
return $ret;
}
@ -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;
}
@ -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;
}
@ -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;
}
@ -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;
@ -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'] ) );
}
@ -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'] ) );
}
@ -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();
@ -2057,8 +2062,9 @@ SQL
$noEditHtaccess = '1';
if (isset($_POST['needToCheckFalconHtaccess']) && !empty($_POST['needToCheckFalconHtaccess'])) {
$checkHtaccess = self::checkFalconHtaccess();
if (isset($checkHtaccess['ok']))
if (isset($checkHtaccess['ok'])) {
$noEditHtaccess = '0';
}
} elseif (isset($_POST['noEditHtaccess'])) {
$noEditHtaccess = $_POST['noEditHtaccess'];
}
@ -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

@ -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 );

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();

View file

@ -13,8 +13,8 @@ if ( defined( 'MAINWP_DEBUG' ) && MAINWP_DEBUG === true ) {
define( 'MAINWP_CHILD_NR_OF_COMMENTS', 50 );
define( 'MAINWP_CHILD_NR_OF_PAGES', 50 );
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
require_once ABSPATH . '/wp-admin/includes/file.php';
require_once ABSPATH . '/wp-admin/includes/plugin.php';
if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyuse_nonce_hmac'] ) ) {
@ -213,8 +213,9 @@ class MainWP_Child {
$this->load_all_options();
$this->filterFunction = function( $a) {
if ($a == null) { return false; }
if (is_object($a) && property_exists($a, 'last_checked') && !property_exists($a, 'checked'))
if (is_object($a) && property_exists($a, 'last_checked') && !property_exists($a, 'checked')) {
return false;
}
return $a;
};
$this->plugin_dir = dirname( $plugin_file );
@ -269,15 +270,17 @@ class MainWP_Child {
function load_all_options() {
global $wpdb;
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
$alloptions = wp_cache_get( 'alloptions', 'options' );
else
} else {
$alloptions = false;
}
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
$notoptions = wp_cache_get( 'notoptions', 'options' );
else
} else {
$notoptions = false;
}
if ( !isset($alloptions['mainwp_db_version']) ) {
$suppress = $wpdb->suppress_errors();
@ -325,7 +328,8 @@ class MainWP_Child {
$alloptions_db = $wpdb->get_results( $query );
$wpdb->suppress_errors($suppress);
if ( !is_array( $alloptions ) ) $alloptions = array();
if ( !is_array( $alloptions ) ) { $alloptions = array();
}
if ( is_array( $alloptions_db ) ) {
foreach ( (array) $alloptions_db as $o ) {
$alloptions[ $o->option_name ] = $o->option_value;
@ -726,14 +730,16 @@ class MainWP_Child {
$all_subpages = apply_filters( 'mainwp-child-init-subpages', array() );
if ( !is_array( $all_subpages ) )
if ( !is_array( $all_subpages ) ) {
$all_subpages = array();
}
if ( !self::$subPagesLoaded ) {
foreach( $all_subpages as $page ) {
$slug = isset( $page['slug'] ) ? $page['slug'] : '';
if ( empty( $slug ) )
if ( empty( $slug ) ) {
continue;
}
$subpage = array();
$subpage['slug'] = $slug;
$subpage['title'] = $page['title'];
@ -844,8 +850,9 @@ class MainWP_Child {
$shownPage = $_GET['tab'];
}
if (empty($shownPage))
if (empty($shownPage)) {
$shownPage = 'settings';
}
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
@ -1081,7 +1088,7 @@ class MainWP_Child {
}
if ( $hard ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
$home_path = ABSPATH;
$htaccess_file = $home_path . '.htaccess';
@ -1308,7 +1315,7 @@ class MainWP_Child {
}
if ( get_option( 'mainwp_child_fix_htaccess' ) === false ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
$wp_rewrite->flush_rules();
MainWP_Helper::update_option( 'mainwp_child_fix_htaccess', 'yes', 'yes' );
@ -1517,8 +1524,9 @@ class MainWP_Child {
MainWP_Child_Links_Checker::Instance()->init();
MainWP_Child_WPvivid_BackupRestore::Instance()->init();
global $_wp_submenu_nopriv;
if ($_wp_submenu_nopriv === null)
if ($_wp_submenu_nopriv === null) {
$_wp_submenu_nopriv = array(); // fix warning
}
//Call the function required
if ( $auth && isset( $_POST['function'] ) && isset( $this->callableFunctions[ $_POST['function'] ] ) ) {
@ -1669,12 +1677,12 @@ class MainWP_Child {
}
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
include_once ABSPATH . '/wp-admin/includes/screen.php';
}
include_once( ABSPATH . '/wp-admin/includes/template.php' );
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once ABSPATH . '/wp-admin/includes/template.php';
include_once ABSPATH . '/wp-admin/includes/misc.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . '/wp-admin/includes/plugin.php';
$urlgot = json_decode( stripslashes( $_POST['url'] ) );
@ -1807,17 +1815,17 @@ class MainWP_Child {
$information = array();
include_once( ABSPATH . '/wp-admin/includes/update.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once ABSPATH . '/wp-admin/includes/update.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
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';
}
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/file.php';
include_once ABSPATH . '/wp-admin/includes/misc.php';
if ( null !== $this->filterFunction ) {
add_filter( 'pre_site_transient_update_core', $this->filterFunction, 99 );
@ -1894,19 +1902,19 @@ class MainWP_Child {
define( 'DOING_CRON', true );
MainWP_Helper::getWPFilesystem();
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.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';
}
if ( file_exists( ABSPATH . '/wp-admin/includes/misc.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
}
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once ABSPATH . '/wp-admin/includes/file.php';
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
// to fix
@wp_version_check();
@ -1948,32 +1956,33 @@ class MainWP_Child {
*/
function upgradePluginTheme() {
//Prevent disable/re-enable at upgrade
if (!defined( 'DOING_CRON') )
if (!defined( 'DOING_CRON') ) {
define( 'DOING_CRON', true );
}
MainWP_Helper::getWPFilesystem();
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
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';
}
if ( file_exists( ABSPATH . '/wp-admin/includes/misc.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
}
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once( ABSPATH . '/wp-admin/includes/plugin-install.php' );
include_once ABSPATH . '/wp-admin/includes/file.php';
include_once ABSPATH . '/wp-admin/includes/plugin.php';
include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
$information = array();
$information['upgrades'] = array();
$mwp_premium_updates_todo = array();
$mwp_premium_updates_todo_slugs = array();
if ( isset( $_POST['type'] ) && 'plugin' === $_POST['type'] ) {
include_once( ABSPATH . '/wp-admin/includes/update.php' );
include_once ABSPATH . '/wp-admin/includes/update.php';
if ( null !== $this->filterFunction ) {
// ET_Automatic_Updates
add_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
@ -1985,7 +1994,7 @@ class MainWP_Child {
if ( in_array( 'backupbuddy/backupbuddy.php', $plugins ) ) {
if ( isset( $GLOBALS['ithemes_updater_path'] ) ) {
if ( ! class_exists( 'Ithemes_Updater_Settings' ) ) {
require( $GLOBALS['ithemes_updater_path'] . '/settings.php' );
require $GLOBALS['ithemes_updater_path'] . '/settings.php';
}
if ( class_exists( 'Ithemes_Updater_Settings' ) ) {
$ithemes_updater = new Ithemes_Updater_Settings();
@ -1999,7 +2008,7 @@ class MainWP_Child {
if (in_array('smart-manager-for-wp-e-commerce/smart-manager.php', $plugins)) {
if (file_exists(plugin_dir_path( __FILE__ ) . '../../smart-manager-for-wp-e-commerce/pro/upgrade.php') && file_exists(plugin_dir_path( __FILE__ ) . '../../smart-manager-for-wp-e-commerce/smart-manager.php')) {
include_once plugin_dir_path( __FILE__ ) . '../../smart-manager-for-wp-e-commerce/smart-manager.php';
include_once (plugin_dir_path( __FILE__ ) . '../../smart-manager-for-wp-e-commerce/pro/upgrade.php');
include_once plugin_dir_path( __FILE__ ) . '../../smart-manager-for-wp-e-commerce/pro/upgrade.php';
}
}
////
@ -2113,7 +2122,7 @@ class MainWP_Child {
$last_update = get_site_transient( 'update_themes' );
include_once( ABSPATH . '/wp-admin/includes/update.php' );
include_once ABSPATH . '/wp-admin/includes/update.php';
if ( null !== $this->filterFunction ) {
add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
}
@ -2122,7 +2131,7 @@ class MainWP_Child {
// $originalLastChecked = !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ? $last_update->last_checked : 0;
@wp_update_themes();
include_once( ABSPATH . '/wp-admin/includes/theme.php' );
include_once ABSPATH . '/wp-admin/includes/theme.php';
// to support cached premium themes update info, hooking in the bulk_upgrade()
add_filter( 'pre_site_transient_update_themes', array( $this, 'set_cached_update_themes' ) );
@ -2324,8 +2333,9 @@ class MainWP_Child {
}
}
if ($pre == false)
if ($pre == false) {
return $false;
}
return $_transient_data;
}
@ -2347,8 +2357,9 @@ class MainWP_Child {
}
}
if ($pre == false)
if ($pre == false) {
return $false;
}
return $_transient_data;
}
@ -2601,7 +2612,7 @@ class MainWP_Child {
}
}
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php' );
include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
$post_featured_image = get_post_thumbnail_id( $id );
$child_upload_dir = wp_upload_dir();
$new_post = array(
@ -2646,7 +2657,7 @@ class MainWP_Child {
if ( $post ) {
$post_custom = get_post_custom( $id );
//post_slug = base64_decode( get_post_meta( $id, '_slug', true ) );
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php' );
include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
$post_featured_image = get_post_thumbnail_id( $id );
$child_upload_dir = wp_upload_dir();
@ -2715,7 +2726,7 @@ class MainWP_Child {
global $current_user;
$reassign = ( isset( $current_user ) && isset( $current_user->ID ) ) ? $current_user->ID : 0;
include_once( ABSPATH . '/wp-admin/includes/user.php' );
include_once ABSPATH . '/wp-admin/includes/user.php';
if ( 'delete' === $action ) {
wp_delete_user( $userId, $reassign );
@ -2755,8 +2766,9 @@ class MainWP_Child {
$failed = true;
}
if ($failed)
if ($failed) {
$information['status'] = 'FAIL';
}
if ( ! isset( $information['status'] ) && !isset($information['error']) ) {
$information['status'] = 'SUCCESS';
@ -2783,33 +2795,39 @@ class MainWP_Child {
}
$pass1 = $pass2 = '';
if ( isset( $data['pass1'] ) )
if ( isset( $data['pass1'] ) ) {
$pass1 = $data['pass1'];
if ( isset( $data['pass2'] ) )
}
if ( isset( $data['pass2'] ) ) {
$pass2 = $data['pass2'];
}
if ( isset( $data['role'] ) && current_user_can( 'edit_users' ) ) {
$new_role = sanitize_text_field( $data['role'] );
$potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
// Multisite super admins can freely edit their blog roles -- they possess all caps.
if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) {
$user->role = $new_role;
}
// If the new role isn't editable by the logged-in user die with error
$editable_roles = get_editable_roles();
if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) )
if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) {
return array('error' => 'You can&#8217;t give users that role.');
}
}
$email = '';
if ( isset( $data['email'] ) )
if ( isset( $data['email'] ) ) {
$email = trim( $data['email'] );
}
if ( !empty( $email ) )
if ( !empty( $email ) ) {
$user->user_email = sanitize_text_field( wp_unslash( $email ) );
else
} else {
$user->user_email = $userdata->user_email;
}
if ( isset( $data['url'] ) ) {
if ( empty ( $data['url'] ) || $data['url'] == 'http://' ) {
@ -2821,22 +2839,28 @@ class MainWP_Child {
}
}
if ( isset( $data['first_name'] ) )
if ( isset( $data['first_name'] ) ) {
$user->first_name = sanitize_text_field( $data['first_name'] );
if ( isset( $data['last_name'] ) )
}
if ( isset( $data['last_name'] ) ) {
$user->last_name = sanitize_text_field( $data['last_name'] );
if ( isset( $data['nickname'] ) && !empty($data['nickname']))
}
if ( isset( $data['nickname'] ) && !empty($data['nickname'])) {
$user->nickname = sanitize_text_field( $data['nickname'] );
if ( isset( $data['display_name'] ) )
}
if ( isset( $data['display_name'] ) ) {
$user->display_name = sanitize_text_field( $data['display_name'] );
if ( isset( $data['description'] ) )
}
if ( isset( $data['description'] ) ) {
$user->description = trim( $data['description'] );
}
$errors = new WP_Error();
/* checking that username has been typed */
if ( $user->user_login == '' )
if ( $user->user_login == '' ) {
$errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) );
}
do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) );
@ -2856,8 +2880,9 @@ class MainWP_Child {
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
}
if ( !empty( $pass1 ) )
if ( !empty( $pass1 ) ) {
$user->user_pass = $pass1;
}
} else {
$user->user_pass = $userdata->user_pass;
}
@ -2883,8 +2908,9 @@ class MainWP_Child {
if ( $errors->get_error_codes() ) {
$error_str = '';
foreach ( $errors->get_error_messages() as $message ) {
if ( is_string( $message ) )
if ( is_string( $message ) ) {
$error_str .= ' ' . esc_html( strip_tags( $message ) );
}
}
return array( 'error' => $error_str );
@ -2896,7 +2922,7 @@ class MainWP_Child {
}
function get_user_to_edit( $user_id ) {
require_once(ABSPATH . 'wp-admin/includes/user.php');
require_once ABSPATH . 'wp-admin/includes/user.php';
$profileuser = get_user_to_edit($user_id);
$edit_data = array();
@ -2912,19 +2938,22 @@ class MainWP_Child {
$public_display['display_nickname'] = $profileuser->nickname;
$public_display['display_username'] = $profileuser->user_login;
if ( !empty($profileuser->first_name) )
if ( !empty($profileuser->first_name) ) {
$public_display['display_firstname'] = $profileuser->first_name;
}
if ( !empty($profileuser->last_name) )
if ( !empty($profileuser->last_name) ) {
$public_display['display_lastname'] = $profileuser->last_name;
}
if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
}
if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
if ( !in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
}
$public_display = array_map( 'trim', $public_display );
$public_display = array_unique( $public_display );
@ -3008,7 +3037,7 @@ class MainWP_Child {
//Read form data
$new_password = maybe_unserialize( base64_decode( $_POST['new_password'] ) );
$user = get_user_by( 'login', $_POST['user'] );
require_once( ABSPATH . WPINC . '/registration.php' );
require_once ABSPATH . WPINC . '/registration.php';
$id = wp_update_user( array( 'ID' => $user->ID, 'user_pass' => $new_password['user_pass'] ) );
if ( $id !== $user->ID ) {
@ -3652,7 +3681,7 @@ class MainWP_Child {
}
$information['nossl'] = ( 1 == $nossl ? 1 : 0 );
include_once( ABSPATH . '/wp-admin/includes/update.php' );
include_once ABSPATH . '/wp-admin/includes/update.php';
$timeout = 3 * 60 * 60; // 3minutes
@set_time_limit( $timeout );
@ -3750,7 +3779,7 @@ class MainWP_Child {
$wp_current_filter[] = 'load-plugins.php';
@wp_update_plugins();
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once ABSPATH . '/wp-admin/includes/plugin.php';
$plugin_updates = get_plugin_updates();
if ( is_array( $plugin_updates ) ) {
@ -3805,7 +3834,7 @@ class MainWP_Child {
add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
}
@wp_update_themes();
include_once( ABSPATH . '/wp-admin/includes/theme.php' );
include_once ABSPATH . '/wp-admin/includes/theme.php';
$theme_updates = $this->upgrade_get_theme_updates();
if ( is_array( $theme_updates ) ) {
$information['theme_updates'] = array();
@ -4024,8 +4053,9 @@ class MainWP_Child {
function get_site_icon() {
$information = array();
$url = $this->get_favicon( true );
if ( !empty( $url ) )
if ( !empty( $url ) ) {
$information['faviIconUrl'] = $url;
}
MainWP_Helper::write( $information );
}
@ -4595,7 +4625,7 @@ class MainWP_Child {
function get_recent_comments( $pAllowedStatuses, $pCount ) {
if ( ! function_exists( 'get_comment_author_url' ) ) {
include_once( WPINC . '/comment-template.php' );
include_once WPINC . '/comment-template.php';
}
$allComments = array();
@ -4637,23 +4667,23 @@ class MainWP_Child {
$theme = $_POST['theme'];
if ( 'activate' === $action ) {
include_once( ABSPATH . '/wp-admin/includes/theme.php' );
include_once ABSPATH . '/wp-admin/includes/theme.php';
$theTheme = wp_get_theme( $theme );
if ( null !== $theTheme && '' !== $theTheme ) {
switch_theme( $theTheme['Template'], $theTheme['Stylesheet'] );
}
} elseif ( 'delete' === $action ) {
include_once( ABSPATH . '/wp-admin/includes/theme.php' );
include_once ABSPATH . '/wp-admin/includes/theme.php';
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
include_once ABSPATH . '/wp-admin/includes/screen.php';
}
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once( ABSPATH . '/wp-admin/includes/template.php' );
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php' );
include_once ABSPATH . '/wp-admin/includes/file.php';
include_once ABSPATH . '/wp-admin/includes/template.php';
include_once ABSPATH . '/wp-admin/includes/misc.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
$wp_filesystem = $this->getWPFilesystem();
if ( empty( $wp_filesystem ) ) {
@ -4742,7 +4772,7 @@ class MainWP_Child {
$plugins = explode( '||', $_POST['plugin'] );
if ( 'activate' === $action ) {
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once ABSPATH . '/wp-admin/includes/plugin.php';
foreach ( $plugins as $idx => $plugin ) {
if ( $plugin !== $this->plugin_slug ) {
@ -4759,7 +4789,7 @@ class MainWP_Child {
}
}
} elseif ( 'deactivate' === $action ) {
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once ABSPATH . '/wp-admin/includes/plugin.php';
foreach ( $plugins as $idx => $plugin ) {
if ( $plugin !== $this->plugin_slug ) {
@ -4770,17 +4800,17 @@ class MainWP_Child {
}
}
} elseif ( 'delete' === $action ) {
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
include_once ABSPATH . '/wp-admin/includes/plugin.php';
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
include_once ABSPATH . '/wp-admin/includes/screen.php';
}
include_once( ABSPATH . '/wp-admin/includes/file.php' );
include_once( ABSPATH . '/wp-admin/includes/template.php' );
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php' );
include_once( ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php' );
include_once ABSPATH . '/wp-admin/includes/file.php';
include_once ABSPATH . '/wp-admin/includes/template.php';
include_once ABSPATH . '/wp-admin/includes/misc.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
$wp_filesystem = $this->getWPFilesystem();
if ( null === $wp_filesystem ) {
@ -4828,7 +4858,7 @@ class MainWP_Child {
function get_all_plugins_int( $filter, $keyword = '', $status = '' ) {
if ( ! function_exists( 'get_plugins' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$rslt = array();
$plugins = get_plugins();
@ -4904,8 +4934,9 @@ class MainWP_Child {
}
}
}
if ($return)
if ($return) {
return $allusers;
}
MainWP_Helper::write( $allusers );
}
@ -4913,8 +4944,9 @@ class MainWP_Child {
$allusers = array();
$params = array();
if ($number)
if ($number) {
$params['number'] = $number;
}
$new_users = get_users($params);
if ( is_array( $new_users ) ) {
@ -5015,7 +5047,7 @@ class MainWP_Child {
//Deactivating the plugin
function deactivate() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
include_once ABSPATH . 'wp-admin/includes/plugin.php';
deactivate_plugins( $this->plugin_slug, true );
$information = array();
if ( is_plugin_active( $this->plugin_slug ) ) {
@ -5027,8 +5059,9 @@ class MainWP_Child {
function activation() {
$mu_plugin_enabled = apply_filters('mainwp_child_mu_plugin_enabled', false);
if ($mu_plugin_enabled)
if ($mu_plugin_enabled) {
return;
}
$to_delete = array(
'mainwp_child_pubkey',
@ -5054,8 +5087,9 @@ class MainWP_Child {
function deactivation( $deact = true) {
$mu_plugin_enabled = apply_filters('mainwp_child_mu_plugin_enabled', false);
if ($mu_plugin_enabled)
if ($mu_plugin_enabled) {
return;
}
$to_delete = array(
'mainwp_child_pubkey',
@ -5075,9 +5109,10 @@ class MainWP_Child {
}
}
if ($deact)
if ($deact) {
do_action( 'mainwp_child_deactivation' );
}
}
function getWPFilesystem() {
global $wp_filesystem;
@ -5086,10 +5121,10 @@ class MainWP_Child {
ob_start();
// if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
if ( file_exists( ABSPATH . '/wp-admin/includes/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', '', false, false, $extra_fields = null );
ob_end_clean();
@ -5824,7 +5859,7 @@ class MainWP_Child {
static function fix_for_custom_themes() {
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 ( function_exists( 'et_register_updates_component' ) ) {

View file

@ -12,7 +12,7 @@ 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 ) ) {

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 );

View file

@ -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

@ -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 );
}
}
@ -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
@ -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 ) {
@ -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();
@ -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
@ -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' )) {
@ -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,11 +1570,12 @@ 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,9 +1588,10 @@ 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) ) {
$message = 'Missing classes: ' . implode(',', $missing);
@ -1597,8 +1614,9 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
}
} elseif (!empty($methods)) {
if ( !method_exists($object, $methods) )
if ( !method_exists($object, $methods) ) {
$missing[] = $methods;
}
}
@ -1623,8 +1641,9 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
}
} elseif (!empty($properties)) {
if ( !property_exists($object, $properties) )
if ( !property_exists($object, $properties) ) {
$missing[] = $properties;
}
}
@ -1649,8 +1668,9 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
}
}
} elseif (!empty($funcs)) {
if ( !function_exists($funcs) )
if ( !function_exists($funcs) ) {
$missing[] = $funcs;
}
}

View file

@ -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' ) ) {
@ -126,7 +126,7 @@ class MainWP_Keyword_Links {
return true;
} elseif ( '' === get_option( 'permalink_structure' ) ) {
include_once( ABSPATH . '/wp-admin/includes/misc.php' );
include_once ABSPATH . '/wp-admin/includes/misc.php';
$redirection_folder = $this->get_option( 'redirection_folder', '' );
if ( empty( $redirection_folder ) ) {
$rules = $this->get_cloak_rules();

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 ) ) {

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;
}
}