support for arrays in backend_url_image in prep for meta box

This commit is contained in:
John Bintz 2009-12-03 18:43:07 -05:00
parent ab3af9244a
commit cae60abc4f
2 changed files with 7 additions and 0 deletions

View File

@ -121,8 +121,14 @@ class ComicPressMediaHandling {
}
if ($result = get_post_meta($post_to_use->ID, "backend_url_images", true)) {
$types = false;
if (is_string($result)) {
parse_str($result, $types);
}
if (is_array($result)) {
$types = $result;
}
if (is_array($types)) {
if (isset($types[$type])) {
return $types[$type];
}

View File

@ -183,6 +183,7 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
array('comic', array('backend_url_comic' => '/test'), '/test'),
array('comic', array('backend_url_images' => 'test=/test'), false),
array('comic', array('backend_url_images' => 'comic=/test'), '/test'),
array('comic', array('backend_url_images' => array('comic' => '/test')), '/test'),
array('comic', array('backend_url' => '/test'), '/test'),
);
}