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,11 +31,13 @@ class ComicPressBackendAttachment extends ComicPressBackend {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ComicPressBackendAttachment($attachment) {
|
function ComicPressBackendAttachment($attachment = null) {
|
||||||
|
if (!is_null($attachment)) {
|
||||||
$this->attachment = $attachment;
|
$this->attachment = $attachment;
|
||||||
$this->id = sprintf('%s-%d', $this->root_id, $this->attachment->ID);
|
$this->id = sprintf('%s-%d', $this->root_id, $this->attachment->ID);
|
||||||
$this->type = get_post_meta($this->attachment->ID, 'comic_image_type', true);
|
$this->type = get_post_meta($this->attachment->ID, 'comic_image_type', true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function dims($size = 'comic') {
|
function dims($size = 'comic') {
|
||||||
$comicpress = ComicPress::get_instance();
|
$comicpress = ComicPress::get_instance();
|
||||||
|
Loading…
Reference in New Issue
Block a user