Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adamnbowen
Created January 9, 2012 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamnbowen/303306675da9e70fe211 to your computer and use it in GitHub Desktop.
Save adamnbowen/303306675da9e70fe211 to your computer and use it in GitHub Desktop.
Newscast Diff
From e771e3abf1b5a004c73afa0bd891ba51fe730bd6 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Tue, 10 Jan 2012 11:12:39 -0500
Subject: [PATCH] Fix various undefined variable errors in "Add New Page"
---
.../kriesi_meta_box/kriesi_meta_box.php | 30 ++++++++++++-------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/wp-content/themes/newscast/framework/theme_plugins/kriesi_meta_box/kriesi_meta_box.php b/wp-content/themes/newscast/framework/theme_plugins/kriesi_meta_box/kriesi_meta_box.php
index 578ef72..3a8bbf9 100644
--- a/wp-content/themes/newscast/framework/theme_plugins/kriesi_meta_box/kriesi_meta_box.php
+++ b/wp-content/themes/newscast/framework/theme_plugins/kriesi_meta_box/kriesi_meta_box.php
@@ -90,7 +90,9 @@ class kriesi_meta_box{
{
if (method_exists($this, $option['type']))
{
- $meta_box_value = get_post_meta($post->ID, $option['id'], true);
+ $meta_box_value = isset($option['id'])
+ ? get_post_meta($post->ID, $option['id'], true)
+ : null;
if($meta_box_value != "") $option['std'] = $meta_box_value;
echo '<div class="alt kriesi_meta_box_alt meta_box_'.$option['type'].' meta_box_'.$this->boxinfo['context'].'">';
@@ -103,20 +105,21 @@ class kriesi_meta_box{
echo'<input type="hidden" name="'.$this->boxinfo['id'].'_noncename" id="'.$this->boxinfo['id'].'_noncename" value="'.wp_create_nonce(plugin_basename(__FILE__) ).'" />';
}
- function save_postdata()
+ function save_postdata($post_id)
{
- $post_id = $_POST['post_ID'];
foreach ($this->options as $option)
{
// Verify
- if (!wp_verify_nonce($_POST[$this->boxinfo['id'].'_noncename'], plugin_basename(__FILE__)))
+ if (isset($_POST[$this->boxinfo['id'].'_noncename'])
+ && !wp_verify_nonce($_POST[$this->boxinfo['id'].'_noncename'], plugin_basename(__FILE__)))
{
return $post_id ;
}
- if ( 'page' == $_POST['post_type'] )
- {
+ if ((isset($_POST['post_type']) && 'page' == $_POST['post_type'] )
+ || (isset($_GET['post_type']) && 'page' == $_GET['post_type'])
+ ) {
if ( !current_user_can( 'edit_page', $post_id ))
return $post_id ;
}
@@ -126,15 +129,18 @@ class kriesi_meta_box{
return $post_id ;
}
- $data = htmlspecialchars($_POST[$option['id']], ENT_QUOTES,"UTF-8");
+ $data = (isset($option['id']) && isset($_POST[$option['id']]))
+ ? htmlspecialchars($_POST[$option['id']], ENT_QUOTES,"UTF-8")
+ : null;
- if(get_post_meta($post_id , $option['id']) == "")
+ if(isset($option['id']) && get_post_meta($post_id , $option['id']) == "")
add_post_meta($post_id , $option['id'], $data, true);
- elseif($data != get_post_meta($post_id , $option['id'], true))
+ elseif(isset($option['id'])
+ && $data != get_post_meta($post_id , $option['id'], true))
update_post_meta($post_id , $option['id'], $data);
- elseif($data == "")
+ elseif(isset($option['id']) && $data == "")
delete_post_meta($post_id , $option['id'], get_post_meta($post_id , $option['id'], true));
}
@@ -181,7 +187,9 @@ class kriesi_meta_box{
$media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
$image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
- $button = '<a href="'.$image_upload_iframe_src.'&amp;hijack_target='.$values['id'].'&amp;TB_iframe=true" id="'.$values['id'].'" class="k_hijack button thickbox" title="'.$image_title.'" onclick="return false;" >'.$values['button_label'].'</a>';
+ $button = '<a href="'.$image_upload_iframe_src.'&amp;hijack_target='.$values['id'].'&amp;TB_iframe=true" id="'.$values['id'].'" class="k_hijack button thickbox" title="';
+ $button .= isset($image_title) ? $image_title : null;
+ $button .= '" onclick="return false;" >'.$values['button_label'].'</a>';
// check if entry is a valid image and display it if thats the case
$image = '';
--
1.7.3.4
From 43a23e36e7d91d6bddebc84a3ed721d81c4ddf5b Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 15:49:17 -0500
Subject: [PATCH 01/17] Remove remaining deprecation warnings
---
.../kriesi_option_pages/kriesi_option_pages.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
index 5740ee7..c92aed2 100644
--- a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
+++ b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
@@ -60,13 +60,13 @@ class kriesi_option_pages{
// add top level item
if(!$this->pageinfo['child'])
{
- add_menu_page($top_level, $top_level, 7, $this->pageinfo['filename'], array(&$this, 'initialize'));
+ add_menu_page($top_level, $top_level, 'editor', $this->pageinfo['filename'], array(&$this, 'initialize'));
define('TOP_LEVEL_BASEAME', $this->pageinfo['filename']);
}
// add sub level item
else
{
- add_submenu_page(TOP_LEVEL_BASEAME, $this->pageinfo['full_name'], $this->pageinfo['full_name'], 7, $this->pageinfo['filename'], array(&$this, 'initialize'));
+ add_submenu_page(TOP_LEVEL_BASEAME, $this->pageinfo['full_name'], $this->pageinfo['full_name'], 'editor', $this->pageinfo['filename'], array(&$this, 'initialize'));
}
}
--
1.7.3.4
From 6a8ea251344d6101ae2d0ade0e1d4ea7f57a8e4c Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:50:02 -0500
Subject: [PATCH 02/17] Add isset() for analytics index
---
wp-content/themes/newscast/footer.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/footer.php b/wp-content/themes/newscast/footer.php
index 57d092f..32b5041 100644
--- a/wp-content/themes/newscast/footer.php
+++ b/wp-content/themes/newscast/footer.php
@@ -38,7 +38,7 @@
<!-- ###################################################################### -->
<?php wp_footer();
-if($k_option['general']['analytics']) echo $k_option['general']['analytics'];
+if(isset($k_option['general']['analytics']) && $k_option['general']['analytics']) echo $k_option['general']['analytics'];
?>
</body>
</html>
--
1.7.3.4
From fc0edd3dda9b3d5750b8d0229794011db955660d Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:50:33 -0500
Subject: [PATCH 03/17] Add isset() for exclude, use wp_list_categories instead of deprecated function
---
wp-content/themes/newscast/footer.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/footer.php b/wp-content/themes/newscast/footer.php
index 32b5041..cc93a80 100644
--- a/wp-content/themes/newscast/footer.php
+++ b/wp-content/themes/newscast/footer.php
@@ -86,7 +86,7 @@ function display_placeholder($whichone)
<div class='box box_small'>
<h3>Categories</h3>
<ul>
- <?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=0'.$exclude); ?>
+ <?php if (isset($exclude)) wp_list_categories('sort_column=name&optioncount=0&hierarchical=0'.$exclude); ?>
</ul>
</div>
<div class='box box_small'>
--
1.7.3.4
From ddd5d1ed65545d112102e1621aa13c1d15852b1c Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:50:54 -0500
Subject: [PATCH 04/17] Add isset() for $k_option['blog']
---
wp-content/themes/newscast/footer.php | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/wp-content/themes/newscast/footer.php b/wp-content/themes/newscast/footer.php
index cc93a80..fa48a09 100644
--- a/wp-content/themes/newscast/footer.php
+++ b/wp-content/themes/newscast/footer.php
@@ -62,8 +62,9 @@ if(isset($k_option['general']['analytics']) && $k_option['general']['analytics']
################################################################################################################
$exclude = '';
-if($k_option['mainpage']['blog_widget_exclude'] == 1)
-{
+if($k_option['mainpage']['blog_widget_exclude'] == 1
+ && isset($k_option['blog'])
+) {
$exclude = '&exclude='.$k_option['blog']['blog_cat_final'];
}
@@ -113,4 +114,4 @@ function display_placeholder($whichone)
}
-?>
\ No newline at end of file
+?>
--
1.7.3.4
From 5c4ffffaf02ee6503e645d2e8737d431e7df4bc4 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:51:14 -0500
Subject: [PATCH 05/17] add isset for $image_customfield, fix redundant if statement
---
.../helper_functions/kriesi_post_thumb.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-content/themes/newscast/framework/helper_functions/kriesi_post_thumb.php b/wp-content/themes/newscast/framework/helper_functions/kriesi_post_thumb.php
index a3f66fc..2d7f714 100644
--- a/wp-content/themes/newscast/framework/helper_functions/kriesi_post_thumb.php
+++ b/wp-content/themes/newscast/framework/helper_functions/kriesi_post_thumb.php
@@ -34,7 +34,7 @@ function kriesi_post_thumb($this_post, $option)
//if there is are no post thumbnails or if there is an overwrite value set the default image gets pulled from the custom field
- if(($image_customfield != '') || $image_customfield != '')
+ if(isset($image_customfield) && $image_customfield != '')
{
$image_URL = $image_customfield;
}
@@ -156,4 +156,4 @@ function kriesi_post_thumb($this_post, $option)
return $defaultimage;
-}
\ No newline at end of file
+}
--
1.7.3.4
From 39b4b5457807967c9d793d02edd31c833544da4b Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:51:45 -0500
Subject: [PATCH 06/17] Add issets to helper functions
---
.../helper_functions/lots_of_small_helpers.php | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/wp-content/themes/newscast/framework/helper_functions/lots_of_small_helpers.php b/wp-content/themes/newscast/framework/helper_functions/lots_of_small_helpers.php
index 6a98a2f..3724e23 100644
--- a/wp-content/themes/newscast/framework/helper_functions/lots_of_small_helpers.php
+++ b/wp-content/themes/newscast/framework/helper_functions/lots_of_small_helpers.php
@@ -46,8 +46,12 @@ function check_custom_widget()
{
global $custom_widget_area, $k_option;
//special widget area
- $specialpage = explode(',',$k_option['includes']['multi_widget_final']);
- $specialcat = explode(',',$k_option['includes']['multi_widget_cat_final']);
+ $specialpage = isset($k_option['includes']['multi_widget_final'])
+ ? explode(',',$k_option['includes']['multi_widget_final'])
+ : null;
+ $specialcat = isset($k_option['includes']['multi_widget_cat_final'])
+ ? explode(',',$k_option['includes']['multi_widget_cat_final'])
+ : null;
if(is_page($specialpage))
{
@@ -111,13 +115,15 @@ function filter_category($cat_args)
{
global $k_option;
- if($k_option['blog']['blog_widget_exclude'] == 1)
+ if(isset($k_option['blog']) && $k_option['blog']['blog_widget_exclude'] == 1)
{
$cat_args['exclude'] = $k_option['blog']['blog_cat_final'];
}
else if($k_option['mainpage']['blog_widget_exclude'] == 1)
{
- $cat_args['exclude'] = $k_option['mainpage']['main_cat_final'];
+ $cat_args['exclude'] = isset($k_option['mainpage']['main_cat_final'])
+ ? $k_option['mainpage']['main_cat_final']
+ : null;
}
return $cat_args;
--
1.7.3.4
From 35a06ebadb058d14a872244f126d9d76ad62ed62 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:52:00 -0500
Subject: [PATCH 07/17] get_settings instead of get_options
---
wp-content/themes/newscast/header.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/header.php b/wp-content/themes/newscast/header.php
index 56c3820..a083c9d 100644
--- a/wp-content/themes/newscast/header.php
+++ b/wp-content/themes/newscast/header.php
@@ -97,7 +97,7 @@ if (isset($k_option['custom']['bodyclass'])) $k_body_class = $k_option['custom']
<div id="head">
<!-- ###################################################################### -->
- <h2 class="logo ie6fix <?php echo $logoclass; ?>"><a href="<?php echo get_settings('home'); ?>/"><?php echo $logo; ?></a></h2>
+ <h2 class="logo ie6fix <?php echo $logoclass; ?>"><a href="<?php echo get_option('home'); ?>/"><?php echo $logo; ?></a></h2>
<div class="nav_wrapper">
--
1.7.3.4
From 28126d2e57cc09db8ecb29a8f01eae3d298991bb Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:52:25 -0500
Subject: [PATCH 08/17] isset and correction on preg_replace
---
wp-content/themes/newscast/index.php | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/index.php b/wp-content/themes/newscast/index.php
index 807296a..d609328 100644
--- a/wp-content/themes/newscast/index.php
+++ b/wp-content/themes/newscast/index.php
@@ -86,7 +86,13 @@
}
- $negative_cats = preg_replace("!(\d)+!","-${0}$0", $k_option['mainpage']['main_cat_final']);
+ $negative_cats = isset($k_option['mainpage']['main_cat_final'])
+ ? preg_replace(
+ "!(\d)+!",
+ '-${0}$0',
+ $k_option['mainpage']['main_cat_final']
+ )
+ : null;
$smallsized = 1;
$additional_loop = new WP_Query("cat=".$negative_cats."&paged=$paged");
--
1.7.3.4
From 0b90f3047bdaeead4b627729f90334e75782fb3c Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:52:48 -0500
Subject: [PATCH 09/17] isset for $k_option['mainpage']['slider']
---
wp-content/themes/newscast/index.php | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/index.php b/wp-content/themes/newscast/index.php
index d609328..f525b97 100644
--- a/wp-content/themes/newscast/index.php
+++ b/wp-content/themes/newscast/index.php
@@ -5,7 +5,8 @@
// FRONTPAGE SLIDESHOW
//
// check if slideshow should be displayed?
- if($k_option['mainpage']['slider'] != 'none') :
+ if(isset($k_option['mainpage']['slider'])
+ && $k_option['mainpage']['slider'] != 'none') :
?>
<!-- FEATURED POST AREA ################################################### -->
<div id="feature_wrap">
--
1.7.3.4
From fae72c12d02898416f7a0a0861d4c59a519e76f7 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:53:03 -0500
Subject: [PATCH 10/17] issets on page.php
---
wp-content/themes/newscast/page.php | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/wp-content/themes/newscast/page.php b/wp-content/themes/newscast/page.php
index 33d6faf..20d14ed 100644
--- a/wp-content/themes/newscast/page.php
+++ b/wp-content/themes/newscast/page.php
@@ -8,8 +8,8 @@ global $k_option;
######################################################################
# Check for blog and contact pages
######################################################################
-if ($post->ID == $k_option['contact']['contact_page']) $contactpage = true;
-else if ($post->ID == $k_option['blog']['blog_page']) $blogpage = true;
+if (isset($k_option['contact']['contact_page']) && $post->ID == $k_option['contact']['contact_page']) $contactpage = true;
+else if (isset($k_option['blog']) && $post->ID == $k_option['blog']['blog_page']) $blogpage = true;
######################################################################
@@ -28,15 +28,15 @@ if(isset($k_option['portfolio']['matrix_slider_port_final']) && $k_option['portf
######################################################################
# Include page templates if other template is applied to the page
######################################################################
-if($contactpage)
+if(isset($contactpage) && $contactpage)
{
include(TEMPLATEPATH."/template_contact.php");
}
-else if($blogpage)
+else if(isset($blogpage) && $blogpage)
{
include(TEMPLATEPATH."/template_blog.php");
}
-else if($portfoliopage)
+else if(isset($portfoliopage) && $portfoliopage)
{
include(TEMPLATEPATH."/template_portfolio.php");
}
@@ -109,4 +109,4 @@ get_header(); ?>
get_sidebar();
get_footer(); }
- ?>
\ No newline at end of file
+ ?>
--
1.7.3.4
From 76fe8331b1ed209f773b6ed54e3058645c693c00 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:53:46 -0500
Subject: [PATCH 11/17] Use bloginfo('url') instead of bloginfo('home')
---
wp-content/themes/newscast/searchform.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-content/themes/newscast/searchform.php b/wp-content/themes/newscast/searchform.php
index 2d66140..4d8392e 100644
--- a/wp-content/themes/newscast/searchform.php
+++ b/wp-content/themes/newscast/searchform.php
@@ -1,5 +1,5 @@
-<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
-<div><input type="text" class='rounded text_input' value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
+<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
+<div><input type="text" class='rounded text_input' value="<?php if (isset($s)) echo esc_html($s); ?>" name="s" id="s" />
<input type="submit" class="button ie6fix" id="searchsubmit" value="." />
</div>
</form>
--
1.7.3.4
From 4507c5a92a98ede22980b0092f9bec68d13fbe0f Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:54:05 -0500
Subject: [PATCH 12/17] wp_list_categories instead of wp_list_cats
---
wp-content/themes/newscast/sidebar.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/sidebar.php b/wp-content/themes/newscast/sidebar.php
index 2a9e68f..29f613c 100644
--- a/wp-content/themes/newscast/sidebar.php
+++ b/wp-content/themes/newscast/sidebar.php
@@ -45,7 +45,7 @@ if ($k_option['custom']['bodyclass'] == "") // check if its a full width page, i
<div class='box box_small'>
<h3>Categories</h3>
<ul>
- <?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=0'.$exclude); ?>
+ <?php wp_list_categories('sort_column=name&optioncount=0&hierarchical=0'.$exclude); ?>
</ul>
</div>
--
1.7.3.4
From c6ed8227205587b081b53be3dd6d64f3a04f753b Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:54:18 -0500
Subject: [PATCH 13/17] issets() on sidebar.php
---
wp-content/themes/newscast/sidebar.php | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/wp-content/themes/newscast/sidebar.php b/wp-content/themes/newscast/sidebar.php
index 29f613c..e1d17e5 100644
--- a/wp-content/themes/newscast/sidebar.php
+++ b/wp-content/themes/newscast/sidebar.php
@@ -1,6 +1,6 @@
<?php
global $k_option, $custom_widget_area;
-if ($k_option['custom']['bodyclass'] == "") // check if its a full width page, if full width dont show the sidebar content
+if (isset($k_option['custom']['bodyclass']) && $k_option['custom']['bodyclass'] == "") // check if its a full width page, if full width dont show the sidebar content
{
##############################################################################
@@ -37,7 +37,8 @@ if ($k_option['custom']['bodyclass'] == "") // check if its a full width page, i
//left dummy sidebar
if($sidebar == 'left'){
$exclude = '';
- if($k_option['mainpage']['blog_widget_exclude'] == 1)
+ if($k_option['mainpage']['blog_widget_exclude'] == 1
+ && isset($k_option['blog']['blog_cat_final']))
{
$exclude = '&exclude='.$k_option['blog']['blog_cat_final'];
}
@@ -78,4 +79,4 @@ if ($k_option['custom']['bodyclass'] == "") // check if its a full width page, i
}
?>
-<?php } ?>
\ No newline at end of file
+<?php } ?>
--
1.7.3.4
From 87588fa3b8262ef68b2f3ac5b430575af1debdb7 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 16:54:33 -0500
Subject: [PATCH 14/17] Use get_the_author_meta()
---
wp-content/themes/newscast/single.php | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/wp-content/themes/newscast/single.php b/wp-content/themes/newscast/single.php
index 9cea083..526fa76 100644
--- a/wp-content/themes/newscast/single.php
+++ b/wp-content/themes/newscast/single.php
@@ -63,7 +63,7 @@ get_header(); ?>
<div class='entry' id="author-box">
<div class="gravatar">
<?php
- $author_email = get_the_author_email();
+ $author_email = get_the_author_meta('email');
echo get_avatar( $author_email, $size = '60');
the_author_posts_link();
?>
@@ -71,7 +71,7 @@ get_header(); ?>
<div class="author-info">
<h3><?php _e('About the author','newscast'); ?></h3>
<?php
- $description = get_the_author_description();
+ $description = get_the_author_meta('description');
if($description != '')
{
echo $description;
@@ -117,4 +117,4 @@ get_header(); ?>
get_sidebar();
get_footer();
- ?>
\ No newline at end of file
+ ?>
--
1.7.3.4
From e0fe19eef1d91b49e4e8583c107357b0aebf3627 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 17:19:56 -0500
Subject: [PATCH 15/17] Fix undefined index errors on the "General Options" page
---
.../kriesi_option_pages/kriesi_option_pages.php | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
index c92aed2..533a557 100644
--- a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
+++ b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
@@ -60,13 +60,13 @@ class kriesi_option_pages{
// add top level item
if(!$this->pageinfo['child'])
{
- add_menu_page($top_level, $top_level, 'editor', $this->pageinfo['filename'], array(&$this, 'initialize'));
+ add_menu_page($top_level, $top_level, 'administrator', $this->pageinfo['filename'], array(&$this, 'initialize'));
define('TOP_LEVEL_BASEAME', $this->pageinfo['filename']);
}
// add sub level item
else
{
- add_submenu_page(TOP_LEVEL_BASEAME, $this->pageinfo['full_name'], $this->pageinfo['full_name'], 'editor', $this->pageinfo['filename'], array(&$this, 'initialize'));
+ add_submenu_page(TOP_LEVEL_BASEAME, $this->pageinfo['full_name'], $this->pageinfo['full_name'], 'administrator', $this->pageinfo['filename'], array(&$this, 'initialize'));
}
}
@@ -161,7 +161,7 @@ class kriesi_option_pages{
//reset update_option($saved_optionname, "");
- if ( $_POST['save_my_options'] )
+ if ( isset($_POST['save_my_options']) && $_POST['save_my_options'] )
{
echo '<div class="updated fade" id="message" style=""><p><strong>Settings saved.</strong></p></div>';
//update_option($saved_optionname, "");
@@ -328,7 +328,7 @@ class kriesi_option_pages{
echo '<tr valign="top" '.$this->table_bg_class.'>';
echo '<td colspan="2" scope="row"><h3>'.$values['name'].'</h3>';
if (isset($values['desc'])) echo '<p>'.$values['desc'].'</p>';
- if ($values['id']) echo '<input type="hidden" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
+ if (isset($values['id']) && $values['id']) echo '<input type="hidden" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
echo '</td></tr>';
}
@@ -343,7 +343,7 @@ class kriesi_option_pages{
echo '<th scope="row" width="200px">'.$values['name'].'</th>';
echo '<td>'.$values['desc'].'<br/>';
echo '<textarea name="'.$values['id'].'" cols="60" rows="7" id="'.$values['id'].'" style="width: 80%; font-size: 12px;" class="code">';
- echo $values['std'].'</textarea><br/>';
+ if (isset($values['std'])) echo $values['std'].'</textarea><br/>';
echo '<br/></td>';
echo '</tr>';
}
@@ -481,7 +481,7 @@ class kriesi_option_pages{
$title = $key;
}
- if ($this->database_options[$values['id']] == $id )
+ if (isset($this->database_options[$values['id']]) && $this->database_options[$values['id']] == $id )
{
$selected = "selected='selected'";
}
--
1.7.3.4
From 9054f6d9aed4cd111a96435c591f36f0b7d47a20 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 17:25:02 -0500
Subject: [PATCH 16/17] Fix save button
---
.../kriesi_option_pages/kriesi_option_pages.php | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
index 533a557..cdfd786 100644
--- a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
+++ b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
@@ -343,7 +343,8 @@ class kriesi_option_pages{
echo '<th scope="row" width="200px">'.$values['name'].'</th>';
echo '<td>'.$values['desc'].'<br/>';
echo '<textarea name="'.$values['id'].'" cols="60" rows="7" id="'.$values['id'].'" style="width: 80%; font-size: 12px;" class="code">';
- if (isset($values['std'])) echo $values['std'].'</textarea><br/>';
+ if (isset($values['std'])) echo $values['std'];
+ echo '</textarea><br/>';
echo '<br/></td>';
echo '</tr>';
}
--
1.7.3.4
From 41b6afe4f3bc447d3b071f4bf8da64fc53375aa0 Mon Sep 17 00:00:00 2001
From: Adam Bowen <adamnbowen@gmail.com>
Date: Mon, 9 Jan 2012 17:35:52 -0500
Subject: [PATCH 17/17] Fix remaining issues on options pages
---
.../kriesi_option_pages/kriesi_option_pages.php | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
index cdfd786..8823385 100644
--- a/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
+++ b/wp-content/themes/newscast/framework/theme_plugins/kriesi_option_pages/kriesi_option_pages.php
@@ -328,7 +328,7 @@ class kriesi_option_pages{
echo '<tr valign="top" '.$this->table_bg_class.'>';
echo '<td colspan="2" scope="row"><h3>'.$values['name'].'</h3>';
if (isset($values['desc'])) echo '<p>'.$values['desc'].'</p>';
- if (isset($values['id']) && $values['id']) echo '<input type="hidden" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
+ if (isset($values['id']) && $values['id'] && isset($values['std'])) echo '<input type="hidden" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
echo '</td></tr>';
}
@@ -359,7 +359,7 @@ class kriesi_option_pages{
echo '<tr valign="top" '.$this->table_bg_class.'>';
echo '<th scope="row" width="200px">'.$values['name'].'</th>';
echo '<td>'.$values['desc'].'<br/>';
- echo '<input type="text" size="'.$values['size'].'" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
+ if (isset($values['size'])) echo '<input type="text" size="'.$values['size'].'" value="'.$values['std'].'" id="'.$values['id'].'" name="'.$values['id'].'"/>';
echo '<br/><br/></td>';
echo '</tr>';
}
@@ -514,12 +514,15 @@ class kriesi_option_pages{
echo '<div class="multiple_box">';
$hidden_name = $values['id'].'_hidden';
- if($this->database_options[$hidden_name] == "" || $this->database_options[$hidden_name] == false)
+ if(isset($this->database_options[$hidden_name]) && ($this->database_options[$hidden_name] == "" || $this->database_options[$hidden_name] == false))
{
$this->database_options[$hidden_name] = 1;
}
- for($i = 0; $i < $this->database_options[$hidden_name]; $i++)
+ $database_options_hidden_name = isset($this->database_options[$hidden_name])
+ ? $this->database_options[$hidden_name]
+ : 0;
+ for($i = 0; $i < $database_options_hidden_name; $i++)
{
if($values['subtype'] == 'page')
@@ -566,7 +569,11 @@ class kriesi_option_pages{
if(isset($this->database_options[$hidden_name])) $values['std'] = $this->database_options[$hidden_name];
- echo '<input name="'.$hidden_name.'" class="'.$hidden_name.'" type="hidden" value="'.$this->database_options[$hidden_name].'" />';
+ echo '<input name="'.$hidden_name.'" class="'.$hidden_name.'" type="hidden" value="';
+ if (isset($this->database_options[$hidden_name])) {
+ echo $this->database_options[$hidden_name];
+ }
+ echo '" />';
echo '</div>';
echo '<br/> </td>';
--
1.7.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment