From cdc53d4320781e11afd2a0c54cd16b9e18e435b8 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 25 Jul 2015 18:33:39 +0100 Subject: [PATCH] [auto] Plugin: simply-exclude 2.0.6.6 --- wp-content/plugins/simply-exclude/readme.txt | 19 ++- .../plugins/simply-exclude/simplyexclude.php | 115 +++++++++++++++++- 2 files changed, 125 insertions(+), 9 deletions(-) diff --git a/wp-content/plugins/simply-exclude/readme.txt b/wp-content/plugins/simply-exclude/readme.txt index eab97fcd4..46e965454 100644 --- a/wp-content/plugins/simply-exclude/readme.txt +++ b/wp-content/plugins/simply-exclude/readme.txt @@ -2,9 +2,9 @@ Contributors: pmenard Donate link: http://www.codehooligans.com Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author -Requires at least: 3.7 -Tested up to: 3.9 -Stable tag: 2.0.6.2 +Requires at least: 3.9 +Tested up to: 4.2 +Stable tag: 2.0.6.6 License: GPLv2 License URI: http://www.opensource.org/licenses/GPL-2.0 @@ -50,6 +50,19 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit == Changelog == += 2.0.6.6 = +- Corrected bug introduced via 2.0.6.4 and 2.0.6.5 + += 2.0.6.5 = +- DO NOT USE. + += 2.0.6.4 = +- Corrected issue reported related to Missing argument 2 for SimplyExclude::se_widget_getarchives_where() +- Added a filter 'se_filters_priority' to allow control the priority of the se_filter hook. This can also be set via a define in wp-config.php or functions.php as define('SE_FILTERS_PRIORITY', 99); + += 2.0.6.3 = +- Updated logic such that excluding posts for Archive will also automatically exclude post from Archive Widget. This way you don't get links showing from the widget that cause 404 errors. See support thread https://wordpress.org/support/topic/archive-month-shows-when-all-posts-in-month-are-excluded-giving-404-error + = 2.0.6.2 = - Corrected reported issue related to undefined 'action' settings in the widget hooks. Thanks Arnold. - Cleanup some of the CSS related to settings used within the dashboard area. diff --git a/wp-content/plugins/simply-exclude/simplyexclude.php b/wp-content/plugins/simply-exclude/simplyexclude.php index 833ec386b..b16a69a7c 100644 --- a/wp-content/plugins/simply-exclude/simplyexclude.php +++ b/wp-content/plugins/simply-exclude/simplyexclude.php @@ -4,8 +4,13 @@ Plugin Name: Simply Exclude Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/ Description: Provides an interface to selectively exclude/include all Taxonomies, Post Types and Users from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed. Also provides access to some of the common widgets user like tag cloud and categories listings. Author: Paul Menard -Version: 2.0.6.2 +Version: 2.0.6.6 Author URI: http://www.codehooligans.com +Text Domain: simplyexclude +Domain Path: /languages +License: GNU General Public License v2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + */ define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude'); @@ -32,7 +37,7 @@ class SimplyExclude public function __construct() { - $this->se_version = "2.0.6.2"; + $this->se_version = "2.0.6.6"; $this->admin_menu_label = __("Simply Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN); $this->options_key = "simplyexclude_v2"; @@ -53,8 +58,17 @@ class SimplyExclude add_action( 'admin_footer', array(&$this,'se_admin_footer') ); add_action( 'wp_ajax_se_update', array(&$this, 'se_ajax_update') ); + // In 2.0.6.4 added a define to allow control of the SE_FILTERS_PRIORITY + //https://wordpress.org/support/topic/first-install-problems-in-wordpress-40?replies=3#post-6579114 + if (defined('SE_FILTERS_PRIORITY')) + $SE_FILTERS_PRIORITY = intval(SE_FILTERS_PRIORITY); + else { + $SE_FILTERS_PRIORITY = 999; + } + $SE_FILTERS_PRIORITY = apply_filters('se_filters_priority', $SE_FILTERS_PRIORITY); + // Used to limit the categories displayed on the home page. Simple - add_filter('pre_get_posts', array(&$this,'se_filters'), 999); + add_filter('pre_get_posts', array($this,'se_filters'), $SE_FILTERS_PRIORITY); } function admin_init_proc() @@ -126,6 +140,10 @@ class SimplyExclude // Support for the Tag Clod widget. This widget supports both the post_tag and category taxonomies. add_filter('widget_tag_cloud_args', array(&$this, 'se_widget_tag_cloud_args_proc')); + + // Support for Archive widget. This widget will output a month or year archive listing/dropdown of posts + add_filter('getarchives_where', array($this, 'se_widget_getarchives_where'), 99); + } } @@ -1663,6 +1681,7 @@ class SimplyExclude $taxonomy_actions['is_archive'] = "e"; $taxonomy_actions['is_search'] = "e"; $taxonomy_actions['is_feed'] = "e"; + //$taxonomy_actions['widget_archives'] = "e"; } else if ($post_type == "page") { @@ -1909,6 +1928,25 @@ class SimplyExclude return; break; + case 'widget_archives': + + if ($post_type == "post") { + switch($key) + { + case 'name': + return __("Widget: Archives", SIMPLY_EXCLUDE_I18N_DOMAIN); + break; + + case 'description': + return __("Exclude from Post Archives Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN); + + default: + return; + } + } + return; + break; + default: return; break; @@ -2338,8 +2376,9 @@ class SimplyExclude && (count($this->se_cfg['data']['post_types']['page']['terms']['widget_pages'])) ) { //echo "se_cfg<pre>"; print_r($this->se_cfg['data']['post_types']['page']); echo "</pre>"; + //die(); - $action = $this->se_cfg['data']['post_types']['page']['actions']['widget_pages']['action']; + $action = $this->se_cfg['data']['post_types']['page']['actions']['widget_pages']; $terms = $this->se_listify_ids(array_keys($this->se_cfg['data']['post_types']['page']['terms']['widget_pages']), 'i'); //echo "terms<pre>"; print_r($terms); echo "</pre>"; if ($action == "e") @@ -2494,9 +2533,73 @@ class SimplyExclude return $args; } - - + function se_widget_getarchives_where($where_sql) { + if (is_admin()) return $where_sql; + + //echo "where_sql[". $where_sql ."]<br />"; + //echo "args<pre>"; print_r($args); echo "</pre>"; + + $this->se_load_config(); + //echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>"; + $action_data = $this->se_get_action_data('is_archive'); + //echo "action_data<pre>"; print_r($action_data); echo "</pre>"; + //die(); + + + $post__in = array(); + $post__not_in = array(); + + if ($action_data) { + foreach($action_data as $key => $key_data) { + if ($key == "post_types") { + + foreach($key_data as $key_key => $key_key_data) { + //echo "key_key[". $key_key ."]<br />"; + //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>"; + + if ($key_key_data['actions'] == 'e') { + $post__not_in = array_merge($post__not_in, $key_key_data['terms']); + + } else if ($key_key_data['actions'] == 'i') { + $post__in = array_merge($post__in, $key_key_data['terms']); + } + } + } else if ($key == "taxonomies") { + + foreach($key_data as $key_key => $key_key_data) { + //echo "key_key[". $key_key ."]<br />"; + //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>"; + if ((isset($key_key_data['terms'])) && (!empty($key_key_data['terms']))) { + $posts_ids = get_objects_in_term( $key_key_data['terms'], $key_key ); + if ( !is_wp_error( $posts_ids ) ) { + //echo "posts_ids<pre>"; print_r($posts_ids); echo "</pre>"; + + if ($key_key_data['actions'] == 'e') { + $post__not_in = array_merge($post__not_in, $posts_ids); + } else if ($key_key_data['actions'] == 'i') { + $post__in = array_merge($post__in, $posts_ids); + } + } + } + } + } + } + } + + if (!empty($post__not_in)) { + //echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>"; + $where_sql .= " AND ID NOT IN(". implode(',', $post__not_in) .") "; + + } else if (!empty($post__in)) { + //echo "post__in<pre>"; print_r($post__in); echo "</pre>"; + $where_sql .= " AND ID IN(". implode(',', $post__not_in) .") "; + } + //echo "where_sql[". $where_sql ."]<br />"; + + return $where_sql; + } + function se_admin_footer() { if ( !current_user_can('manage_options') ) -- GitLab