comicpress-core/classes/ComicPressBackend.inc

32 lines
793 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-11 13:46:26 +00:00
$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) {
$result = $backend->generate_from_id($id);
if ($result !== false) {
return $result;
}
}
return false;
}
2009-11-09 03:11:26 +00:00
}