Notice fixes from DD32. see #7509
git-svn-id: http://svn.automattic.com/wordpress/trunk@9699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1677,6 +1677,7 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
|
||||
if ( empty($tags) )
|
||||
$tags = array();
|
||||
$tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
|
||||
$tags = array_map('trim', $tags); //Trim whitespace from around the tags.
|
||||
wp_set_object_terms($post_id, $tags, 'post_tag', $append);
|
||||
}
|
||||
|
||||
@@ -2158,8 +2159,10 @@ function &get_pages($args = '') {
|
||||
|
||||
$pages = $wpdb->get_results($query);
|
||||
|
||||
if ( empty($pages) )
|
||||
return apply_filters('get_pages', array(), $r);
|
||||
if ( empty($pages) ) {
|
||||
$page = apply_filters('get_pages', array(), $r);
|
||||
return $pages;
|
||||
}
|
||||
|
||||
// Update cache.
|
||||
update_page_cache($pages);
|
||||
@@ -2261,7 +2264,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
|
||||
extract($object, EXTR_SKIP);
|
||||
|
||||
// Make sure we set a valid category
|
||||
if (0 == count($post_category) || !is_array($post_category)) {
|
||||
if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
|
||||
$post_category = array(get_option('default_category'));
|
||||
}
|
||||
|
||||
@@ -2272,10 +2275,12 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
|
||||
$post_status = 'inherit';
|
||||
|
||||
// Are we updating or creating?
|
||||
$update = false;
|
||||
if ( !empty($ID) ) {
|
||||
$update = true;
|
||||
$post_ID = (int) $ID;
|
||||
} else {
|
||||
$update = false;
|
||||
$post_ID = 0;
|
||||
}
|
||||
|
||||
// Create a valid post name.
|
||||
@@ -3241,8 +3246,8 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) {
|
||||
$return['post_status'] = 'inherit';
|
||||
$return['post_type'] = 'revision';
|
||||
$return['post_name'] = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
|
||||
$return['post_date'] = $post['post_modified'];
|
||||
$return['post_date_gmt'] = $post['post_modified_gmt'];
|
||||
$return['post_date'] = isset($post['post_modified']) ? $post['post_modified'] : '';
|
||||
$return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user