Notice fixes from nbachiyski. fixes #5961

git-svn-id: https://develop.svn.wordpress.org/trunk@6983 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-02-22 17:43:56 +00:00
parent da19acbc4b
commit 7ed364b2ce
14 changed files with 70 additions and 37 deletions
+12 -7
View File
@@ -180,9 +180,11 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
if ( $output == OBJECT ) {
return $_post;
} elseif ( $output == ARRAY_A ) {
return get_object_vars($_post);
$__post = get_object_vars($_post);
return $__post;
} elseif ( $output == ARRAY_N ) {
return array_values(get_object_vars($_post));
$__post = array_values(get_object_vars($_post));
return $__post;
} else {
return $_post;
}
@@ -698,14 +700,17 @@ function get_post_custom_values( $key = '', $post_id = 0 ) {
function sanitize_post($post, $context = 'display') {
if ( 'raw' == $context )
return $post;
if ( is_object($post) )
if ( is_object($post) ) {
if ( !isset($post->ID) )
return $post;
foreach ( array_keys(get_object_vars($post)) as $field )
$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
else
} else {
if ( !isset($post['ID']) )
return $post;
foreach ( array_keys($post) as $field )
$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
}
return $post;
}
@@ -2366,7 +2371,7 @@ function wp_mime_type_icon( $mime = 0 ) {
* @return int Same as $post_id
*/
function wp_check_for_changed_slugs($post_id) {
if ( !strlen($_POST['wp-old-slug']) )
if ( !isset($_POST['wp-old-slug']) || !strlen($_POST['wp-old-slug']) )
return $post_id;
$post = &get_post($post_id);