From 545da159509eccf060c15d4379bea0b50a315198 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 10 Nov 2008 18:54:18 +0000 Subject: [PATCH] Notice fixes from DD32. see #7509 git-svn-id: http://svn.automattic.com/wordpress/trunk@9596 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 9 +++++++-- wp-admin/edit-tags.php | 9 ++++----- wp-admin/includes/dashboard.php | 4 ++-- wp-admin/includes/post.php | 6 +++--- wp-admin/includes/template.php | 2 +- wp-admin/install.php | 6 +++--- wp-admin/page.php | 6 +++--- wp-admin/post.php | 2 +- wp-includes/comment.php | 11 ++++++----- wp-includes/js/autosave.js | 1 + wp-includes/post.php | 4 ++++ wp-includes/query.php | 2 +- wp-includes/script-loader.php | 2 +- wp-includes/taxonomy.php | 13 +++++++++---- wp-includes/widgets.php | 3 +++ wp-settings.php | 14 +++++--------- 16 files changed, 54 insertions(+), 40 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 9c161f7a0..4ef9edb9c 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -77,8 +77,13 @@ $blog_name = get_bloginfo('name', 'display'); if ( '' == $blog_name ) $blog_name = ' '; $title_class = ''; -if ( function_exists('mb_strlen') && mb_strlen($blog_name, 'UTF-8') > 30 ) - $title_class = 'class="long-title"'; +if ( function_exists('mb_strlen') ) { + if ( mb_strlen($blog_name, 'UTF-8') > 30 ) + $title_class = 'class="long-title"'; +} else { + if ( strlen($blog_name) > 30 ) + $title_class = 'class="long-title"'; +} ?>

>

diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 1d4070958..f9adb6118 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -247,30 +247,29 @@ else + do_action('add_tag_form_pre'); ?>

-
- +

- +

- +
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 1a17ee153..034b05c47 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -37,8 +37,8 @@ function wp_dashboard_setup() { 'home' => get_option('home'), 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), - 'items' => $widget_options['dashboard_incoming_links']['items'], - 'show_date' => $widget_options['dashboard_incoming_links']['show_date'] + 'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10, + 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false ); } wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 977b1433e..849a4ff96 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -25,8 +25,8 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { if ( $update ) $post_data['ID'] = (int) $post_data['post_ID']; - $post_data['post_content'] = $post_data['content']; - $post_data['post_excerpt'] = $post_data['excerpt']; + $post_data['post_content'] = isset($post_data['content']) ? $post_data['content'] : ''; + $post_data['post_excerpt'] = isset($post_data['excerpt']) ? $post_data['excerpt'] : ''; $post_data['post_parent'] = isset($post_data['parent_id'])? $post_data['parent_id'] : ''; if ( isset($post_data['trackback_url']) ) $post_data['to_ping'] = $post_data['trackback_url']; @@ -71,7 +71,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { if ( isset($post_data['pending']) && '' != $post_data['pending'] ) $post_data['post_status'] = 'pending'; - $previous_status = get_post_field('post_status', $post_data['ID']); + $previous_status = get_post_field('post_status', isset($post_data['ID']) ? $post_data['ID'] : $post_data['temp_ID']); // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 08b633a29..1f9f746ea 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -3166,7 +3166,7 @@ function screen_meta($screen) {
urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), 'message' => 1 ), get_edit_post_link( $page_ID, 'url' ) ); else $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) ); - } elseif ($_POST['addmeta']) { + } elseif ( isset($_POST['addmeta']) ) { $location = add_query_arg( 'message', 2, wp_get_referer() ); $location = explode('#', $location); $location = $location[0] . '#postcustom'; - } elseif ($_POST['deletemeta']) { + } elseif ( isset($_POST['deletemeta']) ) { $location = add_query_arg( 'message', 3, wp_get_referer() ); $location = explode('#', $location); $location = $location[0] . '#postcustom'; diff --git a/wp-admin/post.php b/wp-admin/post.php index fd1c4973c..fc7d6e5cb 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -39,7 +39,7 @@ function redirect_post($post_ID = '') { elseif ( isset($_POST['publish']) ) $location = 'sidebar.php?a=b'; } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) { - if ( $_POST['_wp_original_http_referer'] && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false ) + if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false ) $location = add_query_arg( array( '_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), 'message' => 1 diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 1ccb236c1..85c0af926 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1392,11 +1392,12 @@ function pingback($content, $post_ID) { foreach ( (array) $post_links_temp[0] as $link_test ) : if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. - $test = parse_url($link_test); - if ( isset($test['query']) ) - $post_links[] = $link_test; - elseif ( ($test['path'] != '/') && ($test['path'] != '') ) - $post_links[] = $link_test; + if ( $test = @parse_url($link_test) ) { + if ( isset($test['query']) ) + $post_links[] = $link_test; + elseif ( ($test['path'] != '/') && ($test['path'] != '') ) + $post_links[] = $link_test; + } endif; endforeach; diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index 928986437..8459bc50c 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -179,6 +179,7 @@ var autosave = function() { post_data["excerpt"] = jQuery("#excerpt").val(); if ( jQuery("#post_author").size() ) post_data["post_author"] = jQuery("#post_author").val(); + post_data["user_ID"] = jQuery("#user-id").val(); // Don't run while the TinyMCE spellcheck is on. Why? Who knows. if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) { diff --git a/wp-includes/post.php b/wp-includes/post.php index 33e6a891e..8d64004b6 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1336,6 +1336,10 @@ function wp_insert_post($postarr = array(), $wp_error = false) { $post_category = array(get_option('default_category')); } + //Set the default tag list + if ( !isset($tags_input) ) + $tags_input = array(); + if ( empty($post_author) ) $post_author = $user_ID; diff --git a/wp-includes/query.php b/wp-includes/query.php index 7202996ad..75f4954d1 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1691,7 +1691,7 @@ class WP_Query { $q['name'] = $q['pagename']; $where .= " AND ($wpdb->posts.ID = '$reqpage')"; $reqpage_obj = get_page($reqpage); - if ( 'attachment' == $reqpage_obj->post_type ) { + if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) { $this->is_attachment = true; $this->is_page = true; $q['attachment_id'] = $reqpage; diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 800ded895..f3b8e2b50 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -75,7 +75,7 @@ function wp_default_scripts( &$scripts ) { 'broken' => __('An unidentified error has occurred.') ) ); - $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081102' ); + $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081110' ); $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080729' ); $scripts->localize( 'wp-lists', 'wpListL10n', array( diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 13b759d88..e05f8dee7 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -840,11 +840,16 @@ function sanitize_term($term, $taxonomy, $context = 'display') { if ( is_object($term) ) $do_object = true; + $term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0); + foreach ( (array) $fields as $field ) { - if ( $do_object ) - $term->$field = sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context); - else - $term[$field] = sanitize_term_field($field, $term[$field], $term['term_id'], $taxonomy, $context); + if ( $do_object ) { + if ( isset($term->$field) ) + $term->$field = sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context); + } else { + if ( isset($term[$field]) ) + $term[$field] = sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context); + } } return $term; diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 9e8c366b5..f66ddfd70 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -1707,9 +1707,12 @@ function wp_widget_rss_control($widget_args) { * @param array $inputs Override default display options. */ function wp_widget_rss_form( $args, $inputs = null ) { + $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true ); $inputs = wp_parse_args( $inputs, $default_inputs ); extract( $args ); + extract( $inputs, EXTR_SKIP); + $number = attribute_escape( $number ); $title = attribute_escape( $title ); $url = attribute_escape( $url ); diff --git a/wp-settings.php b/wp-settings.php index ac5184095..6e7f443d5 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -336,15 +336,11 @@ if ( !defined('WP_PLUGIN_URL') ) if ( !defined('PLUGINDIR') ) define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. -if ( ! defined('WP_INSTALLING') ) { - // Used to guarantee unique hash cookies - $cookiehash = md5(get_option('siteurl')); - /** - * Used to guarantee unique hash cookies - * @since 1.5 - */ - define('COOKIEHASH', $cookiehash); -} +/** + * Used to guarantee unique hash cookies + * @since 1.5 + */ +define('COOKIEHASH', md5(get_option('siteurl'))); /** * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php