WP Hide Post - Version 1.1.3

Version Description

Download this release

Release Info

Developer rmahfoud
Plugin Icon wp plugin WP Hide Post
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

Files changed (2) hide show
  1. readme.txt +3 -2
  2. wp-hide-post.php +29 -20
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: rmahfoud
3
  Donate link: http://anappleaday.konceptus.net/donate
4
  Tags: SEO,hide,show,visbility,privacy,customization,sitemap,filter
5
- Requires at least: 2.7.1
6
  Tested up to: 2.8.3
7
- Stable tag: 1.1.2
8
 
9
  Enables you to control the visibility of items on your blog by making posts/pages hidden on some parts of your blog, while still visible in other parts as well as to search engines. This plugin is the new incarnation of the 'WP low Profiler'. If this plugin already exists, it will be upgraded to this one, keeping all existing settings.
10
 
@@ -92,6 +92,7 @@ Ditto. It will be deleted. If you had any existing data (if you had it active be
92
 
93
  == Revision History ==
94
 
 
95
  * 08/07/2009: v1.1.2 - Bug fixes.
96
  * 08/05/2009: v1.1.1 - Reduce the number of SQL queries to hide pages to a single queries for all pages, rather than one query per page.
97
  * 08/04/2009: v1.1.0 - Bug fix: bulk update clears "Visibility Attributes". Split code into separate files.
2
  Contributors: rmahfoud
3
  Donate link: http://anappleaday.konceptus.net/donate
4
  Tags: SEO,hide,show,visbility,privacy,customization,sitemap,filter
5
+ Requires at least: 2.6
6
  Tested up to: 2.8.3
7
+ Stable tag: 1.1.3
8
 
9
  Enables you to control the visibility of items on your blog by making posts/pages hidden on some parts of your blog, while still visible in other parts as well as to search engines. This plugin is the new incarnation of the 'WP low Profiler'. If this plugin already exists, it will be upgraded to this one, keeping all existing settings.
10
 
92
 
93
  == Revision History ==
94
 
95
+ * 08/07/2009: v1.1.3 - Extended support for Wordpress 2.6.
96
  * 08/07/2009: v1.1.2 - Bug fixes.
97
  * 08/05/2009: v1.1.1 - Reduce the number of SQL queries to hide pages to a single queries for all pages, rather than one query per page.
98
  * 08/04/2009: v1.1.0 - Bug fix: bulk update clears "Visibility Attributes". Split code into separate files.
wp-hide-post.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Hide Post
4
  Plugin URI: http://anappleaday.konceptus.net/posts/wp-hide-post/
5
  Description: Enables a user to control the visibility of items on the blog by making posts and pages selectively hidden in different views throughout the blog, such as on the front page, category pages, search results, etc... The hidden item remains otherwise accessible directly using permalinks, and also visible to search engines as part of the sitemap (at least). This plugin enables new SEO possibilities for authors since it enables them to create new posts and pages without being forced to display them on their front and in feeds.
6
- Version: 1.1.2
7
  Author: Robert Mahfoud
8
  Author URI: http://anappleaday.konceptus.net
9
  Text Domain: wp_hide_post
@@ -37,7 +37,7 @@ function wphp_init() {
37
  if( !defined('WP_POSTS_TABLE_NAME') )
38
  define('WP_POSTS_TABLE_NAME', "${table_prefix}posts");
39
  if( !defined('WPHP_DEBUG') ) {
40
- define('WPHP_DEBUG', defined('WP_DEBUG') && WP_DEBUG ? 1 : 1);
41
  }
42
  }
43
  wphp_init();
@@ -135,21 +135,6 @@ function wphp_textdomain() {
135
  }
136
  add_action('init', 'wphp_textdomain');
137
 
138
- /**
139
- * Hook called when activating the plugin
140
- * @return unknown_type
141
- */
142
- function wphp_activate() {
143
- wphp_init();
144
- wphp_log("called: wphp_activate");
145
-
146
- require_once(dirname(__FILE__).'/upgrade.php');
147
- wphp_migrate_db();
148
- wphp_remove_wp_low_profiler();
149
- }
150
- add_action('activate_wp-hide-post/wp-hide-post.php', 'wphp_activate' );
151
- //register_activation_hook( __FILE__, 'wphp_activate' );
152
-
153
  /**
154
  *
155
  * @param $item_type
@@ -254,6 +239,23 @@ add_filter('posts_join_paged', 'wphp_query_posts_join');
254
  * ADMIN FUNCTIONS
255
  *********************/
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  /**
258
  * Hook to watch for the activation of 'WP low Profiler', and forbid it...
259
  * @return unknown_type
@@ -341,7 +343,6 @@ function wphp_set_low_profile($item_type, $id, $lp_flag, $lp_value) {
341
  global $wpdb;
342
  // Ensure No Duplicates!
343
  $check = $wpdb->get_var("SELECT count(*) FROM ".WPHP_TABLE_NAME." WHERE post_id = $id AND meta_key='$lp_flag'");
344
- error_log("Check: $check");
345
  if(!$check) {
346
  $wpdb->query("INSERT INTO ".WPHP_TABLE_NAME."(post_id, meta_key, meta_value) VALUES($id, '$lp_flag', '$lp_value')");
347
  } elseif( $item_type == 'page' && $lp_flag == "_wplp_page_flags" ) {
@@ -355,8 +356,15 @@ function wphp_set_low_profile($item_type, $id, $lp_flag, $lp_value) {
355
  */
356
  function wphp_add_post_edit_meta_box() {
357
  wphp_log("called: wphp_add_post_edit_meta_box");
358
- add_meta_box('hidepostdivpost', __('Post Visibility', 'wp-hide-post'), 'wphp_metabox_post_edit', 'post', 'side');
359
- add_meta_box('hidepostdivpage', __('Page Visibility', 'wp-hide-post'), 'wphp_metabox_page_edit', 'page', 'side');
 
 
 
 
 
 
 
360
  }
361
  add_action('admin_menu', 'wphp_add_post_edit_meta_box');
362
 
@@ -532,4 +540,5 @@ function wphp_delete_post($post_id) {
532
  }
533
  add_action('delete_post', 'wphp_delete_post');
534
 
 
535
  ?>
3
  Plugin Name: WP Hide Post
4
  Plugin URI: http://anappleaday.konceptus.net/posts/wp-hide-post/
5
  Description: Enables a user to control the visibility of items on the blog by making posts and pages selectively hidden in different views throughout the blog, such as on the front page, category pages, search results, etc... The hidden item remains otherwise accessible directly using permalinks, and also visible to search engines as part of the sitemap (at least). This plugin enables new SEO possibilities for authors since it enables them to create new posts and pages without being forced to display them on their front and in feeds.
6
+ Version: 1.1.3
7
  Author: Robert Mahfoud
8
  Author URI: http://anappleaday.konceptus.net
9
  Text Domain: wp_hide_post
37
  if( !defined('WP_POSTS_TABLE_NAME') )
38
  define('WP_POSTS_TABLE_NAME', "${table_prefix}posts");
39
  if( !defined('WPHP_DEBUG') ) {
40
+ define('WPHP_DEBUG', defined('WP_DEBUG') && WP_DEBUG ? 1 : 0);
41
  }
42
  }
43
  wphp_init();
135
  }
136
  add_action('init', 'wphp_textdomain');
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  *
140
  * @param $item_type
239
  * ADMIN FUNCTIONS
240
  *********************/
241
 
242
+
243
+ /**
244
+ * Hook called when activating the plugin
245
+ * @return unknown_type
246
+ */
247
+ function wphp_activate() {
248
+ wphp_init();
249
+ wphp_log("called: wphp_activate");
250
+
251
+ require_once(dirname(__FILE__).'/upgrade.php');
252
+ wphp_migrate_db();
253
+ wphp_remove_wp_low_profiler();
254
+ }
255
+ add_action('activate_wp-hide-post/wp-hide-post.php', 'wphp_activate' );
256
+ //register_activation_hook( __FILE__, 'wphp_activate' );
257
+
258
+
259
  /**
260
  * Hook to watch for the activation of 'WP low Profiler', and forbid it...
261
  * @return unknown_type
343
  global $wpdb;
344
  // Ensure No Duplicates!
345
  $check = $wpdb->get_var("SELECT count(*) FROM ".WPHP_TABLE_NAME." WHERE post_id = $id AND meta_key='$lp_flag'");
 
346
  if(!$check) {
347
  $wpdb->query("INSERT INTO ".WPHP_TABLE_NAME."(post_id, meta_key, meta_value) VALUES($id, '$lp_flag', '$lp_value')");
348
  } elseif( $item_type == 'page' && $lp_flag == "_wplp_page_flags" ) {
356
  */
357
  function wphp_add_post_edit_meta_box() {
358
  wphp_log("called: wphp_add_post_edit_meta_box");
359
+ global $wp_version;
360
+ if( ! $wp_version || $wp_version >= '2.7' ) {
361
+ add_meta_box('hidepostdivpost', __('Post Visibility', 'wp-hide-post'), 'wphp_metabox_post_edit', 'post', 'side');
362
+ add_meta_box('hidepostdivpage', __('Page Visibility', 'wp-hide-post'), 'wphp_metabox_page_edit', 'page', 'side');
363
+ } else {
364
+ add_meta_box('hidepostdivpost', __('Post Visibility', 'wp-hide-post'), 'wphp_metabox_post_edit', 'post');
365
+ add_meta_box('hidepostdivpage', __('Page Visibility', 'wp-hide-post'), 'wphp_metabox_page_edit', 'page');
366
+ }
367
+
368
  }
369
  add_action('admin_menu', 'wphp_add_post_edit_meta_box');
370
 
540
  }
541
  add_action('delete_post', 'wphp_delete_post');
542
 
543
+
544
  ?>