working on decoupling

This commit is contained in:
John Bintz 2009-10-19 20:56:32 -04:00
parent c23d3d646c
commit d0228e830a
4 changed files with 17 additions and 20 deletions

View File

@ -408,16 +408,6 @@ class ComicPress {
return new WP_Query();
}
/**
* Get the previous comic from the current one.
*/
function get_previous_comic($category = null, $override_post = null) { return $this->get_adjacent_comic($category, false, $override_post); }
/**
* Get the next comic from the current one.
*/
function get_next_comic($category = null, $override_post = null) { return $this->get_adjacent_comic($category, true, $override_post); }
/**
* Get the path to a partial.
* @param array $partials The partials to search for in each path.

View File

@ -3,11 +3,9 @@
class ComicPressComicPost {
var $post;
var $attachments = null;
var $comicpress;
function ComicPressComicPost($post = null, $comicpress = null) {
function ComicPressComicPost($post = null) {
if (!is_null($post)) { $this->post = $post; }
if (!is_null($comicpress)) { $this->comicpress = $comicpress; }
}
function get_comic_image_attachments() {
@ -21,6 +19,9 @@ class ComicPressComicPost {
return $this->attachments;
}
/**
* 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;
@ -51,7 +52,9 @@ class ComicPressComicPost {
}
}
}
echo apply_filters('comicpress_display_attached_images', implode("\n", $output), $this->post->ID);
if (!empty($output)) {
echo apply_filters('comicpress_display_attached_images', $output, $this->post->ID, '');
}
return $found;
}
@ -69,6 +72,9 @@ class ComicPressComicPost {
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();
@ -193,6 +199,7 @@ class ComicPressComicPost {
update_post_meta($this->post->ID, 'comic_ordering', $new_order);
}
}
?>

View File

@ -96,7 +96,7 @@ class ComicPressStoryline {
return false;
}
function get_valid_storyline_nav($post_id) {
function get_valid_nav($post_id) {
$data = false;
foreach (wp_get_post_categories($post_id) as $category) {

View File

@ -110,7 +110,7 @@ class ComicPressStorylineTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($expected_value, $this->css->{$field}($category));
}
function providerTestGetValidStorylineNav() {
function providerTestGetValidNav() {
return array(
array(array(1), array('upcoming')),
array(array(1,2), false),
@ -121,9 +121,9 @@ class ComicPressStorylineTest extends PHPUnit_Framework_TestCase {
}
/**
* @dataProvider providerTestGetValidStorylineNav
* @dataProvider providerTestGetValidNav
*/
function testGetValidStorylineNav($post_categories, $expected_navigation) {
function testGetValidNav($post_categories, $expected_navigation) {
wp_set_post_categories(1, $post_categories);
$this->css->_structure = array(