mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-05 09:19:53 +08:00
Merge with Thangs branch
This commit is contained in:
parent
b5f9300816
commit
5cae413ff3
3 changed files with 57 additions and 38 deletions
|
@ -154,28 +154,52 @@ class MainWPChild
|
|||
|
||||
function admin_menu()
|
||||
{
|
||||
// hide menu
|
||||
if (get_option('mainwp_branding_remove_wp_tools')) {
|
||||
remove_menu_page( 'tools.php' );
|
||||
$pos = stripos($_SERVER['REQUEST_URI'], 'tools.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'import.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'export.php');
|
||||
if ($pos !== false)
|
||||
wp_redirect(get_option('siteurl') . '/wp-admin/index.php');
|
||||
}
|
||||
|
||||
if (get_option('mainwp_branding_remove_wp_setting')) {
|
||||
remove_menu_page( 'options-general.php' );
|
||||
$pos = stripos($_SERVER['REQUEST_URI'], 'options-general.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'options-writing.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'options-reading.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'options-discussion.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'options-media.php') ||
|
||||
stripos($_SERVER['REQUEST_URI'], 'options-permalink.php');
|
||||
if ($pos !== false)
|
||||
wp_redirect(get_option('siteurl') . '/wp-admin/index.php');
|
||||
}
|
||||
|
||||
// hide menu
|
||||
if (get_option('mainwp_branding_child_hide') == 'T')
|
||||
return;
|
||||
|
||||
$branding_header = get_option('mainwp_branding_plugin_header');
|
||||
|
||||
if (is_array($branding_header) && !empty($branding_header['name']))
|
||||
$this->branding = $branding_header['name'];
|
||||
$this->branding = stripslashes($branding_header['name']);
|
||||
|
||||
add_options_page('MainWPSettings', __($this->branding . ' Settings','mainwp-child'), 'manage_options', 'MainWPSettings', array(&$this, 'settings'));
|
||||
if (!get_option('mainwp_branding_remove_setting'))
|
||||
add_options_page('MainWPSettings', __($this->branding . ' Settings','mainwp-child'), 'manage_options', 'MainWPSettings', array(&$this, 'settings'));
|
||||
|
||||
if (!get_option('mainwp_branding_remove_restore')) {
|
||||
$restorePage = add_submenu_page('tools.php', $this->branding . ' Restore', '<span style="display: hidden"></span>', 'read', 'mainwp-child-restore', array('MainWPClone', 'renderRestore'));
|
||||
add_action('admin_print_scripts-'.$restorePage, array('MainWPClone', 'print_scripts'));
|
||||
|
||||
$restorePage = add_submenu_page('tools.php', $this->branding . ' Restore', '<span style="display: hidden"></span>', 'read', 'mainwp-child-restore', array('MainWPClone', 'renderRestore'));
|
||||
add_action('admin_print_scripts-'.$restorePage, array('MainWPClone', 'print_scripts'));
|
||||
|
||||
$sitesToClone = get_option('mainwp_child_clone_sites');
|
||||
if ($sitesToClone != '0')
|
||||
{
|
||||
MainWPClone::init_menu($this->branding);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWPClone::init_restore_menu($this->branding);
|
||||
$sitesToClone = get_option('mainwp_child_clone_sites');
|
||||
if ($sitesToClone != '0')
|
||||
{
|
||||
MainWPClone::init_menu($this->branding);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWPClone::init_restore_menu($this->branding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,20 +16,7 @@ class MainWPChildBranding
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->child_plugin_dir = dirname(dirname(__FILE__));
|
||||
$default_header = get_option('mainwp_branding_default_header', false);
|
||||
if (empty($default_header))
|
||||
{
|
||||
$info = get_plugin_data($this->child_plugin_dir . '/mainwp-child.php');
|
||||
if (is_array($info))
|
||||
{
|
||||
$default_header = array('name' => $info['Name'],
|
||||
'description' => $info['Description'],
|
||||
'authoruri' => $info['AuthorURI'],
|
||||
'author' => $info['Author']);
|
||||
update_option('mainwp_branding_default_header', $default_header);
|
||||
}
|
||||
}
|
||||
$this->child_plugin_dir = dirname(dirname(__FILE__));
|
||||
add_action('mainwp_child_deactivation', array($this, 'child_deactivation'));
|
||||
}
|
||||
|
||||
|
@ -50,6 +37,10 @@ class MainWPChildBranding
|
|||
'mainwp_branding_show_support',
|
||||
'mainwp_branding_support_email',
|
||||
'mainwp_branding_support_message',
|
||||
'mainwp_branding_remove_restore',
|
||||
'mainwp_branding_remove_setting',
|
||||
'mainwp_branding_remove_wp_tools',
|
||||
'mainwp_branding_remove_wp_setting',
|
||||
'mainwp_branding_plugin_header');
|
||||
foreach ($dell_all as $opt)
|
||||
{
|
||||
|
@ -85,6 +76,10 @@ class MainWPChildBranding
|
|||
update_option('mainwp_branding_plugin_header', $header);
|
||||
update_option('mainwp_branding_support_email', $settings['child_support_email']);
|
||||
update_option('mainwp_branding_support_message', $settings['child_support_message']);
|
||||
update_option('mainwp_branding_remove_restore', $settings['child_remove_restore']);
|
||||
update_option('mainwp_branding_remove_setting', $settings['child_remove_setting']);
|
||||
update_option('mainwp_branding_remove_wp_tools', $settings['child_remove_wp_tools']);
|
||||
update_option('mainwp_branding_remove_wp_setting', $settings['child_remove_wp_setting']);
|
||||
|
||||
if ($settings['child_plugin_hide'])
|
||||
{
|
||||
|
@ -119,7 +114,7 @@ class MainWPChildBranding
|
|||
|
||||
public function branding_init()
|
||||
{
|
||||
add_filter('map_meta_cap', array($this, 'theme_plugin_disable_change'), 10, 5);
|
||||
add_filter('map_meta_cap', array($this, 'branding_map_meta_cap'), 10, 5);
|
||||
add_filter('all_plugins', array($this, 'branding_child_plugin'));
|
||||
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
||||
|
||||
|
@ -210,7 +205,7 @@ class MainWPChildBranding
|
|||
<div style="height: 230px; margin-bottom: 10px; text-align: left">
|
||||
<div class="mainwp_info-box-yellow" id="mainwp_branding_contact_ajax_message_zone"
|
||||
style="display: none;"></div>
|
||||
<p><?php echo get_option('mainwp_branding_support_message'); ?></p>
|
||||
<p><?php echo stripslashes(get_option('mainwp_branding_support_message')); ?></p>
|
||||
<textarea id="mainwp_branding_contact_message_content" name="mainwp_branding_contact_message_content"
|
||||
cols="69" rows="5" class="text"></textarea>
|
||||
</div>
|
||||
|
@ -307,7 +302,7 @@ class MainWPChildBranding
|
|||
}
|
||||
|
||||
|
||||
public function theme_plugin_disable_change($caps, $cap, $user_id, $args)
|
||||
public function branding_map_meta_cap($caps, $cap, $user_id, $args)
|
||||
{
|
||||
if (get_option('mainwp_branding_disable_change') == 'T')
|
||||
{
|
||||
|
@ -361,10 +356,10 @@ class MainWPChildBranding
|
|||
|
||||
if (!empty($plugin_key))
|
||||
{
|
||||
$plugin_data['Name'] = $header['name'];
|
||||
$plugin_data['Description'] = $header['description'];
|
||||
$plugin_data['Author'] = $header['author'];
|
||||
$plugin_data['AuthorURI'] = $header['authoruri'];
|
||||
$plugin_data['Name'] = stripslashes($header['name']);
|
||||
$plugin_data['Description'] = stripslashes($header['description']);
|
||||
$plugin_data['Author'] = stripslashes($header['author']);
|
||||
$plugin_data['AuthorURI'] = stripslashes($header['authoruri']);
|
||||
$plugins[$plugin_key] = $plugin_data;
|
||||
}
|
||||
return $plugins;
|
||||
|
|
|
@ -157,7 +157,7 @@ class MainWPClone
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<div id="icon-options-general" class="icon32"><br></div><h2><strong>Option 1: </strong><?php _e('Restore/Clone From Backup','mainwp-child'); ?></h2>
|
||||
<div id="icon-options-general" class="icon32"><br></div><h2><strong><?php _e('Option 1:', 'mainwp-child'); ?></strong> <?php _e('Restore/Clone From Backup','mainwp-child'); ?></h2>
|
||||
<br />
|
||||
<?php _e('Upload backup in .zip format (Maximum filesize for your server settings: ','mainwp-child'); ?><?php echo $uploadSize; ?>)<br/>
|
||||
<i><?php _e('If you have a FULL backup created by your Network dashboard you may restore it by uploading here.','mainwp-child'); ?><br />
|
||||
|
@ -202,7 +202,7 @@ class MainWPClone
|
|||
$uploadSize = MainWPHelper::human_filesize($uploadSizeInBytes);
|
||||
self::renderHeader();
|
||||
|
||||
?><div id="icon-options-general" class="icon32"><br></div><h2><?php _e('Restore','mainwp-child'); ?></h2><?php
|
||||
?><div id="icon-options-general" class="icon32"><br></div><h2><strong><?php _e('Option 1:', 'mainwp-child'); ?></strong> <?php _e('Restore','mainwp-child'); ?></h2><?php
|
||||
|
||||
MainWPHelper::getWPFilesystem();
|
||||
global $wp_filesystem;
|
||||
|
@ -271,7 +271,7 @@ Author URI: http://dd32.id.au/
|
|||
$current_dir = untrailingslashit($current_dir);
|
||||
|
||||
echo "<br /><hr /><br />";
|
||||
echo '<h2 id="title_03"><strong>Option 2: </strong>' . __('Restore/Clone From Server','mainwp-child') . '</h2>';
|
||||
echo '<h2 id="title_03"><strong>' . __('Option 2:', 'mainwp-child') . '</strong> ' . __('Restore/Clone From Server','mainwp-child') . '</h2>';
|
||||
echo __('If you have uploaded a FULL backup to your server (via FTP or other means) you can use this section to locate the zip file and select it. A database only backup will not work.','mainwp-child');
|
||||
|
||||
if (!is_readable($current_dir)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue