Simply Exclude - Version 1.6

Version Description

Download this release

Release Info

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

Code changes from version 1.5 to 1.6

Files changed (3) hide show
  1. readme.txt +10 -3
  2. simplyexclude.php +150 -61
  3. simplyexclude_style_admin.css +67 -22
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.3
6
  Tested up to: 2.5
7
- Stable tag: 1.5
8
 
9
  == Description ==
10
 
@@ -21,7 +21,7 @@ is_feed - When a Feed is viewed/requested.
21
 
22
  1. Upload the extracted plugin folder and contained files to your `/wp-content/plugins/` directory
23
  2. Activate the plugin through the 'Plugins' menu in WordPress
24
- 3. Navigate to Settings -> Simply Exclude (Options -> Simply Exclude is pre 2.5).
25
  4. Once on the plugin admin page you should see navigation links at the top: Manage Categories, Manage Tags, Manage Pages.On each of these page you can selectively exclude/include the cat/tag/page for the given action is_front/is_archive/is_feed/is_search.
26
 
27
  == Frequently Asked Questions ==
@@ -36,4 +36,11 @@ I've not added that feature. A minor version coming soon.
36
 
37
  == Screenshots ==
38
 
39
- None
 
 
 
 
 
 
 
4
  Tags: admin, posts, pages, categories, tags, exclude, include, is_front, is_archive, is_search, is_feed
5
  Requires at least: 2.3
6
  Tested up to: 2.5
7
+ Stable tag: 1.6
8
 
9
  == Description ==
10
 
21
 
22
  1. Upload the extracted plugin folder and contained files to your `/wp-content/plugins/` directory
23
  2. Activate the plugin through the 'Plugins' menu in WordPress
24
+ 3. Navigate to Settings -> Simply Exclude (Options -> Simply Exclude in pre 2.5).
25
  4. Once on the plugin admin page you should see navigation links at the top: Manage Categories, Manage Tags, Manage Pages.On each of these page you can selectively exclude/include the cat/tag/page for the given action is_front/is_archive/is_feed/is_search.
26
 
27
  == Frequently Asked Questions ==
36
 
37
  == Screenshots ==
38
 
39
+ None
40
+
41
+ == Version Histroy ==
42
+ Revision history
43
+ 1.0 - 2007-11-20: Initial release
44
+ 1.1 - 2008-12-15: Added logic to work with WP version greater than 2.2
45
+ 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.
46
+ 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.
simplyexclude.php CHANGED
@@ -4,13 +4,15 @@ 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.5
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
11
  1.0 - 2007-11-20: Initial release
12
  1.1 - 2008-12-15: Added logic to work with WP version greater than 2.2
13
  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.
 
 
14
  */
15
 
16
  class SimplyExclude
@@ -24,10 +26,13 @@ class SimplyExclude
24
 
25
  var $wp_version;
26
 
 
 
27
  function SimplyExclude()
28
  {
29
  global $wp_version;
30
  $this->wp_version = $wp_version;
 
31
 
32
  $this->_admin_menu_label = "Simply Exclude";
33
  $this->options_key = "simplyexclude";
@@ -49,10 +54,22 @@ class SimplyExclude
49
  add_filter('pre_get_posts', array(&$this,'se_filters'));
50
 
51
  add_action('save_post', array(&$this,'save_page_exclude_answer'));
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  function admin_init_proc()
55
  {
 
 
 
56
  if (function_exists('add_meta_box')) {
57
  add_meta_box($this->_options_key, $this->_admin_menu_label, array(&$this,'add_page_exclude_sidebar_dbx'), 'page');
58
  }
@@ -211,15 +228,17 @@ class SimplyExclude
211
 
212
  function se_manage_page()
213
  {
214
- $this->se_display_navigation();
 
 
 
 
 
215
 
216
  ?>
217
  <div class="wrap">
218
  <?php
219
 
220
- if (isset($_REQUEST['se_admin']))
221
- $se_admin = $_REQUEST['se_admin'];
222
-
223
  switch ($se_admin['action'])
224
  {
225
  case 'edit_pages':
@@ -245,26 +264,40 @@ class SimplyExclude
245
  }
246
 
247
 
248
- function se_display_navigation()
249
  {
250
-
251
  ?>
252
  <div id="se_admin_nav">
253
  <ul>
254
  <li><a href="?page=<?php
255
  echo $this->options_key ?>&amp;se_admin[action]=edit_categories"
256
- title="Manage Category Exclusions">Manage Categories</a></li>
 
 
 
 
 
257
  <?php
258
  if ($this->wp_version >= 2.3)
259
  {
260
  ?>
261
  <li><a href="?page=<?php
262
  echo $this->options_key ?>&amp;se_admin[action]=edit_tags"
 
 
 
 
 
263
  title="Manage Tag Exclusions">Manage Tags</a></li><?php
264
  }
265
  ?>
266
  <li><a href="?page=<?php
267
  echo $this->options_key ?>&amp;se_admin[action]=edit_pages"
 
 
 
 
 
268
  title="Manage Page Exclusions">Manage Pages</a></li>
269
  </ul>
270
  </div>
@@ -300,13 +333,28 @@ class SimplyExclude
300
  global $wpdb;
301
  if (!$this->categories)
302
  {
303
- //$this->categories = $wpdb->get_results("SELECT cat_ID, cat_name
304
- // FROM $wpdb->categories ORDER BY cat_name");
305
-
306
- $this->categories = get_categories();
307
  }
308
  }
309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  function se_show_categories_form()
311
  {
312
  $this->se_load_categories();
@@ -318,12 +366,12 @@ class SimplyExclude
318
  action="?page=<?php
319
  echo $this->options_key ?>&amp;se_admin[action]=save_categories" method="post">
320
 
321
- <table width="80%" cellpadding="3" cellspacing="3" border="0">
322
  <thead>
323
  <tr>
324
- <th><?php _e('Action Name') ?></th>
325
- <th><?php _e('Description ') ?></th>
326
- <th><?php _e('Inclusion/Exclusion') ?></th>
327
  </tr>
328
  </thead>
329
  <tbody>
@@ -333,9 +381,9 @@ class SimplyExclude
333
  $class = ('alternate' == $class) ? '' : 'alternate';
334
  ?>
335
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
336
- <td><?php echo $action_val['name'] ?></td>
337
- <td><?php echo $action_val['description'] ?></td>
338
- <td>
339
  <input type="radio"
340
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="i"
341
  <?php if ($this->se_cfg['cats']['actions'][$action_key] == 'i')
@@ -352,7 +400,7 @@ class SimplyExclude
352
  </tbody>
353
  </table>
354
  <br />
355
- <table width="80%" cellpadding="3" cellspacing="3" border="0">
356
  <thead>
357
  <tr>
358
  <th class="cat-id" scope="col"><?php _e('ID') ?></th>
@@ -369,9 +417,11 @@ class SimplyExclude
369
  }
370
  ?>
371
  <tr>
372
- <td>
373
- <div style="float:right;"><p class="submit"><input type="hidden" name="action" value="editcatvis" /><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
374
-
 
 
375
  </td>
376
  </tr>
377
  </tbody>
@@ -388,10 +438,21 @@ class SimplyExclude
388
 
389
  function se_show_cat_item_row($cat_info, $class)
390
  {
 
 
 
 
 
 
 
 
 
 
 
391
  ?>
392
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
393
  <td class="cat-id"><?php echo $cat_info->cat_ID ?></td>
394
- <td class="cat-name"><?php echo $cat_info->cat_name ?></td>
395
  <td class="cat-action"><?php $this->se_display_cat_action_row($cat_info->cat_ID) ?></td>
396
  </tr>
397
  <?php
@@ -448,7 +509,7 @@ class SimplyExclude
448
  global $wpdb;
449
  if (!$this->tags)
450
  {
451
- $this->tags = get_tags();
452
  }
453
  }
454
 
@@ -464,12 +525,12 @@ class SimplyExclude
464
  action="?page=<?php
465
  echo $this->options_key ?>&amp;se_admin[action]=save_tags" method="post">
466
 
467
- <table width="80%" cellpadding="3" cellspacing="3" border="0">
468
  <thead>
469
  <tr>
470
- <th><?php _e('Action Name') ?></th>
471
- <th><?php _e('Description ') ?></th>
472
- <th><?php _e('Inclusion/Exclusion') ?></th>
473
  </tr>
474
  </thead>
475
  <tbody>
@@ -479,9 +540,9 @@ class SimplyExclude
479
  $class = ('alternate' == $class) ? '' : 'alternate';
480
  ?>
481
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
482
- <td><?php echo $action_val['name'] ?></td>
483
- <td><?php echo $action_val['description'] ?></td>
484
- <td>
485
  <input type="radio"
486
  name="se_admin[tags][actions][<?php echo $action_key ?>]" value="i"
487
  <?php if ($this->se_cfg['tags']['actions'][$action_key] == 'i')
@@ -498,7 +559,7 @@ class SimplyExclude
498
  </tbody>
499
  </table>
500
  <br />
501
- <table width="80%" cellpadding="3" cellspacing="3" border="0">
502
  <thead>
503
  <tr>
504
  <th class="cat-id" scope="col"><?php _e('ID') ?></th>
@@ -515,9 +576,11 @@ class SimplyExclude
515
  }
516
  ?>
517
  <tr>
518
- <td>
519
- <div style="float:right;"><p class="submit"><input type="hidden" name="action" value="editcatvis" /><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
520
-
 
 
521
  </td>
522
  </tr>
523
  </tbody>
@@ -594,12 +657,26 @@ class SimplyExclude
594
  {
595
  global $wpdb;
596
  if (!$this->pages)
597
- $this->pages = $wpdb->get_results("SELECT ID, post_title
598
- FROM $wpdb->posts
599
- WHERE post_type='page'
600
- AND post_status='publish'
601
- ORDER BY post_title");
602
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
 
604
  function se_show_pages_form()
605
  {
@@ -614,12 +691,12 @@ class SimplyExclude
614
  <form name="page_exclusion" id="page_exclusion"
615
  action="?page=<?php
616
  echo $this->options_key ?>&amp;se_admin[action]=save_pages" method="post">
617
- <table width="80%" cellpadding="3" cellspacing="3" border="0">
618
  <thead>
619
  <tr>
620
- <th><?php _e('Action Name') ?></th>
621
- <th><?php _e('Description ') ?></th>
622
- <th><?php _e('Inclusion/Exclusion Default') ?></th>
623
  </tr>
624
  </thead>
625
  <tbody>
@@ -629,9 +706,9 @@ class SimplyExclude
629
  $class = ('alternate' == $class) ? '' : 'alternate';
630
  ?>
631
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
632
- <td><?php echo $action_val['name'] ?></td>
633
- <td><?php echo $action_val['description'] ?></td>
634
- <td>
635
  <input type="radio"
636
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="i"
637
  <?php if ($this->se_cfg['pages']['actions'][$action_key] == 'i')
@@ -651,7 +728,7 @@ class SimplyExclude
651
  <br />
652
 
653
 
654
- <table width="80%" cellpadding="3" cellspacing="3">
655
  <thead>
656
  <tr>
657
  <th class="page-id" scope="col"><?php _e('ID') ?></th>
@@ -668,10 +745,11 @@ class SimplyExclude
668
  }
669
  ?>
670
  <tr>
671
- <td>
672
- <div style="float:right;"><p class="submit"><input type="hidden" name="action" value="editcatvis" /><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
673
- </p></div>
674
-
 
675
  </td>
676
  </tr>
677
  </tbody>
@@ -689,10 +767,21 @@ class SimplyExclude
689
 
690
  function se_show_page_item_row($page_info, $class = '')
691
  {
 
 
 
 
 
 
 
 
 
 
 
692
  ?>
693
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
694
  <td class="page-id"><?php echo $page_info->ID ?></td>
695
- <td class="page-name"><?php echo $page_info->post_title ?></td>
696
  <td class="page-action"><?php $this->se_display_page_action_row($page_info->ID) ?></td>
697
  </tr>
698
  <?php
@@ -734,12 +823,13 @@ class SimplyExclude
734
  // http://wordpress.org/extend/plugins/search-everything/
735
  function SE4_exclude_posts($where) {
736
  global $wp_query;
 
 
 
737
  if ((!empty($wp_query->query_vars['s']))
738
  && (count($this->se_cfg['pages'][$action_key]) > 0))
739
  {
740
- $action_key = "is_search";
741
  $excl_list = $this->get_pages_list(',', $this->se_cfg['pages'][$action_key]);
742
-
743
  //$excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_posts_list'])));
744
 
745
  $where = str_replace('"', '\'', $where);
@@ -757,7 +847,6 @@ class SimplyExclude
757
  global $wp_query;
758
 
759
  if (!empty($wp_query->query_vars['s'])) {
760
-
761
  $where = str_replace('"', '\'', $where);
762
  if ('true' == $this->options['SE4_approved_pages_only']) {
763
  $where = str_replace('post_type = \'post\' AND ', 'post_password = \'\' AND ', $where);
@@ -768,8 +857,6 @@ class SimplyExclude
768
  }
769
  return $where;
770
  }
771
-
772
-
773
 
774
  // END CONFIG FUNCTIONS
775
  /////////////////////////////////////////////////////////////////
@@ -777,7 +864,10 @@ class SimplyExclude
777
 
778
  function se_filters($query)
779
  {
780
- //echo "query before<pre>"; print_r($query); echo "</pre>";
 
 
 
781
  if (count($this->default_IsActions['cats']) > 0)
782
  {
783
  foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
@@ -834,7 +924,6 @@ class SimplyExclude
834
 
835
  foreach ($this->default_IsActions['pages'] as $action_key => $action_val)
836
  {
837
- //echo "action_key=[". $action_key. "]<br />";
838
  if ($query->{$action_key})
839
  {
840
  add_filter('posts_where', array(&$this, 'SE4_search_pages'));
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.6
8
  Author URI: http://www.codehooligans.com
9
 
10
  Revision history
11
  1.0 - 2007-11-20: Initial release
12
  1.1 - 2008-12-15: Added logic to work with WP version greater than 2.2
13
  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.
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
+
16
  */
17
 
18
  class SimplyExclude
26
 
27
  var $wp_version;
28
 
29
+ var $in_admin;
30
+
31
  function SimplyExclude()
32
  {
33
  global $wp_version;
34
  $this->wp_version = $wp_version;
35
+ $this->in_admin = false;
36
 
37
  $this->_admin_menu_label = "Simply Exclude";
38
  $this->options_key = "simplyexclude";
54
  add_filter('pre_get_posts', array(&$this,'se_filters'));
55
 
56
  add_action('save_post', array(&$this,'save_page_exclude_answer'));
57
+
58
+ add_filter('posts_request', array(&$this,'posts_request_proc'));
59
+ }
60
+
61
+
62
+ function posts_request_proc($request)
63
+ {
64
+ //echo "request=[". $request. "]<br />";
65
+ return $request;
66
  }
67
 
68
  function admin_init_proc()
69
  {
70
+ // Means we are in the wp-admin backend and not running from the front site end.
71
+ $this->in_admin = true;
72
+
73
  if (function_exists('add_meta_box')) {
74
  add_meta_box($this->_options_key, $this->_admin_menu_label, array(&$this,'add_page_exclude_sidebar_dbx'), 'page');
75
  }
228
 
229
  function se_manage_page()
230
  {
231
+ if (isset($_REQUEST['se_admin']))
232
+ $se_admin = $_REQUEST['se_admin'];
233
+ else
234
+ $se_admin['action'] = 'edit_categories';
235
+
236
+ $this->se_display_navigation($se_admin);
237
 
238
  ?>
239
  <div class="wrap">
240
  <?php
241
 
 
 
 
242
  switch ($se_admin['action'])
243
  {
244
  case 'edit_pages':
264
  }
265
 
266
 
267
+ function se_display_navigation($se_admin)
268
  {
 
269
  ?>
270
  <div id="se_admin_nav">
271
  <ul>
272
  <li><a href="?page=<?php
273
  echo $this->options_key ?>&amp;se_admin[action]=edit_categories"
274
+ <?php
275
+ if (($se_admin['action'] == 'edit_categories')
276
+ || ($se_admin['action'] == 'save_categories'))
277
+ echo 'class="current"';
278
+ ?>
279
+ title="Manage Category Exclusions">Manage Categories</a></li>
280
  <?php
281
  if ($this->wp_version >= 2.3)
282
  {
283
  ?>
284
  <li><a href="?page=<?php
285
  echo $this->options_key ?>&amp;se_admin[action]=edit_tags"
286
+ <?php
287
+ if (($se_admin['action'] == 'edit_tags')
288
+ || ($se_admin['action'] == 'save_tags'))
289
+ echo 'class="current"';
290
+ ?>
291
  title="Manage Tag Exclusions">Manage Tags</a></li><?php
292
  }
293
  ?>
294
  <li><a href="?page=<?php
295
  echo $this->options_key ?>&amp;se_admin[action]=edit_pages"
296
+ <?php
297
+ if (($se_admin['action'] == 'edit_pages')
298
+ || ($se_admin['action'] == 'save_pages'))
299
+ echo 'class="current"';
300
+ ?>
301
  title="Manage Page Exclusions">Manage Pages</a></li>
302
  </ul>
303
  </div>
333
  global $wpdb;
334
  if (!$this->categories)
335
  {
336
+ $this->categories = get_categories('hide_empty=0&orderby=name&order=ASC');
 
 
 
337
  }
338
  }
339
 
340
+
341
+ function get_cat_parent_tree_array($cat_id=0, $level=0)
342
+ {
343
+ $cat_info = get_category($cat_id);
344
+
345
+ $parent_array = array();
346
+ $parent_array[$level] = $cat_info;
347
+
348
+ if (intval($cat_info->parent) > 0)
349
+ {
350
+ $cat_array_tmp = $this->get_cat_parent_tree_array($cat_info->parent, $level+1);
351
+ if ($cat_array_tmp)
352
+ $parent_array = array_merge($parent_array, $cat_array_tmp);
353
+ }
354
+ return $parent_array;
355
+ }
356
+
357
+
358
  function se_show_categories_form()
359
  {
360
  $this->se_load_categories();
366
  action="?page=<?php
367
  echo $this->options_key ?>&amp;se_admin[action]=save_categories" method="post">
368
 
369
+ <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
370
  <thead>
371
  <tr>
372
+ <th class="action"><?php _e('Action Name') ?></th>
373
+ <th class="description"><?php _e('Description ') ?></th>
374
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
375
  </tr>
376
  </thead>
377
  <tbody>
381
  $class = ('alternate' == $class) ? '' : 'alternate';
382
  ?>
383
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
384
+ <td class="action"><?php echo $action_val['name'] ?></td>
385
+ <td class="description"><?php echo $action_val['description'] ?></td>
386
+ <td class="inc-excl">
387
  <input type="radio"
388
  name="se_admin[cats][actions][<?php echo $action_key ?>]" value="i"
389
  <?php if ($this->se_cfg['cats']['actions'][$action_key] == 'i')
400
  </tbody>
401
  </table>
402
  <br />
403
+ <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
404
  <thead>
405
  <tr>
406
  <th class="cat-id" scope="col"><?php _e('ID') ?></th>
417
  }
418
  ?>
419
  <tr>
420
+ <td colspan="3">
421
+ <p class="submit">
422
+ <input type="hidden" name="action" value="editcatvis" />
423
+ <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
424
+ </p>
425
  </td>
426
  </tr>
427
  </tbody>
438
 
439
  function se_show_cat_item_row($cat_info, $class)
440
  {
441
+ $cat_parents = $this->get_cat_parent_tree_array($cat_info->cat_ID, 0);
442
+ //echo "cat_parents<pre>"; print_r($cat_parents); echo "</pre>";
443
+ $level_spacer = "";
444
+ foreach($cat_parents as $cat_parent)
445
+ {
446
+ if ($cat_parent->cat_ID == $cat_info->cat_ID)
447
+ continue;
448
+
449
+ $level_spacer .= "&ndash;";
450
+ }
451
+
452
  ?>
453
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
454
  <td class="cat-id"><?php echo $cat_info->cat_ID ?></td>
455
+ <td class="cat-name"><?php echo $level_spacer . $cat_info->cat_name ?></td>
456
  <td class="cat-action"><?php $this->se_display_cat_action_row($cat_info->cat_ID) ?></td>
457
  </tr>
458
  <?php
509
  global $wpdb;
510
  if (!$this->tags)
511
  {
512
+ $this->tags = get_tags('hide_empty=0&orderby=name&order=ASC');
513
  }
514
  }
515
 
525
  action="?page=<?php
526
  echo $this->options_key ?>&amp;se_admin[action]=save_tags" method="post">
527
 
528
+ <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
529
  <thead>
530
  <tr>
531
+ <th class="action"><?php _e('Action Name') ?></th>
532
+ <th class="description"><?php _e('Description ') ?></th>
533
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
534
  </tr>
535
  </thead>
536
  <tbody>
540
  $class = ('alternate' == $class) ? '' : 'alternate';
541
  ?>
542
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
543
+ <td class="action"><?php echo $action_val['name'] ?></td>
544
+ <td class="description"><?php echo $action_val['description'] ?></td>
545
+ <td class="inc-excl">
546
  <input type="radio"
547
  name="se_admin[tags][actions][<?php echo $action_key ?>]" value="i"
548
  <?php if ($this->se_cfg['tags']['actions'][$action_key] == 'i')
559
  </tbody>
560
  </table>
561
  <br />
562
+ <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
563
  <thead>
564
  <tr>
565
  <th class="cat-id" scope="col"><?php _e('ID') ?></th>
576
  }
577
  ?>
578
  <tr>
579
+ <td colspan="3">
580
+ <p class="submit">
581
+ <input type="hidden" name="action" value="editcatvis" />
582
+ <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
583
+ </p>
584
  </td>
585
  </tr>
586
  </tbody>
657
  {
658
  global $wpdb;
659
  if (!$this->pages)
660
+ $this->pages = get_pages();
 
 
 
 
661
  }
662
+
663
+ function get_page_parent_tree_array($page_id=0, $level=0)
664
+ {
665
+ $page_info = get_page($page_id);
666
+
667
+ $parent_array = array();
668
+ $parent_array[$level] = $page_info;
669
+
670
+ if (intval($page_info->post_parent) > 0)
671
+ {
672
+ $page_array_tmp = $this->get_page_parent_tree_array($page_info->post_parent, $level+1);
673
+ if ($page_array_tmp)
674
+ $parent_array = array_merge($parent_array, $page_array_tmp);
675
+ }
676
+ return $parent_array;
677
+ }
678
+
679
+
680
 
681
  function se_show_pages_form()
682
  {
691
  <form name="page_exclusion" id="page_exclusion"
692
  action="?page=<?php
693
  echo $this->options_key ?>&amp;se_admin[action]=save_pages" method="post">
694
+ <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
695
  <thead>
696
  <tr>
697
+ <th class="action"><?php _e('Action Name') ?></th>
698
+ <th class="description"><?php _e('Description ') ?></th>
699
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion Default') ?></th>
700
  </tr>
701
  </thead>
702
  <tbody>
706
  $class = ('alternate' == $class) ? '' : 'alternate';
707
  ?>
708
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
709
+ <td class="action"><?php echo $action_val['name'] ?></td>
710
+ <td class="description"><?php echo $action_val['description'] ?></td>
711
+ <td class="inc-excl">
712
  <input type="radio"
713
  name="se_admin[pages][actions][<?php echo $action_key ?>]" value="i"
714
  <?php if ($this->se_cfg['pages']['actions'][$action_key] == 'i')
728
  <br />
729
 
730
 
731
+ <table class="widefat" width="80%" cellpadding="3" cellspacing="3">
732
  <thead>
733
  <tr>
734
  <th class="page-id" scope="col"><?php _e('ID') ?></th>
745
  }
746
  ?>
747
  <tr>
748
+ <td colspan="3">
749
+ <p class="submit">
750
+ <input type="hidden" name="action" value="editcatvis" />
751
+ <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
752
+ </p>
753
  </td>
754
  </tr>
755
  </tbody>
767
 
768
  function se_show_page_item_row($page_info, $class = '')
769
  {
770
+ $page_parents = $this->get_page_parent_tree_array($page_info->ID, 0);
771
+ $level_spacer = "";
772
+ foreach($page_parents as $page_parent)
773
+ {
774
+ if ($page_parent->ID == $page_info->ID)
775
+ continue;
776
+
777
+ $level_spacer .= "&ndash;";
778
+ }
779
+
780
+
781
  ?>
782
  <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
783
  <td class="page-id"><?php echo $page_info->ID ?></td>
784
+ <td class="page-name"><?php echo $level_spacer. $page_info->post_title ?></td>
785
  <td class="page-action"><?php $this->se_display_page_action_row($page_info->ID) ?></td>
786
  </tr>
787
  <?php
823
  // http://wordpress.org/extend/plugins/search-everything/
824
  function SE4_exclude_posts($where) {
825
  global $wp_query;
826
+
827
+ $action_key = "is_search";
828
+
829
  if ((!empty($wp_query->query_vars['s']))
830
  && (count($this->se_cfg['pages'][$action_key]) > 0))
831
  {
 
832
  $excl_list = $this->get_pages_list(',', $this->se_cfg['pages'][$action_key]);
 
833
  //$excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_posts_list'])));
834
 
835
  $where = str_replace('"', '\'', $where);
847
  global $wp_query;
848
 
849
  if (!empty($wp_query->query_vars['s'])) {
 
850
  $where = str_replace('"', '\'', $where);
851
  if ('true' == $this->options['SE4_approved_pages_only']) {
852
  $where = str_replace('post_type = \'post\' AND ', 'post_password = \'\' AND ', $where);
857
  }
858
  return $where;
859
  }
 
 
860
 
861
  // END CONFIG FUNCTIONS
862
  /////////////////////////////////////////////////////////////////
864
 
865
  function se_filters($query)
866
  {
867
+ if ($this->in_admin == true)
868
+ return;
869
+
870
+ echo "query before<pre>"; print_r($query); echo "</pre>";
871
  if (count($this->default_IsActions['cats']) > 0)
872
  {
873
  foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
924
 
925
  foreach ($this->default_IsActions['pages'] as $action_key => $action_val)
926
  {
 
927
  if ($query->{$action_key})
928
  {
929
  add_filter('posts_where', array(&$this, 'SE4_search_pages'));
simplyexclude_style_admin.css CHANGED
@@ -1,33 +1,69 @@
 
 
 
 
 
 
 
 
 
1
  #se_admin_nav ul li {
2
  display: inline;
3
- text-decoration: none;
4
- padding-right: 4px;
5
  margin: 0px;
6
  }
7
 
8
- form#cat_exclusion table tbody tr td.cat-id,
9
- form#tag_exclusion table tbody tr td.tag-id,
10
- form#page_exclusion table tbody tr td.page-id {
11
- text-align: center;
12
- width: 10%;
13
- padding: 8px 5px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
- form#cat_exclusion table thead tr th.cat-name,
17
- form#cat_exclusion table tbody tr td.cat-name,
18
- form#tag_exclusion table thead tr th.tag-name,
19
- form#tag_exclusion table tbody tr td.tag-name,
20
- form#page_exclusion table thead tr th.page-name,
21
- form#page_exclusion table tbody tr td.page-name {
 
22
  text-align: left;
23
- padding-left: 20px;
24
- width: 40%;
25
  }
26
 
27
- form#cat_exclusion table tbody tr td.cat-action,
28
- form#tag_exclusion table tbody tr td.tag-action,
29
- form#page_exclusion table tbody tr td.page-action {
30
- text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  form#cat_exclusion table tbody tr td.cat-action label,
@@ -40,10 +76,19 @@ form#page_exclusion table tbody tr td.page-action label {
40
  form#cat_exclusion table tbody tr td.cat-action input,
41
  form#tag_exclusion table tbody tr td.tag-action input {
42
  margin-right: 15px;
43
- margin-left: -5px;
44
  }
45
 
46
  form#page_exclusion table tbody tr td.page-action input {
47
  margin-right: 15px;
48
- margin-left: -5px;
49
  }
 
 
 
 
 
 
 
 
 
1
+ #se_admin_nav {
2
+ background-color: #E4F2FD;
3
+ border-bottom-color: #C6D9E9;
4
+ border-bottom-style: solid;
5
+ border-bottom-width: 1px;
6
+ padding: 1px 0;
7
+ margin: 0 0 0 0;
8
+ }
9
+
10
  #se_admin_nav ul li {
11
  display: inline;
12
+ padding: 0px;
 
13
  margin: 0px;
14
  }
15
 
16
+
17
+ #se_admin_nav ul li a {
18
+ text-decoration: none;
19
+ padding: 13px 4px 15px 4px;
20
+ border-style:solid;
21
+ border-width:1px;
22
+ border-color:#E4F2FD #E4F2FD #C6D9E9 #E4F2FD;
23
+ }
24
+
25
+ #se_admin_nav ul li a.current,
26
+ #se_admin_nav ul li a:hover {
27
+ background-color:#FFFFFF;
28
+ border-style:solid;
29
+ border-width:1px;
30
+ border-color:#C6D9E9 #C6D9E9 #FFFFFF #C6D9E9 ;
31
+ color:#D54E21;
32
+ }
33
+
34
+ #se_admin_nav ul li a:hover {
35
+ background-color:#C6D9E9;
36
  }
37
 
38
+
39
+ form#cat_exclusion table tr .action,
40
+ form#cat_exclusion table tr .cat-id,
41
+ form#tag_exclusion table tr .action,
42
+ form#tag_exclusion table tr .tag-id,
43
+ form#page_exclusion table tr .action,
44
+ form#page_exclusion table tr .page-id {
45
  text-align: left;
46
+ width: 5%;
 
47
  }
48
 
49
+ form#cat_exclusion table tr .description,
50
+ form#cat_exclusion table tr .cat-name,
51
+ form#tag_exclusion table tr .description,
52
+ form#tag_exclusion table tr .tag-name,
53
+ form#page_exclusion table tr .description,
54
+ form#page_exclusion table tr .page-name {
55
+ text-align: left;
56
+ width: 45%;
57
+ }
58
+
59
+ form#cat_exclusion table tr .inc-excl,
60
+ form#cat_exclusion table tr .cat-action,
61
+ form#tag_exclusion table tr .inc-excl,
62
+ form#tag_exclusion table tr .tag-action,
63
+ form#page_exclusion table tr .inc-excl,
64
+ form#page_exclusion table tr .page-action {
65
+ text-align: left;
66
+ width: 50%;
67
  }
68
 
69
  form#cat_exclusion table tbody tr td.cat-action label,
76
  form#cat_exclusion table tbody tr td.cat-action input,
77
  form#tag_exclusion table tbody tr td.tag-action input {
78
  margin-right: 15px;
79
+ margin-left: 0px;
80
  }
81
 
82
  form#page_exclusion table tbody tr td.page-action input {
83
  margin-right: 15px;
84
+ margin-left: 0px;
85
  }
86
+
87
+
88
+ form#cat_exclusion .submit,
89
+ form#tag_exclusion .submit,
90
+ form#page_exclusion .submit {
91
+ border-top: 0px solid #CCCCCC;
92
+ margin: 2px 0pt 0pt;
93
+ padding: 0em 0pt 0pt;
94
+ }