diff --git a/404.php b/404.php deleted file mode 100644 index 29146e5..0000000 --- a/404.php +++ /dev/null @@ -1,18 +0,0 @@ - - - -
-
-
-

-

-

-
-
-
-
- - - - - \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index 26b0e68..0000000 --- a/README +++ /dev/null @@ -1,18 +0,0 @@ -ComicPress is the WordPress Comic Pubishing Theme. - -Copyright 2005-2009 Tyler Martin -Copyright 2008-2009 John Bintz -Copyright 2009 Philip M. Hofer - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . diff --git a/archive-comic-calendar.php b/archive-comic-calendar.php deleted file mode 100644 index c5754a9..0000000 --- a/archive-comic-calendar.php +++ /dev/null @@ -1,162 +0,0 @@ - - - - -query('&showposts=1000&cat='.get_all_comic_categories_as_cat_string().'&year='.$archive_year); -while ($comicArchive->have_posts()) : $comicArchive->the_post(); - $calTitle = get_the_title(); - $calLink = get_permalink(); - $calDay = get_the_time('j'); - $calMonth = get_the_time('F'); - $calComic[$calMonth.$calDay] = array('link' => $calLink, 'title' => $calTitle); -endwhile; -$post = $tempPost; - -function leapYear($yr) { - if ($yr % 4 != 0) { - return 28; - } else { - if ($yr % 100 != 0) { - return 29; - } else { - if ($yr % 400 != 0) { - return 28; - } else { - return 29; - } - } - } -} -$leapYear = leapYear($archive_year); - -$month['1'] = array('month' => __('January','comicpress'), 'days' => '31'); -$month['2'] = array('month' => __('February','comicpress'), 'days' => $leapYear); -$month['3'] = array('month' => __('March','comicpress'), 'days' => '31'); -$month['4'] = array('month' => __('April','comicpress'), 'days' => '30'); -$month['5'] = array('month' => __('May','comicpress'), 'days' => '31'); -$month['6'] = array('month' => __('June','comicpress'), 'days' => '30'); -$month['7'] = array('month' => __('July','comicpress'), 'days' => '31'); -$month['8'] = array('month' => __('August','comicpress'), 'days' => '31'); -$month['9'] = array('month' => __('September','comicpress'), 'days' => '30'); -$month['10'] = array('month' => __('October','comicpress'), 'days' => '31'); -$month['11'] = array('month' => __('November','comicpress'), 'days' => '30'); -$month['12'] = array('month' => __('December','comicpress'), 'days' => '31'); - -?> -
-
-
- -
-

- -
- - -
| -get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC"); -foreach ( $years as $year ) { - if ($year != (0) ) { ?> - | - -
-
- -
- - - - 0) { - if (is_array($monthfile)) $monthfile = reset($monthfile); ?> - <?php echo $month[$i]['month'] ?> - - <?php echo $month[$i]['month'] ?> - - - 0) { - if (is_array($monthfile)) $monthfile = reset($monthfile); ?> - <?php echo $month[$i]['month'] ?> - - <?php echo $month[$i]['month'] ?> - - - - - - - - 0) { - if (is_array($monthfile)) $monthfile = reset($monthfile); ?> - <?php echo $month[$i]['month'] ?> - - <?php echo $month[$i]['month'] ?> - - - 0) { - if (is_array($monthfile)) $monthfile = reset($monthfile); ?> - <?php echo $month[$i]['month'] ?> - - <?php echo $month[$i]['month'] ?> - - - - - -
- -
- -
- -
- -
- -
- - - -
- -
- -
-
-
-
- -comment_status) { comments_template('', true); } ?> - - - \ No newline at end of file diff --git a/archive-comic-month.php b/archive-comic-month.php deleted file mode 100644 index 8e67b50..0000000 --- a/archive-comic-month.php +++ /dev/null @@ -1,45 +0,0 @@ - - - - -
-
-
- -
-

- -
- - - '" . date('Y-m-d', strtotime('-30 days')) . "'"; -// $where .= " AND post_date >= '2009-03-01' AND post_date < '2009-03-16'"; - return $where; - } -add_filter('posts_where', 'filter_where'); -$posts = query_posts('&show_posts=-1&posts_per_page=-1&cat='.get_all_comic_categories_as_cat_string()); - -?> - - -
-
- <?php the_title() ?>
-
-
- -
-
-
-
- - - \ No newline at end of file diff --git a/archive-comic-storyline-thumbs.php b/archive-comic-storyline-thumbs.php deleted file mode 100644 index 33a1780..0000000 --- a/archive-comic-storyline-thumbs.php +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
-
-
- -
-

