mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-05 09:19:53 +08:00
Refactoring
This commit is contained in:
parent
cb163b9e2b
commit
159205b55d
11 changed files with 31 additions and 31 deletions
|
@ -86,7 +86,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
remove_menu_page( 'pb_backupbuddy_backup' );
|
||||
|
||||
if ( false !== stripos( $_SERVER['REQUEST_URI'], 'admin.php?page=pb_backupbuddy_' ) ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
if ( isset( $getOverview['lastBackupStats']['finish'] ) ) {
|
||||
$finish_time = $getOverview['lastBackupStats']['finish'];
|
||||
$time = $this->localize_time( $finish_time );
|
||||
$data['lastBackupStats'] = date( 'M j - g:i A', $time );
|
||||
$data['lastBackupStats'] = date( 'M j - g:i A', $time ); // phpcs:ignore -- local time
|
||||
$data['lasttime_backup'] = $finish_time;
|
||||
MainWP_Helper::update_lasttime_backup( 'backupbuddy', $finish_time ); // support Require Backup Before Update feature.
|
||||
} else {
|
||||
|
|
|
@ -1074,7 +1074,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'tools.php?page=backupwordpress' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'admin.php?page=backwpup' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
if ( ! is_object( $phpmailer ) || ! $phpmailer instanceof PHPMailer ) {
|
||||
require_once ABSPATH . WPINC . '/class-phpmailer.php';
|
||||
require_once ABSPATH . WPINC . '/class-smtp.php';
|
||||
$phpmailer = new PHPMailer( true );
|
||||
$phpmailer = new PHPMailer( true ); // phpcs:ignore -- to custom init PHP mailer
|
||||
}
|
||||
if ( is_object( $phpmailer ) ) {
|
||||
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
|
||||
|
|
|
@ -603,7 +603,7 @@ class MainWP_Child_Branding {
|
|||
$pos1 = stripos( $_SERVER['REQUEST_URI'], 'update-core.php' );
|
||||
$pos2 = stripos( $_SERVER['REQUEST_URI'], 'plugins.php' );
|
||||
if ( false !== $pos1 || false !== $pos2 ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ class MainWP_Child_Branding {
|
|||
$generator = '<!-- generator="' . $extra_setting['site_generator'] . '" -->';
|
||||
break;
|
||||
case 'export':
|
||||
$generator = '<!-- generator="' . $extra_setting['site_generator'] . '" created="' . date( 'Y-m-d H:i' ) . '" -->';
|
||||
$generator = '<!-- generator="' . $extra_setting['site_generator'] . '" created="' . date( 'Y-m-d H:i' ) . '" -->'; //phpcs:ignore -- current local time
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
|
|
|
@ -13,15 +13,14 @@
|
|||
* Extension URL: https://mainwp.com/extension/ithemes-security/
|
||||
*/
|
||||
|
||||
class MainWP_Child_iThemes_Security {
|
||||
class MainWP_Child_IThemes_Security {
|
||||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_iThemes_Security();
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
@ -139,7 +138,7 @@ class MainWP_Child_iThemes_Security {
|
|||
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
||||
add_action( 'admin_head', array( &$this, 'custom_admin_css' ) );
|
||||
if ( isset( $_GET['page'] ) && ( 'itsec' == $_GET['page'] || 'itsec-security-check' == $_GET['page'] ) ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +991,7 @@ class MainWP_Child_iThemes_Security {
|
|||
$and = '';
|
||||
}
|
||||
|
||||
$active = $and . " `lockout_active`=1 AND `lockout_expire_gmt` > '" . date( 'Y-m-d H:i:s', $itsec_globals['current_time_gmt'] ) . "'";
|
||||
$active = $and . " `lockout_active`=1 AND `lockout_expire_gmt` > '" . gmdate( 'Y-m-d H:i:s', $itsec_globals['current_time_gmt'] ) . "'";
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ class MainWP_Child_Staging {
|
|||
remove_menu_page( 'wpstg_clone' );
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'admin.php?page=wpstg_clone' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
protected function getBackups( $last_time = false ) {
|
||||
if ( empty( $last_time ) ) {
|
||||
$last_time = strtotime( date( 'Y-m-d', strtotime( date( 'Y-m-01' ) ) ) );
|
||||
$last_time = strtotime( date( 'Y-m-d', strtotime( date( 'Y-m-01' ) ) ) ); // phpcs:ignore -- local time
|
||||
}
|
||||
global $wpdb;
|
||||
$all_backups = $wpdb->get_results(
|
||||
|
@ -1172,7 +1172,7 @@ class MainWP_Child_Timecapsule {
|
|||
|
||||
$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>';
|
||||
echo '<tr title=""><td>' . __( 'Blog Time', 'wp-time-capsule' ) . '</td><td>' . date( 'H:i', current_time( 'timestamp' ) ) . '</td></tr>';
|
||||
echo '<tr title=""><td>' . __( 'Blog Time', 'wp-time-capsule' ) . '</td><td>' . date( 'H:i', current_time( 'timestamp' ) ) . '</td></tr>'; // phpcs:ignore -- local time
|
||||
echo '<tr title="WPLANG"><td>' . __( 'Blog language', 'wp-time-capsule' ) . '</td><td>' . get_bloginfo( 'language' ) . '</td></tr>';
|
||||
echo '<tr title="utf8"><td>' . __( 'MySQL Client encoding', 'wp-time-capsule' ) . '</td><td>';
|
||||
echo defined( 'DB_CHARSET' ) ? DB_CHARSET : '';
|
||||
|
@ -1246,7 +1246,7 @@ class MainWP_Child_Timecapsule {
|
|||
remove_menu_page( 'wp-time-capsule-monitor' );
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'admin.php?page=wp-time-capsule-monitor' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3975,7 +3975,7 @@ ENDHERE;
|
|||
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-general.php?page=updraftplus' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ class MainWP_Child_WP_Rocket {
|
|||
}
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-general.php?page=wprocket' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -632,7 +632,7 @@ class MainWP_Child {
|
|||
remove_menu_page( 'tools.php' );
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'tools.php' ) || stripos( $_SERVER['REQUEST_URI'], 'import.php' ) || stripos( $_SERVER['REQUEST_URI'], 'export.php' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
}
|
||||
}
|
||||
// if preserve branding and do not remove menus.
|
||||
|
@ -640,7 +640,7 @@ class MainWP_Child {
|
|||
remove_menu_page( 'options-general.php' );
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-general.php' ) || stripos( $_SERVER['REQUEST_URI'], 'options-writing.php' ) || stripos( $_SERVER['REQUEST_URI'], 'options-reading.php' ) || stripos( $_SERVER['REQUEST_URI'], 'options-discussion.php' ) || stripos( $_SERVER['REQUEST_URI'], 'options-media.php' ) || stripos( $_SERVER['REQUEST_URI'], 'options-permalink.php' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ class MainWP_Child {
|
|||
remove_submenu_page( 'options-general.php', 'options-permalink.php' );
|
||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-permalink.php' );
|
||||
if ( false !== $pos ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -1156,7 +1156,7 @@ class MainWP_Child {
|
|||
|
||||
// Redirect to the admin part if needed.
|
||||
if ( isset( $_POST['admin'] ) && '1' === $_POST['admin'] ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/' );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
@ -1403,11 +1403,11 @@ class MainWP_Child {
|
|||
$open_location = str_replace( 'nonce=child_temp_nonce', 'nonce=' . wp_create_nonce( 'wp-ajax' ), $open_location );
|
||||
}
|
||||
}
|
||||
wp_redirect( site_url() . $open_location );
|
||||
wp_safe_redirect( site_url() . $open_location );
|
||||
exit();
|
||||
}
|
||||
|
||||
wp_redirect( admin_url( $where ) );
|
||||
wp_safe_redirect( admin_url( $where ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -1480,14 +1480,14 @@ class MainWP_Child {
|
|||
|
||||
// Redirect to the admin part if needed.
|
||||
if ( isset( $_POST['admin'] ) && '1' === $_POST['admin'] ) {
|
||||
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/' );
|
||||
wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/' );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
// Init extensions.
|
||||
// Handle fatal errors for those init if needed.
|
||||
MainWP_Child_iThemes_Security::Instance()->ithemes_init();
|
||||
MainWP_Child_IThemes_Security::Instance()->ithemes_init();
|
||||
MainWP_Child_Updraft_Plus_Backups::Instance()->updraftplus_init();
|
||||
MainWP_Child_Back_Up_Wordpress::Instance()->init();
|
||||
MainWP_Child_WP_Rocket::Instance()->init();
|
||||
|
@ -1501,9 +1501,10 @@ class MainWP_Child {
|
|||
MainWP_Child_Pagespeed::Instance()->init();
|
||||
MainWP_Child_Links_Checker::Instance()->init();
|
||||
MainWP_Child_WPvivid_BackupRestore::Instance()->init();
|
||||
|
||||
global $_wp_submenu_nopriv;
|
||||
if ( null === $_wp_submenu_nopriv ) {
|
||||
$_wp_submenu_nopriv = array();
|
||||
$_wp_submenu_nopriv = array(); // phpcs:ignore -- to fix warning.
|
||||
}
|
||||
|
||||
// Call the function required.
|
||||
|
@ -1959,7 +1960,7 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
global $wp_current_filter;
|
||||
$wp_current_filter[] = 'load-plugins.php';
|
||||
$wp_current_filter[] = 'load-plugins.php'; // phpcs:ignore -- to custom plugin installation.
|
||||
wp_update_plugins();
|
||||
|
||||
// trick to prevent some premium plugins re-create update info.
|
||||
|
@ -3614,7 +3615,7 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
global $wp_current_filter;
|
||||
$wp_current_filter[] = 'load-plugins.php';
|
||||
$wp_current_filter[] = 'load-plugins.php'; // phpcs:ignore -- to custom plugin installation.
|
||||
|
||||
wp_update_plugins();
|
||||
include_once ABSPATH . '/wp-admin/includes/plugin.php';
|
||||
|
@ -5468,7 +5469,7 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
public function ithemes() {
|
||||
MainWP_Child_iThemes_Security::Instance()->action();
|
||||
MainWP_Child_IThemes_Security::Instance()->action();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ class MainWP_Keyword_Links {
|
|||
if ( get_option( 'mainwp_kwl_enable_statistic' ) ) {
|
||||
$this->add_statistic( $link_id, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_REFERER'] );
|
||||
}
|
||||
wp_redirect( $destination_url );
|
||||
wp_safe_redirect( $destination_url );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue