comicpress-core/classes/ComicPressBackend.inc

35 lines
850 B
PHP
Raw Normal View History

2009-11-09 03:11:26 +00:00
<?php
class ComicPressBackend {
function _embed_image($size) {
$extras = array();
2009-11-11 13:46:26 +00:00
$dims = $this->dims($size);
if (!empty($dims)) {
if (is_array($dims)) {
$extras = array_merge($extras, $dims);
}
2009-11-09 03:11:26 +00:00
}
2009-11-12 03:07:34 +00:00
2009-11-09 03:11:26 +00:00
foreach ($extras as $field => $value) {
2009-11-16 17:35:48 +00:00
if (!empty($value)) {
$extras[] = "${field}=\"${value}\" ";
}
2009-11-09 03:11:26 +00:00
unset($extras[$field]);
}
2009-11-11 13:46:26 +00:00
$output = sprintf('<img src="%s" alt="%s" title="%s" %s/>', $this->url(), $this->alt(), $this->title(), implode("", $extras));
2009-11-09 03:11:26 +00:00
return apply_filters('comicpress_embed_image', $output, $this);
}
2009-11-12 03:07:34 +00:00
function generate_from_id($id) {
$comicpress = ComicPress::get_instance();
foreach ($comicpress->backends as $backend) {
2009-11-13 01:25:46 +00:00
$result = call_user_func(array($backend, 'generate_from_id'), $id);
2009-11-12 03:07:34 +00:00
if ($result !== false) {
return $result;
}
}
return false;
}
2009-11-13 01:25:46 +00:00
}