'; if ($image) { $cast_output .= ''; $cast_output .= '
'; $cast_output .= '
'; } $cast_output .= ''; $cast_output .= '

'.$character->name.'

'; $cast_output .= '

'; $cast_output .= $character->description; $cast_output .= '

'; if ($stats) { $cast_output .= '

'; $cast_output .= ''.__('Comics:','comiceasel').' '.$character->count.'
'; $args = array( 'nopaging' => true, 'numberposts' => 9999, 'posts_per_page' => 9999, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => 'ASC', 'post_status' => 'publish', 'characters' => $character->slug, ); $qposts = get_posts( $args ); if (!empty($qposts)) { $first_seen_object = reset($qposts); $first_seen_title = $first_seen_object->post_title; $first_seen_id = $first_seen_object->ID; $last_seen_object = end($qposts); $last_seen_title = $last_seen_object->post_title; $last_seen_id = $last_seen_object->ID; if ($first_seen_id == $last_seen_id) { $cast_output .= ''.__('Only Appearance:','comiceasel').' '.$first_seen_title.'
'; } else { $cast_output .= ''.__('Recent Appearance:','comiceasel').' '.$last_seen_title.'
'; $cast_output .= ''.__('First Appearance:','comiceasel').' '.$first_seen_title.'
'; } } $qposts = null; $cast_output .= '

'; } $cast_output .= ''; } return $cast_output; } // , $limit, $stats, $image, $order function ceo_get_character_list($chapter) { global $wpdb; $sql_string3 = "SELECT DISTINCT terms2.name as tag FROM wp_posts as p1 LEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID LEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN wp_terms as terms1 ON t1.term_id = terms1.term_id, wp_posts as p2 LEFT JOIN wp_term_relationships as r2 ON p2.ID = r2.object_ID LEFT JOIN wp_term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id LEFT JOIN wp_terms as terms2 ON t2.term_id = terms2.term_id WHERE t1.taxonomy = 'chapters' AND p1.post_status = 'publish' AND terms1.term_id = '".$chapter."' AND t2.taxonomy = 'characters' AND p2.post_status = 'publish' AND p1.ID = p2.ID"; $character_list = $wpdb->get_results($sql_string3); if (!empty($character_list)) return $character_list; return false; } function ceo_cast_page( $atts, $content = '' ) { extract( shortcode_atts( array( 'character' => '', 'limit' => '', 'order' => 'desc', 'stats' => 1, 'image' => 1, 'chapter' => 0 ), $atts ) ); $cast_output = ''; if ($chapter) { $character_list = ceo_get_character_list($chapter); $cast_output .= ''."\r\n"; foreach ($character_list as $character) { $character_object = get_term_by('slug', $character->tag, 'characters'); $cast_output .= ceo_cast_display($character_object, $stats, $image)."\r\n"; } $cast_output .= '
'."\r\n"; return $cast_output; } if (empty($character)) { if ($limit) { $args = 'orderby=count&order='.$order.'&hide_empty=1&number='.$limit; } else $args = 'orderby=count&order='.$order.'&hide_empty=1'; $characters = get_terms( 'characters', $args ); if (is_array($characters)) { $cast_output .= ''."\r\n"; foreach ($characters as $character) { $cast_output .= ceo_cast_display($character, $stats, $image)."\r\n"; } $cast_output .= '
'."\r\n"; } else { $cast_output = __('You do not have any characters yet.','comiceasel')."
\r\n"; } } else { $single_character = get_term_by('slug', $character, 'characters'); if (!empty($single_character)) { $cast_output .= ''."\r\n"; $cast_output .= ceo_cast_display($single_character, $stats, $image)."\r\n"; $cast_output .= '
'."\r\n"; } else $cast_output .= __('Unknown Character:', 'comiceasel').' '.$character."
\r\n"; } return $cast_output; } function ceo_comic_archive_multi( $atts, $content = '' ) { extract( shortcode_atts( array( 'list' => 0, 'style' => 0, 'chapter' => 0, 'thumbnail' => 0, 'order' => 'ASC' ), $atts ) ); $output = ''; switch ($list) { case 4: $output = ceo_archive_list_by_chapter_thumbnails($order); break; case 3: $output = ceo_archive_list_by_all_years($thumbnail, $order, $chapter); break; case 2: $output = ceo_archive_list_by_year($thumbnail, $order, $chapter); break; case 1: $output = ceo_archive_list_series($thumbnail); break; case 0: default: if ($chapter) { $output = ceo_archive_list_single($chapter, $order, $thumbnail); } else { $output = ceo_archive_list_all($order, $thumbnail); } break; } wp_reset_postdata(); return $output; } function ceo_archive_list_single($chapter = 0, $order = 'ASC', $thumbnail = 0) { $output = ''; // get chapter from ID# $single_chapter = get_term_by('term_id', $chapter, 'chapters'); if (is_null($single_chapter)) { echo "Invalid Chapter Specified"; return; } $output .= '
'; $output .= '

'.$single_chapter->name.'

'; $output .= '
'; $output .= '
'.$single_chapter->description.'
'; $args = array( 'numberposts' => -1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => $order, 'post_status' => 'publish', 'chapters' => $single_chapter->slug ); $qposts = get_posts( $args ); $archive_count = 0; if ($thumbnail) { $output .= '
'.get_the_post_thumbnail($qposts[0]->ID, 'thumbnail').'
'; } $output .= '
'; $css_alt = false; foreach ($qposts as $qpost) { $archive_count++; if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; } $output .= '
'.get_the_time('M d, Y', $qpost->ID).''.$qpost->post_title.'
'; } $output .= '
'; $output .= '
'; return $output; } function ceo_get_terms_orderby($orderby, $args) { $orderby = 't.menu_order'; return $orderby; } function ceo_archive_list_all($order = 'ASC', $thumbnail = 0) { $output = ''; $main_args = array( 'hide_empty' => true, 'order' => $order, 'orderby' => 'menu_order', 'hierarchical' => 1 ); $all_chapters = get_terms('chapters', $main_args); if (is_null($all_chapters)) { echo 'There are no chapters available.'; return; } $output = ''; foreach ($all_chapters as $chapter) { if ($chapter->count) { $output .= '
'."\r\n"; $output .= '

'.$chapter->name.'

'."\r\n"; $output .= '
'."\r\n"; $output .= '
'.$chapter->description.'
'."\r\n"; $args = array( 'numberposts' => -1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => $order, 'post_status' => 'publish', 'chapters' => $chapter->slug ); $qposts = get_posts( $args ); $archive_count = 0; if ($thumbnail) { $get_thumbnail = (strtoupper($order) == 'ASC') ? get_the_post_thumbnail(reset($qposts)->ID, 'thumbnail') : get_the_post_thumbnail(end($qposts)->ID, 'thumbnail'); $output .= '
'.$get_thumbnail.'
'."\r\n"; } $output .= '
'."\r\n"; $css_alt = false; foreach ($qposts as $qpost) { $archive_count++; if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; } $output .= '
'.get_the_time('M d, Y', $qpost->ID).''.$qpost->post_title.'
'."\r\n"; } $output .= '
'."\r\n"; $output .= '
'."\r\n"; } $qposts = null; } return $output; } function ceo_archive_list_series($thumbnail = 0) { $output = ''; $archive_count = 0; $args = array( 'pad_counts' => 0, 'order' => 'ASC', 'hide_empty' => false, 'parent' => 0, 'orderby' => 'menu_order' ); $parent_chapters = get_terms('chapters', $args); if (is_array($parent_chapters)) { foreach($parent_chapters as $parent_chapter) { $output .= '

'.$parent_chapter->name.'

'; $output .= '
'; $output .= '
'.$parent_chapter->description.'
'; $child_chapters = get_term_children( $parent_chapter->term_id, 'chapters' ); foreach ($child_chapters as $child) { $child_term = get_term_by( 'id', $child, 'chapters' ); if ($child_term->count) { $output .= '
'; $output .= '

'.$child_term->name.'

'; $output .= '
'; $output .= '
'.$child_term->description.'
'; $child_args = array( 'numberposts' => -1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => 'ASC', 'post_status' => 'publish', 'chapters' => $child_term->slug ); $qcposts = get_posts( $child_args ); if ($thumbnail) { $output .= '
'.get_the_post_thumbnail($qcposts[0]->ID, 'thumbnail').'
'; } $output .= '
'; $css_alt = false; foreach ($qcposts as $qcpost) { $archive_count++; if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; } $output .= '
'.get_the_time('M d, Y', $qcpost->ID).''.$qcpost->post_title.'
'; } $output .= '
'; $output .= '
'; } } } return $output; } } function ceo_archive_list_by_chapter_thumbnails($order = 'ASC', $showtitle = false) { $output = ''; $archive_count = 0; $args = array( 'pad_counts' => 0, 'order' => $order, 'hide_empty' => 1, 'orderby' => 'menu_order' ); $chapters = get_terms('chapters', $args); if (is_array($chapters) && !is_wp_error($chapters)) { $output .= '
'; foreach($chapters as $chapter) { $qcposts = null; if (!empty($chapter->menu_order)) { $child_args = array( 'numberposts' => 1, 'post_type' => 'comic', 'orderby' => 'post_date', 'order' => 'ASC', 'post_status' => 'publish', 'chapters' => $chapter->slug ); $qcposts = get_posts( $child_args ); $qcposts = reset($qcposts); if (has_post_thumbnail($qcposts->ID)) { $output .= '
'.get_the_post_thumbnail($qcposts->ID, 'thumbnail').'
'; } else $output .= __('No Thumbnail Found', 'comiceasel'); } } $output .= '
'; return $output; } } function ceo_display_transcript($atts, $content = null) { extract( shortcode_atts( array( 'display' => 'styled' ), $atts ) ); if (is_archive() || is_search() || ceo_pluginfo('enable_transcripts_in_comic_posts')) return; return ceo_the_transcript($display); } function ceo_display_the_transcript_action() { global $post; if (is_archive() || is_search() || ceo_pluginfo('enable_transcripts_in_comic_posts')) return; return ceo_the_transcript('styled'); } function ceo_the_transcript($displaymode = 'raw') { global $post; $transcript = get_post_meta( $post->ID, "transcript", true ); apply_filters('ceo_the_transcript_raw', $transcript); if (!empty($transcript)) { switch ($displaymode) { case "raw": return $transcript; break; case "br": return nl2br($transcript); break; case "styled": $output = "\r\n"; $output .= "
↓ Transcript
".nl2br($transcript)."

\r\n"; $output .= "\r\n"; return $output; break; } } } function ceo_archive_list_by_year($thumbnail = false, $order = 'ASC', $chapter = 0) { global $wpdb; if (isset($_GET['archive_year'])) { $archive_year = (int)esc_attr($_GET['archive_year']); } else { $latest_comic = ceo_get_last_comic(false); $archive_year = get_post_time('Y', false, $latest_comic, true); } if (empty($archive_year)) $archive_year = date('Y'); $output = '

'.$archive_year.'

'; $output .= '
'; $output .= '
| '; if ($chapter) { $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->term_taxonomy.taxonomy = 'chapters' AND $wpdb->term_taxonomy.term_id = ".$chapter." ORDER BY post_date ".$order); } else { $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='comic' ORDER BY post_date ASC"); } foreach ( $years as $year ) { if ($year != (0) ) { $output .= ''.$year.' | '; } } $output .= '
'; $output .= '
'; $output .= ''; if ($chapter) { $comic_args = array( 'showposts' => -1, 'year' => (int)$archive_year, 'post_type' => 'comic', 'chapter' => $chapter, 'order' => $order ); } else { $comic_args = array( 'showposts' => -1, 'year' => (int)$archive_year, 'post_type' => 'comic', 'order' => $order ); } $theposts = get_posts($comic_args); foreach ($theposts as $post) { $output .= ''; } $output .= '
'.get_the_time('M j', $post).''.get_the_title($post->ID).'
'; return $output; } function ceo_archive_list_by_all_years($thumbnail = false, $order = 'ASC', $chapter = 0) { global $wpdb; $latest_comic = ceo_get_last_comic(false); $archive_year_latest = get_post_time('Y', false, $latest_comic, true); $first_comic = ceo_get_first_comic(false); $archive_year_first = get_post_time('Y', false, $first_comic, true); if ($chapter) { $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->term_taxonomy.taxonomy = 'chapters' AND $wpdb->term_taxonomy.term_id = ".$chapter." ORDER BY post_date ".$order); } else { $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='comic' ORDER BY post_date ".$order); } $output = ''; foreach ( $years as $year ) { if ($chapter) { $comic_args = array( 'showposts' => -1, 'year' => (int)$year, 'post_type' => 'comic', 'chapter' => $chapter, 'order' => $order ); } else { $comic_args = array( 'showposts' => -1, 'year' => (int)$year, 'post_type' => 'comic', 'order' => $order ); } $theposts = get_posts($comic_args); $output .= '

'.$year.'

'; $output .= ''; foreach ($theposts as $post) { $output .= ''; } $output .= '
'.get_the_time('M j', $post->ID).''.get_the_title($post->ID).'
'; } return $output; } function ceo_display_buycomic( $atts, $content = '' ) { global $post; extract(shortcode_atts( array( 'character' => '', 'thanks' => __('Thank you for the purchase!','comiceasel'), 'cancelled' => __('You have cancelled the transaction.','comiceasel') ), $atts ) ); $buy_output = ''; if (isset($_REQUEST['id'])) $comicnum = intval($_REQUEST['id']); if (isset($_REQUEST['action'])) { $action = esc_attr($_REQUEST['action']); switch ($action) { case 'thankyou': $buy_output .= '
'; $buy_output .= $thanks; $buy_output .= '
'; break; case 'cancelled': $buy_output .= '
'; $buy_output .= $cancelled; $buy_output .= '
'; break; } } if (isset($comicnum)) { $buy_print_orig_amount = get_post_meta($comicnum , 'buy_print_orig_amount', true); if (empty($buy_print_orig_amount)) $buy_print_orig_amount = ceo_pluginfo('buy_comic_orig_amount'); $buy_print_amount = get_post_meta($comicnum , 'buy_print_amount', true); if (empty($buy_print_amount)) $buy_print_amount = ceo_pluginfo('buy_comic_print_amount'); $buyprint_status = get_post_meta($comicnum , 'buyprint-status', true); if (empty($buyprint_status)) $buyprint_status = __('Available','comiceasel'); $buyorig_status = get_post_meta($comicnum , 'buyorig-status', true); if (empty($buyorig_status)) $buyorig_status = __('Available','comiceasel'); ceo_protect(); $post = get_post($comicnum); // Get the post if (!is_wp_error($post) && !empty($post)) { // error check make sure it got a post $buy_output .= __('Comic ID','comiceasel').' #'.$comicnum."
\r\n"; $buy_output .= __('Title:','comiceasel').' '.get_the_title($post)."
\r\n"; if (ceo_pluginfo('buy_comic_sell_print')) { $buy_output .= __('Print Status:','comiceasel').' '.$buyprint_status."
\r\n"; } if (ceo_pluginfo('buy_comic_sell_original')) { $buy_output .= __('Original Status:','comiceasel').' '.$buyorig_status."
\r\n"; } $buy_output .= "
\r\n"; $buy_output .= ''; $buy_output .= ''; // buy print if (ceo_pluginfo('buy_comic_sell_print')) { $buy_output .= ''; } // buy original if (ceo_pluginfo('buy_comic_sell_original')) { $buy_output .= ''; } $buy_output .= ''; $buy_output .= "
'; $buy_output .= '
'; $buy_output .= '

Print

'; $buy_output .= '$'.$buy_print_amount.'
'; if ($buyprint_status == __('Available','comiceasel')) { $buy_output .= '
'; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; // Say a thank you and that transaction went through with an action $url = ceo_pluginfo('buy_comic_url'); $url_and = (strpos($url,'?')) ? $url.'&' : $url.'?'; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= '
'; } if ($buyprint_status == __('Sold','comiceasel')) { $buy_output .= ''.__('Sold','comiceasel').''; } elseif ($buyprint_status == __('Out Of Stock','comiceasel')) { $buy_output .= ''.__('Out Of Stock','comiceasel').''; } elseif ($buyprint_status == __('Not Available','comiceasel')) { $buy_output .= ''.__('Not Available','comiceasel').''; } $buy_output .= '
'; $buy_output .= '
'; $buy_output .= '
'; $buy_output .= '

Original

'; $buy_output .= '$'.$buy_print_orig_amount.'
'; if ($buyorig_status == __('Available','comiceasel')) { $buy_output .= '
'; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; // Say a thank you and that transaction went through with an action $url = ceo_pluginfo('buy_comic_url'); $url_and = (strpos($url,'?')) ? $url.'&' : $url.'?'; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= ''; $buy_output .= '
'; } if ($buyorig_status == __('Sold','comiceasel')) { $buy_output .= ''.__('Sold','comiceasel').''; } elseif ($buyorig_status == __('Out Of Stock','comiceasel')) { $buy_output .= ''.__('Out Of Stock','comiceasel').''; } elseif ($buyorig_status == __('Not Available','comiceasel')) { $buy_output .= ''.__('Not Available','comiceasel').''; } $buy_output .= '
'; $buy_output .= '
\r\n"; $buy_output .= '
'; $buy_output .= ceo_display_comic_thumbnail('large', $post); $buy_output .= "
\r\n"; /* $last_info = get_option('ceo_paypal_receiver'); // Debug to see the last transaction, which is stored in this option if (!empty($last_info)) $buy_output .= nl2br($last_info); */ } else { $buy_output .= __('Invalid Comic ID.','comiceasel')."
\r\n"; } ceo_unprotect(); } return $buy_output; } function ceo_comic_archive_dropdown($atts, $content='') { extract( shortcode_atts( array( 'unhide' => false, 'exclude' => '', 'showcount' => false, 'jumptoarchive' => false, 'return' => true ), $atts ) ); return ceo_comic_archive_jump_to_chapter($unhide, $exclude, $showcount, $jumptoarchive, $return); } function ceo_random_comic_shortcode($atts, $content = '') { extract( shortcode_atts( array( 'character' => '', 'size' => 'thumbnail', 'slug' => '', 'chapter' => '', 'orderby' => 'rand', 'month' => '', 'day' => '', 'year' => '' ), $atts ) ); global $post; $args = array( 'name' => $slug, 'orderby' => $orderby, 'showposts' => 1, 'post_type' => 'comic', 'chapters' => $chapter, 'characters' => $character, 'exclude' => $post->ID, 'year' => $year, 'month' => $month, 'day' => $day ); ceo_protect(); $thumbnail_query = new WP_Query($args); $output = ''; $archive_image = ''; if ($thumbnail_query->have_posts()) { while ($thumbnail_query->have_posts()) : $thumbnail_query->the_post(); $the_permalink = get_permalink($post->ID); $output = '
'; if ( has_post_thumbnail($post->ID) ) { $output .= "".get_the_post_thumbnail($post->ID, $size)."\r\n"; } else { $output .= __('No Thumbnail Found.','comiceasel'); } $output .= "
\r\n"; endwhile; } ceo_unprotect(); return $output; }