From c59767468b047754268844b6e28e555243a3fbe2 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 19 Jul 2009 19:08:27 -0400 Subject: [PATCH] move partial search to comicpress class for testing purposes --- classes/ComicPress.inc | 12 ++++++++++++ functions.php | 13 ++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 235f5fc..9eeed7f 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -303,6 +303,18 @@ class ComicPress { * 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_partial_path($partials) { + foreach ($partials as $partial) { + foreach ($comicpress->partial_paths as $path) { + $target = $path . '/' . $partial . '.inc'; + if (file_exists($target)) { + include($target); + return; + } + } + } + } } ?> \ No newline at end of file diff --git a/functions.php b/functions.php index 8bc51ab..cca9285 100644 --- a/functions.php +++ b/functions.php @@ -76,19 +76,14 @@ function comicpress_get_header() { function include_partial($partials = '') { global $comicpress; + if (!is_array($partials)) { $partials = func_get_args(); } - foreach ($partials as $partial) { - foreach ($comicpress->partial_paths as $path) { - $target = $path . '/' . $partial . '.inc'; - if (file_exists($target)) { - include($target); - return; - } - } - } + $target = $comicpress->get_partial_path($partials); + + if ($target !== false) { include($target); } } function in_comic_category() {