Advertising
Paste Description for remove php notice from code
GIT patch (diff) with changes to code to remove PHP NOTICE error messages in log
- remove php notice from code
- Wednesday, July 18th, 2012 at 5:01:10am MDT
- diff --git a/public_html/wp-content/plugins/wp-page-widget/wp-page-widgets.php b/public_html/wp-content/plugins/wp-page-widget/wp-page-widgets.php
- index 7858890..9764632 100644
- --- a/public_html/wp-content/plugins/wp-page-widget/wp-page-widgets.php
- +++ b/public_html/wp-content/plugins/wp-page-widget/wp-page-widgets.php
- @@ -258,7 +258,7 @@ function pw_search_page() {
- </div>
- <div style="padding: 5px;">
- - <!-- <a id="pw-button-customize" class="<?php echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- + <!-- <a id="pw-button-customize" class="<?php //echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- <input type="radio" class="pw-toggle-customize" name="pw-customize-sidebars" value="no" <?php checked($customize, 'no') ?> /> Default (follow <a href="<?php echo admin_url('widgets.php') ?>">Widgets settings</a>)
- <input class="pw-toggle-customize" type="radio" name="pw-customize-sidebars" value="yes" <?php checked($customize, 'yes') ?> /> Customize
- <br class="clear" />
- @@ -418,7 +418,7 @@ function pw_metabox_content($post) {
- </div>
- <div style="padding: 5px;">
- -<!-- <a id="pw-button-customize" class="<?php echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- +<!-- <a id="pw-button-customize" class="<?php //echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- <input type="radio" class="pw-toggle-customize" name="pw-customize-sidebars" value="no" <?php checked($customize, 'no') ?> /> Default (follow <a href="<?php echo admin_url('widgets.php') ?>">Widgets settings</a>)
- <input class="pw-toggle-customize" type="radio" name="pw-customize-sidebars" value="yes" <?php checked($customize, 'yes') ?> /> Customize
- <br class="clear" />
- @@ -535,7 +535,7 @@ function pw_showTaxonomyWidget($tag, $taxonomy){
- </div>
- <div style="padding: 5px;">
- - <!-- <a id="pw-button-customize" class="<?php echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- + <!-- <a id="pw-button-customize" class="<?php //echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- <input type="radio" class="pw-toggle-customize" name="pw-customize-sidebars" value="no" <?php checked($customize, 'no') ?> /> Default (follow <a href="<?php echo admin_url('widgets.php') ?>">Widgets settings</a>)
- <input class="pw-toggle-customize" type="radio" name="pw-customize-sidebars" value="yes" <?php checked($customize, 'yes') ?> /> Customize
- <br class="clear" />
- @@ -655,7 +655,7 @@ function pw_returnTaxonomyWidget(){
- </div>
- <div style="padding: 5px;">
- - <!-- <a id="pw-button-customize" class="<?php echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- + <!-- <a id="pw-button-customize" class="<?php //echo $pw_class ?>" href="#"><span class="customize">Customize</span><span class="default">Default</span></a>-->
- <input type="radio" class="pw-toggle-customize" name="pw-customize-sidebars" value="no" <?php checked($customize, 'no') ?> /> Default (follow <a href="<?php echo admin_url('widgets.php') ?>">Widgets settings</a>)
- <input class="pw-toggle-customize" type="radio" name="pw-customize-sidebars" value="yes" <?php checked($customize, 'yes') ?> /> Customize
- <br class="clear" />
- @@ -828,11 +828,11 @@ function pw_ajax_widgets_order() {
- die('-1');
- }
- - $post_id = stripslashes($_POST['post_id']);
- - $tag_id = stripslashes($_POST['tag_id']);
- - $taxonomy = stripslashes($_POST['taxonomy']);
- + $post_id = isset($_POST['post_id']) ? stripslashes($_POST['post_id']) : null;
- + $tag_id = isset($_POST['tag_id']) ? stripslashes($_POST['tag_id']) : null;
- + $taxonomy = isset($_POST['taxonomy']) ? stripslashes($_POST['taxonomy']) : null;
- - $search_page = stripslashes($_POST['search_page']);
- + $search_page = isset($_POST['search_page']) ? stripslashes($_POST['search_page']) : null;
- unset( $_POST['savewidgets'], $_POST['action'] );
- @@ -878,12 +878,12 @@ function pw_ajax_save_widget() {
- if ( !$_POST['post_id'] && !$_POST['tag_id'] && !$_POST['search_page'] )
- die('-1');
- - $post_id = stripslashes($_POST['post_id']);
- - $tag_id = stripslashes($_POST['tag_id']);
- - $taxonomy = stripslashes($_POST['taxonomy']);
- + $post_id = isset($_POST['post_id']) ? stripslashes($_POST['post_id']) : null;
- + $tag_id = isset($_POST['tag_id']) ? stripslashes($_POST['tag_id']) : null;
- + $taxonomy = isset($_POST['taxonomy']) ? stripslashes($_POST['taxonomy']) : null;
- // For search page
- - $search_page = stripslashes($_POST['search_page']);
- + $search_page = isset($_POST['search_page']) ? stripslashes($_POST['search_page']) : null;
- unset( $_POST['savewidgets'], $_POST['action'] );
- @@ -921,7 +921,7 @@ function pw_ajax_save_widget() {
- // Save widgets
- - if ( !isset($_POST['delete_widget']) && !$_POST['delete_widget'] ) {
- + if ( !isset($_POST['delete_widget']) || !$_POST['delete_widget'] ) {
- foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
- if ( $name == $id_base ) {
- @@ -975,7 +975,7 @@ function pw_ajax_save_widget() {
- if ( !empty($_POST['add_new']) )
- die();
- - if ( $form = $wp_registered_widget_controls[$widget_id] )
- + if ( isset($wp_registered_widget_controls[$widget_id]) && $form = $wp_registered_widget_controls[$widget_id] )
- call_user_func_array( $form['callback'], $form['params'] );
- print 'Updated ajax save widget.';
- die();
- @@ -1012,7 +1012,7 @@ function pw_filter_widgets($sidebars_widgets) {
- if (
- ( is_admin()
- && !in_array($pagenow, array('post-new.php', 'post.php', 'edit-tags.php'))
- - && ( !in_array($pagenow, array('admin.php')) && (($_GET['page'] == 'pw-front-page') || ($_GET['page'] == 'pw-search-page')) )
- + && ( !in_array($pagenow, array('admin.php')) && isset($_GET['page']) && (($_GET['page'] == 'pw-front-page') || ($_GET['page'] == 'pw-search-page')) )
- )
- || (!is_admin() && !is_singular() && !is_search() && empty($objTaxonomy['taxonomy']))
- @@ -1023,14 +1023,14 @@ function pw_filter_widgets($sidebars_widgets) {
- // Search page
- - if ( is_search() || (is_admin() && $_GET['page'] == 'pw-search-page') ) {
- + if ( is_search() || (is_admin() && isset($_GET['page']) && $_GET['page'] == 'pw-search-page') ) {
- $enable_customize = get_option('_pw_search_page', true);
- $_sidebars_widgets = get_option('_search_page_sidebars_widgets', true);
- }
- // Post page
- - elseif(empty($objTaxonomy['taxonomy'])){
- + elseif(empty($objTaxonomy['taxonomy']) && is_object($post)){
- $enable_customize = get_post_meta($post->ID, '_customize_sidebars', true);
- $_sidebars_widgets = get_post_meta($post->ID, '_sidebars_widgets', true);
- }
Paste Details
Tags: wp-page-widgets
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.