Simply Exclude - Version 2.0.6.3

Version Description

  • 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
Download this release

Release Info

Developer pmenard
Plugin Icon wp plugin Simply Exclude
Version 2.0.6.3
Comparing to
See all releases

Code changes from version 2.0.6.1 to 2.0.6.3

Files changed (3) hide show
  1. readme.txt +10 -3
  2. simplyexclude.php +103 -8
  3. simplyexclude_style_admin.css +13 -1
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: pmenard
3
  Donate link: http://www.codehooligans.com
4
  Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author
5
- Requires at least: 3.7
6
- Tested up to: 3.9
7
- Stable tag: 2.0.6.1
8
  License: GPLv2
9
  License URI: http://www.opensource.org/licenses/GPL-2.0
10
 
@@ -50,6 +50,13 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
 
53
  = 2.0.6.1 =
54
  Corrected issue with reported PHP 5.4 related code.
55
  Changes settings screen to split Taxonomies, Post Types and Users into tabbed screen. Better than one long screen.
2
  Contributors: pmenard
3
  Donate link: http://www.codehooligans.com
4
  Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author
5
+ Requires at least: 3.9
6
+ Tested up to: 4,1
7
+ Stable tag: 2.0.6.3
8
  License: GPLv2
9
  License URI: http://www.opensource.org/licenses/GPL-2.0
10
 
50
 
51
  == Changelog ==
52
 
53
+ = 2.0.6.3 =
54
+ - 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
55
+
56
+ = 2.0.6.2 =
57
+ - Corrected reported issue related to undefined 'action' settings in the widget hooks. Thanks Arnold.
58
+ - Cleanup some of the CSS related to settings used within the dashboard area.
59
+
60
  = 2.0.6.1 =
61
  Corrected issue with reported PHP 5.4 related code.
62
  Changes settings screen to split Taxonomies, Post Types and Users into tabbed screen. Better than one long screen.
simplyexclude.php CHANGED
@@ -4,8 +4,13 @@ Plugin Name: Simply Exclude
4
  Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
  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.
6
  Author: Paul Menard
7
- Version: 2.0.6.1
8
  Author URI: http://www.codehooligans.com
 
 
 
 
 
9
  */
10
 
11
  define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude');
@@ -32,7 +37,7 @@ class SimplyExclude
32
 
33
  public function __construct() {
34
 
35
- $this->se_version = "2.0.6.1";
36
 
37
  $this->admin_menu_label = __("Simply Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN);
38
  $this->options_key = "simplyexclude_v2";
@@ -126,6 +131,10 @@ class SimplyExclude
126
 
127
  // Support for the Tag Clod widget. This widget supports both the post_tag and category taxonomies.
128
  add_filter('widget_tag_cloud_args', array(&$this, 'se_widget_tag_cloud_args_proc'));
 
 
 
 
129
  }
130
  }
131
 
@@ -748,7 +757,7 @@ class SimplyExclude
748
  {
749
  if (current_user_can('manage_options')) {
750
  if (!isset($columns['se-actions']))
751
- $columns['se-actions'] = __('Simply Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN). ' <a id="se-show-actions-panel" href="#">'. __('show', SIMPLY_EXCLUDE_I18N_DOMAIN) .'</a>';
752
  }
753
  return $columns;
754
  }
@@ -1663,6 +1672,7 @@ class SimplyExclude
1663
  $taxonomy_actions['is_archive'] = "e";
1664
  $taxonomy_actions['is_search'] = "e";
1665
  $taxonomy_actions['is_feed'] = "e";
 
1666
  }
1667
  else if ($post_type == "page")
