merging + version update

This commit is contained in:
ruben- 2017-01-18 22:33:53 +01:00
parent 41858e4f09
commit 591bc7822f
5 changed files with 24 additions and 67 deletions

View file

@ -275,6 +275,10 @@ 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 ( get_option( 'mainwp_branding_ext_enabled' ) !== 'Y' ) {
return;
}
@ -299,7 +303,6 @@ class MainWP_Child_Branding {
add_action( 'admin_bar_menu', array( $this, 'add_support_button_in_top_admin_bar' ), 100 );
}
}
add_filter( 'update_footer', array( &$this, 'update_footer' ), 15 );
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 );
@ -761,65 +764,6 @@ class MainWP_Child_Branding {
return 'MainWP';
}
function check_update_child_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['mainwp-child/mainwp-child.php'] ) ) {
return true;
}
}
}
return false;
}
function update_footer( $text ) {
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_child_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 > 1 ) {
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 );
} );
} else if ( count == 1 ) {
jQuery( 'span.update-plugins' ).remove();
}
}
} );
</script>
<?php
}
}
return $text;
}
public function branding_map_meta_cap( $caps, $cap, $user_id, $args ) {
if ( 'T' === get_option( 'mainwp_branding_disable_change' ) ) {
// disable: edit, update, install, active themes and plugins
@ -856,6 +800,16 @@ class MainWP_Child_Branding {
}
}
function remove_update_nag( $value ) {
if ( isset( $_POST['mainwpsignature'] ) ) {
return $value;
}
if ( isset( $value->response['mainwp-child/mainwp-child.php'] ) ) {
unset( $value->response['mainwp-child/mainwp-child.php'] );
}
return $value;
}
public function update_child_header( $plugins, $header ) {
$plugin_key = '';
foreach ( $plugins as $key => $value ) {

View file

@ -1324,7 +1324,7 @@ class MainWP_Child_Wordfence {
return array( 'ok' => 1 , 'download_url' => $download_url );
}
public static function downloadHtaccess(){
public static function downloadHtaccess() {
if ( ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) {
die( '-1' );
}

View file

@ -84,7 +84,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
}
class MainWP_Child {
public static $version = '3.2.6';
public static $version = '3.2.7';
private $update_version = '1.3';
private $callableFunctions = array(
@ -2102,6 +2102,7 @@ class MainWP_Child {
//Read form data
$action = $_POST['action'];
$postId = $_POST['id'];
$my_post = array();
if ( 'publish' === $action ) {
wp_publish_post( $postId );
@ -2110,7 +2111,6 @@ class MainWP_Child {
$my_post = is_array( $postData ) ? $postData : array();
wp_update_post( $my_post );
} else if ( 'unpublish' === $action ) {
$my_post = array();
$my_post['ID'] = $postId;
$my_post['post_status'] = 'draft';
wp_update_post( $my_post );
@ -2397,8 +2397,11 @@ class MainWP_Child {
return array('error' => 'You can&#8217;t give users that role.');
}
$email = trim($data['email']);
if ( isset( $data['email'] ) && !empty( $email ) )
$email = '';
if ( isset( $data['email'] ) )
$email = trim( $data['email'] );
if ( !empty( $email ) )
$user->user_email = sanitize_text_field( wp_unslash( $email ) );
else
$user->user_email = $userdata->user_email;

View file

@ -269,7 +269,7 @@ class MainWP_Helper {
$new_post['post_author'] = $post_author;
$is_ezine_post = ! empty( $post_custom['_ezine_post_article_source'] ) ? true : false;
$terms = $new_post['_ezin_post_category'];
$terms = isset( $new_post['_ezin_post_category'] ) ? $new_post['_ezin_post_category'] : false ;
unset( $new_post['_ezin_post_category'] );
$is_post_plus = isset( $post_custom['_mainwp_post_plus'] ) ? true : false;

View file

@ -6,7 +6,7 @@
Author: MainWP
Author URI: https://mainwp.com
Text Domain: mainwp-child
Version: 3.2.6
Version: 3.2.7
*/
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
header( 'X-Frame-Options: ALLOWALL' );