rework backend post generation
This commit is contained in:
parent
a46e9ad58b
commit
9525ed566a
|
@ -15,7 +15,13 @@ class ComicPressComicPost {
|
||||||
$comicpress = ComicPress::get_instance();
|
$comicpress = ComicPress::get_instance();
|
||||||
$attachments = array();
|
$attachments = array();
|
||||||
foreach ($comicpress->backends as $backend) {
|
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;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,12 @@ class ComicPressBackendAttachment extends ComicPressBackend {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ComicPressBackendAttachment($attachment) {
|
function ComicPressBackendAttachment($attachment = null) {
|
||||||
$this->attachment = $attachment;
|
if (!is_null($attachment)) {
|
||||||
$this->id = sprintf('%s-%d', $this->root_id, $this->attachment->ID);
|
$this->attachment = $attachment;
|
||||||
$this->type = get_post_meta($this->attachment->ID, 'comic_image_type', true);
|
$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') {
|
function dims($size = 'comic') {
|
||||||
|
|
Loading…
Reference in New Issue