- -
- -
    -description; - $first_comic_in_category = get_terminal_post_in_category($category_id,true); - $first_comic_permalink = get_permalink($first_comic_in_category->ID); - $archive_image = null; - foreach (array("mini", "archive", "rss", "comic") as $type) { - if (($requested_archive_image = get_comic_url($type, $first_comic_in_category)) !== false) { - $archive_image = $requested_archive_image; break; - } - } - if ($target_depth < $current_depth) { - echo str_repeat("
", ($current_depth - $target_depth)); - } - if ($target_depth > $current_depth) { - for ($i = $current_depth; $i < $target_depth; ++$i) { - $next_i = $i + 1; - echo "
    • "; - } - } ?> - -
    • > - - - - cat_name ?> - -
      - -
      -
    • - - 0) { - echo str_repeat("
  • ", $current_depth); - } - } - } else { ?> -



  • ComicPress Manager
  • - - -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/archive-comic-storyline.php b/archive-comic-storyline.php deleted file mode 100644 index d27ae77..0000000 --- a/archive-comic-storyline.php +++ /dev/null @@ -1,77 +0,0 @@ - - - - -
    -
    -
    - -
    -

    - -
    - -
      - description; - $first_comic_in_category = get_terminal_post_in_category($category_id); - $first_comic_permalink = get_permalink($first_comic_in_category->ID); - $archive_image = null; - foreach (array("mini", "archive", "rss", "comic") as $type) { - if (($requested_archive_image = get_comic_url($type, $first_comic_in_category)) !== false) { - $archive_image = $requested_archive_image; break; - } - } - if ($target_depth < $current_depth) { - echo str_repeat("
    ", ($current_depth - $target_depth)); - } - if ($target_depth > $current_depth) { - for ($i = $current_depth; $i < $target_depth; ++$i) { - $next_i = $i + 1; - echo "
  • ", $current_depth); - } - } - } else { ?> -



  • ComicPress Manager
  • - - -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/archive-comic-year.php b/archive-comic-year.php deleted file mode 100644 index e9eb76e..0000000 --- a/archive-comic-year.php +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - -
    -
    -
    - -
    -

    - -
    - -
    | - get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC"); - foreach ( $years as $year ) { - if ($year != (0) ) { ?> - | - -
    - - - query('&showposts=-1&cat='.get_all_comic_categories_as_cat_string().'&year='.$archive_year); - while ($comicArchive->have_posts()) : $comicArchive->the_post() ?> - - -
    - -
    - -
    -
    -
    - - - \ No newline at end of file diff --git a/archive-comic.php b/archive-comic.php deleted file mode 100644 index 337149c..0000000 --- a/archive-comic.php +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
    -
    -
    - -
    -

    - -
    - - - get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC"); - foreach ( $years as $year ) { - if ($year != (0) ) { ?> -

    - - query('showposts=10000&cat='.get_all_comic_categories_as_cat_string().'&year='.$year); - while ($comicArchive->have_posts()) : $comicArchive->the_post() ?> - - -
    - - -
    - -
    -
    -
    - - - - \ No newline at end of file diff --git a/archive.php b/archive.php deleted file mode 100644 index a90c1aa..0000000 --- a/archive.php +++ /dev/null @@ -1,155 +0,0 @@ -post_count; - - if (!$count) $count = "no"; -?> - - - -
    -
    -
    -
    - - -

    - -

    - -

    - -

    - -

    - -

    - -

    - -
    -
    -
    -
    -
    -
    - - - - - - -
    -
    - <?php the_title() ?> -
    -
    - - - -
    -
    -
    - -
    - <?php the_title() ?>
    -
    -
    -
    -
    -
    - -
    -
    -
    > - - -
    -
    -
    - '); ?> -
    -
    -
    -
    -
    -
    - - - -
    - -
    -
    -
    -

    -

    -

    -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/archives.php b/archives.php deleted file mode 100644 index a710c48..0000000 --- a/archives.php +++ /dev/null @@ -1,24 +0,0 @@ - - - - -
    -
    -
    -
    -

    -
    -

    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/author.php b/author.php deleted file mode 100644 index af87b63..0000000 --- a/author.php +++ /dev/null @@ -1,70 +0,0 @@ - - - - -

    - -
    -
    -
    -
    - display_name, 1)."' title='".wp_specialchars($curauth->display_name, 1), comicpress_get_avatar($curauth->user_email, 64)); ?> -
    -
    -
    - display_name) - $authorname = $curauth->display_name; - elseif($curauth->user_nickname) - $authorname = $curauth->nickname; - elseif($curauth->user_nicename) - $authorname = $curauth->user_nicename; - else - $authorname = $curauth->user_login; - ?> -
    - user_registered)); ?>
    -
    - user_url)) { ?> user_url; ?>
    - aim)) { ?> aim; ?>
    - jabber)) { ?> jabber; ?>
    - yim)) { ?> jabber; ?>
    -
    - description)) { ?> -
    - description; ?> -
    - -
    -
    -
    - -

    (ID); ?>) ¬

    - -
      - - - - - -
      -
    - - - - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/blog.php b/blog.php deleted file mode 100644 index db2896d..0000000 --- a/blog.php +++ /dev/null @@ -1,54 +0,0 @@ - - - - - -
    -
    -
    - - View all posts by:
    -
    -
    -
    - - View all posts by:
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/buystrip.php b/buystrip.php deleted file mode 100644 index e97060f..0000000 --- a/buystrip.php +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    - <?php _e('Powered by Paypal','comicpress'); ?>
    -
    -
    -

    -
    -
    - - #
    -
    -
    - - -
    - <?php the_title(); ?>
    -
    - - - - - - -
    -
    - - - - - - - - - - US/Canada
    - $ + $
    - - US/Canada
    - $
    - - -
    -
    - -
    - - - - - - - - - - International
    - $ + $
    - - International
    - $
    - - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - - -
    -
    -
    -

    -
    - - '

    '.__('Pages:','comicpress').' ', 'after' => '

    ', 'next_or_number' => 'number')) ?> -
    - ', '

    ') ?> -
    -
    -
    -
    - - - - - diff --git a/chrome_style.css b/chrome_style.css deleted file mode 100644 index 0b0c65a..0000000 --- a/chrome_style.css +++ /dev/null @@ -1,19 +0,0 @@ -/* ComicPress Custom CSS over-rides for [ chrome ]: ComicPress - 2.8 */ - -html { overflow-y: scroll; } - -.comicarchiveframe { - opacity:0.99; /* firefox, opera, safari, chrome */ -} - - .comicarchiveframe:hover { - opacity:0.70; /* firefox, opera, safari, chrome */ - } - - .imagenav-link img { - opacity:0.5; /* firefox, opera, safari, chrome */ - } - - .imagenav-link img:hover { - opacity:0.5; /* firefox, opera, safari, chrome */ - } \ No newline at end of file diff --git a/classes/ComicPressDBInterface.inc b/classes/ComicPressDBInterface.inc deleted file mode 100644 index d844749..0000000 --- a/classes/ComicPressDBInterface.inc +++ /dev/null @@ -1,111 +0,0 @@ -_all_categories = get_all_category_ids(); - $this->_non_comic_categories = array_values(array_diff($this->_all_categories, $categories)); - } - - function _get_categories_to_exclude($category = null) { - $result = array_diff($this->_all_categories, array($category)); - if (is_array($result)) { - return (is_null($category)) ? $this->_non_comic_categories : array_values($result); - } else { - return $this->_non_comic_categories; - } - } - - /** - * Find the terminal post in a specific category. - */ - function get_terminal_post_in_category($category_id, $first = true) { - $this->_prepare_wp_query(); - - $sort_order = $first ? "asc" : "desc"; - $terminal_comic_query = new WP_Query(); - $terminal_comic_query->query("showposts=1&order=${sort_order}&cat=${category_id}&status=publish"); - $post = false; - if ($terminal_comic_query->have_posts()) { - $post = reset($terminal_comic_query->posts); - } - - $this->_reset_wp_query(); - return $post; - } - - /** - * Get the first comic in a category. - */ - function get_first_comic($category_id) { - return $this->get_terminal_post_in_category($category_id); - } - - /** - * Get the last comic in a category. - */ - function get_last_comic($category_id) { - return $this->get_terminal_post_in_category($category_id, false); - } - - /** - * Get the comic post adjacent to the current comic. - * Wrapper around get_adjacent_post(). Don't unit test this method. - */ - function get_adjacent_comic($category, $next = false, $override_post = null) { - global $post; - - $this->_prepare_wp_query(); - if (!is_null($override_post)) { $temp_post = $post; $post = $override_post; } - - $result = get_adjacent_post(false, implode(" and ", $this->_get_categories_to_exclude($category)), !$next); - - $this->_reset_wp_query(); - if (!is_null($override_post)) { $post = $temp_post; } - - return empty($result) ? false : $result; - } - - function _prepare_wp_query() { - global $wp_query; - - $this->is_single = $wp_query->is_single; - $this->in_the_loop = $wp_query->in_the_loop; - - $wp_query->is_single = $wp_query->in_the_loop = true; - } - - function _reset_wp_query() { - global $wp_query; - - $wp_query->is_single = $this->is_single; - $wp_query->in_the_loop = $this->in_the_loop; - } - - /** - * 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); } -} - -?> diff --git a/classes/ComicPressNavigation.inc b/classes/ComicPressNavigation.inc deleted file mode 100644 index 2097b0b..0000000 --- a/classes/ComicPressNavigation.inc +++ /dev/null @@ -1,68 +0,0 @@ -_storyline = $storyline; - $this->_dbi = ComicPressDBInterface::get_instance(); - } - - function get_post_nav($post) { - $nav = array(); - if (is_object($post)) { - if (isset($post->ID)) { - $cache_key = 'navigation-' . $post->ID; - - if (($result = wp_cache_get($cache_key, 'comicpress')) !== false) { - foreach ($result as $key => $post_id) { - $nev[$key] = get_post($post_id); - } - } - - // global previous/next - foreach (array('previous', 'next') as $field) { - $nav[$field] = $this->_dbi->{"get_${field}_comic"}(null, $post); - } - - // global first/last - foreach (array('first', 'last') as $field) { - $nav[$field] = $this->_dbi->{"get_${field}_comic"}(null); - } - - if ($category = $this->_storyline->get_valid_post_category($post->ID)) { - // storyline previous/next - foreach (array('previous', 'next') as $field) { - $nav["storyline-${field}"] = $this->_dbi->{"get_${field}_comic"}($category, $post); - } - - // adjacent storyline nodes - if (is_array($valid = $this->_storyline->valid($category))) { - foreach ($valid as $field) { - $all_adjacents = $this->_storyline->all_adjacent($category, $field); - foreach ($all_adjacents as $adjacent_category) { - $result = $this->_dbi->get_first_comic($adjacent_category); - if (!empty($result)) { - $nav["storyline-chapter-${field}"] = $result; break; - } - } - } - } - } - - $cache_data = array(); - foreach ($nav as $key => $output_post) { - if (!empty($output_post)) { $cache_data[$key] = $output_post->ID; } - if ($output_post->ID == $post->ID) { $nav[$key] = false; } - } - - wp_cache_set($cache_key, $cache_data, 'comicpress'); - - return $nav; - } - } - } -} - -?> \ No newline at end of file diff --git a/classes/ComicPressStoryline.inc b/classes/ComicPressStoryline.inc deleted file mode 100644 index ca4ba52..0000000 --- a/classes/ComicPressStoryline.inc +++ /dev/null @@ -1,589 +0,0 @@ -create_structure($this->get_flattened_storyline()); - return $this; - } - - /** - * Get the flattened storyline from options. - */ - function get_flattened_storyline() { - $comicpress = &ComicPress::get_instance(); - return $comicpress->comicpress_options['storyline_order']; - } - - /** - * Set the global storyline as a flattened storyline. - */ - function set_flattened_storyline($storyline) { - $comicpress = &ComicPress::get_instance(); - $comicpress->comicpress_options['storyline_order'] = $storyline; - $comicpress->save(); - } - - /** - * Set the order from a flattened storyline. - */ - function set_order_via_flattened_storyline($order) { - $nodes = explode(',', $order); - $original_nodes = explode(',', $this->get_flattened_storyline()); - - $missing_good_nodes = array_diff($original_nodes, $nodes); - $any_bad_nodes = array_diff($nodes, $original_nodes); - - if (empty($missing_good_nodes) && empty($any_bad_nodes)) { - $this->set_flattened_storyline($order); - return true; - } else { - return false; - } - } - - /** - * Create a searchable structure from a node list. - * @param array $structure The structure to process. - * @return boolean True if the structure was valid. - */ - function create_structure($structure) { - $key = null; - if (is_string($structure)) { - $key = $structure; - $structure = explode(',', $structure); - } else { - if (is_array($structure)) { - $fixed_structure = array(); - foreach ($structure as $s) { - if (!is_array($s)) { $fixed_structure[] = $s; } - } - $key = implode(',', $fixed_structure); - } - } - - if (!is_null($key)) { - $key = "storyline-structure-${key}"; - - if (($result = wp_cache_get($key, 'comicpress')) !== false) { - $this->_structure = $result; - } else { - $new_structure = array(); - $parent = null; - $all_leaves = array(); - - $adjacents_by_parent = array(); - - if (is_array($structure)) { - $is_valid = true; - foreach ($structure as $branch) { - if (is_string($branch)) { - $parts = explode('/', $branch); - $valid = false; - if (count($parts) > 1) { - if ($parts[0] == '0') { $valid = true; } - } - if (!$valid) { - $is_valid = false; break; - } else { - $data = array(); - $leaf = end($parts); - $all_leaves[] = $leaf; - - $data['level'] = count($parts) - 1; - - if (count($parts) > 2) { - $parent = $parts[count($parts) - 2]; - - if (!isset($adjacents_by_parent[$parent])) { - $adjacents_by_parent[$parent] = array(); - } - $adjacents_by_parent[$parent][] = $leaf; - - $data['parent'] = $parent; - } - - $new_structure[$leaf] = $data; - } - } else { - $is_valid = false; break; - } - } - if ($is_valid) { - for ($i = 0; $i < count($all_leaves); ++$i) { - foreach (array('previous' => -1, 'next' => 1) as $type => $dir) { - if (isset($all_leaves[$i + $dir])) { - $new_structure[$all_leaves[$i]][$type] = $all_leaves[$i + $dir]; - } - } - } - - $this->_structure = $new_structure; - } - } - wp_cache_set($key, $this->_structure, 'comicpress'); - } - } - return is_array($this->_structure); - } - - function _get_field($field, $id) { - if (isset($this->_structure)) { - if (isset($this->_structure[$id])) { - if (isset($this->_structure[$id][$field])) { - return $this->_structure[$id][$field]; - } - } - } - return false; - } - - function parent($id) { return $this->_get_field('parent', $id); } - function previous($id) { return $this->_get_field('previous', $id); } - function next($id) { return $this->_get_field('next', $id); } - function valid($id) { - if (isset($this->_structure[$id])) { - return array_keys($this->_structure[$id]); - } - return false; - } - - function all_adjacent($id, $direction) { - if (isset($this->_structure[$id])) { - $all_adjacent = array(); - do { - $has_adjacent = false; - if (!in_array($id, $all_adjacent)) { - if ($has_adjacent = isset($this->_structure[$id][$direction])) { - $all_adjacent[] = $this->_structure[$id][$direction]; - $id = $this->_structure[$id][$direction]; - } - } - } while ($has_adjacent); - return $all_adjacent; - } - return false; - } - - /** - * Get the valid navigation directions for a particular post. - */ - function get_valid_nav($post_id) { - if (($category = $this->get_valid_post_category($post_id)) !== false) { - return $this->valid($category); - } - return false; - } - - /** - * Get the valid comic category for this post. - */ - function get_valid_post_category($post_id) { - $result = false; - - foreach (wp_get_post_categories($post_id) as $category) { - if ($this->valid($category)) { - if ($result) { return false; } - - $result = $category; - } - } - return $result; - } - - /** - * Get all comic categories. - * @deprecated - */ - function get_comic_categories() { - return array_keys($this->_structure); - } - - /** - * Get a simple storyline. - */ - function get_simple_storyline() { - $simple_storyline = array('0' => array()); - foreach ($this->_structure as $category_id => $adjacents) { - $parent = 0; - if (isset($adjacents['parent'])) { $parent = $adjacents['parent']; } - if (!isset($simple_storyline[$parent])) { - $simple_storyline[$parent] = array(); - } - $simple_storyline[$parent][$category_id] = true; - } - - return $this->_merge_simple_storyline($simple_storyline); - } - - /** - * Get a simple structure. - */ - function get_category_simple_structure($parent = null) { - $structure = array(); - foreach (get_all_category_ids() as $category_id) { - $category = get_category($category_id); - if (!isset($structure[$category->parent])) { - $structure[$category->parent] = array(); - } - $structure[$category->parent][$category_id] = true; - } - $structure = $this->_merge_simple_storyline($structure); - if (!empty($parent)) { - if (isset($structure[0])) { - foreach ($structure[0] as $key => $children) { - if ($key != $parent) { unset($structure[0][$key]); } - } - } - } - return $structure; - } - - /** - * Get a flattened category node list. - */ - function get_category_flattened($parent = null) { - return $this->flatten_simple_storyline($this->get_category_simple_structure($parent)); - } - - /** - * Merge a flat simple storyline into a tree. - */ - function _merge_simple_storyline($simple_storyline) { - while (count($simple_storyline) > 0) { - $merge_found = false; - foreach ($simple_storyline as $parent => $children) { - $has_no_descendents = true; - foreach (array_keys($children) as $child) { - if (is_numeric($child)) { - if (isset($simple_storyline[$child])) { - $has_no_descendents = false; - break; - } - } - } - if ($has_no_descendents) { - $merge_found = $parent; break; - } - } - if ($merge_found !== false) { - foreach ($simple_storyline as $parent => $children) { - if (isset($children[$merge_found])) { - $simple_storyline[$parent][$merge_found] = $simple_storyline[$merge_found]; - unset($simple_storyline[$merge_found]); - break; - } - } - } - if (!$merge_found) { break; } - } - return $simple_storyline; - } - - /** - * Integrates a bunch of other things. - */ - function normalize($flattened_storyline = null, $set = true) { - $comicpress = ComicPress::get_instance(); - if (is_null($flattened_storyline)) { - $flattened_storyline = $this->get_flattened_storyline(); - } - $all_categories_flattened = $this->get_category_flattened(); - - $result = $this->normalize_flattened_storyline($flattened_storyline, $all_categories_flattened); - if ($set) { - $this->set_flattened_storyline($result); - } - return $result; - } - - /** - * Sort nodes by node count. - */ - function _length_sort($parts) { - $new = array(); - foreach ($parts as $part) { - $p = explode('/', $part); - if (!isset($new[count($p)])) { - $new[count($p)] = array(); - } - $new[count($p)][] = $part; - } - ksort($new); - $output = array(); - foreach (array_values($new) as $values) { - $output = array_merge($output, $values); - } - return $output; - } - - /** - * Normalize a flattened storyline, inserting and removing categories from the list is necessary. - */ - function normalize_flattened_storyline($storyline, $comic_categories) { - $storyline_nodes = explode(",", $storyline); - $category_nodes = explode(",", $comic_categories); - - $missing_from_storyline = array_diff($category_nodes, $storyline_nodes); - $extra_in_storyline = array_diff($storyline_nodes, $category_nodes); - - if (!empty($missing_from_storyline)) { - $missing_from_storyline = $this->_length_sort($missing_from_storyline); - foreach ($missing_from_storyline as $node) { - $parent_pattern = implode('/', array_slice(explode('/', $node), 0, -1)); - $last = null; - for ($i = 0, $il = count($storyline_nodes); $i < $il; ++$i) { - if (strpos($storyline_nodes[$i], $parent_pattern) === 0) { - $last = $i; - } - } - if (!is_null($last)) { - array_splice($storyline_nodes, $last + 1, 0, array($node)); - } else { - $storyline_nodes[] = $node; - } - } - } - - if (!empty($extra_in_storyline)) { - $new = array(); - foreach ($storyline_nodes as $node) { - if (!in_array($node, $extra_in_storyline)) { - $new[] = $node; - } - } - $storyline_nodes = $new; - } - - return implode(',', $storyline_nodes); - } - - /** - * Flatten a simple storyline. - */ - function flatten_simple_storyline($storyline) { - return implode(',', $this->_follow_simple_storyline($storyline)); - } - - /** - * Follow the nodes of a simple storyline, creating a node list. - */ - function _follow_simple_storyline($storyline, $parent = null) { - $output = array(); - foreach ($storyline as $key => $children) { - if (is_null($parent)) { - $new_parent = $key; - } else { - $new_parent = $parent . '/' . $key; - $output[] = $new_parent; - } - if (is_array($children)) { - $output = array_merge($output, $this->_follow_simple_storyline($children, $new_parent)); - } - } - return $output; - } - - function &include_all() { - $this->_category_search = array_keys($this->_structure); - return $this; - } - - function &exclude_all() { - $this->_category_search = array(); - return $this; - } - - function _find_children($parent) { - if (!is_numeric($parent)) { - foreach (get_all_category_ids() as $id) { - $category = get_category($id); - if ($category->slug == $parent) { - $parent = $id; break; - } - } - } - if (is_numeric($parent)) { - $children = array($parent); - do { - $found_children = false; - foreach ($this->_structure as $category_id => $info) { - if (!in_array($category_id, $children)) { - if (isset($info['parent'])) { - if (in_array($info['parent'], $children)) { - $children[] = $category_id; - $found_children = true; - } - } - } - } - } while ($found_children); - - return $children; - } - return false; - } - - function &_include() { - $args = func_get_args(); - $method = array_shift($args); - $this->_category_search = array_unique(array_merge($this->_category_search, call_user_func_array(array($this, $method), $args))); - sort($this->_category_search); - return $this; - } - - function &_exclude() { - $args = func_get_args(); - $method = array_shift($args); - $this->_category_search = array_diff($this->_category_search, call_user_func_array(array($this, $method), $args)); - sort($this->_category_search); - return $this; - } - - function _find_level_or_above($level = null) { - $found = array(); - foreach ($this->_structure as $category_id => $info) { - if ($info['level'] <= $level) { $found[] = $category_id; } - } - return $found; - } - - function _find_only($id = null) { - if (isset($this->_structure[$id])) { - return array($id); - } - return array(); - } - - function _find_level($level = null) { - $found = array(); - foreach ($this->_structure as $category_id => $info) { - if ($info['level'] == $level) { $found[] = $category_id; } - } - return $found; - } - - function _ensure_post_id($thing) { - $id = null; - if (is_object($thing)) { - if (isset($thing->ID)) { $id = $thing->ID; } - } else { - if (is_numeric($thing)) { $id = $thing; } - } - return $id; - } - - function _find_post_category($post = null) { - $found = array(); - - $id = $this->_ensure_post_id($post); - - if (!is_null($id)) { - if (count($categories = wp_get_post_categories($id)) == 1) { - $found = $categories; - } - } - return $found; - } - - function _find_adjacent($category = null, $next = false) { - $found = array(); - - if (!is_null($category)) { - if (isset($this->_structure[$category])) { - $field = $next ? 'next' : 'previous'; - if (isset($this->_structure[$category][$field])) { - $found = array($this->_structure[$category][$field]); - } - } - } - - return $found; - } - - function _find_post_root($post = null) { - $found = array(); - - $id = $this->_ensure_post_id($post); - - if (!is_null($id)) { - if (count($categories = wp_get_post_categories($id)) == 1) { - $comic_post = new ComicPressComicPost(get_post($id)); - $parents = $comic_post->find_parents(); - if (!empty($parents)) { - $parents = array_keys($parents); $found = $this->_find_children(end($parents)); - } - - } - } - return $found; - } - - function end_search() { - $result = $this->_category_search; - $this->_category_search = array(); - return $result; - } - - function build_from_restrictions($restrictions = null) { - global $post; - - $this->read_from_options(); - $this->exclude_all(); - - $include_all = true; - if (is_array($restrictions)) { - if (!empty($restrictions)) { - $include_all = false; - } - } - - if (!$include_all) { - foreach ($restrictions as $type => $list) { - if (substr($type, 0, 1) == "!") { - $method_root = 'exclude'; - $method_type = substr($type, 1); - } else { - $method_root = 'include'; - $method_type = $type; - } - - if (!is_array($list)) { $list = array($list); } - - foreach ($list as $restriction) { - $method = ''; - $args = array($restriction); - switch ($method_type) { - case 'child_of': $method = 'children'; break; - case 'root_of': $method = 'post_root'; break; - case 'from_post': $method = 'post_category'; break; - case 'previous': - $method = 'adjacent'; - $args[] = false; - break; - case 'next': - $method = 'adjacent'; - $args[] = true; - break; - default: - $method = $method_type; break; - } - if (!empty($method)) { - array_unshift($args, "_find_${method}"); - call_user_func_array(array($this, "_${method_root}"), $args); - } - } - } - } else { - $this->include_all(); - } - - return $this->end_search(); - } -} - -?> diff --git a/comicpress-config.php b/comicpress-config.php deleted file mode 100644 index 09a30e0..0000000 --- a/comicpress-config.php +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/comicpress-options-config.php b/comicpress-options-config.php deleted file mode 100644 index f05afed..0000000 --- a/comicpress-options-config.php +++ /dev/null @@ -1,294 +0,0 @@ - "open"), - - array( - "id" => "comicpress-disable_comic_frontpage", - "default" => "no", - "type" => "comicpress-disable_comic_frontpage"), - - array( - "id" => "comicpress-disable_comic_blog_frontpage", - "default" => "no", - "type" => "comicpress-disable_comic_blog_frontpage"), - - array( - "id" => "comicpress-disable_comic_blog_single", - "default" => "no", - "type" => "comicpress-disable_comic_blog_single"), - - array( - "id" => "comicpress-disable_blog_frontpage", - "default" => "no", - "type" => "comicpress-disable_blog_frontpage"), - - array( - "id" => "comicpress-custom_css", - "default" => "", - "type" => "comicpress-custom_css"), - - array( - "id" => "comicpress-cp_theme_layout", - "default" => "standard", - "type" => "comicpress-cp_theme_layout"), - - array( - "id" => "comicpress-buy_print_email", - "default" => "youremail@youremail.com", - "type" => "comicpress-buy_print_email"), - - array( - "id" => "comicpress-buy_print_url", - "default" => "/shop/", - "type" => "comicpress-buy_print_url"), - - array( - "id" => "comicpress-buy_print_us_amount", - "default" => "19.95", - "type" => "comicpress-buy_print_us_amount"), - - array( - "id" => "comicpress-buy_print_int_amount", - "default" => "29.95", - "type" => "comicpress-buy_print_int_amount"), - - array( - "id" => "comicpress-buy_print_add_shipping", - "default" => "yes", - "type" => "comicpress-buy_print_add_shipping"), - - array( - "id" => "comicpress-buy_print_us_ship", - "default" => "4.95", - "type" => "comicpress-buy_print_us_ship"), - - array( - "id" => "comicpress-buy_print_int_ship", - "default" => "9.95", - "type" => "comicpress-buy_print_int_ship"), - - array( - "id" => "comicpress-transcript_in_posts", - "default" => "no", - "type" => "comicpress-transcript_in_posts"), - - array( - "id" => "comicpress-enable_widgetarea_use_sidebar_css", - "default" => "no", - "type" => "comicpress-enable_widgetarea_use_sidebar_css"), - - array( - "id" => "comicpress-contact_in_menubar", - "default" => "no", - "type" => "comicpress-contact_in_menubar"), - - array( - "id" => "comicpress-disable_extended_comments", - "default" => "no", - "type" => "comicpress-disable_extended_comments"), - - array( - "id" => "comicpress-enable_custom_image_header", - "default" => "no", - "type" => "comicpress-enable_custom_image_header"), - - array( - "id" => "comicpress-custom_image_header_width", - "default" => "780", - "type" => "comicpress-custom_image_header_width"), - - array( - "id" => "comicpress-custom_image_header_height", - "default" => "120", - "type" => "comicpress-custom_image_header_height"), - - array( - "id" => "comicpress-enable_numbered_pagination", - "default" => "no", - "type" => "comicpress-enable_numbered_pagination"), - - array( - "id" => "comicpress-disable_page_restraints", - "default" => "no", - "type" => "comicpress-disable_page_restraints"), - - array( - "id" => "comicpress-enable_dropdown_sidebar", - "default" => "no", - "type" => "comicpress-enable_dropdown_sidebar"), - - array( - "id" => "comicpress-enable_related_comics", - "default" => "no", - "type" => "comicpress-enable_related_comics"), - - array( - "id" => "comicpress-enable_related_posts", - "default" => "no", - "type" => "comicpress-enable_related_posts"), - - array( - "id" => "comicpress-comic_clicks_next", - "default" => "no", - "type" => "comicpress-comic_clicks_next"), - - array( - "id" => "comicpress-rascal_says", - "default" => "no", - "type" => "comicpress-rascal_says"), - - array( - "id" => "comicpress-disable_css_style_editor", - "default" => "no", - "type" => "comicpress-disable_css_style_editor"), - - array( - "id" => "comicpress-enable_post_calendar", - "default" => "no", - "type" => "comicpress-enable_post_calendar"), - - array( - "id" => "comicpress-enable_post_author_gravatar", - "default" => "no", - "type" => "comicpress-enable_post_author_gravatar"), - - array( - "id" => "comicpress-enable_comic_post_calendar", - "default" => "no", - "type" => "comicpress-enable_comic_post_calendar"), - - array( - "id" => "comicpress-enable_comic_post_author_gravatar", - "default" => "no", - "type" => "comicpress-enable_comic_post_author_gravatar"), - - array( - "id" => "comicpress-disable_tags_in_posts", - "default" => "no", - "type" => "comicpress-disable_tags_in_posts"), - - array( - "id" => "comicpress-disable_categories_in_posts", - "default" => "no", - "type" => "comicpress-disable_categories_in_posts"), - - array( - "id" => "comicpress-moods_directory", - "default" => "default", - "type" => "comicpress-moods_directory"), - - array( - "id" => "comicpress-graphicnav_directory", - "default" => "default", - "type" => "comicpress-graphicnav_directory"), - - array( - "id" => "comicpress-enable_search_in_menubar", - "default" => "no", - "type" => "comicpress-enable_search_in_menubar"), - - array( - "id" => "comicpress-enable_rss_in_menubar", - "default" => "no", - "type" => "comicpress-enable_rss_in_menubar"), - - array( - "id" => "comicpress-enable_navigation_in_menubar", - "default" => "yes", - "type" => "comicpress-enable_navigation_in_menubar"), - - array( - "id" => "comicpress-disable_lrsidebars_frontpage", - "default" => "no", - "type" => "comicpress-disable_lrsidebars_frontpage"), - - array( - "id" => "comicpress-calendar_directory", - "default" => "default", - "type" => "comicpress-calendar_directory"), - - array( - "id" => "comicpress-disable_dynamic_menubar_links", - "default" => "no", - "type" => "comicpress-disable_dynamic_menubar_links"), - - array( - "id" => "comicpress-disable_footer_text", - "default" => "no", - "type" => "comicpress-disable_footer_text"), - - array( - "id" => "comicpress-avatar_directory", - "default" => "default", - "type" => "comicpress-avatar_directory"), - - array( - "id" => "comicpress-archive_display_order", - "default" => "desc", - "type" => "comicpress-archive_display_order"), - - array( - "id" => "comicpress-disable_comment_note", - "default" => "no", - "type" => "comicpress-disable_comment_note"), - - array( - "id" => "comicpress-excerpt_or_content_archive", - "default" => "excerpt", - "type" => "comicpress-excerpt_or_content_archive"), - - array( - "id" => "comicpress-excerpt_or_content_search", - "default" => "excerpt", - "type" => "comicpress-excerpt_or_content_search"), - - array( - "id" => "comicpress-category_thumbnail_postcount", - "default" => "30", - "type" => "comicpress-category_thumbnail_postcount"), - - array( - "id" => "comicpress-members_post_category", - "default" => "", - "type" => "comicpress-members_post_category"), - - array( - "id" => "comicpress-blogposts_with_comic", - "default" => "no", - "type" => "comicpress-blogposts_with_comic"), - - array( - "id" => "comicpress-split_column_in_two", - "default" => "no", - "type" => "comicpress-split_column_in_two"), - - array( - "id" => "comicpress-author_column_one", - "default" => "1", - "type" => "comicpress-author_column_one"), - - array( - "id" => "comicpress-author_column_two", - "default" => "1", - "type" => "comicpress-author_column_two"), - - array( - "id" => "comicpress-remove_wptexturize", - "default" => "no", - "type" => "comicpress-remove_wptexturize"), - - array( - "id" => "comicpress-disable_default_menubar", - "default" => "no", - "type" => "comicpress-disable_default_menubar"), - - array( - "id" => "comicpress-disable_blogheader", - "default" => "no", - "type" => "comicpress-disable_blogheader"), - - array("type" => "close") - ); -?> \ No newline at end of file diff --git a/comicpress-options.php b/comicpress-options.php deleted file mode 100644 index ce88a76..0000000 --- a/comicpress-options.php +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - -
    -

    - - ComicPress - - -
    -
    -
    - - -
    -
    -
    - -

    - -

    - -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    - ComicPress 2.8 (), Tyler Martin, John Bintz Philip M. Hofer (Frumph)
    -
    -
    - - - - -
    -
    -
    - - \ No newline at end of file diff --git a/comments.php b/comments.php deleted file mode 100644 index 037bee0..0000000 --- a/comments.php +++ /dev/null @@ -1,134 +0,0 @@ - -

    - - -
    -
    - - - - - - -

    - -
      - 'comment', - 'reply_text' => __('Reply to %s¬','comicpress'), - 'callback' => 'comicpress_comments_callback', - 'end-callback' => 'comicpress_comments_end_callback', - 'avatar_size'=>64 - ) - ); - } else { - wp_list_comments(array('type' => 'comment', 'avatar_size'=>64)); - }?> -
    - - - - 0)); - if (!empty($pagelinks)) { - $pagelinks = preg_replace('#\#', '', $pagelinks); - $pagelinks = preg_replace('#\#', '', $pagelinks); ?> -
    -
    -
  • '.__('Comment Pages','comicpress').'
  • '. $pagelinks . ''; ?> -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - comment_status) : ?> - - - - -

    - - - - -comment_status) : ?> - -
    - -

    - -
    -

    -
    - - -

    - -
    - -

    .

    - -

    -

    -

    -

    -

    -

    - - ID); ?> -

    -

    - -


    - - -
    - -
    - - - - - -

    -
      -
        - 'pings', - 'callback' => 'comicpress_comments_callback', - 'end-callback' => 'comicpress_comments_end_callback', - 'avatar_size'=>32 - ) - ); - } else { - wp_list_comments(array('type' => 'pings', 'avatar_size'=>64)); - }?> -
      -
    - - -
    -
    \ No newline at end of file diff --git a/footer.php b/footer.php deleted file mode 100644 index 62c38ff..0000000 --- a/footer.php +++ /dev/null @@ -1,29 +0,0 @@ - - - -
    - - - - - - - diff --git a/functions.php b/functions.php deleted file mode 100644 index 6e684e1..0000000 --- a/functions.php +++ /dev/null @@ -1,888 +0,0 @@ - 'comiccat', - 'blogcat' => 'blogcat', - 'comics_path' => 'comic_folder', - 'comicsrss_path' => 'rss_comic_folder', - 'comicsarchive_path' => 'archive_comic_folder', - 'comicsmini_path' => 'mini_comic_folder', - 'archive_comic_width' => 'archive_comic_width', - 'rss_comic_width' => 'rss_comic_width', - 'mini_comic_width' => 'mini_comic_width', - 'blog_postcount' => 'blog_postcount') as $options => $variable_name) { - $variables_to_extract[$variable_name] = get_option("comicpress-${options}"); - } - - extract($variables_to_extract); - } - -} else { - require(get_template_directory() . '/comicpress-config.php'); -} - -if (get_option('upload_path') !== false) { - $variables_to_extract = array(); - - foreach (array( - 'disable_comic_frontpage' => 'disable_comic_frontpage', - 'disable_comic_blog_frontpage' => 'disable_comic_blog_frontpage', - 'disable_comic_blog_single' => 'disable_comic_blog_single', - 'disable_blog_frontpage' => 'disable_blog_frontpage', - 'buy_print_email' => 'buy_print_email', - 'buy_print_url' => 'buy_print_url', - 'buy_print_us_amount' => 'buy_print_us_amount', - 'buy_print_int_amount' => 'buy_print_int_amount', - 'buy_print_add_shipping' => 'buy_print_add_shipping', - 'buy_print_us_ship' => 'buy_print_us_ship', - 'buy_print_int_ship' => 'buy_print_int_ship', - 'cp_theme_layout' => 'cp_theme_layout', - 'transcript_in_posts' => 'transcript_in_posts', - 'enable_widgetarea_use_sidebar_css' => 'enable_widgetarea_use_sidebar_css', - 'enable_custom_image_header' => 'enable_custom_image_header', - 'custom_image_header_width' => 'custom_image_header_width', - 'custom_image_header_height' => 'custom_image_header_height', - 'enable_numbered_pagination' => 'enable_numbered_pagination', - 'disable_page_restraints' => 'disable_page_restraints', - 'enable_related_comics' => 'enable_related_comics', - 'enable_related_posts' => 'enable_related_posts', - 'comic_clicks_next' => 'comic_clicks_next', - 'rascal_says' => 'rascal_says', - 'disable_css_style_editor' => 'disable_css_style_editor', - 'enable_post_calendar' => 'enable_post_calendar', - 'enable_post_author_gravatar' => 'enable_post_author_gravatar', - 'enable_comic_post_calendar' => 'enable_comic_post_calendar', - 'enable_comic_post_author_gravatar' => 'enable_comic_post_author_gravatar', - 'disable_tags_in_posts' => 'disable_tags_in_posts', - 'disable_categories_in_posts' => 'disable_categories_in_posts', - 'moods_directory' => 'moods_directory', - 'graphicnav_directory' => 'graphicnav_directory', - 'enable_search_in_menubar' => 'enable_search_in_menubar', - 'enable_rss_in_menubar' => 'enable_rss_in_menubar', - 'enable_navigation_in_menubar' => 'enable_navigation_in_menubar', - 'disable_lrsidebars_frontpage' => 'disable_lrsidebars_frontpage', - 'calendar_directory' => 'calendar_directory', - 'contact_in_menubar' => 'contact_in_menubar', - 'disable_dynamic_menubar_links' => 'disable_dynamic_menubar_links', - 'disable_footer_text' => 'disable_footer_text', - 'themepack_directory' => 'themepack_directory', - 'avatar_directory' => 'avatar_directory', - 'archive_display_order' => 'archive_display_order', - 'disable_comment_note' => 'disable_comment_note', - 'excerpt_or_content_archive' => 'excerpt_or_content_archive', - 'excerpt_or_content_search' => 'excerpt_or_content_search', - 'category_thumbnail_postcount' => 'category_thumbnail_postcount', - 'members_post_category' => 'members_post_category', - 'blogposts_with_comic' => 'blogposts_with_comic', - 'split_column_in_two' => 'split_column_in_two', - 'author_column_one' => 'author_column_one', - 'author_column_two' => 'author_column_two', - 'remove_wptexturize' => 'remove_wptexturize', - 'disable_default_menubar' => 'disable_default_menubar', - 'disable_blogheader' => 'disable_blogheader' ) as $options => $variable_name) { - $variables_to_extract[$variable_name] = get_option("comicpress-${options}"); - } - - extract($variables_to_extract); -} - -if (empty($avatar_directory)) $avatar_directory = 'default'; -if (empty($graphicnav_directory)) $graphicnav_directory = 'default'; -if (empty($moods_directory)) $moods_directory = 'default'; -if (empty($calendar_directory)) $calendar_directory = 'default'; -if (empty($cp_theme_layout)) $cp_theme_layout='standard'; - -function is_cp_theme_layout($choices) { -global $cp_theme_layout; - if (empty($cp_theme_layout)) $cp_theme_layout='standard'; - $choices = explode(",", $choices); - foreach ($choices as $choice) { - - if ($choice == $cp_theme_layout) { - return true; - } - } - return false; -} - -if ($remove_wptexturize == 'yes') { - // Remove the wptexturizer from changing the quotes and squotes. - // remove_filter('the_content', 'wpautop'); - // remove_filter('the_title', 'wptexturize'); - remove_filter('the_content', 'wptexturize'); - // remove_filter('the_excerpt', 'wptexturize'); - // remove_filter('comment_text', 'wptexturize'); -} - -// WIDGETS WP 2.8 compatible ONLY, no backwards compatibility here. -$dirs_to_search = array_unique(array(get_template_directory(),get_stylesheet_directory())); -foreach ($dirs_to_search as $dir) { - // Widgets - foreach (glob($dir . '/widgets/*.php') as $__file) { require_once($__file); } - - // FUNCTIONS & Extra's - foreach (glob($dir . '/functions/*.php') as $__file) { require_once($__file); } -} - -// Dashboard Menu Comicpress Options and ComicPress CSS -require_once(get_template_directory() . '/comicpress-options.php'); - -// If any errors occur while searching for a comic file, the error messages will be pushed into here. -$comic_pathfinding_errors = array(); - -// If ComicPress Manager is installed, use the date format defined there. If not, default to -// Y-m-d.. It's best to use CPM's date definition for improved operability between theme and plugin. - -if (defined("CPM_DATE_FORMAT")) { - define("CP_DATE_FORMAT", CPM_DATE_FORMAT); -} else { - define("CP_DATE_FORMAT", "Y-m-d"); -} - -// If you want to run multiple comics on a single day, define your additional filters here. -// Example: you want to run an additional comic with the filename 2008-01-01-a-my-new-years-comic.jpg. -// Define an additional filter in the list below: -// -// $comic_filename_filters['secondary'] = "{date}-a*.*"; -// -// Then show the second comic on your page by calling the_comic with your filter name (PHP tags munged -// to maintain valid file syntax): -// -// < ?php the_comic('secondary'); ? > -// -// Note that it's quite possible to slurp up the wrong file if your expressions are too broad. - -$comic_filename_filters = array(); -$comic_filename_filters['default'] = "{date}*.*"; - -// load all of the comic & non-comic category information -add_action('init', 'get_all_comic_categories'); - -function get_first_comic() { - return get_terminal_post_in_category(get_all_comic_categories_as_cat_string(), true); -} - -function get_last_comic() { - return get_terminal_post_in_category(get_all_comic_categories_as_cat_string(), false); -} - -/** -* Get the hyperlink to the first comic post in the database. -* @return string The hyperlink to the first comic post, or false. -*/ -function get_first_comic_permalink() { - $terminal = get_first_comic(); - return !empty($terminal) ? get_permalink($terminal->ID) : false; -} - -/** -* Get the hyperlink to the last comic post in the database. -* @return string The hyperlink to the first comic post, or false. -*/ -function get_last_comic_permalink() { - $terminal = get_last_comic(); - return !empty($terminal) ? get_permalink($terminal->ID) : false; -} - -/** - * Given a category ID or an array of category IDs, create an exclusion string that will - * filter out every category but the provided ones. - */ -function get_string_to_exclude_all_but_provided_categories($category) { - $category_ids = array_keys(get_all_category_objects_by_id()); - if (!is_array($category)) { $category = array($category); } - return implode(" and ", array_diff($category_ids, $category)); -} - -/** - * Get the link to the previous comic from the current one. - */ -function previous_comic_link($format, $link) { - global $non_comic_categories; - previous_post_link($format, $link, false, $non_comic_categories); -} - -/** - * Get the link to the next comic from the current one. - */ -function next_comic_link($format, $link) { - global $non_comic_categories; - next_post_link($format, $link, false, $non_comic_categories); -} - -/** - * Get the previous comic from the current one. - */ -function get_previous_comic($category = null) { return get_adjacent_comic($category, true); } - -/** - * Get the next comic from the current one. - */ -function get_next_comic($category = null) { return get_adjacent_comic($category); } - -/** - * This is function get_next_comic_permalink - * - * @return mixed false if no next comic permalink, else return the permalink - * - */ -function get_next_comic_permalink() { - $next_comic = get_next_comic(); - if (is_object($next_comic)) { - if (isset($next_comic->ID)) { - return get_permalink($next_comic->ID); - } - } - return false; -} - -/** - * This is function get_previous_comic_permalink - * - * @return mixed false if there is no permalink or next previous comic - * - */ -function get_previous_comic_permalink() { - $prev_comic = get_previous_comic(); - if (is_object($prev_comic)) { - if (isset($prev_comic->ID)) { - return get_permalink($prev_comic->ID); - } - } - return false; -} - -/** - * Get the adjacent comic from the current one. - * @param int $category The category to use. - * @param boolean $previous True if the previous chronological comic should be retrieved. - * @return array The WordPress post object for the comic post. - */ -function get_adjacent_comic($category, $previous = false) { - global $non_comic_categories; - -// get_all_comic_categories(); - - $categories_to_exclude = $non_comic_categories; - if (!empty($category)) { - $categories_to_exclude = get_string_to_exclude_all_but_provided_categories($category); - } - - return get_adjacent_post(false, $categories_to_exclude, $previous); -} - -/** - * Find the terminal post in a specific category. - */ -function get_terminal_post_in_category($categoryID, $first = true) { - global $post; - - $temp = $wp_query; $wp_query = null; - $sortOrder = $first ? "asc" : "desc"; - $terminalComicQuery = new WP_Query(); $terminalComicQuery->query("showposts=1&order=${sortOrder}&cat=${categoryID}"); - $terninalPost = false; - if ($terminalComicQuery->have_posts()) { - $terminalPost = reset($terminalComicQuery->posts); - } - - $wp_query = null; $wp_query = $temp; - return $terminalPost; -} - -/** - * Find the first post in the storyline prior to the current one. - */ -function get_previous_storyline_start() { - if (($category_id = get_adjacent_storyline_category_id(false)) !== false) { - return get_terminal_post_in_category($category_id); - } - return false; -} - -function get_previous_storyline_start_permalink() { - $prev_story = get_previous_storyline_start(); - if (is_object($prev_story)) { - if (isset($prev_story->ID)) { - return get_permalink($prev_story->ID); - } - } - return false; -} - -/** - * Find the first post in the storyline following to the current one. - */ -function get_next_storyline_start() { - if (($category_id = get_adjacent_storyline_category_id(true)) !== false) { - return get_terminal_post_in_category($category_id); - } - return false; -} - -function get_next_storyline_start_permalink() { - $next_story = get_next_storyline_start(); - if (is_object($next_story)) { - if (isset($next_story->ID)) { - return get_permalink($next_story->ID); - } - } - return false; -} - -function get_adjacent_storyline_category_id($next = false) { - global $post, $category_tree; - - $categories = wp_get_post_categories($post->ID); - if (is_array($categories)) { - $category_id = reset($categories); - for ($i = 0, $il = count($category_tree); $i < $il; ++$i) { - $storyline_category_id = end(explode("/", $category_tree[$i])); - - if ($storyline_category_id == $category_id) { - $target_index = false; - if ($next) { - $target_index = $i + 1; - } else { - $target_index = $i - 1; - } - if (isset($category_tree[$target_index])) { - return end(explode('/', $category_tree[$target_index])); - } - } - } - } - return false; -} - -/** -* Find a comic file in the filesystem. -* @param string $folder The folder name to search. -* @param string $override_post A WP Post object to use in place of global $post. -* @param string $filter The $comic_filename_filters to use. -* @return string The relative path to the comic file, or false if not found. -*/ - -function get_comic_path($folder = 'comic', $override_post = null, $filter = 'default', $multi = null) { - global $post, $comic_filename_filters, $comic_folder, $archive_comic_folder, $rss_comic_folder, $mini_comic_folder, $comic_pathfinding_errors, $wpmu_version; - - if (isset($comic_filename_filters[$filter])) { - $filter_to_use = $comic_filename_filters[$filter]; - } else { - $filter_to_use = '{date}*.*'; - } - - switch ($folder) { - case "rss": $folder_to_use = $rss_comic_folder; break; - case "archive": $folder_to_use = $archive_comic_folder; break; - case "mini": $folder_to_use = $mini_comic_folder; break; - case "comic": default: $folder_to_use = $comic_folder; break; - } - - if (!empty($wpmu_version)) { - if (($wpmu_path = get_option('upload_path')) !== false) { - $folder_to_use = $wpmu_path . '/' . $folder_to_use; - } - } - - $post_to_use = (is_object($override_post)) ? $override_post : $post; - $post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date); - - $filter_with_date = str_replace('{date}', $post_date, $filter_to_use); - - $cwd = get_stylesheet_directory(); - if ($cwd !== false) { - // Strip the wp-admin part and just get to the root. - $root_path = preg_replace('#[\\/]wp-(admin|content).*#', '', $cwd); - } - - $results = array(); - /* have to use root_path to get subdirectory installation directories */ - if (count($results = glob("${root_path}/${folder_to_use}/${filter_with_date}")) > 0) { - - if (!empty($wpmu_version)) { - $comic = reset($results); - $comic = $folder_to_use . '/'. basename($comic); - if ($wpmu_path !== false) { $comic = str_replace($wpmu_path, "files", $comic); } - return $comic; - } - - if (!empty($multi)) { - return $results; - } else { - /* clear the root path */ - $comic = reset($results); - $comic = $folder_to_use .'/'. basename($comic); - return $comic; - } - } - - $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the %s folder that matched the pattern %s. Check your WordPress and ComicPress settings.", 'comicpress'), $folder_to_use, $filter_with_date); - return false; -} - - -/** -* Find a comic file in the filesystem and return an absolute URL to that file. -* @param string $folder The folder name to search. -* @param string $override_post A WP Post object to use in place of global $post. -* @param string $filter The $comic_filename_filters to use. -* @return string The absolute URL to the comic file, or false if not found. -*/ -function get_comic_url($folder = 'comic', $override_post = null, $filter = 'default') { - if (($result = get_comic_path($folder, $override_post, $filter)) !== false) { - return get_bloginfo('wpurl') . '/' . $result; - } else { - if (($result = get_comic_path('comic', $override_post, $filter)) !== false) { - $basecomic = basename($result); - return get_bloginfo('wpurl') . '/' . $result; - } - } - return $result; -} - -/** - * get_comic_filename - * returns the filename of the comic for the individual date. - * - */ -function get_comic_filename($folder = 'comic', $override_post = null, $filter = 'default') { - if (($result = get_comic_path($folder, $override_post, $filter)) !== false) { - return $result; - } -} - -/** - * Return a list of the comic categories with a negative value for exclusions - * NOTE: need a pre - negative for the first one - */ -function exclude_comic_categories() { - global $all_comic_categories_as_string; - if (empty($all_comic_categories_as_string)) get_all_comic_categories_as_cat_string(); - $returnstring = str_replace(",",",-",$all_comic_categories_as_string); - return $returnstring; -} - -/** - * Turn the tree of comics categories into a string to be fed into wp_query functions. - */ -function get_all_comic_categories_as_cat_string() { - global $all_comic_categories_as_string, $category_tree; - if (empty($all_comic_categories_as_string)) { - $categories = array(); - foreach ($category_tree as $node) { - $parts = explode("/", $node); - $categories[] = end($parts); - } - $all_comic_categories_as_string = implode(",", $categories); - } - return $all_comic_categories_as_string; -} - -/** - * Turn the list of categories into a hash table of category objects. - */ -function get_all_category_objects_by_id() { - global $categories_by_id; - if (empty($categories_by_id)) { - $categories_by_id = array(); - foreach (get_categories("hide_empty=0") as $category_object) { - $categories_by_id[$category_object->term_id] = $category_object; - } - } - return $categories_by_id; -} - -/** - * Parse all categories and sort them into comics and non-comics categories. - */ -function get_all_comic_categories() { - global $comiccat, $category_tree, $non_comic_categories; - - $categories_by_id = get_all_category_objects_by_id(); - - foreach (array_keys($categories_by_id) as $category_id) { - $category_tree[] = $categories_by_id[$category_id]->parent . '/' . $category_id; - } - - do { - $all_ok = true; - for ($i = 0; $i < count($category_tree); ++$i) { - $current_parts = explode("/", $category_tree[$i]); - if (reset($current_parts) != 0) { - - $all_ok = false; - for ($j = 0; $j < count($category_tree); ++$j) { - $j_parts = explode("/", $category_tree[$j]); - - if (end($j_parts) == reset($current_parts)) { - $category_tree[$i] = implode("/", array_merge($j_parts, array_slice($current_parts, 1))); - break; - } - } - } - } - } while (!$all_ok); - - $non_comic_tree = array(); - - if (get_option('comicpress-enable-storyline-support') == 1) { - $result = get_option("comicpress-storyline-category-order"); - if (!empty($result)) { - $category_tree = explode(",", $result); - } - $non_comic_tree = array_keys($categories_by_id); - foreach ($category_tree as $node) { - $parts = explode("/", $node); - $category_id = end($parts); - if ($parts[1] == $comiccat) { - if (($index = array_search($category_id, $non_comic_tree)) !== false) { - array_splice($non_comic_tree, $index, 1); - } - } - } - } else { - $new_category_tree = array(); - foreach ($category_tree as $node) { - $parts = explode("/", $node); - if ($parts[1] == $comiccat) { - $new_category_tree[] = $node; - } else { - $non_comic_tree[] = end($parts); - } - } - $category_tree = $new_category_tree; - } - - $non_comic_categories = implode(" and ", $non_comic_tree); -} - -/** - * Return true if the current post is in the comics category or a child category. - */ -function in_comic_category() { - global $post, $category_tree; - - $comic_categories = array(); - foreach ($category_tree as $node) { - $comic_categories[] = end(explode("/", $node)); - } - - return (count(array_intersect($comic_categories, wp_get_post_categories($post->ID))) > 0); -} - -// ComicPress Template Functions - -function the_comic_filename($filter = 'default') { return get_comic_filename('comic',null, $filter); } - -function the_comic($filter = 'default') { echo get_comic_url('comic', null, $filter); } - //The following is deprecated... - function comic_display($filter = 'default') { echo get_comic_url('comic', null, $filter); } - -function the_comic_archive($filter = 'default') { echo get_comic_url('archive', null, $filter); } - //The following is deprecated... - function comic_archive($filter = 'default') { echo get_comic_url('archive', null, $filter); } - -function the_comic_rss($filter = 'default') { echo get_comic_url('rss', null, $filter); } - //The following is deprecated... - function comic_rss($filter = 'default') { echo get_comic_url('rss', null, $filter); } - -function the_comic_mini($filter = 'default') { echo get_comic_url('mini', null, $filter); } - //The following is deprecated... - function comic_mini($filter = 'default') { echo get_comic_url('mini', null, $filter); } - -/** - * Display the list of Storyline categories. - */ -function comicpress_list_storyline_categories($args = "") { - global $category_tree; - - $defaults = array( - 'style' => 'list', 'title_li' => __('Storyline','comicpress') - ); - - $r = wp_parse_args($args, $defaults); - - extract($r); - - $categories_by_id = get_all_category_objects_by_id(); - - $output = ''; - if ($style == "list") { $output .= '
  • '; } - if ($title_li && ($style == "list")) { $output .= $title_li; } - if ($style == "list") { $output .= "
  • ", $current_depth); - } - if ($style == "list") { $output .= ""; } - echo $output; -} - -/** -* Display text when image (comic) is hovered -* Text is taken from a custom field named "hovertext" -*/ -function the_hovertext() { - $hovertext = get_post_meta( get_the_ID(), "hovertext", true ); - echo (empty($hovertext)) ? get_the_title() : $hovertext; -} - -/** -* Display the comic transcript -* Transcript must be entered into a custom field named "transcript" -* @param string $displaymode, "raw" (straight from the field), "br" (includes html line breaks), "styled" (fully css styled with JavaScript expander) -*/ -function the_transcript($displaymode = 'raw') { - $transcript = get_post_meta( get_the_ID(), "transcript", true ); - switch ($displaymode) { - case "raw": - echo $transcript; - break; - case "br": - echo nl2br($transcript); - break; - case "styled": - if (!empty($transcript)) { ?> - -
    - -

    <?php the_title() ?>

    'Left Sidebar', 'before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Right Sidebar','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Above Header','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Header','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Menubar','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Over Comic','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Left of Comic','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Right of Comic','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Under Comic','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Over Blog','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Blog','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Under Blog','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); - register_sidebar(array('name'=>'Footer','before_widget' => ' -
    -','after_widget' => ' -
    ','before_title' => '

    ', 'after_title' => '

    -' )); -} - -function storyline_category_list() { - $listcats = wp_list_categories('echo=0&title_li=&include='.get_all_comic_categories_as_cat_string()); - $listcats = str_replace("