Ultimate Category Excluder - Version 0.9

Version Description

Download this release

Release Info

Developer planetmike
Plugin Icon 128x128 Ultimate Category Excluder
Version 0.9
Comparing to
See all releases

Code changes from version 0.90 to 0.9

Files changed (2) hide show
  1. readme.txt +4 -1
  2. ultimate-category-excluder.php +26 -11
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.planetmike.com/donations/
4
  Tags: category, categories, exclude, visible, hidden, hide, invisible, remove
5
  Requires at least: 3.1
6
  Tested up to: 3.6
7
- Stable tag: 0.84
8
 
9
  Ultimate Category Excluder allows you to quickly and easily exclude categories from your front page, archives, and feeds.
10
 
@@ -22,6 +22,9 @@ Ultimate Category Excluder (UCE - unfortunately the same abbreviation as unsolic
22
 
23
  == Changelog ==
24
 
 
 
 
25
  = 0.84 =
26
  * August 3, 2013 - Fixed empty category bug. Again.
27
 
4
  Tags: category, categories, exclude, visible, hidden, hide, invisible, remove
5
  Requires at least: 3.1
6
  Tested up to: 3.6
7
+ Stable tag: 0.90
8
 
9
  Ultimate Category Excluder allows you to quickly and easily exclude categories from your front page, archives, and feeds.
10
 
22
 
23
  == Changelog ==
24
 
25
+ = 0.90 =
26
+ * September 3, 2013 - You can now exclude categories from appearing in results from the built-in WordPress search engine. Other search engines (e.g. Bing, Google) may still be able to find and index your content. Also fixed a bug that excluded categories from appearing in the Post Editor. And fixed a bug in the system information section.
27
+
28
  = 0.84 =
29
  * August 3, 2013 - Fixed empty category bug. Again.
30
 
ultimate-category-excluder.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name: Ultimate Category Excluder
4
  Plugin URI: http://www.planetmike.com/plugins/ultimate-category-excluder/
5
- Description: Easily exclude categories from your front page, feeds, and archives.
6
  Author: Michael Clark
7
- Version: 0.84
8
  Author URI: http://www.planetmike.com
9
  Text Domain: UCE
10
  */
@@ -37,6 +37,7 @@ function ksuce_options_page() {
37
  <th scope="col"><?php _e('Exclude from Main Page?', 'UCE'); ?></th>
38
  <th scope="col"><?php _e('Exclude from Feeds?', 'UCE'); ?></th>
39
  <th scope="col"><?php _e('Exclude from Archives?', 'UCE'); ?></th>
 
40
  </tr>
41
  </thead>
42
  <tbody id="the-list">
@@ -52,11 +53,10 @@ $args=array(
52
  ?>
53
  <tr<?php if ( $alt == 1 ) { echo ' class="alternate"'; $alt = 0; } else { $alt = 1; } ?>>
54
  <th scope="row"><?php echo $cat->cat_name; //. ' (' . $cat->cat_ID . ')'; ?></th>
55
- <td>
56
- <input type="checkbox" name="exclude_main[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_main'] ) ) { echo 'checked="true" '; } ?>/>
57
- </td>
58
  <td><input type="checkbox" name="exclude_feed[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_feed'] ) ) { echo 'checked="true" '; } ?>/></td>
59
  <td><input type="checkbox" name="exclude_archives[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_archives'] ) ) { echo 'checked="true" '; } ?>/></td>
 
60
  </tr>
61
  <?php
62
  }
@@ -70,12 +70,14 @@ $args=array(
70
  <?php
71
  global $wpdb, $wp_version;
72
  echo "<h3>Support</h3>\n";
73
- echo "<p>Please report this information if you have trouble with this plugin. Thanks!</p>";
74
- echo '<ul><li>UCE version: 0.83</li>';
75
  echo '<li>PHP version: '.PHP_VERSION.'</li>';
76
  echo '<li>MySQL version: '.mysql_get_server_info($wpdb->dbh).'</li>';
77
  echo '<li>WordPress version: '.$wp_version.'</li>';
78
- if ( AUTH_KEY2 == "" ) {echo "<li>Auth_Key is empty.</li>";} ;
 
 
79
  echo "</ul>";
80
  ?>
81
  <?php
@@ -92,9 +94,13 @@ function ksuce_process() {
92
  if( !$_POST[ 'exclude_archives' ] ) {
93
  $_POST[ 'exclude_archives' ] = array();
94
  }
 
 
 
95
  $options['exclude_main'] = $_POST[ 'exclude_main' ];
96
  $options['exclude_feed'] = $_POST[ 'exclude_feed' ];
97
  $options['exclude_archives'] = $_POST[ 'exclude_archives' ];
 
98
  update_option('ksuceExcludes', $options);
99
 
100
  $message = "<div class='updated'><p>" . (__('Excludes successfully updated', 'UCE')) . "</p></div>";
@@ -106,6 +112,7 @@ function ksuce_get_options(){
106
  $defaults['exclude_main'] = array();
107
  $defaults['exclude_feed'] = array();
108
  $defaults['exclude_archives'] = array();
 
109
 
110
  $options = get_option('ksuceExcludes');
111
  if (!is_array($options)){
@@ -118,7 +125,7 @@ function ksuce_get_options(){
118
 
119
  function ksuce_exclude_categories($query) {
120
  $options = ksuce_get_options();
121
- if ($query->is_home) {
122
  $mbccount=0;
123
  foreach ($options[ 'exclude_main' ] as $value) {
124
  $array2[$mbccount] = $value;
@@ -126,7 +133,7 @@ function ksuce_exclude_categories($query) {
126
  }
127
  $query->set('category__not_in', $array2);
128
  }
129
- if ($query->is_feed) {
130
  $mbccount=0;
131
  foreach ($options[ 'exclude_feed' ] as $value) {
132
  $array2[$mbccount] = $value;
@@ -134,7 +141,15 @@ function ksuce_exclude_categories($query) {
134
  }
135
  $query->set('category__not_in', $array2);
136
  }
137
- if ($query->is_archive) {
 
 
 
 
 
 
 
 
138
  $mbccount=0;
139
  foreach ($options[ 'exclude_archives' ] as $value) {
140
  $array2[$mbccount] = $value;
2
  /*
3
  Plugin Name: Ultimate Category Excluder
4
  Plugin URI: http://www.planetmike.com/plugins/ultimate-category-excluder/
5
+ Description: Easily exclude categories from your front page, feeds, archives, and search results.
6
  Author: Michael Clark
7
+ Version: 0.90
8
  Author URI: http://www.planetmike.com
9
  Text Domain: UCE
10
  */
37
  <th scope="col"><?php _e('Exclude from Main Page?', 'UCE'); ?></th>
38
  <th scope="col"><?php _e('Exclude from Feeds?', 'UCE'); ?></th>
39
  <th scope="col"><?php _e('Exclude from Archives?', 'UCE'); ?></th>
40
+ <th scope="col"><?php _e('Exclude from Search?', 'UCE'); ?></th>
41
  </tr>
42
  </thead>
43
  <tbody id="the-list">
53
  ?>
54
  <tr<?php if ( $alt == 1 ) { echo ' class="alternate"'; $alt = 0; } else { $alt = 1; } ?>>
55
  <th scope="row"><?php echo $cat->cat_name; //. ' (' . $cat->cat_ID . ')'; ?></th>
56
+ <td><input type="checkbox" name="exclude_main[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_main'] ) ) { echo 'checked="true" '; } ?>/></td>
 
 
57
  <td><input type="checkbox" name="exclude_feed[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_feed'] ) ) { echo 'checked="true" '; } ?>/></td>
58
  <td><input type="checkbox" name="exclude_archives[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_archives'] ) ) { echo 'checked="true" '; } ?>/></td>
59
+ <td><input type="checkbox" name="exclude_search[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_search'] ) ) { echo 'checked="true" '; } ?>/></td>
60
  </tr>
61
  <?php
62
  }
70
  <?php
71
  global $wpdb, $wp_version;
72
  echo "<h3>Support</h3>\n";
73
+ echo "<p>Please report this information to <i>mclark -at- planetmike.com</i> if you have trouble with this plugin. Thanks!</p>";
74
+ echo '<ul><li>UCE version: 0.90</li>';
75
  echo '<li>PHP version: '.PHP_VERSION.'</li>';
76
  echo '<li>MySQL version: '.mysql_get_server_info($wpdb->dbh).'</li>';
77
  echo '<li>WordPress version: '.$wp_version.'</li>';
78
+ if(!defined('AUTH_KEY')){
79
+ echo "<li>AUTH_KEY is empty. Please check your settings in your wp-config.php file. This doesn't affect UCE, but it will help make your WordPress sytem more secure.</li>";
80
+ }
81
  echo "</ul>";
82
  ?>
83
  <?php
94
  if( !$_POST[ 'exclude_archives' ] ) {
95
  $_POST[ 'exclude_archives' ] = array();
96
  }
97
+ if( !$_POST[ 'exclude_search' ] ) {
98
+ $_POST[ 'exclude_search' ] = array();
99
+ }
100
  $options['exclude_main'] = $_POST[ 'exclude_main' ];
101
  $options['exclude_feed'] = $_POST[ 'exclude_feed' ];
102
  $options['exclude_archives'] = $_POST[ 'exclude_archives' ];
103
+ $options['exclude_search'] = $_POST[ 'exclude_search' ];
104
  update_option('ksuceExcludes', $options);
105
 
106
  $message = "<div class='updated'><p>" . (__('Excludes successfully updated', 'UCE')) . "</p></div>";
112
  $defaults['exclude_main'] = array();
113
  $defaults['exclude_feed'] = array();
114
  $defaults['exclude_archives'] = array();
115
+ $defaults['exclude_search'] = array();
116
 
117
  $options = get_option('ksuceExcludes');
118
  if (!is_array($options)){
125
 
126
  function ksuce_exclude_categories($query) {
127
  $options = ksuce_get_options();
128
+ if ($query->is_main_query() && $query->is_home) {
129
  $mbccount=0;
130
  foreach ($options[ 'exclude_main' ] as $value) {
131
  $array2[$mbccount] = $value;
133
  }
134
  $query->set('category__not_in', $array2);
135
  }
136
+ if ($query->is_main_query() && $query->is_feed) {
137
  $mbccount=0;
138
  foreach ($options[ 'exclude_feed' ] as $value) {
139
  $array2[$mbccount] = $value;
141
  }
142
  $query->set('category__not_in', $array2);
143
  }
144
+ if ($query->is_main_query() && $query->is_search) {
145
+ $mbccount=0;
146
+ foreach ($options[ 'exclude_search' ] as $value) {
147
+ $array2[$mbccount] = $value;
148
+ $mbccount++;
149
+ }
150
+ $query->set('category__not_in', $array2);
151
+ }
152
+ if (!is_admin() && $query->is_main_query() && $query->is_archive) {
153
  $mbccount=0;
154
  foreach ($options[ 'exclude_archives' ] as $value) {
155
  $array2[$mbccount] = $value;