remove some unneeded code, posts no longer display images

This commit is contained in:
John Bintz 2009-11-10 22:17:52 -05:00
parent d2e227a549
commit 13e2e0cffb
2 changed files with 2 additions and 85 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.buildpath
.project
.settings/
coverage/

View File

@ -22,91 +22,7 @@ class ComicPressComicPost {
}
/**
* Display all the attached images.
*/
function display_attached_images($type = "comic", $limit = null, $size_type = null, $format = "%s") {
if (is_null($size_type)) { $size_type = $type; }
$found = false;
$ordering = $this->normalize_comic_image_ordering($this->post->ID);
$output = array();
if (is_array($ordering[$type])) {
$i = 1;
foreach ($ordering[$type] as $attachment_id) {
if (get_post_meta($attachment_id, "comic_image_type", true) == $type) {
$attachment = get_post($attachment_id);
$title = (!empty($attachment->post_excerpt) ? $attachment->post_excerpt : $attachment->post_title);
$url = wp_get_attachment_url($attachment->ID, '');
$sizes = image_downsize($attachment->ID, $size_type);
if ($sizes) {
$url = $sizes[0];
}
$output[] = apply_filters('comicpress_attached_image',
sprintf($format, $this->get_comic_img_tag($url, $size_type, array('title' => $title))),
$attachment_id,
$i++);
$found = true;
if (!is_null($limit)) {
if (--$limit == 0) { break; }
}
}
}
}
if (!empty($output)) {
echo apply_filters('comicpress_display_attached_images', $output, $this->post->ID, '');
}
return $found;
}
function _display_type($types, $format, $single = false) {
$target_type = reset($types);
foreach ($types as $type) {
if ($this->display_attached_images($type, ($single ? 1 : null), $target_type, $format)) {
return;
}
}
}
function display_comics($format) { $this->_display_type(array('comic'), $format); }
function display_archive($format) { $this->_display_type(array('archive'. 'comic'), $format, true); }
function display_rss($format) { $this->_display_type(array('rss'. 'comic'), $format); }
/**
* Build an <img /> tag for a comic.
*/
function get_comic_img_tag($url, $type, $additional_parameters = array()) {
$dimensions = array();
if (isset($this->comicpress->comicpress_options["${type}_dimensions"])) {
$parts = explode("x", $this->comicpress->comicpress_options["${type}_dimensions"]);
switch (count($parts)) {
case 1: list($width) = $parts; break;
case 2: list($width, $height) = $parts; break;
}
$dimensions = compact('width', 'height');
}
$output = '<img src="' . $url . '" ';
foreach (array('width', 'height') as $field) {
if (!empty($dimensions[$field])) {
$output .= $field . '="' . $dimensions[$field] . '" ';
}
}
if (is_array($additional_parameters)) {
foreach ($additional_parameters as $parameter => $value) {
$output .= $parameter . '="' . $value . '" ';
}
}
$output .= "/>";
return $output;
}
/**
* Normalize the ordering of comic images in this post.
* Normalize the ordering of attachments in this post.
* If images have beed added or removed, intelligently update the metadata.
*/
function normalize_ordering() {