move partial search to comicpress class for testing purposes

This commit is contained in:
John Bintz 2009-07-19 19:08:27 -04:00
parent cb9d2b6ccc
commit c59767468b
2 changed files with 16 additions and 9 deletions

View File

@ -303,6 +303,18 @@ class ComicPress {
* Get the next comic from the current one. * 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); } function get_next_comic($category = null, $override_post = null) { return $this->get_adjacent_comic($category, true, $override_post); }
function get_partial_path($partials) {
foreach ($partials as $partial) {
foreach ($comicpress->partial_paths as $path) {
$target = $path . '/' . $partial . '.inc';
if (file_exists($target)) {
include($target);
return;
}
}
}
}
} }
?> ?>

View File

@ -76,19 +76,14 @@ function comicpress_get_header() {
function include_partial($partials = '') { function include_partial($partials = '') {
global $comicpress; global $comicpress;
if (!is_array($partials)) { if (!is_array($partials)) {
$partials = func_get_args(); $partials = func_get_args();
} }
foreach ($partials as $partial) { $target = $comicpress->get_partial_path($partials);
foreach ($comicpress->partial_paths as $path) {
$target = $path . '/' . $partial . '.inc'; if ($target !== false) { include($target); }
if (file_exists($target)) {
include($target);
return;
}
}
}
} }
function in_comic_category() { function in_comic_category() {