1668
  {
@@ -1909,6 +1919,25 @@ class SimplyExclude
1909
  return;
1910
  break;
1911
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1912
  default:
1913
  return;
1914
  break;
@@ -2358,10 +2387,12 @@ class SimplyExclude
2358
 
2359
  $this->se_load_config();
2360
 
 
 
2361
  if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']))
2362
  && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'])) )
2363
  {
2364
- $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_category']['action'];
2365
  $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'];
2366
 
2367
  $all_cat_ids = array();
@@ -2413,7 +2444,7 @@ class SimplyExclude
2413
  if ( (isset($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud']))
2414
  && (count($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'])) )
2415
  {
2416
- $action = $this->se_cfg['data']['taxonomies']['post_tag']['actions']['widget_tag_cloud']['action'];
2417
  $terms = $this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'];
2418
 
2419
  $all_tags = get_tags('hide_empty=0&orderby=name&order=ASC');
@@ -2454,7 +2485,7 @@ class SimplyExclude
2454
  if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud']))
2455
  && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'])) )
2456
  {
2457
- $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_tag_cloud']['action'];
2458
  $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'];
2459
 
2460
  $all_cat_ids = array();
@@ -2492,9 +2523,73 @@ class SimplyExclude
2492
  return $args;
2493
  }
2494
 
2495
-
2496
-
 
 
 
 
 
2497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2498
  function se_admin_footer()
2499
  {
2500
  if ( !current_user_can('manage_options') )
4
  Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
  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.
6
  Author: Paul Menard
7
+ Version: 2.0.6.3
8
  Author URI: http://www.codehooligans.com
9
+ Text Domain: simplyexclude
10
+ Domain Path: /languages
11
+ License: GNU General Public License v2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
  */
15
 
16
  define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude');
37
 
38
  public function __construct() {
39
 
40
+ $this->se_version = "2.0.6.2";
41
 
42
  $this->admin_menu_label = __("Simply Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN);
43
  $this->options_key = "simplyexclude_v2";
131
 
132
  // Support for the Tag Clod widget. This widget supports both the post_tag and category taxonomies.
133
  add_filter('widget_tag_cloud_args', array(&$this, 'se_widget_tag_cloud_args_proc'));
134
+
135
+ // Support for Archive widget. This widget will output a month or year archive listing/dropdown of posts
136
+ add_filter('getarchives_where', array($this, 'se_widget_getarchives_where'), 99, 2);
137
+
138
  }
139
  }
140
 
757
  {
758
  if (current_user_can('manage_options')) {
759
  if (!isset($columns['se-actions']))
760
+ $columns['se-actions'] = '<a id="se-show-actions-panel" title="" href="#">'. __('Simply Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN) .'</a>';
761
  }
762
  return $columns;
763
  }
1672
  $taxonomy_actions['is_archive'] = "e";
1673
  $taxonomy_actions['is_search'] = "e";
1674
  $taxonomy_actions['is_feed'] = "e";
1675
+ //$taxonomy_actions['widget_archives'] = "e";
1676
  }
1677
  else if ($post_type == "page")
1678
  {
1919
  return;
1920
  break;
1921
 
1922
+ case 'widget_archives':
1923
+
1924
+ if ($post_type == "post") {
1925
+ switch($key)
1926
+ {
1927
+ case 'name':
1928
+ return __("Widget: Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
1929
+ break;
1930
+
1931
+ case 'description':
1932
+ return __("Exclude from Post Archives Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1933
+
1934
+ default:
1935
+ return;
1936
+ }
1937
+ }
1938
+ return;
1939
+ break;
1940
+
1941
  default:
1942
  return;
1943
  break;
2387
 
2388
  $this->se_load_config();
2389
 
2390
+ //echo "widget_category<pre>"; print_r($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']); echo "</pre>";
2391
+
2392
  if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']))
2393
  && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'])) )
2394
  {
2395
+ $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_category'];
2396
  $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'];
2397
 
2398
  $all_cat_ids = array();
2444
  if ( (isset($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud']))
2445
  && (count($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'])) )
2446
  {
2447
+ $action = $this->se_cfg['data']['taxonomies']['post_tag']['actions']['widget_tag_cloud'];
2448
  $terms = $this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'];
2449
 
2450
  $all_tags = get_tags('hide_empty=0&orderby=name&order=ASC');
2485
  if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud']))
2486
  && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'])) )
2487
  {
2488
+ $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_tag_cloud'];
2489
  $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'];
2490
 
2491
  $all_cat_ids = array();
2523
  return $args;
2524
  }
2525
 
2526
+ function se_widget_getarchives_where($where_sql, $args) {
2527
+ if (is_admin()) return $where;
2528
+
2529
+ //echo "where_sql[". $where_sql ."]<br />";
2530
+ //echo "args<pre>"; print_r($args); echo "</pre>";
2531
+
2532
+ $this->se_load_config();
2533
 
2534
+ //echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
2535
+ $action_data = $this->se_get_action_data('is_archive');
2536
+ //echo "action_data<pre>"; print_r($action_data); echo "</pre>";
2537
+ //die();
2538
+
2539
+
2540
+ $post__in = array();
2541
+ $post__not_in = array();
2542
+
2543
+ if ($action_data) {
2544
+ foreach($action_data as $key => $key_data) {
2545
+ if ($key == "post_types") {
2546
+
2547
+ foreach($key_data as $key_key => $key_key_data) {
2548
+ //echo "key_key[". $key_key ."]<br />";
2549
+ //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>";
2550
+
2551
+ if ($key_key_data['actions'] == 'e') {
2552
+ $post__not_in = array_merge($post__not_in, $key_key_data['terms']);
2553
+
2554
+ } else if ($key_key_data['actions'] == 'i') {
2555
+ $post__in = array_merge($post__in, $key_key_data['terms']);
2556
+ }
2557
+ }
2558
+ } else if ($key == "taxonomies") {
2559
+
2560
+ foreach($key_data as $key_key => $key_key_data) {
2561
+ //echo "key_key[". $key_key ."]<br />";
2562
+ //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>";
2563
+ if ((isset($key_key_data['terms'])) && (!empty($key_key_data['terms']))) {
2564
+ $posts_ids = get_objects_in_term( $key_key_data['terms'], $key_key );
2565
+ if ( !is_wp_error( $posts_ids ) ) {
2566
+ //echo "posts_ids<pre>"; print_r($posts_ids); echo "</pre>";
2567
+
2568
+ if ($key_key_data['actions'] == 'e') {
2569
+ $post__not_in = array_merge($post__not_in, $posts_ids);
2570
+ } else if ($key_key_data['actions'] == 'i') {
2571
+ $post__in = array_merge($post__in, $posts_ids);
2572
+ }
2573
+ }
2574
+ }
2575
+ }
2576
+ }
2577
+ }
2578
+ }
2579
+
2580
+ if (!empty($post__not_in)) {
2581
+ //echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
2582
+ $where_sql .= " AND ID NOT IN(". implode(',', $post__not_in) .") ";
2583
+
2584
+ } else if (!empty($post__in)) {
2585
+ //echo "post__in<pre>"; print_r($post__in); echo "</pre>";
2586
+ $where_sql .= " AND ID IN(". implode(',', $post__not_in) .") ";
2587
+ }
2588
+ //echo "where_sql[". $where_sql ."]<br />";
2589
+
2590
+ return $where_sql;
2591
+ }
2592
+
2593
  function se_admin_footer()
2594
  {
2595
  if ( !current_user_can('manage_options') )
simplyexclude_style_admin.css CHANGED
@@ -1,8 +1,9 @@
 
1
  input.se-term-input {
2
  width: 15px;
3
  float: left;
4
  }
5
-
6
  table.simplyexclude-actions-panel td.action {
7
  width: 20%;
8
  }
@@ -49,6 +50,17 @@ td.inc-excl ul.se-actions-list li {
49
  width: 100%;
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
52
  .ui-accordion-header {
53
  border-top-left-radius: 3px;
54
  border-top-right-radius: 3px;
1
+ /*
2
  input.se-term-input {
3
  width: 15px;
4
  float: left;
5
  }
6
+ */
7
  table.simplyexclude-actions-panel td.action {
8
  width: 20%;
9
  }
50
  width: 100%;
51
  }
52
 
53
+ td.column-se-actions ul.se-actions-list li input.se-term-input {
54
+ width: 15px;
55
+ /* float: left; */
56
+ }
57
+
58
+ td.column-se-actions ul.se-actions-list li label {
59
+ /* float: left; */
60
+ vertical-align: top;
61
+ }
62
+
63
+
64
  .ui-accordion-header {
65
  border-top-left-radius: 3px;
66
  border-top-right-radius: 3px;