mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
Merge with brand01
* Fixed: issues with displaying broken links data for specific setups * Fixed: compatibility issues with the latest PageSpeed Insights plugin version * Fixed: an issue with publishing "future" posts * Fixed: an issue with sending email alerts in specific setups * Fixed: an issue with saving code snippets in wp-config.php when the file is in a custom location * Fixed: an issue with clearing unused scheduled cron jobs * Added: support for the new PageSpeed Insights plugin options * Updated: disabled the "Remove readme.html" security check feature for WPEngine hosted child sites * Updated: support for detecting premium themes updates
This commit is contained in:
parent
1e11c93c4a
commit
bd4d9d2432
14 changed files with 851 additions and 481 deletions
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
class MainWP_Child_Branding {
|
class MainWP_Child_Branding {
|
||||||
public static $instance = null;
|
public static $instance = null;
|
||||||
protected $child_plugin_dir;
|
|
||||||
protected $settings = null;
|
public $child_plugin_dir;
|
||||||
|
public $child_branding_options = null;
|
||||||
|
|
||||||
static function Instance() {
|
static function Instance() {
|
||||||
if ( null === MainWP_Child_Branding::$instance ) {
|
if ( null === MainWP_Child_Branding::$instance ) {
|
||||||
MainWP_Child_Branding::$instance = new MainWP_Child_Branding();
|
MainWP_Child_Branding::$instance = new MainWP_Child_Branding();
|
||||||
}
|
}
|
||||||
|
|
||||||
return MainWP_Child_Branding::$instance;
|
return MainWP_Child_Branding::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,25 +17,65 @@ class MainWP_Child_Branding {
|
||||||
$this->child_plugin_dir = dirname( dirname( __FILE__ ) );
|
$this->child_plugin_dir = dirname( dirname( __FILE__ ) );
|
||||||
add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
|
add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
|
||||||
add_filter( 'mainwp_child_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 3 );
|
add_filter( 'mainwp_child_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 3 );
|
||||||
|
$this->child_branding_options = $this->init_options();
|
||||||
$label = get_option( 'mainwp_branding_button_contact_label' );
|
|
||||||
if ( ! empty( $label ) ) {
|
|
||||||
$label = stripslashes( $label );
|
|
||||||
} else {
|
|
||||||
$label = 'Contact Support';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->settings['contact_support_label'] = $label;
|
|
||||||
$this->settings['extra_settings'] = get_option( 'mainwp_branding_extra_settings' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init_options(){
|
||||||
|
|
||||||
|
$opts = get_option( 'mainwp_child_branding_settings' );
|
||||||
|
|
||||||
|
if ( !is_array( $opts ) ) {
|
||||||
|
// compatible with old code
|
||||||
|
$opts = array();
|
||||||
|
|
||||||
|
$label = get_option( 'mainwp_branding_button_contact_label' );
|
||||||
|
if ( ! empty( $label ) ) {
|
||||||
|
$label = stripslashes( $label );
|
||||||
|
}
|
||||||
|
|
||||||
|
$opts['contact_label'] = $label;
|
||||||
|
$opts['extra_settings'] = get_option( 'mainwp_branding_extra_settings' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !isset($opts['contact_label']) || empty($opts['contact_label']) ) {
|
||||||
|
$opts['contact_label'] = 'Contact Support';
|
||||||
|
}
|
||||||
|
|
||||||
|
$disconnected = isset( $opts['branding_disconnected'] ) ? $opts['branding_disconnected'] : '';
|
||||||
|
$preserve_branding = isset( $opts['preserve_branding'] ) ? $opts['preserve_branding'] : '';
|
||||||
|
$cancelled_branding = ( $disconnected === 'yes' ) && ! $preserve_branding;
|
||||||
|
|
||||||
|
$opts['cancelled_branding'] = $cancelled_branding;
|
||||||
|
$opts['branding_preserve_title'] = '';
|
||||||
|
|
||||||
|
if ( ! $cancelled_branding ) {
|
||||||
|
if (isset($opts['branding_header'])) {
|
||||||
|
$branding_header = $opts['branding_header'];
|
||||||
|
if ( is_array( $branding_header ) && isset( $branding_header['name'] ) && ! empty( $branding_header['name'] ) ) {
|
||||||
|
$opts['branding_preserve_title'] = stripslashes( $branding_header['name'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_extra_options() {
|
||||||
|
$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))
|
||||||
|
$extra = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $extra;
|
||||||
|
}
|
||||||
|
|
||||||
public function plugin_row_meta( $plugin_meta, $plugin_file, $child_plugin_slug ) {
|
public function plugin_row_meta( $plugin_meta, $plugin_file, $child_plugin_slug ) {
|
||||||
if ( $child_plugin_slug !== $plugin_file ) {
|
if ( $child_plugin_slug !== $plugin_file ) {
|
||||||
return $plugin_meta;
|
return $plugin_meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! self::is_branding() ) {
|
if ( ! $this->is_branding() ) {
|
||||||
return $plugin_meta;
|
return $plugin_meta;
|
||||||
}
|
}
|
||||||
// hide View details links
|
// hide View details links
|
||||||
|
@ -52,6 +92,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function child_deactivation() {
|
public function child_deactivation() {
|
||||||
|
// will remove later
|
||||||
$dell_all = array(
|
$dell_all = array(
|
||||||
'mainwp_branding_disable_change',
|
'mainwp_branding_disable_change',
|
||||||
'mainwp_branding_disable_switching_theme',
|
'mainwp_branding_disable_switching_theme',
|
||||||
|
@ -73,9 +114,40 @@ class MainWP_Child_Branding {
|
||||||
'mainwp_branding_extra_settings',
|
'mainwp_branding_extra_settings',
|
||||||
'mainwp_branding_ext_enabled',
|
'mainwp_branding_ext_enabled',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $dell_all as $opt ) {
|
foreach ( $dell_all as $opt ) {
|
||||||
delete_option( $opt );
|
delete_option( $opt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$brandingOptions_empty = array(
|
||||||
|
'hide',
|
||||||
|
'disable_change',
|
||||||
|
'disable_switching_theme',
|
||||||
|
'show_support',
|
||||||
|
'support_email',
|
||||||
|
'support_message',
|
||||||
|
'remove_restore',
|
||||||
|
'remove_setting',
|
||||||
|
'remove_server_info',
|
||||||
|
'remove_wp_tools',
|
||||||
|
'remove_wp_setting',
|
||||||
|
'remove_permalink',
|
||||||
|
//'branding_header', // don't remove header
|
||||||
|
'contact_label',
|
||||||
|
'email_message',
|
||||||
|
'message_return_sender',
|
||||||
|
'submit_button_title',
|
||||||
|
'extra_settings',
|
||||||
|
'branding_ext_enabled',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($brandingOptions_empty as $opt) {
|
||||||
|
if (isset($this->child_branding_options[$opt])) {
|
||||||
|
$this->child_branding_options[$opt] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $this->child_branding_options );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,8 +167,13 @@ class MainWP_Child_Branding {
|
||||||
if ( ! is_array( $settings ) ) {
|
if ( ! is_array( $settings ) ) {
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
$current_extra_setting = $this->settings['extra_settings'];
|
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_ext_enabled', 'Y', 'yes' );
|
$current_settings = $this->child_branding_options;
|
||||||
|
$current_extra_setting = $this->child_branding_options['extra_settings'];
|
||||||
|
|
||||||
|
//MainWP_Helper::update_option( 'mainwp_branding_ext_enabled', 'Y' );
|
||||||
|
$current_settings['branding_ext_enabled'] = 'Y';
|
||||||
|
|
||||||
$header = array(
|
$header = array(
|
||||||
'name' => $settings['child_plugin_name'],
|
'name' => $settings['child_plugin_name'],
|
||||||
'description' => $settings['child_plugin_desc'],
|
'description' => $settings['child_plugin_desc'],
|
||||||
|
@ -104,23 +181,44 @@ class MainWP_Child_Branding {
|
||||||
'authoruri' => $settings['child_plugin_author_uri'],
|
'authoruri' => $settings['child_plugin_author_uri'],
|
||||||
'pluginuri' => isset($settings['child_plugin_uri']) ? $settings['child_plugin_uri'] : '',
|
'pluginuri' => isset($settings['child_plugin_uri']) ? $settings['child_plugin_uri'] : '',
|
||||||
);
|
);
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'], 'yes' );
|
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_plugin_header', $header, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'], 'yes' ); // to compatible with old version of child report plugin
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] );
|
MainWP_Helper::update_option( 'mainwp_branding_plugin_header', $header, 'yes' ); // to compatible
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_support_email', $settings['child_support_email'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_connection_detail', (isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0) );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools'], 'yes' );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' );
|
// MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_submit_button_title', $settings['child_submit_button_title'] );
|
// MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] );
|
||||||
if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
// MainWP_Helper::update_option( 'mainwp_branding_submit_button_title', $settings['child_submit_button_title'] );
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
// if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
||||||
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_wp_branding', $settings['child_disable_wp_branding'] );
|
||||||
|
// }
|
||||||
|
|
||||||
|
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
||||||
|
$current_settings['branding_header'] = $header;
|
||||||
|
$current_settings['support_email'] = $settings['child_support_email'];
|
||||||
|
$current_settings['support_message'] = $settings['child_support_message'];
|
||||||
|
$current_settings['remove_restore'] = $settings['child_remove_restore'];
|
||||||
|
$current_settings['remove_setting'] = $settings['child_remove_setting'];
|
||||||
|
$current_settings['remove_server_info'] = $settings['child_remove_server_info'];
|
||||||
|
$current_settings['remove_connection_detail'] = isset($settings['child_remove_connection_detail']) ? $settings['child_remove_connection_detail'] : 0 ;
|
||||||
|
$current_settings['remove_wp_tools'] = $settings['child_remove_wp_tools'];
|
||||||
|
$current_settings['remove_wp_setting'] = $settings['child_remove_wp_setting'];
|
||||||
|
$current_settings['remove_permalink'] = $settings['child_remove_permalink'];
|
||||||
|
$current_settings['contact_label'] = $settings['child_button_contact_label'];
|
||||||
|
$current_settings['email_message'] = $settings['child_send_email_message'];
|
||||||
|
$current_settings['return_sender'] = $settings['child_message_return_sender'];
|
||||||
|
$current_settings['submit_button_title'] = $settings['child_submit_button_title'];
|
||||||
|
|
||||||
|
if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
||||||
|
$current_settings['disable_wp_branding'] = $settings['child_disable_wp_branding'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_setting = array(
|
$extra_setting = array(
|
||||||
|
@ -206,31 +304,40 @@ class MainWP_Child_Branding {
|
||||||
$extra_setting['favico_image'] = $current_extra_setting['favico_image'];
|
$extra_setting['favico_image'] = $current_extra_setting['favico_image'];
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_extra_settings', $extra_setting, 'yes' );
|
//MainWP_Helper::update_option( 'mainwp_branding_extra_settings', $extra_setting, 'yes' );
|
||||||
|
$current_settings['extra_settings'] = $extra_setting;
|
||||||
|
|
||||||
|
// keep it to compatible with old version of child reports plugin
|
||||||
if ( $settings['child_plugin_hide'] ) {
|
if ( $settings['child_plugin_hide'] ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', 'T', 'yes' );
|
MainWP_Helper::update_option( 'mainwp_branding_child_hide', 'T', 'yes' );
|
||||||
} else {
|
} else {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', '' );
|
MainWP_Helper::update_option( 'mainwp_branding_child_hide', '' );
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) {
|
||||||
|
// MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' );
|
||||||
|
// } else {
|
||||||
|
// MainWP_Helper::update_option( 'mainwp_branding_show_support', '' );
|
||||||
|
// }
|
||||||
|
|
||||||
if ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) {
|
// if ( $settings['child_disable_change'] ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_show_support', 'T' );
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' );
|
||||||
} else {
|
// } else {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_show_support', '' );
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' );
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ( $settings['child_disable_change'] ) {
|
// if ( $settings['child_disable_switching_theme'] ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_disable_change', 'T' );
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' );
|
||||||
} else {
|
// } else {
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_disable_change', '' );
|
// MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' );
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ( $settings['child_disable_switching_theme'] ) {
|
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', 'T' );
|
$current_settings['show_support'] = ( $settings['child_show_support_button'] && !empty($settings['child_support_email']) ) ? 'T' : '';
|
||||||
} else {
|
$current_settings['disable_change'] = $settings['child_disable_change'] ? 'T' : '';
|
||||||
MainWP_Helper::update_option( 'mainwp_branding_disable_switching_theme', '' );
|
$current_settings['disable_switching_theme'] = $settings['child_disable_switching_theme'] ? 'T' : '';
|
||||||
}
|
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $current_settings );
|
||||||
|
|
||||||
$information['result'] = 'SUCCESS';
|
$information['result'] = 'SUCCESS';
|
||||||
|
|
||||||
|
@ -266,10 +373,8 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
|
|
||||||
public function branding_init() {
|
public function branding_init() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
$extra_setting = $this->get_extra_options();
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to hide updates notice
|
// to hide updates notice
|
||||||
if (is_admin()) {
|
if (is_admin()) {
|
||||||
|
@ -279,27 +384,28 @@ class MainWP_Child_Branding {
|
||||||
// front end
|
// front end
|
||||||
add_action( 'add_admin_bar_menus', array( $this, 'add_admin_bar_menus' ));
|
add_action( 'add_admin_bar_menus', array( $this, 'add_admin_bar_menus' ));
|
||||||
}
|
}
|
||||||
|
$opts = $this->child_branding_options;
|
||||||
|
|
||||||
|
$cancelled_branding = $opts['cancelled_branding'];
|
||||||
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
|
||||||
if ( $cancelled_branding ) {
|
if ( $cancelled_branding ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// enable branding in case child plugin is deactive
|
|
||||||
add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
|
|
||||||
|
|
||||||
if ( self::is_branding() ) {
|
// enable branding in case child plugin deactive and re-activated
|
||||||
|
add_filter( 'all_plugins', array( $this, 'modify_plugin_header' ) );
|
||||||
|
|
||||||
|
if ( $this->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' ) );
|
add_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( get_option( 'mainwp_branding_ext_enabled' ) !== 'Y' ) {
|
if ( !isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'map_meta_cap', array( $this, 'branding_map_meta_cap' ), 10, 5 );
|
add_filter( 'map_meta_cap', array( $this, 'branding_map_meta_cap' ), 10, 5 );
|
||||||
|
|
||||||
if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
|
if ( 'T' === $opts['disable_change']) {
|
||||||
|
|
||||||
// Disable the wordpress plugin update notifications
|
// Disable the wordpress plugin update notifications
|
||||||
remove_action('load-update-core.php', 'wp_update_plugins');
|
remove_action('load-update-core.php', 'wp_update_plugins');
|
||||||
|
@ -323,7 +429,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
// to fix
|
// to fix
|
||||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );//
|
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );//
|
||||||
if ( get_option( 'mainwp_branding_disable_wp_branding' ) !== 'Y' ) {
|
if ( $opts['disable_wp_branding'] !== 'Y' ) {
|
||||||
add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 );
|
add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 );
|
||||||
add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 );
|
add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 );
|
||||||
// branding site generator
|
// branding site generator
|
||||||
|
@ -366,14 +472,17 @@ class MainWP_Child_Branding {
|
||||||
} else if ( !current_user_can( 'administrator' ) ) {
|
} else if ( !current_user_can( 'administrator' ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
$extra_setting = $this->get_extra_options();
|
||||||
$extra_setting = array();
|
if ( empty ( $extra_setting ) ) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if ( 'T' === get_option( 'mainwp_branding_show_support' ) ) {
|
$opts = $this->child_branding_options;
|
||||||
$title = $this->settings['contact_support_label'];
|
|
||||||
|
if ( 'T' === $opts['show_support'] ) {
|
||||||
|
$title = $opts['contact_label'];
|
||||||
if ( isset( $extra_setting['show_button_in'] ) && ( 2 === (int) $extra_setting['show_button_in'] || 3 === (int) $extra_setting['show_button_in'] ) ) {
|
if ( isset( $extra_setting['show_button_in'] ) && ( 2 === (int) $extra_setting['show_button_in'] || 3 === (int) $extra_setting['show_button_in'] ) ) {
|
||||||
$title = $this->settings['contact_support_label'];
|
$title = $opts['contact_label'];
|
||||||
add_menu_page( $title, $title, 'read', 'ContactSupport2', array(
|
add_menu_page( $title, $title, 'read', 'ContactSupport2', array(
|
||||||
$this,
|
$this,
|
||||||
'contact_support',
|
'contact_support',
|
||||||
|
@ -381,7 +490,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $extra_setting['show_button_in'] ) && ( 1 === $extra_setting['show_button_in'] || 3 === $extra_setting['show_button_in'] ) ) {
|
if ( isset( $extra_setting['show_button_in'] ) && ( 1 === $extra_setting['show_button_in'] || 3 === $extra_setting['show_button_in'] ) ) {
|
||||||
add_submenu_page( null, $title, $this->settings['contact_support_label'], 'read', 'ContactSupport', array(
|
add_submenu_page( null, $title, $opts['contact_label'], 'read', 'ContactSupport', array(
|
||||||
$this,
|
$this,
|
||||||
'contact_support',
|
'contact_support',
|
||||||
) );
|
) );
|
||||||
|
@ -392,10 +501,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_default_post_metaboxes() {
|
function remove_default_post_metaboxes() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter( 'manage_posts_columns', array( &$this, 'custom_post_columns' ) );
|
add_filter( 'manage_posts_columns', array( &$this, 'custom_post_columns' ) );
|
||||||
add_filter( 'manage_edit-post_tag_columns', array( &$this, 'manage_my_category_columns' ) );
|
add_filter( 'manage_edit-post_tag_columns', array( &$this, 'manage_my_category_columns' ) );
|
||||||
|
@ -435,10 +541,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
|
|
||||||
function custom_post_columns( $defaults ) {
|
function custom_post_columns( $defaults ) {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset( $extra_setting['hide_metabox_post_comments'] ) && $extra_setting['hide_metabox_post_comments'] ) {
|
if ( isset( $extra_setting['hide_metabox_post_comments'] ) && $extra_setting['hide_metabox_post_comments'] ) {
|
||||||
unset( $defaults['comments'] );
|
unset( $defaults['comments'] );
|
||||||
|
@ -454,10 +557,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function manage_my_category_columns( $defaults ) {
|
function manage_my_category_columns( $defaults ) {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset( $extra_setting['hide_metabox_post_slug'] ) && $extra_setting['hide_metabox_post_slug'] ) {
|
if ( isset( $extra_setting['hide_metabox_post_slug'] ) && $extra_setting['hide_metabox_post_slug'] ) {
|
||||||
unset( $defaults['slug'] );
|
unset( $defaults['slug'] );
|
||||||
|
@ -467,10 +567,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_default_page_metaboxes() {
|
function remove_default_page_metaboxes() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter( 'manage_pages_columns', array( &$this, 'custom_pages_columns' ) );
|
add_filter( 'manage_pages_columns', array( &$this, 'custom_pages_columns' ) );
|
||||||
|
|
||||||
|
@ -498,10 +595,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_pages_columns( $defaults ) {
|
function custom_pages_columns( $defaults ) {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( ! is_array( $extra_setting ) ) {
|
|
||||||
$extra_setting = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset( $extra_setting['hide_metabox_page_comments'] ) && $extra_setting['hide_metabox_page_comments'] ) {
|
if ( isset( $extra_setting['hide_metabox_page_comments'] ) && $extra_setting['hide_metabox_page_comments'] ) {
|
||||||
unset( $defaults['comments'] );
|
unset( $defaults['comments'] );
|
||||||
|
@ -541,14 +635,14 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function admin_footer_text() {
|
function admin_footer_text() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
||||||
echo wp_kses_post( nl2br( stripslashes( $extra_setting['dashboard_footer'] ) ) );
|
echo wp_kses_post( nl2br( stripslashes( $extra_setting['dashboard_footer'] ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_favicon_frontend() {
|
function custom_favicon_frontend() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['favico_image']['url'] ) && ! empty( $extra_setting['favico_image']['url'] ) ) {
|
if ( isset( $extra_setting['favico_image']['url'] ) && ! empty( $extra_setting['favico_image']['url'] ) ) {
|
||||||
$favico = $extra_setting['favico_image']['url'];
|
$favico = $extra_setting['favico_image']['url'];
|
||||||
echo '<link rel="shortcut icon" href="' . esc_url( $favico ) . '"/>' . "\n";
|
echo '<link rel="shortcut icon" href="' . esc_url( $favico ) . '"/>' . "\n";
|
||||||
|
@ -556,7 +650,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_login_logo() {
|
function custom_login_logo() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['login_image']['url'] ) && ! empty( $extra_setting['login_image']['url'] ) ) {
|
if ( isset( $extra_setting['login_image']['url'] ) && ! empty( $extra_setting['login_image']['url'] ) ) {
|
||||||
$login_logo = $extra_setting['login_image']['url'];
|
$login_logo = $extra_setting['login_image']['url'];
|
||||||
echo '<style type="text/css">
|
echo '<style type="text/css">
|
||||||
|
@ -567,7 +661,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
function custom_login_headerurl( $value ) {
|
function custom_login_headerurl( $value ) {
|
||||||
|
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['login_image_link'] ) && ! empty( $extra_setting['login_image_link'] ) ) {
|
if ( isset( $extra_setting['login_image_link'] ) && ! empty( $extra_setting['login_image_link'] ) ) {
|
||||||
return $extra_setting['login_image_link'];
|
return $extra_setting['login_image_link'];
|
||||||
}
|
}
|
||||||
|
@ -577,7 +671,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
function custom_login_headertitle( $value ) {
|
function custom_login_headertitle( $value ) {
|
||||||
|
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['login_image_title'] ) && ! empty( $extra_setting['login_image_title'] ) ) {
|
if ( isset( $extra_setting['login_image_title'] ) && ! empty( $extra_setting['login_image_title'] ) ) {
|
||||||
return $extra_setting['login_image_title'];
|
return $extra_setting['login_image_title'];
|
||||||
}
|
}
|
||||||
|
@ -586,7 +680,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_gettext( $translations, $text, $domain = 'default' ) {
|
function custom_gettext( $translations, $text, $domain = 'default' ) {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
$texts_replace = $extra_setting['texts_replace'];
|
$texts_replace = $extra_setting['texts_replace'];
|
||||||
if ( is_array( $texts_replace ) && count( $texts_replace ) > 0 ) {
|
if ( is_array( $texts_replace ) && count( $texts_replace ) > 0 ) {
|
||||||
foreach ( $texts_replace as $text => $replace ) {
|
foreach ( $texts_replace as $text => $replace ) {
|
||||||
|
@ -601,9 +695,9 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
function custom_admin_css() {
|
function custom_admin_css() {
|
||||||
$header_css = '';
|
$header_css = '';
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
|
|
||||||
if ( is_array( $extra_setting ) && isset( $extra_setting['admin_css'] ) && ! empty( $extra_setting['admin_css'] ) ) {
|
if ( isset( $extra_setting['admin_css'] ) && ! empty( $extra_setting['admin_css'] ) ) {
|
||||||
$header_css .= $extra_setting['admin_css'];
|
$header_css .= $extra_setting['admin_css'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,14 +716,14 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_login_css() {
|
function custom_login_css() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( is_array( $extra_setting ) && isset( $extra_setting['login_css'] ) && ! empty( $extra_setting['login_css'] ) ) {
|
if ( isset( $extra_setting['login_css'] ) && ! empty( $extra_setting['login_css'] ) ) {
|
||||||
echo '<style>' . MainWP_Helper::parse_css( $extra_setting['login_css'] ) . '</style>';
|
echo '<style>' . MainWP_Helper::parse_css( $extra_setting['login_css'] ) . '</style>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_the_generator( $generator, $type = '' ) {
|
function custom_the_generator( $generator, $type = '' ) {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['site_generator'] ) ) {
|
if ( isset( $extra_setting['site_generator'] ) ) {
|
||||||
if ( ! empty( $extra_setting['site_generator'] ) ) {
|
if ( ! empty( $extra_setting['site_generator'] ) ) {
|
||||||
switch ( $type ) :
|
switch ( $type ) :
|
||||||
|
@ -671,7 +765,7 @@ class MainWP_Child_Branding {
|
||||||
|
|
||||||
function custom_dashboard_widgets() {
|
function custom_dashboard_widgets() {
|
||||||
global $wp_meta_boxes;
|
global $wp_meta_boxes;
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['remove_widget_welcome'] ) && $extra_setting['remove_widget_welcome'] ) {
|
if ( isset( $extra_setting['remove_widget_welcome'] ) && $extra_setting['remove_widget_welcome'] ) {
|
||||||
remove_action( 'welcome_panel', 'wp_welcome_panel' );
|
remove_action( 'welcome_panel', 'wp_welcome_panel' );
|
||||||
}
|
}
|
||||||
|
@ -690,28 +784,28 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function branding_global_footer() {
|
public function branding_global_footer() {
|
||||||
$extra_setting = $this->settings['extra_settings'];
|
$extra_setting = $this->get_extra_options();
|
||||||
if ( isset( $extra_setting['global_footer'] ) && ! empty( $extra_setting['global_footer'] ) ) {
|
if ( isset( $extra_setting['global_footer'] ) && ! empty( $extra_setting['global_footer'] ) ) {
|
||||||
echo wp_kses_post( nl2br( stripslashes( $extra_setting['global_footer'] ) ) );
|
echo wp_kses_post( nl2br( stripslashes( $extra_setting['global_footer'] ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function send_support_mail() {
|
public function send_support_mail() {
|
||||||
$email = get_option( 'mainwp_branding_support_email' );
|
$email = $this->child_branding_options['support_email'];
|
||||||
$sub = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_subject'] ) ) );
|
$sub = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_subject'] ) ) );
|
||||||
$subject = !empty( $sub ) ? $sub : "MainWP - Support Contact";
|
$subject = !empty( $sub ) ? $sub : "MainWP - Support Contact";
|
||||||
$content = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_content'] ) ) );
|
$content = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_content'] ) ) );
|
||||||
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
|
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
|
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
|
||||||
$headers .= "From: \"" . $current_user->user_email . "\" <" . $current_user->user_email . ">\r\n";
|
//$headers .= "From: \"" . $current_user->user_email . "\" <" . $current_user->user_email . ">\r\n";
|
||||||
$mail .= "<p>Support Email from: <a href='" . site_url() . "'>" . site_url() . "</a></p>\r\n\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>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";
|
$mail .= "<p>Client Email: " . $current_user->user_email . " </p>\r\n\r\n";
|
||||||
$mail .= "<p>Support Text:</p>\r\n\r\n";
|
$mail .= "<p>Support Text:</p>\r\n\r\n";
|
||||||
$mail .= "<p>" . $content . "</p>\r\n\r\n";
|
$mail .= "<p>" . $content . "</p>\r\n\r\n";
|
||||||
|
|
||||||
if ( wp_mail( $email, $subject, $mail, $headers ) ) {
|
if ( @wp_mail( $email, $subject, $mail, $headers ) ) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,17 +830,19 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
|
$opts = $this->child_branding_options;
|
||||||
|
|
||||||
if ( isset( $_POST['submit'] ) ) {
|
if ( isset( $_POST['submit'] ) ) {
|
||||||
if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], '_contactNonce' ) ) {
|
if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], '_contactNonce' ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$from_page = $_POST['mainwp_branding_send_from_page'];
|
$from_page = $_POST['mainwp_branding_send_from_page'];
|
||||||
$back_link = get_option( 'mainwp_branding_message_return_sender' );
|
$back_link = $opts['message_return_sender'];
|
||||||
$back_link = ! empty( $back_link ) ? $back_link : 'Go Back';
|
$back_link = ! empty( $back_link ) ? $back_link : 'Go Back';
|
||||||
$back_link = ! empty( $from_page ) ? '<a href="' . esc_url( $from_page ) . '" title="' . esc_attr( $back_link ) . '">' . esc_html( $back_link ) . '</a>' : '';
|
$back_link = ! empty( $from_page ) ? '<a href="' . esc_url( $from_page ) . '" title="' . esc_attr( $back_link ) . '">' . esc_html( $back_link ) . '</a>' : '';
|
||||||
|
|
||||||
if ( $this->send_support_mail() ) {
|
if ( $this->send_support_mail() ) {
|
||||||
$send_email_message = get_option( 'mainwp_branding_send_email_message' );
|
$send_email_message = $opts['send_email_message'];
|
||||||
if ( ! empty( $send_email_message ) ) {
|
if ( ! empty( $send_email_message ) ) {
|
||||||
$send_email_message = stripslashes( $send_email_message );
|
$send_email_message = stripslashes( $send_email_message );
|
||||||
} else {
|
} else {
|
||||||
|
@ -768,12 +864,12 @@ class MainWP_Child_Branding {
|
||||||
$from_page = urldecode( $fullurl );
|
$from_page = urldecode( $fullurl );
|
||||||
}
|
}
|
||||||
|
|
||||||
$support_message = get_option( 'mainwp_branding_support_message' );
|
$support_message = $opts['support_message'];
|
||||||
$support_message = nl2br( stripslashes( $support_message ) );
|
$support_message = nl2br( stripslashes( $support_message ) );
|
||||||
?>
|
?>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<div style="width: 99%;">
|
<div style="width: 99%;">
|
||||||
<h2><?php echo esc_html( $this->settings['contact_support_label'] ); ?></h2>
|
<h2><?php echo esc_html( $opts['contact_label'] ); ?></h2>
|
||||||
|
|
||||||
<div style="height: auto; margin-bottom: 10px; text-align: left">
|
<div style="height: auto; margin-bottom: 10px; text-align: left">
|
||||||
<p><?php echo wp_kses_post( $support_message ); ?></p>
|
<p><?php echo wp_kses_post( $support_message ); ?></p>
|
||||||
|
@ -796,7 +892,7 @@ class MainWP_Child_Branding {
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<?php
|
<?php
|
||||||
$button_title = get_option( 'mainwp_branding_submit_button_title' );
|
$button_title = $opts['submit_button_title'];
|
||||||
$button_title = ! empty( $button_title ) ? $button_title : __( 'Submit' );
|
$button_title = ! empty( $button_title ) ? $button_title : __( 'Submit' );
|
||||||
?>
|
?>
|
||||||
<input id="mainwp-branding-contact-support-submit" type="submit" name="submit"
|
<input id="mainwp-branding-contact-support-submit" type="submit" name="submit"
|
||||||
|
@ -827,47 +923,59 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
$args = array(
|
$args = array(
|
||||||
'id' => 999,
|
'id' => 999,
|
||||||
'title' => $this->settings['contact_support_label'],
|
'title' => $this->child_branding_options['contact_label'],
|
||||||
'parent' => 'top-secondary',
|
'parent' => 'top-secondary',
|
||||||
'href' => $href,
|
'href' => $href,
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'class' => 'mainwp_branding_support_top_bar_button',
|
'class' => 'mainwp_branding_support_top_bar_button',
|
||||||
'title' => $this->settings['contact_support_label'],
|
'title' => $this->child_branding_options['contact_label'],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_node( $args );
|
$wp_admin_bar->add_node( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function is_branding() {
|
public function is_branding() {
|
||||||
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
$opts = $this->child_branding_options;
|
||||||
if ( $cancelled_branding ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// hide
|
if (!isset($opts['branding_ext_enabled']) || $opts['branding_ext_enabled'] !== 'Y') {
|
||||||
if ( 'T' === get_option( 'mainwp_branding_child_hide' ) ) {
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
// branding
|
|
||||||
$header = get_option( 'mainwp_branding_plugin_header' );
|
|
||||||
if ( is_array( $header ) && ! empty( $header['name'] ) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
$is_hide = isset( $opts['hide'] ) ? $opts['hide'] : '';
|
||||||
|
$cancelled_branding = $opts['cancelled_branding'];
|
||||||
|
$branding_header = isset( $opts['branding_header'] ) ? $opts['branding_header'] : '';
|
||||||
|
|
||||||
|
if ( $cancelled_branding ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// hide
|
||||||
|
if ( 'T' === $is_hide ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ( is_array( $branding_header ) && !empty( $branding_header['name'] ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_branding() {
|
public function get_branding_title() {
|
||||||
if ( self::is_branding() ) {
|
if ( $this->is_branding() ) {
|
||||||
$header = get_option( 'mainwp_branding_plugin_header' );
|
$branding_header = $this->child_branding_options['branding_header'];
|
||||||
|
return $branding_header['name'];
|
||||||
return $header['name'];
|
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
return 'MainWP';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_branding_options() {
|
||||||
|
return $this->child_branding_options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save_branding_options( $name, $val ) {
|
||||||
|
$this->child_branding_options[$name] = $val;
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $this->child_branding_options );
|
||||||
|
}
|
||||||
|
|
||||||
public function add_admin_bar_menus() {
|
public function add_admin_bar_menus() {
|
||||||
|
|
||||||
$hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array());
|
$hide_slugs = apply_filters('mainwp_child_hide_update_notice' , array());
|
||||||
|
@ -998,15 +1106,7 @@ class MainWP_Child_Branding {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
|
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
|
||||||
|
if ( isset($this->child_branding_options['disable_switching_theme']) && 'T' === $this->child_branding_options['disable_switching_theme'] ) {
|
||||||
// this is causing of some plugin's menu not added
|
|
||||||
// if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
|
|
||||||
// // disable: edit, update, install, active themes and plugins
|
|
||||||
// if ( false !== strpos( $cap, 'plugins' ) || false !== strpos( $cap, 'themes' ) || 'edit_theme_options' === $cap ) {
|
|
||||||
// $caps[0] = 'do_not_allow';
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if ( 'T' === get_option( 'mainwp_branding_disable_switching_theme' ) ) {
|
|
||||||
// disable: theme switching
|
// disable: theme switching
|
||||||
if ( 'switch_themes' === $cap ) {
|
if ( 'switch_themes' === $cap ) {
|
||||||
$caps[0] = 'do_not_allow';
|
$caps[0] = 'do_not_allow';
|
||||||
|
@ -1015,24 +1115,35 @@ class MainWP_Child_Branding {
|
||||||
return $caps;
|
return $caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function branding_child_plugin( $plugins ) {
|
public function modify_plugin_header( $plugins ) {
|
||||||
if ( 'T' === get_option( 'mainwp_branding_child_hide' ) ) {
|
$opts = $this->child_branding_options;
|
||||||
foreach ( $plugins as $key => $value ) {
|
if ( is_array($opts) ) {
|
||||||
$plugin_slug = basename( $key, '.php' );
|
$is_hide = isset( $opts['hide'] ) ? $opts['hide'] : '';
|
||||||
if ( 'mainwp-child' === $plugin_slug ) {
|
$cancelled_branding = $opts['cancelled_branding'];
|
||||||
unset( $plugins[ $key ] );
|
$branding_header = isset( $opts['branding_header'] ) ? $opts['branding_header'] : '';
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $plugins;
|
if ( $cancelled_branding ) {
|
||||||
}
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
$header = get_option( 'mainwp_branding_plugin_header' );
|
if ( $is_hide === 'T' ) {
|
||||||
if ( is_array( $header ) && ! empty( $header['name'] ) ) {
|
foreach ( $plugins as $key => $value ) {
|
||||||
return $this->update_child_header( $plugins, $header );
|
$plugin_slug = basename( $key, '.php' );
|
||||||
} else {
|
if ( 'mainwp-child-reports' === $plugin_slug ) {
|
||||||
return $plugins;
|
unset( $plugins[ $key ] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) {
|
||||||
|
return $this->update_plugin_header( $plugins, $branding_header );
|
||||||
|
} else {
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide_update_notice( $slugs ) {
|
function hide_update_notice( $slugs ) {
|
||||||
|
@ -1056,7 +1167,7 @@ class MainWP_Child_Branding {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_child_header( $plugins, $header ) {
|
public function update_plugin_header( $plugins, $header ) {
|
||||||
$plugin_key = '';
|
$plugin_key = '';
|
||||||
foreach ( $plugins as $key => $value ) {
|
foreach ( $plugins as $key => $value ) {
|
||||||
$plugin_slug = basename( $key, '.php' );
|
$plugin_slug = basename( $key, '.php' );
|
||||||
|
|
|
@ -18,12 +18,12 @@ class MainWP_Child_Links_Checker {
|
||||||
if ( is_plugin_active( 'broken-link-checker/broken-link-checker.php' ) ) {
|
if ( is_plugin_active( 'broken-link-checker/broken-link-checker.php' ) ) {
|
||||||
$this->is_plugin_installed = true;
|
$this->is_plugin_installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$this->is_plugin_installed )
|
if ( !$this->is_plugin_installed )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function action() {
|
public function action() {
|
||||||
|
@ -33,7 +33,8 @@ class MainWP_Child_Links_Checker {
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
blc_init();
|
blc_init();
|
||||||
|
|
||||||
|
MainWP_Helper::update_option( 'mainwp_linkschecker_ext_enabled', 'Y', 'yes' );
|
||||||
// need this try()
|
// need this try()
|
||||||
try {
|
try {
|
||||||
if ( isset( $_POST['mwp_action'] ) ) {
|
if ( isset( $_POST['mwp_action'] ) ) {
|
||||||
|
@ -100,7 +101,7 @@ class MainWP_Child_Links_Checker {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_settings() {
|
function save_settings() {
|
||||||
$information = array();
|
$information = array();
|
||||||
$check_threshold = intval( $_POST['check_threshold'] );
|
$check_threshold = intval( $_POST['check_threshold'] );
|
||||||
if ( $check_threshold > 0 ) {
|
if ( $check_threshold > 0 ) {
|
||||||
$conf = blc_get_configuration();
|
$conf = blc_get_configuration();
|
||||||
|
@ -186,7 +187,6 @@ class MainWP_Child_Links_Checker {
|
||||||
|
|
||||||
|
|
||||||
function set_showhide() {
|
function set_showhide() {
|
||||||
MainWP_Helper::update_option( 'mainwp_linkschecker_ext_enabled', 'Y', 'yes' );
|
|
||||||
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
||||||
MainWP_Helper::update_option( 'mainwp_linkschecker_hide_plugin', $hide );
|
MainWP_Helper::update_option( 'mainwp_linkschecker_hide_plugin', $hide );
|
||||||
$information['result'] = 'SUCCESS';
|
$information['result'] = 'SUCCESS';
|
||||||
|
@ -195,106 +195,106 @@ class MainWP_Child_Links_Checker {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok
|
// ok
|
||||||
public function syncOthersData( $information, $data = array() ) {
|
public function syncOthersData( $information, $data = array() ) {
|
||||||
if ( isset( $data['syncBrokenLinksCheckerData'] ) && $data['syncBrokenLinksCheckerData'] ) {
|
if ( isset( $data['syncBrokenLinksCheckerData'] ) && $data['syncBrokenLinksCheckerData'] ) {
|
||||||
try{
|
try{
|
||||||
$information['syncBrokenLinksCheckerData'] = $this->get_sync_data();
|
$information['syncBrokenLinksCheckerData'] = $this->get_sync_data();
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_sync_data( $strategy = '' ) {
|
function get_sync_data( $strategy = '' ) {
|
||||||
$information = array();
|
$information = array();
|
||||||
$data = $this->get_count_links();
|
$data = $this->get_count_links();
|
||||||
if (is_array($data))
|
if (is_array($data))
|
||||||
$information['data'] = $data;
|
$information['data'] = $data;
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_links_data() {
|
function get_links_data() {
|
||||||
|
|
||||||
if (!defined('BLC_DIRECTORY')) return;
|
if (!defined('BLC_DIRECTORY')) return;
|
||||||
|
|
||||||
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
||||||
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
|
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
|
||||||
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
||||||
|
|
||||||
require_once $file_path1;
|
require_once $file_path1;
|
||||||
require_once $file_path2;
|
require_once $file_path2;
|
||||||
|
|
||||||
MainWP_Helper::check_classes_exists('blcLinkQuery');
|
MainWP_Helper::check_classes_exists('blcLinkQuery');
|
||||||
MainWP_Helper::check_methods('blcLinkQuery', 'getInstance');
|
MainWP_Helper::check_methods('blcLinkQuery', 'getInstance');
|
||||||
|
|
||||||
$blc_link_query = blcLinkQuery::getInstance();
|
$blc_link_query = blcLinkQuery::getInstance();
|
||||||
|
|
||||||
MainWP_Helper::check_methods($blc_link_query, 'get_filter_links');
|
MainWP_Helper::check_methods($blc_link_query, 'get_filter_links');
|
||||||
|
|
||||||
$total = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
|
$total = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
|
||||||
|
|
||||||
|
|
||||||
$max_results = isset($_POST['max_results']) ? intval($_POST['max_results']) : 50;
|
$max_results = isset($_POST['max_results']) ? intval($_POST['max_results']) : 50;
|
||||||
$offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
|
$offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
array( 'load_instances' => true ),
|
array( 'load_instances' => true ),
|
||||||
'max_results' => $max_results
|
'max_results' => $max_results
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($offset)) {
|
if (empty($offset)) {
|
||||||
$first_sync = true;
|
$first_sync = true;
|
||||||
} else {
|
} else {
|
||||||
$params['offset'] = $offset;
|
$params['offset'] = $offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
$link_data = $this->links_checker_data($params);
|
$link_data = $this->links_checker_data($params);
|
||||||
|
|
||||||
$total_sync = 0;
|
$total_sync = 0;
|
||||||
if ($offset){
|
if ($offset){
|
||||||
$total_sync = $offset;
|
$total_sync = $offset;
|
||||||
}
|
}
|
||||||
$total_sync += (is_array($link_data) ? count($link_data) : 0);
|
$total_sync += (is_array($link_data) ? count($link_data) : 0);
|
||||||
|
|
||||||
$information = array('links_data' => $link_data);
|
$information = array('links_data' => $link_data);
|
||||||
|
|
||||||
if ($first_sync) {
|
if ($first_sync) {
|
||||||
$information['data'] = $this->get_count_links();
|
$information['data'] = $this->get_count_links();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total > $offset + $max_results ) {
|
if ($total > $offset + $max_results ) {
|
||||||
$information['sync_offset'] = $offset + $max_results;
|
$information['sync_offset'] = $offset + $max_results;
|
||||||
} else {
|
} else {
|
||||||
$information['last_sync'] = 1;
|
$information['last_sync'] = 1;
|
||||||
$information['total_sync'] = $total_sync;
|
$information['total_sync'] = $total_sync;
|
||||||
$information['data'] = $this->get_count_links();
|
$information['data'] = $this->get_count_links();
|
||||||
}
|
}
|
||||||
|
|
||||||
$information['result'] = 'success';
|
$information['result'] = 'success';
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_count_links() {
|
function get_count_links() {
|
||||||
if (!defined('BLC_DIRECTORY')) return;
|
if (!defined('BLC_DIRECTORY')) return;
|
||||||
|
|
||||||
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
$file_path1 = BLC_DIRECTORY . '/includes/link-query.php';
|
||||||
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
|
$file_path2 = BLC_DIRECTORY . '/includes/modules.php';
|
||||||
|
|
||||||
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
MainWP_Helper::check_files_exists(array( $file_path1, $file_path2 ));
|
||||||
|
|
||||||
require_once $file_path1;
|
require_once $file_path1;
|
||||||
require_once $file_path2;
|
require_once $file_path2;
|
||||||
|
|
||||||
MainWP_Helper::check_classes_exists('blcLinkQuery');
|
MainWP_Helper::check_classes_exists('blcLinkQuery');
|
||||||
MainWP_Helper::check_methods('blcLinkQuery', 'getInstance');
|
MainWP_Helper::check_methods('blcLinkQuery', 'getInstance');
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$blc_link_query = blcLinkQuery::getInstance();
|
$blc_link_query = blcLinkQuery::getInstance();
|
||||||
|
|
||||||
MainWP_Helper::check_methods($blc_link_query, 'get_filter_links');
|
MainWP_Helper::check_methods($blc_link_query, 'get_filter_links');
|
||||||
|
|
||||||
$data['broken'] = $blc_link_query->get_filter_links( 'broken', array( 'count_only' => true ) );
|
$data['broken'] = $blc_link_query->get_filter_links( 'broken', array( 'count_only' => true ) );
|
||||||
$data['redirects'] = $blc_link_query->get_filter_links( 'redirects', array( 'count_only' => true ) );
|
$data['redirects'] = $blc_link_query->get_filter_links( 'redirects', array( 'count_only' => true ) );
|
||||||
$data['dismissed'] = $blc_link_query->get_filter_links( 'dismissed', array( 'count_only' => true ) );
|
$data['dismissed'] = $blc_link_query->get_filter_links( 'dismissed', array( 'count_only' => true ) );
|
||||||
|
@ -302,14 +302,14 @@ class MainWP_Child_Links_Checker {
|
||||||
$data['all'] = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
|
$data['all'] = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function links_checker_data($params) {
|
function links_checker_data($params) {
|
||||||
|
|
||||||
MainWP_Helper::check_functions('blc_get_links');
|
MainWP_Helper::check_functions('blc_get_links');
|
||||||
MainWP_Helper::check_classes_exists('blcLink');
|
MainWP_Helper::check_classes_exists('blcLink');
|
||||||
|
|
||||||
$links = blc_get_links( $params );
|
$links = blc_get_links( $params );
|
||||||
|
|
||||||
$filter_fields = array(
|
$filter_fields = array(
|
||||||
'link_id',
|
'link_id',
|
||||||
'url',
|
'url',
|
||||||
|
@ -332,10 +332,10 @@ class MainWP_Child_Links_Checker {
|
||||||
'dismissed',
|
'dismissed',
|
||||||
'status_text',
|
'status_text',
|
||||||
'status_code',
|
'status_code',
|
||||||
'log'
|
'log'
|
||||||
);
|
);
|
||||||
$return = array();
|
$return = array();
|
||||||
|
|
||||||
$blc_option = get_option( 'wsblc_options' );
|
$blc_option = get_option( 'wsblc_options' );
|
||||||
|
|
||||||
if ( is_string( $blc_option ) && ! empty( $blc_option ) ) {
|
if ( is_string( $blc_option ) && ! empty( $blc_option ) ) {
|
||||||
|
@ -348,47 +348,47 @@ class MainWP_Child_Links_Checker {
|
||||||
foreach ( $filter_fields as $field ) {
|
foreach ( $filter_fields as $field ) {
|
||||||
$new_link->$field = $link->$field;
|
$new_link->$field = $link->$field;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_info = array();
|
$extra_info = array();
|
||||||
|
|
||||||
if ( ! empty( $link->post_date ) ) {
|
if ( ! empty( $link->post_date ) ) {
|
||||||
$extra_info['post_date'] = $link->post_date;
|
$extra_info['post_date'] = $link->post_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
$days_broken = 0;
|
$days_broken = 0;
|
||||||
if ( $link->broken ) {
|
if ( $link->broken ) {
|
||||||
//Add a highlight to broken links that appear to be permanently broken
|
//Add a highlight to broken links that appear to be permanently broken
|
||||||
$days_broken = intval( ( time() - $link->first_failure ) / ( 3600 * 24 ) );
|
$days_broken = intval( ( time() - $link->first_failure ) / ( 3600 * 24 ) );
|
||||||
if ( $days_broken >= $blc_option['failure_duration_threshold'] ) {
|
if ( $days_broken >= $blc_option['failure_duration_threshold'] ) {
|
||||||
$extra_info['permanently_broken'] = 1;
|
$extra_info['permanently_broken'] = 1;
|
||||||
if ( $blc_option['highlight_permanent_failures'] ) {
|
if ( $blc_option['highlight_permanent_failures'] ) {
|
||||||
$extra_info['permanently_broken_highlight'] = 1;
|
$extra_info['permanently_broken_highlight'] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$extra_info['days_broken'] = $days_broken;
|
$extra_info['days_broken'] = $days_broken;
|
||||||
$instances = false;
|
$instances = false;
|
||||||
|
|
||||||
$get_link = new blcLink( intval( $link->link_id ) );
|
$get_link = new blcLink( intval( $link->link_id ) );
|
||||||
if ( $get_link->valid() ) {
|
if ( $get_link->valid() ) {
|
||||||
MainWP_Helper::check_methods($get_link, 'get_instances');
|
MainWP_Helper::check_methods($get_link, 'get_instances');
|
||||||
$instances = $get_link->get_instances();
|
$instances = $get_link->get_instances();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $instances ) ) {
|
if ( ! empty( $instances ) ) {
|
||||||
$first_instance = reset( $instances );
|
$first_instance = reset( $instances );
|
||||||
|
|
||||||
MainWP_Helper::check_methods($first_instance, array( 'ui_get_link_text', 'get_container', 'is_link_text_editable', 'is_url_editable') );
|
MainWP_Helper::check_methods($first_instance, array( 'ui_get_link_text', 'get_container', 'is_link_text_editable', 'is_url_editable') );
|
||||||
|
|
||||||
$new_link->link_text = $first_instance->ui_get_link_text();
|
$new_link->link_text = $first_instance->ui_get_link_text();
|
||||||
$extra_info['count_instance'] = count( $instances );
|
$extra_info['count_instance'] = count( $instances );
|
||||||
$container = $first_instance->get_container();
|
$container = $first_instance->get_container();
|
||||||
|
|
||||||
/** @var blcContainer $container */
|
/** @var blcContainer $container */
|
||||||
|
|
||||||
if ( ! empty( $container ) /* && ($container instanceof blcAnyPostContainer) */ ) {
|
if ( ! empty( $container ) /* && ($container instanceof blcAnyPostContainer) */ ) {
|
||||||
if (true === MainWP_Helper::check_properties($first_instance, array( 'container_field' ), true )) {
|
if (true === MainWP_Helper::check_properties($first_instance, array( 'container_field' ), true )) {
|
||||||
if (true === MainWP_Helper::check_properties($container, array( 'container_type', 'container_id' ), true )) {
|
if (true === MainWP_Helper::check_properties($container, array( 'container_type', 'container_id' ), true )) {
|
||||||
$extra_info['container_type'] = $container->container_type;
|
$extra_info['container_type'] = $container->container_type;
|
||||||
$extra_info['container_id'] = $container->container_id;
|
$extra_info['container_id'] = $container->container_id;
|
||||||
$extra_info['source_data'] = $this->ui_get_source( $container, $first_instance->container_field );
|
$extra_info['source_data'] = $this->ui_get_source( $container, $first_instance->container_field );
|
||||||
|
@ -422,8 +422,8 @@ class MainWP_Child_Links_Checker {
|
||||||
}
|
}
|
||||||
$extra_info['data_link_text'] = $data_link_text;
|
$extra_info['data_link_text'] = $data_link_text;
|
||||||
$extra_info['can_edit_url'] = $can_edit_url;
|
$extra_info['can_edit_url'] = $can_edit_url;
|
||||||
$extra_info['can_edit_text'] = $can_edit_text;
|
$extra_info['can_edit_text'] = $can_edit_text;
|
||||||
} else {
|
} else {
|
||||||
$new_link->link_text = '';
|
$new_link->link_text = '';
|
||||||
$extra_info['count_instance'] = 0;
|
$extra_info['count_instance'] = 0;
|
||||||
}
|
}
|
||||||
|
@ -642,10 +642,10 @@ class MainWP_Child_Links_Checker {
|
||||||
} else {
|
} else {
|
||||||
$image = 'font-awesome/font-awesome-comment-alt.png';
|
$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;
|
return false;
|
||||||
|
|
||||||
$comment = $container->get_wrapped_object();
|
$comment = $container->get_wrapped_object();
|
||||||
|
|
||||||
//Display a small text sample from the comment
|
//Display a small text sample from the comment
|
||||||
|
|
|
@ -62,7 +62,7 @@ class MainWP_Child_Pagespeed {
|
||||||
public function init() {
|
public function init() {
|
||||||
if (!$this->is_plugin_installed)
|
if (!$this->is_plugin_installed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( get_option( 'mainwp_pagespeed_hide_plugin' ) === 'hide' ) {
|
if ( get_option( 'mainwp_pagespeed_hide_plugin' ) === 'hide' ) {
|
||||||
add_filter( 'all_plugins', array( $this, 'hide_plugin' ) );
|
add_filter( 'all_plugins', array( $this, 'hide_plugin' ) );
|
||||||
add_action('admin_menu', array($this, 'hide_menu'), 999);
|
add_action('admin_menu', array($this, 'hide_menu'), 999);
|
||||||
|
@ -164,6 +164,13 @@ class MainWP_Child_Pagespeed {
|
||||||
$current_values['strategy'] = $_POST['strategy'];
|
$current_values['strategy'] = $_POST['strategy'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset( $settings['store_screenshots'] ) ) {
|
||||||
|
$current_values['store_screenshots'] = $settings['store_screenshots'];
|
||||||
|
}
|
||||||
|
if ( isset( $settings['use_schedule'] ) ) {
|
||||||
|
$current_values['use_schedule'] = $settings['use_schedule'];
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $settings['max_execution_time'] ) ) {
|
if ( isset( $settings['max_execution_time'] ) ) {
|
||||||
$current_values['max_execution_time'] = $settings['max_execution_time'];
|
$current_values['max_execution_time'] = $settings['max_execution_time'];
|
||||||
}
|
}
|
||||||
|
@ -184,10 +191,6 @@ class MainWP_Child_Pagespeed {
|
||||||
$current_values['log_api_errors'] = ( $settings['log_exception'] ) ? true : false;
|
$current_values['log_api_errors'] = ( $settings['log_exception'] ) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $settings['scan_technical'] ) ) {
|
|
||||||
$current_values['scan_method'] = $settings['scan_technical'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset( $settings['report_expiration'] ) ) {
|
if ( isset( $settings['report_expiration'] ) ) {
|
||||||
$current_values['recheck_interval'] = $settings['report_expiration'];
|
$current_values['recheck_interval'] = $settings['report_expiration'];
|
||||||
}
|
}
|
||||||
|
@ -197,8 +200,9 @@ class MainWP_Child_Pagespeed {
|
||||||
$current_values['check_pages'] = in_array( 'page', $settings['check_report'] ) ? true : false;
|
$current_values['check_pages'] = in_array( 'page', $settings['check_report'] ) ? true : false;
|
||||||
$current_values['check_posts'] = in_array( 'post', $settings['check_report'] ) ? true : false;
|
$current_values['check_posts'] = in_array( 'post', $settings['check_report'] ) ? true : false;
|
||||||
$current_values['check_categories'] = in_array( 'category', $settings['check_report'] ) ? true : false;
|
$current_values['check_categories'] = in_array( 'category', $settings['check_report'] ) ? true : false;
|
||||||
|
$current_values['check_custom_urls'] = in_array( 'custom_urls', $settings['check_report'] ) ? true : false;
|
||||||
} else {
|
} else {
|
||||||
$current_values['check_pages'] = $current_values['check_posts'] = $current_values['check_categories'] = false;
|
$current_values['check_pages'] = $current_values['check_posts'] = $current_values['check_categories'] = $current_values['check_custom_urls'] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +257,7 @@ class MainWP_Child_Pagespeed {
|
||||||
if ( $checkstatus ) {
|
if ( $checkstatus ) {
|
||||||
$information['error'] = __( 'The API is busy checking other pages, please try again later.', 'gpagespeedi' );
|
$information['error'] = __( 'The API is busy checking other pages, please try again later.', 'gpagespeedi' );
|
||||||
} else {
|
} else {
|
||||||
do_action( 'googlepagespeedinsightsworker', array(), true );
|
do_action( 'googlepagespeedinsightsworker', array(), $forceRecheck );
|
||||||
$information['checked_pages'] = 1;
|
$information['checked_pages'] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,15 +292,19 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
if ( 'both' === $strategy || 'desktop' === $strategy ) {
|
if ( 'both' === $strategy || 'desktop' === $strategy ) {
|
||||||
$result = self::cal_pagespeed_data( 'desktop' );
|
$result = self::cal_pagespeed_data( 'desktop' );
|
||||||
$data['desktop_score'] = $result['average_score'];
|
if ( !empty($result) && is_array($result) ) {
|
||||||
$data['desktop_total_pages'] = $result['total_pages'];
|
$data['desktop_score'] = $result['average_score'];
|
||||||
$data['desktop_last_modified'] = $result['last_modified'];
|
$data['desktop_total_pages'] = $result['total_pages'];
|
||||||
|
$data['desktop_last_modified'] = $result['last_modified'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( 'both' === $strategy || 'mobile' === $strategy ) {
|
if ( 'both' === $strategy || 'mobile' === $strategy ) {
|
||||||
$result = self::cal_pagespeed_data( 'mobile' );
|
$result = self::cal_pagespeed_data( 'mobile' );
|
||||||
$data['mobile_score'] = $result['average_score'];
|
if ( !empty($result) && is_array($result) ) {
|
||||||
$data['mobile_total_pages'] = $result['total_pages'];
|
$data['mobile_score'] = $result['average_score'];
|
||||||
$data['mobile_last_modified'] = $result['last_modified'];
|
$data['mobile_total_pages'] = $result['total_pages'];
|
||||||
|
$data['mobile_last_modified'] = $result['last_modified'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$information['data'] = $data;
|
$information['data'] = $data;
|
||||||
|
@ -307,15 +315,15 @@ class MainWP_Child_Pagespeed {
|
||||||
static function cal_pagespeed_data( $strategy ) {
|
static function cal_pagespeed_data( $strategy ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
if ( ! defined( 'GPI_DIRECTORY' ) ) {
|
if ( ! defined( 'GPI_DIRECTORY' ) ) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'desktop' !== $strategy && 'mobile' !== $strategy ) {
|
if ( 'desktop' !== $strategy && 'mobile' !== $strategy ) {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$score_column = $strategy . '_score';
|
$score_column = $strategy . '_score';
|
||||||
$page_stats_column = $strategy . '_page_stats';
|
//$page_stats_column = $strategy . '_page_stats';
|
||||||
|
|
||||||
|
|
||||||
$data_typestocheck = self::getTypesToCheck( 'all' );
|
$data_typestocheck = self::getTypesToCheck( 'all' );
|
||||||
|
@ -325,7 +333,7 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
$allpagedata = $wpdb->get_results(
|
$allpagedata = $wpdb->get_results(
|
||||||
$wpdb->prepare(
|
$wpdb->prepare(
|
||||||
"SELECT ID, URL, $score_column, $page_stats_column
|
"SELECT ID, URL, $score_column
|
||||||
FROM $gpi_page_stats
|
FROM $gpi_page_stats
|
||||||
WHERE ($data_typestocheck[0])",
|
WHERE ($data_typestocheck[0])",
|
||||||
$data_typestocheck[1]
|
$data_typestocheck[1]
|
||||||
|
@ -343,11 +351,10 @@ class MainWP_Child_Pagespeed {
|
||||||
|
|
||||||
$allpagereports = $wpdb->get_results(
|
$allpagereports = $wpdb->get_results(
|
||||||
$wpdb->prepare(
|
$wpdb->prepare(
|
||||||
"SELECT r.rule_key, r.rule_name, r.rule_impact
|
"SELECT r.rule_key, r.rule_name
|
||||||
FROM $gpi_page_stats d
|
FROM $gpi_page_stats d
|
||||||
INNER JOIN $gpi_page_reports r
|
INNER JOIN $gpi_page_reports r
|
||||||
ON r.page_id = d.ID
|
ON r.page_id = d.ID
|
||||||
AND r.rule_impact > 0
|
|
||||||
AND r.strategy = '$strategy'
|
AND r.strategy = '$strategy'
|
||||||
WHERE ($reports_typestocheck[0])",
|
WHERE ($reports_typestocheck[0])",
|
||||||
$reports_typestocheck[1]
|
$reports_typestocheck[1]
|
||||||
|
|
|
@ -33,19 +33,20 @@ class MainWP_Child_Plugins_Check {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->schedule_watchdog();
|
if ( get_option('mainwp_child_plugintheme_days_outdate') ) {
|
||||||
|
$this->schedule_watchdog();
|
||||||
|
|
||||||
add_action( $this->cron_name_batching, array( $this, 'run_check' ) );
|
add_action( $this->cron_name_batching, array( $this, 'run_check' ) );
|
||||||
add_action( $this->cron_name_daily, array( $this, 'run_check' ) );
|
add_action( $this->cron_name_daily, array( $this, 'run_check' ) );
|
||||||
|
|
||||||
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
||||||
|
|
||||||
//add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
//add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
||||||
|
|
||||||
add_filter( 'plugins_api_args', array( $this, 'modify_plugin_api_search_query' ), 10, 2 );
|
add_filter( 'plugins_api_args', array( $this, 'modify_plugin_api_search_query' ), 10, 2 );
|
||||||
|
|
||||||
add_action( 'mainwp_child_deactivation', array( $this, 'cleanup_deactivation' ) );
|
|
||||||
|
|
||||||
|
add_action( 'mainwp_child_deactivation', array( $this, 'cleanup_deactivation' ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cleanup_basic() {
|
private function cleanup_basic() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ class MainWP_Child_Server_Information {
|
||||||
var data = {
|
var data = {
|
||||||
action: 'mainwp-child_dismiss_warnings',
|
action: 'mainwp-child_dismiss_warnings',
|
||||||
what: pAction,
|
what: pAction,
|
||||||
warnings: <?php echo intval($warnings); ?>
|
warnings: <?php echo intval($warnings); ?>
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.ajax( {
|
jQuery.ajax( {
|
||||||
|
@ -537,11 +537,11 @@ class MainWP_Child_Server_Information {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function render() {
|
public static function render() {
|
||||||
$branding_title = 'MainWP Child';
|
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||||
$isBranding = false;
|
$isBranding = true;
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
if ( $branding_title == '' ) {
|
||||||
$branding_title = MainWP_Child_Branding::get_branding();
|
$branding_title = 'MainWP Child';
|
||||||
$isBranding = true;
|
$isBranding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -956,10 +956,10 @@ class MainWP_Child_Server_Information {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function checkDirectoryMainWPDirectory( $write = true ) {
|
protected static function checkDirectoryMainWPDirectory( $write = true ) {
|
||||||
$branding_title = 'MainWP';
|
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
if ($branding_title == '')
|
||||||
$branding_title = MainWP_Child_Branding::get_branding();
|
$branding_title = 'MainWP';
|
||||||
}
|
|
||||||
$branding_title .= ' Upload Directory';
|
$branding_title .= ' Upload Directory';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1009,7 +1009,7 @@ class MainWP_Child_Server_Information {
|
||||||
?>
|
?>
|
||||||
<tr class="mwp-not-generate-row">
|
<tr class="mwp-not-generate-row">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><?php echo esc_html( stripslashes( $pName ) ); ?><br/><?php echo esc_html( ( MainWP_Child_Branding::is_branding() ) ? '' : $pDirectory ); ?>
|
<td><?php echo esc_html( stripslashes( $pName ) ); ?><br/><?php echo esc_html( ( MainWP_Child_Branding::Instance()->is_branding() ) ? '' : $pDirectory ); ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo esc_html( $pCheck ); ?></td>
|
<td><?php echo esc_html( $pCheck ); ?></td>
|
||||||
<td><?php echo esc_html( $pResult ); ?></td>
|
<td><?php echo esc_html( $pResult ); ?></td>
|
||||||
|
@ -1467,14 +1467,12 @@ class MainWP_Child_Server_Information {
|
||||||
$lines = array_filter( $lines );
|
$lines = array_filter( $lines );
|
||||||
|
|
||||||
if ( empty( $lines ) ) {
|
if ( empty( $lines ) ) {
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||||
$branding_title = MainWP_Child_Branding::get_branding();
|
if ($branding_title == '') {
|
||||||
$msg = esc_html( stripslashes( $branding_title ) ) . ' is unable to find your error logs, please contact your host for server error logs.';
|
$branding_title = 'MainWP';
|
||||||
} else {
|
|
||||||
$msg = esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp-child' );
|
|
||||||
}
|
}
|
||||||
|
$msg = esc_html( stripslashes( $branding_title ) ) . ' is unable to find your error logs, please contact your host for server error logs.';
|
||||||
echo '<tr><td colspan="2">' . $msg . '</td></tr>';
|
echo '<tr><td colspan="2">' . $msg . '</td></tr>';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1621,10 +1619,9 @@ class MainWP_Child_Server_Information {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function renderConnectionDetails() {
|
public static function renderConnectionDetails() {
|
||||||
$branding_title = 'MainWP';
|
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
if ($branding_title == '')
|
||||||
$branding_title = MainWP_Child_Branding::get_branding();
|
$branding_title = 'MainWP';
|
||||||
}
|
|
||||||
|
|
||||||
global $current_user;
|
global $current_user;
|
||||||
$uniqueId = get_option('mainwp_child_uniqueId');
|
$uniqueId = get_option('mainwp_child_uniqueId');
|
||||||
|
|
|
@ -33,15 +33,19 @@ class MainWP_Child_Themes_Check {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->schedule_watchdog();
|
|
||||||
add_action( $this->cron_name_batching, array( $this, 'run_check' ) );
|
|
||||||
add_action( $this->cron_name_daily, array( $this, 'run_check' ) );
|
|
||||||
|
|
||||||
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
if ( get_option('mainwp_child_plugintheme_days_outdate') ) {
|
||||||
|
$this->schedule_watchdog();
|
||||||
|
add_action( $this->cron_name_batching, array( $this, 'run_check' ) );
|
||||||
|
add_action( $this->cron_name_daily, array( $this, 'run_check' ) );
|
||||||
|
|
||||||
add_filter( 'themes_api_args', array( $this, 'modify_theme_api_search_query' ), 10, 2 );
|
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
||||||
|
|
||||||
add_action( 'mainwp_child_deactivation', array( $this, 'cleanup_deactivation' ) );
|
add_filter( 'themes_api_args', array( $this, 'modify_theme_api_search_query' ), 10, 2 );
|
||||||
|
|
||||||
|
add_action( 'mainwp_child_deactivation', array( $this, 'cleanup_deactivation' ) );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cleanup_basic() {
|
private function cleanup_basic() {
|
||||||
|
|
|
@ -115,8 +115,8 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainWP_Child {
|
class MainWP_Child {
|
||||||
public static $version = '3.5.3';
|
public static $version = '3.5.4';
|
||||||
private $update_version = '1.3';
|
private $update_version = '1.5';
|
||||||
|
|
||||||
private $callableFunctions = array(
|
private $callableFunctions = array(
|
||||||
'stats' => 'getSiteStats',
|
'stats' => 'getSiteStats',
|
||||||
|
@ -185,7 +185,7 @@ class MainWP_Child {
|
||||||
'disconnect' => 'disconnect',
|
'disconnect' => 'disconnect',
|
||||||
'time_capsule' => 'time_capsule',
|
'time_capsule' => 'time_capsule',
|
||||||
'extra_excution' => 'extra_execution', // deprecated
|
'extra_excution' => 'extra_execution', // deprecated
|
||||||
'extra_execution' => 'extra_execution',
|
'extra_execution' => 'extra_execution'
|
||||||
);
|
);
|
||||||
|
|
||||||
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
||||||
|
@ -203,7 +203,6 @@ class MainWP_Child {
|
||||||
|
|
||||||
private $filterFunction = null;
|
private $filterFunction = null;
|
||||||
public static $brandingTitle = null;
|
public static $brandingTitle = null;
|
||||||
private $branding_robust = 'MainWP';
|
|
||||||
|
|
||||||
public static $subPages;
|
public static $subPages;
|
||||||
public static $subPagesLoaded = false;
|
public static $subPagesLoaded = false;
|
||||||
|
@ -231,7 +230,9 @@ class MainWP_Child {
|
||||||
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
add_action( 'admin_init', array( &$this, 'admin_init' ) );
|
||||||
add_action( 'admin_head', array( &$this, 'admin_head' ) );
|
add_action( 'admin_head', array( &$this, 'admin_head' ) );
|
||||||
add_action( 'init', array( &$this, 'localization' ), 33 );
|
add_action( 'init', array( &$this, 'localization' ), 33 );
|
||||||
add_action( 'pre_current_active_plugins', array( &$this, 'pre_current_active_plugins' ) );
|
add_action( 'pre_current_active_plugins', array( &$this, 'detect_premium_themesplugins_updates' ) ); // to support detect premium themes/plugins update
|
||||||
|
add_action( 'core_upgrade_preamble', array( &$this, 'detect_premium_themesplugins_updates' ) );
|
||||||
|
|
||||||
|
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_plugin_version', self::$version, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_plugin_version', self::$version, 'yes' );
|
||||||
|
@ -242,22 +243,16 @@ class MainWP_Child {
|
||||||
MainWP_Clone::get()->init();
|
MainWP_Clone::get()->init();
|
||||||
MainWP_Child_Server_Information::init();
|
MainWP_Child_Server_Information::init();
|
||||||
MainWP_Client_Report::Instance()->init();
|
MainWP_Client_Report::Instance()->init();
|
||||||
MainWP_Child_Plugins_Check::Instance();
|
MainWP_Child_Plugins_Check::Instance();
|
||||||
MainWP_Child_Themes_Check::Instance();
|
MainWP_Child_Themes_Check::Instance();
|
||||||
|
|
||||||
$this->run_saved_snippets();
|
$this->run_saved_snippets();
|
||||||
|
|
||||||
if ( ! get_option( 'mainwp_child_pubkey' ) ) {
|
if ( ! get_option( 'mainwp_child_pubkey' ) ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' );
|
MainWP_Child_Branding::Instance()->save_branding_options('branding_disconnected', 'yes');
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' ); // to compatible
|
||||||
}
|
}
|
||||||
|
|
||||||
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
|
||||||
if ( ! $cancelled_branding ) {
|
|
||||||
$branding_header = get_option( 'mainwp_branding_plugin_header' );
|
|
||||||
if ( is_array( $branding_header ) && isset( $branding_header['name'] ) && ! empty( $branding_header['name'] ) ) {
|
|
||||||
$this->branding_robust = stripslashes( $branding_header['name'] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action( 'admin_notices', array( &$this, 'admin_notice' ) );
|
add_action( 'admin_notices', array( &$this, 'admin_notice' ) );
|
||||||
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
||||||
|
|
||||||
|
@ -310,15 +305,17 @@ class MainWP_Child {
|
||||||
'mainwp_security',
|
'mainwp_security',
|
||||||
'mainwp_backupwordpress_ext_enabled',
|
'mainwp_backupwordpress_ext_enabled',
|
||||||
'mainwp_wprocket_ext_enabled',
|
'mainwp_wprocket_ext_enabled',
|
||||||
'mainwp_wordfence_ext_enabled',
|
//'mainwp_wordfence_ext_enabled',
|
||||||
'mainwp_branding_button_contact_label',
|
'mainwp_branding_button_contact_label',
|
||||||
'mainwp_branding_extra_settings',
|
'mainwp_branding_extra_settings',
|
||||||
'mainwp_branding_child_hide',
|
'mainwp_branding_child_hide',
|
||||||
'mainwp_branding_ext_enabled',
|
'mainwp_branding_ext_enabled',
|
||||||
'mainwp_creport_ext_branding_enabled',
|
//'mainwp_creport_ext_branding_enabled',
|
||||||
'mainwp_pagespeed_ext_enabled',
|
'mainwp_pagespeed_ext_enabled',
|
||||||
'mainwp_linkschecker_ext_enabled',
|
'mainwp_linkschecker_ext_enabled',
|
||||||
'mainwp_ithemes_ext_enabled',
|
//'mainwp_ithemes_ext_enabled',
|
||||||
|
'mainwp_child_branding_settings',
|
||||||
|
'mainwp_child_plugintheme_days_outdate'
|
||||||
);
|
);
|
||||||
$query = "SELECT option_name, option_value FROM $wpdb->options WHERE option_name in (";
|
$query = "SELECT option_name, option_value FROM $wpdb->options WHERE option_name in (";
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
|
@ -360,7 +357,6 @@ class MainWP_Child {
|
||||||
$options = array(
|
$options = array(
|
||||||
'mainwp_child_legacy',
|
'mainwp_child_legacy',
|
||||||
'mainwp_child_auth',
|
'mainwp_child_auth',
|
||||||
'mainwp_branding_ext_enabled',
|
|
||||||
'mainwp_child_uniqueId',
|
'mainwp_child_uniqueId',
|
||||||
'mainwp_child_htaccess_set',
|
'mainwp_child_htaccess_set',
|
||||||
'mainwp_child_fix_htaccess',
|
'mainwp_child_fix_htaccess',
|
||||||
|
@ -401,33 +397,33 @@ class MainWP_Child {
|
||||||
'mainwp_kwl_statistic_data_',
|
'mainwp_kwl_statistic_data_',
|
||||||
'mainwp_kwl_enable_statistic',
|
'mainwp_kwl_enable_statistic',
|
||||||
'mainwpKeywordLinks',
|
'mainwpKeywordLinks',
|
||||||
'mainwp_branding_ext_enabled',
|
// 'mainwp_branding_ext_enabled',
|
||||||
'mainwp_branding_plugin_header',
|
// 'mainwp_branding_plugin_header',
|
||||||
'mainwp_branding_support_email',
|
// 'mainwp_branding_support_email',
|
||||||
'mainwp_branding_support_message',
|
// 'mainwp_branding_support_message',
|
||||||
'mainwp_branding_remove_restore',
|
// 'mainwp_branding_remove_restore',
|
||||||
'mainwp_branding_remove_setting',
|
// 'mainwp_branding_remove_setting',
|
||||||
'mainwp_branding_remove_wp_tools',
|
// 'mainwp_branding_remove_wp_tools',
|
||||||
'mainwp_branding_remove_wp_setting',
|
// 'mainwp_branding_remove_wp_setting',
|
||||||
'mainwp_branding_remove_permalink',
|
// 'mainwp_branding_remove_permalink',
|
||||||
'mainwp_branding_button_contact_label',
|
// 'mainwp_branding_button_contact_label',
|
||||||
'mainwp_branding_send_email_message',
|
// 'mainwp_branding_send_email_message',
|
||||||
'mainwp_branding_message_return_sender',
|
// 'mainwp_branding_message_return_sender',
|
||||||
'mainwp_branding_submit_button_title',
|
// 'mainwp_branding_submit_button_title',
|
||||||
'mainwp_branding_disable_wp_branding',
|
// 'mainwp_branding_disable_wp_branding',
|
||||||
'mainwp_branding_extra_settings',
|
// 'mainwp_branding_extra_settings',
|
||||||
'mainwp_branding_child_hide',
|
// 'mainwp_branding_child_hide',
|
||||||
'mainwp_branding_show_support',
|
// 'mainwp_branding_show_support',
|
||||||
'mainwp_branding_disable_change',
|
// 'mainwp_branding_disable_change',
|
||||||
);
|
);
|
||||||
foreach ( $options as $option ) {
|
foreach ( $options as $option ) {
|
||||||
MainWP_Helper::fix_option( $option );
|
MainWP_Helper::fix_option( $option );
|
||||||
}
|
}
|
||||||
} else if ( ( false === $update_version ) || ( '1.0' === $update_version ) || ( '1.1' === $update_version ) ) {
|
} else if ( ( '1.0' === $update_version ) || ( '1.1' === $update_version ) ) {
|
||||||
$options = array(
|
$options = array(
|
||||||
'mainwp_child_pubkey',
|
'mainwp_child_pubkey',
|
||||||
'mainwp_child_branding_disconnected',
|
//'mainwp_child_branding_disconnected',
|
||||||
'mainwp_branding_plugin_header',
|
//'mainwp_branding_plugin_header',
|
||||||
'mainwp_child_update_version',
|
'mainwp_child_update_version',
|
||||||
'mainwp_child_auth',
|
'mainwp_child_auth',
|
||||||
'mainwp_child_clone_permalink',
|
'mainwp_child_clone_permalink',
|
||||||
|
@ -444,14 +440,14 @@ class MainWP_Child {
|
||||||
'mainwp_updraftplus_ext_enabled',
|
'mainwp_updraftplus_ext_enabled',
|
||||||
'mainwpKeywordLinks',
|
'mainwpKeywordLinks',
|
||||||
'mainwp_keyword_links_htaccess_set',
|
'mainwp_keyword_links_htaccess_set',
|
||||||
'mainwp_branding_button_contact_label',
|
//'mainwp_branding_button_contact_label',
|
||||||
'mainwp_branding_extra_settings',
|
//'mainwp_branding_extra_settings',
|
||||||
'mainwp_branding_ext_enabled',
|
//'mainwp_branding_ext_enabled',
|
||||||
'mainwp_creport_ext_branding_enabled',
|
//'mainwp_creport_ext_branding_enabled',
|
||||||
'mainwp_pagespeed_ext_enabled',
|
'mainwp_pagespeed_ext_enabled',
|
||||||
'mainwp_linkschecker_ext_enabled',
|
'mainwp_linkschecker_ext_enabled',
|
||||||
'mainwp_wordfence_ext_enabled',
|
//'mainwp_wordfence_ext_enabled',
|
||||||
'mainwp_ithemes_ext_enabled',
|
//'mainwp_ithemes_ext_enabled',
|
||||||
'mainwp_maintenance_opt_alert_404',
|
'mainwp_maintenance_opt_alert_404',
|
||||||
);
|
);
|
||||||
foreach ( $options as $option ) {
|
foreach ( $options as $option ) {
|
||||||
|
@ -479,9 +475,46 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' );
|
||||||
}
|
}
|
||||||
} else if ($update_version == '1.2') {
|
}
|
||||||
MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation(false);
|
|
||||||
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation(false);
|
if ( !empty($update_version) && version_compare($update_version, '1.4', '<=' ) ) { // 3.5.4
|
||||||
|
if ( ! is_array( get_option( 'mainwp_child_branding_settings' ) ) ) {
|
||||||
|
// to fix: reduce number of options
|
||||||
|
$brandingOptions = array(
|
||||||
|
'hide' => 'mainwp_branding_child_hide',
|
||||||
|
'extra_settings' => 'mainwp_branding_extra_settings',
|
||||||
|
'branding_disconnected' => 'mainwp_child_branding_disconnected',
|
||||||
|
'preserve_branding' => 'mainwp_branding_preserve_branding',
|
||||||
|
'branding_header' => 'mainwp_branding_plugin_header',
|
||||||
|
'support_email' => 'mainwp_branding_support_email',
|
||||||
|
'support_message' => 'mainwp_branding_support_message',
|
||||||
|
'remove_restore' => 'mainwp_branding_remove_restore',
|
||||||
|
'remove_setting' => 'mainwp_branding_remove_setting',
|
||||||
|
'remove_server_info' => 'mainwp_branding_remove_server_info',
|
||||||
|
'remove_connection_detail' => 'mainwp_branding_remove_connection_detail',
|
||||||
|
'remove_wp_tools' => 'mainwp_branding_remove_wp_tools',
|
||||||
|
'remove_wp_setting' => 'mainwp_branding_remove_wp_setting',
|
||||||
|
'remove_permalink' => 'mainwp_branding_remove_permalink',
|
||||||
|
'contact_label' => 'mainwp_branding_button_contact_label',
|
||||||
|
'email_message' => 'mainwp_branding_send_email_message',
|
||||||
|
'message_return_sender' => 'mainwp_branding_message_return_sender',
|
||||||
|
'submit_button_title' => 'mainwp_branding_submit_button_title',
|
||||||
|
'disable_wp_branding' => 'mainwp_branding_disable_wp_branding',
|
||||||
|
'show_support' => 'mainwp_branding_show_support',
|
||||||
|
'disable_change' => 'mainwp_branding_disable_change',
|
||||||
|
'disable_switching_theme' => 'mainwp_branding_disable_switching_theme',
|
||||||
|
'hide_child_reports' => 'mainwp_creport_branding_stream_hide',
|
||||||
|
'branding_ext_enabled' => 'mainwp_branding_ext_enabled'
|
||||||
|
);
|
||||||
|
|
||||||
|
$convertBranding = array();
|
||||||
|
foreach ( $brandingOptions as $option => $old ) {
|
||||||
|
$value = get_option( $old );
|
||||||
|
$convertBranding[ $option ] = $value;
|
||||||
|
}
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_settings', $convertBranding );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWP_Helper::update_option( 'mainwp_child_update_version', $this->update_version, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_update_version', $this->update_version, 'yes' );
|
||||||
|
@ -507,27 +540,27 @@ class MainWP_Child {
|
||||||
|
|
||||||
public function admin_notice() {
|
public function admin_notice() {
|
||||||
//Admin Notice...
|
//Admin Notice...
|
||||||
if ( is_plugin_active( 'mainwp-child/mainwp-child.php' ) ) {
|
if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::isAdmin() && is_admin() ) {
|
||||||
if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::isAdmin() && is_admin() ) {
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
$child_name = ( $this->branding_robust === 'MainWP' ) ? 'MainWP Child' : $this->branding_robust;
|
$child_name = ( $branding_opts['branding_preserve_title'] === '' ) ? 'MainWP Child' : $branding_opts['branding_preserve_title'];
|
||||||
$msg = '<div class="wrap"><div class="postbox" style="margin-top: 4em;"><p style="background: #a00; color: #fff; font-size: 22px; font-weight: bold; margin: 0; padding: .3em;">';
|
$dashboard_name = ( $branding_opts['branding_preserve_title'] === '' ) ? 'MainWP Dashboard' : $branding_opts['branding_preserve_title'] . ' Dashboard';
|
||||||
$msg .= __( 'Attention!', 'mainwp-child' );
|
|
||||||
$msg .= '</p><div style="padding-left: 1em; padding-right: 1em;"><p style="font-size: 16px;">';
|
|
||||||
$msg .= __( 'Please add this site to your ', 'mainwp-child' ) . $this->branding_robust . __( ' Dashboard <b>NOW</b> or deactivate the ', 'mainwp-child' ) . $child_name . __( ' plugin until you are ready to connect this site to your Dashboard in order to avoid unexpected security issues.','mainwp-child' );
|
|
||||||
$msg .= '</p>';
|
|
||||||
$msg .= '<p style="font-size: 16px;">';
|
|
||||||
$msg .= __( 'If you are not sure how to add this site to your Dashboard, <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/add-site-to-your-dashboard/" target="_blank">please review these instructions</a>.', 'mainwp-child' );
|
|
||||||
$msg .= '</p>';
|
|
||||||
if ( ! MainWP_Child_Branding::is_branding() ) {
|
|
||||||
$msg .= '<p>';
|
|
||||||
$msg .= __( 'You can also turn on the unique security ID option in <a href="admin.php?page=mainwp_child_tab">', 'mainwp-child' ) . $this->branding_robust . __( ' settings</a> if you would like extra security and additional time to add this site to your Dashboard. <br/>Find out more in this help document <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/set-unique-security-id/" target="_blank">How do I use the child unique security ID?</a>', 'mainwp-child' );
|
|
||||||
$msg .= '</p>';
|
|
||||||
}
|
|
||||||
$msg .= '</div></div></div>';
|
|
||||||
echo wp_kses_post( $msg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$msg = '<div class="wrap"><div class="postbox" style="margin-top: 4em;"><p style="background: #a00; color: #fff; font-size: 22px; font-weight: bold; margin: 0; padding: .3em;">';
|
||||||
|
$msg .= __( 'Attention!', 'mainwp-child' );
|
||||||
|
$msg .= '</p><div style="padding-left: 1em; padding-right: 1em;"><p style="font-size: 16px;">';
|
||||||
|
$msg .= __( 'Please add this site to your ', 'mainwp-child' ) . $dashboard_name . ' ' . __( '<b>NOW</b> or deactivate the ', 'mainwp-child' ) . $child_name . __( ' plugin until you are ready to connect this site to your Dashboard in order to avoid unexpected security issues.','mainwp-child' );
|
||||||
|
$msg .= '</p>';
|
||||||
|
$msg .= '<p style="font-size: 16px;">';
|
||||||
|
$msg .= __( 'If you are not sure how to add this site to your Dashboard, <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/add-site-to-your-dashboard/" target="_blank">please review these instructions</a>.', 'mainwp-child' );
|
||||||
|
$msg .= '</p>';
|
||||||
|
if ( ! MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||||
|
$msg .= '<p>';
|
||||||
|
$msg .= __( 'You can also turn on the unique security ID option in <a href="admin.php?page=mainwp_child_tab">', 'mainwp-child' ) . $child_name . __( ' settings</a> if you would like extra security and additional time to add this site to your Dashboard. <br/>Find out more in this help document <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/set-unique-security-id/" target="_blank">How do I use the child unique security ID?</a>', 'mainwp-child' );
|
||||||
|
$msg .= '</p>';
|
||||||
|
}
|
||||||
|
$msg .= '</div></div></div>';
|
||||||
|
echo wp_kses_post( $msg );
|
||||||
|
}
|
||||||
MainWP_Child_Server_Information::showWarnings();
|
MainWP_Child_Server_Information::showWarnings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,14 +568,28 @@ class MainWP_Child {
|
||||||
load_plugin_textdomain( 'mainwp-child', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
|
load_plugin_textdomain( 'mainwp-child', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pre_current_active_plugins() {
|
public function detect_premium_themesplugins_updates() {
|
||||||
if (isset($_GET['_detect_plugins_updates']) && $_GET['_detect_plugins_updates'] == 'yes') {
|
if (isset($_GET['_detect_plugins_updates']) && $_GET['_detect_plugins_updates'] == 'yes') {
|
||||||
// to fix some premium plugins update notification
|
// to fix some premium plugins update notification
|
||||||
$current = get_site_transient( 'update_plugins' );
|
$current = get_site_transient( 'update_plugins' );
|
||||||
set_site_transient( 'update_plugins', $current );
|
set_site_transient( 'update_plugins', $current );
|
||||||
|
|
||||||
$plugin_updates = get_plugin_updates();
|
add_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
|
||||||
set_site_transient( 'mainwp_update_plugins_cached', $plugin_updates, DAY_IN_SECONDS);
|
$plugins = get_plugin_updates();
|
||||||
|
remove_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
|
||||||
|
|
||||||
|
set_site_transient( 'mainwp_update_plugins_cached', $plugins, DAY_IN_SECONDS);
|
||||||
|
wp_destroy_current_session(); // to fix issue multi user session
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['_detect_themes_updates']) && $_GET['_detect_themes_updates'] == 'yes') {
|
||||||
|
add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
||||||
|
$themes = get_theme_updates();
|
||||||
|
remove_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
||||||
|
|
||||||
|
set_site_transient( 'mainwp_update_themes_cached', $themes, DAY_IN_SECONDS);
|
||||||
|
wp_destroy_current_session(); // to fix issue multi user session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,9 +647,11 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
function admin_menu() {
|
function admin_menu() {
|
||||||
$cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
|
$is_hide = isset( $branding_opts['hide'] ) ? $branding_opts['hide'] : '';
|
||||||
|
$cancelled_branding = $branding_opts['cancelled_branding'];
|
||||||
|
|
||||||
if ( get_option( 'mainwp_branding_remove_wp_tools' ) && ! $cancelled_branding ) {
|
if ( isset($branding_opts['remove_wp_tools']) && $branding_opts['remove_wp_tools'] && ! $cancelled_branding ) {
|
||||||
remove_menu_page( 'tools.php' );
|
remove_menu_page( 'tools.php' );
|
||||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'tools.php' ) ||
|
$pos = stripos( $_SERVER['REQUEST_URI'], 'tools.php' ) ||
|
||||||
stripos( $_SERVER['REQUEST_URI'], 'import.php' ) ||
|
stripos( $_SERVER['REQUEST_URI'], 'import.php' ) ||
|
||||||
|
@ -612,7 +661,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if preserve branding do not remove menus
|
// if preserve branding do not remove menus
|
||||||
if ( get_option( 'mainwp_branding_remove_wp_setting' ) && ! $cancelled_branding ) {
|
if ( isset($branding_opts['remove_wp_setting']) && $branding_opts['remove_wp_setting'] && ! $cancelled_branding ) {
|
||||||
remove_menu_page( 'options-general.php' );
|
remove_menu_page( 'options-general.php' );
|
||||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-general.php' ) ||
|
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-general.php' ) ||
|
||||||
stripos( $_SERVER['REQUEST_URI'], 'options-writing.php' ) ||
|
stripos( $_SERVER['REQUEST_URI'], 'options-writing.php' ) ||
|
||||||
|
@ -626,7 +675,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( get_option( 'mainwp_branding_remove_permalink' ) && ! $cancelled_branding ) {
|
if ( isset($branding_opts['remove_permalink']) && $branding_opts['remove_permalink'] && ! $cancelled_branding ) {
|
||||||
remove_submenu_page( 'options-general.php', 'options-permalink.php' );
|
remove_submenu_page( 'options-general.php', 'options-permalink.php' );
|
||||||
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-permalink.php' );
|
$pos = stripos( $_SERVER['REQUEST_URI'], 'options-permalink.php' );
|
||||||
if ( false !== $pos ) {
|
if ( false !== $pos ) {
|
||||||
|
@ -636,13 +685,13 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
$remove_all_child_menu = false;
|
$remove_all_child_menu = false;
|
||||||
if ( get_option( 'mainwp_branding_remove_setting' ) && get_option( 'mainwp_branding_remove_restore' ) && get_option( 'mainwp_branding_remove_server_info' ) ) {
|
if ( isset($branding_opts['remove_setting']) && isset($branding_opts['remove_restore']) && isset($branding_opts['remove_server_info']) && $branding_opts['remove_setting'] && $branding_opts['remove_restore'] && $branding_opts['remove_server_info'] ) {
|
||||||
$remove_all_child_menu = true;
|
$remove_all_child_menu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if preserve branding do not hide menus
|
// if preserve branding do not hide menus
|
||||||
if ( ( ! $remove_all_child_menu && get_option( 'mainwp_branding_child_hide' ) !== 'T' ) || $cancelled_branding ) {
|
if ( ( ! $remove_all_child_menu && $is_hide !== 'T' ) || $cancelled_branding ) {
|
||||||
$branding_header = get_option( 'mainwp_branding_plugin_header' );
|
$branding_header = isset( $branding_opts['branding_header'] ) ? $branding_opts['branding_header'] : array();
|
||||||
if ( ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) && ! $cancelled_branding ) {
|
if ( ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) && ! $cancelled_branding ) {
|
||||||
self::$brandingTitle = $child_menu_title = stripslashes( $branding_header['name'] );
|
self::$brandingTitle = $child_menu_title = stripslashes( $branding_header['name'] );
|
||||||
$child_page_title = $child_menu_title . ' Settings';
|
$child_page_title = $child_menu_title . ' Settings';
|
||||||
|
@ -662,6 +711,7 @@ class MainWP_Child {
|
||||||
do_action( 'mainwp-child-subpages', $subpageargs ); // to compatible
|
do_action( 'mainwp-child-subpages', $subpageargs ); // to compatible
|
||||||
|
|
||||||
$sub_pages = array();
|
$sub_pages = array();
|
||||||
|
|
||||||
$all_subpages = apply_filters( 'mainwp-child-init-subpages', array() );
|
$all_subpages = apply_filters( 'mainwp-child-init-subpages', array() );
|
||||||
|
|
||||||
if ( !is_array( $all_subpages ) )
|
if ( !is_array( $all_subpages ) )
|
||||||
|
@ -709,11 +759,13 @@ class MainWP_Child {
|
||||||
if ( isset($_GET['tab']) ) {
|
if ( isset($_GET['tab']) ) {
|
||||||
$shownPage = $_GET['tab'];
|
$shownPage = $_GET['tab'];
|
||||||
}
|
}
|
||||||
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
|
|
||||||
|
$hide_settings = $branding_opts['remove_setting'] ? true : false;
|
||||||
|
$hide_restore = $branding_opts['remove_restore'] ? true : false;
|
||||||
|
$hide_server_info = $branding_opts['remove_server_info'] ? true : false;
|
||||||
|
$hide_connection_detail = $branding_opts['remove_connection_detail'] ? true : false;
|
||||||
|
|
||||||
$hide_settings = get_option( 'mainwp_branding_remove_setting' ) ? true : false;
|
|
||||||
$hide_restore = get_option( 'mainwp_branding_remove_restore' ) ? true : false;
|
|
||||||
$hide_server_info = get_option( 'mainwp_branding_remove_server_info' ) ? true : false;
|
|
||||||
$hide_connection_detail = get_option( 'mainwp_branding_remove_connection_detail' ) ? true : false;
|
|
||||||
$hide_style = 'style="display:none"';
|
$hide_style = 'style="display:none"';
|
||||||
|
|
||||||
if ($shownPage == '') {
|
if ($shownPage == '') {
|
||||||
|
@ -783,10 +835,13 @@ class MainWP_Child {
|
||||||
if (empty($shownPage))
|
if (empty($shownPage))
|
||||||
$shownPage = 'settings';
|
$shownPage = 'settings';
|
||||||
|
|
||||||
$hide_settings = get_option( 'mainwp_branding_remove_setting' ) ? true : false;
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
$hide_restore = get_option( 'mainwp_branding_remove_restore' ) ? true : false;
|
|
||||||
$hide_server_info = get_option( 'mainwp_branding_remove_server_info' ) ? true : false;
|
$hide_settings = $branding_opts['remove_setting'] ? true : false;
|
||||||
$hide_connection_detail = get_option( 'mainwp_branding_remove_connection_detail' ) ? true : false;
|
$hide_restore = $branding_opts['remove_restore'] ? true : false;
|
||||||
|
$hide_server_info = $branding_opts['remove_server_info'] ? true : false;
|
||||||
|
$hide_connection_detail = $branding_opts['remove_connection_detail'] ? true : false;
|
||||||
|
|
||||||
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1064,7 +1119,7 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_login() {
|
function check_login() {
|
||||||
$file = '';
|
$file = '';
|
||||||
if ( isset( $_REQUEST['f'] ) ) {
|
if ( isset( $_REQUEST['f'] ) ) {
|
||||||
$file = $_REQUEST['f'];
|
$file = $_REQUEST['f'];
|
||||||
|
@ -1084,13 +1139,30 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$auth_user = false;
|
||||||
if ( $auth ) {
|
if ( $auth ) {
|
||||||
//disable duo auth for mainwp
|
//disable duo auth for mainwp
|
||||||
remove_action('init', 'duo_verify_auth', 10);
|
remove_action('init', 'duo_verify_auth', 10);
|
||||||
|
|
||||||
//Check if the user exists & is an administrator
|
//Check if the user exists & is an administrator
|
||||||
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
||||||
$user = get_user_by( 'login', $_POST['user'] );
|
|
||||||
|
$user = null;
|
||||||
|
|
||||||
|
if ( isset( $_POST['alt_user'] ) && !empty( $_POST['alt_user'] ) ) {
|
||||||
|
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
||||||
|
$auth_user = $_POST['alt_user'];
|
||||||
|
$user = get_user_by( 'login', $auth_user );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if not valid alternative admin
|
||||||
|
if ( ! $user ) {
|
||||||
|
// check connected admin existed
|
||||||
|
$user = get_user_by( 'login', $_POST['user'] );
|
||||||
|
$auth_user = $_POST['user'];
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
MainWP_Helper::error( __( 'That administrator username was not found on this child site. Please verify that it is an existing administrator.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'That administrator username was not found on this child site. Please verify that it is an existing administrator.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
@ -1099,11 +1171,16 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'That user is not an administrator. Please use an administrator user to establish the connection.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'That user is not an administrator. Please use an administrator user to establish the connection.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->login( $_REQUEST['user'] );
|
$this->login( $auth_user );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['function'] ) && 'visitPermalink' === $_POST['function'] ) {
|
if ( isset( $_POST['function'] ) && 'visitPermalink' === $_POST['function'] ) {
|
||||||
if ( $this->login( $_POST['user'], true ) ) {
|
|
||||||
|
if (empty($auth_user)) {
|
||||||
|
$auth_user = $_POST['user'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->login( $auth_user, true ) ) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
exit();
|
exit();
|
||||||
|
@ -1261,7 +1338,17 @@ class MainWP_Child {
|
||||||
global $current_user; //wp variable
|
global $current_user; //wp variable
|
||||||
//Login the user
|
//Login the user
|
||||||
if ( isset( $_REQUEST['login_required'] ) && ( '1' === $_REQUEST['login_required'] ) && isset( $_REQUEST['user'] ) ) {
|
if ( isset( $_REQUEST['login_required'] ) && ( '1' === $_REQUEST['login_required'] ) && isset( $_REQUEST['user'] ) ) {
|
||||||
$username = rawurldecode( $_REQUEST['user'] );
|
$alter_login_required = false;
|
||||||
|
$username = rawurldecode( $_REQUEST['user'] );
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['alt_user'] ) && !empty( $_REQUEST['alt_user'] ) ) {
|
||||||
|
$alter_login_required = $this->check_login_as( $_REQUEST['alt_user'] );
|
||||||
|
|
||||||
|
if ( $alter_login_required ) {
|
||||||
|
$username = rawurldecode( $_REQUEST['alt_user'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_user_logged_in() ) {
|
if ( is_user_logged_in() ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
if ( 10 !== $current_user->wp_user_level && ( ! isset( $current_user->user_level ) || 10 !== $current_user->user_level ) && ! current_user_can( 'level_10' ) ) {
|
if ( 10 !== $current_user->wp_user_level && ( ! isset( $current_user->user_level ) || 10 !== $current_user->user_level ) && ! current_user_can( 'level_10' ) ) {
|
||||||
|
@ -1291,9 +1378,14 @@ class MainWP_Child {
|
||||||
|
|
||||||
global $current_user;
|
global $current_user;
|
||||||
if ( 10 !== $current_user->wp_user_level && ( ! isset( $current_user->user_level ) || 10 !== $current_user->user_level ) && ! current_user_can( 'level_10' ) ) {
|
if ( 10 !== $current_user->wp_user_level && ( ! isset( $current_user->user_level ) || 10 !== $current_user->user_level ) && ! current_user_can( 'level_10' ) ) {
|
||||||
do_action( 'wp_logout' );
|
// if is not alternative admin login
|
||||||
|
// it is connected admin login
|
||||||
|
if ( ! $alter_login_required ) {
|
||||||
|
// log out if connected admin is not admin level 10
|
||||||
|
do_action( 'wp_logout' );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1323,6 +1415,7 @@ class MainWP_Child {
|
||||||
$_SESSION['size'] = $_POST['size'];
|
$_SESSION['size'] = $_POST['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to support open not wp-admin url
|
||||||
$open_location = isset( $_REQUEST['open_location'] ) ? $_REQUEST['open_location'] : '';
|
$open_location = isset( $_REQUEST['open_location'] ) ? $_REQUEST['open_location'] : '';
|
||||||
if ( ! empty( $open_location ) ) {
|
if ( ! empty( $open_location ) ) {
|
||||||
$open_location = base64_decode( $open_location );
|
$open_location = base64_decode( $open_location );
|
||||||
|
@ -1347,7 +1440,6 @@ class MainWP_Child {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100, 2 );
|
|
||||||
wp_redirect( admin_url( $where ) );
|
wp_redirect( admin_url( $where ) );
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -1387,10 +1479,26 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Authentication failed! Please deactivate and re-activate the MainWP Child plugin on this site.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$auth_user = false;
|
||||||
if ( $auth ) {
|
if ( $auth ) {
|
||||||
//Check if the user exists & is an administrator
|
//Check if the user exists & is an administrator
|
||||||
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
if ( isset( $_POST['function'] ) && isset( $_POST['user'] ) ) {
|
||||||
$user = get_user_by( 'login', $_POST['user'] );
|
|
||||||
|
$user = null;
|
||||||
|
if ( isset( $_POST['alt_user'] ) && !empty( $_POST['alt_user'] ) ) {
|
||||||
|
if ( $this->check_login_as( $_POST['alt_user'] ) ) {
|
||||||
|
$auth_user = $_POST['alt_user'];
|
||||||
|
$user = get_user_by( 'login', $auth_user );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if alternative admin not existed
|
||||||
|
if ( ! $user ) {
|
||||||
|
// check connected admin existed
|
||||||
|
$user = get_user_by( 'login', $_POST['user'] );
|
||||||
|
$auth_user = $_POST['user'];
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
MainWP_Helper::error( __( 'That administrator username was not found on this child site. Please verify that it is an existing administrator.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'That administrator username was not found on this child site. Please verify that it is an existing administrator.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
@ -1399,11 +1507,16 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'That user is not an administrator. Please use an administrator user to establish the connection.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'That user is not an administrator. Please use an administrator user to establish the connection.', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->login( $_REQUEST['user'] );
|
$this->login( $auth_user );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['function'] ) && 'visitPermalink' === $_POST['function'] ) {
|
if ( isset( $_POST['function'] ) && 'visitPermalink' === $_POST['function'] ) {
|
||||||
if ( $this->login( $_POST['user'], true ) ) {
|
|
||||||
|
if (empty($auth_user)) {
|
||||||
|
$auth_user = $_POST['user'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->login( $auth_user, true ) ) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
exit();
|
exit();
|
||||||
|
@ -1470,6 +1583,31 @@ class MainWP_Child {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check to support login by alternative admin
|
||||||
|
// return false will login by connected admin user
|
||||||
|
// return true will try to login as alternative user
|
||||||
|
function check_login_as( $alter_login ) {
|
||||||
|
|
||||||
|
if ( !empty( $alter_login ) ) {
|
||||||
|
// check alternative admin existed
|
||||||
|
$user = get_user_by( 'login', $alter_login );
|
||||||
|
|
||||||
|
if ( ! $user ) {
|
||||||
|
//That administrator username was not found on this child site
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 10 != $user->wp_user_level && ( ! isset( $user->user_level ) || 10 != $user->user_level ) && ! $user->has_cap( 'level_10' ) ) {
|
||||||
|
// That user is not an administrator
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // ok, will try to login by alternative user
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function default_option_active_plugins( $default ) {
|
function default_option_active_plugins( $default ) {
|
||||||
if ( ! is_array( $default ) ) {
|
if ( ! is_array( $default ) ) {
|
||||||
$default = array();
|
$default = array();
|
||||||
|
@ -1508,10 +1646,16 @@ class MainWP_Child {
|
||||||
//Logout if required
|
//Logout if required
|
||||||
if ( isset( $current_user->user_login ) ) {
|
if ( isset( $current_user->user_login ) ) {
|
||||||
if ( $current_user->user_login === $username ) {
|
if ( $current_user->user_login === $username ) {
|
||||||
|
|
||||||
|
// to fix issue multi user session
|
||||||
|
$user_id = wp_validate_auth_cookie();
|
||||||
|
if ( $user_id && $user_id === $current_user->ID ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
wp_set_auth_cookie( $current_user->ID );
|
wp_set_auth_cookie( $current_user->ID );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'wp_logout' );
|
do_action( 'wp_logout' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1665,7 @@ class MainWP_Child {
|
||||||
// wp_set_auth_cookie($user->ID);
|
// wp_set_auth_cookie($user->ID);
|
||||||
|
|
||||||
wp_set_current_user( $user->ID );
|
wp_set_current_user( $user->ID );
|
||||||
wp_set_auth_cookie( $user->ID );
|
wp_set_auth_cookie( $user->ID );
|
||||||
if ( $doAction ) {
|
if ( $doAction ) {
|
||||||
do_action( 'wp_login', $user->user_login );
|
do_action( 'wp_login', $user->user_login );
|
||||||
}
|
}
|
||||||
|
@ -1899,11 +2043,11 @@ class MainWP_Child {
|
||||||
// trick to prevent some premium plugins re-create update info
|
// trick to prevent some premium plugins re-create update info
|
||||||
remove_all_filters('pre_set_site_transient_update_plugins');
|
remove_all_filters('pre_set_site_transient_update_plugins');
|
||||||
|
|
||||||
$information['plugin_updates'] = get_plugin_updates();
|
// to support cached premium plugins update info, hooking in the bulk_upgrade()
|
||||||
|
|
||||||
// to support cached premium plugins update info, hooking in the bulk_upgrade()
|
|
||||||
add_filter( 'pre_site_transient_update_plugins', array( $this, 'set_cached_update_plugins' ) );
|
add_filter( 'pre_site_transient_update_plugins', array( $this, 'set_cached_update_plugins' ) );
|
||||||
|
|
||||||
|
$information['plugin_updates'] = get_plugin_updates();
|
||||||
|
|
||||||
$plugins = explode( ',', urldecode( $_POST['list'] ) );
|
$plugins = explode( ',', urldecode( $_POST['list'] ) );
|
||||||
$premiumPlugins = array();
|
$premiumPlugins = array();
|
||||||
$premiumUpdates = get_option( 'mainwp_premium_updates' );
|
$premiumUpdates = get_option( 'mainwp_premium_updates' );
|
||||||
|
@ -2011,6 +2155,10 @@ class MainWP_Child {
|
||||||
|
|
||||||
@wp_update_themes();
|
@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' ) );
|
||||||
|
|
||||||
$information['theme_updates'] = $this->upgrade_get_theme_updates();
|
$information['theme_updates'] = $this->upgrade_get_theme_updates();
|
||||||
$themes = explode( ',', $_POST['list'] );
|
$themes = explode( ',', $_POST['list'] );
|
||||||
$premiumThemes = array();
|
$premiumThemes = array();
|
||||||
|
@ -2094,6 +2242,10 @@ class MainWP_Child {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_filter( 'pre_site_transient_update_themes', array( $this, 'set_cached_update_themes' ), 10 );
|
||||||
|
delete_site_transient( 'mainwp_update_themes_cached' ); // to fix cached update info
|
||||||
|
|
||||||
|
|
||||||
// $last_update = get_site_transient( 'update_themes' );
|
// $last_update = get_site_transient( 'update_themes' );
|
||||||
// if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) {
|
// if ( !empty( $last_update ) && property_exists( $last_update, 'last_checked' ) ) {
|
||||||
// $last_update->last_checked = $originalLastChecked;
|
// $last_update->last_checked = $originalLastChecked;
|
||||||
|
@ -2197,9 +2349,32 @@ class MainWP_Child {
|
||||||
$pre = false;
|
$pre = false;
|
||||||
$cached_update_info = get_site_transient( 'mainwp_update_plugins_cached' );
|
$cached_update_info = get_site_transient( 'mainwp_update_plugins_cached' );
|
||||||
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
||||||
foreach( $cached_update_info as $slug => $plugin_update ) {
|
foreach( $cached_update_info as $slug => $info ) {
|
||||||
if ( !isset( $_transient_data->response[ $slug ] ) && isset($plugin_update->update) ) {
|
if ( !isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
||||||
$_transient_data->response[ $slug ] = $plugin_update->update;
|
$_transient_data->response[ $slug ] = $info->update;
|
||||||
|
$pre = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pre == false)
|
||||||
|
return $false;
|
||||||
|
|
||||||
|
return $_transient_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_cached_update_themes( $false = false, $_transient_data = null ) {
|
||||||
|
|
||||||
|
if ( ! is_object( $_transient_data ) ) {
|
||||||
|
$_transient_data = new stdClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pre = false;
|
||||||
|
$cached_update_info = get_site_transient( 'mainwp_update_themes_cached' );
|
||||||
|
if ( is_array($cached_update_info) && count($cached_update_info) > 0 ) {
|
||||||
|
foreach( $cached_update_info as $slug => $info ) {
|
||||||
|
if ( !isset( $_transient_data->response[ $slug ] ) && isset($info->update) ) {
|
||||||
|
$_transient_data->response[ $slug ] = $info->update;
|
||||||
$pre = true;
|
$pre = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2253,11 +2428,13 @@ class MainWP_Child {
|
||||||
MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' );
|
|
||||||
|
|
||||||
//Already added - can't readd. Deactivate plugin..
|
//Already added - can't readd. Deactivate plugin..
|
||||||
if ( get_option( 'mainwp_child_pubkey' ) ) {
|
if ( get_option( 'mainwp_child_pubkey' ) ) {
|
||||||
|
// set disconnect status to yes here, it will empty after reconnected
|
||||||
|
MainWP_Child_Branding::Instance()->save_branding_options('branding_disconnected', 'yes');
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' ); // to compatible with old client reports
|
||||||
MainWP_Helper::error( __( 'Public key already set. Please reset the MainWP Child plugin on the child site and try again.', 'mainwp-child' ) );
|
MainWP_Helper::error( __( 'Public key already set. Please reset the MainWP Child plugin on the child site and try again.', 'mainwp-child' ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' != get_option( 'mainwp_child_uniqueId' ) ) {
|
if ( '' != get_option( 'mainwp_child_uniqueId' ) ) {
|
||||||
|
@ -2294,7 +2471,6 @@ class MainWP_Child {
|
||||||
$nossl_key = uniqid( '', true );
|
$nossl_key = uniqid( '', true );
|
||||||
MainWP_Helper::update_option( 'mainwp_child_nossl_key', $nossl_key, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_nossl_key', $nossl_key, 'yes' );
|
||||||
$information['nosslkey'] = $nossl_key;
|
$information['nosslkey'] = $nossl_key;
|
||||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', '', 'yes' );
|
|
||||||
|
|
||||||
$information['register'] = 'OK';
|
$information['register'] = 'OK';
|
||||||
$information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' );
|
$information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' );
|
||||||
|
@ -2348,9 +2524,21 @@ class MainWP_Child {
|
||||||
$my_post = array();
|
$my_post = array();
|
||||||
|
|
||||||
if ( 'publish' === $action ) {
|
if ( 'publish' === $action ) {
|
||||||
// to fix error post slug
|
$post_current = get_post( $postId );
|
||||||
//wp_publish_post( $postId );
|
if ( empty($post_current) ) {
|
||||||
wp_update_post(array('ID' => $postId, 'post_status' => 'publish' ));
|
$information['status'] = 'FAIL';
|
||||||
|
} else {
|
||||||
|
if ( 'future' == $post_current->post_status ) {
|
||||||
|
wp_publish_post( $postId ); // to fix: fail when publish future page
|
||||||
|
wp_update_post(array('ID' => $postId,
|
||||||
|
'post_date' => current_time( 'mysql', false ),
|
||||||
|
'post_date_gmt' => current_time( 'mysql', true )
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
// to fix error post slug
|
||||||
|
wp_update_post(array('ID' => $postId,'post_status' => 'publish' ));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if ( 'update' === $action ) {
|
} else if ( 'update' === $action ) {
|
||||||
$postData = $_POST['post_data'];
|
$postData = $_POST['post_data'];
|
||||||
$my_post = is_array( $postData ) ? $postData : array();
|
$my_post = is_array( $postData ) ? $postData : array();
|
||||||
|
@ -2897,7 +3085,7 @@ class MainWP_Child {
|
||||||
$message .= sprintf( __( 'Password: %s' ), $new_user['user_pass'] ) . "\r\n";
|
$message .= sprintf( __( 'Password: %s' ), $new_user['user_pass'] ) . "\r\n";
|
||||||
$message .= wp_login_url() . "\r\n";
|
$message .= wp_login_url() . "\r\n";
|
||||||
|
|
||||||
wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message );
|
@wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message, '' );
|
||||||
}
|
}
|
||||||
$information['added'] = true;
|
$information['added'] = true;
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
|
@ -3461,15 +3649,16 @@ class MainWP_Child {
|
||||||
$this->updateExternalSettings();
|
$this->updateExternalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainWP_Child_Branding::Instance()->save_branding_options('branding_disconnected', '');
|
||||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', '', 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', '', 'yes' );
|
||||||
if ( isset( $_POST['server'] ) ) {
|
if ( isset( $_POST['server'] ) ) {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] );
|
MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['numberdaysOutdatePluginTheme'] ) && ! empty( $_POST['numberdaysOutdatePluginTheme'] ) ) {
|
if ( isset( $_POST['numberdaysOutdatePluginTheme'] ) ) {
|
||||||
$days_outdate = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
$days_outdate = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||||
if ( $days_outdate !== $_POST['numberdaysOutdatePluginTheme'] ) {
|
if ( $days_outdate != $_POST['numberdaysOutdatePluginTheme'] ) {
|
||||||
$days_outdate = $_POST['numberdaysOutdatePluginTheme'];
|
$days_outdate = intval($_POST['numberdaysOutdatePluginTheme']);
|
||||||
MainWP_Helper::update_option( 'mainwp_child_plugintheme_days_outdate', $days_outdate );
|
MainWP_Helper::update_option( 'mainwp_child_plugintheme_days_outdate', $days_outdate );
|
||||||
MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation( false );
|
MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation( false );
|
||||||
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
|
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
|
||||||
|
@ -3479,7 +3668,7 @@ class MainWP_Child {
|
||||||
$information['version'] = self::$version;
|
$information['version'] = self::$version;
|
||||||
$information['wpversion'] = $wp_version;
|
$information['wpversion'] = $wp_version;
|
||||||
$information['siteurl'] = get_option( 'siteurl' );
|
$information['siteurl'] = get_option( 'siteurl' );
|
||||||
$information['wpe'] = function_exists( 'is_wpe' ) ? 1 : 0;
|
$information['wpe'] = MainWP_Helper::is_wp_engine() ? 1 : 0;
|
||||||
|
|
||||||
$information['site_info'] = array(
|
$information['site_info'] = array(
|
||||||
'wpversion' => $wp_version,
|
'wpversion' => $wp_version,
|
||||||
|
@ -3614,23 +3803,23 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// to fix bug
|
if ( null !== $this->filterFunction ) {
|
||||||
$info_update_plugins_cached = get_site_transient( 'mainwp_update_plugins_cached' );
|
remove_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
|
||||||
if ( is_array( $info_update_plugins_cached ) && ( count( $info_update_plugins_cached ) > 0 ) ) {
|
}
|
||||||
|
|
||||||
|
// to fix premium plugs update
|
||||||
|
$cached_plugins_update = get_site_transient( 'mainwp_update_plugins_cached' );
|
||||||
|
if ( is_array( $cached_plugins_update ) && ( count( $cached_plugins_update ) > 0 ) ) {
|
||||||
if (!isset($information['plugin_updates'])) {
|
if (!isset($information['plugin_updates'])) {
|
||||||
$information['plugin_updates'] = array();
|
$information['plugin_updates'] = array();
|
||||||
}
|
}
|
||||||
foreach( $info_update_plugins_cached as $slug => $plugin_update ) {
|
foreach( $cached_plugins_update as $slug => $plugin_update ) {
|
||||||
if ( !isset( $information['plugin_updates'][ $slug ] ) ) {
|
if ( !isset( $information['plugin_updates'][ $slug ] ) ) {
|
||||||
$information['plugin_updates'][ $slug ] = $plugin_update;
|
$information['plugin_updates'][ $slug ] = $plugin_update;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end fix
|
|
||||||
|
|
||||||
if ( null !== $this->filterFunction ) {
|
|
||||||
remove_filter( 'pre_site_transient_update_plugins', $this->filterFunction, 99 );
|
|
||||||
}
|
|
||||||
if ( null !== $this->filterFunction ) {
|
if ( null !== $this->filterFunction ) {
|
||||||
add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
add_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
||||||
}
|
}
|
||||||
|
@ -3653,6 +3842,26 @@ class MainWP_Child {
|
||||||
remove_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
remove_filter( 'pre_site_transient_update_themes', $this->filterFunction, 99 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to fix premium themes update
|
||||||
|
$cached_themes_update = get_site_transient( 'mainwp_update_themes_cached' );
|
||||||
|
if ( is_array( $cached_themes_update ) && ( count( $cached_themes_update ) > 0 ) ) {
|
||||||
|
if (!isset($information['theme_updates'])) {
|
||||||
|
$information['theme_updates'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $cached_themes_update as $slug => $theme_update ) {
|
||||||
|
$name = ( is_array( $theme_update ) ? $theme_update['Name'] : $theme_update->Name );
|
||||||
|
if ( in_array( $name, $premiumThemes ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( isset( $information['theme_updates'][ $slug ] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$information['theme_updates'][ $slug ] = $theme_update;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$translation_updates = wp_get_translation_updates();
|
$translation_updates = wp_get_translation_updates();
|
||||||
if ( !empty( $translation_updates ) ) {
|
if ( !empty( $translation_updates ) ) {
|
||||||
$information['translation_updates'] = array();
|
$information['translation_updates'] = array();
|
||||||
|
@ -4773,7 +4982,7 @@ class MainWP_Child {
|
||||||
global $wp_version;
|
global $wp_version;
|
||||||
$information['version'] = self::$version;
|
$information['version'] = self::$version;
|
||||||
$information['wpversion'] = $wp_version;
|
$information['wpversion'] = $wp_version;
|
||||||
$information['wpe'] = function_exists( 'is_wpe' ) ? 1 : 0;
|
$information['wpe'] = MainWP_Helper::is_wp_engine() ? 1 : 0;
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5226,8 +5435,8 @@ class MainWP_Child {
|
||||||
'<div>' . 'USER AGENT: ' . $agent . '</div>';
|
'<div>' . 'USER AGENT: ' . $agent . '</div>';
|
||||||
$mail = '<div>404 alert</div>
|
$mail = '<div>404 alert</div>
|
||||||
<div></div>' . $mail;
|
<div></div>' . $mail;
|
||||||
wp_mail( $email, 'MainWP - 404 Alert: ' . $blog, MainWP_Helper::formatEmail( $email, $mail ), array(
|
@wp_mail( $email, 'MainWP - 404 Alert: ' . $blog, MainWP_Helper::formatEmail( $email, $mail ), array(
|
||||||
'From: "' . $from_email . '" <' . $from_email . '>',
|
//'From: "' . $from_email . '" <' . $from_email . '>',
|
||||||
'content-type: text/html',
|
'content-type: text/html',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -5299,13 +5508,33 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function snippetUpdateWPConfig( $action, $slug, $code = '' ) {
|
public function snippetUpdateWPConfig( $action, $slug, $code = '' ) {
|
||||||
$wpConfig = file_get_contents( ABSPATH . 'wp-config.php' );
|
|
||||||
if ( 'delete' === $action ) {
|
$config_file = '';
|
||||||
$wpConfig = preg_replace( '/' . PHP_EOL . '{1,2}\/\*\*\*snippet_' . $slug . '\*\*\*\/(.*)\/\*\*\*end_' . $slug . '\*\*\*\/' . PHP_EOL . '/is', '', $wpConfig );
|
if ( file_exists( ABSPATH . 'wp-config.php') ) {
|
||||||
} else if ( 'save' === $action ) {
|
|
||||||
$wpConfig = preg_replace( '/(\$table_prefix *= *[\'"][^\'|^"]*[\'"] *;)/is', '${1}' . PHP_EOL . PHP_EOL . '/***snippet_' . $slug . '***/' . PHP_EOL . $code . PHP_EOL . '/***end_' . $slug . '***/' . PHP_EOL, $wpConfig );
|
/** The config file resides in ABSPATH */
|
||||||
}
|
$config_file = ABSPATH . 'wp-config.php';
|
||||||
file_put_contents( ABSPATH . 'wp-config.php', $wpConfig );
|
|
||||||
|
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
|
||||||
|
|
||||||
|
/** The config file resides one level above ABSPATH but is not part of another install */
|
||||||
|
$config_file = dirname( ABSPATH ) . '/wp-config.php';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !empty($config_file) ) {
|
||||||
|
$wpConfig = file_get_contents( $config_file );
|
||||||
|
|
||||||
|
if ( 'delete' === $action ) {
|
||||||
|
$wpConfig = preg_replace( '/' . PHP_EOL . '{1,2}\/\*\*\*snippet_' . $slug . '\*\*\*\/(.*)\/\*\*\*end_' . $slug . '\*\*\*\/' . PHP_EOL . '/is', '', $wpConfig );
|
||||||
|
} else if ( 'save' === $action ) {
|
||||||
|
$wpConfig = preg_replace( '/(\$table_prefix *= *[\'"][^\'|^"]*[\'"] *;)/is', '${1}' . PHP_EOL . PHP_EOL . '/***snippet_' . $slug . '***/' . PHP_EOL . $code . PHP_EOL . '/***end_' . $slug . '***/' . PHP_EOL, $wpConfig );
|
||||||
|
}
|
||||||
|
file_put_contents( $config_file, $wpConfig );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_saved_snippets() {
|
function run_saved_snippets() {
|
||||||
|
@ -5564,7 +5793,7 @@ class MainWP_Child {
|
||||||
MainWP_Helper::write( $information );
|
MainWP_Helper::write( $information );
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnect() {
|
function disconnect() {
|
||||||
$this->deactivation(false);
|
$this->deactivation(false);
|
||||||
MainWP_Helper::write( array( 'result' => 'success' ) );
|
MainWP_Helper::write( array( 'result' => 'success' ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ class MainWP_Client_Report {
|
||||||
$args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] );
|
$args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
if ( MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||||
$args['hide_child_reports'] = 1;
|
$args['hide_child_reports'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,6 +316,8 @@ class MainWP_Client_Report {
|
||||||
|
|
||||||
function get_other_tokens_data( $records, $tokens, &$skip_records ) {
|
function get_other_tokens_data( $records, $tokens, &$skip_records ) {
|
||||||
|
|
||||||
|
// convert context name of tokens to context name saved in child report
|
||||||
|
// some context are not difference
|
||||||
$convert_context_name = array(
|
$convert_context_name = array(
|
||||||
'comment' => 'comments',
|
'comment' => 'comments',
|
||||||
'plugin' => 'plugins',
|
'plugin' => 'plugins',
|
||||||
|
@ -489,19 +491,19 @@ class MainWP_Client_Report {
|
||||||
'backup' => 'mainwp_backup',
|
'backup' => 'mainwp_backup',
|
||||||
);
|
);
|
||||||
|
|
||||||
$some_allowed_data = array(
|
// $some_allowed_data = array(
|
||||||
'ID',
|
// 'ID',
|
||||||
'name',
|
// 'name',
|
||||||
'title',
|
// 'title',
|
||||||
'oldversion',
|
// 'oldversion',
|
||||||
'currentversion',
|
// 'currentversion',
|
||||||
'date',
|
// 'date',
|
||||||
'time',
|
// 'time',
|
||||||
'count',
|
// 'count',
|
||||||
'author',
|
// 'author',
|
||||||
'old.version',
|
// 'old.version',
|
||||||
'current.version',
|
// 'current.version',
|
||||||
);
|
// );
|
||||||
|
|
||||||
$context = $action = '';
|
$context = $action = '';
|
||||||
$str_tmp = str_replace( array( '[', ']' ), '', $section );
|
$str_tmp = str_replace( array( '[', ']' ), '', $section );
|
||||||
|
@ -807,30 +809,33 @@ class MainWP_Client_Report {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_showhide() {
|
function set_showhide() {
|
||||||
// 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_Child_Branding::Instance()->save_branding_options('hide_child_reports', $hide);
|
||||||
MainWP_Helper::update_option( 'mainwp_creport_branding_stream_hide', $hide, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_creport_branding_stream_hide', $hide, 'yes' ); // to compatible with old child reports
|
||||||
$information['result'] = 'SUCCESS';
|
$information['result'] = 'SUCCESS';
|
||||||
|
|
||||||
return $information;
|
return $information;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function creport_init() {
|
public function creport_init() {
|
||||||
// if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||||
$hide_nag = false;
|
$hide_nag = false;
|
||||||
if ( get_option( 'mainwp_creport_branding_stream_hide' ) === 'hide' ) {
|
|
||||||
add_filter( 'all_plugins', array( $this, 'creport_branding_plugin' ) );
|
|
||||||
add_action( 'admin_menu', array( $this, 'creport_remove_menu' ) );
|
|
||||||
$hide_nag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
// check setting of 'hide_child_reports'
|
||||||
|
if ( isset($branding_opts['hide_child_reports']) && $branding_opts['hide_child_reports'] == 'hide' ) {
|
||||||
|
add_filter( 'all_plugins', array( $this, 'creport_branding_plugin' ) );
|
||||||
|
add_action( 'admin_menu', array( $this, 'creport_remove_menu' ) );
|
||||||
$hide_nag = true;
|
$hide_nag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! $hide_nag ) {
|
||||||
|
// check child branding settings
|
||||||
|
if ( MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||||
|
$hide_nag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($hide_nag) {
|
if ($hide_nag) {
|
||||||
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_filter( 'mainwp_child_hide_update_notice', array( &$this, 'hide_update_notice' ) );
|
||||||
|
|
|
@ -198,7 +198,7 @@ class MainWP_Clone {
|
||||||
</div>
|
</div>
|
||||||
<p><?php _e("The site selected above will replace this site's files and database", 'mainwp-child'); ?></p>
|
<p><?php _e("The site selected above will replace this site's files and database", 'mainwp-child'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mainwp-child_clonebutton_container"><?php if ( ! $error ) { ?>
|
<div class="mainwp-child_clonebutton_container"><?php if ( ! $error ) { ?>
|
||||||
<a href="#"
|
<a href="#"
|
||||||
id="mainwp-child_clonebutton"
|
id="mainwp-child_clonebutton"
|
||||||
class="button-primary"><?php esc_html_e( 'Clone website', 'mainwp-child' ); ?></a><?php } ?>
|
class="button-primary"><?php esc_html_e( 'Clone website', 'mainwp-child' ); ?></a><?php } ?>
|
||||||
|
@ -223,12 +223,12 @@ class MainWP_Clone {
|
||||||
<br/>
|
<br/>
|
||||||
<form
|
<form
|
||||||
action="<?php echo esc_attr( admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone&upload=yes' ) ); ?>"
|
action="<?php echo esc_attr( admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone&upload=yes' ) ); ?>"
|
||||||
method="post"
|
method="post"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="file" name="file" id="file"/>
|
<input type="file" name="file" id="file"/>
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
name="submit"
|
name="submit"
|
||||||
id="filesubmit"
|
id="filesubmit"
|
||||||
class="button button-primary"
|
class="button button-primary"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
value="<?php esc_attr_e( 'Clone/Restore Website', 'mainwp-child' ); ?>"/>
|
value="<?php esc_attr_e( 'Clone/Restore Website', 'mainwp-child' ); ?>"/>
|
||||||
|
@ -287,7 +287,7 @@ class MainWP_Clone {
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if ( $uploadFile ) {
|
if ( $uploadFile ) {
|
||||||
esc_html_e( 'Upload successful.', 'mainwp-child' ); ?> <a href="#"
|
esc_html_e( 'Upload successful.', 'mainwp-child' ); ?> <a href="#"
|
||||||
id="mainwp-child_uploadclonebutton"
|
id="mainwp-child_uploadclonebutton"
|
||||||
class="button-primary"
|
class="button-primary"
|
||||||
file="<?php echo esc_attr( $uploadFile ); ?>"><?php esc_html_e( 'Restore Website', 'mainwp-child' ); ?></a><?php
|
file="<?php echo esc_attr( $uploadFile ); ?>"><?php esc_html_e( 'Restore Website', 'mainwp-child' ); ?></a><?php
|
||||||
|
@ -300,26 +300,19 @@ class MainWP_Clone {
|
||||||
?>
|
?>
|
||||||
<p><?php esc_html_e( 'Upload backup in .zip format (Maximum filesize for your server settings: ', 'mainwp-child' ); ?><?php echo esc_html( $uploadSize ); ?>)</p>
|
<p><?php esc_html_e( 'Upload backup in .zip format (Maximum filesize for your server settings: ', 'mainwp-child' ); ?><?php echo esc_html( $uploadSize ); ?>)</p>
|
||||||
<?php
|
<?php
|
||||||
$branding_msg = '';
|
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||||
if ( MainWP_Child_Branding::is_branding() ) {
|
if ( $branding_title != '' ) {
|
||||||
$branding_title = MainWP_Child_Branding::get_branding();
|
$branding_msg = 'If you have a FULL backup created by basic ' . esc_html( stripslashes( $branding_title ) ) . ' Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.';
|
||||||
$branding_msg = 'If you have a FULL backup created by basic ' . esc_html( stripslashes( $branding_title ) ) . ' Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.';
|
} else {
|
||||||
|
$branding_msg = esc_html__( 'If you have a FULL backup created by basic MainWP Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.', 'mainwp-child' );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<em>
|
<em> <?php echo $branding_msg ; ?> <br/>
|
||||||
<?php
|
|
||||||
if ($branding_msg != '') {
|
|
||||||
echo $branding_msg ;
|
|
||||||
} else {
|
|
||||||
esc_html_e( 'If you have a FULL backup created by basic MainWP Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.', 'mainwp-child' );
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<br/>
|
|
||||||
<?php esc_html_e( 'A database only backup will not work.', 'mainwp-child' ); ?></em><br/><br/>
|
<?php esc_html_e( 'A database only backup will not work.', 'mainwp-child' ); ?></em><br/><br/>
|
||||||
<form action="<?php echo esc_attr( admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone&upload=yes' ) ); ?>"
|
<form action="<?php echo esc_attr( admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone&upload=yes' ) ); ?>"
|
||||||
method="post"
|
method="post"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="file" name="file" id="file"/>
|
<input type="file" name="file" id="file"/>
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
name="submit"
|
name="submit"
|
||||||
class="button button-primary"
|
class="button button-primary"
|
||||||
|
@ -332,7 +325,7 @@ class MainWP_Clone {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
self::renderCloneFromServer();
|
self::renderCloneFromServer();
|
||||||
self::renderJavaScript();
|
self::renderJavaScript();
|
||||||
}
|
}
|
||||||
|
@ -350,7 +343,7 @@ class MainWP_Clone {
|
||||||
|
|
||||||
$page = $_REQUEST['page'];
|
$page = $_REQUEST['page'];
|
||||||
|
|
||||||
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
||||||
$url = admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone#title_03' );
|
$url = admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone#title_03' );
|
||||||
|
|
||||||
$dirs = MainWP_Helper::getMainWPDir( 'backup', false );
|
$dirs = MainWP_Helper::getMainWPDir( 'backup', false );
|
||||||
|
@ -895,7 +888,7 @@ class MainWP_Clone {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function renderStyle() {
|
public static function renderStyle() {
|
||||||
|
|
|
@ -263,18 +263,21 @@ class MainWP_Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// current user may be connected admin or alternative admin
|
||||||
|
$current_uid = $current_user->ID;
|
||||||
//Set up a new post (adding addition information)
|
//Set up a new post (adding addition information)
|
||||||
$usr = get_user_by( 'login', $_POST['user'] );
|
//$usr = get_user_by( 'login', $_POST['user'] );
|
||||||
//$new_post['post_author'] = $current_user->ID;
|
//$new_post['post_author'] = $current_user->ID;
|
||||||
$is_robot_post = false;
|
|
||||||
|
$is_robot_post = false; // retirement soon
|
||||||
if ( isset( $_POST['isMainWPRobot'] ) && ! empty( $_POST['isMainWPRobot'] ) ) {
|
if ( isset( $_POST['isMainWPRobot'] ) && ! empty( $_POST['isMainWPRobot'] ) ) {
|
||||||
$is_robot_post = true;
|
$is_robot_post = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_author = isset( $new_post['post_author'] ) ? $new_post['post_author'] : $usr->ID;
|
$post_author = isset( $new_post['post_author'] ) ? $new_post['post_author'] : $current_uid;
|
||||||
if ( $is_robot_post ) {
|
if ( $is_robot_post ) { // retirement soon
|
||||||
if ( 1 === $post_author ) {
|
if ( 1 === $post_author ) {
|
||||||
$new_post['post_author'] = $usr->ID;
|
$new_post['post_author'] = $current_uid;
|
||||||
} else if ( ! is_numeric( $post_author ) ) {
|
} else if ( ! is_numeric( $post_author ) ) {
|
||||||
$user_author = get_user_by( 'login', $post_author );
|
$user_author = get_user_by( 'login', $post_author );
|
||||||
if ( $user_author ) {
|
if ( $user_author ) {
|
||||||
|
@ -289,12 +292,12 @@ class MainWP_Helper {
|
||||||
if ( ! empty( $_author ) ) {
|
if ( ! empty( $_author ) ) {
|
||||||
$new_post['post_author'] = $_author->ID;
|
$new_post['post_author'] = $_author->ID;
|
||||||
} else {
|
} else {
|
||||||
$new_post['post_author'] = $usr->ID;
|
$new_post['post_author'] = $current_uid;
|
||||||
}
|
}
|
||||||
unset( $new_post['custom_post_author'] );
|
unset( $new_post['custom_post_author'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_author = ! empty( $post_author ) ? $post_author : $usr->ID;
|
$post_author = ! empty( $post_author ) ? $post_author : $current_uid;
|
||||||
$new_post['post_author'] = $post_author;
|
$new_post['post_author'] = $post_author;
|
||||||
|
|
||||||
$is_ezine_post = ! empty( $post_custom['_ezine_post_article_source'] ) ? true : false;
|
$is_ezine_post = ! empty( $post_custom['_ezine_post_article_source'] ) ? true : false;
|
||||||
|
@ -1433,6 +1436,10 @@ static function remove_filters_with_method_name( $hook_name = '', $method_name =
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function is_wp_engine() {
|
||||||
|
return function_exists( 'is_wpe' ) && is_wpe();
|
||||||
|
}
|
||||||
|
|
||||||
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)) {
|
||||||
|
|
|
@ -318,6 +318,11 @@ class MainWP_Security {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function remove_readme( $force = false ) {
|
public static function remove_readme( $force = false ) {
|
||||||
|
|
||||||
|
// to prevent remove readme.html file on WPE hosts
|
||||||
|
if ( MainWP_Helper::is_wp_engine() )
|
||||||
|
return true;
|
||||||
|
|
||||||
if ( $force || self::get_security_option( 'readme' ) ) {
|
if ( $force || self::get_security_option( 'readme' ) ) {
|
||||||
if ( @file_exists( ABSPATH . 'readme.html' ) ) {
|
if ( @file_exists( ABSPATH . 'readme.html' ) ) {
|
||||||
if ( ! @unlink( ABSPATH . 'readme.html' ) ) {
|
if ( ! @unlink( ABSPATH . 'readme.html' ) ) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ class MainWP_Wordpress_SEO {
|
||||||
if ( $this->import_seo_settings( $temporary_file ) ) {
|
if ( $this->import_seo_settings( $temporary_file ) ) {
|
||||||
$information['success'] = true;
|
$information['success'] = true;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( __( 'Settings could not be imported:', 'wordpress-seo' ) );
|
throw new Exception( __( 'Settings could not be imported.', 'wordpress-seo' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
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.3
|
Version: 3.5.4
|
||||||
*/
|
*/
|
||||||
//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' );
|
||||||
|
|
15
readme.txt
15
readme.txt
|
@ -6,8 +6,8 @@ Author: mainwp
|
||||||
Author URI: https://mainwp.com
|
Author URI: https://mainwp.com
|
||||||
Plugin URI: https://mainwp.com
|
Plugin URI: https://mainwp.com
|
||||||
Requires at least: 3.6
|
Requires at least: 3.6
|
||||||
Tested up to: 5.0.1
|
Tested up to: 5.0.3
|
||||||
Stable tag: 3.5.3
|
Stable tag: 3.5.4
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
@ -71,6 +71,17 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 3.5.4 - 2-14-19 =
|
||||||
|
* Fixed: issues with displaying broken links data for specific setups
|
||||||
|
* Fixed: compatibility issues with the latest PageSpeed Insights plugin version
|
||||||
|
* Fixed: an issue with publishing "future" posts
|
||||||
|
* Fixed: an issue with sending email alerts in specific setups
|
||||||
|
* Fixed: an issue with saving code snippets in wp-config.php when the file is in a custom location
|
||||||
|
* Fixed: an issue with clearing unused scheduled cron jobs
|
||||||
|
* Added: support for the new PageSpeed Insights plugin options
|
||||||
|
* Updated: disabled the "Remove readme.html" security check feature for WPEngine hosted child sites
|
||||||
|
* Updated: support for detecting premium themes updates
|
||||||
|
|
||||||
= 3.5.3 - 12-19-18 =
|
= 3.5.3 - 12-19-18 =
|
||||||
* Fixed: an issue with the X-Frame-Options configuration
|
* Fixed: an issue with the X-Frame-Options configuration
|
||||||
* Fixed: an issue with clearing WP Rocket cache
|
* Fixed: an issue with clearing WP Rocket cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue