mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-05 09:19:53 +08:00
Merge with branch01
This commit is contained in:
parent
57b229fe3d
commit
0335237fe2
8 changed files with 456 additions and 238 deletions
|
@ -38,7 +38,7 @@ class MainWP_Child_Branding {
|
|||
if ( ! self::is_branding() ) {
|
||||
return $plugin_meta;
|
||||
}
|
||||
// hide View details links
|
||||
// hide View details links
|
||||
$meta_total = count( $plugin_meta );
|
||||
for ( $i = 0; $i < $meta_total; $i++ ) {
|
||||
$str_meta = $plugin_meta[ $i ];
|
||||
|
@ -107,17 +107,17 @@ class MainWP_Child_Branding {
|
|||
'authoruri' => $settings['child_plugin_author_uri'],
|
||||
'pluginuri' => $settings['child_plugin_uri'],
|
||||
);
|
||||
MainWP_Helper::update_option( 'mainwp_branding_preserve_branding', $settings['child_preserve_branding'] );
|
||||
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_support_email', $settings['child_support_email'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_support_message', $settings['child_support_message'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_restore', $settings['child_remove_restore'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_setting', $settings['child_remove_setting'], 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_server_info', $settings['child_remove_server_info'] );
|
||||
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_tools', $settings['child_remove_wp_tools'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'] );
|
||||
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_tools', $settings['child_remove_wp_tools'], 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting'], 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_remove_permalink', $settings['child_remove_permalink'], 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_button_contact_label', $settings['child_button_contact_label'], 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_send_email_message', $settings['child_send_email_message'] );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_message_return_sender', $settings['child_message_return_sender'] );
|
||||
|
@ -210,7 +210,7 @@ class MainWP_Child_Branding {
|
|||
MainWP_Helper::update_option( 'mainwp_branding_extra_settings', $extra_setting, 'yes' );
|
||||
|
||||
if ( $settings['child_plugin_hide'] ) {
|
||||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', 'T' );
|
||||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', 'T', 'yes' );
|
||||
} else {
|
||||
MainWP_Helper::update_option( 'mainwp_branding_child_hide', '' );
|
||||
}
|
||||
|
@ -275,9 +275,9 @@ class MainWP_Child_Branding {
|
|||
// enable branding in case child plugin is deactive
|
||||
add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
|
||||
|
||||
if ( self::is_branding() ) {
|
||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||
}
|
||||
if ( self::is_branding() ) {
|
||||
add_filter( 'site_transient_update_plugins', array( &$this, 'remove_update_nag' ) );
|
||||
}
|
||||
|
||||
if ( get_option( 'mainwp_branding_ext_enabled' ) !== 'Y' ) {
|
||||
return;
|
||||
|
@ -285,24 +285,26 @@ class MainWP_Child_Branding {
|
|||
|
||||
add_filter( 'map_meta_cap', array( $this, 'branding_map_meta_cap' ), 10, 5 );
|
||||
|
||||
if ( 'T' === get_option( 'mainwp_branding_show_support' ) ) {
|
||||
$title = $this->settings['contact_support_label'];
|
||||
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'];
|
||||
add_menu_page( $title, $title, 'read', 'ContactSupport2', array(
|
||||
$this,
|
||||
'contact_support',
|
||||
), '', '2.0001' );
|
||||
}
|
||||
|
||||
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(
|
||||
$this,
|
||||
'contact_support',
|
||||
) );
|
||||
add_action( 'admin_bar_menu', array( $this, 'add_support_button_in_top_admin_bar' ), 100 );
|
||||
}
|
||||
}
|
||||
// to fix
|
||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
|
||||
// if ( 'T' === get_option( 'mainwp_branding_show_support' ) ) {
|
||||
// $title = $this->settings['contact_support_label'];
|
||||
// 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'];
|
||||
// add_menu_page( $title, $title, 'read', 'ContactSupport2', array(
|
||||
// $this,
|
||||
// 'contact_support',
|
||||
// ), '', '2.0001' );
|
||||
// }
|
||||
//
|
||||
// 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(
|
||||
// $this,
|
||||
// 'contact_support',
|
||||
// ) );
|
||||
// add_action( 'admin_bar_menu', array( $this, 'add_support_button_in_top_admin_bar' ), 100 );
|
||||
// }
|
||||
// }
|
||||
if ( get_option( 'mainwp_branding_disable_wp_branding' ) !== 'Y' ) {
|
||||
add_filter( 'wp_footer', array( &$this, 'branding_global_footer' ), 15 );
|
||||
add_action( 'wp_dashboard_setup', array( &$this, 'custom_dashboard_widgets' ), 999 );
|
||||
|
@ -330,6 +332,33 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
}
|
||||
|
||||
// to fix conflict with other plugin
|
||||
function admin_menu() {
|
||||
$extra_setting = $this->settings['extra_settings'];
|
||||
if ( ! is_array( $extra_setting ) ) {
|
||||
$extra_setting = array();
|
||||
}
|
||||
if ( 'T' === get_option( 'mainwp_branding_show_support' ) ) {
|
||||
$title = $this->settings['contact_support_label'];
|
||||
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'];
|
||||
add_menu_page( $title, $title, 'read', 'ContactSupport2', array(
|
||||
$this,
|
||||
'contact_support',
|
||||
), '', '2.0001' );
|
||||
}
|
||||
|
||||
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(
|
||||
$this,
|
||||
'contact_support',
|
||||
) );
|
||||
add_action( 'admin_bar_menu', array( $this, 'add_support_button_in_top_admin_bar' ), 100 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function remove_default_post_metaboxes() {
|
||||
$extra_setting = $this->settings['extra_settings'];
|
||||
if ( ! is_array( $extra_setting ) ) {
|
||||
|
@ -615,7 +644,7 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
|
||||
function contact_support() {
|
||||
if ( current_user_can( 'subscriber' ) ) {
|
||||
if ( !current_user_can('administrator') ) {
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
|
@ -710,7 +739,7 @@ class MainWP_Child_Branding {
|
|||
* @param WP_Admin_Bar $wp_admin_bar
|
||||
*/
|
||||
public function add_support_button_in_top_admin_bar( $wp_admin_bar ) {
|
||||
if ( current_user_can( 'subscriber' ) ) {
|
||||
if ( !current_user_can( 'administrator' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -800,7 +829,7 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
}
|
||||
|
||||
function remove_update_nag( $value ) {
|
||||
function remove_update_nag( $value ) {
|
||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue