init(); $comicpress_admin = new ComicPressAdmin(); $comicpress_admin->init(); $comicpress_admin->handle_update(); $comicpress_filters = new ComicPressFilters(); $comicpress_filters->init(); } function F($name, $path, $override_post = null) { global $post; $comic_post = new ComicPressComicPost(is_null($override_post) ? $post : $override_post); $comicpress = ComicPress::get_instance(); return $comicpress->find_file($name, $path, $comic_post->find_parents()); } /** * Finish rendering this template and shove the output into application.php. */ function finish_comicpress() { $content = ob_get_clean(); include(F('application.php', '')); } /** * Protect global $post and $wp_query. */ function Protect() { global $post, $wp_query, $__post, $__wp_query; $__post = $post; $__wp_query = $wp_query; } /** * Temporarily restore the global $post variable and set it up for use. */ function Restore() { global $post, $__post; $post = $__post; setup_postdata($post); } /** * Restore global $post and $wp_query. */ function Unprotect() { global $post, $wp_query, $__post, $__wp_query; $post = $__post; $wp_query = $__wp_query; $__post = $__wp_query = null; } function R($which, $restrictions = null, $override_post = null) { global $post; $post_to_use = !is_null($override_post) ? $override_post : $post; $storyline = new ComicPressStoryline(); if (is_string($restrictions)) { switch ($restrictions) { case 'from_post': $restrictions = array('from_post' => $post_to_use); break; } } if (is_array($restrictions)) { $new_restrictions = array(); foreach ($restrictions as $type => $list) { if (is_string($list)) { $value = $list; switch ($list) { case '__post': $value = $post_to_use; break; } $new_restrictions[$type] = $value; } else { $new_restrictions[$type] = $list; } } $restrictions = $new_restrictions; } $categories = $storyline->build_from_restrictions($restrictions); $dbi = ComicPressDBInterface::get_instance(); $new_post = false; switch ($which) { case 'first': $new_post = $dbi->get_first_post($categories); break; case 'last': $new_post = $dbi->get_last_post($categories); break; case 'next': $new_post = $dbi->get_next_post($categories, $post_to_use); break; case 'previous': $new_post = $dbi->get_previous_post($categories, $post_to_use); break; } return $new_post; } function RT($which, $restrictions = null, $override_post = null) { global $post, $__post; if (!empty($override_post)) { $post_to_use = $override_post; } else { $post_to_use = (!empty($__post)) ? $__post : $post; } if (($new_post = R($which, $restrictions, $post_to_use)) !== false) { $post = $new_post; setup_postdata($post); } return $post; } function M($override_post = null) { global $post; $post_to_use = !is_null($override_post) ? $override_post : $post; $comic_post = new ComicPressComicPost($post_to_use); return $comic_post->get_attachments(); } /** * Display the list of Storyline categories. */ function comicpress_list_storyline_categories($args = "") { global $category_tree; $defaults = array( 'style' => 'list', 'title_li' => __('Storyline') ); $r = wp_parse_args($args, $defaults); extract($r); $categories_by_id = get_all_category_objects_by_id(); $output = ''; if ($style == "list") { $output .= '