rework backend post generation

This commit is contained in:
John Bintz 2009-12-06 14:18:11 -05:00
parent a46e9ad58b
commit 9525ed566a
2 changed files with 13 additions and 5 deletions

View File

@ -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;
}

View File

@ -31,11 +31,13 @@ class ComicPressBackendAttachment extends ComicPressBackend {
return $result;
}
function ComicPressBackendAttachment($attachment) {
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') {
$comicpress = ComicPress::get_instance();