diff --git a/classes/ComicPressComicPost.inc b/classes/ComicPressComicPost.inc index efac07e..1daafd9 100644 --- a/classes/ComicPressComicPost.inc +++ b/classes/ComicPressComicPost.inc @@ -15,7 +15,13 @@ class ComicPressComicPost { $comicpress = ComicPress::get_instance(); $attachments = array(); foreach ($comicpress->backends as $backend) { - $attachments = array_merge($attachments, call_user_func(array($backend, 'generate_from_post'), $this->post)); + if (is_string($backend)) { + $a = new $backend(); + } + if (is_object($backend)) { + $a = $backend; + } + $attachments = array_merge($attachments, $a->generate_from_post($this->post)); } return $attachments; } diff --git a/classes/backends/ComicPressBackendAttachment.inc b/classes/backends/ComicPressBackendAttachment.inc index ddaca16..cd7a553 100644 --- a/classes/backends/ComicPressBackendAttachment.inc +++ b/classes/backends/ComicPressBackendAttachment.inc @@ -31,10 +31,12 @@ class ComicPressBackendAttachment extends ComicPressBackend { return $result; } - function ComicPressBackendAttachment($attachment) { - $this->attachment = $attachment; - $this->id = sprintf('%s-%d', $this->root_id, $this->attachment->ID); - $this->type = get_post_meta($this->attachment->ID, 'comic_image_type', true); + function ComicPressBackendAttachment($attachment = null) { + if (!is_null($attachment)) { + $this->attachment = $attachment; + $this->id = sprintf('%s-%d', $this->root_id, $this->attachment->ID); + $this->type = get_post_meta($this->attachment->ID, 'comic_image_type', true); + } } function dims($size = 'comic') {