merge with branch 1 + new version

This commit is contained in:
ruben- 2014-09-02 19:37:25 +02:00
parent 4a9b369302
commit 931b6b59f0
7 changed files with 114 additions and 20 deletions

View file

@ -617,7 +617,6 @@ class MainWPBackup
if ($this->gcCnt > 20)
{
echo memory_get_usage(true) . "\n";
@gc_enable();
@gc_collect_cycles();
$this->gcCnt = 0;

View file

@ -11,7 +11,7 @@ include_once(ABSPATH . '/wp-admin/includes/plugin.php');
class MainWPChild
{
private $version = '1.0.0';
private $version = '1.1';
private $update_version = '1.0';
private $callableFunctions = array(
@ -982,12 +982,11 @@ class MainWPChild
if (strcmp($slug, $premiumPlugin) == 0)
{
$mwp_premium_updates_todo[$key] = $update;
$mwp_premium_updates_todo_slugs[] = $slug;
$mwp_premium_updates_todo_slugs[] = $premiumPlugin;
}
}
}
unset($mwp_premium_updates);
$premiumUpgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
}

View file

@ -114,7 +114,10 @@ class MainWPChildBranding
'generator_link' => $settings['child_generator_link'],
'admin_css' => $settings['child_admin_css'],
'login_css' => $settings['child_login_css'],
'texts_replace' => $settings['child_texts_replace']
'texts_replace' => $settings['child_texts_replace'],
'hide_nag' => $settings['child_hide_nag'],
'hide_screen_opts' => $settings['child_hide_screen_opts'],
'hide_help_box' => $settings['child_hide_help_box']
);
if (isset($settings['child_login_image_url'])) {
@ -274,9 +277,14 @@ class MainWPChildBranding
remove_filter( 'update_footer', 'core_update_footer' );
add_filter('update_footer', array(&$this, 'update_admin_footer'), 14);
}
}
if (isset($extra_setting['hide_nag']) && !empty($extra_setting['hide_nag']))
{
add_action( 'admin_init', create_function('', 'remove_action( \'admin_notices\', \'update_nag\', 3 );') );
}
}
}
function update_admin_footer() {
$extra_setting = $this->settings['extra_settings'];
if (isset($extra_setting['dashboard_footer']) && !empty($extra_setting['dashboard_footer'])) {
@ -316,10 +324,26 @@ class MainWPChildBranding
}
function custom_admin_css() {
$header_css = "";
$extra_setting = $this->settings['extra_settings'];
if (is_array($extra_setting) && isset($extra_setting['admin_css']) && !empty($extra_setting['admin_css'])) {
echo '<style>' . $extra_setting['admin_css'] . '</style>';
}
$header_css .= $extra_setting['admin_css'];
}
if (isset($extra_setting['hide_screen_opts']) && !empty($extra_setting['hide_screen_opts']))
{
$header_css .= ' #screen-options-link-wrap { display: none; }';
}
if (isset($extra_setting['hide_help_box']) && !empty($extra_setting['hide_help_box']))
{
$header_css .= ' #contextual-help-link-wrap { display: none; }';
$header_css .= ' #contextual-help-link { display: none; }';
}
if (!empty($header_css))
echo '<style>' . $header_css . '</style>';
}
function custom_login_css() {

View file

@ -49,7 +49,23 @@ class MainWPChildWordfence
'scansEnabled_scanImages',
'scansEnabled_themes',
'scheduledScansEnabled',
'securityLevel'
'securityLevel',
//'scheduleScan' // filtered this
'blockFakeBots',
'neverBlockBG',
'maxGlobalRequests',
'maxGlobalRequests_action',
'maxRequestsCrawlers',
'maxRequestsCrawlers_action',
'max404Crawlers',
'max404Crawlers_action',
'maxRequestsHumans',
'maxRequestsHumans_action',
'max404Humans',
'max404Humans_action',
'maxScanHits',
'maxScanHits_action',
'blockedTime'
);
@ -62,13 +78,17 @@ class MainWPChildWordfence
public function __construct() {
global $wpdb;
add_action('mainwp_child_deactivation', array($this, 'deactivation'));
}
public static function init() {
public function deactivation()
{
if ($sched = wp_next_scheduled('mainwp_child_wordfence_cron_scan')) {
wp_unschedule_event($sched, 'mainwp_child_wordfence_cron_scan');
}
}
public function action() {
$information = array();
if (!class_exists('wordfence') || !class_exists('wfScanEngine')) {
@ -147,12 +167,39 @@ class MainWPChildWordfence
{
if (get_option('mainwp_wordfence_ext_enabled') !== "Y")
return;
if (get_option('mainwp_wordfence_hide_plugin') === "hide")
{
add_filter('all_plugins', array($this, 'all_plugins'));
add_action( 'admin_menu', array($this, 'remove_menu'));
}
$this->init_cron();
}
public function init_cron() {
$sched = wp_next_scheduled('mainwp_child_wordfence_cron_scan');
$sch = get_option("mainwp_child_wordfence_cron_time");
if ($sch == "twicedaily" ||
$sch == "daily" ||
$sch == "weekly" ||
$sch == "monthly") {
add_action('mainwp_child_wordfence_cron_scan', array($this, 'wfc_cron_scan'));
if ($sched == false)
{
$sched = wp_schedule_event(time(), $sch, 'mainwp_child_wordfence_cron_scan');
}
} else {
if ($sched != false) {
wp_unschedule_event($sched, 'mainwp_child_wordfence_cron_scan');
}
}
}
public function wfc_cron_scan() {
$this->start_scan();
}
public function all_plugins($plugins) {
foreach ($plugins as $key => $value)
{
@ -410,6 +457,15 @@ class MainWPChildWordfence
wfConfig::disableAutoUpdate();
}
$sch = isset($opts['scheduleScan']) ? $opts['scheduleScan'] : "";
if ($sch != get_option('mainwp_child_wordfence_cron_time')) {
update_option('mainwp_child_wordfence_cron_time', $sch);
$sched = wp_next_scheduled('mainwp_child_wordfence_cron_scan');
if ($sched != false) {
wp_unschedule_event($sched, 'mainwp_child_wordfence_cron_scan');
}
}
return array('result' => 'SUCCESS');
}
}

View file

@ -238,8 +238,10 @@ class MainWPHelper
$not_allowed[] = '_saved_draft_random_category';
$not_allowed[] = '_saved_draft_random_publish_date';
$not_allowed[] = '_saved_draft_publish_date_from';
$not_allowed[] = '_saved_draft_publish_date_to';
$not_allowed[] = '_saved_draft_publish_date_to';
$not_allowed[] = '_post_to_only_existing_categories';
$post_to_only_existing_categories = false;
foreach ($post_custom as $meta_key => $meta_values)
{
if (!in_array($meta_key, $not_allowed))
@ -265,8 +267,12 @@ class MainWPHelper
stick_post($new_post_id);
}
}
} else if ($meta_key == '_post_to_only_existing_categories') {
if (isset($meta_values[0]) && $meta_values[0])
$post_to_only_existing_categories = true;
}
}
// yoast seo extension
if ($seo_ext_activated) {
$_seo_opengraph_image = isset($post_custom[WPSEO_Meta::$meta_prefix . 'opengraph-image']) ? $post_custom[WPSEO_Meta::$meta_prefix . 'opengraph-image'] : array();
@ -302,7 +308,17 @@ class MainWPHelper
$categories = explode(',', $post_category);
if (count($categories) > 0)
{
$post_category = wp_create_categories($categories, $new_post_id);
if (!$post_to_only_existing_categories)
$post_category = wp_create_categories($categories, $new_post_id);
else {
$cat_ids = array ();
foreach($categories as $cat) {
if ($id = category_exists($cat))
$cat_ids[] = $id;
}
if (count($cat_ids) > 0)
wp_set_post_categories($new_post_id, $cat_ids);
}
}
}

View file

@ -5,7 +5,7 @@
Description: Child Plugin for MainWP. The plugin is used so the installed blog can be securely managed remotely by your network. Plugin documentation and options can be found here http://docs.mainwp.com
Author: MainWP
Author URI: http://mainwp.com
Version: 1.0.1-beta
Version: 1.1
*/
header('X-Frame-Options: ALLOWALL');
//header('X-Frame-Options: GOFORIT');

View file

@ -6,8 +6,8 @@ Author: mainwp
Author URI: http://mainwp.com
Plugin URI: http://mainwp.com
Requires at least: 3.6
Tested up to: 3.9.2
Stable tag: 1.0.0
Tested up to: 4.0
Stable tag: 1.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html