diff --git a/404.php b/404.php
new file mode 100644
index 0000000..29146e5
--- /dev/null
+++ b/404.php
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
+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); ?>
+
+
+
+
+
+ 0) {
+ if (is_array($monthfile)) $monthfile = reset($monthfile); ?>
+
+
+
+
+
+
+
+
+
+
+ 0) {
+ if (is_array($monthfile)) $monthfile = reset($monthfile); ?>
+
+
+
+
+
+ 0) {
+ if (is_array($monthfile)) $monthfile = reset($monthfile); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+comment_status) { comments_template('', true); } ?>
+
+
+
\ No newline at end of file
diff --git a/archive-comic-month.php b/archive-comic-month.php
new file mode 100644
index 0000000..8e67b50
--- /dev/null
+++ b/archive-comic-month.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '" . 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());
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/archive-comic-storyline-thumbs.php b/archive-comic-storyline-thumbs.php
new file mode 100644
index 0000000..33a1780
--- /dev/null
+++ b/archive-comic-storyline-thumbs.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
new file mode 100644
index 0000000..d27ae77
--- /dev/null
+++ b/archive-comic-storyline.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
new file mode 100644
index 0000000..e9eb76e
--- /dev/null
+++ b/archive-comic-year.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
+ 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
new file mode 100644
index 0000000..337149c
--- /dev/null
+++ b/archive-comic.php
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
new file mode 100644
index 0000000..a90c1aa
--- /dev/null
+++ b/archive.php
@@ -0,0 +1,155 @@
+post_count;
+
+ if (!$count) $count = "no";
+?>
+
+
+
+
+
+
+
+
+
+
’
+
+
’
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/archives.php b/archives.php
new file mode 100644
index 0000000..a710c48
--- /dev/null
+++ b/archives.php
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/author.php b/author.php
new file mode 100644
index 0000000..af87b63
--- /dev/null
+++ b/author.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+ 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
new file mode 100644
index 0000000..db2896d
--- /dev/null
+++ b/blog.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
View all posts by:
+
+
+
+
+
View all posts by:
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/buystrip.php b/buystrip.php
new file mode 100644
index 0000000..e97060f
--- /dev/null
+++ b/buystrip.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '
'.__('Pages:','comicpress').' ', 'after' => '
', 'next_or_number' => 'number')) ?>
+
+ ', '') ?>
+
+
+
+
+
+
+
+
+
diff --git a/chrome_style.css b/chrome_style.css
new file mode 100644
index 0000000..0b0c65a
--- /dev/null
+++ b/chrome_style.css
@@ -0,0 +1,19 @@
+/* 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
new file mode 100644
index 0000000..d844749
--- /dev/null
+++ b/classes/ComicPressDBInterface.inc
@@ -0,0 +1,111 @@
+_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
new file mode 100644
index 0000000..2097b0b
--- /dev/null
+++ b/classes/ComicPressNavigation.inc
@@ -0,0 +1,68 @@
+_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
new file mode 100644
index 0000000..ca4ba52
--- /dev/null
+++ b/classes/ComicPressStoryline.inc
@@ -0,0 +1,589 @@
+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
new file mode 100644
index 0000000..09a30e0
--- /dev/null
+++ b/comicpress-config.php
@@ -0,0 +1,33 @@
+
\ No newline at end of file
diff --git a/comicpress-options-config.php b/comicpress-options-config.php
new file mode 100644
index 0000000..f05afed
--- /dev/null
+++ b/comicpress-options-config.php
@@ -0,0 +1,294 @@
+ "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
new file mode 100644
index 0000000..ce88a76
--- /dev/null
+++ b/comicpress-options.php
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/comments.php b/comments.php
new file mode 100644
index 0000000..037bee0
--- /dev/null
+++ b/comments.php
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/footer.php b/footer.php
new file mode 100644
index 0000000..62c38ff
--- /dev/null
+++ b/footer.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+ '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); ?> ++
+ + ++ 'pings', + 'callback' => 'comicpress_comments_callback', + 'end-callback' => 'comicpress_comments_end_callback', + 'avatar_size'=>32 + ) + ); + } else { + wp_list_comments(array('type' => 'pings', 'avatar_size'=>64)); + }?> +
+