mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
Merge with branch01
* Fixed: an issue with the X-Frame-Options configuration * Fixed: an issue with clearing WP Rocket cache * Fixed: an issue with saving BackWPup settings * Fixed: multiple compatibility issues for the Bulk Settings Manger extension * Fixed: an issue with submitting the Bulk Settings Manger keys on child sites protected with the HTTP Basic Authentication * Fixed: an issue with creating buckets in Backblaze remote option caused by disallowed characters * Fixed: an issue with tokens usage in the UpdraftPlus Webdav remote storage settings * Added: support for new WP Staging plugin options * Updated: update detection process in order to improve performance on some hosts * Updated: disabled site size calculation function as default state * Updated: support for the latest Wordfence version
This commit is contained in:
parent
a0ab1b7a0c
commit
1e11c93c4a
15 changed files with 521 additions and 155 deletions
|
@ -32,13 +32,24 @@ class MainWP_Child_Back_Up_Buddy {
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'backupbuddy/backupbuddy.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $value->response['backupbuddy/backupbuddy.php'] ) ) {
|
if ( isset( $value->response['backupbuddy/backupbuddy.php'] ) ) {
|
||||||
unset( $value->response['backupbuddy/backupbuddy.php'] );
|
unset( $value->response['backupbuddy/backupbuddy.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,23 @@ class MainWP_Child_Back_Up_Wordpress {
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'backupwordpress/backupwordpress.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
if ( isset( $value->response['backupwordpress/backupwordpress.php'] ) ) {
|
if ( isset( $value->response['backupwordpress/backupwordpress.php'] ) ) {
|
||||||
unset( $value->response['backupwordpress/backupwordpress.php'] );
|
unset( $value->response['backupwordpress/backupwordpress.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1423,7 +1423,10 @@ class MainWP_Child_Back_WP_Up {
|
||||||
|
|
||||||
update_site_option( 'backwpup_messages', array() );
|
update_site_option( 'backwpup_messages', array() );
|
||||||
|
|
||||||
$backwpup = new BackWPup_Page_Settings();
|
$settings_views = array();
|
||||||
|
$settings_updaters = array();
|
||||||
|
|
||||||
|
$backwpup = new BackWPup_Page_Settings($settings_views, $settings_updaters);
|
||||||
$backwpup->save_post_form();
|
$backwpup->save_post_form();
|
||||||
|
|
||||||
if ( class_exists( 'BackWPup_Pro' ) ) {
|
if ( class_exists( 'BackWPup_Pro' ) ) {
|
||||||
|
|
|
@ -270,6 +270,17 @@ class MainWP_Child_Branding {
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
if ( ! is_array( $extra_setting ) ) {
|
||||||
$extra_setting = array();
|
$extra_setting = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to hide updates notice
|
||||||
|
if (is_admin()) {
|
||||||
|
// back end
|
||||||
|
add_action( 'in_admin_footer', array( $this, 'in_admin_footer' ) );
|
||||||
|
} else if (is_user_logged_in()) {
|
||||||
|
// front end
|
||||||
|
add_action( 'add_admin_bar_menus', array( $this, 'add_admin_bar_menus' ));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
||||||
if ( $cancelled_branding ) {
|
if ( $cancelled_branding ) {
|
||||||
return;
|
return;
|
||||||
|
@ -277,9 +288,10 @@ class MainWP_Child_Branding {
|
||||||
// enable branding in case child plugin is deactive
|
// enable branding in case child plugin is deactive
|
||||||
add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
|
add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
|
||||||
|
|
||||||
// if ( self::is_branding() ) {
|
if ( self::is_branding() ) {
|
||||||
// add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
// }
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( get_option( 'mainwp_branding_ext_enabled' ) !== 'Y' ) {
|
if ( get_option( 'mainwp_branding_ext_enabled' ) !== 'Y' ) {
|
||||||
return;
|
return;
|
||||||
|
@ -856,6 +868,135 @@ class MainWP_Child_Branding {
|
||||||
return 'MainWP';
|
return 'MainWP';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add_admin_bar_menus() {
|
||||||
|
|
||||||
|
$hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array());
|
||||||
|
|
||||||
|
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' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$count_hide = 0;
|
||||||
|
|
||||||
|
$updates = get_plugin_updates();
|
||||||
|
if (is_array($updates)) {
|
||||||
|
foreach($updates as $slug => $data) {
|
||||||
|
if (in_array($slug, $hide_slugs)) {
|
||||||
|
$count_hide++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $count_hide == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// js for front end
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var mainwpCountHide = <?php echo esc_attr($count_hide); ?>;
|
||||||
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||||||
|
var $adminBarUpdates = document.querySelector( '#wp-admin-bar-updates .ab-label' ),
|
||||||
|
itemCount;
|
||||||
|
|
||||||
|
if (typeof($adminBarUpdates) !== 'undefined' && $adminBarUpdates !== null) {
|
||||||
|
itemCount = $adminBarUpdates.textContent;
|
||||||
|
itemCount = parseInt(itemCount);
|
||||||
|
|
||||||
|
itemCount -= mainwpCountHide;
|
||||||
|
if (itemCount < 0)
|
||||||
|
itemCount = 0;
|
||||||
|
|
||||||
|
$adminBarUpdates.textContent = itemCount;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script><?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function in_admin_footer() {
|
||||||
|
|
||||||
|
$hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array());
|
||||||
|
|
||||||
|
if (!is_array($hide_slugs))
|
||||||
|
$hide_slugs = array();
|
||||||
|
|
||||||
|
$count_hide = 0;
|
||||||
|
|
||||||
|
$updates = get_plugin_updates();
|
||||||
|
if (is_array($updates)) {
|
||||||
|
foreach($updates as $slug => $data) {
|
||||||
|
if (in_array($slug, $hide_slugs)) {
|
||||||
|
$count_hide++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $count_hide == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// to tweaks counting of update notification display
|
||||||
|
// js for admin end
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var mainwpCountHide = <?php echo esc_attr($count_hide); ?>;
|
||||||
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||||||
|
if (typeof(pagenow) !== 'undefined' && pagenow == 'plugins') {
|
||||||
|
<?php
|
||||||
|
// hide update notice row
|
||||||
|
if (in_array('mainwp-child/mainwp-child.php', $hide_slugs)) {
|
||||||
|
?>
|
||||||
|
var el = document.querySelector('tr#mainwp-child-update');
|
||||||
|
if (typeof(el) !== 'undefined' && el !== null) {
|
||||||
|
el.style.display = 'none';
|
||||||
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
// hide update notice row
|
||||||
|
if (in_array('mainwp-child-reports/mainwp-child-reports.php', $hide_slugs)) {
|
||||||
|
?>
|
||||||
|
var el = document.querySelector('tr#mainwp-child-reports-update');
|
||||||
|
if (typeof(el) !== 'undefined' && el !== null) {
|
||||||
|
el.style.display = 'none';
|
||||||
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainwpCountHide > 0) {
|
||||||
|
jQuery( document ).ready( function () {
|
||||||
|
|
||||||
|
var $adminBarUpdates = jQuery( '#wp-admin-bar-updates' ),
|
||||||
|
$pluginsNavMenuUpdateCount = jQuery( 'a[href="plugins.php"] .update-plugins' ),
|
||||||
|
itemCount;
|
||||||
|
itemCount = $adminBarUpdates.find( '.ab-label' ).text();
|
||||||
|
itemCount -= mainwpCountHide;
|
||||||
|
if (itemCount < 0)
|
||||||
|
itemCount = 0;
|
||||||
|
|
||||||
|
itemPCount = $pluginsNavMenuUpdateCount.find( '.plugin-count' ).text();
|
||||||
|
itemPCount -= mainwpCountHide;
|
||||||
|
|
||||||
|
if (itemPCount < 0)
|
||||||
|
itemPCount = 0;
|
||||||
|
|
||||||
|
$adminBarUpdates.find( '.ab-label' ).text(itemCount);
|
||||||
|
$pluginsNavMenuUpdateCount.find( '.plugin-count' ).text( itemPCount );
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script><?php
|
||||||
|
}
|
||||||
|
|
||||||
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
|
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
|
||||||
|
|
||||||
// this is causing of some plugin's menu not added
|
// this is causing of some plugin's menu not added
|
||||||
|
@ -894,15 +1035,26 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function remove_update_nag( $value ) {
|
function hide_update_notice( $slugs ) {
|
||||||
// if ( isset( $_POST['mainwpsignature'] ) ) {
|
$slugs[] = 'mainwp-child/mainwp-child.php';
|
||||||
// return $value;
|
return $slugs;
|
||||||
// }
|
}
|
||||||
// if ( isset( $value->response['mainwp-child/mainwp-child.php'] ) ) {
|
|
||||||
// unset( $value->response['mainwp-child/mainwp-child.php'] );
|
|
||||||
// }
|
function remove_update_nag( $value ) {
|
||||||
// return $value;
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
// }
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $value->response['mainwp-child/mainwp-child.php'] ) ) {
|
||||||
|
unset( $value->response['mainwp-child/mainwp-child.php'] );
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
public function update_child_header( $plugins, $header ) {
|
public function update_child_header( $plugins, $header ) {
|
||||||
$plugin_key = '';
|
$plugin_key = '';
|
||||||
|
|
|
@ -1250,7 +1250,8 @@ class MainWP_Child_Server_Information {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getServerGetawayInterface() {
|
protected static function getServerGetawayInterface() {
|
||||||
echo esc_html( $_SERVER['GATEWAY_INTERFACE'] );
|
$gate = isset($_SERVER['GATEWAY_INTERFACE']) ? $_SERVER['GATEWAY_INTERFACE'] : '';
|
||||||
|
echo esc_html( $gate );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getServerIP() {
|
public static function getServerIP() {
|
||||||
|
|
|
@ -123,6 +123,9 @@ class MainWP_Child_Skeleton_Key {
|
||||||
|
|
||||||
$full_url = add_query_arg( $get_args, get_site_url() . $url );
|
$full_url = add_query_arg( $get_args, get_site_url() . $url );
|
||||||
|
|
||||||
|
global $mainWPChild;
|
||||||
|
add_filter( 'http_request_args', array( $mainWPChild, 'http_request_reject_unsafe_urls' ), 99, 2 );
|
||||||
|
|
||||||
$response = wp_remote_post( $full_url, $post_args );
|
$response = wp_remote_post( $full_url, $post_args );
|
||||||
|
|
||||||
if ( is_wp_error( $response ) ) {
|
if ( is_wp_error( $response ) ) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ class MainWP_Child_Staging {
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +142,7 @@ class MainWP_Child_Staging {
|
||||||
'fileLimit',
|
'fileLimit',
|
||||||
'batchSize',
|
'batchSize',
|
||||||
'cpuLoad',
|
'cpuLoad',
|
||||||
|
'delayRequests',
|
||||||
'disableAdminLogin',
|
'disableAdminLogin',
|
||||||
'querySRLimit',
|
'querySRLimit',
|
||||||
'maxFileSize',
|
'maxFileSize',
|
||||||
|
@ -393,10 +395,20 @@ class MainWP_Child_Staging {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'wp-staging/wp-staging.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $value->response['wp-staging/wp-staging.php'] ) ) {
|
if ( isset( $value->response['wp-staging/wp-staging.php'] ) ) {
|
||||||
unset( $value->response['wp-staging/wp-staging.php'] );
|
unset( $value->response['wp-staging/wp-staging.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class MainWP_Child_Timecapsule {
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1243,10 +1244,18 @@ function get_sibling_files_callback_wptc() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'wp-time-capsule/wp-time-capsule.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
if ( isset( $value->response['wp-time-capsule/wp-time-capsule.php'] ) ) {
|
if ( isset( $value->response['wp-time-capsule/wp-time-capsule.php'] ) ) {
|
||||||
unset( $value->response['wp-time-capsule/wp-time-capsule.php'] );
|
unset( $value->response['wp-time-capsule/wp-time-capsule.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,57 +421,60 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
}
|
}
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} else if ( 'updraft_googledrive' === $key ) {
|
} else if ( 'updraft_googledrive' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' );
|
// do not saving from dashboard
|
||||||
if (!is_array($opts))
|
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_googledrive' );
|
||||||
$opts = array();
|
// if (!is_array($opts))
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
// $opts = array();
|
||||||
$settings_key = key($opts['settings']);
|
// if(is_array($opts) && isset($opts['settings'])) {
|
||||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
// $settings_key = key($opts['settings']);
|
||||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||||
$opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||||
} else {
|
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
// } else {
|
||||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||||
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||||
}
|
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
// }
|
||||||
|
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} else if ( 'updraft_googlecloud' === $key ) {
|
} else if ( 'updraft_googlecloud' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( $key );
|
// do not saving from dashboard
|
||||||
if (!is_array($opts))
|
// $opts = UpdraftPlus_Options::get_updraft_option( $key );
|
||||||
$opts = array();
|
// if (!is_array($opts))
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
// $opts = array();
|
||||||
$settings_key = key($opts['settings']);
|
// if(is_array($opts) && isset($opts['settings'])) {
|
||||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
// $settings_key = key($opts['settings']);
|
||||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||||
// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id'];
|
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||||
// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path'];
|
//// $opts['settings'][$settings_key]['project_id'] = $settings[ $key ]['project_id'];
|
||||||
$opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class'];
|
//// $opts['settings'][$settings_key]['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||||
$opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location'];
|
// $opts['settings'][$settings_key]['storage_class'] = $settings[ $key ]['storage_class'];
|
||||||
} else {
|
// $opts['settings'][$settings_key]['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
// } else {
|
||||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||||
// $opts['project_id'] = $settings[ $key ]['project_id'];
|
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||||
// $opts['bucket_path'] = $settings[ $key ]['bucket_path'];
|
//// $opts['project_id'] = $settings[ $key ]['project_id'];
|
||||||
$opts['storage_class'] = $settings[ $key ]['storage_class'];
|
//// $opts['bucket_path'] = $settings[ $key ]['bucket_path'];
|
||||||
$opts['bucket_location'] = $settings[ $key ]['bucket_location'];
|
// $opts['storage_class'] = $settings[ $key ]['storage_class'];
|
||||||
}
|
// $opts['bucket_location'] = $settings[ $key ]['bucket_location'];
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
// }
|
||||||
|
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} else if ( 'updraft_onedrive' === $key ) {
|
} else if ( 'updraft_onedrive' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' );
|
// do not saving from dashboard
|
||||||
if (!is_array($opts))
|
// $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_onedrive' );
|
||||||
$opts = array();
|
// if (!is_array($opts))
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
// $opts = array();
|
||||||
$settings_key = key($opts['settings']);
|
// if(is_array($opts) && isset($opts['settings'])) {
|
||||||
// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
// $settings_key = key($opts['settings']);
|
||||||
// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
//// $opts['settings'][$settings_key]['clientid'] = $settings[ $key ]['clientid'];
|
||||||
$opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
//// $opts['settings'][$settings_key]['secret'] = $settings[ $key ]['secret'];
|
||||||
} else {
|
// $opts['settings'][$settings_key]['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
// $opts['clientid'] = $settings[ $key ]['clientid'];
|
// } else {
|
||||||
// $opts['secret'] = $settings[ $key ]['secret'];
|
//// $opts['clientid'] = $settings[ $key ]['clientid'];
|
||||||
$opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
//// $opts['secret'] = $settings[ $key ]['secret'];
|
||||||
}
|
// $opts['folder'] = $this->replace_tokens($settings[ $key ]['folder']);
|
||||||
|
// }
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
//
|
||||||
|
// UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
} else if ( 'updraft_email' === $key ) {
|
} else if ( 'updraft_email' === $key ) {
|
||||||
$value = $settings[ $key ];
|
$value = $settings[ $key ];
|
||||||
// free version
|
// free version
|
||||||
|
@ -600,10 +603,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
if(is_array($opts) && isset($opts['settings'])) {
|
if(is_array($opts) && isset($opts['settings'])) {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][$settings_key]['url'] = $settings[ $key ]['url'];
|
$opts['settings'][$settings_key]['url'] = $this->replace_tokens( $settings[ $key ]['url'] );
|
||||||
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
|
UpdraftPlus_Options::update_updraft_option( 'updraft_webdav', $opts );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( 'updraft_backblaze' === $key ) {
|
} else if ( 'updraft_backblaze' === $key ) {
|
||||||
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
|
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_backblaze' );
|
||||||
if (!is_array($opts))
|
if (!is_array($opts))
|
||||||
|
@ -612,8 +615,14 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
$settings_key = key($opts['settings']);
|
$settings_key = key($opts['settings']);
|
||||||
$opts['settings'][$settings_key]['account_id'] = $settings[ $key ]['account_id'];
|
$opts['settings'][$settings_key]['account_id'] = $settings[ $key ]['account_id'];
|
||||||
$opts['settings'][$settings_key]['key'] = $settings[ $key ]['key'];
|
$opts['settings'][$settings_key]['key'] = $settings[ $key ]['key'];
|
||||||
$opts['settings'][$settings_key]['bucket_name'] = $this->replace_tokens( $settings[ $key ]['bucket_name'] );
|
$bname = $this->replace_tokens( $settings[ $key ]['bucket_name'] );
|
||||||
$opts['settings'][$settings_key]['backup_path'] = $this->replace_tokens( $settings[ $key ]['backup_path'] );
|
$bpath = $this->replace_tokens( $settings[ $key ]['backup_path'] );
|
||||||
|
$bname = str_replace('.', '-', $bname);
|
||||||
|
$bpath = str_replace('.', '-', $bpath);
|
||||||
|
$bname = str_replace('_', '', $bname); // to fix strange character
|
||||||
|
$bpath = str_replace('_', '', $bpath);
|
||||||
|
$opts['settings'][$settings_key]['bucket_name'] = $bname;
|
||||||
|
$opts['settings'][$settings_key]['backup_path'] = $bpath;
|
||||||
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
UpdraftPlus_Options::update_updraft_option( $key, $opts );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -899,7 +908,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
'm' => '<strong>' . __( 'Start backup', 'updraftplus' ) . ':</strong> ' . htmlspecialchars( __( 'OK. You should soon see activity in the "Last log message" field below.', 'updraftplus' ) ),
|
'm' => '<strong>' . __( 'Start backup', 'updraftplus' ) . ':</strong> ' . htmlspecialchars( __( 'OK. You should soon see activity in the "Last log message" field below.', 'updraftplus' ) ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->close_browser_connection( $msg );
|
// to fix issue for some site
|
||||||
|
//$this->close_browser_connection( $msg );
|
||||||
|
|
||||||
$options = array( 'nocloud' => $backupnow_nocloud, 'use_nonce' => $nonce );
|
$options = array( 'nocloud' => $backupnow_nocloud, 'use_nonce' => $nonce );
|
||||||
if ( ! empty( $_REQUEST['onlythisfileentity'] ) && is_string( $_REQUEST['onlythisfileentity'] ) ) {
|
if ( ! empty( $_REQUEST['onlythisfileentity'] ) && is_string( $_REQUEST['onlythisfileentity'] ) ) {
|
||||||
|
@ -910,6 +920,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
|
|
||||||
do_action( $event, apply_filters( 'updraft_backupnow_options', $options, array() ) );
|
do_action( $event, apply_filters( 'updraft_backupnow_options', $options, array() ) );
|
||||||
|
|
||||||
|
return $msg;
|
||||||
|
|
||||||
// not used anymore
|
// not used anymore
|
||||||
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {
|
// if (wp_schedule_single_event(time()+5, $event, array($backupnow_nocloud)) === false) {
|
||||||
// $updraftplus->log("A backup run failed to schedule");
|
// $updraftplus->log("A backup run failed to schedule");
|
||||||
|
@ -920,9 +932,9 @@ class MainWP_Child_Updraft_Plus_Backups {
|
||||||
// //echo htmlspecialchars(__('OK. You should soon see activity in the "Last log message" field below.','updraftplus'))." <a href=\"http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/\"><br>".__('Nothing happening? Follow this link for help.','updraftplus')."</a></div>";
|
// //echo htmlspecialchars(__('OK. You should soon see activity in the "Last log message" field below.','updraftplus'))." <a href=\"http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/\"><br>".__('Nothing happening? Follow this link for help.','updraftplus')."</a></div>";
|
||||||
// $updraftplus->log("A backup run has been scheduled");
|
// $updraftplus->log("A backup run has been scheduled");
|
||||||
// }
|
// }
|
||||||
$out = array( 'result' => 'OK' );
|
// $out = array( 'result' => 'OK' );
|
||||||
|
//
|
||||||
return $out;
|
// return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
function activejobs_list() {
|
function activejobs_list() {
|
||||||
|
@ -3926,6 +3938,7 @@ ENDHERE;
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
add_action( 'wp_before_admin_bar_render', array( $this, 'wp_before_admin_bar_render' ), 99 );
|
add_action( 'wp_before_admin_bar_render', array( $this, 'wp_before_admin_bar_render' ), 99 );
|
||||||
add_action( 'admin_init', array( $this, 'remove_notices' ) );
|
add_action( 'admin_init', array( $this, 'remove_notices' ) );
|
||||||
}
|
}
|
||||||
|
@ -3972,10 +3985,19 @@ ENDHERE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'updraftplus/updraftplus.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $value->response['updraftplus/updraftplus.php'] ) ) {
|
if ( isset( $value->response['updraftplus/updraftplus.php'] ) ) {
|
||||||
unset( $value->response['updraftplus/updraftplus.php'] );
|
unset( $value->response['updraftplus/updraftplus.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,33 +666,35 @@ class MainWP_Child_Wordfence {
|
||||||
$lastcheck = time() - 3600 * 24 * 10; // check 10 days ago
|
$lastcheck = time() - 3600 * 24 * 10; // check 10 days ago
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_table = $wpdb->base_prefix . 'wfStatus';
|
$table_wfStatus = wfDB::networkTable('wfStatus');
|
||||||
|
|
||||||
// to fix prepare sql empty
|
// to fix prepare sql empty
|
||||||
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime >= %d AND level = 1 AND type = 'info' AND msg LIKE ", $lastcheck );
|
$sql = sprintf( "SELECT * FROM {$table_wfStatus} WHERE ctime >= %d AND level = 1 AND type = 'info' AND msg LIKE ", $lastcheck );
|
||||||
$sql .= " 'Scan Complete. %';";
|
$sql .= " 'Scan Complete.%';";
|
||||||
$rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
|
$rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
|
||||||
|
|
||||||
|
$scan_time = array();
|
||||||
if ( $rows ) {
|
if ( $rows ) {
|
||||||
while ( $row = MainWP_Child_DB::fetch_array( $rows ) ) {
|
while ( $row = MainWP_Child_DB::fetch_array( $rows ) ) {
|
||||||
$message = "Wordfence scan completed";
|
$scan_time[$row['ctime']] = $row['msg'];
|
||||||
$scan_time = $row['ctime'];
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $scan_time, $scan_time + 100 ); // to get nearest SUM_FINAL msg
|
if ($scan_time) {
|
||||||
|
$message = "Wordfence scan completed";
|
||||||
|
foreach($scan_time as $ctime => $details) {
|
||||||
|
$sql = sprintf( "SELECT * FROM {$table_wfStatus} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $ctime, $ctime + 100 ); // to get nearest SUM_FINAL msg
|
||||||
$sql .= " 'SUM_FINAL:Scan complete.%';";
|
$sql .= " 'SUM_FINAL:Scan complete.%';";
|
||||||
|
|
||||||
$sum_rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
|
$sum_rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
|
||||||
$result = '';
|
$result = '';
|
||||||
if ($sum_rows) {
|
if ($sum_rows) {
|
||||||
$sum_row = MainWP_Child_DB::fetch_array( $sum_rows );
|
$sum_row = MainWP_Child_DB::fetch_array( $sum_rows );
|
||||||
if (is_array($sum_row) && isset($sum_row['msg'])) {
|
if (is_array($sum_row) && isset($sum_row['msg'])) {
|
||||||
if ( false !== strpos( $sum_row['msg'], 'Congratulations, no problems found' ) ) {
|
$result = $sum_row['msg'];
|
||||||
$result = 'No issues detected';
|
|
||||||
} else {
|
|
||||||
$result = 'Issues Detected';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$details = $row['msg'];
|
do_action( 'mainwp_reports_wordfence_scan', $message, $ctime, $details, $result );
|
||||||
do_action( 'mainwp_reports_wordfence_scan', $message, $scan_time, $details, $result );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,10 +832,11 @@ class MainWP_Child_Wordfence {
|
||||||
|
|
||||||
public function count_attacks_blocked($maxAgeDays) {
|
public function count_attacks_blocked($maxAgeDays) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
$table_wfBlockedIPLog = wfDB::networkTable('wfBlockedIPLog');
|
||||||
$interval = 'FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval ' . $maxAgeDays . ' day)) / 86400)';
|
$interval = 'FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval ' . $maxAgeDays . ' day)) / 86400)';
|
||||||
return $wpdb->get_var(<<<SQL
|
return $wpdb->get_var(<<<SQL
|
||||||
SELECT SUM(blockCount) as blockCount
|
SELECT SUM(blockCount) as blockCount
|
||||||
FROM {$wpdb->prefix}wfBlockedIPLog
|
FROM {$table_wfBlockedIPLog}
|
||||||
WHERE unixday >= {$interval}
|
WHERE unixday >= {$interval}
|
||||||
SQL
|
SQL
|
||||||
);
|
);
|
||||||
|
@ -841,10 +844,9 @@ SQL
|
||||||
|
|
||||||
|
|
||||||
function get_lastscan() {
|
function get_lastscan() {
|
||||||
global $wpdb;
|
|
||||||
$wfdb = new wfDB();
|
$wfdb = new wfDB();
|
||||||
$p = $wpdb->base_prefix;
|
$table_wfStatus = wfDB::networkTable('wfStatus');
|
||||||
$ctime = $wfdb->querySingle("SELECT MAX(ctime) FROM $p"."wfStatus WHERE msg LIKE '%SUM_PREP:Preparing a new scan.%'");
|
$ctime = $wfdb->querySingle("SELECT MAX(ctime) FROM {$table_wfStatus} WHERE msg LIKE '%SUM_PREP:Preparing a new scan.%'");
|
||||||
return $ctime;
|
return $ctime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,9 +1147,8 @@ SQL
|
||||||
if (in_array('other_WFNet', $saving_opts)) {
|
if (in_array('other_WFNet', $saving_opts)) {
|
||||||
if ( ! $opts['other_WFNet'] ) {
|
if ( ! $opts['other_WFNet'] ) {
|
||||||
$wfdb = new wfDB();
|
$wfdb = new wfDB();
|
||||||
global $wpdb;
|
$table_wfBlocks7 = wfDB::networkTable('wfBlocks7');
|
||||||
$p = $wpdb->base_prefix;
|
$wfdb->queryWrite( "delete from {$table_wfBlocks7} where wfsn=1 and permanent=0" );
|
||||||
$wfdb->queryWrite( "delete from $p" . 'wfBlocks where wfsn=1 and permanent=0' );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,7 +1159,7 @@ SQL
|
||||||
$regenerateHtaccess = true;
|
$regenerateHtaccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//error_log(print_r($opts, true));
|
|
||||||
// $to_fix_boolean_values = array(
|
// $to_fix_boolean_values = array(
|
||||||
// 'scansEnabled_checkGSB',
|
// 'scansEnabled_checkGSB',
|
||||||
// 'spamvertizeCheck',
|
// 'spamvertizeCheck',
|
||||||
|
@ -1372,9 +1373,8 @@ SQL
|
||||||
|
|
||||||
if ( ! $opts['other_WFNet'] ) {
|
if ( ! $opts['other_WFNet'] ) {
|
||||||
$wfdb = new wfDB();
|
$wfdb = new wfDB();
|
||||||
global $wpdb;
|
$table_wfBlocks7 = wfDB::networkTable('wfBlocks7');
|
||||||
$p = $wpdb->base_prefix;
|
$wfdb->queryWrite( "delete from {$table_wfBlocks7} where wfsn=1 and permanent=0" );
|
||||||
$wfdb->queryWrite( "delete from $p" . 'wfBlocks where wfsn=1 and permanent=0' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$regenerateHtaccess = false;
|
$regenerateHtaccess = false;
|
||||||
|
@ -1493,51 +1493,109 @@ SQL
|
||||||
}
|
}
|
||||||
|
|
||||||
public function export_settings(){
|
public function export_settings(){
|
||||||
/** @var wpdb $wpdb */
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
|
|
||||||
|
$export = array();
|
||||||
|
|
||||||
|
//Basic Options
|
||||||
$keys = wfConfig::getExportableOptionsKeys();
|
$keys = wfConfig::getExportableOptionsKeys();
|
||||||
$export = array();
|
foreach ($keys as $key) {
|
||||||
foreach($keys as $key){
|
|
||||||
$export[$key] = wfConfig::get($key, '');
|
$export[$key] = wfConfig::get($key, '');
|
||||||
}
|
}
|
||||||
$export['scanScheduleJSON'] = json_encode(wfConfig::get_ser('scanSched', array()));
|
|
||||||
$export['schedMode'] = wfConfig::get('schedMode', '');
|
|
||||||
|
|
||||||
// Any user supplied blocked IPs.
|
//Serialized Options
|
||||||
$export['_blockedIPs'] = $wpdb->get_results('SELECT *, HEX(IP) as IP FROM ' . $wpdb->base_prefix . 'wfBlocks WHERE wfsn = 0 AND permanent = 1');
|
$export['scanSched'] = wfConfig::get_ser('scanSched', array());
|
||||||
|
|
||||||
// Any advanced blocking stuff too.
|
//Table-based Options
|
||||||
$export['_advancedBlocking'] = $wpdb->get_results('SELECT * FROM ' . $wpdb->base_prefix . 'wfBlocksAdv');
|
$export['blocks'] = wfBlock::exportBlocks();
|
||||||
|
|
||||||
|
//Make the API call
|
||||||
try {
|
try {
|
||||||
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
|
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
|
||||||
$res = $api->call('export_options', array(), $export);
|
$res = $api->call('export_options', array(), array('export' => json_encode($export)));
|
||||||
if($res['ok'] && $res['token']){
|
if ($res['ok'] && $res['token']) {
|
||||||
return array(
|
return array(
|
||||||
'ok' => 1,
|
'ok' => 1,
|
||||||
'token' => $res['token'],
|
'token' => $res['token'],
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
throw new Exception("Invalid response: " . var_export($res, true));
|
|
||||||
}
|
}
|
||||||
} catch(Exception $e){
|
else if ($res['err']) {
|
||||||
return array('errorExport' => "An error occurred: " . $e->getMessage());
|
return array('errorExport' => __("An error occurred: ", 'wordfence') . $res['err']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Exception(__("Invalid response: ", 'wordfence') . var_export($res, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return array('errorExport' => __("An error occurred: ", 'wordfence') . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function import_settings(){
|
public function import_settings(){
|
||||||
$token = $_POST['token'];
|
$token = $_POST['token'];
|
||||||
try {
|
try {
|
||||||
$totalSet = wordfence::importSettings($token);
|
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
|
||||||
return array(
|
$res = $api->call('import_options', array(), array('token' => $token));
|
||||||
'ok' => 1,
|
if ($res['ok'] && $res['export']) {
|
||||||
'totalSet' => $totalSet,
|
$totalSet = 0;
|
||||||
'settings' => $this->get_settings()
|
$import = @json_decode($res['export'], true);
|
||||||
);
|
if (!is_array($import)) {
|
||||||
} catch(Exception $e){
|
return array('errorImport' => __("An error occurred: Invalid options format received.", 'wordfence'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Basic Options
|
||||||
|
$keys = wfConfig::getExportableOptionsKeys();
|
||||||
|
$toSet = array();
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
if (isset($import[$key])) {
|
||||||
|
$toSet[$key] = $import[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($toSet)) {
|
||||||
|
$validation = wfConfig::validate($toSet);
|
||||||
|
$skipped = array();
|
||||||
|
if ($validation !== true) {
|
||||||
|
foreach ($validation as $error) {
|
||||||
|
$skipped[$error['option']] = $error['error'];
|
||||||
|
unset($toSet[$error['option']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalSet += count($toSet);
|
||||||
|
wfConfig::save(wfConfig::clean($toSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Serialized Options
|
||||||
|
if (isset($import['scanSched']) && is_array($import['scanSched'])) {
|
||||||
|
wfConfig::set_ser('scanSched', $import['scanSched']);
|
||||||
|
wfScanner::shared()->scheduleScans();
|
||||||
|
$totalSet++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Table-based Options
|
||||||
|
if (isset($import['blocks']) && is_array($import['blocks'])) {
|
||||||
|
wfBlock::importBlocks($import['blocks']);
|
||||||
|
$totalSet += count($import['blocks']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'ok' => 1,
|
||||||
|
'totalSet' => $totalSet,
|
||||||
|
'settings' => $this->get_settings()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if ($res['err']) {
|
||||||
|
return array('errorImport' => "An error occurred: " . $res['err']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Exception("Invalid response: " . var_export($res, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
return array('errorImport' => "An error occurred: " . $e->getMessage());
|
return array('errorImport' => "An error occurred: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_settings() {
|
function get_settings() {
|
||||||
|
@ -1553,15 +1611,15 @@ SQL
|
||||||
|
|
||||||
function ticker() {
|
function ticker() {
|
||||||
$wfdb = new wfDB();
|
$wfdb = new wfDB();
|
||||||
global $wpdb;
|
|
||||||
$p = $wpdb->base_prefix;
|
|
||||||
|
|
||||||
$serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
|
$serverTime = $wfdb->querySingle( 'select unix_timestamp()' );
|
||||||
|
|
||||||
|
$table_wfStatus = wfDB::networkTable('wfStatus');
|
||||||
|
|
||||||
$jsonData = array(
|
$jsonData = array(
|
||||||
'serverTime' => $serverTime,
|
'serverTime' => $serverTime,
|
||||||
'serverMicrotime' => microtime(true),
|
'serverMicrotime' => microtime(true),
|
||||||
'msg' => $wfdb->querySingle( "select msg from $p" . 'wfStatus where level < 3 order by ctime desc limit 1' ),
|
'msg' => $wfdb->querySingle( "select msg from {$table_wfStatus} where level < 3 order by ctime desc limit 1" ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$events = array();
|
$events = array();
|
||||||
|
|
|
@ -12,7 +12,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
|
@ -21,25 +21,26 @@ class MainWP_Child_WP_Rocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
||||||
|
|
||||||
if ( get_option( 'mainwp_wprocket_hide_plugin' ) === 'hide' ) {
|
if ( get_option( 'mainwp_wprocket_hide_plugin' ) === 'hide' ) {
|
||||||
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
add_action( 'wp_before_admin_bar_render', array( $this, 'wp_before_admin_bar_render' ), 99 );
|
add_action( 'wp_before_admin_bar_render', array( $this, 'wp_before_admin_bar_render' ), 99 );
|
||||||
add_action( 'admin_init', array( $this, 'remove_notices' ) );
|
add_action( 'admin_init', array( $this, 'remove_notices' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok
|
// ok
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) {
|
||||||
try{
|
try{
|
||||||
$data = array( 'rocket_boxes' => get_user_meta( $GLOBALS['current_user']->ID, 'rocket_boxes', true ));
|
$data = array( 'rocket_boxes' => get_user_meta( $GLOBALS['current_user']->ID, 'rocket_boxes', true ));
|
||||||
$information['syncWPRocketData'] = $data;
|
$information['syncWPRocketData'] = $data;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +80,20 @@ class MainWP_Child_WP_Rocket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'wp-rocket/wp-rocket.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $value->response['wp-rocket/wp-rocket.php'] ) ) {
|
if ( isset( $value->response['wp-rocket/wp-rocket.php'] ) ) {
|
||||||
unset( $value->response['wp-rocket/wp-rocket.php'] );
|
unset( $value->response['wp-rocket/wp-rocket.php'] );
|
||||||
}
|
}
|
||||||
|
@ -195,7 +206,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function purge_cache_all() {
|
function purge_cache_all() {
|
||||||
if ( function_exists( 'rocket_clean_domain' ) || function_exists( 'rocket_clean_minify' ) || function_exists( 'create_rocket_uniqid' ) ) {
|
if ( function_exists( 'rocket_clean_domain' ) || function_exists( 'rocket_clean_minify' ) || function_exists( 'create_rocket_uniqid' ) ) {
|
||||||
set_transient( 'rocket_clear_cache', 'all', HOUR_IN_SECONDS );
|
set_transient( 'rocket_clear_cache', 'all', HOUR_IN_SECONDS );
|
||||||
// Remove all cache files
|
// Remove all cache files
|
||||||
|
@ -208,7 +219,11 @@ class MainWP_Child_WP_Rocket {
|
||||||
if ( function_exists( 'rocket_clean_cache_busting' )) {
|
if ( function_exists( 'rocket_clean_cache_busting' )) {
|
||||||
rocket_clean_cache_busting();
|
rocket_clean_cache_busting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !function_exists( 'rocket_dismiss_boxes' ) && defined('WP_ROCKET_ADMIN_PATH')) {
|
||||||
|
require_once WP_ROCKET_ADMIN_PATH . 'admin.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Generate a new random key for minify cache file
|
// Generate a new random key for minify cache file
|
||||||
$options = get_option( WP_ROCKET_SLUG );
|
$options = get_option( WP_ROCKET_SLUG );
|
||||||
$options['minify_css_key'] = create_rocket_uniqid();
|
$options['minify_css_key'] = create_rocket_uniqid();
|
||||||
|
@ -248,7 +263,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
if (isset($_POST['do_database_optimization']) && !empty($_POST['do_database_optimization'])) {
|
||||||
$_POST['wp_rocket_settings']['submit_optimize'] = 1; // simulate POST
|
$_POST['wp_rocket_settings']['submit_optimize'] = 1; // simulate POST
|
||||||
}
|
}
|
||||||
|
|
||||||
update_option( WP_ROCKET_SLUG, $options );
|
update_option( WP_ROCKET_SLUG, $options );
|
||||||
|
@ -328,7 +343,7 @@ class MainWP_Child_WP_Rocket {
|
||||||
'deferred_js_files' => array(),
|
'deferred_js_files' => array(),
|
||||||
'lazyload' => 0,
|
'lazyload' => 0,
|
||||||
'lazyload_iframes' => 0,
|
'lazyload_iframes' => 0,
|
||||||
'lazyload_youtube' =>0,
|
'lazyload_youtube' =>0,
|
||||||
'minify_css' => 0,
|
'minify_css' => 0,
|
||||||
// 'minify_css_key' => $minify_css_key,
|
// 'minify_css_key' => $minify_css_key,
|
||||||
'minify_concatenate_css' => 0,
|
'minify_concatenate_css' => 0,
|
||||||
|
|
|
@ -57,6 +57,14 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $nonce ) ) {
|
if ( empty( $nonce ) ) {
|
||||||
|
|
||||||
|
// To fix verify nonce conflict #1
|
||||||
|
// this is fake post field to fix some conflict of wp_verify_nonce()
|
||||||
|
// just return false to unverify nonce, does not exit
|
||||||
|
if ( isset($_POST[$action]) && ($_POST[$action] == 'mainwp-bsm-unverify-nonce')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// to help tracing the conflict verify nonce with other plugins
|
// to help tracing the conflict verify nonce with other plugins
|
||||||
@ob_start();
|
@ob_start();
|
||||||
@debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
@debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
|
@ -64,8 +72,8 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
die( '<mainwp>' . base64_encode( json_encode( array( 'error' => 'You dont send nonce: ' . $action . '<br/>Trace: ' .$stackTrace) ) ) . '</mainwp>' );
|
die( '<mainwp>' . base64_encode( json_encode( array( 'error' => 'You dont send nonce: ' . $action . '<br/>Trace: ' .$stackTrace) ) ) . '</mainwp>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// To fix verify nonce conflict #1
|
// To fix verify nonce conflict #2
|
||||||
// this is fake nonce to fix some conflict of wp_verify_nonce
|
// this is fake nonce to fix some conflict of wp_verify_nonce()
|
||||||
// just return false to unverify nonce, does not exit
|
// just return false to unverify nonce, does not exit
|
||||||
if ($nonce == 'mainwp-bsm-unverify-nonce') {
|
if ($nonce == 'mainwp-bsm-unverify-nonce') {
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,8 +95,8 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// To fix verify nonce conflict #2
|
// To fix verify nonce conflict #3
|
||||||
// this is fake post field to fix some conflict of wp_verify_nonce
|
// this is fake post field to fix some conflict of wp_verify_nonce()
|
||||||
// just return false to unverify nonce, does not exit
|
// just return false to unverify nonce, does not exit
|
||||||
if ( isset($_POST[$action]) && ($_POST[$action] == 'mainwp-bsm-unverify-nonce')) {
|
if ( isset($_POST[$action]) && ($_POST[$action] == 'mainwp-bsm-unverify-nonce')) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -107,7 +115,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWP_Child {
|
class MainWP_Child {
|
||||||
public static $version = '3.5.2';
|
public static $version = '3.5.3';
|
||||||
private $update_version = '1.3';
|
private $update_version = '1.3';
|
||||||
|
|
||||||
private $callableFunctions = array(
|
private $callableFunctions = array(
|
||||||
|
@ -1344,8 +1352,8 @@ class MainWP_Child {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_action( 'admin_init', 'send_frame_options_header' );
|
// remove_action( 'admin_init', 'send_frame_options_header' );
|
||||||
remove_action( 'login_init', 'send_frame_options_header' );
|
// remove_action( 'login_init', 'send_frame_options_header' );
|
||||||
|
|
||||||
// Call Heatmap
|
// Call Heatmap
|
||||||
if ( 'yes' === get_option( 'heatMapExtensionLoaded' ) ) {
|
if ( 'yes' === get_option( 'heatMapExtensionLoaded' ) ) {
|
||||||
|
@ -3729,7 +3737,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
$information['categories'] = $categories;
|
$information['categories'] = $categories;
|
||||||
$get_file_size = apply_filters('mainwp-child-get-total-size', true);
|
$get_file_size = apply_filters('mainwp-child-get-total-size', true);
|
||||||
if ($get_file_size) {
|
if ( $get_file_size && isset( $_POST['cloneSites'] ) && ( '0' !== $_POST['cloneSites'] ) ) {
|
||||||
$max_exe = ini_get( 'max_execution_time' ); // to fix issue of some hosts have limit of execution time
|
$max_exe = ini_get( 'max_execution_time' ); // to fix issue of some hosts have limit of execution time
|
||||||
if ($max_exe > 20) {
|
if ($max_exe > 20) {
|
||||||
$information['totalsize'] = $this->getTotalFileSize();
|
$information['totalsize'] = $this->getTotalFileSize();
|
||||||
|
|
|
@ -439,6 +439,19 @@ class MainWP_Client_Report {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to avoid WC order_note, action_log
|
||||||
|
if ( 'comments' === $context ) {
|
||||||
|
if ( isset( $record->meta ) ) {
|
||||||
|
if ( isset( $record->meta[ 'comment_type' ] ) && is_array($record->meta[ 'comment_type' ])) {
|
||||||
|
$cmtype = current($record->meta[ 'comment_type' ]);
|
||||||
|
if ( $cmtype == 'order_note' || $cmtype == 'action_log') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$count ++;
|
$count ++;
|
||||||
|
@ -716,7 +729,20 @@ class MainWP_Client_Report {
|
||||||
case 'details':
|
case 'details':
|
||||||
case 'result':
|
case 'result':
|
||||||
if ( 'wordfence' === $context || 'maintenance' === $context ) {
|
if ( 'wordfence' === $context || 'maintenance' === $context ) {
|
||||||
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
|
$meta_value = $this->get_stream_meta_data( $record, $data );
|
||||||
|
// to fix
|
||||||
|
if ('wordfence' === $context && $data == 'result') {
|
||||||
|
// SUM_FINAL:Scan complete. You have xxx new issues to fix. See below.
|
||||||
|
// SUM_FINAL:Scan complete. Congratulations, no new problems found
|
||||||
|
if (stripos($meta_value, 'Congratulations')) {
|
||||||
|
$meta_value = 'No issues detected';
|
||||||
|
} else if (stripos($meta_value, 'You have')) {
|
||||||
|
$meta_value = 'Issues Detected';
|
||||||
|
} else {
|
||||||
|
$meta_value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$token_values[ $token ] = $meta_value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'destination': // backup cases
|
case 'destination': // backup cases
|
||||||
|
@ -781,7 +807,7 @@ class MainWP_Client_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_showhide() {
|
function set_showhide() {
|
||||||
MainWP_Helper::update_option( 'mainwp_creport_ext_branding_enabled', 'Y', 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_creport_ext_branding_enabled', 'Y', 'yes' );
|
||||||
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
||||||
MainWP_Helper::update_option( 'mainwp_creport_branding_stream_hide', $hide, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_creport_branding_stream_hide', $hide, 'yes' );
|
||||||
$information['result'] = 'SUCCESS';
|
$information['result'] = 'SUCCESS';
|
||||||
|
@ -790,21 +816,41 @@ class MainWP_Client_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function creport_init() {
|
public function creport_init() {
|
||||||
if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) {
|
// if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$hide_nag = false;
|
||||||
if ( get_option( 'mainwp_creport_branding_stream_hide' ) === 'hide' ) {
|
if ( get_option( 'mainwp_creport_branding_stream_hide' ) === 'hide' ) {
|
||||||
add_filter( 'all_plugins', array( $this, 'creport_branding_plugin' ) );
|
add_filter( 'all_plugins', array( $this, 'creport_branding_plugin' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'creport_remove_menu' ) );
|
add_action( 'admin_menu', array( $this, 'creport_remove_menu' ) );
|
||||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
$hide_nag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( MainWP_Child_Branding::is_branding() ) {
|
||||||
|
$hide_nag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hide_nag) {
|
||||||
|
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||||
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide_update_notice( $slugs ) {
|
||||||
|
$slugs[] = 'mainwp-child-reports/mainwp-child-reports.php';
|
||||||
|
return $slugs;
|
||||||
|
}
|
||||||
|
|
||||||
function remove_update_nag( $value ) {
|
function remove_update_nag( $value ) {
|
||||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! MainWP_Helper::is_screen_with_update()) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ) ) {
|
if ( isset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ) ) {
|
||||||
unset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] );
|
unset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1417,6 +1417,22 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
return function_exists( 'openssl_verify' );
|
return function_exists( 'openssl_verify' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function is_screen_with_update() {
|
||||||
|
|
||||||
|
if ( ( defined('DOING_AJAX') && DOING_AJAX ) || ( defined('DOING_CRON') && DOING_CRON ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (function_exists('get_current_screen')) {
|
||||||
|
$screen = get_current_screen();
|
||||||
|
if ( $screen ) {
|
||||||
|
if ( $screen->base == 'update-core' && $screen->parent_file == 'index.php' ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function check_files_exists( $files = array(), $return = false ) {
|
public static function check_files_exists( $files = array(), $return = false ) {
|
||||||
$missing = array();
|
$missing = array();
|
||||||
if (is_array($files)) {
|
if (is_array($files)) {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
Author: MainWP
|
Author: MainWP
|
||||||
Author URI: https://mainwp.com
|
Author URI: https://mainwp.com
|
||||||
Text Domain: mainwp-child
|
Text Domain: mainwp-child
|
||||||
Version: 3.5.2
|
Version: 3.5.3
|
||||||
*/
|
*/
|
||||||
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
//if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
||||||
header( 'X-Frame-Options: ALLOWALL' );
|
// header( 'X-Frame-Options: ALLOWALL' );
|
||||||
}
|
//}
|
||||||
//header('X-Frame-Options: GOFORIT');
|
//header('X-Frame-Options: GOFORIT');
|
||||||
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ function mainwp_child_autoload( $class_name ) {
|
||||||
|
|
||||||
if ( function_exists( 'spl_autoload_register' ) ) {
|
if ( function_exists( 'spl_autoload_register' ) ) {
|
||||||
spl_autoload_register( 'mainwp_child_autoload' );
|
spl_autoload_register( 'mainwp_child_autoload' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$mainWPChild = new MainWP_Child( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) );
|
$mainWPChild = new MainWP_Child( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) );
|
||||||
register_activation_hook( __FILE__, array( $mainWPChild, 'activation' ) );
|
register_activation_hook( __FILE__, array( $mainWPChild, 'activation' ) );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue