Simply Exclude - Version 1.7.7

Version Description

2010-05-12 Fixes: Mainly bug fixes and code cleanup. Most bugs discovered via using WP_DEBUG for uninitialized variables.

Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.7

Files changed (3) hide show
  1. readme.txt +40 -15
  2. simplyexclude.php +618 -60
  3. simplyexclude_style_admin.css +2 -1
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Paul Menard
3
  Donate link: http://www.codehooligans.com
4
  Tags: admin, posts, pages, categories, tags, exclude, include, is_front, is_archive, is_search, is_feed
5
  Requires at least: 2.6
6
- Tested up to: 2.8.1
7
- Stable tag: 1.7.5
8
 
9
  == Description ==
10
 
@@ -17,7 +17,7 @@ is_feed - When a Feed is viewed/requested.
17
 
18
  Note: Page exclusions only work for search.
19
 
20
- [Plugin Homepage](http://www.codehooligans.com/2008/04/27/simply-exclude-plugin/ "SimplyExclude Plugin for WordPress")
21
 
22
  == Installation ==
23
 
@@ -47,15 +47,40 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit
47
  2. Page Admin interface allow for exclusion of Page from search.
48
 
49
 
50
- == Version Histroy ==
51
- <p>
52
- 1.0 - 2007-11-20: Initial release<br />
53
- 1.1 - 2008-12-15: Added logic to work with WP version greater than 2.2<br />
54
- 1.5 - 20008-04-27 Fixed display issues. Changes 'List' to 'Archive'. Added tags inclusion/exclusion login. Works only with WP 2.3 and greater.<br />
55
- 1.6 - 2008-05-22 Fixed various items. Added format display for Categories and Pages to reveal hierarchy, Disable plugin functions when searching in admin. This also corrected a display exclusion bug when showing categories and pages. <br />
56
- 1.7 - 2008-05-29 Added Author to the Include/Exclude logic. Now you can exclude Author's Posts from Search, Home, RSS, Archive.
57
- 1.7.1 - 2008-07-16 Fixed an issue with WP 2.6 where it automatically decided to unserialize the option data structure.
58
- 1.7.2 - 2009-02.05 Fixed some PHP warning by checking variable is set. Also added style to 2.7 interface.
59
- 1.7.2.1 - 2009-07.01 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
60
- 1.7.5 - 2009-07.15 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
61
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Donate link: http://www.codehooligans.com
4
  Tags: admin, posts, pages, categories, tags, exclude, include, is_front, is_archive, is_search, is_feed
5
  Requires at least: 2.6
6
+ Tested up to: 2.9.2
7
+ Stable tag: 1.7.7
8
 
9
  == Description ==
10
 
17
 
18
  Note: Page exclusions only work for search.
19
 
20
+ [Plugin Homepage](http://www.codehooligans.com/projects/wordpress/simply-exclude/ "SimplyExclude Plugin for WordPress")
21
 
22
  == Installation ==
23
 
47
  2. Page Admin interface allow for exclusion of Page from search.
48
 
49
 
50
+ == Changelog ==
51
+
52
+ = 1.7.7 =
53
+ 2010-05-12
54
+ Fixes: Mainly bug fixes and code cleanup. Most bugs discovered via using WP_DEBUG for uninitialized variables.
55
+
56
+ = 1.7.6 =
57
+ 2009-11-14
58
+ Fixes: Issue with the Pages exclusion. Many users reporting a permissions issue.
59
+ Additions: Added handler logic to interface with two other plugins. One of the often used Google XML Sitemaps. When setting Page or Category exclusions you now have the option to update the Google XML Sitemaps exclude pages and categories automatically. The other plugin is Search Unleashed.
60
+
61
+ = 1.7.5 =
62
+ 2009-07-15 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
63
+
64
+ = 1.7.2.1 =
65
+ 2009-07-01 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
66
+
67
+ = 1.7.2 =
68
+ 2009-02-05 Fixed some PHP warning by checking variable is set. Also added style to 2.7 interface.
69
+
70
+ = 1.7.1 =
71
+ 2008-07-16 Fixed an issue with WP 2.6 where it automatically decided to unserialize the option data structure.
72
+
73
+ = 1.7 =
74
+ 2008-05-29 Added Author to the Include/Exclude logic. Now you can exclude Author's Posts from Search, Home, RSS, Archive.
75
+
76
+ = 1.6 =
77
+ 2008-05-22 Fixed various items. Added format display for Categories and Pages to reveal hierarchy, Disable plugin functions when searching in admin. This also corrected a display exclusion bug when showing categories and pages.
78
+
79
+ = 1.5 =
80
+ 20008-04-27 Fixed display issues. Changes 'List' to 'Archive'. Added tags inclusion/exclusion login. Works only with WP 2.3 and greater.
81
+
82
+ = 1.1 =
83
+ 2008-12-15: Added logic to work with WP version greater than 2.2
84
+
85
+ = 1.0 =
86
+ 2007-11-20: Initial release
simplyexclude.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  Plugin Name: Simply Exclude
4
- Plugin URI: http://www.codehooligans.com/2008/04/27/simply-exclude-plugin/
5
  Description: Provides an interface to selectively exclude/include categories, tags and page from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed.
6
  Author: Paul Menard
7
- Version: 1.7.5
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
@@ -14,9 +14,10 @@ Revision history
14
  1.6 - 2008-05-22 Fixed various items. Added format display for Categories and Pages to reveal heirarchy, Disable plugin functions when searching in admin. This also corrected a display exclusion bug when showing categories and pages.
15
  1.7 - 2008-05-29 Added Author to the Include/Exclude logic. Now you can exclude Author's Posts from Search, Home, RSS, Archive.
16
  1.7.1 - 2008-07-16 Fixed an issue with WP 2.6 where it automatically decided to unserialize the option data structure.
17
- 1.7.2 - 2009-02.05 Fixed some PHP warning by checking variable is set. Also added style to 2.7 interface.
18
- 1.7.2.1 - 2009-07.01 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
19
- 1.7.5 - 2009-07.15 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
 
20
 
21
  */
22
 
@@ -33,6 +34,8 @@ class SimplyExclude
33
 
34
  var $in_admin;
35
 
 
 
36
  function SimplyExclude()
37
  {
38
  global $wp_version;
@@ -49,7 +52,11 @@ class SimplyExclude
49
  // Add our own admin menu
50
  add_action('admin_menu', array(&$this,'se_add_nav'));
51
 
52
- if ((isset($_REQUEST['page'])) && ($_REQUEST['page'] == $this->options_key))
 
 
 
 
53
  add_action('admin_head', array(&$this,'se_admin_head'));
54
 
55
  if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'activate')
@@ -257,13 +264,52 @@ class SimplyExclude
257
  $this->se_cfg['pages']['actions'][$page_key] = $page_action['action'];
258
  }
259
  }
260
- }
261
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  function se_save_config()
263
  {
264
  $ret = update_option($this->options_key, serialize($this->se_cfg));
265
  }
266
-
267
 
268
  function se_add_nav()
269
  {
@@ -284,6 +330,10 @@ class SimplyExclude
284
 
285
  add_submenu_page( 'se_manage_categories', 'Exclude Pages', 'Exclude Pages', 7,
286
  'se_manage_pages', array(&$this, 'se_manage_pages'));
 
 
 
 
287
  }
288
 
289
  function se_admin_head()
@@ -307,7 +357,7 @@ class SimplyExclude
307
  serialize($this->se_cfg),
308
  "This is the serialized config structures used.");
309
  }
310
-
311
  function se_manage_page()
