mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
Merge + fixes
This commit is contained in:
parent
aa8f0fa5bf
commit
acd2b4e663
3 changed files with 106 additions and 17 deletions
|
@ -110,6 +110,7 @@ class MainWPChild
|
|||
$this->branding_robust = stripslashes($branding_header["name"]);
|
||||
}
|
||||
add_action( 'admin_notices', array(&$this, 'admin_notice'));
|
||||
add_filter('plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2);
|
||||
}
|
||||
|
||||
function update()
|
||||
|
@ -194,6 +195,13 @@ class MainWPChild
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public function plugin_row_meta($plugin_meta, $plugin_file)
|
||||
{
|
||||
if ($this->plugin_slug != $plugin_file) return $plugin_meta;
|
||||
return apply_filters("mainwp_child_plugin_row_meta", $plugin_meta, $plugin_file, $this->plugin_slug);
|
||||
}
|
||||
|
||||
function admin_menu()
|
||||
{
|
||||
if (get_option('mainwp_branding_remove_wp_tools')) {
|
||||
|
@ -2751,7 +2759,7 @@ class MainWPChild
|
|||
{
|
||||
if (isset($_POST['keyword']))
|
||||
{
|
||||
$this->posts_where_suffix .= " AND $wpdb->posts.post_content LIKE '%" . $_POST['keyword'] . "%'";
|
||||
$this->posts_where_suffix .= " AND ($wpdb->posts.post_content LIKE '%" . $_POST['keyword'] . "%' OR $wpdb->posts.post_title LIKE '%" . $_POST['keyword'] . "%' )";
|
||||
}
|
||||
if (isset($_POST['dtsstart']) && $_POST['dtsstart'] != '')
|
||||
{
|
||||
|
@ -3723,10 +3731,16 @@ class MainWPChild
|
|||
MainWPHelper::write($information);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($path === '/')
|
||||
|
||||
if (strpos($path, "wp-content") === 0) {
|
||||
$path = basename(WP_CONTENT_DIR) . substr($path, 10);
|
||||
} else if (strpos($path, "wp-includes") === 0) {
|
||||
$path = WPINC . substr($path, 11);
|
||||
}
|
||||
|
||||
if ($path === '/') {
|
||||
$dir = ABSPATH;
|
||||
else {
|
||||
} else {
|
||||
$path = str_replace(' ', '-', $path);
|
||||
$path = str_replace('.', '-', $path);
|
||||
$dir = ABSPATH . $path;
|
||||
|
|
|
@ -14,11 +14,12 @@ class MainWPChildBranding
|
|||
}
|
||||
return MainWPChildBranding::$instance;
|
||||
}
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->child_plugin_dir = dirname(dirname(__FILE__));
|
||||
add_action('mainwp_child_deactivation', array($this, 'child_deactivation'));
|
||||
add_filter("mainwp_child_plugin_row_meta", array($this, "plugin_row_meta"), 10, 3);
|
||||
|
||||
$label = get_option("mainwp_branding_button_contact_label");
|
||||
if (!empty($label)) {
|
||||
|
@ -30,6 +31,24 @@ class MainWPChildBranding
|
|||
$this->settings['extra_settings'] = get_option('mainwp_branding_extra_settings');
|
||||
}
|
||||
|
||||
|
||||
public function plugin_row_meta($plugin_meta, $plugin_file, $child_plugin_slug)
|
||||
{
|
||||
if ($child_plugin_slug != $plugin_file) return $plugin_meta;
|
||||
|
||||
if (!self::is_branding())
|
||||
return $plugin_meta;
|
||||
|
||||
for ($i = 0; $i < count($plugin_meta); $i++) {
|
||||
$str_meta = $plugin_meta[$i];
|
||||
if (strpos($str_meta, "plugin-install.php?tab=plugin-information")) {
|
||||
unset ($plugin_meta[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $plugin_meta;
|
||||
}
|
||||
|
||||
public static function admin_init()
|
||||
{
|
||||
}
|
||||
|
@ -668,18 +687,58 @@ class MainWPChildBranding
|
|||
return false;
|
||||
}
|
||||
|
||||
function check_update_stream_plugin() {
|
||||
if ( $plugins = current_user_can( 'update_plugins' ) ) {
|
||||
$update_plugins = get_site_transient( 'update_plugins' );
|
||||
if (!empty( $update_plugins->response )) {
|
||||
$response = $update_plugins->response;
|
||||
if (is_array($response) && isset($response['stream/stream.php']))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function update_footer($text){
|
||||
if (stripos($_SERVER['REQUEST_URI'], 'update-core.php') !== false && self::is_branding())
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('input[type="checkbox"][value="mainwp-child/mainwp-child.php"]').closest('tr').remove();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
if (self::is_branding()) {
|
||||
if (stripos($_SERVER['REQUEST_URI'], 'update-core.php') !== false)
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('input[type="checkbox"][value="mainwp-child/mainwp-child.php"]').closest('tr').remove();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($this->check_update_stream_plugin()) {
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
var menu_update = jQuery('span.update-plugins');
|
||||
var menu_count = jQuery('span.update-plugins > span.update-count');
|
||||
if (menu_count) {
|
||||
var count = parseInt(menu_count.html());
|
||||
if (count > 0) {
|
||||
jQuery('span.update-plugins > span.update-count').each(function(){
|
||||
jQuery(this).html(count - 1);
|
||||
});
|
||||
jQuery('span.update-plugins > span.plugin-count').each(function(){
|
||||
jQuery(this).html(count - 1);
|
||||
});
|
||||
var title = menu_update.attr('title').replace(count, count - 1);
|
||||
jQuery('span.update-plugins').each(function(){
|
||||
jQuery(this).attr('title', title);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
|
@ -694,10 +694,11 @@ class MainWPClientReport
|
|||
{
|
||||
add_filter('all_plugins', array($this, 'creport_branding_plugin'));
|
||||
add_action( 'admin_menu', array($this, 'creport_remove_menu'));
|
||||
add_filter('update_footer', array(&$this, 'update_footer'), 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function creport_branding_plugin($plugins) {
|
||||
foreach ($plugins as $key => $value)
|
||||
{
|
||||
|
@ -710,6 +711,21 @@ class MainWPClientReport
|
|||
|
||||
public function creport_remove_menu() {
|
||||
remove_menu_page('wp_stream');
|
||||
}
|
||||
}
|
||||
|
||||
function update_footer($text){
|
||||
if (stripos($_SERVER['REQUEST_URI'], 'update-core.php') !== false)
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('input[type="checkbox"][value="stream/stream.php"]').closest('tr').remove();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue