Simply Exclude - Version 2.0

Version Description

2012-03-03 Full rewrite of the plugin core code. Replace the growing list of panels and added functionality directly to the Post Type and Taxonomy panels. On both Post Types and Taxonomy panels you will see a new column allowing setting the exclude/include on Search, Archive, Feed and Home.

Download this release

Release Info

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

Code changes from version 1.7.9.2 to 2.0

readme.txt CHANGED
@@ -1,30 +1,27 @@
1
  === Simply Exclude ===
2
  Contributors: Paul Menard
3
- Donate link: http://www.codehooligans.com/donations/
4
- Tags: admin, posts, pages, categories, tags, exclude, include, is_front, is_archive, is_search, is_feed
5
- Requires at least: 2.8
6
- Tested up to: 3.2
7
- Stable tag: 1.7.9.2
8
 
9
  == Description ==
10
 
11
- Provides an interface to selectively exclude/include categories, tags, authors and pages from the 4 actions used by WordPress
12
 
13
  is_front - When the user views the Front page.
14
  is_archive - When the user views an category or tags Archive.
15
  is_search - When the user views a search result page.
16
  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/projects/wordpress/simply-exclude/ "SimplyExclude Plugin for WordPress")
21
 
22
  == Installation ==
23
 
24
  1. Upload the extracted plugin folder and contained files to your `/wp-content/plugins/` directory
25
  2. Activate the plugin through the 'Plugins' menu in WordPress
26
- 3. Navigate to Settings -> Simply Exclude (Options -> Simply Exclude in pre 2.5).
27
- 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.
28
 
29
  == Frequently Asked Questions ==
30
 
@@ -44,38 +41,14 @@ At the time (version 1.6.1) the plugin only effects Pages included in the tradit
44
  == Screenshots ==
45
 
46
  1. Simply Exclude Admin interface showing Category exclusion options.
47
- 2. Page Admin interface allow for exclusion of Page from search.
48
-
49
 
50
  == Changelog ==
51
 
52
- = 1.7.9.2 =
53
-
54
- Very small correction to table row elements which were not properly closed. This seemed to effect FireFox 5.0.1
55
- Thanks for Frank for reporting this issue:
56
- http://www.codehooligans.com/projects/wordpress/simply-exclude/#comment-107073
57
-
58
- = 1.7.9.1 =
59
- More fixes for compatibility issues with WordPress 3.1. Some of these issues reported are:
60
-
61
- * Simply Exclude effects the nav menus with using WP menus. http://wordpress.org/support/topic/plugin-simply-exclude-this-plugin-make-all-my-menus-totally-blank
62
-
63
- * Simple Exclude effect filtering of sidebar widgets OR Filter of sidebar content not effected by Simply Exclude settings.
64
- http://www.codehooligans.com/projects/wordpress/simply-exclude/#comment-82318
65
-
66
- I'm sure there are some other areas still having issues. I'm still working on the code changes but wanted to get these fixes posts some at least some users can start using the plugin again.
67
-
68
- Thanks to all for reporting issues and thank you for your patience in this code matter.
69
-
70
-
71
- = 1.7.9 =
72
- Fixes some small issue which prevented this plugin from working under WordPress 3.1.
73
-
74
- = 1.7.8 =
75
- Fixes: Mainly bug fixes and code cleanup. Patched code based on reported issues with the WP Gallery shortcode and the new WP 3.0 RC1 menus
76
- Additions: Added some logic to Categories and Tags to work with Exclude/Include when using the WordPress Category or Tag Cloud Widgets.
77
-
78
- Coming Soon: Have been working on a new version of Simply Exclude that will dynamically work with the new Taxonomy system. No longer will we be restricted to excluding just categories and tags. But any registered Taxonomy now can be tweaked. This will be a major code rewrite and will be named SE 2.0. Coming this summer!
79
 
80
  = 1.7.7 =
81
  2010-05-12
1
  === Simply Exclude ===
2
  Contributors: Paul Menard
3
+ Donate link: http://www.codehooligans.com
4
+ Tags: admin, posts, pages, categories, tags, Post Type, Taxonomy, exclude, include, is_front, is_archive, is_search, is_feed, is_author
5
+ Requires at least: 3.2
6
+ Tested up to: 3.3.1
7
+ Stable tag: 2.0
8
 
9
  == Description ==
10
 
11
+ Provides an interface to selectively exclude/include Post Types, Taxonomies and Authors 4 actions used by WordPress
12
 
13
  is_front - When the user views the Front page.
14
  is_archive - When the user views an category or tags Archive.
15
  is_search - When the user views a search result page.
16
  is_feed - When a Feed is viewed/requested.
17
 
 
 
18
  [Plugin Homepage](http://www.codehooligans.com/projects/wordpress/simply-exclude/ "SimplyExclude Plugin for WordPress")
19
 
20
  == Installation ==
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 you PostS/Pages/Category/Tags or any Post Type or Taxonomy sections. You will notice a new column allowing setting of the Taxonomy or Post type item in relation to selectively exclude/include the cat/tag/page for the given action is_front/is_archive/is_feed/is_search.
 
25
 
26
  == Frequently Asked Questions ==
27
 
41
  == Screenshots ==
42
 
43
  1. Simply Exclude Admin interface showing Category exclusion options.
44
+ 2. Post listing showing new Simply Exclude options.
45
+ 3. New Help section to answer some of your questions.
46
 
47
  == Changelog ==
48
 
49
+ = 2.0 =
50
+ 2012-03-03
51
+ Full rewrite of the plugin core code. Replace the growing list of panels and added functionality directly to the Post Type and Taxonomy panels. On both Post Types and Taxonomy panels you will see a new column allowing setting the exclude/include on Search, Archive, Feed and Home.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  = 1.7.7 =
54
  2010-05-12
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png ADDED
Binary file
simplyexclude.php CHANGED
@@ -1,1352 +1,1281 @@
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, is_front.
6
  Author: Paul Menard
7
- Version: 1.7.9.2
8
  Author URI: http://www.codehooligans.com
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  */
11
 
12
- class SimplyExclude
 
 
13
  {
14
- var $se_cfg;
15
- var $options_key;
16
- var $default_IsActions;
17
-
18
- var $categories;
19
- var $pages;
20
-
21
- var $wp_version;
22
 
23
- var $in_admin;
 
 
 
 
24
 
25
- var $GA_generatorObject;
26
 
27
- function SimplyExclude()
28
- {
29
  global $wp_version;
30
  $this->wp_version = $wp_version;
31
- $this->in_admin = false;
32
 
33
- $this->admin_menu_label = "Simply Exclude";
34
- $this->options_key = "simplyexclude";
35
-
36
- $this->se_load_config();
37
-
38
- add_action('admin_menu', array(&$this,'admin_init_proc'));
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- // Add our own admin menu
41
- add_action('admin_menu', array(&$this,'se_add_nav'));
 
42
 
43
- if ((isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_categories")
44
- || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_tags")
45
- || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_authors")
46
- || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_pages")
47
- || (isset($_REQUEST['page'])) && ($_REQUEST['page'] == "se_manage_options"))
48
- add_action('admin_head', array(&$this,'se_admin_head'));
 
 
 
49
 
50
- if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'activate')
51
- add_action('init', array(&$this,'se_install'));
 
52
 
53
- // Used to limit the categories displayed on the home page. Simple
54
- //add_filter('pre_get_posts', array(&$this,'se_filters'), 99, 1);
55
- add_action('pre_get_posts', array(&$this,'se_filters'));
56
-
57
- add_action('save_post', array(&$this,'save_page_exclude_answer'));
58
-
59
- //echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
60
- if ((floatval($this->wp_version) >= "2.8.0") && (!is_admin()))
61
- {
62
- if ( (isset($this->se_cfg['cats']['extra']['wp_list_categories']))
63
- && ($this->se_cfg['cats']['extra']['wp_list_categories'] == 'Yes') )
64
- {
65
- add_filter('widget_categories_dropdown_args', array(&$this,'se_categories_dropdown_args_proc'));
66
- add_filter('widget_categories_args', array(&$this,'se_categories_dropdown_args_proc'));
67
- }
68
 
69
- if ( (isset($this->se_cfg['tags']['extra']['wp_tag_cloud']))
70
- && ($this->se_cfg['tags']['extra']['wp_tag_cloud'] == 'Yes'))
71
- {
72
- add_filter('widget_tag_cloud_args', array(&$this,'se_widget_tag_cloud_args_proc'));
73
- }
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
 
 
 
 
 
76
 
77
- function posts_request_proc($request)
78
- {
79
- //echo "request=[". $request. "]<br />";
80
- return $request;
81
  }
82
-
83
- function admin_init_proc()
84
  {
85
- // Means we are in the wp-admin backend and not running from the front site end.
86
- $this->in_admin = true;
87
-
88
- if (function_exists('add_meta_box')) {
89
- add_meta_box($this->options_key, $this->admin_menu_label,
90
- array(&$this,'add_page_exclude_sidebar_dbx'), 'page');
91
- }
92
- else {
93
- add_filter('dbx_page_sidebar', array(&$this,'add_page_exclude_sidebar_dbx'));
 
 
 
 
94
  }
95
  }
 
 
 
 
 
 
96
 
 
 
 
 
97
 
98
- function se_load_config()
99
- {
100
- // This is the pre-defined WordPress is_* actions.
101
- $this->default_IsActions = array();
102
-
103
- // Define the actions allow on Post Categories
104
- $this->default_IsActions['cats'] = array();
105
- $this->default_IsActions['cats']['is_home']['name']
106
- = "Front";
107
- $this->default_IsActions['cats']['is_home']['description']
108
- = "Visibility on the front/main page.";
109
- $this->default_IsActions['cats']['is_home']['action']
110
- = "i";
111
-
112
- $this->default_IsActions['cats']['is_archive']['name']
113
- = "Archive";
114
- $this->default_IsActions['cats']['is_archive']['description']
115
- = "Visibility on the archive of categories on the sidebar";
116
- $this->default_IsActions['cats']['is_archive']['action']
117
- = "e";
118
-
119
- $this->default_IsActions['cats']['is_search']['name']
120
- = "Search";
121
- $this->default_IsActions['cats']['is_search']['description']
122
- = "Visibility in search results.";
123
- $this->default_IsActions['cats']['is_search']['action']
124
- = "e";
125
-
126
- $this->default_IsActions['cats']['is_feed']['name']
127
- = "Feed";
128
- $this->default_IsActions['cats']['is_feed']['description']
129
- = "Visibility in RSS/RSS2/Atom feeds.";
130
- $this->default_IsActions['cats']['is_feed']['action']
131
- = "e";
132
-
133
- $this->default_IsActions['cats']['is_archive']['name']
134
- = "Archive";
135
- $this->default_IsActions['cats']['is_archive']['description']
136
- = "Visibility in archive links (i.e., calendar links).";
137
- $this->default_IsActions['cats']['is_archive']['action'] = "e";
138
 
 
 
 
 
139
 
140
- // Tag Definitions
141
- $this->default_IsActions['tags'] = array();
142
- $this->default_IsActions['tags']['is_home']['name']
143
- = "Front";
144
- $this->default_IsActions['tags']['is_home']['description']
145
- = "Visibility on the front/main page.";
146
- $this->default_IsActions['tags']['is_home']['action']
147
- = "i";
148
-
149
- $this->default_IsActions['tags']['is_archive']['name']
150
- = "Archive";
151
- $this->default_IsActions['tags']['is_archive']['description']
152
- = "Visibility on the archive of tags on the sidebar";
153
- $this->default_IsActions['tags']['is_archive']['action']
154
- = "e";
155
-
156
- $this->default_IsActions['tags']['is_search']['name']
157
- = "Search";
158
- $this->default_IsActions['tags']['is_search']['description']
159
- = "Visibility in search results.";
160
- $this->default_IsActions['tags']['is_search']['action']
161
- = "e";
162
-
163
- $this->default_IsActions['tags']['is_feed']['name']
164
- = "Feed";
165
- $this->default_IsActions['tags']['is_feed']['description']
166
- = "Visibility in RSS/RSS2/Atom feeds.";
167
- $this->default_IsActions['tags']['is_feed']['action']
168
- = "e";
169
-
170
- $this->default_IsActions['tags']['is_archive']['name']
171
- = "Archive";
172
- $this->default_IsActions['tags']['is_archive']['description']
173
- = "Visibility in archive links (i.e., calendar links).";
174
- $this->default_IsActions['tags']['is_archive']['action'] = "e";
175
-
176
- // Authors
177
- $this->default_IsActions['authors'] = array();
178
- $this->default_IsActions['authors']['is_home']['name']
179
- = "Front";
180
- $this->default_IsActions['authors']['is_home']['description']
181
- = "Visibility on the front/main page.";
182
- $this->default_IsActions['authors']['is_home']['action']
183
- = "i";
184
-
185
- $this->default_IsActions['authors']['is_archive']['name']
186
- = "Archive";
187
- $this->default_IsActions['authors']['is_archive']['description']
188
- = "Visibility on the archive of categories on the sidebar";
189
- $this->default_IsActions['authors']['is_archive']['action']
190
- = "e";
191
-
192
- $this->default_IsActions['authors']['is_search']['name']
193
- = "Search";
194
- $this->default_IsActions['authors']['is_search']['description']
195
- = "Visibility in search results.";
196
- $this->default_IsActions['authors']['is_search']['action']
197
- = "e";
198
-
199
- $this->default_IsActions['authors']['is_feed']['name']
200
- = "Feed";
201
- $this->default_IsActions['authors']['is_feed']['description']
202
- = "Visibility in RSS/RSS2/Atom feeds.";
203
- $this->default_IsActions['authors']['is_feed']['action']
204
- = "e";
205
-
206
- $this->default_IsActions['authors']['is_archive']['name']
207
- = "Archive";
208
- $this->default_IsActions['authors']['is_archive']['description']
209
- = "Visibility in archive links (i.e., calendar links).";
210
- $this->default_IsActions['authors']['is_archive']['action'] = "e";
211
-
212
- // Pages Definitions
213
- $this->default_IsActions['pages'] = array();
214
- $this->default_IsActions['pages']['is_search']['name'] = "Search";
215
- $this->default_IsActions['pages']['is_search']['description'] = "Visibility in search results.";
216
- $this->default_IsActions['pages']['is_search']['action'] = "e";
217
 
218
- $this->se_cfg['cfg']['page_name'] = "simplyexclude";
 
219
 
220
- $tmp_se_cfg = get_option($this->options_key);
221
- if ($tmp_se_cfg)
222
- {
223
- //if (!is_array($tmp_se_cfg))
224
- // $this->se_cfg = unserialize($tmp_se_cfg);
225
-
226
- // something new in WP 2.6.
227
- // It might decide to unseralize the option data for you! Fuckers!!
228
- // So check the return.
229
- if (is_serialized($tmp_se_cfg))
230
- $this->se_cfg = unserialize($tmp_se_cfg);
231
- else
232
- $this->se_cfg = $tmp_se_cfg;
233
- }
234
- // echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
235
-
236
- $plugindir_node = dirname(plugin_basename(__FILE__));
237
- $plugindir_url = get_bloginfo('wpurl') . "/wp-content/plugins/". $plugindir_node;
238
- $this->se_cfg['cfg']['myurl'] = $plugindir_url;
239
-
240
- if (!isset($this->se_cfg['cats']['actions']))
241
- {
242
- foreach($this->default_IsActions['cats'] as $cat_key => $cat_action)
243
- {
244
- $this->se_cfg['cats']['actions'][$cat_key] = $cat_action['action'];
245
- }
246
- }
247
-
248
- if (!isset($this->se_cfg['tags']['actions']))
249
  {
250
- foreach($this->default_IsActions['tags'] as $tag_key => $tag_action)
251
  {
252
- $this->se_cfg['tags']['actions'][$tag_key] = $tag_action['action'];
 
 
 
 
 
253
  }
 
254
  }
255
 
256
- if (!isset($this->se_cfg['authors']['actions']))
 
 
257
  {
258
- foreach($this->default_IsActions['authors'] as $author_key => $author_action)
259
  {
260
- $this->se_cfg['authors']['actions'][$author_key] = $author_action['action'];
 
 
 
 
 
 
 
 
261
  }
262
  }
263
 
264
- if (!isset($this->se_cfg['pages']['actions']))
 
 
265
  {
266
- foreach($this->default_IsActions['pages'] as $page_key => $page_action)
267
- {
268
- $this->se_cfg['pages']['actions'][$page_key] = $page_action['action'];
269
- }
270
  }
 
 
 
 
 
 
 
 
271
 
 
 
 
272
 
273
- if (!isset($this->se_cfg['options']))
274
- {
275
- $this->se_cfg['options'] = array();
276
-
277
- $this->se_cfg['options']['google-sitemap-generator'] = array();
278
- $this->se_cfg['options']['google-sitemap-generator']['name'] = "Google XML Sitemaps";
279
- $this->se_cfg['options']['google-sitemap-generator']['url'] = "http://wordpress.org/extend/plugins/google-sitemap-generator/";
280
- $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";
281
- $this->se_cfg['options']['google-sitemap-generator']['version'] = "3.1.6";
282
- $this->se_cfg['options']['google-sitemap-generator']['status'] = false;
283
- $this->se_cfg['options']['google-sitemap-generator']['active'] = true;
284
-
285
- $this->se_cfg['options']['google-sitemap-generator']['actions'] = array();
286
- $this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['desc'] = "Update Excluded Pages";
287
- $this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update'] = false;
288
- $this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['desc'] = "Update Excluded Categories";
289
- $this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update'] = false;
290
-
291
 
292
- $this->se_cfg['options']['search-unleashed'] = array();
293
- $this->se_cfg['options']['search-unleashed']['name'] = "Search Unleashed";
294
- $this->se_cfg['options']['search-unleashed']['url'] = "http://wordpress.org/extend/plugins/search-unleashed/";
295
- $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";
296
- $this->se_cfg['options']['search-unleashed']['version'] = "1.0.5";
297
- $this->se_cfg['options']['search-unleashed']['status'] = false;
298
- $this->se_cfg['options']['search-unleashed']['active'] = true;
299
-
300
- $this->se_cfg['options']['search-unleashed']['actions'] = array();
301
- $this->se_cfg['options']['search-unleashed']['actions']['pages']['desc'] = "Update Excluded Pages";
302
- $this->se_cfg['options']['search-unleashed']['actions']['pages']['update'] = false;
303
- $this->se_cfg['options']['search-unleashed']['actions']['categories']['desc'] = "Update Excluded Categories";
304
- $this->se_cfg['options']['search-unleashed']['actions']['categories']['update'] = false;
305
- }
306
- $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";
307
- $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";
308
 
309
- asort($this->se_cfg['options']);
310
- }
 
311
 
312
- function se_save_config()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  {
314
- $ret = update_option($this->options_key, serialize($this->se_cfg));
 
 
 
 
 
 
 
 
 
 
315
  }
316
 
 
 
 
 
 
317
 
318
- function se_add_nav()
319
  {
320
- // Add a new menu under Manage:
321
- //add_options_page('Simply Exclude', 'Simply Exclude', 8,
322
- // $this->options_key, array(&$this, 'se_manage_page'));
323
-
324
- add_menu_page( 'Simply Exclude', 'Simply Exclude', 'manage_options',
325
- 'se_manage_categories', array(&$this, 'se_manage_categories'));
326
 
327
- add_submenu_page( 'se_manage_categories', 'Exclude Categories', 'Exclude Categories', 'manage_options',
328
- 'se_manage_categories', array(&$this, 'se_manage_categories'));
329
 
330
- add_submenu_page( 'se_manage_categories', 'Exclude Tags', 'Exclude Tags', 'manage_options',
331
- 'se_manage_tags', array(&$this, 'se_manage_tags'));
 
 
 
 
 
 
 
 
 
 
332
 
333
- add_submenu_page( 'se_manage_categories', 'Exclude Authors', 'Exclude Authors', 'manage_options',
334
- 'se_manage_authors', array(&$this, 'se_manage_authors'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
 
336
- add_submenu_page( 'se_manage_categories', 'Exclude Pages', 'Exclude Pages', 'manage_options',
337
- 'se_manage_pages', array(&$this, 'se_manage_pages'));
338
 
339
- add_submenu_page( 'se_manage_categories', 'Exclude Options', 'Exclude Options', 'manage_options',
340
- 'se_manage_options', array(&$this, 'se_manage_options'));
 
 
 
 
 
 
 
 
 
 
 
341
 
342
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
 
344
- function se_admin_head()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  {
 
 
 
 
 
 
346
  ?>
347
- <link rel="stylesheet" href="<?php echo $this->se_cfg['cfg']['myurl'] ?>/simplyexclude_style_admin.css"
348
- type="text/css" media="screen" />
349
- <?php
350
- if ($this->wp_version >= 2.7)
 
 
 
 
 
 
 
 
 
351
  {
 
352
  ?>
353
- <link rel="stylesheet" href="<?php echo $this->se_cfg['cfg']['myurl'] ?>/simplyexclude_style_admin_27.css"
354
- type="text/css" media="screen" />
 
 
 
 
 
 
 
 
355
  <?php
356
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  }
358
 
359
- function se_install()
360
  {
361
- add_option($this->options_key,
362
- serialize($this->se_cfg));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  }
364
-
365
- function se_manage_page()
366
  {
367
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
368
-
369
- if (isset($_REQUEST['se_admin']))
370
- {
371
- $se_admin = $_REQUEST['se_admin'];
372
- $se_admin['action'] = $_GET['se_admin']['action'];
373
- }
374
- else
375
- $se_admin['action'] = 'edit_categories';
376
 
377
- $this->se_display_navigation($se_admin);
 
378
 
 
 
 
379
  ?>
380
- <div class="wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
 
383
- switch ($se_admin['action'])
384
- {
385
- case 'edit_pages':
386
- case 'save_pages':
387
- $this->se_display_pages_panel($se_admin);
388
- break;
389
-
390
- case 'edit_tags':
391
- case 'save_tags':
392
- $this->se_display_tags_panel($se_admin);
393
- break;
394
-
395
- case 'edit_authors':
396
- case 'save_authors':
397
- $this->se_display_authors_panel($se_admin);
398
- break;
399
-
400
- default:
401
- case 'edit_categories':
402
- case 'save_categories':
403
- $this->se_display_categories_panel($se_admin);
404
- break;
405
- }
406
  ?>
407
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  <?php
409
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
 
411
- function se_manage_categories()
 
 
 
 
 
 
412
  {
413
- ?><div class="wrap"><?php
414
- if (isset($_REQUEST['se_admin']))
415
- {
416
- // echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
417
- $se_admin = $_REQUEST['se_admin'];
418
- //$se_admin['action'] = $_GET['se_admin']['action'];
419
- $this->se_display_categories_panel($se_admin);
420
- }
421
- else
422
- $this->se_display_categories_panel();
423
- ?></div><?php
424
  }
425
 
426
- function se_manage_tags()
427
  {
428
- ?><div class="wrap"><?php
429
- if (isset($_REQUEST['se_admin']))
430
- {
431
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
432
- $se_admin = $_REQUEST['se_admin'];
433
- //$se_admin['action'] = $_GET['se_admin']['action'];
434
- $this->se_display_tags_panel($se_admin);
435
- }
436
- else
437
- $this->se_display_tags_panel();
 
438
 
439
- ?></div><?php
440
  }
441
 
442
- function se_manage_authors()
 
 
 
 
 
 
 
443
  {
444
- ?><div class="wrap"><?php
445
- if (isset($_REQUEST['se_admin']))
 
446
  {
447
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
448
- $se_admin = $_REQUEST['se_admin'];
449
- //$se_admin['action'] = $_GET['se_admin']['action'];
450
- $this->se_display_authors_panel($se_admin);
 
 
 
 
 
451
  }
452
- else
453
- $this->se_display_authors_panel();
454
- ?></div><?php
455
  }
456
-
457
- function se_manage_pages()
458
  {
459
- ?><div class="wrap"><?php
460
- if (isset($_REQUEST['se_admin']))
 
461
  {
462
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
463
- $se_admin = $_REQUEST['se_admin'];
464
- //$se_admin['action'] = $_GET['se_admin']['action'];
465
- $this->se_display_pages_panel($se_admin);
 
 
 
 
 
 
466
  }
467
- else
468
- $this->se_display_pages_panel();
469
- ?></div><?php
470
  }
471
 
472
- function se_manage_options()
473
- {
474
- ?><div class="wrap"><?php
475
- if (isset($_REQUEST['se_admin']))
476
  {
477
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
478
- $se_admin = $_REQUEST['se_admin'];
479
- //$se_admin['action'] = $_REQUEST['se_admin']['action'];
480
- $this->se_display_options_panel($se_admin);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  }
482
- else
483
- $this->se_display_options_panel();
484
- ?></div><?php
485
-
486
  }
487
 
488
 
489
- function se_display_navigation($se_admin)
 
 
 
 
 
 
490
  {
491
- ?>
492
- <div id="se_admin_nav">
493
- <ul>
494
- <li><a href="?page=<?php
495
- echo $this->options_key ?>&amp;se_admin[action]=edit_categories"
 
 
 
 
 
 
496
  <?php
497
- if (($se_admin['action'] == 'edit_categories')
498
- || ($se_admin['action'] == 'save_categories'))
499
- echo 'class="current"';
500
- ?>
501
- title="Manage Category Exclusions">Manage Categories</a></li>
 
502
  <?php
503
- if ($this->wp_version >= 2.3)
504
- {
505
- ?>
506
- <li><a href="?page=<?php
507
- echo $this->options_key ?>&amp;se_admin[action]=edit_tags"
508
- <?php
509
- if (($se_admin['action'] == 'edit_tags')
510
- || ($se_admin['action'] == 'save_tags'))
511
- echo 'class="current"';
512
- ?>
513
- title="Manage Tag Exclusions">Manage Tags</a></li><?php
514
- }
515
- ?>
516
- <li><a href="?page=<?php
517
- echo $this->options_key ?>&amp;se_admin[action]=edit_authors"
518
- <?php
519
- if (($se_admin['action'] == 'edit_authors')
520
- || ($se_admin['action'] == 'save_authors'))
521
- echo 'class="current"';
522
- ?>
523
- title="Manage Author Exclusions">Manage Authors</a></li>
524
-
525
- <li><a href="?page=<?php
526
- echo $this->options_key ?>&amp;se_admin[action]=edit_pages"
527
- <?php
528
- if (($se_admin['action'] == 'edit_pages')
529
- || ($se_admin['action'] == 'save_pages'))
530
- echo 'class="current"';
531
- ?>
532
- title="Manage Page Exclusions">Manage Pages</a></li>
533
- </ul>
534
- </div>
535
- <?php
536
- }
537
-
538
- // CATEGORY FUNCTIONS
539
- /////////////////////////////////////////////////////////////////
540
- function se_display_categories_panel($se_admin='')
541
- {
542
- //$this->se_check_google_xml_sitemap_exclude_cats();
543
- //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
544
- ?>
545
-
546
- <h2>Manage Category Exclusions</h2>
547
- <?php
548
- if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_categories"))
549
- {
550
- $this->se_update_google_xml_sitemap_exclude_cats();
551
- $this->se_update_search_unleashed_exclude_cats();
552
-
553
- //echo "se_admin<pre>"; print_r($se_admin); echo "</pre>";
554
- if (isset($se_admin['cats']))
555
- $this->se_cfg['cats'] = $se_admin['cats'];
556
- else
557
- unset($this->se_cfg['cats']);
558
-
559
- $this->se_save_config();
560
- ?>
561
- <div class="updated">
562
- <p>Category Exclusions successfully updated.</p>
563
- </div>
564
- <?php
565
  }
566
- $this->se_show_categories_form();
567
  }
568
 
569
- function se_load_categories()
570
- {
571
- global $wpdb;
572
- if (!$this->categories)
573
- {
574
- $this->categories = get_categories('hide_empty=0&orderby=name&order=ASC');
575
- }
576
- }
577
-
578
-
579
- function get_cat_parent_tree_array($cat_id=0, $level=0)
580
  {
581
- $cat_info = get_category($cat_id);
582
-
583
- $parent_array = array();
584
- $parent_array[$level] = $cat_info;
585
 
586
- if (intval($cat_info->parent) > 0)
587
  {
588
- $cat_array_tmp = $this->get_cat_parent_tree_array($cat_info->parent, $level+1);
589
- if ($cat_array_tmp)
590
- $parent_array = array_merge($parent_array, $cat_array_tmp);
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  }
592
- return $parent_array;
593
  }
594
 
595
-
596
- function se_show_categories_form()
597
  {
598
- $this->se_load_categories();
599
- if ($this->categories)
 
 
 
600
  {
601
- $this->display_instructions('cats');
602
- ?>
603
- <form name="cat_exclusion" id="cat_exclusion"
604
- action="?page=se_manage_categories&amp;se_admin[action]=save_categories" method="post">
605
- <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
606
- <thead>
607
- <tr>
608
- <th class="action"><?php _e('Action Name') ?></th>
609
- <th class="description"><?php _e('Description ') ?></th>
610
- <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
611
- </tr>
612
- </thead>
613
- <tbody>
614
- <?php
615
- $class = "";
616
- foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
617
- {
618
- $class = ('alternate' == $class) ? '' : 'alternate';
619
- ?>
620
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
621
- <td class="action"><?php echo $action_val['name'] ?></td>
622
- <td class="description"><?php echo $action_val['description'] ?></td>
623
- <td class="inc-excl">
624
- <input type="radio"
625
- name="se_admin[cats][actions][<?php echo $action_key ?>]" value="i"
626
- <?php if ((isset($this->se_cfg['cats']['actions'][$action_key]))
627
- && ($this->se_cfg['cats']['actions'][$action_key] == 'i'))
628
- echo "checked='checked'"; ?> /> Include only<br />
629
- <input type="radio"
630
- name="se_admin[cats][actions][<?php echo $action_key ?>]" value="e"
631
- <?php if ((isset($this->se_cfg['cats']['actions'][$action_key]))
632
- && ($this->se_cfg['cats']['actions'][$action_key] == 'e'))
633
- echo "checked='checked'"; ?> /> Exclude
634
- </td>
635
- </tr>
636
  <?php
637
- }
638
 
639
- $class = ('alternate' == $class) ? '' : 'alternate';
 
 
 
 
640
 
641
- if (!isset($this->se_cfg['cats']['extra']['wp_list_categories']))
642
- $this->se_cfg['cats']['extra']['wp_list_categories'] = 'No';
643
- ?>
644
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
645
- <td class="action">Widget</td>
646
- <td class="description">Exclude from WordPress List Category Widget<br />Any categories set as part of the 'Archive' acton for Include/Exclude will be Included/Excluded via the WordPress List Categories Widget output</td>
647
- <td class="inc-excl">
648
- <input type="radio" name="se_admin[cats][extra][wp_list_categories]" value="Yes"
649
- <?php if ((isset($this->se_cfg['cats']['extra']['wp_list_categories']))
650
- && ($this->se_cfg['cats']['extra']['wp_list_categories'] == 'Yes'))
651
- echo "checked='checked'"; ?> /> Yes<br />
652
- <input type="radio" name="se_admin[cats][extra][wp_list_categories]" value="No"
653
- <?php if ((isset($this->se_cfg['cats']['extra']['wp_list_categories']))
654
- && ($this->se_cfg['cats']['extra']['wp_list_categories'] == 'No'))
655
- echo "checked='checked'"; ?> /> No
656
- </td>
657
- </tr>
658
- </tbody>
659
- </table>
660
- <br />
661
-
662
- <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
663
- <thead>
664
- <tr>
665
- <th class="cat-id" scope="col"><?php _e('ID') ?></th>
666
- <th class="cat-name" scope="col"><?php _e('Category Name') ?></th>
667
- <th class="cat-action" scope="col"><?php _e('Exclude from...') ?></th>
668
- </tr>
669
- </thead>
670
- <tbody>
671
  <?php
672
- $class="";
673
- foreach($this->categories as $cat_info)
674
- {
675
- $class = ('alternate' == $class) ? '' : 'alternate';
676
- $this->se_show_cat_item_row($cat_info, $class);
677
- }
678
- ?>
679
- <tr>
680
- <td colspan="3">
681
- <p class="submit">
682
- <input type="hidden" name="se_admin[action]" value="save_categories" />
683
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
684
- </p>
685
- </td>
686
- </tr>
687
- </tbody>
688
- </table>
689
- </form>
690
- <?php
691
- }
692
- else
693
- {
694
- ?><p>You don't have any Categories defined.</p><?php
695
  }
696
  }
697
 
698
- function se_show_cat_item_row($cat_info, $class)
 
 
 
 
 
 
 
 
699
  {
700
- $cat_parents = $this->get_cat_parent_tree_array($cat_info->cat_ID, 0);
701
- $level_spacer = "";
702
- foreach($cat_parents as $cat_parent)
703
- {
704
- if ($cat_parent->cat_ID == $cat_info->cat_ID)
705
- continue;
706
-
707
- $level_spacer .= "&ndash;";
708
- }
709
-
710
  ?>
711
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
712
- <td class="cat-id"><?php echo $cat_info->cat_ID ?></td>
713
- <td class="cat-name"><?php echo $level_spacer . $cat_info->cat_name ?></td>
714
- <td class="cat-action"><?php $this->se_display_cat_action_row($cat_info->cat_ID) ?></td>
715
  </tr>
 
 
716
  <?php
 
717
  }
718
 
719
- function se_display_cat_action_row($cat_id)
720
  {
721
- foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
 
 
 
 
 
 
 
 
722
  {
723
- ?>
724
- <label for="cats-<?php echo $action_key ?>-<?php echo $cat_id ?>">
725
- <?php echo $action_val['name'] ?></label>&nbsp;
726
- <input type="checkbox"
727
- name="se_admin[cats][<?php echo $action_key ?>][<?php echo $cat_id ?>]"
728
- id="cats-<?php echo $action_key ?>-<?php echo $cat_id ?>"
729
- <?php
730
-
731
- if ((isset($this->se_cfg['cats'][$action_key][$cat_id])) && ($this->se_cfg['cats'][$action_key][$cat_id] == "on"))
732
- echo "checked='checked' ";
733
- ?> />
734
- <?php
735
  }
736
- }
737
-
738
- // END CONFIG FUNCTIONS
739
- /////////////////////////////////////////////////////////////////
740
 
741
-
742
- // TAG FUNCTIONS
743
- /////////////////////////////////////////////////////////////////
744
- function se_display_tags_panel($se_admin='')
745
- {
746
- ?>
747
- <h2>Manage Tag Exclusions</h2>
748
- <?php
749
- if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_tags"))
750
  {
751
- if (isset($se_admin['tags']))
752
- $this->se_cfg['tags'] = $se_admin['tags'];
753
- else
754
- unset($this->se_cfg['tags']);
755
-
756
- $this->se_save_config();
757
- ?>
758
- <div class="updated">
759
- <p>Tag Exclusions successfully updated.</p>
760
- </div>
761
- <?php
 
 
 
 
 
762
  }
763
- $this->se_show_tags_form();
764
  }
 
 
765
 
766
- function se_load_tags()
 
 
 
 
 
 
 
767
  {
768
- global $wpdb;
769
- if (!isset($this->tags))
 
770
  {
771
- $this->tags = get_tags('hide_empty=0&orderby=name&order=ASC');
 
772
  }
773
  }
774
-
775
-
776
- function se_show_tags_form()
777
  {
778
- $this->se_load_tags();
779
- if ($this->tags)
 
 
 
 
 
 
 
 
 
 
780
  {
781
- $this->display_instructions('tags');
782
- ?>
783
- <form name="tag_exclusion" id="tag_exclusion"
784
- action="?page=se_manage_tags&amp;se_admin[action]=save_tags" method="post">
785
-
786
- <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
787
- <thead>
788
- <tr>
789
- <th class="action"><?php _e('Action Name') ?></th>
790
- <th class="description"><?php _e('Description ') ?></th>
791
- <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
792
- </tr>
793
- </thead>
794
- <tbody>
795
- <?php
796
- $class="";
797
- foreach ($this->default_IsActions['tags'] as $action_key => $action_val)
798
  {
799
- $class = ('alternate' == $class) ? '' : 'alternate';
800
- ?>
801
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
802
- <td class="action"><?php echo $action_val['name'] ?></td>
803
- <td class="description"><?php echo $action_val['description'] ?></td>
804
- <td class="inc-excl">
805
- <input type="radio"
806
- name="se_admin[tags][actions][<?php echo $action_key ?>]" value="i"
807
- <?php if ($this->se_cfg['tags']['actions'][$action_key] == 'i')
808
- echo "checked='checked'"; ?> /> Include only<br />
809
- <input type="radio"
810
- name="se_admin[tags][actions][<?php echo $action_key ?>]" value="e"
811
- <?php if ($this->se_cfg['tags']['actions'][$action_key] == 'e')
812
- echo "checked='checked'"; ?> /> Exclude
813
- </td>
814
- </tr>
815
- <?php
816
  }
817
- $class = ('alternate' == $class) ? '' : 'alternate';
818
-
819
- if (!isset($this->se_cfg['tags']['extra']['wp_tag_cloud']))
820
- $this->se_cfg['tags']['extra']['wp_tag_cloud'] = 'No';
821
- ?>
822
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
823
- <td class="action">Widget</td>
824
- <td class="description">Exclude from WordPress Tag Cloud Widget<br />Any tags set as part of the 'Archive' acton for Include/Exclude will be Included/Excluded via the WordPress Tag Cloud Widget output</td>
825
- <td class="inc-excl">
826
- <input type="radio" name="se_admin[tags][extra][wp_tag_cloud]" value="Yes"
827
- <?php if ((isset($this->se_cfg['tags']['extra']['wp_tag_cloud']))
828
- && ($this->se_cfg['tags']['extra']['wp_tag_cloud'] == 'Yes'))
829
- echo "checked='checked'"; ?> /> Yes<br />
830
- <input type="radio" name="se_admin[tags][extra][wp_tag_cloud]" value="No"
831
- <?php if ((isset($this->se_cfg['tags']['extra']['wp_tag_cloud']))
832
- && ($this->se_cfg['tags']['extra']['wp_tag_cloud'] == 'No'))
833
- echo "checked='checked'"; ?> /> No
834
- </td>
835
- </tr>
836
 
837
- </tbody>
838
- </table>
839
- <br />
840
- <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
841
- <thead>
842
- <tr>
843
- <th class="cat-id" scope="col"><?php _e('ID') ?></th>
844
- <th class="cat-name" scope="col"><?php _e('Tag Name') ?></th>
845
- <th class="cat-action" scope="col"><?php _e('Exclude from...') ?></th>
846
- </tr>
847
- </thead>
848
- <tbody>
849
- <?php
850
- foreach($this->tags as $tag_info)
851
- {
852
- $class = ('alternate' == $class) ? '' : 'alternate';
853
- $this->se_show_tag_item_row($tag_info, $class);
854
  }
855
- ?>
856
- <tr>
857
- <td colspan="3">
858
- <p class="submit">
859
- <input type="hidden" name="se_admin[action]" value="save_tags" />
860
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
861
- </p>
862
- </td>
863
- </tr>
864
- </tbody>
865
- </table>
866
- </form>
867
- <?php
868
- }
869
- else
870
- {
871
- ?><p>You don't have any Tags defined.</p><?php
872
  }
 
873
  }
874
-
875
- function se_show_tag_item_row($tag_info, $class)
 
 
 
 
 
 
 
 
 
 
876
  {
 
 
 
 
 
 
 
 
 
 
877
  ?>
878
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
879
- <td class="tag-id"><?php echo $tag_info->term_id ?></td>
880
- <td class="tag-name"><?php echo $tag_info->name ?></td>
881
- <td class="tag-action"><?php $this->se_display_tag_action_row($tag_info->term_id) ?></td>
882
  </tr>
883
  <?php
884
  }
885
-
886
- function se_display_tag_action_row($tag_id)
887
  {
888
- foreach ($this->default_IsActions['tags'] as $action_key => $action_val)
 
 
889
  {
890
- ?>
891
- <label for="tags-<?php echo $action_key ?>-<?php echo $tag_id ?>">
892
- <?php echo $action_val['name'] ?></label>&nbsp;
893
- <input type="checkbox"
894
- name="se_admin[tags][<?php echo $action_key ?>][<?php echo $tag_id ?>]"
895
- id="tags-<?php echo $action_key ?>-<?php echo $tag_id ?>"
896
- <?php
897
- if ((isset($this->se_cfg['tags'][$action_key][$tag_id])) && ($this->se_cfg['tags'][$action_key][$tag_id] == "on"))
898
- echo "checked='checked' ";
899
- ?> />
900
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901
  }
902
  }
903
-
904
 
905
- // END CONFIG FUNCTIONS
906
- /////////////////////////////////////////////////////////////////
907
 
 
 
 
 
 
908
 
909
- // AUTHOR FUNCTIONS
910
- /////////////////////////////////////////////////////////////////
911
- function se_display_authors_panel($se_admin='')
912
- {
913
- ?>
914
- <h2>Manage Author Exclusions</h2>
915
- <?php
916
- if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_authors"))
917
  {
918
- if (isset($se_admin['authors']))
919
- $this->se_cfg['authors'] = $se_admin['authors'];
 
 
920
  else
921
- unset($this->se_cfg['authors']);
922
 
923
- $this->se_save_config();
924
- ?>
925
- <div class="updated">
926
- <p>Author Exclusions successfully updated.</p>
927
- </div>
928
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  }
930
- $this->se_show_authors_form();
931
- }
 
 
 
 
932
 
933
- function se_load_authors()
934
- {
935
- global $wpdb;
936
- if (!isset($this->authors))
 
 
937
  {
938
- $this->authors = get_users_of_blog();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  }
940
- }
941
-
942
- function se_show_authors_form()
943
- {
944
- $this->se_load_authors();
945
- if ($this->authors)
946
  {
947
- $this->display_instructions('authors');
948
- ?>
949
- <form name="author_exclusion" id="author_exclusion"
950
- action="?page=se_manage_authors&amp;se_admin[action]=save_authors" method="post">
951
-
952
- <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
953
- <thead>
954
- <tr>
955
- <th class="action"><?php _e('Action Name') ?></th>
956
- <th class="description"><?php _e('Description ') ?></th>
957
- <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
958
- </tr>
959
- </thead>
960
- <tbody>
961
- <?php
962
- $class="";
963
- foreach ($this->default_IsActions['authors'] as $action_key => $action_val)
964
  {
965
- $class = ('alternate' == $class) ? '' : 'alternate';
966
- ?>
967
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
968
- <td class="action"><?php echo $action_val['name'] ?></td>
969
- <td class="description"><?php echo $action_val['description'] ?></td>
970
- <td class="inc-excl">
971
- <input type="radio"
972
- name="se_admin[authors][actions][<?php echo $action_key ?>]" value="i"
973
- <?php if ($this->se_cfg['authors']['actions'][$action_key] == 'i')
974
- echo "checked='checked'"; ?> /> Include only<br />
975
- <input type="radio"
976
- name="se_admin[authors][actions][<?php echo $action_key ?>]" value="e"
977
- <?php if ($this->se_cfg['authors']['actions'][$action_key] == 'e')
978
- echo "checked='checked'"; ?> /> Exclude
979
- </td>
980
- </tr>
981
- <?php
982
  }
983
- ?>
984
- </tbody>
985
- </table>
986
- <br />
987
- <table class="widefat" width="80%" cellpadding="0" cellspacing="2" border="0">
988
- <thead>
989
- <tr>
990
- <th class="author-id" scope="col"><?php _e('ID') ?></th>
991
- <th class="author-name" scope="col"><?php _e('Author Name') ?></th>
992
- <th class="cat-action" scope="col"><?php _e('Exclude from...') ?></th>
993
- </tr>
994
- </thead>
995
- <tbody>
996
- <?php
997
- foreach($this->authors as $author_info)
998
- {
999
- $class = ('alternate' == $class) ? '' : 'alternate';
1000
- $this->se_show_author_item_row($author_info, $class);
1001
- }
1002
- ?>
1003
- <tr>
1004
- <td colspan="3">
1005
- <p class="submit">
1006
- <input type="hidden" name="se_admin[action]" value="save_authors" />
1007
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1008
- </p>
1009
- </td>
1010
- </tr>
1011
- </tbody>
1012
- </table>
1013
- </form>
1014
- <?php
1015
- }
1016
- else
1017
- {
1018
- ?><p>You don't have any Authors defined.</p><?php
1019
- }
1020
- }
1021
-
1022
- function se_show_author_item_row($author_info, $class)
1023
- {
1024
- ?>
1025
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
1026
- <td class="author-id"><?php echo $author_info->user_id ?></td>
1027
- <td class="author-name"><?php echo $author_info->display_name ?></td>
1028
- <td class="author-action"><?php $this->se_display_author_action_row($author_info->user_id) ?></td>
1029
- </tr>
1030
- <?php
1031
- }
1032
-
1033
- function se_display_author_action_row($author_id)
1034
- {
1035
- foreach ($this->default_IsActions['authors'] as $action_key => $action_val)
1036
- {
1037
- ?>
1038
- <label for="authors-<?php echo $action_key ?>-<?php echo $author_id ?>">
1039
- <?php echo $action_val['name'] ?></label>&nbsp;
1040
- <input type="checkbox"
1041
- name="se_admin[authors][<?php echo $action_key ?>][<?php echo $author_id ?>]"
1042
- id="authors-<?php echo $action_key ?>-<?php echo $author_id ?>"
1043
- <?php
1044
- if ((isset($this->se_cfg['authors'][$action_key][$author_id]))
1045
- && ($this->se_cfg['authors'][$action_key][$author_id] == "on"))
1046
- echo "checked='checked' ";
1047
- ?> />
1048
- <?php
1049
- }
1050
- }
1051
-
1052
- // END CONFIG FUNCTIONS
1053
- /////////////////////////////////////////////////////////////////
1054
-
1055
- // PAGE FUNCTIONS
1056
- /////////////////////////////////////////////////////////////////
1057
- function se_display_pages_panel($se_admin='')
1058
- {
1059
- //$this->se_check_google_sitemap_exclude_pages();
1060
- ?>
1061
- <h2>Manage Page Exclusions</h2>
1062
- <?php
1063
- if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_pages"))
1064
- {
1065
- if (isset($se_admin['pages']))
1066
- {
1067
- // Need to update the third party items before updating the master. This will allow for
1068
- // comparison checking
1069
- $this->se_update_google_xml_sitemap_exclude_pages();
1070
- $this->se_update_search_unleashed_exclude_pages();
1071
 
1072
- $this->se_cfg['pages'] = $se_admin['pages'];
1073
- $this->se_save_config();
1074
- ?>
1075
- <div class="updated">
1076
- <p>Page Exclusions successfully updated.</p>
1077
- </div>
1078
- <?php
1079
- }
1080
- }
1081
- $this->se_show_pages_form();
1082
-
1083
- }
1084
 
1085
- function se_load_pages()
1086
- {
1087
- global $wpdb;
1088
- if (!$this->pages)
1089
- $this->pages = get_pages();
1090
- }
1091
-
1092
- function get_page_parent_tree_array($page_id=0, $level=0)
1093
- {
1094
- $page_info = get_page($page_id);
1095
 
1096
- $parent_array = array();
1097
- $parent_array[$level] = $page_info;
 
 
1098
 
1099
- if (intval($page_info->post_parent) > 0)
1100
- {
1101
- $page_array_tmp = $this->get_page_parent_tree_array($page_info->post_parent, $level+1);
1102
- if ($page_array_tmp)
1103
- $parent_array = array_merge($parent_array, $page_array_tmp);
 
 
1104
  }
1105
- return $parent_array;
1106
- }
1107
-
1108
-
1109
 
1110
- function se_show_pages_form()
1111
- {
1112
- $this->se_load_pages();
1113
- if ($this->pages)
1114
  {
1115
- $this->display_instructions('pages');
1116
- ?>
1117
- <form name="page_exclusion" id="page_exclusion"
1118
- action="?page=se_manage_pages&amp;se_admin[action]=save_pages" method="post">
1119
- <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
1120
- <thead>
1121
- <tr>
1122
- <th class="action"><?php _e('Action Name') ?></th>
1123
- <th class="description"><?php _e('Description ') ?></th>
1124
- <th class="inc-excl"><?php _e('Inclusion/Exclusion Default') ?></th>
1125
- </tr>
1126
- </thead>
1127
- <tbody>
1128
- <?php
1129
- $class = "";
1130
- foreach ($this->default_IsActions['pages'] as $action_key => $action_val)
1131
  {
1132
- $class = ('alternate' == $class) ? '' : 'alternate';
1133
- ?>
1134
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
1135
- <td class="action"><?php echo $action_val['name'] ?></td>
1136
- <td class="description"><?php echo $action_val['description'] ?></td>
1137
- <td class="inc-excl">
1138
- <input type="radio"
1139
- name="se_admin[pages][actions][<?php echo $action_key ?>]" value="i"
1140
- <?php if ((isset($this->se_cfg['pages']['actions'][$action_key]))
1141
- && ($this->se_cfg['pages']['actions'][$action_key] == 'i'))
1142
- echo "checked='checked'"; ?> /> Include only<br />
1143
-
1144
- <input type="radio"
1145
- name="se_admin[pages][actions][<?php echo $action_key ?>]" value="e"
1146
- <?php if ((isset($this->se_cfg['pages']['actions'][$action_key]))
1147
- && ($this->se_cfg['pages']['actions'][$action_key] == 'e'))
1148
- echo "checked='checked'"; ?> /> Exclude
1149
- </td>
1150
- </tr>
1151
- <?php
1152
  }
1153
- ?>
1154
- </tbody>
1155
- </table>
1156
- <br />
1157
-
1158
-
1159
- <table class="widefat" width="80%" cellpadding="3" cellspacing="3">
1160
- <thead>
1161
- <tr>
1162
- <th class="page-id" scope="col"><?php _e('ID') ?></th>
1163
- <th class="page-name" scope="col"><?php _e('Title') ?></th>
1164
- <th class="page-action" scope="col"><?php _e('Exclude from...') ?></th>
1165
- </tr>
1166
- </thead>
1167
- <tbody>
1168
- <?php
1169
- foreach($this->pages as $page_info)
1170
- {
1171
- $class = ('alternate' == $class) ? '' : 'alternate';
1172
- $this->se_show_page_item_row($page_info, $class);
1173
- }
1174
- ?>
1175
- <tr>
1176
- <td colspan="3">
1177
- <p class="submit">
1178
- <input type="hidden" name="se_admin[action]" value="save_pages" />
1179
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1180
- </p>
1181
- </td>
1182
- </tr>
1183
- </tbody>
1184
- </table>
1185
- </form>
1186
- <?php
1187
- //$this->se_check_google_sitemap_exclude(1);
1188
- }
1189
- else
1190
- {
1191
- ?><p>You don't have any Pages.</p><?php
1192
- }
1193
-
1194
- }
1195
 
1196
- function se_show_page_item_row($page_info, $class = '')
1197
- {
1198
- $page_parents = $this->get_page_parent_tree_array($page_info->ID, 0);
1199
- $level_spacer = "";
1200
- foreach($page_parents as $page_parent)
1201
- {
1202
- if ($page_parent->ID == $page_info->ID)
1203
- continue;
1204
 
1205
- $level_spacer .= "&ndash;";
1206
- }
1207
-
1208
-
1209
- ?>
1210
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
1211
- <td class="page-id"><?php echo $page_info->ID ?></td>
1212
- <td class="page-name"><?php echo $level_spacer. $page_info->post_title ?></td>
1213
- <td class="page-action"><?php $this->se_display_page_action_row($page_info->ID) ?></td>
1214
- </tr>
1215
- <?php
1216
- }
1217
-
1218
-
1219
- function se_display_page_action_row($page_id)
1220
- {
1221
- foreach ($this->default_IsActions['pages'] as $action_key => $action_val)
1222
- {
1223
- ?>
1224
- <label for="pages-<?php echo $action_key ?>-<?php echo $page_id ?>">
1225
- <?php echo $action_val['name'] ?></label>&nbsp;
1226
- <input type="checkbox"
1227
- name="se_admin[pages][<?php echo $action_key ?>][<?php echo $page_id ?>]"
1228
- id="pages-<?php echo $action_key ?>-<?php echo $page_id ?>"
1229
- <?php
1230
-
1231
- if ((isset($this->se_cfg['pages'][$action_key][$page_id]))
1232
- && ($this->se_cfg['pages'][$action_key][$page_id] == "on"))
1233
- echo "checked='checked' ";
1234
- ?> />
1235
- <?php
1236
- }
1237
- }
1238
-
1239
- function get_pages_list($sep, $ids)
1240
- {
1241
- foreach($ids as $id_key => $id_val)
1242
- {
1243
- if (strlen($id_list))
1244
- $id_list .= ",";
1245
- $id_list .= $id_key;
1246
- }
1247
- return $id_list;
1248
-
1249
- }
1250
-
1251
- // The following 2 function we taken from the wonderful SearchEverything plugin.
1252
- // http://wordpress.org/extend/plugins/search-everything/
1253
- function SE4_exclude_posts($where) {
1254
- global $wp_query, $wpdb;
1255
 
1256
- $action_key = "is_search";
 
1257
 
1258
- if ((!empty($wp_query->query_vars['s']))
1259
- && ((isset($this->se_cfg['pages'][$action_key])) && (count($this->se_cfg['pages'][$action_key]) > 0)))
1260
- {
1261
- //echo __FUNCTION__ ." before : where=[".$where."]<br />";
1262
- $excl_list = $this->get_pages_list(',', $this->se_cfg['pages'][$action_key]);
1263
- //$excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_posts_list'])));
1264
-
1265
- $where = str_replace('"', "'", $where);
1266
- $where = 'AND ('. substr($where, strpos($where, 'AND')+3). ' )';
1267
- if ($this->se_cfg['pages']['actions'][$action_key] == 'e')
1268
- $where .= ' AND ('.$wpdb->posts.'.ID NOT IN ( '.$excl_list.' ))';
1269
- else
1270
- $where .= ' AND ('.$wpdb->posts.'.ID IN ( '.$excl_list.' ))';
1271
- //echo __FUNCTION__ ." after: where=[".$where."]<br />";
1272
  }
1273
- return $where;
1274
- }
1275
-
1276
- //search pages (except password protected pages provided by loops)
1277
- function SE4_search_pages($where) {
1278
- global $wp_query;
1279
 
1280
- if (!empty($wp_query->query_vars['s'])) {
1281
- //echo __FUNCTION__ ." before: where=[".$where."]<br />";
1282
 
1283
- $where = str_replace('"', "'", $where);
 
 
 
 
 
 
 
 
 
 
 
1284
 
1285
- if (isset($this->options['SE4_approved_pages_only']))
1286
- {
1287
- if ('true' == $this->options['SE4_approved_pages_only']) {
1288
- $where = str_replace("post_type = 'post' AND ", "post_password = '' AND ", $where);
1289
- }
1290
- else { // < v 2.1
1291
- $where = str_replace("post_type = 'post' AND ", "", $where);
1292
- }
1293
- }
1294
- //echo __FUNCTION__ ." after: where=[".$where."]<br />";
1295
- }
1296
 
1297
- return $where;
1298
- }
1299
-
1300
- // END CONFIG FUNCTIONS
1301
- /////////////////////////////////////////////////////////////////
1302
-
1303
-
1304
-
1305
- // OPTIONS FUNCTIONS
1306
- /////////////////////////////////////////////////////////////////
1307
- function se_display_options_panel($se_admin='')
1308
- {
1309
- ?>
1310
- <h2>Manage Simply Exclude Options and Third-Party hooks</h2>
1311
- <?php
1312
 
1313
- if (isset($_REQUEST['se_admin']))
1314
- $se_admin = $_REQUEST['se_admin'];
1315
-
1316
- $this->se_load_options();
 
 
 
1317
 
1318
- if ((isset($se_admin['action'])) && ($se_admin['action'] == "save_options"))
 
 
 
 
 
 
 
1319
  {
1320
- if (isset($se_admin['options']))
1321
  {
1322
- foreach ($this->se_cfg['options'] as $option_key => $options_set)
1323
  {
1324
- if ($options_set['status'] === true)
1325
- {
1326
- if (count($options_set['actions']))
1327
- {
1328
- foreach($options_set['actions'] as $option_actions_idx => $option_actions_set)
1329
- {
1330
- if (isset($se_admin['options'][$option_key]['actions'][$option_actions_idx]['update']))
1331
- $this->se_cfg['options'][$option_key]['actions'][$option_actions_idx]['update'] = true;
1332
- else
1333
- $this->se_cfg['options'][$option_key]['actions'][$option_actions_idx]['update'] = false;
1334
- }
1335
- }
1336
- }
1337
  }
1338
- $this->se_save_config();
1339
- ?>
1340
- <div class="updated">
1341
- <p>Exclusion Options successfully updated.</p>
1342
- </div>
1343
- <?php
1344
-
1345
  }
1346
  }
1347
- $this->se_show_options_form();
 
 
 
 
 
 
 
 
 
 
 
 
1348
  }
1349
 
 
 
 
 
 
 
 
1350
  function se_load_options()
1351
  {
1352
  $check_plugins = get_option('active_plugins');
@@ -1360,731 +1289,1491 @@ class SimplyExclude
1360
  }
1361
  }
1362
  }
1363
- function se_show_options_form()
1364
- {
1365
- $this->display_instructions('options');
1366
-
1367
- ?>
1368
- <form name="option_exclusion" id="option_exclusion"
1369
- action="?page=se_manage_options" method="post">
1370
- <table class="widefat" width="80%" cellpadding="3" cellspacing="3" border="0">
1371
- <thead>
1372
- <tr>
1373
- <th class="name"><?php _e('Plugin Name') ?></th>
1374
- <th class="description"><?php _e('Description of Functionality') ?></th>
1375
- <th class="actions"><?php _e('Actions') ?></th>
1376
- </tr>
1377
- </thead>
1378
- <tbody>
1379
- <?php
1380
- $class = "";
1381
- foreach ($this->se_cfg['options'] as $option_key => $options_set)
1382
- {
1383
- //echo "options_set<pre>"; print_r($options_set); echo "</pre>";
1384
-
1385
- $class = ('alternate' == $class) ? '' : 'alternate';
1386
- ?>
1387
- <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
1388
- <td class="name"><a href="<?php echo $options_set['url'] ?>"><?php echo $options_set['name'] ?></a></td>
1389
- <td class="description"><?php echo $options_set['desc'] ?></td>
1390
- <td class="actions" nowrap="nowrap">
1391
- <?php
1392
- if ($options_set['active'] == true)
1393
- {
1394
- if ($options_set['status'] !== true)
1395
- {
1396
- ?>This plugin is not installed or not active.<?php
1397
- }
1398
- else
1399
- {
1400
- if (count($options_set['actions']))
1401
- {
1402
- foreach($options_set['actions'] as $option_actions_idx => $option_actions_set)
1403
- {
1404
- ?>
1405
- <input type="checkbox"
1406
- name="se_admin[options][<?php echo $option_key; ?>][actions][<?php
1407
- echo $option_actions_idx; ?>][update]"
1408
- <?php if ($option_actions_set['update'] === true)
1409
- echo "checked='checked'"; ?> /> <?php echo $option_actions_set['desc']?><br />
1410
- <?php
1411
- }
1412
- }
1413
- }
1414
- }
1415
- ?>
1416
-
1417
- </td>
1418
- </tr>
1419
- <?php
1420
- }
1421
- ?>
1422
- <tr>
1423
- <td colspan="2">
1424
- <p class="submit">
1425
- <input type="hidden" name="se_admin[action]" value="save_options" />
1426
- <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
1427
- </p>
1428
- </td>
1429
- </tr>
1430
-
1431
- </tbody>
1432
- </table>
1433
- </form>
1434
- <?php
1435
- }
1436
 
 
 
 
 
 
1437
 
1438
- // END CONFIG FUNCTIONS
1439
- /////////////////////////////////////////////////////////////////
1440
-
1441
-
1442
-
1443
- function se_filters($wp_query)
1444
  {
1445
- if (($wp_query->is_admin) || ($wp_query->is_single) || ($wp_query->is_page))
1446
- return $wp_query;
1447
-
1448
- if ((isset($wp_query->query_vars['post_type']))
1449
- && (strlen($wp_query->query_vars['post_type'])) )
1450
- {
1451
- return $wp_query;
1452
- }
1453
 
1454
- // Only filter on our actions.
1455
- if ((!$wp_query->is_home)
1456
- && (!$wp_query->is_search)
1457
- && (!$wp_query->is_archive)
1458
- && (!$wp_query->is_feed)
1459
- && (!$wp_query->is_author) )
1460
- return $wp_query;
1461
-
1462
- if (count($this->default_IsActions['cats']) > 0)
1463
- {
1464
- foreach ($this->default_IsActions['cats'] as $action_key => $action_val)
1465
- {
1466
- $cats_list = "";
1467
- if ($wp_query->{$action_key})
1468
- {
1469
- if ((isset($this->se_cfg['cats'][$action_key])) && (count($this->se_cfg['cats'][$action_key])))
1470
- {
1471
- if ($this->se_cfg['cats']['actions'][$action_key] == 'e')
1472
- $wp_query->set('category__not_in', array_keys($this->se_cfg['cats'][$action_key]));
1473
- else
1474
- $wp_query->set('category__in', array_keys($this->se_cfg['cats'][$action_key]));
1475
- }
1476
- }
1477
- }
1478
- }
1479
-
1480
- if ($this->wp_version >= 2.3)
1481
  {
1482
- if (count($this->default_IsActions['tags']) > 0)
1483
  {
1484
- //echo "this->default_IsActions[tags]<pre>"; print_r($this->default_IsActions['tags']); echo "</pre>";
1485
- foreach ($this->default_IsActions['tags'] as $action_key => $action_val)
 
 
 
1486
  {
1487
- if ($wp_query->{$action_key})
1488
- {
1489
- if ((isset($this->se_cfg['tags'][$action_key])) && (count($this->se_cfg['tags'][$action_key]) > 0))
1490
- {
1491
- if ($this->se_cfg['tags']['actions'][$action_key] == "e")
1492
- $wp_query->set('tag__not_in', array_keys($this->se_cfg['tags'][$action_key]));
1493
- else
1494
- $wp_query->set('tag__in', array_keys($this->se_cfg['tags'][$action_key]));
1495
- }
1496
- }
1497
- }
1498
  }
1499
  }
 
 
 
 
 
 
 
1500
 
1501
- if (count($this->default_IsActions['authors']) > 0)
 
1502
  {
1503
- foreach ($this->default_IsActions['authors'] as $action_key => $action_val)
1504
  {
1505
- $authors_list = "";
1506
- if ($wp_query->{$action_key})
1507
- {
1508
- if (isset($this->se_cfg['authors'][$action_key]))
1509
- {
1510
- if (count($this->se_cfg['authors'][$action_key]))
1511
- {
1512
- $authors_list = $this->se_listify_ids(
1513
- $this->se_cfg['authors']['actions'][$action_key],
1514
- $this->se_cfg['authors'][$action_key]);
1515
- }
1516
- }
1517
- if (strlen($authors_list))
1518
- $wp_query->set('author', $authors_list);
1519
- }
1520
- }
1521
- }
1522
 
1523
- if (count($this->default_IsActions['pages']) > 0)
1524
- {
1525
- foreach ($this->default_IsActions['pages'] as $action_key => $action_val)
1526
- {
1527
- if ($wp_query->{$action_key})
1528
  {
1529
- add_filter('posts_where', array(&$this, 'SE4_search_pages'));
1530
- add_filter('posts_where', array(&$this, 'SE4_exclude_posts'));
1531
- }
1532
  }
1533
  }
1534
- return $wp_query;
 
1535
  }
1536
-
1537
- function se_listify_ids($action, $ids)
1538
  {
1539
- $id_list = "";
1540
- if ($action == "e")
1541
- $action_value = "-";
1542
- else
1543
- $action_value = "";
1544
- foreach($ids as $id_key => $id_val)
1545
- {
1546
- if (strlen($id_list))
1547
- $id_list .= ",";
1548
- $id_list .= $action_value.$id_key;
1549
- }
1550
- return $id_list;
1551
- }
1552
 
1553
-
1554
- function display_instructions($type)
 
 
 
 
 
 
 
 
 
 
1555
  {
1556
- if ($type == "cats")
1557
- {
1558
- ?>
1559
- <p>Set the checkbox to exclude the respective page from the action</p>
1560
- <p>So what is the difference between Exclusion and Inclusion?<br />
1561
- <strong>Exclude</strong>: Select this action to exclude Categories from WP
1562
- action. For example you may wish to exclude the Category 'Blogroll' from Searches.<br />
1563
- <strong>Include</strong>: Select the Categories you wish to be included for certain
1564
- WP actions. For example you want only a certain category displayed on the home
1565
- page. Note that with Include only those checked items will be included in the
1566
- WP action. </p>
1567
- <?php
1568
- }
1569
- else if ($type == "tags")
1570
- {
1571
- ?>
1572
- <p>Set the checkbox to exclude the respective page from the action</p>
1573
- <p>So what is the difference between Exclusion and Inclusion?<br />
1574
- <strong>Exclude</strong>: Select this action to exclude Tags from WP
1575
- action. For example you may wish to exclude the Tag 'Blogroll' from Searches.<br />
1576
- <strong>Include</strong>: Select the Tag you wish to be included for certain
1577
- WP actions. For example you want only a certain tag displayed on the home
1578
- page. Note that with Include only those checked items will be included in the
1579
- WP action. </p>
1580
- <?php
1581
- }
1582
- else if ($type == "authors")
1583
- {
1584
- ?>
1585
- <p>Set the checkbox to exclude the respective author from the action</p>
1586
- <p>So what is the difference between Exclusion and Inclusion?<br />
1587
- <strong>Exclude</strong>: Select this action to exclude Authors from WP
1588
- action. For example you may wish to exclude the Author 'jim' from Searches.<br />
1589
- <strong>Include</strong>: Select the Author you wish to be included for certain
1590
- WP actions. For example you want only a certain author(s) displayed on the home
1591
- page. Note that with Include only those checked items will be included in the
1592
- WP action. </p>
1593
- <?php
1594
- }
1595
- else if ($type == "pages")
1596
- {
1597
 
1598
- ?>
1599
- <p style="color: red"><strong>WARNING: There is a known conflict when excluding pages here and via the plugin Search Everything. The problem is related to how each plugin will modify the SQL query used by WordPress. If you are using Search Everything plugin please do not make any exclusions here.</p>
1600
- <p>Set the checkbox to exclude the respective page from the action</p>
1601
- <p>So what is the difference between Exclusion and Inclusion?<br />
1602
- <strong>Exclude</strong>: Select this action to exclude Pages from WP
1603
- action. For example you may wish to exclude a Page from Searches. Most common use.<br />
1604
- <strong>Include</strong>: Select the Page you wish to be included for certain
1605
- WP actions. For example you want only certain Pages displayed from a Search. Note with Include only those checked items will be included in the
1606
- WP action. And as new Pages are added they will need to be checked here. </p>
1607
-
1608
- <p><strong>Note</strong>: The Pages section of this plugin is at best experimental until Page Search is included
1609
- by default into WordPress core. Also, you might consider using the SearchEverything plugin which offers much more
1610
- functionality on Searched. http://wordpress.org/extend/plugins/search-everything/</p>
1611
- <?php
1612
 
1613
- /*
1614
- ?>
1615
- <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>
1616
- <?php
1617
- */
1618
  }
1619
- else if ($type == "options")
 
1620
  {
1621
- ?>
1622
- <p>The Simply Exclude plugin now works with a few other plugins. Check the box for support of the listed third
1623
- party plugins options below</p>
1624
- <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>
1625
- <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>
1626
- <?php
1627
-
1628
- /*
1629
- ?>
1630
- <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>
1631
- <?php
1632
- */
1633
  }
1634
 
 
 
1635
 
1636
 
1637
- }
1638
-
1639
- function add_page_exclude_sidebar_dbx()
1640
  {
1641
- global $post;
1642
-
1643
- $action_key = "is_search";
1644
 
1645
- if ($this->se_cfg['pages'][$action_key][$post->ID] == "on")
1646
- $exclude_page = "yes";
1647
- else
1648
- $exclude_page = "no";
1649
 
 
1650
 
1651
-
1652
- if ($this->wp_version < 2.5)
1653
- {
1654
- ?>
1655
- <fieldset id="exclude_search_page" class="dbx-box">
1656
- <h3 class="dbx-handle"><?php _e('Exclude from Search?') ?></h3>
1657
- <div class="dbx-content">
1658
- <?php
1659
  }
1660
- ?>
1661
- <p><?php
1662
- if ($this->wp_version >= 2.5)
1663
- {
1664
- ?>Select this option 'Yes' to exclude this page from Searches or visit <a href="<?php echo get_option('siteurl') ?>/wp-admin/options-general.php?page=simplyexclude&amp;se_admin[action]=edit_pages">Simply Exclude</a> Settings page to mass edit all Pages.<br /><?php
1665
- } ?>
1666
- <select name="se_page_exclude">
1667
- <option value='No' selected><?php echo _e('No'); ?></option>
1668
- <option value='Yes' <?php if ($exclude_page == "yes") echo "selected"; ?>><?php _e('Yes'); ?></option>
1669
- </select>
1670
- </p>
1671
- <?php
1672
- if ($this->wp_version < 2.5)
1673
- {
1674
- ?>
1675
- </div>
1676
- </fieldset>
1677
- <?php
1678
  }
1679
- }
1680
-
 
 
 
 
 
1681
 
1682
- function save_page_exclude_answer()
1683
  {
1684
- if (!isset($_REQUEST['post_ID']))
1685
- return;
1686
-
1687
- if (!isset($_REQUEST['se_page_exclude']))
1688
- return;
1689
-
1690
- $post_id = $_REQUEST['post_ID'];
1691
- $action_key = "is_search";
1692
-
1693
- if ($_REQUEST['se_page_exclude'] == "Yes")
1694
- $this->se_cfg['pages'][$action_key][$post_id] = "on";
1695
- else
1696
- $this->se_cfg['pages'][$action_key][$post_id] = "";
1697
 
1698
- $this->se_save_config();
1699
  }
1700
 
1701
 
1702
- // THIRD PARTY FUNCTIONS
1703
- /////////////////////////////////////////////////////////////////
1704
-
1705
- /*
1706
- function se_check_google_xml_sitemap_exclude_cats()
 
 
 
1707
  {
1708
- return;
1709
-
1710
-
1711
- if (!$this->GA_generatorObject) return;
1712
 
1713
- if ((!$this->GA_generatorObject->_options["sm_b_exclude_cats"])
1714
- || (count($this->GA_generatorObject->_options["sm_b_exclude_cats"]) == 0))
1715
- return;
1716
 
1717
- // We only care about
1718
- if ((!isset($this->se_cfg['cats']['actions']['is_search']))
1719
- || ($this->se_cfg['cats']['actions']['is_search'] != "e"))
1720
- return;
 
1721
 
1722
- if (!isset($this->se_cfg['cats']['is_search']))
1723
- $this->se_cfg['cats']['is_search'] = array();
1724
 
1725
- foreach($this->GA_generatorObject->_options["sm_b_exclude_cats"] as $google_sitemap_cat_id) {
1726
- $this->se_cfg['cats']['is_search'][$google_sitemap_cat_id] = "on";
 
 
 
1727
 
1728
- }
1729
- }
1730
- */
1731
- function se_update_google_xml_sitemap_exclude_cats()
1732
- {
1733
- // If the user didn't elect to sync the excluded page with the Google Xml Sitemap -- return;
1734
- if ((!isset($this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update']))
1735
- || ($this->se_cfg['options']['google-sitemap-generator']['actions']['categories']['update'] !== true))
1736
- return;
1737
 
1738
- unset($this->GA_generatorObject->_options['sm_b_exclude_cats']);
1739
- $this->GA_generatorObject->_options['sm_b_exclude_cats'] = array();
 
 
 
1740
 
1741
- if ($_REQUEST['se_admin']['cats']['actions']['is_search'] == "e")
1742
- {
1743
- foreach($_REQUEST['se_admin']['cats']['is_search'] as $cat_idx => $cal_status)
1744
- {
1745
- if (array_search($cat_idx, $this->GA_generatorObject->_options['sm_b_exclude_cats']) === false)
1746
- $this->GA_generatorObject->_options['sm_b_exclude_cats'][] = $cat_idx;
1747
- }
1748
- }
1749
- else
1750
- {
1751
- $all_cat_ids = get_all_category_ids();
1752
- if (!$all_cat_ids)
1753
- $all_cat_ids = array();
1754
 
1755
- foreach($all_cat_ids as $cat_idx)
1756
- {
1757
- if (!isset($_REQUEST['se_admin']['cats']['is_search'][$cat_idx]))
1758
- $this->GA_generatorObject->_options['sm_b_exclude_cats'][] = $cat_idx;
1759
- }
1760
- }
1761
- update_option("sm_options", $this->GA_generatorObject->_options);
1762
- }
1763
 
1764
 
1765
- /*
1766
- function se_check_google_sitemap_exclude_pages()
1767
- {
1768
- return;
1769
 
1770
- if (!$this->GA_generatorObject) return;
 
 
 
 
1771
 
1772
- if ((!$this->GA_generatorObject->_options["sm_b_exclude"])
1773
- || (count($this->GA_generatorObject->_options["sm_b_exclude"]) == 0))
1774
- return;
1775
 
1776
- // We only care about
1777
- if ((!isset($this->se_cfg['pages']['actions']['is_search']))
1778
- || ($this->se_cfg['pages']['actions']['is_search'] != "e"))
1779
- return;
 
1780
 
1781
- if (!isset($this->se_cfg['pages']['is_search']))
1782
- $this->se_cfg['pages']['is_search'] = array();
1783
 
1784
- $all_page_ids = get_all_page_ids();
1785
- if (!$all_page_ids)
1786
- $all_page_ids = array();
1787
 
1788
- foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $google_sitemap_page_id) {
 
 
 
 
1789
 
1790
- if (array_search($google_sitemap_page_id, $all_page_ids) === false)
1791
- continue;
1792
 
1793
- if (count($this->se_cfg['pages']['is_search'])) {
1794
- if (!isset($this->se_cfg['pages']['is_search'][$google_sitemap_page_id])) {
1795
- $this->se_cfg['pages']['is_search'][$google_sitemap_page_id] = "on";
1796
  }
1797
- }
1798
- else
1799
- $this->se_cfg['pages']['is_search'][$google_sitemap_page_id] = "on";
1800
- }
1801
- if (count($this->se_cfg['pages']))
1802
- asort($this->se_cfg['pages']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1803
  }
1804
- */
1805
- function se_update_google_xml_sitemap_exclude_pages()
1806
  {
1807
- if ((!isset($this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update']))
1808
- || ($this->se_cfg['options']['google-sitemap-generator']['actions']['pages']['update'] !== true))
1809
- return;
1810
 
1811
- // If both arrays are empty then we don't have anything to do -- return
1812
- //echo "sm_b_exclude<pre>"; print_r($this->GA_generatorObject->_options["sm_b_exclude"]); echo "</pre>";
1813
- //exit;
1814
-
1815
- if ((count($this->GA_generatorObject->_options["sm_b_exclude"]) == 0)
1816
- && (count($_REQUEST['se_admin']['pages']['is_search']) == 0))
1817
- return;
1818
 
1819
- $all_page_ids = get_all_page_ids();
1820
- if (!$all_page_ids)
1821
- $all_page_ids = array();
 
 
1822
 
1823
- if ($_REQUEST['se_admin']['pages']['actions']['is_search'] == "e") {
 
1824
 
1825
- // Remove all Pages from the Google XML Sitemap exclude array. Then we will add the new ones back.
1826
- foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $idx => $google_sitemap_page_id) {
 
 
 
1827
 
1828
- if (array_search($google_sitemap_page_id, $all_page_ids) !== false)
1829
- unset($this->GA_generatorObject->_options["sm_b_exclude"][$idx]);
1830
- }
1831
- foreach($_REQUEST['se_admin']['pages']['is_search'] as $se_pages_idx => $se_page_status)
1832
- {
1833
- if (array_search($se_pages_idx, $this->GA_generatorObject->_options["sm_b_exclude"]) === false)
1834
- $this->GA_generatorObject->_options["sm_b_exclude"][] = $se_pages_idx;
1835
- }
1836
- }
1837
- else {
 
 
 
 
 
 
1838
 
1839
- foreach($this->GA_generatorObject->_options["sm_b_exclude"] as $idx => $google_sitemap_page_id) {
1840
- if (array_search($google_sitemap_page_id, $all_page_ids) !== false)
1841
- unset($this->GA_generatorObject->_options["sm_b_exclude"][$idx]);
1842
- }
1843
 
1844
- foreach($all_page_ids as $page_idx => $page_id) {
1845
- if (array_key_exists($page_id, $_REQUEST['se_admin']['pages']['is_search']) === false)
1846
  {
1847
- if (array_search($page_id, $this->GA_generatorObject->_options["sm_b_exclude"]) === false)
1848
- $this->GA_generatorObject->_options["sm_b_exclude"][] = $page_id;
 
 
 
 
 
 
 
1849
  }
1850
- }
1851
- }
1852
- //echo "GA_generatorObject : after<pre>"; print_r($this->GA_generatorObject->_options["sm_b_exclude"]); echo "</pre>";
1853
 
1854
- update_option("sm_options", $this->GA_generatorObject->_options);
1855
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1856
 
1857
-
1858
- function se_update_search_unleashed_exclude_cats()
1859
- {
1860
- if ((!isset($this->se_cfg['options']['search-unleashed']['actions']['categories']['update']))
1861
- || ($this->se_cfg['options']['search-unleashed']['actions']['categories']['update'] !== true))
1862
- return;
1863
-
1864
- $search_unleashed_options = get_option( 'search_unleashed', $options );
1865
- if (strlen($search_unleashed_options['exclude_cat']))
1866
  {
1867
- $search_unleashed_exclude = explode(',', $search_unleashed_options['exclude_cat']);
1868
- if ($search_unleashed_exclude)
1869
- {
1870
- foreach($search_unleashed_exclude as $ex_idx => $ex_item)
1871
  {
1872
- $search_unleashed_exclude[$ex_idx] = trim($ex_item);
 
 
 
 
 
 
 
 
 
1873
  }
1874
- }
1875
- else
1876
- $search_unleashed_exclude = array();
1877
- }
1878
- else
1879
- $search_unleashed_exclude = array();
1880
 
1881
- $all_cat_ids = get_all_category_ids();
1882
- if (!$all_cat_ids)
1883
- $all_cat_ids = array();
1884
-
1885
-
1886
- if ($_REQUEST['se_admin']['cats']['actions']['is_search'] == "e")
1887
- {
1888
- foreach($search_unleashed_exclude as $idx => $search_exclude_cat_id) {
1889
- if (array_search($search_exclude_cat_id, $all_cat_ids) !== false)
1890
- unset($search_unleashed_exclude[$idx]);
1891
- }
1892
 
1893
- foreach($_REQUEST['se_admin']['cats']['is_search'] as $se_cat_idx => $se_cat_status)
1894
- {
1895
- if (array_search($se_cat_idx, $search_unleashed_exclude) === false)
1896
- $search_unleashed_exclude[] = $se_cat_idx;
1897
- }
1898
-
1899
- }
1900
- else
1901
- {
1902
- foreach($search_unleashed_exclude as $idx => $search_exclude_cat_id) {
1903
- if (array_search($search_exclude_cat_id, $all_cat_ids) !== false)
1904
- unset($search_unleashed_exclude[$idx]);
1905
- }
1906
-
1907
- foreach($all_cat_ids as $cat_idx => $cat_id) {
1908
- if (array_key_exists($cat_id, $_REQUEST['se_admin']['cats']['is_search']) === false)
1909
  {
1910
- if (array_search($cat_id, $search_unleashed_exclude) === false)
1911
- $search_unleashed_exclude[] = $cat_id;
 
 
 
 
 
 
 
 
1912
  }
1913
- }
1914
- }
1915
- $search_unleashed_options['exclude_cat'] = "";
1916
- if (count($search_unleashed_exclude))
1917
- {
1918
- $search_unleashed_options['exclude_cat'] = implode(',', $search_unleashed_exclude);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1919
  }
1920
- update_option( 'search_unleashed', $search_unleashed_options );
1921
  }
 
 
 
 
 
 
 
1922
 
1923
- function se_update_search_unleashed_exclude_pages()
1924
  {
1925
- if ((!isset($this->se_cfg['options']['search-unleashed']['actions']['pages']['update']))
1926
- || ($this->se_cfg['options']['search-unleashed']['actions']['pages']['update'] !== true))
1927
- return;
1928
-
1929
- $search_unleashed_options = get_option( 'search_unleashed', $options );
1930
-
1931
- if (strlen($search_unleashed_options['exclude']))
 
 
 
 
 
 
 
 
 
 
 
 
1932
  {
1933
- $search_unleashed_exclude = explode(',', $search_unleashed_options['exclude']);
1934
- if ($search_unleashed_exclude)
1935
- {
1936
- foreach($search_unleashed_exclude as $ex_idx => $ex_item)
1937
- {
1938
- $search_unleashed_exclude[$ex_idx] = trim($ex_item);
1939
- }
1940
- }
1941
- else
1942
- $search_unleashed_exclude = array();
1943
  }
1944
- else
1945
- $search_unleashed_exclude = array();
1946
-
1947
-
1948
- $all_page_ids = get_all_page_ids();
1949
- if (!$all_page_ids)
1950
- $all_page_ids = array();
1951
-
1952
- if ($_REQUEST['se_admin']['pages']['actions']['is_search'] == "e")
1953
  {
1954
-
1955
- // Remove all Pages from the Google XML Sitemap exclude array. Then we will add the new ones back.
1956
- foreach($search_unleashed_exclude as $idx => $search_exclude_page_id)
1957
- {
1958
- if (array_search($search_exclude_page_id, $all_page_ids) !== false)
1959
- unset($search_unleashed_exclude[$idx]);
1960
- }
1961
-
1962
- foreach($_REQUEST['se_admin']['pages']['is_search'] as $se_pages_idx => $se_page_status)
1963
- {
1964
- if (array_search($se_pages_idx, $search_unleashed_exclude) === false)
1965
- $search_unleashed_exclude[] = $se_pages_idx;
1966
- }
1967
  }
1968
- else
1969
  {
 
 
1970
 
1971
- foreach($search_unleashed_exclude as $idx => $search_exclude_page_id)
 
 
 
 
 
 
1972
  {
1973
- if (array_search($search_exclude_page_id, $all_page_ids) !== false)
1974
- unset($search_unleashed_exclude[$idx]);
1975
- }
 
 
 
 
 
1976
 
1977
- foreach($all_page_ids as $page_idx => $page_id)
1978
- {
1979
- if (array_key_exists($page_id, $_REQUEST['se_admin']['pages']['is_search']) === false)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980
  {
1981
- if (array_search($page_id, $search_unleashed_exclude) === false)
1982
- $search_unleashed_exclude[] = $page_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
1983
  }
1984
  }
 
 
 
 
 
 
 
 
 
 
1985
  }
1986
-
1987
- $search_unleashed_options['exclude'] = "";
1988
- if (count($search_unleashed_exclude))
1989
- {
1990
- $search_unleashed_options['exclude'] = implode(',', $search_unleashed_exclude);
1991
- }
1992
- update_option( 'search_unleashed', $search_unleashed_options );
1993
  }
1994
 
1995
- function se_categories_dropdown_args_proc($args)
 
1996
  {
1997
- $all_cat_ids = get_all_category_ids();
1998
- if (!$all_cat_ids)
1999
- $all_cat_ids = array();
2000
 
2001
- if ((isset($this->se_cfg['cats']['actions']['is_archive']))
2002
- && (isset($this->se_cfg['cats']['is_archive'])))
2003
  {
2004
- if (($this->se_cfg['cats']['actions']['is_archive'] == 'e')
2005
- && (count($this->se_cfg['cats']['is_archive'])))
2006
- {
2007
- $all_cat_ids = array_keys($this->se_cfg['cats']['is_archive']);
2008
- }
2009
- else if (($this->se_cfg['cats']['actions']['is_archive'] == 'i')
2010
- && (count($this->se_cfg['cats']['is_archive'])))
2011
  {
2012
- foreach($this->se_cfg['cats']['is_archive'] as $c_idx => $c_item)
 
 
 
2013
  {
2014
- $item_idx = array_search($c_idx, $all_cat_ids);
2015
- if ($item_idx !== false)
2016
- unset($all_cat_ids[$item_idx]);
2017
  }
 
2018
  }
2019
  }
2020
-
2021
- if ((isset($all_cat_ids)) && (count($all_cat_ids)))
2022
- {
2023
- $args['exclude'] = implode(',', $all_cat_ids);
2024
- }
2025
- return $args;
2026
- }
2027
 
2028
- function se_widget_tag_cloud_args_proc($args)
2029
- {
2030
- $all_tags = get_tags('hide_empty=0&orderby=name&order=ASC');
2031
-
2032
- $all_tag_ids = array();
2033
- if ($all_tags)
2034
  {
2035
- foreach($all_tags as $t_item)
2036
  {
2037
- $all_tag_ids[] = $t_item->term_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2038
  }
2039
  }
2040
 
2041
- if (($this->se_cfg['tags']['actions']['is_archive'] == 'e')
2042
- && (count($this->se_cfg['tags']['is_archive'])))
2043
- {
2044
- $all_tag_ids = array_keys($this->se_cfg['tags']['is_archive']);
2045
- }
2046
- else if (($this->se_cfg['tags']['actions']['is_archive'] == 'i')
2047
- && (count($this->se_cfg['tags']['is_archive'])))
2048
  {
2049
- foreach($this->se_cfg['tags']['is_archive'] as $c_idx => $c_item)
2050
  {
2051
- $item_idx = array_search($c_idx, $all_tag_ids);
2052
- if ($item_idx !== false)
2053
- unset($all_tag_ids[$item_idx]);
 
 
 
 
 
 
2054
  }
 
2055
  }
2056
-
2057
- if ((isset($all_tag_ids)) && (count($all_tag_ids)))
2058
- {
2059
- $args['exclude'] = implode(',', $all_tag_ids);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2060
  }
 
 
 
2061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2062
  return $args;
2063
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2064
 
2065
- }
2066
- $simplyexclude = new SimplyExclude();
 
 
 
 
 
 
 
2067
 
2068
- // Need to determine of the site uses the Google XML Sitemap Plugin
2069
- if (is_file(WP_PLUGIN_DIR . '/google-sitemap-generator/sitemap-core.php'))
2070
- {
2071
- include (WP_PLUGIN_DIR. '/google-sitemap-generator/sitemap-core.php');
2072
- $simplyexclude->GA_generatorObject = new GoogleSitemapGenerator();
2073
- $simplyexclude->GA_generatorObject->LoadOptions();
2074
- }
 
 
 
 
 
 
 
 
2075
 
2076
- /*
2077
- function myBlogPostsFilter($query)
2078
- {
2079
- global $wp_query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2080
 
2081
- if ($query->is_search)
2082
  {
2083
- $query->set('cat','-3,-4,-5,-6,-7');
2084
- $query->set('page','-33');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2085
  }
2086
- return $query;
2087
  }
2088
- add_filter('pre_get_posts','myBlogPostsFilter');
2089
- */
2090
- ?>
1
  <?php
2
  /*
3
+ Plugin Name: Simply Exclude New
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: 2.0
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
+ 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
+ 2.0 - 2012-01-23 Full rewrite of the plugin to support custom Taxonomies and Custom Post Types. Added support for managing items within the Taxonomy/Post Type panels. Added support for exclude/include on Post instead of just Categories and Tags. Dropped support for third-party plugins like Google XML Sitemaps and Seach Unleashed (Sorry!). Now correctly supporting Pages seach excludes. Yah!.
22
+
23
  */
24
 
25
+ define('SIMPLY_EXCLUDE_I18N_DOMAIN', 'simplyexclude');
26
+
27
+ class SimplyExcludeNew
28
  {
29
+ public $wp_version;
30
+ public $se_version;
31
+ public $admin_menu_label;
32
+ public $options_key;
33
+
34
+ public $se_taxonomies_exclude = array();
35
+ public $se_post_types_exclude = array();
 
36
 
37
+ private $plugindir_url;
38
+
39
+ private $current_taxonomy;
40
+ private $current_post_type;
41
+ private $current_se_type;
42
 
43
+ private $page_hooks;
44
 
45
+ public function __construct() {
46
+
47
  global $wp_version;
48
  $this->wp_version = $wp_version;
 
49
 
50
+ $this->se_version = "2.0";
51
+
52
+ $this->admin_menu_label = __("Simply Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN);
53
+ $this->options_key = "simplyexclude_v2";
54
+
55
+ $plugindir_node = dirname(plugin_basename(__FILE__));
56
+ $this->plugindir_url = WP_PLUGIN_URL . "/". $plugindir_node;
57
+
58
+ $this->se_taxonomies_exclude = array('media-tags', 'post_format', 'link_category', 'nav_menu');
59
+ $this->se_post_types_exclude = array('revision', 'nav_menu_item', 'attachment');
60
+ $this->page_hooks = array();
61
+
62
+ add_action( 'init', array(&$this,'init_proc') );
63
+ add_action( 'admin_init', array(&$this,'admin_init_proc') );
64
+ add_action( 'admin_menu', array(&$this,'se_add_nav') );
65
+ add_action( 'admin_footer', array(&$this,'se_admin_footer') );
66
+ add_action( 'wp_ajax_se_update', array(&$this, 'se_ajax_update') );
67
 
68
+ // Used to limit the categories displayed on the home page. Simple
69
+ add_filter('pre_get_posts', array(&$this,'se_filters'));
70
+ }
71
 
72
+ function admin_init_proc()
73
+ {
74
+ $this->se_load_config();
75
+
76
+ if ( ($this->check_url('wp-admin/edit-tags.php'))
77
+ || ($this->check_url('wp-admin/edit.php'))
78
+ || ($this->check_url('wp-admin/users.php')) )
79
+ {
80
+ wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
81
 
82
+ wp_enqueue_script('jquery');
83
+ wp_enqueue_script('jquery-ui-core');
84
+ wp_enqueue_script('jquery-ui-dialog');
85
 
86
+ wp_enqueue_style( 'simplyexclude-jquery-ui',
87
+ $this->plugindir_url .'/js/jquery-ui/css/flick/jquery-ui-1.8.17.custom.css',
88
+ null, $this->se_version );
89
+
90
+ wp_enqueue_script('simplyexclude-admin-dialog-js', $this->plugindir_url .'/js/simplyexclude_admin_dialog.js',
91
+ array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'), $this->se_version);
 
 
 
 
 
 
 
 
 
92
 
93
+ wp_enqueue_script('simplyexclude-admin-ajax-js', $this->plugindir_url .'/js/simplyexclude_admin_ajax.js',
94
+ array('jquery', 'jquery-ui-core'), $this->se_version);
 
 
 
95
  }
96
+
97
+ add_action('edit_category_form_fields', array(&$this,'se_show_taxonomy_term_fields'), 99, 1);
98
+ add_action('edit_tag_form_fields', array(&$this,'se_show_taxonomy_term_fields'), 99, 1);
99
+ add_action('edited_term', array(&$this,'se_save_taxonomy_term_fields'), 99, 3);
100
+
101
+ add_action( 'show_user_profile', array(&$this,'se_show_user_profile'), 99 );
102
+ add_action( 'edit_user_profile', array(&$this,'se_show_user_profile'), 99 );
103
+
104
+ add_action( 'profile_update', array(&$this,'se_save_user_profile'), 99);
105
+
106
+ add_filter( 'plugin_action_links_'. basename( dirname( __FILE__ ) ). '/' .basename( __FILE__ ), array(&$this,'plugin_settings'));
107
+
108
  }
109
+
110
+ // Adds a 'Settings' link on the Plugins listing row. Cool!
111
+ function plugin_settings( $links ) {
112
+ $settings_link = '<a href="admin.php?page=se_manage_settings">'.__( 'Settings', SIMPLY_EXCLUDE_I18N_DOMAIN ).'</a>';
113
+ array_unshift( $links, $settings_link );
114
 
115
+ return $links;
 
 
 
116
  }
117
+
118
+ function init_proc()
119
  {
120
+ if (!is_admin())
121
+ {
122
+ add_filter('widget_pages_args', array(&$this, 'se_widget_pages_args_proc'));
123
+
124
+ // Not needed since wp_list_pages is user managable.
125
+ //aad_filter('wp_list_pages_excludes', array(&$this, 'se_wp_list_pages_excludes_proc'));
126
+
127
+ // Suport for the Category list/dropdown widget
128
+ add_filter('widget_categories_dropdown_args', array(&$this, 'se_widget_categories_dropdown_args_proc'));
129
+ add_filter('widget_categories_args', array(&$this, 'se_widget_categories_dropdown_args_proc'));
130
+
131
+ // Support for the Tag Clod widget. This widget supports both the post_tag and category taxonomies.
132
+ add_filter('widget_tag_cloud_args', array(&$this, 'se_widget_tag_cloud_args_proc'));
133
  }
134
  }
135
+
136
+ function se_add_nav()
137
+ {
138
+ // Add the Main Nav item to the WP menu
139
+ add_menu_page( 'Simply Exclude', 'Simply Exclude', 'manage_options', 'se_manage_settings',
140
+ array(&$this, 'se_manage_settings'));
141
 
142
+ // Add our Options sub menu.
143
+ $this->pagehooks['se_manage_settings'] = add_submenu_page( 'se_manage_settings', 'Settings', 'Settings', 'manage_options',
144
+ 'se_manage_settings', array(&$this, 'se_manage_settings'));
145
+ add_action('load-'. $this->pagehooks['se_manage_settings'], array(&$this, 'on_load_settings_page'));
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
+ // Add our Help sub menu.
149
+ $this->pagehooks['se_manage_help'] = add_submenu_page( 'se_manage_settings', 'Help', 'Help', 'manage_options',
150
+ 'se_manage_help', array(&$this, 'se_manage_help'));
151
+ add_action('load-'. $this->pagehooks['se_manage_help'], array(&$this, 'on_load_help_page'));
152
 
153
+ if ( !current_user_can('manage_options') )
154
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
+ $this->se_load_config();
157
+ //echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
158
 
159
+ // Now add a submenu for each registered taxonomy
160
+ $se_taxonomies = $this->se_load_taxonomy_list();
161
+ if ($se_taxonomies)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  {
163
+ foreach($se_taxonomies as $t_item)
164
  {
165
+ if ((isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide']))
166
+ && ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == 'show'))
167
+ {
168
+ add_filter( "manage_edit-". $t_item->name ."_columns", array( &$this, 'se_manage_taxonomy_columns' ), 99 );
169
+ add_filter( "manage_". $t_item->name. "_custom_column", array(&$this, 'se_display_taxonomy_column_actions'), 99, 3);
170
+ }
171
  }
172
+ //add_action("delete_term", array(&$this, 'se_delete_taxonomy_term'), 99, 3);
173
  }
174
 
175
+ // Now add a submenu for each registered post_type
176
+ $se_post_types = $this->se_load_post_type_list();
177
+ if ($se_post_types)
178
  {
179
+ foreach($se_post_types as $t_item)
180
  {
181
+ if ((isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
182
+ && ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == 'show'))
183
+ {
184
+ add_filter( "manage_". $t_item->name ."_posts_columns", array( &$this, 'se_manage_post_type_columns' ), 99 );
185
+ add_filter( "manage_". $t_item->name ."_posts_custom_column", array(&$this, 'se_display_post_type_column_actions'), 99, 3);
186
+
187
+ add_meta_box($this->options_key, $this->admin_menu_label, array(&$this,'show_post_type_exclude_sidebar_dbx'), $t_item->name, 'side');
188
+ add_action('save_post', array(&$this,'save_post_type_exclude_sidebar_dbx'));
189
+ }
190
  }
191
  }
192
 
193
+ // Users table
194
+ if ((isset($this->se_cfg['data']['se_types']['users']['options']['showhide']))
195
+ && ($this->se_cfg['data']['se_types']['users']['options']['showhide'] == 'show'))
196
  {
197
+ add_filter( "manage_users_columns", array( &$this, 'se_manage_user_columns' ), 99 );
198
+ add_filter( 'manage_users_custom_column', array(&$this, 'se_display_user_column_actions'), 99, 3);
 
 
199
  }
200
+ }
201
+
202
+ /*
203
+ function se_delete_taxonomy_term($term, $tt_id, $taxonomy)
204
+ {
205
+ echo "term<pre>"; print_r($term); echo "</pre>";
206
+ echo "tt_id=[". $tt_id ."]<br />";
207
+ echo "taxonomy=[". $taxonomy ."]<br />";
208
 
209
+ exit;
210
+ }
211
+ */
212
 
213
+ /****************************************************************************************************************************/
214
+ /* */
215
+ /* ON LOAD PAGES */
216
+ /* */
217
+ /****************************************************************************************************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
+ function on_load_settings_page() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
+ wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
222
+ wp_enqueue_script('simplyexclude-admin-ajax-js', $this->plugindir_url .'/js/simplyexclude_admin_ajax.js',
223
+ array('jquery', 'jquery-ui-core'), $this->se_version);
224
 
225
+ wp_enqueue_script('common');
226
+ wp_enqueue_script('wp-lists');
227
+ wp_enqueue_script('postbox');
228
+
229
+ //add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
230
+ add_meta_box('se_settings_about_sidebar', 'About this Plugin', array(&$this, 'se_settings_about_sidebar'),
231
+ $this->pagehooks['se_manage_settings'], 'side', 'core');
232
+ add_meta_box('se_settings_donate_sidebar', 'Make a Donation', array(&$this, 'se_settings_donate_sidebar'),
233
+ $this->pagehooks['se_manage_settings'], 'side', 'core');
234
+
235
+ add_meta_box('se_display_options_taxonomy_actions_panel', 'Taxonomies Actions', array(&$this, 'se_display_options_taxonomy_actions_panel'),
236
+ $this->pagehooks['se_manage_settings'], 'normal', 'core');
237
+
238
+ add_meta_box('se_display_options_post_type_actions_panel', 'Post Types Actions', array(&$this, 'se_display_options_post_type_actions_panel'),
239
+ $this->pagehooks['se_manage_settings'], 'normal', 'core');
240
+
241
+ add_meta_box('se_display_options_user_actions_panel', 'Users Actions', array(&$this, 'se_display_options_user_actions_panel'),
242
+ $this->pagehooks['se_manage_settings'], 'normal', 'core');
243
+
244
+ // add_meta_box('se_options_thirdparty_panel', 'Other Plugins', array(&$this, 'se_options_thirdparty_panel'),
245
+ // $this->pagehooks['se_manage_settings'], 'normal', 'core');
246
+ }
247
+
248
+ function on_load_help_page()
249
  {
250
+ wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
251
+
252
+ wp_enqueue_script('jquery');
253
+ wp_enqueue_script('jquery-ui-core');
254
+ wp_enqueue_script('jquery-ui-widget');
255
+ wp_enqueue_script('jquery-ui-accordion');
256
+
257
+ add_meta_box('se_settings_about_sidebar', 'About this Plugin', array(&$this, 'se_settings_about_sidebar'),
258
+ $this->pagehooks['se_manage_help'], 'side', 'core');
259
+ add_meta_box('se_settings_donate_sidebar', 'Make a Donation', array(&$this, 'se_settings_donate_sidebar'),
260
+ $this->pagehooks['se_manage_help'], 'side', 'core');
261
  }
262
 
263
+ /****************************************************************************************************************************/
264
+ /* */
265
+ /* ACTIONS PANELS */
266
+ /* */
267
+ /****************************************************************************************************************************/
268
 
269
+ function se_show_taxonomy_actions_panel($taxonomy)
270
  {
271
+ if (!$taxonomy) return;
272
+
273
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]))
274
+ return;
 
 
275
 
276
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
 
277
 
278
+ ?>
279
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-actions-panel" cellpadding="3" cellspacing="3" border="0">
280
+ <thead>
281
+ <tr>
282
+ <th class="action"><?php _e('Action Name') ?></th>
283
+ <th class="description"><?php _e('Description ') ?></th>
284
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
285
+ </tr>
286
+ </thead>
287
+ <tbody>
288
+ <?php
289
+ $class="";
290
 
291
+ foreach ($this->current_taxonomy['actions'] as $action_key => $action_val)
292
+ {
293
+ $class = ('alternate' == $class) ? '' : 'alternate';
294
+ ?>
295
+ <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
296
+ <td class="action"><?php echo $this->get_taxonomy_action_label($taxonomy, $action_key, 'name'); //$action_val['name'] ?></td>
297
+ <td class="description"><?php echo $this->get_taxonomy_action_label($taxonomy, $action_key, 'description');//$action_val['description'] ?></td>
298
+ <td class="inc-excl">
299
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][actions][<?php echo $action_key ?>]" value="i"
300
+ <?php if ($action_val['action'] == 'i') echo "checked='checked'"; ?> /> <?php _e('Include only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
301
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][actions][<?php echo $action_key ?>]" value="e"
302
+ <?php if ($action_val['action'] == 'e') echo "checked='checked'"; ?> /> <?php _e('Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
303
+ </td>
304
+ <tr>
305
+ <?php
306
+ }
307
+ ?>
308
+ </tbody>
309
+ </table>
310
+ <?php
311
+ }
312
+
313
+ function se_show_post_type_actions_panel($post_type='')
314
+ {
315
+ if (!$post_type) return;
316
 
317
+ if (!isset($this->se_cfg['data']['post_types'][$post_type]))
318
+ return;
319
 
320
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
321
+ ?>
322
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-actions-panel" cellpadding="3" cellspacing="3" border="0">
323
+ <thead>
324
+ <tr>
325
+ <th class="action"><?php _e('Action Name') ?></th>
326
+ <th class="description"><?php _e('Description ') ?></th>
327
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
328
+ </tr>
329
+ </thead>
330
+ <tbody>
331
+ <?php
332
+ $class="";
333
 
334
+ foreach ($this->current_post_type['actions'] as $action_key => $action_val)
335
+ {
336
+ $class = ('alternate' == $class) ? '' : 'alternate';
337
+ ?>
338
+ <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
339
+ <td class="action"><?php echo $this->get_post_type_action_label($post_type, $action_key, 'name'); ?></td>
340
+ <td class="description"><?php echo $this->get_post_type_action_label($post_type, $action_key, 'description'); ?></td>
341
+ <td class="inc-excl">
342
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][actions][<?php echo $action_key ?>]" value="i"
343
+ <?php if ($action_val['action'] == 'i') echo "checked='checked'"; ?> /> <?php _e('Include only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
344
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][actions][<?php echo $action_key ?>]" value="e"
345
+ <?php if ($action_val['action'] == 'e') echo "checked='checked'"; ?> /> <?php _e('Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
346
+ <?php
347
+ if (($action_key == "is_home")
348
+ && ((isset($this->current_post_type['options']['capability_type'])) && ($this->current_post_type['options']['capability_type'] == "post")))
349
+ {
350
+ ?><br />
351
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][actions][<?php echo $action_key ?>]" value="a"
352
+ <?php if ($action_val['action'] == 'a') echo "checked='checked'"; ?> /> <?php _e('Include All', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
353
+ <?php
354
+ }
355
 
356
+ else if (($action_key == "is_feed")
357
+ && ((isset($this->current_post_type['options']['capability_type'])) && ($this->current_post_type['options']['capability_type'] == "post")))
358
+ {
359
+ ?><br />
360
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][actions][<?php echo $action_key ?>]" value="a"
361
+ <?php if ($action_val['action'] == 'a') echo "checked='checked'"; ?> /> <?php _e('Include All', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
362
+ <?php
363
+ }
364
+ ?>
365
+ </td>
366
+ <tr>
367
+ <?php
368
+ }
369
+ ?>
370
+ </tbody>
371
+ </table>
372
+ <?php
373
+ }
374
+
375
+ function se_show_se_type_actions_panel($se_type='')
376
  {
377
+ if (!$se_type) return;
378
+
379
+ if (!isset($this->se_cfg['data']['se_types'][$se_type]))
380
+ return;
381
+
382
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
383
  ?>
384
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-actions-panel" cellpadding="3" cellspacing="3" border="0">
385
+ <thead>
386
+ <tr>
387
+ <th class="action"><?php _e('Action Name') ?></th>
388
+ <th class="description"><?php _e('Description ') ?></th>
389
+ <th class="inc-excl"><?php _e('Inclusion/Exclusion') ?></th>
390
+ </tr>
391
+ </thead>
392
+ <tbody>
393
+ <?php
394
+ $class="";
395
+
396
+ foreach ($this->current_se_type['actions'] as $action_key => $action_val)
397
  {
398
+ $class = ('alternate' == $class) ? '' : 'alternate';
399
  ?>
400
+ <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
401
+ <td class="action"><?php echo $this->get_se_type_action_label($se_type, $action_key, 'name'); ?></td>
402
+ <td class="description"><?php echo $this->get_se_type_action_label($se_type, $action_key, 'description'); ?></td>
403
+ <td class="inc-excl">
404
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][actions][<?php echo $action_key ?>]" value="i"
405
+ <?php if ($action_val['action'] == 'i') echo "checked='checked'"; ?> /> <?php _e('Include only', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
406
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][actions][<?php echo $action_key ?>]" value="e"
407
+ <?php if ($action_val['action'] == 'e') echo "checked='checked'"; ?> /> <?php _e('Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
408
+ </td>
409
+ <tr>
410
  <?php
411
  }
412
+ ?>
413
+ </tbody>
414
+ </table>
415
+ <?php
416
+ }
417
+
418
+
419
+ /****************************************************************************************************************************/
420
+ /* */
421
+ /* ACTIVE PANELS */
422
+ /* */
423
+ /****************************************************************************************************************************/
424
+
425
+ function se_show_taxonomy_active_panel($taxonomy)
426
+ {
427
+ if (!$taxonomy) return;
428
+
429
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]))
430
+ return;
431
+
432
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
433
+ if (!isset($this->current_taxonomy['options']['active']))
434
+ $this->current_taxonomy['options']['active'] = "yes";
435
+ ?>
436
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
437
+ <thead>
438
+ <tr>
439
+ <th class="action" colspan="2"><?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
440
+ </tr>
441
+ </thead>
442
+ <tbody>
443
+ <tr>
444
+ <td class="description"><?php _e("Is this Taxonomy active? This is sometimes convenient instead of unsetting all Taxonomy terms.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
445
+ <td class="inc-excl">
446
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][active]" value="yes"
447
+ <?php if ($this->current_taxonomy['options']['active'] == 'yes')
448
+ echo "checked='checked'"; ?> /> <?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
449
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][active]" value="no"
450
+ <?php if ($this->current_taxonomy['options']['active'] == 'no')
451
+ echo "checked='checked'"; ?> /> <?php _e('Disabled', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
452
+ </td>
453
+ </tr>
454
+ </tbody>
455
+ </table>
456
+ <?php
457
  }
458
 
459
+ function se_show_post_type_active_panel($post_type)
460
  {
461
+ if (!$post_type) return;
462
+
463
+ if (!isset($this->se_cfg['data']['post_types'][$post_type]))
464
+ return;
465
+
466
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
467
+ if (!isset($this->current_post_type['options']['active']))
468
+ $this->current_post_type['options']['active'] = "yes";
469
+ ?>
470
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
471
+ <thead>
472
+ <tr>
473
+ <th class="action" colspan="2"><?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
474
+ </tr>
475
+ </thead>
476
+ <tbody>
477
+ <tr>
478
+ <td class="description"><?php _e("Is this Post Type Active? This is sometimes convenient instead of unsetting all Post Type items.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
479
+ <td class="inc-excl">
480
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][active]" value="yes"
481
+ <?php if ($this->current_post_type['options']['active'] == 'yes')
482
+ echo "checked='checked'"; ?> /> <?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
483
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][active]" value="no"
484
+ <?php if ($this->current_post_type['options']['active'] == 'no')
485
+ echo "checked='checked'"; ?> /> <?php _e('Disabled', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
486
+ </td>
487
+ </tr>
488
+ </tbody>
489
+ </table>
490
+ <?php
491
  }
492
+
493
+ function se_show_se_type_active_panel($se_type)
494
  {
495
+ if (!$se_type) return;
 
 
 
 
 
 
 
 
496
 
497
+ if (!isset($this->se_cfg['data']['se_types'][$se_type]))
498
+ return;
499
 
500
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
501
+ if (!isset($this->current_se_type['options']['active']))
502
+ $this->current_se_type['options']['active'] = "yes";
503
  ?>
504
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
505
+ <thead>
506
+ <tr>
507
+ <th class="action" colspan="2"><?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
508
+ </tr>
509
+ </thead>
510
+ <tbody>
511
+ <tr>
512
+ <td class="description"><?php _e("Active?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
513
+ <td class="inc-excl">
514
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][active]" value="yes"
515
+ <?php if ($this->current_se_type['options']['active'] == 'yes')
516
+ echo "checked='checked'"; ?> /> <?php _e('Active', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
517
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][active]" value="no"
518
+ <?php if ($this->current_se_type['options']['active'] == 'no')
519
+ echo "checked='checked'"; ?> /> <?php _e('Disabled', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
520
+ </td>
521
+ </tr>
522
+ </tbody>
523
+ </table>
524
  <?php
525
+ }
526
+
527
+
528
+
529
+ /****************************************************************************************************************************/
530
+ /* */
531
+ /* SHOW/HIDE PANELS */
532
+ /* */
533
+ /****************************************************************************************************************************/
534
+
535
+ function se_show_taxonomy_showhide_panel($taxonomy)
536
+ {
537
+ if (!$taxonomy) return;
538
+
539
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]))
540
+ return;
541
+
542
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  ?>
545
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
546
+ <thead>
547
+ <tr>
548
+ <th class="action" colspan="2"><?php _e('Show/Hide', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
549
+ </tr>
550
+ </thead>
551
+ <tbody>
552
+ <tr>
553
+ <td class="description"><?php _e("Show the extra columns on the Taxonomy listing and the Taxonomy edit form?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
554
+ <td class="inc-excl">
555
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][showhide]" value="show"
556
+ <?php if ($this->current_taxonomy['options']['showhide'] == 'show')
557
+ echo "checked='checked'"; ?> /> <?php _e('Show', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
558
+ <input type="radio" name="se_cfg[<?php echo $taxonomy; ?>][options][showhide]" value="hide"
559
+ <?php if ($this->current_taxonomy['options']['showhide'] == 'hide')
560
+ echo "checked='checked'"; ?> /> <?php _e('Hide', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
561
+ </td>
562
+ </tr>
563
+ </table>
564
  <?php
565
  }
566
+
567
+ function se_show_post_type_showhide_panel($post_type)
568
+ {
569
+ if (!$post_type) return;
570
+
571
+ if (!isset($this->se_cfg['data']['post_types'][$post_type]))
572
+ return;
573
+
574
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
575
+ ?>
576
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
577
+ <thead>
578
+ <tr>
579
+ <th class="action" colspan="2"><?php _e('Show/Hide', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
580
+ </tr>
581
+ </thead>
582
+ <tbody>
583
+ <tr>
584
+ <td class="description"><?php _e("Show the extra columns on the Post Type listing and the Post Type edit form?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
585
+ <td class="inc-excl">
586
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][showhide]" value="show"
587
+ <?php if ($this->current_post_type['options']['showhide'] == 'show')
588
+ echo "checked='checked'"; ?> /> <?php _e('Show', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
589
+ <input type="radio" name="se_cfg[<?php echo $post_type; ?>][options][showhide]" value="hide"
590
+ <?php if ($this->current_post_type['options']['showhide'] == 'hide')
591
+ echo "checked='checked'"; ?> /> <?php _e('Hide', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
592
+ </td>
593
+ </tr>
594
+ </table>
595
+ <?php
596
+ }
597
+
598
+ function se_show_se_type_showhide_panel($se_type)
599
+ {
600
+ if (!$se_type) return;
601
+
602
+ if (!isset($this->se_cfg['data']['se_types'][$se_type]))
603
+ return;
604
+
605
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
606
+ ?>
607
+ <table class="widefat simply-exclude-settings-postbox simplyexclude-active-panel" cellpadding="3" cellspacing="3" border="0">
608
+ <thead>
609
+ <tr>
610
+ <th class="action" colspan="2"><?php _e('Show/Hide', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
611
+ </tr>
612
+ </thead>
613
+ <tbody>
614
+ <tr>
615
+ <td class="description"><?php _e("Show the extra columns on the listing and the edit form?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></td>
616
+ <td class="inc-excl">
617
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][showhide]" value="show"
618
+ <?php if ($this->current_se_type['options']['showhide'] == 'show')
619
+ echo "checked='checked'"; ?> /> <?php _e('Show', SIMPLY_EXCLUDE_I18N_DOMAIN); ?><br />
620
+ <input type="radio" name="se_cfg[<?php echo $se_type; ?>][options][showhide]" value="hide"
621
+ <?php if ($this->current_se_type['options']['showhide'] == 'hide')
622
+ echo "checked='checked'"; ?> /> <?php _e('Hide', SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
623
+ </td>
624
+ </tr>
625
+ </table>
626
+ <?php
627
+ }
628
+
629
+
630
 
631
+ /****************************************************************************************************************************/
632
+ /* */
633
+ /* COLUMNS (HEADERS) */
634
+ /* */
635
+ /****************************************************************************************************************************/
636
+
637
+ function se_manage_taxonomy_columns($columns)
638
  {
639
+ if (!isset($columns['se-actions']))
640
+ $columns['se-actions'] = 'Simply Exclude <a id="se-show-actions-panel" href="#">show</a>';
641
+ return $columns;
 
 
 
 
 
 
 
 
642
  }
643
 
644
+ function se_manage_post_type_columns($columns)
645
  {
646
+ //echo "columns<pre>"; print_r($columns); echo "</pre>";
647
+ if (!isset($columns['se_actions']))
648
+ $columns['se-actions'] = 'Simply Exclude <a id="se-show-actions-panel" href="#">show</a>';
649
+ return $columns;
650
+ }
651
+
652
+ function se_manage_user_columns($columns)
653
+ {
654
+ //echo "columns<pre>"; print_r($columns); echo "</pre>";
655
+ if (!isset($columns['se_actions']))
656
+ $columns['se-actions'] = 'Simply Exclude <a id="se-show-actions-panel" href="#">show</a>';
657
 
658
+ return $columns;
659
  }
660
 
661
+
662
+ /****************************************************************************************************************************/
663
+ /* */
664
+ /* COLUMNS (ACTIONS) */
665
+ /* */
666
+ /****************************************************************************************************************************/
667
+
668
+ function se_display_taxonomy_column_actions($junk, $column_name, $term_id)
669
  {
670
+ global $taxonomy, $post_type;
671
+
672
+ if ($column_name == "se-actions")
673
  {
674
+ if ($taxonomy)
675
+ {
676
+ $term = get_term( $term_id, $taxonomy );
677
+ if ($term)
678
+ {
679
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
680
+ $this->se_display_taxonomy_term_action_row($taxonomy, $term);
681
+ }
682
+ }
683
  }
 
 
 
684
  }
685
+
686
+ function se_display_post_type_column_actions($column_name, $post_id)
687
  {
688
+ global $post_type;
689
+
690
+ if ($column_name == "se-actions")
691
  {
692
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
693
+
694
+ if ($post_id)
695
+ {
696
+ $p_item = get_post( $post_id );
697
+ if ($p_item)
698
+ {
699
+ $this->se_display_post_type_action_row($post_type, $p_item);
700
+ }
701
+ }
702
  }
 
 
 
703
  }
704
 
705
+ function se_display_user_column_actions($junk, $column_name, $user_id )
706
+ {
707
+ if ($column_name == "se-actions")
 
708
  {
709
+ $se_type = "users";
710
+ if (isset($this->se_cfg['data']['se_types'][$se_type]))
711
+ {
712
+ ob_start();
713
+
714
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
715
+ if ($user_id)
716
+ {
717
+ $user = get_userdata($user_id);
718
+ if ($user)
719
+ {
720
+ $this->se_display_user_action_row($se_type, $user);
721
+ }
722
+ }
723
+
724
+ $out = ob_get_contents();
725
+ ob_end_clean();
726
+ return $out;
727
+ }
728
  }
 
 
 
 
729
  }
730
 
731
 
732
+ /****************************************************************************************************************************/
733
+ /* */
734
+ /* COLUMNS ACTION ROW */
735
+ /* */
736
+ /****************************************************************************************************************************/
737
+
738
+ function se_display_taxonomy_term_action_row($taxonomy='', $term='')
739
  {
740
+ if (!$taxonomy) return;
741
+ if (!$term) return;
742
+
743
+ if ((isset($this->current_taxonomy['actions'])) && (count($this->current_taxonomy['actions'])))
744
+ {
745
+ foreach ($this->current_taxonomy['actions'] as $action_key => $action_val)
746
+ {
747
+ ?>
748
+ <input type="checkbox"
749
+ name="se_cfg[<?php echo $taxonomy; ?>][terms][<?php echo $action_key ?>][<?php echo $term->term_id ?>]"
750
+ id="<?php echo $taxonomy; ?>-<?php echo $action_key ?>-<?php echo $term->term_id ?>" class="se-term-input"
751
  <?php
752
+ if ((isset($this->current_taxonomy['terms'][$action_key][$term->term_id]))
753
+ && ($this->current_taxonomy['terms'][$action_key][$term->term_id] == "on"))
754
+ echo "checked='checked' ";
755
+ ?> />&nbsp;<label for="<?php echo $taxonomy; ?>-<?php echo $action_key ?>-<?php echo $term->term_id ?>"
756
+ class="se-term-label"><?php echo $this->get_taxonomy_action_label($taxonomy, $action_key, 'name'); ?></label><br />
757
+
758
  <?php
759
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  }
 
761
  }
762
 
763
+ function se_display_post_type_action_row($post_type='', $p_item='')
 
 
 
 
 
 
 
 
 
 
764
  {
765
+ if (!$post_type) return;
766
+ if (!$p_item) return;
 
 
767
 
768
+ if ((isset($this->current_post_type['actions'])) && (count($this->current_post_type['actions'])))
769
  {
770
+ foreach ($this->current_post_type['actions'] as $action_key => $action_val)
771
+ {
772
+ ?>
773
+ <input type="checkbox"
774
+ name="se_cfg[<?php echo $post_type; ?>][terms][<?php echo $action_key ?>][<?php echo $p_item->ID ?>]"
775
+ id="<?php echo $post_type; ?>-<?php echo $action_key ?>-<?php echo $p_item->ID ?>" class="se-term-input"
776
+ <?php
777
+
778
+ if ((isset($this->current_post_type['terms'][$action_key][$p_item->ID]))
779
+ && ($this->current_post_type['terms'][$action_key][$p_item->ID] == "on"))
780
+ echo "checked='checked' ";
781
+ ?> />&nbsp;<label for="<?php echo $post_type; ?>-<?php echo $action_key ?>-<?php echo $p_item->ID ?>">
782
+ <?php echo $this->get_post_type_action_label($post_type, $action_key, 'name') ?></label><br />
783
+
784
+ <?php
785
+ }
786
  }
 
787
  }
788
 
789
+ function se_display_user_action_row($se_type, $user)
 
790
  {
791
+ if (!$se_type) return;
792
+ if (!$user) return;
793
+
794
+ // Ths current_se_type is set in the caller.
795
+ if ((isset($this->current_se_type['actions'])) && (count($this->current_se_type['actions'])))
796
  {
797
+ foreach ($this->current_se_type['actions'] as $action_key => $action_val)
798
+ {
799
+ ?>
800
+ <input type="checkbox"
801
+ name="se_cfg[<?php echo $se_type; ?>][terms][<?php echo $action_key ?>][<?php echo $user->ID ?>]"
802
+ id="<?php echo $se_type; ?>-<?php echo $action_key ?>-<?php echo $user->ID ?>" class="se-term-input"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
  <?php
 
804
 
805
+ if ((isset($this->current_se_type['terms'][$action_key][$user->ID]))
806
+ && ($this->current_se_type['terms'][$action_key][$user->ID] == "on"))
807
+ echo "checked='checked' ";
808
+ ?> />&nbsp;<label for="<?php echo $se_type; ?>-<?php echo $action_key ?>-<?php echo $user->ID ?>">
809
+ <?php echo $this->get_se_type_action_label($se_type, $action_key, 'name') ?></label><br />
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
  <?php
812
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  }
814
  }
815
 
816
+
817
+
818
+ /****************************************************************************************************************************/
819
+ /* */
820
+ /* USER PROFILE */
821
+ /* */
822
+ /****************************************************************************************************************************/
823
+
824
+ function se_show_user_profile($profileuser)
825
  {
826
+ $se_type = "users";
827
+ $this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
 
 
 
 
 
 
 
 
828
  ?>
829
+ <table class="form-table">
830
+ <tr>
831
+ <th><label for="simply-exclude">Simply-Exclude</label></th>
832
+ <td class="cat-action"><?php $this->se_display_user_action_row('users', $profileuser) ?></td>
833
  </tr>
834
+ </table>
835
+
836
  <?php
837
+
838
  }
839
 
840
+ function se_save_user_profile($user_id)
841
  {
842
+ if (!$user_id)
843
+ return;
844
+
845
+ $this->se_load_config();
846
+
847
+ // First remove all traces of the post item in the actions
848
+ $se_type = "users";
849
+
850
+ if ((isset($this->se_cfg['data']['se_types'][$se_type]['terms'])) && (count($this->se_cfg['data']['se_types'][$se_type]['terms'])))
851
  {
852
+ foreach($this->se_cfg['data']['se_types'][$se_type]['terms'] as $cfg_action => $cfg_action_items)
853
+ {
854
+ foreach($cfg_action_items as $action_id => $action_val)
855
+ {
856
+ if ($action_id == $_REQUEST['user_id'])
857
+ {
858
+ unset($this->se_cfg['data']['se_types'][$se_type]['terms'][$cfg_action][$action_id]);
859
+ }
860
+ }
861
+ }
 
 
862
  }
 
 
 
 
863
 
864
+ if (isset($_REQUEST['se_cfg']))
 
 
 
 
 
 
 
 
865
  {
866
+ $se_cfg = $_REQUEST['se_cfg'];
867
+
868
+ // Now add back the items which were checked.
869
+ foreach($se_cfg as $se_type => $se_type_items)
870
+ {
871
+ foreach($se_type_items as $term => $se_items)
872
+ {
873
+ foreach($se_items as $action => $action_items)
874
+ {
875
+ foreach($action_items as $action_id => $action_val)
876
+ {
877
+ $this->se_cfg['data']['se_types'][$se_type][$term][$action][$action_id] = $action_val;
878
+ }
879
+ }
880
+ }
881
+ }
882
  }
883
+ $this->se_save_config();
884
  }
885
+
886
+
887
 
888
+
889
+ /****************************************************************************************************************************/
890
+ /* */
891
+ /* POST DBX SIDEBAR FOR POST TYPES */
892
+ /* */
893
+ /****************************************************************************************************************************/
894
+
895
+ function show_post_type_exclude_sidebar_dbx()
896
  {
897
+ global $post;
898
+
899
+ if (isset($this->se_cfg['data']['post_types'][$post->post_type]))
900
  {
901
+ $this->current_post_type = $this->se_cfg['data']['post_types'][$post->post_type];
902
+ $this->se_display_post_type_action_row($post->post_type, $post);
903
  }
904
  }
905
+
906
+ function save_post_type_exclude_sidebar_dbx($post_id)
 
907
  {
908
+ if (!$post_id)
909
+ return;
910
+
911
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
912
+ return;
913
+
914
+ if ( wp_is_post_revision( $post_id ) )
915
+ return;
916
+
917
+ $this->se_load_config();
918
+
919
+ if( (isset($_REQUEST['post_type'])) && (isset($_REQUEST['post_ID'])))
920
  {
921
+ // First remove all traces of the post item in the actions
922
+ $post_type = $_REQUEST['post_type'];
923
+ if (isset($this->se_cfg['data']['post_types'][$post_type]['terms']))
924
+ {
925
+ foreach($this->se_cfg['data']['post_types'][$post_type]['terms'] as $cfg_action => $cfg_action_items)
 
 
 
 
 
 
 
 
 
 
 
 
926
  {
927
+ foreach($cfg_action_items as $action_id => $action_val)
928
+ {
929
+ if ($action_id == $_REQUEST['post_ID'])
930
+ {
931
+ unset($this->se_cfg['data']['post_types'][$post_type]['terms'][$cfg_action][$action_id]);
932
+ }
933
+ }
 
 
 
 
 
 
 
 
 
 
934
  }
935
+ }
936
+
937
+ if (isset($_REQUEST['se_cfg']))
938
+ {
939
+ $se_cfg = $_REQUEST['se_cfg'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
940
 
941
+ // Now add back the items which were checked.
942
+ foreach($se_cfg as $post_type => $post_type_items)
943
+ {
944
+ foreach($post_type_items as $term => $term_items)
945
+ {
946
+ foreach($term_items as $action => $action_items)
947
+ {
948
+ foreach($action_items as $action_id => $action_val)
949
+ {
950
+ $this->se_cfg['data']['post_types'][$post_type][$term][$action][$action_id] = $action_val;
951
+ }
952
+ }
 
 
 
 
 
953
  }
954
+ }
955
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
957
+ $this->se_save_config();
958
  }
959
+
960
+
961
+
962
+
963
+
964
+ /****************************************************************************************************************************/
965
+ /* */
966
+ /* TAXONOMY EXTRA FIELDS */
967
+ /* */
968
+ /****************************************************************************************************************************/
969
+
970
+ function se_show_taxonomy_term_fields()
971
  {
972
+ if (!isset($_REQUEST['tag_ID']))
973
+ return;
974
+
975
+ if (!isset($_REQUEST['taxonomy']))
976
+ return;
977
+
978
+ $this->se_load_config();
979
+
980
+ $this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$_REQUEST['taxonomy']];
981
+ $term = get_term_by("ID", $_REQUEST['tag_ID'], $_REQUEST['taxonomy']);
982
  ?>
983
+ <tr class="form-field">
984
+ <th scope="row" valign="top"><label for="description"><br />
985
+ <?php _ex('Simply Exclude', 'Simply Exclude'); ?></label></th>
986
+ <td class="cat-action"><?php $this->se_display_taxonomy_term_action_row($_REQUEST['taxonomy'], $term) ?></td>
987
  </tr>
988
  <?php
989
  }
990
+
991
+ function se_save_taxonomy_term_fields($term_id, $tt_id, $taxonomy)
992
  {
993
+ $this->se_load_config();
994
+
995
+ if ((isset($taxonomy)) && (isset($term_id)))
996
  {
997
+ // First remove all traces of the taxonomy item in the actions
998
+ foreach($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'] as $cfg_action => $cfg_action_items)
999
+ {
1000
+ foreach($cfg_action_items as $action_id => $action_val)
1001
+ {
1002
+ if ($action_id == $term_id)
1003
+ {
1004
+ unset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$cfg_action][$action_id]);
1005
+ }
1006
+ }
1007
+ }
1008
+
1009
+ if (isset($_REQUEST['se_cfg']))
1010
+ {
1011
+ $se_cfg = $_REQUEST['se_cfg'];
1012
+
1013
+ // Now add back the items which were checked.
1014
+ foreach($se_cfg as $taxonomy => $taxonomy_items)
1015
+ {
1016
+ foreach($taxonomy_items as $term => $term_items)
1017
+ {
1018
+ foreach($term_items as $action => $action_items)
1019
+ {
1020
+ foreach($action_items as $action_id => $action_val)
1021
+ {
1022
+ $this->se_cfg['data']['taxonomies'][$taxonomy][$term][$action][$action_id] = $action_val;
1023
+ }
1024
+ }
1025
+ }
1026
+ }
1027
+ }
1028
+ $this->se_save_config();
1029
  }
1030
  }
 
1031
 
 
 
1032
 
1033
+ /****************************************************************************************************************************/
1034
+ /* */
1035
+ /* LOAD CONFIG */
1036
+ /* */
1037
+ /****************************************************************************************************************************/
1038
 
1039
+ function se_load_config()
1040
+ {
1041
+ $tmp_se_cfg = get_option($this->options_key);
1042
+ //echo "se_cfg<pre>"; print_r($tmp_se_cfg); echo "</pre>";
1043
+ //die();
1044
+
1045
+ //$tmp_se_cfg = '';
1046
+ if (!$tmp_se_cfg)
1047
  {
1048
+ // If we don't find the main SE option then assume we are upgrading to grab via the old 'key'
1049
+ $tmp_se_cfg = get_option('simplyexclude');
1050
+ if (is_serialized($tmp_se_cfg))
1051
+ $this->se_cfg = unserialize($tmp_se_cfg);
1052
  else
1053
+ $this->se_cfg = $tmp_se_cfg;
1054
 
1055
+ if (isset($this->se_cfg['cfg']['myurl']))
1056
+ unset($this->se_cfg['cfg']['myurl']);
1057
+
1058
+ // Here assumed older data structure. Need to convert the old array elements to match the new Taxonomy tags
1059
+ if (isset($this->se_cfg['cats']))
1060
+ {
1061
+ $this->se_cfg['data']['taxonomies']['category'] = $this->se_cfg['cats'];
1062
+ unset($this->se_cfg['cats']);
1063
+ }
1064
+ if (isset($this->se_cfg['tags']))
1065
+ {
1066
+ $this->se_cfg['data']['taxonomies']['post_tag'] = $this->se_cfg['tags'];
1067
+ unset($this->se_cfg['tags']);
1068
+ }
1069
+ if (isset($this->se_cfg['authors']))
1070
+ {
1071
+ $this->se_cfg['data']['se_types']['users'] = $this->se_cfg['authors'];
1072
+ unset($this->se_cfg['authors']);
1073
+ }
1074
+ if (isset($this->se_cfg['pages']))
1075
+ {
1076
+ $this->se_cfg['data']['post_types']['pages'] = $this->se_cfg['pages'];
1077
+ unset($this->se_cfg['pages']);
1078
+ }
1079
+ /*
1080
+ if (isset($this->se_cfg['options']['google-sitemap-generator']))
1081
+ {
1082
+ $this->se_cfg['options']['plugins']['google-sitemap-generator'] = $this->se_cfg['options']['google-sitemap-generator'];
1083
+ unset($this->se_cfg['options']['google-sitemap-generator']);
1084
+
1085
+ if (!isset($this->se_cfg['options']['plugins']['google-sitemap-generator']['plugin_key']))
1086
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['plugin_key'] = "google-sitemap-generator/sitemap.php";
1087
+ }
1088
+
1089
+ if (isset($this->se_cfg['options']['search-unleashed']))
1090
+ {
1091
+ $this->se_cfg['options']['plugins']['search-unleashed'] = $this->se_cfg['options']['search-unleashed'];
1092
+ unset($this->se_cfg['options']['search-unleashed']);
1093
+
1094
+ if (!isset($this->se_cfg['options']['plugins']['search-unleashed']['plugin_key']))
1095
+ $this->se_cfg['options']['plugins']['search-unleashed']['plugin_key'] = "search-unleashed/search-unleashed.php";
1096
+ }
1097
+ */
1098
  }
1099
+ else if ($tmp_se_cfg)
1100
+ {
1101
+ if (is_serialized($tmp_se_cfg))
1102
+ $this->se_cfg = unserialize($tmp_se_cfg);
1103
+ else
1104
+ $this->se_cfg = $tmp_se_cfg;
1105
 
1106
+ if (!isset($this->se_cfg['cfg']['version']))
1107
+ $this->se_cfg['cfg']['version'] = $this->se_version;
1108
+ }
1109
+
1110
+ $se_taxonomies = $this->se_load_taxonomy_list();
1111
+ if ($se_taxonomies)
1112
  {
1113
+ foreach($se_taxonomies as $t_idx => $t_item)
1114
+ {
1115
+ if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['actions']))
1116
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['actions'] = array();
1117
+
1118
+ $actions = $this->se_load_taxonomy_default_actions($t_item->name);
1119
+ if ($actions)
1120
+ {
1121
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['actions'] = array_merge($actions,
1122
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['actions']);
1123
+ }
1124
+
1125
+ ksort($this->se_cfg['data']['taxonomies'][$t_item->name]['actions']);
1126
+
1127
+ if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']))
1128
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options'] = array();
1129
+
1130
+ if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['active']))
1131
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['active'] = 'yes';
1132
+
1133
+ if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide']))
1134
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'show';
1135
+
1136
+ if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "yes")
1137
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'show';
1138
+ else if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "no")
1139
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'hide';
1140
+
1141
+ $this->se_cfg['data']['taxonomies'][$t_item->name]['options']['hierarchical'] = $t_item->hierarchical;
1142
+
1143
+ }
1144
  }
1145
+
1146
+ $se_post_types = $this->se_load_post_type_list();
1147
+ if ($se_post_types)
 
 
 
1148
  {
1149
+ foreach($se_post_types as $t_idx => $t_item)
1150
+ {
1151
+ if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['actions']))
1152
+ $this->se_cfg['data']['post_types'][$t_item->name]['actions'] = array();
1153
+
1154
+ $actions = $this->se_load_post_type_default_actions($t_item->name);
1155
+ if ($actions)
 
 
 
 
 
 
 
 
 
 
1156
  {
1157
+ $this->se_cfg['data']['post_types'][$t_item->name]['actions'] = array_merge($actions,
1158
+ $this->se_cfg['data']['post_types'][$t_item->name]['actions']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1159
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1160
 
1161
+ ksort($this->se_cfg['data']['post_types'][$t_item->name]['actions']);
 
 
 
 
 
 
 
 
 
 
 
1162
 
1163
+ if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']))
1164
+ $this->se_cfg['data']['post_types'][$t_item->name]['options'] = array();
 
 
 
 
 
 
 
 
1165
 
1166
+ if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['active']))
1167
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['active'] = 'yes';
1168
+ if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
1169
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
1170
 
1171
+ if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "yes")
1172
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
1173
+ else if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "no")
1174
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'hide';
1175
+
1176
+ $this->se_cfg['data']['post_types'][$t_item->name]['options']['capability_type'] = $t_item->capability_type;
1177
+ }
1178
  }
 
 
 
 
1179
 
1180
+ $se_types = $this->se_load_se_type_list();
1181
+ if ($se_types)
 
 
1182
  {
1183
+ foreach($se_types as $t_idx => $t_item)
1184
+ {
1185
+ if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['actions']))
1186
+ $this->se_cfg['data']['se_types'][$t_item['name']]['actions'] = array();
1187
+
1188
+ $actions = $this->se_load_se_type_default_actions($t_item['name']);
1189
+ if ($actions)
 
 
 
 
 
 
 
 
 
1190
  {
1191
+ $this->se_cfg['data']['se_types'][$t_item['name']]['actions'] = array_merge($actions,
1192
+ $this->se_cfg['data']['se_types'][$t_item['name']]['actions']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1193
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
 
1195
+ if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']))
1196
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options'] = array();
 
 
 
 
 
 
1197
 
1198
+ if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['active']))
1199
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options']['active'] = 'yes';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1200
 
1201
+ if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide']))
1202
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
1203
 
1204
+ if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "yes")
1205
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
1206
+ else if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "no")
1207
+ $this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'hide';
1208
+ }
 
 
 
 
 
 
 
 
 
1209
  }
 
 
 
 
 
 
1210
 
 
 
1211
 
1212
+ if (!isset($this->se_cfg['options']))
1213
+ $this->se_cfg['options'] = array();
1214
+ /*
1215
+ $this->se_cfg['options']['plugins'] = array();
1216
+
1217
+ $this->se_cfg['options']['plugins']['google-sitemap-generator'] = array();
1218
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['name'] = __("Google XML Sitemaps", SIMPLY_EXCLUDE_I18N_DOMAIN);
1219
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['url'] = "http://wordpress.org/extend/plugins/google-sitemap-generator/";
1220
+ $this->se_cfg['options']['plugins']['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", SIMPLY_EXCLUDE_I18N_DOMAIN);
1221
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['version'] = "3.1.6";
1222
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['active'] = false;
1223
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['plugin_key'] = "google-sitemap-generator/sitemap.php";
1224
 
1225
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['actions'] = array();
1226
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['pages']['desc'] = __("Update Excluded Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
1227
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['pages']['update'] = false;
1228
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['categories']['desc'] = __("Update Excluded Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
1229
+ $this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['categories']['update'] = false;
 
 
 
 
 
 
1230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1231
 
1232
+ $this->se_cfg['options']['plugins']['search-unleashed'] = array();
1233
+ $this->se_cfg['options']['plugins']['search-unleashed']['name'] = __("Search Unleashed", SIMPLY_EXCLUDE_I18N_DOMAIN);
1234
+ $this->se_cfg['options']['plugins']['search-unleashed']['url'] = "http://wordpress.org/extend/plugins/search-unleashed/";
1235
+ $this->se_cfg['options']['plugins']['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", SIMPLY_EXCLUDE_I18N_DOMAIN);
1236
+ $this->se_cfg['options']['plugins']['search-unleashed']['version'] = "1.0.5";
1237
+ $this->se_cfg['options']['plugins']['search-unleashed']['active'] = false;
1238
+ $this->se_cfg['options']['plugins']['search-unleashed']['plugin_key'] = "search-unleashed/search-unleashed.php";
1239
 
1240
+ $this->se_cfg['options']['plugins']['search-unleashed']['actions'] = array();
1241
+ $this->se_cfg['options']['plugins']['search-unleashed']['actions']['pages']['desc'] = __("Update Excluded Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
1242
+ $this->se_cfg['options']['plugins']['search-unleashed']['actions']['pages']['update'] = false;
1243
+ $this->se_cfg['options']['plugins']['search-unleashed']['actions']['categories']['desc'] = __("Update Excluded Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
1244
+ $this->se_cfg['options']['plugins']['search-unleashed']['actions']['categories']['update'] = false;
1245
+ $this->se_cfg['options']['plugins']['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", SIMPLY_EXCLUDE_I18N_DOMAIN);
1246
+
1247
+ foreach($this->se_cfg['options']['plugins'] as $plugin => $plugin_data)
1248
  {
1249
+ if ((isset($plugin_data['plugin_key'])) && (strlen($plugin_data['plugin_key'])))
1250
  {
1251
+ if ($this->is_plugin_active($plugin_data['plugin_key']))
1252
  {
1253
+ $this->se_cfg['options']['plugins'][$plugin]['active'] = true;
 
 
 
 
 
 
 
 
 
 
 
 
1254
  }
 
 
 
 
 
 
 
1255
  }
1256
  }
1257
+ */
1258
+ // echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
1259
+ }
1260
+
1261
+ function is_plugin_active( $plugin ) {
1262
+ if (is_admin())
1263
+ {
1264
+ return is_plugin_active($plugin);
1265
+ }
1266
+ else
1267
+ {
1268
+ return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
1269
+ }
1270
  }
1271
 
1272
+
1273
+ function se_save_config()
1274
+ {
1275
+ $ret = update_option($this->options_key, serialize($this->se_cfg));
1276
+ }
1277
+
1278
+ /*
1279
  function se_load_options()
1280
  {
1281
  $check_plugins = get_option('active_plugins');
1289
  }
1290
  }
1291
  }
1292
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1293
 
1294
+ /****************************************************************************************************************************/
1295
+ /* */
1296
+ /* LOAD TYPES (TAX, POST, SE) */
1297
+ /* */
1298
+ /****************************************************************************************************************************/
1299
 
1300
+ function se_load_taxonomy_list()
 
 
 
 
 
1301
  {
1302
+ $se_taxonomies = array();
 
 
 
 
 
 
 
1303
 
1304
+ $taxonomies = get_taxonomies();
1305
+ if ( $taxonomies )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1306
  {
1307
+ foreach($taxonomies as $tax_item)
1308
  {
1309
+ if (array_search($tax_item, $this->se_taxonomies_exclude) !== false)
1310
+ continue;
1311
+
1312
+ $tax_struct = get_taxonomy($tax_item);
1313
+ if ($tax_struct)
1314
  {
1315
+ $se_taxonomies[$tax_struct->labels->name] = $tax_struct;
1316
+ }
 
 
 
 
 
 
 
 
 
1317
  }
1318
  }
1319
+ ksort($se_taxonomies);
1320
+ return $se_taxonomies;
1321
+ }
1322
+
1323
+ function se_load_post_type_list()
1324
+ {
1325
+ $se_post_types = array();
1326
 
1327
+ $post_types = get_post_types();
1328
+ if ( $post_types )
1329
  {
1330
+ foreach($post_types as $post_type_item)
1331
  {
1332
+ if (array_search($post_type_item, $this->se_post_types_exclude) !== false)
1333
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1334
 
1335
+ $post_type_struct = get_post_type_object($post_type_item);
1336
+ if ($post_type_struct)
 
 
 
1337
  {
1338
+ $se_post_types[$post_type_struct->labels->name] = $post_type_struct;
1339
+ }
 
1340
  }
1341
  }
1342
+ ksort($se_post_types);
1343
+ return $se_post_types;
1344
  }
1345
+
1346
+ function se_load_se_type_list()
1347
  {
1348
+ $se_types['users'] = array(
1349
+ 'name' => 'users'
1350
+ );
 
 
 
 
 
 
 
 
 
 
1351
 
1352
+ ksort($se_types);
1353
+ return $se_types;
1354
+ }
1355
+
1356
+
1357
+ /****************************************************************************************************************************/
1358
+ /* */
1359
+ /* LOAD TYPE DEFAULT ACTIONS */
1360
+ /* */
1361
+ /****************************************************************************************************************************/
1362
+
1363
+ function se_load_taxonomy_default_actions($taxonomy)
1364
  {
1365
+ if (!$taxonomy) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
 
1367
+ $taxonomy_actions['is_home']['action'] = "i";
1368
+ $taxonomy_actions['is_archive']['action'] = "e";
1369
+ $taxonomy_actions['is_search']['action'] = "e";
1370
+ $taxonomy_actions['is_feed']['action'] = "e";
 
 
 
 
 
 
 
 
 
 
1371
 
1372
+ if ($taxonomy == "category")
1373
+ {
1374
+ $taxonomy_actions['widget_category']['action'] = "e";
1375
+ $taxonomy_actions['widget_tag_cloud']['action'] = "e";
 
1376
  }
1377
+
1378
+ if ($taxonomy == "post_tag")
1379
  {
1380
+ $taxonomy_actions['widget_tag_cloud']['action'] = "e";
 
 
 
 
 
 
 
 
 
 
 
1381
  }
1382
 
1383
+ return $taxonomy_actions;
1384
+ }
1385
 
1386
 
1387
+ function se_load_post_type_default_actions($post_type)
 
 
1388
  {
1389
+ if (!$post_type) return;
 
 
1390
 
1391
+ $taxonomy_actions = array();
 
 
 
1392
 
1393
+ $post_type_object = get_post_type_object($post_type);
1394
 
1395
+ if ($post_type_object->capability_type == "post")
1396
+ {
1397
+ $taxonomy_actions['is_home']['action'] = "i";
1398
+ $taxonomy_actions['is_archive']['action'] = "e";
1399
+ $taxonomy_actions['is_search']['action'] = "e";
1400
+ $taxonomy_actions['is_feed']['action'] = "e";
 
 
1401
  }
1402
+ else if ($post_type == "page")
1403
+ {
1404
+ $taxonomy_actions['is_search']['action'] = "e";
1405
+ $taxonomy_actions['widget_pages']['action'] = "e";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1406
  }
1407
+ else
1408
+ {
1409
+ $taxonomy_actions['is_search']['action'] = "e";
1410
+ }
1411
+ return $taxonomy_actions;
1412
+ }
1413
+
1414
 
1415
+ function se_load_se_type_default_actions()
1416
  {
1417
+ $taxonomy_actions['is_home']['action'] = "i";
1418
+ $taxonomy_actions['is_archive']['action'] = "e";
1419
+ $taxonomy_actions['is_search']['action'] = "e";
1420
+ $taxonomy_actions['is_feed']['action'] = "e";
 
 
 
 
 
 
 
 
 
1421
 
1422
+ return $taxonomy_actions;
1423
  }
1424
 
1425
 
1426
+
1427
+ /****************************************************************************************************************************/
1428
+ /* */
1429
+ /* ACTION LABELS */
1430
+ /* */
1431
+ /****************************************************************************************************************************/
1432
+
1433
+ function get_taxonomy_action_label($taxonomy, $action, $key)
1434
  {
1435
+ // echo "taxonomy=[". $taxonomy ."]<br />";
1436
+ // echo "action=[". $action ."]<br />";
1437
+ // echo "key=[". $key ."]<br />";
 
1438
 
1439
+ switch($action)
1440
+ {
1441
+ case 'is_home':
1442
 
1443
+ switch($key)
1444
+ {
1445
+ case 'name':
1446
+ return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);;
1447
+ break;
1448
 
1449
+ case 'description':
1450
+ return __("Visibility on the front/main page.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1451
 
1452
+ default:
1453
+ return;
1454
+ }
1455
+ return;
1456
+ break;
1457
 
1458
+ case 'is_archive':
 
 
 
 
 
 
 
 
1459
 
1460
+ switch($key)
1461
+ {
1462
+ case 'name':
1463
+ return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
1464
+ break;
1465
 
1466
+ case 'description':
1467
+ return __("Visibility on the archive of categories on the sidebar.", SIMPLY_EXCLUDE_I18N_DOMAIN);
 
 
 
 
 
 
 
 
 
 
 
1468
 
1469
+ default:
1470
+ return;
1471
+ }
1472
+ return;
1473
+ break;
 
 
 
1474
 
1475
 
1476
+ case 'is_search':
 
 
 
1477
 
1478
+ switch($key)
1479
+ {
1480
+ case 'name':
1481
+ return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
1482
+ break;
1483
 
1484
+ case 'description':
1485
+ return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
 
1486
 
1487
+ default:
1488
+ return;
1489
+ }
1490
+ return;
1491
+ break;
1492
 
 
 
1493
 
1494
+ case 'is_feed':
 
 
1495
 
1496
+ switch($key)
1497
+ {
1498
+ case 'name':
1499
+ return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
1500
+ break;
1501
 
1502
+ case 'description':
1503
+ return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1504
 
1505
+ default:
1506
+ return;
 
1507
  }
1508
+ return;
1509
+ break;
1510
+
1511
+ case 'widget_category':
1512
+ if ($taxonomy == "category")
1513
+ {
1514
+ switch($key)
1515
+ {
1516
+ case 'name':
1517
+ return __("Widget: Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
1518
+ break;
1519
+
1520
+ case 'description':
1521
+ return __("Exclude from WordPress List Category Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1522
+ break;
1523
+
1524
+ default:
1525
+ return;
1526
+ break;
1527
+ }
1528
+ }
1529
+ return;
1530
+ break;
1531
+
1532
+ case 'widget_tag_cloud':
1533
+ if (($taxonomy == "post_tag") || ($taxonomy == "category"))
1534
+ {
1535
+ switch($key)
1536
+ {
1537
+ case 'name':
1538
+ return __("Widget: Tag Cloud", SIMPLY_EXCLUDE_I18N_DOMAIN);
1539
+ break;
1540
+
1541
+ case 'description':
1542
+ return __("Exclude from WordPress Tag Cloud Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1543
+ break;
1544
+
1545
+ default:
1546
+ return;
1547
+ break;
1548
+ }
1549
+ }
1550
+ return;
1551
+ break;
1552
+
1553
+ default:
1554
+ return;
1555
+ break;
1556
+ }
1557
  }
1558
+
1559
+ function get_post_type_action_label($post_type, $action, $key)
1560
  {
1561
+ // echo "post_type=[". $post_type ."]<br />";
1562
+ // echo "action=[". $action ."]<br />";
1563
+ // echo "key=[". $key ."]<br />";
1564
 
1565
+ switch($action)
1566
+ {
1567
+ case 'is_home':
 
 
 
 
1568
 
1569
+ switch($key)
1570
+ {
1571
+ case 'name':
1572
+ return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);
1573
+ break;
1574
 
1575
+ case 'description':
1576
+ return __("Visibility on the front/main page. Set 'Include All' to have this Post Type displayed in addition to the normal Posts.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1577
 
1578
+ default:
1579
+ return;
1580
+ }
1581
+ return;
1582
+ break;
1583
 
1584
+ case 'is_archive':
1585
+
1586
+ switch($key)
1587
+ {
1588
+ case 'name':
1589
+ return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
1590
+ break;
1591
+
1592
+ case 'description':
1593
+ return __("Visibility on the Post Type archive.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1594
+
1595
+ default:
1596
+ return;
1597
+ }
1598
+ return;
1599
+ break;
1600
 
1601
+ case 'is_feed':
 
 
 
1602
 
1603
+ switch($key)
 
1604
  {
1605
+ case 'name':
1606
+ return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
1607
+ break;
1608
+
1609
+ case 'description':
1610
+ return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1611
+
1612
+ default:
1613
+ return;
1614
  }
1615
+ return;
1616
+ break;
 
1617
 
1618
+ case 'is_search':
1619
+
1620
+ switch($key)
1621
+ {
1622
+ case 'name':
1623
+ return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
1624
+ break;
1625
+
1626
+ case 'description':
1627
+ return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1628
+
1629
+ default:
1630
+ return;
1631
+ }
1632
+ return;
1633
+ break;
1634
+
1635
+ case 'widget_pages':
1636
+ switch($key)
1637
+ {
1638
+ case 'name':
1639
+ return __("Widget: Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
1640
+ break;
1641
+
1642
+ case 'description':
1643
+ return __("Exclude from WordPress Pages Widget. Child pages are automatically excluded if the parent is Excluded.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1644
+
1645
+ default:
1646
+ return;
1647
+ }
1648
+ return;
1649
+ break;
1650
+
1651
+ default:
1652
+ return;
1653
+ break;
1654
+
1655
+ }
1656
+ }
1657
 
1658
+ function get_se_type_action_label($se_type, $action, $key)
1659
+ {
1660
+ switch($action)
 
 
 
 
 
 
1661
  {
1662
+ case 'is_home':
1663
+
1664
+ switch($key)
 
1665
  {
1666
+ case 'name':
1667
+ return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);
1668
+ break;
1669
+
1670
+ case 'description':
1671
+ return __("Visibility on the front/main page.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1672
+ break;
1673
+
1674
+ default:
1675
+ return;
1676
  }
1677
+ return;
1678
+ break;
 
 
 
 
1679
 
1680
+ case 'is_archive':
 
 
 
 
 
 
 
 
 
 
1681
 
1682
+ switch($key)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1683
  {
1684
+ case 'name':
1685
+ return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
1686
+ break;
1687
+
1688
+ case 'description':
1689
+ return __("Visibility on the archive of categories on the sidebar.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1690
+ break;
1691
+
1692
+ default:
1693
+ return;
1694
  }
1695
+ return;
1696
+ break;
1697
+
1698
+ case 'is_search':
1699
+
1700
+ switch($key)
1701
+ {
1702
+ case 'name':
1703
+ return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
1704
+ break;
1705
+
1706
+ case 'description':
1707
+ return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1708
+ break;
1709
+
1710
+ default:
1711
+ return;
1712
+ }
1713
+ return;
1714
+ break;
1715
+
1716
+ case 'is_feed':
1717
+
1718
+ switch($key)
1719
+ {
1720
+ case 'name':
1721
+ return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
1722
+ break;
1723
+
1724
+ case 'description':
1725
+ return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
1726
+ break;
1727
+
1728
+ default:
1729
+ return;
1730
+ }
1731
+ return;
1732
+ break;
1733
+
1734
+ default:
1735
+ return;
1736
+ break;
1737
  }
 
1738
  }
1739
+
1740
+
1741
+ /****************************************************************************************************************************/
1742
+ /* */
1743
+ /* SE FILTER LOGIC */
1744
+ /* */
1745
+ /****************************************************************************************************************************/
1746
 
1747
+ function se_filters($query)
1748
  {
1749
+ global $wp_query;
1750
+
1751
+ if ($wp_query != $query)
1752
+ return $query;
1753
+
1754
+ // Ignore all queries from within wp-admin.
1755
+ if ($query->is_admin)
1756
+ return $query;
1757
+
1758
+ $this->se_load_config();
1759
+
1760
+ // echo "se_cfg<pre>"; print_r($this->se_cfg); echo "</pre>";
1761
+ // echo "query<pre>"; print_r($query); echo "</pre>";
1762
+ // echo "wp_query<pre>"; print_r($wp_query); echo "</pre>";
1763
+ // exit;
1764
+
1765
+ $action_data = array();
1766
+ // Only filter on our actions.
1767
+ if (($query->is_home) || ($query->is_posts_page))
1768
  {
1769
+ $action_data = $this->se_get_action_data('is_home');
1770
+ }
1771
+ else if ($query->is_search)
1772
+ {
1773
+ $action_data = $this->se_get_action_data('is_search');
 
 
 
 
 
1774
  }
1775
+ else if ($query->is_archive)
 
 
 
 
 
 
 
 
1776
  {
1777
+ $action_data = $this->se_get_action_data('is_archive');
 
 
 
 
 
 
 
 
 
 
 
 
1778
  }
1779
+ else if ($query->is_feed)
1780
  {
1781
+ $action_data = $this->se_get_action_data('is_feed');
1782
+ }
1783
 
1784
+ //echo "action_data<pre>"; print_r($action_data); echo "</pre>";
1785
+ if ($action_data)
1786
+ {
1787
+ $tax_query = array();
1788
+ $tax_query_relation = array();
1789
+ // echo "action_data<pre>"; print_r($action_data); echo "</pre>";
1790
+ foreach($action_data as $key => $key_data)
1791
  {
1792
+ // echo "key=[". $key ."]<br />";
1793
+ // echo "key_data<pre>"; print_r($key_data); echo "</pre>";
1794
+ if ($key == "taxonomies")
1795
+ {
1796
+ foreach($key_data as $key_key => $key_key_data)
1797
+ {
1798
+ //echo "key_key=[". $key_key ."]<br />";
1799
+ //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>";
1800
 
1801
+ $tax_args = array(
1802
+ 'taxonomy' => $key_key,
1803
+ 'field' => 'id',
1804
+ 'terms' => $key_key_data['terms']
1805
+ );
1806
+
1807
+ if ($key_key_data['actions'] == "e")
1808
+ {
1809
+ $tax_args['operator'] = "NOT IN";
1810
+ $tax_query_relation['NOT IN'] = "NOT IN";
1811
+ }
1812
+ else if ($key_key_data['actions'] == "i")
1813
+ {
1814
+ $tax_args['operator'] = "IN";
1815
+ $tax_query_relation['IN'] = "IN";
1816
+ }
1817
+
1818
+ $tax_query[] = $tax_args;
1819
+ }
1820
+ }
1821
+ else if ($key == "post_types")
1822
+ {
1823
+ $post_types_array = array();
1824
+ $post__in = array();
1825
+ $post__not_in = array();
1826
+ foreach($key_data as $key_key => $key_key_data)
1827
+ {
1828
+ //echo "key_key=[". $key_key ."]<br />";
1829
+ //echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>";
1830
+
1831
+ $post_types_array[] = $key_key;
1832
+ if ($key_key_data['actions'] == 'e')
1833
+ $post__not_in = array_merge($post__not_in, $key_key_data['terms']);
1834
+ else if ($key_key_data['actions'] == 'i')
1835
+ $post__in = array_merge($post__in, $key_key_data['terms']);
1836
+ }
1837
+ // echo "post_types_array<pre>"; print_r($post_types_array); echo "</pre>";
1838
+ // echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
1839
+ // echo "post__in<pre>"; print_r($post__in); echo "</pre>";
1840
+
1841
+ if (count($post__not_in))
1842
+ {
1843
+ //echo "PROCESSING: POST__NOT_IN<br />";
1844
+ //echo "post__not_in<pre>"; print_r($post__not_in); echo "</pre>";
1845
+ $query->set('post__not_in', $post__not_in);
1846
+ }
1847
+ else if (count($post__in))
1848
+ {
1849
+ //echo "PROCESSING: POST__IN<br />";
1850
+ //echo "post__in<pre>"; print_r($post__in); echo "</pre>";
1851
+ $query->set('post__in', $post__in);
1852
+ }
1853
+
1854
+ $query_post_type = $query->get('post_type');
1855
+ if (!$query_post_type) $query_post_type = array();
1856
+ else if (!is_array($query_post_type))
1857
+ {
1858
+ $query_post_type[] = $query_post_type;
1859
+ }
1860
+ if ($post_types_array)
1861
+ {
1862
+ $query_post_type = array_unique(array_merge($post_types_array, $post_types_array));
1863
+ $query->set('post_type', $query_post_type);
1864
+ }
1865
+ }
1866
+ else if ($key == "se_types")
1867
  {
1868
+ foreach($key_data as $key_key => $key_key_data)
1869
+ {
1870
+ // echo "key_key=[". $key_key ."]<br />";
1871
+ // echo "key_key_data<pre>"; print_r($key_key_data); echo "</pre>";
1872
+
1873
+ if ($key_key == "users")
1874
+ {
1875
+ $user_ids = $this->se_listify_ids($key_key_data['terms'], $key_key_data['actions']);
1876
+ //echo "user_ids=[". $user_ids ."]<br />";
1877
+ if ($user_ids)
1878
+ {
1879
+ $query->set('author', $user_ids);
1880
+ }
1881
+ }
1882
+ }
1883
  }
1884
  }
1885
+ if (count($tax_query))
1886
+ {
1887
+ if (count($tax_query_relation) == 2)
1888
+ $tax_query['relation'] = "OR";
1889
+ else
1890
+ $tax_query['relation'] = "AND";
1891
+
1892
+ $query->set('tax_query', $tax_query);
1893
+ }
1894
+ //echo "query<pre>"; print_r($query); echo "</pre>";
1895
  }
1896
+
1897
+ return $query;
 
 
 
 
 
1898
  }
1899
 
1900
+
1901
+ function se_get_action_data($action='')
1902
  {
1903
+ if (!$action) return;
1904
+
1905
+ $action_data = array();
1906
 
1907
+ //echo "se_cfg taxonomies<pre>"; print_r($this->se_cfg['data']['taxonomies']); echo "</pre>";
1908
+ foreach($this->se_cfg['data']['taxonomies'] as $key => $data)
1909
  {
1910
+ if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
 
 
 
 
 
 
1911
  {
1912
+ if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
1913
+ continue;
1914
+
1915
+ foreach($data['terms'][$action] as $id => $val)
1916
  {
1917
+ $action_data['taxonomies'][$key]['terms'][] = $id;
 
 
1918
  }
1919
+ $action_data['taxonomies'][$key]['actions'] = $data['actions'][$action]['action'];
1920
  }
1921
  }
 
 
 
 
 
 
 
1922
 
1923
+ //echo "se_cfg post_types<pre>"; print_r($this->se_cfg['data']['post_types']); echo "</pre>";
1924
+ foreach($this->se_cfg['data']['post_types'] as $key => $data)
 
 
 
 
1925
  {
1926
+ if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
1927
  {
1928
+ if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
1929
+ {
1930
+ if ((isset($data['actions'][$action]['action'])) && ($data['actions'][$action]['action'] == 'a'))
1931
+ {
1932
+ $action_data['post_types'][$key]['actions'] = $data['actions'][$action]['action'];
1933
+ }
1934
+ continue;
1935
+ }
1936
+
1937
+ foreach($data['terms'][$action] as $id => $val)
1938
+ {
1939
+ $action_data['post_types'][$key]['terms'][] = $id;
1940
+ }
1941
+
1942
+ $action_data['post_types'][$key]['actions'] = $data['actions'][$action]['action'];
1943
  }
1944
  }
1945
 
1946
+ //echo "se_cfg se_types<pre>"; print_r($this->se_cfg['data']['se_types']); echo "</pre>";
1947
+ foreach($this->se_cfg['data']['se_types'] as $key => $data)
 
 
 
 
 
1948
  {
1949
+ if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
1950
  {
1951
+ if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
1952
+ continue;
1953
+
1954
+ foreach($data['terms'][$action] as $id => $val)
1955
+ {
1956
+ $action_data['se_types'][$key]['terms'][] = $id;
1957
+ }
1958
+
1959
+ $action_data['se_types'][$key]['actions'] = $data['actions'][$action]['action'];
1960
  }
1961
+
1962
  }
1963
+ //echo "action_data<pre>"; print_r($action_data); echo "</pre>";
1964
+ return $action_data;
1965
+ }
1966
+
1967
+
1968
+
1969
+
1970
+
1971
+
1972
+
1973
+
1974
+ /****************************************************************************************************************************/
1975
+ /* */
1976
+ /* WIDGET FILTER LOGIC */
1977
+ /* */
1978
+ /****************************************************************************************************************************/
1979
+
1980
+ function se_widget_pages_args_proc($args)
1981
+ {
1982
+ //echo "args<pre>"; print_r($args); echo "</pre>";
1983
+
1984
+ if (isset($args['exclude']))
1985
+ {
1986
+ if ((is_array($args['exclude'])) && (count($args['exclude'])))
1987
+ return $args;
1988
+ else if (strlen($args['exclude']))
1989
+ return $args;
1990
+ }
1991
+
1992
+ if (isset($args['include']))
1993
+ {
1994
+ if ((is_array($args['include'])) && (count($args['include'])))
1995
+ return $args;
1996
+ else if (strlen($args['include']))
1997
+ return $args;
1998
+ }
1999
+
2000
+ $this->se_load_config();
2001
+
2002
+ // echo "se_cfg<pre>"; print_r($this->se_cfg['data']['post_types']['page']); echo "</pre>";
2003
+ if ( (isset($this->se_cfg['data']['post_types']['page']['terms']['widget_pages']))
2004
+ && (count($this->se_cfg['data']['post_types']['page']['terms']['widget_pages'])) )
2005
+ {
2006
+ //echo "se_cfg<pre>"; print_r($this->se_cfg['data']['post_types']['page']); echo "</pre>";
2007
+
2008
+ $action = $this->se_cfg['data']['post_types']['page']['actions']['widget_pages']['action'];
2009
+ $terms = $this->se_listify_ids(array_keys($this->se_cfg['data']['post_types']['page']['terms']['widget_pages']), 'i');
2010
+ //echo "terms<pre>"; print_r($terms); echo "</pre>";
2011
+ if ($action == "e")
2012
+ $args['exclude'] = $terms;
2013
+ else if ($action == 'i')
2014
+ $args['include'] = $terms;
2015
  }
2016
+ //echo "args AFTER<pre>"; print_r($args); echo "</pre>";
2017
+ return $args;
2018
+ }
2019
 
2020
+ function se_widget_categories_dropdown_args_proc($args)
2021
+ {
2022
+ if ((isset($args['include'])) || (isset($args['exclude'])))
2023
+ return;
2024
+
2025
+ $this->se_load_config();
2026
+
2027
+ if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']))
2028
+ && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'])) )
2029
+ {
2030
+ $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_category']['action'];
2031
+ $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'];
2032
+
2033
+ $all_cat_ids = array();
2034
+
2035
+ if ($action == 'e')
2036
+ {
2037
+ $all_cat_ids = array_keys($terms);
2038
+ }
2039
+ else if ($action == 'i')
2040
+ {
2041
+ $all_cat_ids = get_all_category_ids();
2042
+ if (!$all_cat_ids)
2043
+ $all_cat_ids = array();
2044
+
2045
+ foreach($terms as $c_idx => $c_item)
2046
+ {
2047
+ $item_idx = array_search($c_idx, $all_cat_ids);
2048
+ if ($item_idx !== false)
2049
+ unset($all_cat_ids[$item_idx]);
2050
+ }
2051
+ }
2052
+
2053
+ if ((isset($all_cat_ids)) && (count($all_cat_ids)))
2054
+ {
2055
+ $args['exclude'] = implode(',', $all_cat_ids);
2056
+ }
2057
+ }
2058
  return $args;
2059
  }
2060
+
2061
+ // The tag Cloud widget now supports using either taxonomy (post_tag or category).
2062
+ function se_widget_tag_cloud_args_proc($args)
2063
+ {
2064
+ if ((isset($args['include'])) || (isset($args['exclude'])))
2065
+ return $args;
2066
+
2067
+ if (!isset($args['taxonomy']))
2068
+ return $args;
2069
+
2070
+ if ( ($args['taxonomy'] != "category") && ($args['taxonomy'] != "post_tag") )
2071
+ return $args;
2072
+
2073
+ $this->se_load_config();
2074
+
2075
+ switch ($args['taxonomy'])
2076
+ {
2077
+ case 'post_tag':
2078
+
2079
+ if ( (isset($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud']))
2080
+ && (count($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'])) )
2081
+ {
2082
+ $action = $this->se_cfg['data']['taxonomies']['post_tag']['actions']['widget_tag_cloud']['action'];
2083
+ $terms = $this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'];
2084
 
2085
+ $all_tags = get_tags('hide_empty=0&orderby=name&order=ASC');
2086
+ $all_tag_ids = array();
2087
+ if ($all_tags)
2088
+ {
2089
+ foreach($all_tags as $t_item)
2090
+ {
2091
+ $all_tag_ids[] = $t_item->term_id;
2092
+ }
2093
+ }
2094
 
2095
+ if (count($all_tag_ids))
2096
+ {
2097
+ if ($action == 'e')
2098
+ {
2099
+ $all_tag_ids = array_keys($terms);
2100
+ }
2101
+ else if ($action == 'i')
2102
+ {
2103
+ foreach($terms as $c_idx => $c_item)
2104
+ {
2105
+ $item_idx = array_search($c_idx, $all_tag_ids);
2106
+ if ($item_idx !== false)
2107
+ unset($all_tag_ids[$item_idx]);
2108
+ }
2109
+ }
2110
 
2111
+ if ((isset($all_tag_ids)) && (count($all_tag_ids)))
2112
+ {
2113
+ $args['exclude'] = implode(',', $all_tag_ids);
2114
+ }
2115
+ }
2116
+ }
2117
+ break;
2118
+
2119
+ case 'category':
2120
+ if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud']))
2121
+ && (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'])) )
2122
+ {
2123
+ $action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_tag_cloud']['action'];
2124
+ $terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'];
2125
+
2126
+ $all_cat_ids = array();
2127
+
2128
+ if ($action == 'e')
2129
+ {
2130
+ $all_cat_ids = array_keys($terms);
2131
+ }
2132
+ else if ($action == 'i')
2133
+ {
2134
+ $all_cat_ids = get_all_category_ids();
2135
+ if (!$all_cat_ids)
2136
+ $all_cat_ids = array();
2137
+
2138
+ foreach($terms as $c_idx => $c_item)
2139
+ {
2140
+ $item_idx = array_search($c_idx, $all_cat_ids);
2141
+ if ($item_idx !== false)
2142
+ unset($all_cat_ids[$item_idx]);
2143
+ }
2144
+ }
2145
+
2146
+ if ((isset($all_cat_ids)) && (count($all_cat_ids)))
2147
+ {
2148
+ $args['exclude'] = implode(',', $all_cat_ids);
2149
+ }
2150
+ }
2151
+
2152
+ break;
2153
+
2154
+ default:
2155
+ break;
2156
+
2157
+ }
2158
+ return $args;
2159
+ }
2160
+
2161
+
2162
+
2163
+
2164
+ function se_admin_footer()
2165
+ {
2166
+ if ( !current_user_can('manage_options') )
2167
+ return;
2168
+
2169
+ if ($this->check_url('wp-admin/edit-tags.php'))
2170
+ {
2171
+ global $taxonomy;
2172
+ ?>
2173
+ <div id="se-actions-panel" style="display: none">
2174
+ <?php
2175
+ if (isset($taxonomy))
2176
+ {
2177
+ $this->display_instructions('taxonomy');
2178
+ $this->se_show_taxonomy_actions_panel($taxonomy);
2179
+ }
2180
+ ?>
2181
+ </div><?php
2182
+ }
2183
+ else if ($this->check_url('wp-admin/edit.php'))
2184
+ {
2185
+ global $post_type;
2186
+ ?>
2187
+ <div id="se-actions-panel" style="display: none">
2188
+ <?php
2189
+ if (isset($post_type))
2190
+ {
2191
+ $this->display_instructions('post_type');
2192
+ $this->se_show_post_type_actions_panel($post_type);
2193
+ }
2194
+ ?>
2195
+ </div>
2196
+ <?php
2197
+ }
2198
+ else if ($this->check_url('wp-admin/users.php'))
2199
+ {
2200
+ ?>
2201
+ <div id="se-actions-panel" style="display: none">
2202
+ <?php
2203
+ $this->display_instructions('users');
2204
+ $this->se_show_se_type_actions_panel('users');
2205
+ ?>
2206
+ </div>
2207
+ <?php
2208
+ }
2209
+ }
2210
+
2211
+ function se_ajax_update() {
2212
+
2213
+ //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
2214
+ //die();
2215
+ if ( !current_user_can('manage_options') )
2216
+ die();
2217
+
2218
+ if ((isset($_REQUEST['se_action'])) && ($_REQUEST['se_action'] == "se_update_terms"))
2219
+ {
2220
+ if (!isset($_REQUEST['is_checked'])) die();
2221
+ if (($_REQUEST['is_checked'] != 'yes') && ($_REQUEST['is_checked'] != 'no')) die();
2222
+
2223
+ $is_checked = $_REQUEST['is_checked'];
2224
+
2225
+ if (isset($_REQUEST['se_cfg']))
2226
+ {
2227
+ $this->se_load_config();
2228
+ $se_cfg = $_REQUEST['se_cfg'];
2229
+
2230
+ $arg_parts = explode('[', $se_cfg);
2231
+ foreach($arg_parts as $idx => $val)
2232
+ {
2233
+ $arg_parts[$idx] = str_replace(']', '', $val);
2234
+ }
2235
+ //echo "arg_parts<pre>"; print_r($arg_parts); echo "</pre>";
2236
+ if ($arg_parts[1] == "users") // Is a User
2237
+ {
2238
+ $se_type = $arg_parts[1];
2239
+ $action = $arg_parts[3];
2240
+ $user_id = $arg_parts[4];
2241
+
2242
+ //echo "se_cfg BEFORE<pre>"; print_r($this->se_cfg['data']['se_types'][$se_type]); echo "</pre>";
2243
+ if ($is_checked == 'yes')
2244
+ {
2245
+ if (!isset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action]))
2246
+ $this->se_cfg['data']['se_types'][$post_type]['terms'][$action] = array();
2247
+ $this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id] = "on";
2248
+ }
2249
+ else
2250
+ {
2251
+ if (isset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id]))
2252
+ unset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id]);
2253
+ }
2254
+ //echo "se_cfg AFTER<pre>"; print_r($this->se_cfg['data']['se_types'][$se_type]); echo "</pre>";
2255
+ $this->se_save_config();
2256
+ echo "SUCCESS";
2257
+ die();
2258
+ }
2259
+ else if ($arg_parts[1] == "plugins")
2260
+ {
2261
+ if ($is_checked == "yes")
2262
+ $this->se_cfg['options'][$arg_parts[1]][$arg_parts[2]]['actions'][$arg_parts[3]][$arg_parts[4]] = true;
2263
+ else
2264
+ $this->se_cfg['options'][$arg_parts[1]][$arg_parts[2]]['actions'][$arg_parts[3]][$arg_parts[4]] = false;
2265
+
2266
+ $this->se_save_config();
2267
+ echo "SUCCESS";
2268
+ die();
2269
+ }
2270
+ else if (post_type_exists($arg_parts[1])) // Is a Post Type
2271
+ {
2272
+ $post_type = $arg_parts[1];
2273
+ $action = $arg_parts[3];
2274
+ $term_id = $arg_parts[4];
2275
+
2276
+ if ($is_checked == 'yes')
2277
+ {
2278
+ if (!isset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action]))
2279
+ $this->se_cfg['data']['post_types'][$post_type]['terms'][$action] = array();
2280
+ $this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id] = "on";
2281
+ }
2282
+ else
2283
+ {
2284
+ if (isset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id]))
2285
+ unset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id]);
2286
+ }
2287
+ $this->se_save_config();
2288
+ echo "SUCCESS";
2289
+ die();
2290
+ }
2291
+ else if (taxonomy_exists($arg_parts[1])) // Else is a Taxonomy
2292
+ {
2293
+ $taxonomy = $arg_parts[1];
2294
+ $action = $arg_parts[3];
2295
+ $term_id = $arg_parts[4];
2296
+
2297
+ if ($is_checked == 'yes')
2298
+ {
2299
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action]))
2300
+ $this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action] = array();
2301
+ $this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id] = "on";
2302
+ }
2303
+ else
2304
+ {
2305
+ if (isset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id]))
2306
+ unset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id]);
2307
+ }
2308
+ $this->se_save_config();
2309
+ echo "SUCCESS";
2310
+ die();
2311
+ }
2312
+ }
2313
+ }
2314
+ else if ((isset($_REQUEST['se_action'])) && ($_REQUEST['se_action'] == "se_update_actions"))
2315
+ {
2316
+ if (!isset($_REQUEST['is_checked']))
2317
+ die();
2318
+
2319
+ //if (($_REQUEST['is_checked'] != 'i') && ($_REQUEST['is_checked'] != 'e'))
2320
+ // die();
2321
+
2322
+ $is_checked = $_REQUEST['is_checked'];
2323
+
2324
+ if (isset($_REQUEST['se_cfg']))
2325
+ {
2326
+ $this->se_load_config();
2327
+ $se_cfg = $_REQUEST['se_cfg'];
2328
+ $arg_parts = explode('[', $se_cfg);
2329
+
2330
+ foreach($arg_parts as $idx => $val)
2331
+ {
2332
+ $arg_parts[$idx] = str_replace(']', '', $val);
2333
+ }
2334
+ //echo "arg_parts<pre>"; print_r($arg_parts); echo "</pre>";
2335
+
2336
+ if ($arg_parts[1] == "users")
2337
+ {
2338
+ $se_type = $arg_parts[1];
2339
+ $option = $arg_parts[2];
2340
+ $action = $arg_parts[3];
2341
+
2342
+ if ($option == "actions")
2343
+ {
2344
+ if (!isset($this->se_cfg['data']['se_types'][$se_type][$option]))
2345
+ $this->se_cfg['data']['se_types'][$se_type][$option] = array();
2346
+
2347
+ if (!isset($this->se_cfg['data']['se_types'][$se_type][$option][$action]))
2348
+ $this->se_cfg['data']['se_types'][$se_type][$option][$action] = array();
2349
+
2350
+ $this->se_cfg['data']['se_types'][$se_type][$option][$action]['action'] = $is_checked;
2351
+ }
2352
+ else if ($option == "options")
2353
+ {
2354
+ $this->se_cfg['data']['se_types'][$se_type][$option][$action] = $is_checked;
2355
+ }
2356
+
2357
+ $this->se_save_config();
2358
+ echo "SUCCESS";
2359
+ die();
2360
+ }
2361
+ else if (post_type_exists($arg_parts[1])) // Is a Post Type
2362
+ {
2363
+ $post_type = $arg_parts[1];
2364
+ $option = $arg_parts[2];
2365
+ $action = $arg_parts[3];
2366
+
2367
+ if ($option == "actions")
2368
+ {
2369
+ if (!isset($this->se_cfg['data']['post_types'][$post_type][$option]))
2370
+ $this->se_cfg['data']['post_types'][$post_type][$option] = array();
2371
+
2372
+ if (!isset($this->se_cfg['data']['post_types'][$post_type][$option][$action]))
2373
+ $this->se_cfg['data']['post_types'][$post_type][$option][$action] = array();
2374
+
2375
+ $this->se_cfg['data']['post_types'][$post_type][$option][$action]['action'] = $is_checked;
2376
+ }
2377
+ else if ($option == "options")
2378
+ {
2379
+ $this->se_cfg['data']['post_types'][$post_type][$option][$action] = $is_checked;
2380
+ }
2381
+ $this->se_save_config();
2382
+ echo "SUCCESS";
2383
+ die();
2384
+ }
2385
+ else if (taxonomy_exists($arg_parts[1])) // Else is a Taxonomy
2386
+ {
2387
+ $taxonomy = $arg_parts[1];
2388
+ $option = $arg_parts[2];
2389
+ $action = $arg_parts[3];
2390
+
2391
+ if ($option == "actions")
2392
+ {
2393
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy][$option]))
2394
+ $this->se_cfg['data']['taxonomies'][$taxonomy][$option] = array();
2395
+
2396
+ if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action]))
2397
+ $this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action] = array();
2398
+
2399
+ $this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action]['action'] = $is_checked;
2400
+ }
2401
+ else if ($option == "options")
2402
+ {
2403
+ $this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action] = $is_checked;
2404
+ }
2405
+ $this->se_save_config();
2406
+ echo "SUCCESS";
2407
+ die();
2408
+ }
2409
+ }
2410
+ }
2411
+ die(); // this is required to return a proper result
2412
+ }
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+
2419
+
2420
+ function display_instructions($item)
2421
+ {
2422
+ switch ($item) {
2423
+ case 'users':
2424
+ ?>
2425
+ <p><?php _e("Set the checkbox to exclude the User items from the action", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2426
+ <p><?php _e("So what is the difference between <strong>Include only</strong> and <strong>Exclude</strong>?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2427
+ <p><strong><?php _e("Include only", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 3 Users but always want to show Posts for only 1 specific User in the Archives. New Users are automatically hidden.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2428
+ <p><strong><?php _e("Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 3 Users but want to hide Posts from one User in the Archives. New Users will by visible.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2429
+
2430
+ <?php
2431
+ break;
2432
+
2433
+ case 'taxonomy':
2434
+ ?>
2435
+ <p><?php _e("Set the checkbox to exclude the Taxonomy items from the action", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2436
+ <p><?php _e("So what is the difference between <strong>Include only</strong> and <strong>Exclude</strong>?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2437
+ <p><strong><?php _e("Include only", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 100 tags but only always want 3 to be used on the home page. New tags added are automatically hidden.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2438
+ <p><strong><?php _e("Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 100 categories but want to hide 3 from being seen. New tags will be visible.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2439
+ <?php
2440
+ break;
2441
+
2442
+ case 'post_type':
2443
+ ?>
2444
+ <p><?php _e("Set the checkbox to exclude the Post Type items from the action", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2445
+ <p><?php _e("So what is the difference between <strong>Include only</strong> and <strong>Exclude</strong>?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2446
+ <p><strong><?php _e("Include only", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 10 Pages but only always want to include only 4 Pages shown in a Search. New Pages are automatically hidden.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2447
+ <p><strong><?php _e("Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></strong>: <?php _e("For example you have 10 Pages and want to hide 3 specific Pages from Search. New Pages will be visible.", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2448
+ <?php
2449
+ break;
2450
+
2451
+ default:
2452
+ break;
2453
+ }
2454
+ }
2455
+
2456
+ //executed to show the plugins complete admin page
2457
+ function se_manage_settings()
2458
+ {
2459
+ ?>
2460
+ <div id="howto-se-manage-settings-metaboxes-general" class="wrap">
2461
+ <?php screen_icon('options-general'); ?>
2462
+ <h2><?php _ex("Simply Exclude Manage Settings", "Options Page Title", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></h2>
2463
+
2464
+ <div id="poststuff" class="metabox-holder has-right-sidebar simnplyexclude-metabox-holder-right-sidebar">
2465
+ <div id="side-info-column" class="inner-sidebar">
2466
+ <?php do_meta_boxes($this->pagehooks['se_manage_settings'], 'side', ''); ?>
2467
+ </div>
2468
+ <div id="post-body" class="has-sidebar ">
2469
+ <div id="post-body-content" class="has-sidebar-content simnplyexclude-metabox-holder-main">
2470
+ <?php do_meta_boxes($this->pagehooks['se_manage_settings'], 'normal', ''); ?>
2471
+ </div>
2472
+ </div>
2473
+ </div>
2474
+ </div>
2475
+ <script type="text/javascript">
2476
+ //<![CDATA[
2477
+ jQuery(document).ready( function($) {
2478
+ // close postboxes that should be closed
2479
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
2480
+ // postboxes setup
2481
+ postboxes.add_postbox_toggles('<?php echo $this->pagehooks['se_manage_settings']; ?>');
2482
+ });
2483
+ //]]>
2484
+ </script>
2485
+ <?php
2486
+ }
2487
+
2488
+ function se_display_options_taxonomy_actions_panel()
2489
+ {
2490
+ $this->display_instructions('taxonomy');
2491
+ $se_taxonomies = $this->se_load_taxonomy_list();
2492
+ if ($se_taxonomies)
2493
+ {
2494
+ foreach($se_taxonomies as $taxonomy)
2495
+ {
2496
+ ?><h4 class="simplyexclude-section-title"><?php echo $taxonomy->labels->name; ?></h4><?php
2497
+ $this->se_show_taxonomy_active_panel($taxonomy->name);
2498
+ $this->se_show_taxonomy_actions_panel($taxonomy->name);
2499
+ $this->se_show_taxonomy_showhide_panel($taxonomy->name);
2500
+ }
2501
+ }
2502
+ }
2503
+
2504
+ function se_display_options_post_type_actions_panel()
2505
+ {
2506
+ $this->display_instructions('post_type');
2507
+ $se_post_types = $this->se_load_post_type_list();
2508
+ if ($se_post_types)
2509
+ {
2510
+ foreach($se_post_types as $post_type)
2511
+ {
2512
+ ?><h4 class="simplyexclude-section-title"><?php echo $post_type->labels->name; ?></h4><?php
2513
+ $this->se_show_post_type_active_panel($post_type->name);
2514
+ $this->se_show_post_type_actions_panel($post_type->name);
2515
+ $this->se_show_post_type_showhide_panel($post_type->name);
2516
+ }
2517
+ }
2518
+ }
2519
 
2520
+ function se_display_options_user_actions_panel()
2521
  {
2522
+ $this->display_instructions('users');
2523
+ ?><h4 class="simplyexclude-section-title">Users</h4><?php
2524
+ $this->se_show_se_type_active_panel('users');
2525
+ $this->se_show_se_type_actions_panel('users');
2526
+ $this->se_show_se_type_showhide_panel('users');
2527
+ }
2528
+
2529
+ function se_options_thirdparty_panel()
2530
+ {
2531
+ ?>
2532
+ <p><?php _e('The Simply Exclude plugin now works with a few other plugins. Check the box for support of the listed third party plugins options below', SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2533
+ <p><?php _e('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.', SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2534
+ <p style="color: #ff0000"><?php _e('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.', SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2535
+
2536
+ <table id="simplyexclude-options-thirdparty-panel" class="widefat simplyexclude-actions-panel" cellpadding="3" cellspacing="3" border="0">
2537
+ <thead>
2538
+ <tr>
2539
+ <th class="action"><?php _e('Plugin Name', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
2540
+ <th class="description"><?php _e('Description of Functionality', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
2541
+ <th class="inc-excl"><?php _e('Actions', SIMPLY_EXCLUDE_I18N_DOMAIN) ?></th>
2542
+ </tr>
2543
+ </thead>
2544
+ <tbody>
2545
+ <?php
2546
+ $class = "";
2547
+ //echo "se_cfg<pre>"; print_r($this->se_cfg['options']); echo "</pre>";
2548
+ foreach ($this->se_cfg['options']['plugins'] as $option_key => $options_set)
2549
+ {
2550
+ //echo "option_key=[". $option_key ."]<br />";
2551
+ //echo "options_set<pre>"; print_r($options_set); echo "</pre>";
2552
+
2553
+ $class = ('alternate' == $class) ? '' : 'alternate';
2554
+ ?>
2555
+ <tr <?php if (strlen($class)) echo "class='".$class."'" ?>>
2556
+ <td class="action"><a href="<?php echo $options_set['url'] ?>"><?php echo $options_set['name'] ?></a></td>
2557
+ <td class="description"><?php echo $options_set['desc'] ?></td>
2558
+ <td class="inc-excl column-se-actions" nowrap="nowrap">
2559
+ <?php
2560
+ if ($options_set['active'] !== true)
2561
+ {
2562
+ ?>This plugin is not installed or not active.<?php
2563
+ }
2564
+ else
2565
+ {
2566
+ if (count($options_set['actions']))
2567
+ {
2568
+ foreach($options_set['actions'] as $option_actions_idx => $option_actions_set)
2569
+ {
2570
+ ?>
2571
+ <input type="checkbox" class="se-term-input"
2572
+ name="se_cfg[plugins][<?php echo $option_key; ?>][<?php
2573
+ echo $option_actions_idx; ?>][update]"
2574
+ <?php if ($option_actions_set['update'] === true)
2575
+ echo "checked='checked'"; ?> /> <?php echo $option_actions_set['desc']?><br />
2576
+ <?php
2577
+ }
2578
+ }
2579
+ }
2580
+ ?>
2581
+
2582
+ </td>
2583
+ </tr>
2584
+ <?php
2585
+ }
2586
+ ?>
2587
+ </tbody>
2588
+ </table>
2589
+
2590
+ <?php
2591
+ }
2592
+
2593
+ function se_settings_about_sidebar()
2594
+ {
2595
+ ?><p><a class="" target="_blank" href="http://www.codehooligans.com/projects/wordpress/simply-exclude/"><?php
2596
+ _e('Plugin Homepage', SIMPLY_EXCLUDE_I18N_DOMAIN); ?></a></p><?php
2597
+
2598
+ }
2599
+ function se_settings_donate_sidebar()
2600
+ {
2601
+ ?>
2602
+ <p><?php _e('Show your support of this plugin by making a small donation to support future development. No donation amount too small.',
2603
+ SIMPLY_EXCLUDE_I18N_DOMAIN); ?></p>
2604
+ <p><a class="" target="_blank" href="http://www.codehooligans.com/donations/"><?php
2605
+ _e('Make a donation today', SIMPLY_EXCLUDE_I18N_DOMAIN); ?></a></p>
2606
+ <?php
2607
+ }
2608
+
2609
+ function se_manage_help()
2610
+ {
2611
+ ?>
2612
+ <div id="se-manage-help-metaboxes-general" class="wrap">
2613
+ <?php screen_icon('options-general'); ?>
2614
+ <h2><?php _ex("Simply Exclude Help", "Options Page Title", SIMPLY_EXCLUDE_I18N_DOMAIN); ?></h2>
2615
+
2616
+ <div id="poststuff" class="metabox-holder has-right-sidebar simnplyexclude-metabox-holder-right-sidebar">
2617
+ <div id="side-info-column" class="inner-sidebar">
2618
+ <?php do_meta_boxes($this->pagehooks['se_manage_help'], 'side', ''); ?>
2619
+ </div>
2620
+ <div id="post-body" class="has-sidebar ">
2621
+ <div id="post-body-content" class="has-sidebar-content simnplyexclude-metabox-holder-main">
2622
+ <?php //do_meta_boxes($this->pagehooks['se_manage_help'], 'normal', ''); ?>
2623
+ <?php $this->se_settings_help_faq_topics(); ?>
2624
+ </div>
2625
+ </div>
2626
+ </div>
2627
+ </div>
2628
+
2629
+ <script>
2630
+ jQuery(document).ready(function() {
2631
+ jQuery( "#se-accordion" ).accordion();
2632
+ });
2633
+ </script>
2634
+ <?php
2635
+ }
2636
+
2637
+ function se_settings_help_faq_topics()
2638
+ {
2639
+ ?>
2640
+ <div id="se-accordion">
2641
+ <h3><a href="#">How do I setup Simply Exclude Plugin to Exclude/Include Category items from the Archive?</a></h3>
2642
+ <div>
2643
+ <p>Simply follow these steps</p>
2644
+ <ol>
2645
+ <li>Go to the Simply Exclude <a href="admin.php?page=se_manage_settings">Settings panel</a>. Location the Category you want to manage</li>
2646
+ <li>On the sub-panel ensure the Category is <strong>Active</strong>.</li>
2647
+ <li>Next, find the row for <strong>Archives</strong>. Ensure the selection is set to <strong>Exclude</strong></li>
2648
+ <li>Finally, ensure the <strong>Show/Hide</strong> option is set to <strong>Show</strong>.</li>
2649
+ <li>Now go to the WordPress <a href="edit-tags.php?taxonomy=category">Category panel</a>. Locate the row of the Category term you want to exclude. Within the <strong>Simply Exclude</strong> column set the checkbox for <strong>Archives</strong></li>
2650
+ <li>Done. At this point you have set the selected Category to exclude from the Archives listing.</li>
2651
+ </ol>
2652
+ </div>
2653
+ <h3><a href="#">Under Settings what does the Active/Disabled options do?</a></h3>
2654
+ <div>
2655
+ <p>On the Simply Exclude <a href="admin.php?page=se_manage_settings">Settings panel</a> you will see a listing of all Taxonomies and Post Types as well as Users and supported plugins. For each item you will see a set of Active/Disabled radio buttons.<p>
2656
+ <p><strong>Active</strong>: If you set the state to <strong>Active</strong> you are telling the plugin code you want to allow filtering of this Taxonomy/Post Type.</p>
2657
+ <p><strong>Disabled</strong>: If you set the state to <strong>Disabled</strong> you are instead telling the plugin to not filter this Taxonomy/Post Type. </p>
2658
+ </div>
2659
+
2660
+ <h3><a href="#">Under Settings what does the Show/Hide options do?</a></h3>
2661
+ <div>
2662
+ <p>On the Simply Exclude <a href="admin.php?page=se_manage_settings">Settings panel</a> you will see a listing of all Taxonomies and Post Types as well as Users and supported plugins. For each item you will see a set of Show/Hide radio buttons.<p>
2663
+ <p><strong>Show</strong>: If you set the state to <strong>Show</strong> the plugin code will add a new column to the Taxonomy/Post Type listing tables. The plug will also add a new set of fields to the Taxonomy/Post Type editor form.</p>
2664
+ <p><strong>Disabled</strong>: If you set the state to <strong>Disabled</strong> the plugin will not add a new column to the Taxonomy/Post Type listing tables. Nor will it add a new set of fields to the Taxonomy/Post Type editor form.</p>
2665
+ </div>
2666
+
2667
+ <h3><a href="#">I'm still confuses on the concepts of 'Include only' vs. 'Exclude' vs. 'Include all' action states</a></h3>
2668
+ <div>
2669
+ <p><strong>Include only</strong>: This setting tells the plugin to include only these selected items within the filtering logic. Let us take a example. Assume you have 100 Category terms and you want to only show 3 of these Category terms on the Front/Home post listing. You could setup the logic to exclude the other 97 Category terms. The problem with this is when you are more categories which you also don't want show on the Front/Home listing you will need to remember to exclude these. Instead the <strong>Include only</strong> lets you set only the 3 Categories to be included. Now as more Categories are added they will automatically be excluded from the Front/Home listing.</p>
2670
+
2671
+ <p><strong>Exclude</strong>: This action state is the simpler to understand. Quite simply you set this to Exclude Taxonomy or Post Type items from the available actions, Archive, Feeds, Searches, etc.</p>
2672
+ <p><strong>Include all</strong>: This is a special action state only available to Post Types compatible with <strong>Post</strong>. When using this special action state you can include the Post Type into the output of the other Post Types. For example in the default WordPress setup a site will display the latest Posts on the front page. Now assume you have a Custom Post Type 'Books' you also want to show on the front page. To accomplish this you would set both <strong>Posts</strong> and <strong>Books</strong> Post Types to the <strong>Include All</strong> action state.</p>
2673
+ </div>
2674
+
2675
+ <h3><a href="#">Can I use the Simply Exclude plugin to include other Post Types on my front page?</a></h3>
2676
+ <div>
2677
+ <p>Short answer, YES! Longer answer. This can be done but you need to be careful with the setup.</p>
2678
+
2679
+ <p>First, some assumptions about your WordPress setup. You MUST be able to answer <strong>YES</strong> to the following</p>
2680
+ <ol>
2681
+ <li>The first assumption is you have your WordPress system setup to show your latest posts on your Home page and not a static Page.</li>
2682
+ <li>Next, it is assumed you have setup a Custom Post Type. And this Post Type is compatible with the legacy <strong>Post</strong> type and not <strong>Page</strong> type.</li>
2683
+ </ol>
2684
+
2685
+ <p>Here is the setup</p>
2686
+ <ol>
2687
+ <li>Go to the Simply Exclude <a href="admin.php?page=se_manage_settings">Settings panel</a>. Location the Post Type you want to manage</li>
2688
+ <li>On the sub-panel ensure the Post Type is <strong>Active</strong>.</li>
2689
+ <li>Next, find the row for <strong>Front/Home</strong>. Ensure the selection is set to <strong>Include All</strong></li>
2690
+ <li>Finally, ensure the <strong>Show/Hide</strong> option is set to <strong>Show</strong>.</li>
2691
+ <li>Now navigate to the Post Type listing. This is important. You must ensure no items are set to <strong>Include Only</strong> or <strong>Exclude</strong>.</li>
2692
+ </ol>
2693
+
2694
+ <p>Note you can also use the <strong>Include all</strong> on the Feeds actions for Post Types</p>
2695
+ </div>
2696
+
2697
+ <h3><a href="#">I've configured the plugin to Include/Exclude a combination of Taxonomies and Post Types. Now my site is all messed up. How do I reset things to the default?</a></h3>
2698
+ <div>
2699
+ <p>My suggestion is to start on the Simply Exclude <a href="admin.php?page=se_manage_settings">Settings panel</a>. For each Taxonomy and Post Type set the Active state to <strong>Disabled</strong>. Then one at a time enable a Taxonomy and check your site. Depending on the number of Taxonomies and Custom Post Types you may be introducing a conflict my including one set of items then excluding them at the same time.</p>
2700
+ </div>
2701
+
2702
+ <h3><a href="#">I've excluded all my categories and all tags. Why am I seeing a 404 page?</a></h3>
2703
+ <div>
2704
+ <p>Well you need to be careful when excluding both categories and tags. Since a post can be associated with both Categories and Tags there is potential that you have excluded all your posts because they are either members of excluded categories and/or members or excluded tags.</p>
2705
+ </div>
2706
+
2707
+ <h3><a href="#">I've excluded Pages but attachments (images) for those pages are showing up. Why?</a></h3>
2708
+ <div>
2709
+ <p>Only the parent Page itself is excluded from searches. By default WordPress does not yet include Pages in search. Make sure you have other search plugins correctly configured to not search attachments.</p>
2710
+ </div>
2711
+
2712
+ <h3><a href="#">I've excluded a Category/Tag via the plugin but it still shows up in my sidebar Widgets. Why?</a></h3>
2713
+ <div>
2714
+ <p>The Simply Exclude plugin can filter for the default WordPress Categories and Tag Cloud widgets. Note the newest version of WordPress (3.3) supports using either Tags or Categories for the Tag Cloud widget.</p>
2715
+ <p>To set the Exclude/Include actions to work with these widgets look for the <strong>Widget: Categories</strong> and <strong>Widget: Tag Cloud</strong> actions. Then set them accordingly</p>
2716
+ <p>If you have set these up and your widgets are still showing excluded terms then double check your theme. If you are not using the WordPress version of the widget of widgets which are included as part of your theme then there is a chance they are bypassing the filtering logic required for using the Simply Exclude plugin. Sorry to say this is beyond my control since I cannot maintain support for the many available Category or Tag Cloud widgets other developers create.</p>
2717
+ </div>
2718
+
2719
+ <h3><a href="#">I've installed your plugin and now my site will not load. How to I remove the plugin?</a></h3>
2720
+ <div>
2721
+ <p>First, I'm sorry to hear my plugin effected your site. I try to test for most combinations but that is no substitute for a <strong>real</strong> system. To remove the plugin you can delete the plugin via the WordPress admin plugins panel. Or it for some reason your site is down you can FTP to your site and simply remove the plugins folder named '<?php echo dirname(plugin_basename(__FILE__)) ?>'. The Simply Exclude plugin does not add any permanent hack to any WordPress core file. Only one entry is added to the options table.</p>
2722
+ </div>
2723
+
2724
+ <h3><a href="#">I'm trying to include some specific Posts and exclude some other Post Type items but it does not seem to be working. Any advice?</a></h3>
2725
+ <div>
2726
+ <p>One important piece of information is to understand how the WP_Query system works within WordPress. If you have one Post Types where you are setting the <strong>Include only</strong>. This will execute before any excludes. This is just the way WordPress works and not something the plugin can control.</p>
2727
+ <p>Let's consider an example. Assume you have the default Post Type <strong>Posts</strong> setup to <strong>Include only</strong> for the Front/Home. Now also assume you have a custom Post Type name <strong>Books</strong> and this action state is set to 'Include All'. When you view the Front/Home page you only see the Posts but not the Books? Why? Because WordPress see the <strong>Include only</strong> as a higher request. If both are included in your setup the <strong>Include only</strong> will be processed while the additional <strong>Exclude</strong> or <strong>Include all</strong> will be ignored.</p>
2728
+ <p>To summarize. You can combine <strong>Exclude</strong> and <strong>Include all</strong> options with in the same Taxonomy or Post Type. But if you combine <strong>Include only</strong> with other action states like <strong>Exclude</strong> or <strong>Include all</strong> only the <strong>Include only</strong> information will be used.</p>
2729
+
2730
+ </div>
2731
+ </div>
2732
+ <?php
2733
+ }
2734
+
2735
+
2736
+ /****************************************************************************************************************************/
2737
+ /* */
2738
+ /* UTILITY FUNCTIONS */
2739
+ /* */
2740
+ /****************************************************************************************************************************/
2741
+
2742
+ function check_url($url='')
2743
+ {
2744
+ if (!$url) return;
2745
+
2746
+ $_REQUEST_URI = explode('?', $_SERVER['REQUEST_URI']);
2747
+ $url_len = strlen($url);
2748
+ $url_offset = $url_len * -1;
2749
+
2750
+ // If out test string ($url) is longer than the page URL. skip
2751
+ if (strlen($_REQUEST_URI[0]) < $url_len) return;
2752
+
2753
+ if ($url == substr($_REQUEST_URI[0], $url_offset, $url_len))
2754
+ return true;
2755
+ }
2756
+
2757
+ function se_listify_ids($ids_array, $action)
2758
+ {
2759
+ //echo "ids_array<pre>"; print_r($ids_array); echo "</pre>";
2760
+ //echo "action=[". $action ."]<br />";
2761
+
2762
+ $id_list = "";
2763
+
2764
+ if ($action == "e")
2765
+ $action_value = "-";
2766
+ else
2767
+ $action_value = "";
2768
+
2769
+ foreach($ids_array as $id_key => $id_val)
2770
+ {
2771
+ if (strlen($id_list))
2772
+ $id_list .= ",";
2773
+ $id_list .= $action_value.$id_val;
2774
+ }
2775
+ return $id_list;
2776
  }
 
2777
  }
2778
+
2779
+ $simplyexclude_new = new SimplyExcludeNew();
 
simplyexclude_style_admin.css CHANGED
@@ -1,104 +1,56 @@
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#author_exclusion table tr .action,
44
- form#author_exclusion table tr .author-id,
45
- form#page_exclusion table tr .action,
46
- form#page_exclusion table tr .page-id {
47
- text-align: left;
48
- width: 5%;
49
  }
50
 
51
- form#cat_exclusion table tr .description,
52
- form#cat_exclusion table tr .cat-name,
53
- form#tag_exclusion table tr .description,
54
- form#tag_exclusion table tr .tag-name,
55
- form#author_exclusion table tr .description,
56
- form#author_exclusion table tr .author-name,
57
- form#page_exclusion table tr .description,
58
- form#page_exclusion table tr .page-name {
59
- text-align: left;
60
- width: 45%;
61
  }
62
 
63
- form#cat_exclusion table tr .inc-excl,
64
- form#cat_exclusion table tr .cat-action,
65
- form#tag_exclusion table tr .inc-excl,
66
- form#tag_exclusion table tr .tag-action,
67
- form#author_exclusion table tr .inc-excl,
68
- form#author_exclusion table tr .author-action,
69
- form#page_exclusion table tr .inc-excl,
70
- form#page_exclusion table tr .page-action {
71
- text-align: left;
72
- width: 50%;
73
  }
74
 
75
- form#cat_exclusion table tbody tr td.cat-action label,
76
- form#tag_exclusion table tbody tr td.tag-action label,
77
- form#author_exclusion table tbody tr td.author-action label,
78
- form#page_exclusion table tbody tr td.page-action label {
79
- padding: 0;
80
- margin: 0;
81
  }
82
 
83
- form#cat_exclusion table tbody tr td.cat-action input,
84
- form#tag_exclusion table tbody tr td.tag-action input,
85
- form#author_exclusion table tbody tr td.author-action input {
86
- margin-right: 15px;
87
- margin-left: 0px;
88
- }
89
 
90
- form#page_exclusion table tbody tr td.page-action input {
91
- margin-right: 15px;
92
- margin-left: 0px;
93
- }
94
 
 
 
 
95
 
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;
104
  }
1
+ input.se-term-input {
2
+ width: 15px;
3
+ float: left;
 
 
 
 
4
  }
 
 
 
 
 
 
 
5
 
6
+ table.simplyexclude-actions-panel td.action {
7
+ width: 20%;
 
 
 
 
8
  }
9
 
10
+ table.simplyexclude-actions-panel td.description {
11
+ width: 50%;
 
 
 
 
 
12
  }
13
 
14
+ table.simplyexclude-actions-panel td.inc-excl {
15
+ width: 30%;
16
  }
17
 
18
+ table.simply-exclude-settings-postbox {
19
+ margin-bottom: 10px;
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
+ table.simplyexclude-active-panel td.description {
23
+ width: 70%;
 
 
 
 
 
 
 
 
24
  }
25
 
26
+ table.simplyexclude-active-panel td.inc-excl {
27
+ width: 30%;
 
 
 
 
 
 
 
 
28
  }
29
 
30
+ .simnplyexclude-metabox-holder-right-sidebar h4.simplyexclude-section-title {
31
+ font-size: 1.3em;
32
+ margin-top: 35px;
33
+ margin-bottom: 5px;
 
 
34
  }
35
 
36
+ .ui-accordion-header {
37
+ border-top-left-radius: 3px;
38
+ border-top-right-radius: 3px;
39
+ background-color: #ccc;
 
 
40
 
41
+ border-bottom-color: #DFDFDF;
42
+ box-shadow: 0 1px 0 #FFFFFF;
43
+ text-shadow: 0 1px 0 #FFFFFF;
 
44
 
45
+ background-color: #F1F1F1;
46
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
47
+ }
48
 
49
+ .ui-accordion-header a {
50
+ color: #000000;
51
+ text-decoration: none;
52
+ }
53
+ .ui-accordion-content {
54
+ border: 1px solid #ccc;
55
+ padding: 20px;
 
56
  }