312
  {
313
  //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
@@ -356,50 +406,79 @@ class SimplyExclude
356
 
357
  function se_manage_categories()
358
  {
 
359
  if (isset($_REQUEST['se_admin']))
360
  {
 
361
  $se_admin = $_REQUEST['se_admin'];
362
- $se_admin['action'] = $_GET['se_admin']['action'];
 
363
  }
364
- ?><div class="wrap"><?php
365
- $this->se_display_categories_panel($se_admin);
366
  ?></div><?php
367
  }
368
 
369
  function se_manage_tags()
370
  {
 
371
  if (isset($_REQUEST['se_admin']))
372
  {
 
373
  $se_admin = $_REQUEST['se_admin'];
374
- $se_admin['action'] = $_GET['se_admin']['action'];
 
375
  }
376
- ?><div class="wrap"><?php
377
- $this->se_display_tags_panel($se_admin);
 
378
  ?></div><?php
379
  }
380
 
381
  function se_manage_authors()
382
  {
 
383
  if (isset($_REQUEST['se_admin']))
384
  {
 
385
  $se_admin = $_REQUEST['se_admin'];
386
- $se_admin['action'] = $_GET['se_admin']['action'];
 
387
  }
388
- ?><div class="wrap"><?php
389
- $this->se_display_authors_panel($se_admin);
390
  ?></div><?php
391
  }
392
 
393
  function se_manage_pages()
394
  {
 
395
  if (isset($_REQUEST['se_admin']))
396
  {
 
397
  $se_admin = $_REQUEST['se_admin'];
398
- $se_admin['action'] = $_GET['se_admin']['action'];
 
399
  }
 
 
 
 
 
 
 
400
  ?><div class="wrap"><?php
401
- $this->se_display_pages_panel($se_admin);
 
 
 
 
 
 
 
 
402
  ?></div><?php
 
403
  }
404
 
405
 
@@ -454,15 +533,19 @@ class SimplyExclude
454
 
455
  // CATEGORY FUNCTIONS
456
  /////////////////////////////////////////////////////////////////
457
- function se_display_categories_panel($se_admin)
458
  {
 
459
  //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
460
  ?>
461
 
462
  <h2>Manage Category Exclusions</h2>
463
  <?php
464
- if ($se_admin['action'] == "save_categories")
465
  {
 
 
 
466
  //echo "se_admin<pre>"; print_r($se_admin); echo "</pre>";
467
  if (isset($se_admin['cats']))
468
  $this->se_cfg['cats'] = $se_admin['cats'];
@@ -525,6 +608,7 @@ class SimplyExclude
525
  </thead>
526
  <tbody>
527
  <?php
 
528
  foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
529
  {
530
  $class = ('alternate' == $class) ? '' : 'alternate';
@@ -535,11 +619,13 @@ class SimplyExclude
535
  <td class="inc-excl">
536
  <input type="radio"
537
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="i"
538
- <?php if ($this->se_cfg['cats']['actions'][$action_key] == 'i')
 
539
  echo "checked='checked'"; ?> /> Include only<br />
540
  <input type="radio"
541
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="e"
542
- <?php if ($this->se_cfg['cats']['actions'][$action_key] == 'e')
 
543
  echo "checked='checked'"; ?> /> Exclude
544
  </td>
545
  <tr>
@@ -559,6 +645,7 @@ class SimplyExclude
559
  </thead>
560
  <tbody>
561
  <?php
 
562
  foreach($this->categories as $cat_info)
563
  {
564
  $class = ('alternate' == $class) ? '' : 'alternate';
@@ -568,7 +655,7 @@ class SimplyExclude
568
  <tr>
569
  <td colspan="3">
570
  <p class="submit">
571
- <input type="hidden" name="action" value="editcatvis" />
572
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
573
  </p>
574
  </td>
@@ -617,7 +704,8 @@ class SimplyExclude
617
  name="se_admin[cats][<?php echo $action_key ?>][<?php echo $cat_id ?>]"
618
  id="cats-<?php echo $action_key ?>-<?php echo $cat_id ?>"
619
  <?php
620
- if ($this->se_cfg['cats'][$action_key][$cat_id] == "on")
 
621
  echo "checked='checked' ";
622
  ?> />
623
  <?php
@@ -630,12 +718,12 @@ class SimplyExclude
630
 
631
  // TAG FUNCTIONS
632
  /////////////////////////////////////////////////////////////////
633
- function se_display_tags_panel($se_admin)
634
  {
635
  ?>
636
  <h2>Manage Tag Exclusions</h2>
637
  <?php
638
- if ($se_admin['action'] == "save_tags")
639
  {
640
  if (isset($se_admin['tags']))
641
  $this->se_cfg['tags'] = $se_admin['tags'];
@@ -655,7 +743,7 @@ class SimplyExclude
655
  function se_load_tags()
656
  {
657
  global $wpdb;
658
- if (!$this->tags)
659
  {
660
  $this->tags = get_tags('hide_empty=0&orderby=name&order=ASC');
661
  }
@@ -682,6 +770,7 @@ class SimplyExclude
682
  </thead>
683
  <tbody>
684
  <?php
 
685
  foreach ($this->default_IsActions['tags'] as $action_key => $action_val)
686
  {
687
  $class = ('alternate' == $class) ? '' : 'alternate';
@@ -725,7 +814,7 @@ class SimplyExclude
725
  <tr>
726
  <td colspan="3">
727
  <p class="submit">
728
- <input type="hidden" name="action" value="editcatvis" />
729
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
730
  </p>
731
  </td>
@@ -742,7 +831,6 @@ class SimplyExclude
742
  }
743
  }
744
 
745
-
746
  function se_show_tag_item_row($tag_info, $class)
747
  {
748
  ?>
@@ -765,7 +853,7 @@ class SimplyExclude
765
  name="se_admin[tags][<?php echo $action_key ?>][<?php echo $tag_id ?>]"
766
  id="tags-<?php echo $action_key ?>-<?php echo $tag_id ?>"
767
  <?php
768
- if ($this->se_cfg['tags'][$action_key][$tag_id] == "on")
769
  echo "checked='checked' ";
770
  ?> />
771
  <?php
@@ -779,12 +867,12 @@ class SimplyExclude
779
 
780
  // AUTHOR FUNCTIONS
781
  /////////////////////////////////////////////////////////////////
782
- function se_display_authors_panel($se_admin)
783
  {
784
  ?>
785
  <h2>Manage Author Exclusions</h2>
786
  <?php
787
- if ($se_admin['action'] == "save_authors")
788
  {
789
  if (isset($se_admin['authors']))
790
  $this->se_cfg['authors'] = $se_admin['authors'];
@@ -804,7 +892,7 @@ class SimplyExclude
804
  function se_load_authors()
805
  {
806
  global $wpdb;
807
- if (!$this->authors)
808
  {
809
  $this->authors = get_users_of_blog();
810
  }
@@ -830,6 +918,7 @@ class SimplyExclude
830
  </thead>
831
  <tbody>
832
  <?php
 
833
  foreach ($this->default_IsActions['authors'] as $action_key => $action_val)
834
  {
835
  $class = ('alternate' == $class) ? '' : 'alternate';
@@ -873,7 +962,7 @@ class SimplyExclude
873
  <tr>
874
  <td colspan="3">
875
  <p class="submit">
876
- <input type="hidden" name="action" value="editcatvis" />
877
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
878
  </p>
879
  </td>
@@ -886,7 +975,7 @@ class SimplyExclude
886
  }
887
  else
888
  {
889
- ?><p>You don't have any Authorss defined.</p><?php
890
  }
891
  }
892
 
@@ -912,7 +1001,8 @@ class SimplyExclude
912
  name="se_admin[authors][<?php echo $action_key ?>][<?php echo $author_id ?>]"
913
  id="authors-<?php echo $action_key ?>-<?php echo $author_id ?>"
914
  <?php
915
- if ($this->se_cfg['authors'][$action_key][$author_id] == "on")
 
916
  echo "checked='checked' ";
917
  ?> />
918
  <?php
@@ -924,15 +1014,21 @@ class SimplyExclude
924
 
925
  // PAGE FUNCTIONS
926
  /////////////////////////////////////////////////////////////////
927
- function se_display_pages_panel($se_admin)
928
  {
 
929
  ?>
930
  <h2>Manage Page Exclusions</h2>
931
  <?php
932
- if ($se_admin['action'] == "save_pages")
933
  {
934
  if (isset($se_admin['pages']))
935
  {
 
 
 
 
 
936
  $this->se_cfg['pages'] = $se_admin['pages'];
937
  $this->se_save_config();
938
  ?>
@@ -943,6 +1039,7 @@ class SimplyExclude
943
  }
944
  }
945
  $this->se_show_pages_form();
 
946
  }
947
 
948
  function se_load_pages()
@@ -972,17 +1069,13 @@ class SimplyExclude
972
 
973
  function se_show_pages_form()
974
  {
975
- //$this->display_instructions('pages');
976
- //return;
977
-
978
  $this->se_load_pages();
979
  if ($this->pages)
980
  {
981
  $this->display_instructions('pages');
982
  ?>
983
  <form name="page_exclusion" id="page_exclusion"
984
- action="?page=<?php
985
- echo $this->options_key ?>&amp;se_admin[action]=save_pages" method="post">
986
  <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
987
  <thead>
988
  <tr>
@@ -1004,12 +1097,14 @@ class SimplyExclude
1004
  <td class="inc-excl">
1005
  <input type="radio"
1006
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="i"
1007
- <?php if ($this->se_cfg['pages']['actions'][$action_key] == 'i')
 
1008
  echo "checked='checked'"; ?> /> Include only<br />
1009
 
1010
  <input type="radio"
1011
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="e"
1012
- <?php if ($this->se_cfg['pages']['actions'][$action_key] == 'e')
 
1013
  echo "checked='checked'"; ?> /> Exclude
1014
  </td>
1015
  <tr>
@@ -1040,7 +1135,7 @@ class SimplyExclude
1040
  <tr>
1041
  <td colspan="3">
1042
  <p class="submit">
1043
- <input type="hidden" name="action" value="editcatvis" />
1044
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1045
  </p>
1046
  </td>
@@ -1050,6 +1145,7 @@ class SimplyExclude
1050
 
1051
  </form>
1052
  <?php
 
1053
  }
1054
  else
1055
  {
@@ -1100,7 +1196,7 @@ class SimplyExclude
1100
  <?php
1101
  }
1102
  }
1103
-
1104
  function get_pages_list($sep, $ids)
1105
  {
1106
  foreach($ids as $id_key => $id_val)
@@ -1116,22 +1212,24 @@ class SimplyExclude
1116
  // The following 2 function we taken from the wonderful SearchEverything plugin.
1117
  // http://wordpress.org/extend/plugins/search-everything/
1118
  function SE4_exclude_posts($where) {
1119
- global $wp_query;
1120
 
1121
  $action_key = "is_search";
1122
 
1123
  if ((!empty($wp_query->query_vars['s']))
1124
  && (count($this->se_cfg['pages'][$action_key]) > 0))
1125
  {
 
1126
  $excl_list = $this->get_pages_list(',', $this->se_cfg['pages'][$action_key]);
1127
  //$excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_posts_list'])));
1128
 
1129
- $where = str_replace('"', '\'', $where);
1130
- $where = 'AND ('.substr($where, strpos($where, 'AND')+3).' )';
1131
  if ($this->se_cfg['pages']['actions'][$action_key] == 'e')
1132
- $where .= ' AND (ID NOT IN ( '.$excl_list.' ))';
1133
  else
1134
- $where .= ' AND (ID IN ( '.$excl_list.' ))';
 
1135
  }
1136
  return $where;
1137
  }
@@ -1141,14 +1239,18 @@ class SimplyExclude
1141
  global $wp_query;
1142
 
1143
  if (!empty($wp_query->query_vars['s'])) {
1144
- $where = str_replace('"', '\'', $where);
 
 
1145
  if ('true' == $this->options['SE4_approved_pages_only']) {
1146
- $where = str_replace('post_type = \'post\' AND ', 'post_password = \'\' AND ', $where);
1147
  }
1148
  else { // < v 2.1
1149
- $where = str_replace('post_type = \'post\' AND ', '', $where);
1150
  }
 
1151
  }
 
1152
  return $where;
1153
  }
1154
 
@@ -1156,6 +1258,146 @@ class SimplyExclude
1156
  /////////////////////////////////////////////////////////////////
1157
 
1158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1159
  function se_filters($query)
1160
  {
1161
  if ($this->in_admin == true)
@@ -1271,6 +1513,7 @@ class SimplyExclude
1271
 
1272
  function se_listify_ids($action, $ids)
1273
  {
 
1274
  if ($action == "e")
1275
  $action_value = "-";
1276
  else
@@ -1350,6 +1593,24 @@ class SimplyExclude
1350
  <?php
1351
  */
1352
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1353
  }
1354
 
1355
  function add_page_exclude_sidebar_dbx()
@@ -1397,10 +1658,10 @@ class SimplyExclude
1397
 
1398
  function save_page_exclude_answer()
1399
  {
1400
- if (!$_REQUEST['post_ID'])
1401
  return;
1402
 
1403
- if (!$_REQUEST['se_page_exclude'])
1404
  return;
1405
 
1406
  $post_id = $_REQUEST['post_ID'];
@@ -1413,9 +1674,306 @@ class SimplyExclude
1413
 
1414
  $this->se_save_config();
1415
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1416
  }
1417
  $simplyexclude = new SimplyExclude();
1418
 
 
 
 
 
 
 
 
 
1419
  /*
1420
  function myBlogPostsFilter($query)
1421
  {
1
  <?php
2
  /*
3
  Plugin Name: Simply Exclude
4
+ Plugin URI: http://www.codehooligans.com/projects/wordpress/simply-exclude/
5
  Description: Provides an interface to selectively exclude/include categories, tags and page from the 4 actions used by WordPress. is_front, is_archive, is_search, is_feed.
6
  Author: Paul Menard
7
+ Version: 1.7.7
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
14
  1.6 - 2008-05-22 Fixed various items. Added format display for Categories and Pages to reveal heirarchy, Disable plugin functions when searching in admin. This also corrected a display exclusion bug when showing categories and pages.
15
  1.7 - 2008-05-29 Added Author to the Include/Exclude logic. Now you can exclude Author's Posts from Search, Home, RSS, Archive.
16
  1.7.1 - 2008-07-16 Fixed an issue with WP 2.6 where it automatically decided to unserialize the option data structure.
17
+ 1.7.2 - 2009-02-05 Fixed some PHP warning by checking variable is set. Also added style to 2.7 interface.
18
+ 1.7.2.1 - 2009-07-01 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
19
+ 1.7.5 - 2009-07015 Fixed some PHP warning by checking variable is set. Also added style for 2.8 interface. Very minor changes.
20
+ 1.7.6 - 2009-11-14 Fixes: Issue with the Pages exclusion. Many users reporting a permissions issue. Additions: Added handler logic to interface with two other plugins. One of the often used Google XML Sitemaps. When setting Page or Category exclusions you now have the option to update the Google XML Sitemaps exclude pages and categories automatically. The other plugin is Search Unleashed.
21
 
22
  */
23
 
34
 
35
  var $in_admin;
36
 
37
+ var $GA_generatorObject;
38
+
39
  function SimplyExclude()
40
  {
41
  global $wp_version;
52
  // Add our own admin menu
53
  add_action('admin_menu', array(&$this,'se_add_nav'));
54
 
55
+ if ((isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_categories")
56
+ || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_tags")
57
+ || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_authors")
58
+ || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_pages")
59
+ || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_options"))
60
  add_action('admin_head', array(&$this,'se_admin_head'));
61
 
62
  if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'activate')
264
  $this->se_cfg['pages']['actions'][$page_key] = $page_action['action'];
265
  }
266
  }
267
+
268
+
269
+ if (!isset($this->se_cfg['options']))
270
+ {
271
+ $this->se_cfg['options'] = array();
272
+
273
+ $this->se_cfg['options']['google-sitemap-generator'] = array();
274
+ $this->se_cfg['options']['google-sitemap-generator']['name'] = "Google XML Sitemaps";
275
+ $this->se_cfg['options']['google-sitemap-generator']['url'] = "http://wordpress.org/extend/plugins/google-sitemap-generator/";
276
+ $this->se_cfg['options']['google-sitemap-generator']['desc'] = "Warning: Page ID listed in the Sitemap plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored";
277
+ $this->se_cfg['options']['google-sitemap-generator']['version'] = "3.1.6";
278
+ $this->se_cfg['options']['google-sitemap-generator']['status'] = false;
279
+ $this->se_cfg['options']['google-sitemap-generator']['active'] = true;
280
+
281
+ $this->se_cfg['options']['google-sitemap-generator']['actions'] = array();
282
+ $this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['desc'] = "Update Excluded Pages";
283
+ $this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update'] = false;
284
+ $this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['desc'] = "Update Excluded Categories";
285
+ $this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update'] = false;
286
+
287
+
288
+ $this->se_cfg['options']['search-unleashed'] = array();
289
+ $this->se_cfg['options']['search-unleashed']['name'] = "Search Unleashed";
290
+ $this->se_cfg['options']['search-unleashed']['url'] = "http://wordpress.org/extend/plugins/search-unleashed/";
291
+ $this->se_cfg['options']['search-unleashed']['desc'] = "Warning: Page ID listed in the Search Unleashed plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored";
292
+ $this->se_cfg['options']['search-unleashed']['version'] = "1.0.5";
293
+ $this->se_cfg['options']['search-unleashed']['status'] = false;
294
+ $this->se_cfg['options']['search-unleashed']['active'] = true;
295
+
296
+ $this->se_cfg['options']['search-unleashed']['actions'] = array();
297
+ $this->se_cfg['options']['search-unleashed']['actions']['pages']['desc'] = "Update Excluded Pages";
298
+ $this->se_cfg['options']['search-unleashed']['actions']['pages']['update'] = false;
299
+ $this->se_cfg['options']['search-unleashed']['actions']['categories']['desc'] = "Update Excluded Categories";
300
+ $this->se_cfg['options']['search-unleashed']['actions']['categories']['update'] = false;
301
+ }
302
+ $this->se_cfg['options']['google-sitemap-generator']['desc'] = "Warning: Page ID listed in the Sitemap plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored";
303
+ $this->se_cfg['options']['search-unleashed']['desc'] = "Warning: Page ID listed in the Search Unleashed plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored";
304
+
305
+ asort($this->se_cfg['options']);
306
+ }
307
+
308
  function se_save_config()
309
  {
310
  $ret = update_option($this->options_key, serialize($this->se_cfg));
311
  }
312
+
313
 
314
  function se_add_nav()
315
  {
330
 
331
  add_submenu_page( 'se_manage_categories', 'Exclude Pages', 'Exclude Pages', 7,
332
  'se_manage_pages', array(&$this, 'se_manage_pages'));
333
+
334
+ add_submenu_page( 'se_manage_categories', 'Exclude Options', 'Exclude Options', 7,
335
+ 'se_manage_options', array(&$this, 'se_manage_options'));
336
+
337
  }
338
 
339
  function se_admin_head()
357
  serialize($this->se_cfg),
358
  "This is the serialized config structures used.");
359
  }
360
+
361
  function se_manage_page()
362
  {
363
  //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
406
 
407
  function se_manage_categories()
408
  {
409
+ ?><div class="wrap"><?php
410
  if (isset($_REQUEST['se_admin']))
411
  {
412
+ // echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
413
  $se_admin = $_REQUEST['se_admin'];
414
+ //$se_admin['action'] = $_GET['se_admin']['action'];
415
+ $this->se_display_categories_panel($se_admin);
416
  }
417
+ else
418
+ $this->se_display_categories_panel();
419
  ?></div><?php
420
  }
421
 
422
  function se_manage_tags()
423
  {
424
+ ?><div class="wrap"><?php
425
  if (isset($_REQUEST['se_admin']))
426
  {
427
+ //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
428
  $se_admin = $_REQUEST['se_admin'];
429
+ //$se_admin['action'] = $_GET['se_admin']['action'];
430
+ $this->se_display_tags_panel($se_admin);
431
  }
432
+ else
433
+ $this->se_display_tags_panel();
434
+
435
  ?></div><?php
436
  }
437
 
438
  function se_manage_authors()
439
  {
440
+ ?><div class="wrap"><?php
441
  if (isset($_REQUEST['se_admin']))
442
  {
443
+ //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
444
  $se_admin = $_REQUEST['se_admin'];
445
+ //$se_admin['action'] = $_GET['se_admin']['action'];
446
+ $this->se_display_authors_panel($se_admin);
447
  }
448
+ else
449
+ $this->se_display_authors_panel();
450
  ?></div><?php
451
  }
452
 
453
  function se_manage_pages()
454
  {
455
+ ?><div class="wrap"><?php
456
  if (isset($_REQUEST['se_admin']))
457
  {
458
+ //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
459
  $se_admin = $_REQUEST['se_admin'];
460
+ //$se_admin['action'] = $_GET['se_admin']['action'];
461
+ $this->se_display_pages_panel($se_admin);
462
  }
463
+ else
464
+ $this->se_display_pages_panel();
465
+ ?></div><?php
466
+ }
467
+
468
+ function se_manage_options()
469
+ {
470
  ?><div class="wrap"><?php
471
+ if (isset($_REQUEST['se_admin']))
472
+ {
473
+ //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
474
+ $se_admin = $_REQUEST['se_admin'];
475
+ //$se_admin['action'] = $_REQUEST['se_admin']['action'];
476
+ $this->se_display_options_panel($se_admin);
477
+ }
478
+ else
479
+ $this->se_display_options_panel();
480
  ?></div><?php
481
+
482
  }
483
 
484
 
533
 
534
  // CATEGORY FUNCTIONS
535
  /////////////////////////////////////////////////////////////////
536
+ function se_display_categories_panel($se_admin='')
537
  {
538
+ //$this->se_check_google_xml_sitemap_exclude_cats();
539
  //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
540
  ?>
541
 
542
  <h2>Manage Category Exclusions</h2>
543
  <?php
544
+ if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_categories"))
545
  {
546
+ $this->se_update_google_xml_sitemap_exclude_cats();
547
+ $this->se_update_search_unleashed_exclude_cats();
548
+
549
  //echo "se_admin<pre>"; print_r($se_admin); echo "</pre>";
550
  if (isset($se_admin['cats']))
551
  $this->se_cfg['cats'] = $se_admin['cats'];
608
  </thead>
609
  <tbody>
610
  <?php
611
+ $class = "";
612
  foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
613
  {
614
  $class = ('alternate' == $class) ? '' : 'alternate';
619
  <td class="inc-excl">
620
  <input type="radio"
621
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="i"
622
+ <?php if ((isset($this->se_cfg['cats']['actions'][$action_key]))
623
+ && ($this->se_cfg['cats']['actions'][$action_key] == 'i'))
624
  echo "checked='checked'"; ?> /> Include only<br />
625
  <input type="radio"
626
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="e"
627
+ <?php if ((isset($this->se_cfg['cats']['actions'][$action_key]))
628
+ && ($this->se_cfg['cats']['actions'][$action_key] == 'e'))
629
  echo "checked='checked'"; ?> /> Exclude
630
  </td>
631
  <tr>
645
  </thead>
646
  <tbody>
647
  <?php
648
+ $class="";
649
  foreach($this->categories as $cat_info)
650
  {
651
  $class = ('alternate' == $class) ? '' : 'alternate';
655
  <tr>
656
  <td colspan="3">
657
  <p class="submit">
658
+ <input type="hidden" name="se_admin[action]" value="save_categories" />
659
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
660
  </p>
661
  </td>
704
  name="se_admin[cats][<?php echo $action_key ?>][<?php echo $cat_id ?>]"
705
  id="cats-<?php echo $action_key ?>-<?php echo $cat_id ?>"
706
  <?php
707
+
708
+ if ((isset($this->se_cfg['cats'][$action_key][$cat_id])) && ($this->se_cfg['cats'][$action_key][$cat_id] == "on"))
709
  echo "checked='checked' ";
710
  ?> />
711
  <?php
718
 
719
  // TAG FUNCTIONS
720
  /////////////////////////////////////////////////////////////////
721
+ function se_display_tags_panel($se_admin='')
722
  {
723
  ?>
724
  <h2>Manage Tag Exclusions</h2>
725
  <?php
726
+ if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_tags"))
727
  {
728
  if (isset($se_admin['tags']))
729
  $this->se_cfg['tags'] = $se_admin['tags'];
743
  function se_load_tags()
744
  {
745
  global $wpdb;
746
+ if (!isset($this->tags))
747
  {
748
  $this->tags = get_tags('hide_empty=0&orderby=name&order=ASC');
749
  }
770
  </thead>
771
  <tbody>
772
  <?php
773
+ $class="";
774
  foreach ($this->default_IsActions['tags'] as $action_key => $action_val)
775
  {
776
  $class = ('alternate' == $class) ? '' : 'alternate';
814
  <tr>
815
  <td colspan="3">
816
  <p class="submit">
817
+ <input type="hidden" name="se_admin[action]" value="save_tags" />
818
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
819
  </p>
820
  </td>
831
  }
832
  }
833
 
 
834
  function se_show_tag_item_row($tag_info, $class)
835
  {
836
  ?>
853
  name="se_admin[tags][<?php echo $action_key ?>][<?php echo $tag_id ?>]"
854
  id="tags-<?php echo $action_key ?>-<?php echo $tag_id ?>"
855
  <?php
856
+ if ((isset($this->se_cfg['tags'][$action_key][$tag_id])) && ($this->se_cfg['tags'][$action_key][$tag_id] == "on"))
857
  echo "checked='checked' ";
858
  ?> />
859
  <?php
867
 
868
  // AUTHOR FUNCTIONS
869
  /////////////////////////////////////////////////////////////////
870
+ function se_display_authors_panel($se_admin='')
871
  {
872
  ?>
873
  <h2>Manage Author Exclusions</h2>
874
  <?php
875
+ if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_authors"))
876
  {
877
  if (isset($se_admin['authors']))
878
  $this->se_cfg['authors'] = $se_admin['authors'];
892
  function se_load_authors()
893
  {
894
  global $wpdb;
895
+ if (!isset($this->authors))
896
  {
897
  $this->authors = get_users_of_blog();
898
  }
918
  </thead>
919
  <tbody>
920
  <?php
921
+ $class="";
922
  foreach ($this->default_IsActions['authors'] as $action_key => $action_val)
923
  {
924
  $class = ('alternate' == $class) ? '' : 'alternate';
962
  <tr>
963
  <td colspan="3">
964
  <p class="submit">
965
+ <input type="hidden" name="se_admin[action]" value="save_authors" />
966
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
967
  </p>
968
  </td>
975
  }
976
  else
977
  {
978
+ ?><p>You don't have any Authors defined.</p><?php
979
  }
980
  }
981
 
1001
  name="se_admin[authors][<?php echo $action_key ?>][<?php echo $author_id ?>]"
1002
  id="authors-<?php echo $action_key ?>-<?php echo $author_id ?>"
1003
  <?php
1004
+ if ((isset($this->se_cfg['authors'][$action_key][$author_id]))
1005
+ && ($this->se_cfg['authors'][$action_key][$author_id] == "on"))
1006
  echo "checked='checked' ";
1007
  ?> />
1008
  <?php
1014
 
1015
  // PAGE FUNCTIONS
1016
  /////////////////////////////////////////////////////////////////
1017
+ function se_display_pages_panel($se_admin='')
1018
  {
1019
+ //$this->se_check_google_sitemap_exclude_pages();
1020
  ?>
1021
  <h2>Manage Page Exclusions</h2>
1022
  <?php
1023
+ if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_pages"))
1024
  {
1025
  if (isset($se_admin['pages']))
1026
  {
1027
+ // Need to update the third party items before updating the master. This will allow for
1028
+ // comparison checking
1029
+ $this->se_update_google_xml_sitemap_exclude_pages();
1030
+ $this->se_update_search_unleashed_exclude_pages();
1031
+
1032
  $this->se_cfg['pages'] = $se_admin['pages'];
1033
  $this->se_save_config();
1034
  ?>
1039
  }
1040
  }
1041
  $this->se_show_pages_form();
1042
+
1043
  }
1044
 
1045
  function se_load_pages()
1069
 
1070
  function se_show_pages_form()
1071
  {
 
 
 
1072
  $this->se_load_pages();
1073
  if ($this->pages)
1074
  {
1075
  $this->display_instructions('pages');
1076
  ?>
1077
  <form name="page_exclusion" id="page_exclusion"
1078
+ action="?page=se_manage_pages&amp;se_admin[action]=save_pages" method="post">
 
1079
  <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
1080
  <thead>
1081
  <tr>
1097
  <td class="inc-excl">
1098
  <input type="radio"
1099
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="i"
1100
+ <?php if ((isset($this->se_cfg['pages']['actions'][$action_key]))
1101
+ && ($this->se_cfg['pages']['actions'][$action_key] == 'i'))
1102
  echo "checked='checked'"; ?> /> Include only<br />
1103
 
1104
  <input type="radio"
1105
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="e"
1106
+ <?php if ((isset($this->se_cfg['pages']['actions'][$action_key]))
1107
+ && ($this->se_cfg['pages']['actions'][$action_key] == 'e'))
1108
  echo "checked='checked'"; ?> /> Exclude
1109
  </td>
1110
  <tr>
1135
  <tr>
1136
  <td colspan="3">
1137
  <p class="submit">
1138
+ <input type="hidden" name="se_admin[action]" value="save_pages" />
1139
  <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1140
  </p>
1141
  </td>
1145
 
1146
  </form>
1147
  <?php
1148
+ //$this->se_check_google_sitemap_exclude(1);
1149
  }
1150
  else
1151
  {
1196
  <?php
1197
  }
1198
  }
1199
+
1200
  function get_pages_list($sep, $ids)
1201
  {
1202
  foreach($ids as $id_key => $id_val)
1212
  // The following 2 function we taken from the wonderful SearchEverything plugin.
1213
  // http://wordpress.org/extend/plugins/search-everything/
1214
  function SE4_exclude_posts($where) {
1215
+ global $wp_query, $wpdb;
1216
 
1217
  $action_key = "is_search";
1218
 
1219
  if ((!empty($wp_query->query_vars['s']))
1220
  && (count($this->se_cfg['pages'][$action_key]) > 0))
1221
  {
1222
+ //echo __FUNCTION__ ." before : where=[".$where."]<br />";
1223
  $excl_list = $this->get_pages_list(',', $this->se_cfg['pages'][$action_key]);
1224
  //$excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_posts_list'])));
1225
 
1226
+ $where = str_replace('"', "'", $where);
1227
+ $where = 'AND ('. substr($where, strpos($where, 'AND')+3). ' )';
1228
  if ($this->se_cfg['pages']['actions'][$action_key] == 'e')
1229
+ $where .= ' AND ('.$wpdb->posts.'.ID NOT IN ( '.$excl_list.' ))';
1230
  else
1231
+ $where .= ' AND ('.$wpdb->posts.'.ID IN ( '.$excl_list.' ))';
1232
+ //echo __FUNCTION__ ." after: where=[".$where."]<br />";
1233
  }
1234
  return $where;
1235
  }
1239
  global $wp_query;
1240
 
1241
  if (!empty($wp_query->query_vars['s'])) {
1242
+ //echo __FUNCTION__ ." before: where=[".$where."]<br />";
1243
+
1244
+ $where = str_replace('"', "'", $where);
1245
  if ('true' == $this->options['SE4_approved_pages_only']) {
1246
+ $where = str_replace("post_type = 'post' AND ", "post_password = '' AND ", $where);
1247
  }
1248
  else { // < v 2.1
1249
+ $where = str_replace("post_type = 'post' AND ", "", $where);
1250
  }
1251
+ //echo __FUNCTION__ ." after: where=[".$where."]<br />";
1252
  }
1253
+
1254
  return $where;
1255
  }
1256
 
1258
  /////////////////////////////////////////////////////////////////
1259
 
1260
 
1261
+
1262
+ // OPTIONS FUNCTIONS
1263
+ /////////////////////////////////////////////////////////////////
1264
+ function se_display_options_panel($se_admin='')
1265
+ {
1266
+ ?>
1267
+ <h2>Manage Simply Exclude Options and Third-Party hooks</h2>
1268
+ <?php
1269
+
1270
+ if (isset($_REQUEST['se_admin']))
1271
+ $se_admin = $_REQUEST['se_admin'];
1272
+
1273
+ $this->se_load_options();
1274
+
1275
+ if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_options"))
1276
+ {
1277
+ if (isset($se_admin['options']))
1278
+ {
1279
+ foreach ($this->se_cfg['options'] as $option_key => $options_set)
1280
+ {
1281
+ if ($options_set['status'] === true)
1282
+ {
1283
+ if (count($options_set['actions']))
1284
+ {
1285
+ foreach($options_set['actions'] as $option_actions_idx => $option_actions_set)
1286
+ {
1287
+ if (isset($se_admin['options'][$option_key]['actions'][$option_actions_idx]['update']))
1288
+ $this->se_cfg['options'][$option_key]['actions'][$option_actions_idx]['update'] = true;
1289
+ else
1290
+ $this->se_cfg['options'][$option_key]['actions'][$option_actions_idx]['update'] = false;
1291
+ }
1292
+ }
1293
+ }
1294
+ }
1295
+ $this->se_save_config();
1296
+ ?>
1297
+ <div class="updated">
1298
+ <p>Exclusion Options successfully updated.</p>
1299
+ </div>
1300
+ <?php
1301
+
1302
+ }
1303
+ }
1304
+ $this->se_show_options_form();
1305
+ }
1306
+
1307
+ function se_load_options()
1308
+ {
1309
+ $check_plugins = get_option('active_plugins');
1310
+ if ($check_plugins)
1311
+ {
1312
+ foreach($check_plugins as $plugin_item)
1313
+ {
1314
+ $plugin_path_prefix = explode('/', $plugin_item);
1315
+ if (isset($this->se_cfg['options'][$plugin_path_prefix[0]]))
1316
+ $this->se_cfg['options'][$plugin_path_prefix[0]]['status'] = true;
1317
+ }
1318
+ }
1319
+ }
1320
+ function se_show_options_form()
1321
+ {
1322
+ $this->display_instructions('options');
1323
+
1324
+ ?>
1325
+ <form name="option_exclusion" id="option_exclusion"
1326
+ action="?page=se_manage_options" method="post">
1327
+ <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
1328
+ <thead>
1329
+ <tr>
1330
+ <th class="name"><?php _e('Plugin Name') ?></th>
1331
+ <th class="description"><?php _e('Description of Functionality') ?></th>
1332
+ <th class="actions"><?php _e('Actions') ?></th>
1333
+ </tr>
1334
+ </thead>
1335
+ <tbody>
1336
+ <?php
1337
+ $class = "";
1338
+ foreach ($this->se_cfg['options'] as $option_key => $options_set)
1339
+ {
1340
+ //echo "options_set<pre>"; print_r($options_set); echo "</pre>";
1341
+
1342
+ $class = ('alternate' == $class) ? '' : 'alternate';
1343
+ ?>
1344
+ <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
1345
+ <td class="name"><a href="<?php echo $options_set['url'] ?>"><?php echo $options_set['name'] ?></a></td>
1346
+ <td class="description"><?php echo $options_set['desc'] ?></td>
1347
+ <td class="actions" nowrap="nowrap">
1348
+ <?php
1349
+ if ($options_set['active'] == true)
1350
+ {
1351
+ if ($options_set['status'] !== true)
1352
+ {
1353
+ ?>This plugin is not installed or not active.<?php
1354
+ }
1355
+ else
1356
+ {
1357
+ if (count($options_set['actions']))
1358
+ {
1359
+ foreach($options_set['actions'] as $option_actions_idx => $option_actions_set)
1360
+ {
1361
+ ?>
1362
+ <input type="checkbox"
1363
+ name="se_admin[options][<?php echo $option_key; ?>][actions][<?php
1364
+ echo $option_actions_idx; ?>][update]"
1365
+ <?php if ($option_actions_set['update'] === true)
1366
+ echo "checked='checked'"; ?> /> <?php echo $option_actions_set['desc']?><br />
1367
+ <?php
1368
+ }
1369
+ }
1370
+ }
1371
+ }
1372
+ ?>
1373
+
1374
+ </td>
1375
+ <tr>
1376
+ <?php
1377
+ }
1378
+ ?>
1379
+ <tr>
1380
+ <td colspan="2">
1381
+ <p class="submit">
1382
+ <input type="hidden" name="se_admin[action]" value="save_options" />
1383
+ <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1384
+ </p>
1385
+ </td>
1386
+ </tr>
1387
+
1388
+ </tbody>
1389
+ </table>
1390
+
1391
+ </form>
1392
+ <?php
1393
+ }
1394
+
1395
+
1396
+ // END CONFIG FUNCTIONS
1397
+ /////////////////////////////////////////////////////////////////
1398
+
1399
+
1400
+
1401
  function se_filters($query)
1402
  {
1403
  if ($this->in_admin == true)
1513
 
1514
  function se_listify_ids($action, $ids)
1515
  {
1516
+ $id_list = "";
1517
  if ($action == "e")
1518
  $action_value = "-";
1519
  else
1593
  <?php
1594
  */
1595
  }
1596
+ else if ($type == "options")
1597
+ {
1598
+ ?>
1599
+ <p>The Simply Exclude plugin now works with a few other plugins. Check the box for support of the listed third
1600
+ party plugins options below</p>
1601
+ <p>When you update this section you will then also need to go back into the Simply Exclude Category or Pages section and re-save the settings. This re-save will then update the third-party plugin settings with the update excluded values. On the respective Category or Pages sections of Simply Exclude you can use either include or exclude action.</p>
1602
+ <p style="color: #ff0000">Warning: Once enabled it is suggested you make edits to the exclusion/inclusion via Simply Exclude. Any PAge or Category exclusion made in the third-party plugins will be over written by changed from Simply Exclude. </p>
1603
+ <?php
1604
+
1605
+ /*
1606
+ ?>
1607
+ <p>This is a placeholder section for Pages Exclusion. Since WordPress does not yet include Pages in searches this section is pointless. From various sources version 2.6 of WordPress should include native support for including Pages in search results. Look for changes to this plugin shortly after that.</p>
1608
+ <?php
1609
+ */
1610
+ }
1611
+
1612
+
1613
+
1614
  }
1615
 
1616
  function add_page_exclude_sidebar_dbx()
1658
 
1659
  function save_page_exclude_answer()
1660
  {
1661
+ if (!isset($_REQUEST['post_ID']))
1662
  return;
1663
 
1664
+ if (!isset($_REQUEST['se_page_exclude']))
1665
  return;
1666
 
1667
  $post_id = $_REQUEST['post_ID'];
1674
 
1675
  $this->se_save_config();
1676
  }
1677
+
1678
+
1679
+ // THIRD PARTY FUNCTIONS
1680
+ /////////////////////////////////////////////////////////////////
1681
+
1682
+ /*
1683
+ function se_check_google_xml_sitemap_exclude_cats()
1684
+ {
1685
+ return;
1686
+
1687
+
1688
+ if (!$this->GA_generatorObject) return;
1689
+
1690
+ if ((!$this->GA_generatorObject->_options["sm_b_exclude_cats"])
1691
+ || (count($this->GA_generatorObject->_options["sm_b_exclude_cats"]) == 0))
1692
+ return;
1693
+
1694
+ // We only care about
1695
+ if ((!isset($this->se_cfg['cats']['actions']['is_search']))
1696
+ || ($this->se_cfg['cats']['actions']['is_search'] != "e"))
1697
+ return;
1698
+
1699
+ if (!isset($this->se_cfg['cats']['is_search']))
1700
+ $this->se_cfg['cats']['is_search'] = array();
1701
+
1702
+ foreach($this->GA_generatorObject->_options["sm_b_exclude_cats"] as $google_sitemap_cat_id) {
1703
+ $this->se_cfg['cats']['is_search'][$google_sitemap_cat_id] = "on";
1704
+
1705
+ }
1706
+ }
1707
+ */
1708
+ function se_update_google_xml_sitemap_exclude_cats()
1709
+ {
1710
+ // If the user didn't elect to sync the excluded page with the Google Xml Sitemap -- return;
1711
+ if ((!isset($this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update']))
1712
+ || ($this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update'] !== true))
1713
+ return;
1714
+
1715
+ unset($this->GA_generatorObject->_options['sm_b_exclude_cats']);
1716
+ $this->GA_generatorObject->_options['sm_b_exclude_cats'] = array();
1717
+
1718
+ if ($_REQUEST['se_admin']['cats']['actions']['is_search'] == "e")
1719
+ {
1720
+ foreach($_REQUEST['se_admin']['cats']['is_search'] as $cat_idx => $cal_status)
1721
+ {
1722
+ if (array_search($cat_idx, $this->GA_generatorObject->_options['sm_b_exclude_cats']) === false)
1723
+ $this->GA_generatorObject->_options['sm_b_exclude_cats'][] = $cat_idx;
1724
+ }
1725
+ }
1726
+ else
1727
+ {
1728
+ $all_cat_ids = get_all_category_ids();
1729
+ if (!$all_cat_ids)
1730
+ $all_cat_ids = array();
1731
+
1732
+ foreach($all_cat_ids as $cat_idx)
1733
+ {
1734
+ if (!isset($_REQUEST['se_admin']['cats']['is_search'][$cat_idx]))
1735
+ $this->GA_generatorObject->_options['sm_b_exclude_cats'][] = $cat_idx;
1736
+ }
1737
+ }
1738
+ update_option("sm_options", $this->GA_generatorObject->_options);
1739
+ }
1740
+
1741
+
1742
+ /*
1743
+ function se_check_google_sitemap_exclude_pages()
1744
+ {
1745
+ return;
1746
+
1747
+ if (!$this->GA_generatorObject) return;
1748
+
1749
+ if ((!$this->GA_generatorObject->_options["sm_b_exclude"])
1750
+ || (count($this->GA_generatorObject->_options["sm_b_exclude"]) == 0))
1751
+ return;
1752
+
1753
+ // We only care about
1754
+ if ((!isset($this->se_cfg['pages']['actions']['is_search']))
1755
+ || ($this->se_cfg['pages']['actions']['is_search'] != "e"))
1756
+ return;
1757
+
1758
+ if (!isset($this->se_cfg['pages']['is_search']))
1759
+ $this->se_cfg['pages']['is_search'] = array();
1760
+
1761
+ $all_page_ids = get_all_page_ids();
1762
+ if (!$all_page_ids)
1763
+ $all_page_ids = array();
1764
+
1765
+ foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $google_sitemap_page_id) {
1766
+
1767
+ if (array_search($google_sitemap_page_id, $all_page_ids) === false)
1768
+ continue;
1769
+
1770
+ if (count($this->se_cfg['pages']['is_search'])) {
1771
+ if (!isset($this->se_cfg['pages']['is_search'][$google_sitemap_page_id])) {
1772
+ $this->se_cfg['pages']['is_search'][$google_sitemap_page_id] = "on";
1773
+ }
1774
+ }
1775
+ else
1776
+ $this->se_cfg['pages']['is_search'][$google_sitemap_page_id] = "on";
1777
+ }
1778
+ if (count($this->se_cfg['pages']))
1779
+ asort($this->se_cfg['pages']);
1780
+ }
1781
+ */
1782
+ function se_update_google_xml_sitemap_exclude_pages()
1783
+ {
1784
+ if ((!isset($this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update']))
1785
+ || ($this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update'] !== true))
1786
+ return;
1787
+
1788
+ // If both arrays are empty then we don't have anything to do -- return
1789
+ //echo "sm_b_exclude<pre>"; print_r($this->GA_generatorObject->_options["sm_b_exclude"]); echo "</pre>";
1790
+ //exit;
1791
+
1792
+ if ((count($this->GA_generatorObject->_options["sm_b_exclude"]) == 0)
1793
+ && (count($_REQUEST['se_admin']['pages']['is_search']) == 0))
1794
+ return;
1795
+
1796
+ $all_page_ids = get_all_page_ids();
1797
+ if (!$all_page_ids)
1798
+ $all_page_ids = array();
1799
+
1800
+ if ($_REQUEST['se_admin']['pages']['actions']['is_search'] == "e") {
1801
+
1802
+ // Remove all Pages from the Google XML Sitemap exclude array. Then we will add the new ones back.
1803
+ foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $idx => $google_sitemap_page_id) {
1804
+
1805
+ if (array_search($google_sitemap_page_id, $all_page_ids) !== false)
1806
+ unset($this->GA_generatorObject->_options["sm_b_exclude"][$idx]);
1807
+ }
1808
+ foreach($_REQUEST['se_admin']['pages']['is_search'] as $se_pages_idx => $se_page_status)
1809
+ {
1810
+ if (array_search($se_pages_idx, $this->GA_generatorObject->_options["sm_b_exclude"]) === false)
1811
+ $this->GA_generatorObject->_options["sm_b_exclude"][] = $se_pages_idx;
1812
+ }
1813
+ }
1814
+ else {
1815
+
1816
+ foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $idx => $google_sitemap_page_id) {
1817
+ if (array_search($google_sitemap_page_id, $all_page_ids) !== false)
1818
+ unset($this->GA_generatorObject->_options["sm_b_exclude"][$idx]);
1819
+ }
1820
+
1821
+ foreach($all_page_ids as $page_idx => $page_id) {
1822
+ if (array_key_exists($page_id, $_REQUEST['se_admin']['pages']['is_search']) === false)
1823
+ {
1824
+ if (array_search($page_id, $this->GA_generatorObject->_options["sm_b_exclude"]) === false)
1825
+ $this->GA_generatorObject->_options["sm_b_exclude"][] = $page_id;
1826
+ }
1827
+ }
1828
+ }
1829
+ //echo "GA_generatorObject : after<pre>"; print_r($this->GA_generatorObject->_options["sm_b_exclude"]); echo "</pre>";
1830
+
1831
+ update_option("sm_options", $this->GA_generatorObject->_options);
1832
+ }
1833
+
1834
+
1835
+ function se_update_search_unleashed_exclude_cats()
1836
+ {
1837
+ if ((!isset($this->se_cfg['options']['search-unleashed']['actions']['categories']['update']))
1838
+ || ($this->se_cfg['options']['search-unleashed']['actions']['categories']['update'] !== true))
1839
+ return;
1840
+
1841
+ $search_unleashed_options = get_option( 'search_unleashed', $options );
1842
+ if (strlen($search_unleashed_options['exclude_cat']))
1843
+ {
1844
+ $search_unleashed_exclude = explode(',', $search_unleashed_options['exclude_cat']);
1845
+ if ($search_unleashed_exclude)
1846
+ {
1847
+ foreach($search_unleashed_exclude as $ex_idx => $ex_item)
1848
+ {
1849
+ $search_unleashed_exclude[$ex_idx] = trim($ex_item);
1850
+ }
1851
+ }
1852
+ else
1853
+ $search_unleashed_exclude = array();
1854
+ }
1855
+ else
1856
+ $search_unleashed_exclude = array();
1857
+
1858
+ $all_cat_ids = get_all_category_ids();
1859
+ if (!$all_cat_ids)
1860
+ $all_cat_ids = array();
1861
+
1862
+
1863
+ if ($_REQUEST['se_admin']['cats']['actions']['is_search'] == "e")
1864
+ {
1865
+ foreach($search_unleashed_exclude as $idx => $search_exclude_cat_id) {
1866
+ if (array_search($search_exclude_cat_id, $all_cat_ids) !== false)
1867
+ unset($search_unleashed_exclude[$idx]);
1868
+ }
1869
+
1870
+ foreach($_REQUEST['se_admin']['cats']['is_search'] as $se_cat_idx => $se_cat_status)
1871
+ {
1872
+ if (array_search($se_cat_idx, $search_unleashed_exclude) === false)
1873
+ $search_unleashed_exclude[] = $se_cat_idx;
1874
+ }
1875
+
1876
+ }
1877
+ else
1878
+ {
1879
+ foreach($search_unleashed_exclude as $idx => $search_exclude_cat_id) {
1880
+ if (array_search($search_exclude_cat_id, $all_cat_ids) !== false)
1881
+ unset($search_unleashed_exclude[$idx]);
1882
+ }
1883
+
1884
+ foreach($all_cat_ids as $cat_idx => $cat_id) {
1885
+ if (array_key_exists($cat_id, $_REQUEST['se_admin']['cats']['is_search']) === false)
1886
+ {
1887
+ if (array_search($cat_id, $search_unleashed_exclude) === false)
1888
+ $search_unleashed_exclude[] = $cat_id;
1889
+ }
1890
+ }
1891
+ }
1892
+ $search_unleashed_options['exclude_cat'] = "";
1893
+ if (count($search_unleashed_exclude))
1894
+ {
1895
+ $search_unleashed_options['exclude_cat'] = implode(',', $search_unleashed_exclude);
1896
+ }
1897
+ update_option( 'search_unleashed', $search_unleashed_options );
1898
+ }
1899
+
1900
+ function se_update_search_unleashed_exclude_pages()
1901
+ {
1902
+ if ((!isset($this->se_cfg['options']['search-unleashed']['actions']['pages']['update']))
1903
+ || ($this->se_cfg['options']['search-unleashed']['actions']['pages']['update'] !== true))
1904
+ return;
1905
+
1906
+ $search_unleashed_options = get_option( 'search_unleashed', $options );
1907
+
1908
+ if (strlen($search_unleashed_options['exclude']))
1909
+ {
1910
+ $search_unleashed_exclude = explode(',', $search_unleashed_options['exclude']);
1911
+ if ($search_unleashed_exclude)
1912
+ {
1913
+ foreach($search_unleashed_exclude as $ex_idx => $ex_item)
1914
+ {
1915
+ $search_unleashed_exclude[$ex_idx] = trim($ex_item);
1916
+ }
1917
+ }
1918
+ else
1919
+ $search_unleashed_exclude = array();
1920
+ }
1921
+ else
1922
+ $search_unleashed_exclude = array();
1923
+
1924
+
1925
+ $all_page_ids = get_all_page_ids();
1926
+ if (!$all_page_ids)
1927
+ $all_page_ids = array();
1928
+
1929
+ if ($_REQUEST['se_admin']['pages']['actions']['is_search'] == "e") {
1930
+
1931
+ // Remove all Pages from the Google XML Sitemap exclude array. Then we will add the new ones back.
1932
+ foreach($search_unleashed_exclude as $idx => $search_exclude_page_id) {
1933
+ if (array_search($search_exclude_page_id, $all_page_ids) !== false)
1934
+ unset($search_unleashed_exclude[$idx]);
1935
+ }
1936
+
1937
+ foreach($_REQUEST['se_admin']['pages']['is_search'] as $se_pages_idx => $se_page_status)
1938
+ {
1939
+ if (array_search($se_pages_idx, $search_unleashed_exclude) === false)
1940
+ $search_unleashed_exclude[] = $se_pages_idx;
1941
+ }
1942
+ }
1943
+ else {
1944
+
1945
+ foreach($search_unleashed_exclude as $idx => $search_exclude_page_id) {
1946
+ if (array_search($search_exclude_page_id, $all_page_ids) !== false)
1947
+ unset($search_unleashed_exclude[$idx]);
1948
+ }
1949
+
1950
+ foreach($all_page_ids as $page_idx => $page_id) {
1951
+ if (array_key_exists($page_id, $_REQUEST['se_admin']['pages']['is_search']) === false)
1952
+ {
1953
+ if (array_search($page_id, $search_unleashed_exclude) === false)
1954
+ $search_unleashed_exclude[] = $page_id;
1955
+ }
1956
+ }
1957
+ }
1958
+
1959
+ $search_unleashed_options['exclude'] = "";
1960
+ if (count($search_unleashed_exclude))
1961
+ {
1962
+ $search_unleashed_options['exclude'] = implode(',', $search_unleashed_exclude);
1963
+ }
1964
+ update_option( 'search_unleashed', $search_unleashed_options );
1965
+ }
1966
  }
1967
  $simplyexclude = new SimplyExclude();
1968
 
1969
+ // Need to determine of the site uses the Google XML Sitemap Plugin
1970
+ if (is_file(WP_PLUGIN_DIR . '/google-sitemap-generator/sitemap-core.php'))
1971
+ {
1972
+ include (WP_PLUGIN_DIR. '/google-sitemap-generator/sitemap-core.php');
1973
+ $simplyexclude->GA_generatorObject = new GoogleSitemapGenerator();
1974
+ $simplyexclude->GA_generatorObject->LoadOptions();
1975
+ }
1976
+
1977
  /*
1978
  function myBlogPostsFilter($query)
1979
  {
simplyexclude_style_admin.css CHANGED
@@ -96,7 +96,8 @@ form#page_exclusion table tbody tr td.page-action input {
96
  form#cat_exclusion .submit,
97
  form#tag_exclusion .submit,
98
  form#author_exclusion .submit,
99
- form#page_exclusion .submit {
 
100
  border-top: 0px solid #CCCCCC;
101
  margin: 2px 0pt 0pt;
102
  padding: 0em 0pt 0pt;
96
  form#cat_exclusion .submit,
97
  form#tag_exclusion .submit,
98
  form#author_exclusion .submit,
99
+ form#page_exclusion .submit,
100
+ form#option_exclusion .submit {
101
  border-top: 0px solid #CCCCCC;
102
  margin: 2px 0pt 0pt;
103
  padding: 0em 0pt 0pt;