Skip to content

Instantly share code, notes, and snippets.

@beatak
Created March 9, 2011 02:22
Show Gist options
  • Save beatak/861569 to your computer and use it in GitHub Desktop.
Save beatak/861569 to your computer and use it in GitHub Desktop.
nit-picky: avoiding error on dev with exclude_pages.php
diff -c exclude-pages/exclude_pages.php trunk/exclude_pages.php
*** exclude-pages/exclude_pages.php 2010-06-18 09:09:20.000000000 -0400
--- trunk/exclude_pages.php 2011-03-08 21:11:55.000000000 -0500
***************
*** 172,184 ****
// one row seems more sensible.
function ep_update_exclusions( $post_ID ) {
// Bang (!) to reverse the polarity of the boolean, turning include into exclude
! $exclude_this_page = ! (bool) $_POST['ep_this_page_included'];
// SWTODO: Also check for a hidden var, which confirms that this checkbox was present
// If hidden var not present, then default to including the page in the nav (i.e. bomb out here rather
// than add the page ID to the list of IDs to exclude)
$ctrl_present = (bool) @ $_POST['ep_ctrl_present'];
if ( ! $ctrl_present ) return;
-
$excluded_ids = ep_get_excluded_ids();
// If we need to EXCLUDE the page from the navigation...
if ( $exclude_this_page ) {
--- 172,189 ----
// one row seems more sensible.
function ep_update_exclusions( $post_ID ) {
// Bang (!) to reverse the polarity of the boolean, turning include into exclude
! if (!array_key_exists('ep_this_page_included', $_POST)) {
! $exclude_this_page = true;
! }
! else {
! $exclude_this_page = ! (bool) $_POST['ep_this_page_included'];
! }
// SWTODO: Also check for a hidden var, which confirms that this checkbox was present
// If hidden var not present, then default to including the page in the nav (i.e. bomb out here rather
// than add the page ID to the list of IDs to exclude)
$ctrl_present = (bool) @ $_POST['ep_ctrl_present'];
+
if ( ! $ctrl_present ) return;
$excluded_ids = ep_get_excluded_ids();
// If we need to EXCLUDE the page from the navigation...
if ( $exclude_this_page ) {
***************
*** 203,209 ****
// Delete option
delete_option($name);
// Insert option
! add_option($name, $value, $description);
}
/**
--- 208,214 ----
// Delete option
delete_option($name);
// Insert option
! add_option($name, $value);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment