';
return $content;
}
/**
* Callback to send the reader to a random comic.
*/
function go_to_random_comic() {
$random_comic_query = new WP_Query();
$random_comic_query->query('showposts=1&orderby=rand&cat=' . $this->comicpress->get_all_comic_categories_as_cat_string());
while ($random_comic_query->have_posts()) {
$random_comic_query->the_post();
$random_comic_id = get_the_ID();
break;
}
if (!empty($random_comic_id)) {
wp_redirect(get_permalink( $random_comic_id ));
}
}
/**
* Markup to insert a comic into the comic feed.
*/
function comic_feed() { ?>
comic_feed() . $content;
} else {
return $content;
}
}
/**
* Set up the admin interface and meta boxes.
*/
function admin_menu() {
global $plugin_page, $pagenow, $post;
add_theme_page(__("ComicPress", 'comicpress'), __('ComicPress', 'comicpress'), 'edit_themes', 'comicpress/render_admin', array(&$this, 'render_admin'));
if (strpos($pagenow, "post") === 0) {
add_meta_box("comic-image-ordering", __("Comic Image Ordering", 'comicpress'), array(&$this, 'render_comic_image_ordering'), "post", "normal", "low");
wp_enqueue_script('cp-ordering', get_stylesheet_directory_uri() . '/js/ComicImageOrdering.js', array('scriptaculous', 'scriptaculous-slider'));
wp_enqueue_style('cp-admin', get_stylesheet_directory_uri() . '/css/cp-admin.css');
add_action('admin_footer', array(&$this, 'admin_footer'));
}
if ($plugin_page == 'comicpress/render_admin') {
wp_enqueue_style('cp-admin', get_stylesheet_directory_uri() . '/css/cp-admin.css');
wp_enqueue_script('cp-admin', get_stylesheet_directory_uri() . '/js/Storyline.js', array('prototype', 'scriptaculous'));
}
if (strpos($pagenow, "media-upload") === 0) {
wp_enqueue_script('cp-media', get_stylesheet_directory_uri() . '/js/MediaUpload.js', array('prototype'));
}
}
function admin_footer() {
$nonce = wp_create_nonce('comicpress');
?>
comicpress->comicpress_options['comic_space']) {
case "comic_only":
$comic_post = new ComicPressComicPost($post_to_use, &$this->comicpress);
$comic_post->{$method}($format);
break;
case "post_content":
$t = $post;
$post = $post_to_use;
include_partial('index-blog-post');
$post = $t;
break;
}
}
/**
* Show a comic.
*/
function show_comic($override_post = null, $format = "%s ") {
$this->show_media($override_post, "display_comics", $format);
}
/**
* Show an archive comic.
*/
function show_archive($override_post = null, $format = "%s ") {
$this->show_media($override_post, "display_archive", $format);
}
/**
* Show an RSS comic.
*/
function show_rss($override_post = null, $format = "%s ") {
$this->show_media($override_post, "display_rss", $format);
}
/**
* Modify the Media Gallery for ComicPress use.
*/
function setup_comic_metadata_buttons($form_fields, $post) {
global $pagenow;
$current_type = get_post_meta($post->ID, 'comic_image_type', true);
if (empty($current_type)) { $current_type = reset(array_keys($this->comic_image_types)); }
$field_html_lines = array();
$field_html_lines[] = '';
foreach ($this->comic_image_types as $field => $label) {
$field_html_lines[] = '';
}
$form_fields['comic_image_type'] = array(
'label' => __("Comic Image Type", 'comicpress'),
'input' => 'html',
'html' => '
' . implode("\n", $field_html_lines) . '
'
);
if ($pagenow !== "media.php") {
$form_fields['auto_attach'] = array(
'label' => __("Auto-attach?", 'comicpress'),
'input' => 'html',
'html' => ' '
. __('Attach to this post w/o needing to insert into post', 'comicpress')
. ''
);
}
return $form_fields;
}
/**
* Render the admin interface.
*/
function render_admin() {
$nonce = wp_create_nonce('comicpress');
$root_categories = $this->get_root_categories();
$storyline = new ComicPressStoryline();
$storyline->normalize();
$storyline->read_from_options();
include(dirname(__FILE__) . '/partials/options-admin.inc');
}
function _render_admin_storyline_tree($node, $parent_id = "0") {
foreach ($node as $category_id => $children) {
$category = get_category($category_id);
echo '