fix bug in post normailzation

This commit is contained in:
John Bintz 2009-08-22 18:31:10 -04:00
parent 51332cef0b
commit fa64f77738
2 changed files with 10 additions and 4 deletions

View File

@ -170,10 +170,16 @@ class ComicPressComicPost {
usort($remaining_posts_to_sort[$type], array(&$this, 'sort_remaining_comic_images'));
}
$result = array_merge($comic_image_ordering, $remaining_posts_to_sort);
foreach ($remaining_posts_to_sort as $type => $posts) {
if (is_array($comic_image_ordering[$type])) {
$comic_image_ordering[$type] = array_merge($comic_image_ordering[$type], $posts);
} else {
$comic_image_ordering[$type] = $posts;
}
}
update_post_meta($this->post->ID, 'comic_ordering', $this->build_comic_ordering_string($result));
return $result;
update_post_meta($this->post->ID, 'comic_ordering', $this->build_comic_ordering_string($comic_image_ordering));
return $comic_image_ordering;
}
}

View File

@ -151,7 +151,7 @@ class ComicPressComicPostTest extends PHPUnit_Framework_TestCase {
$p->expects($this->any())->method('get_comic_image_attachments')->will($this->returnValue($attachments));
wp_insert_post((object)array('ID' => 1));
update_post_meta(1, 'comic_ordering', "comic:3,2");
update_post_meta(1, 'comic_ordering', "comic:3");
$p->post = (object)array('ID' => 1);