Merge branch 'master' of git@github.com:johnbintz/comicpress-2.8

This commit is contained in:
John Bintz 2010-01-02 15:18:49 -05:00
commit ce108969f9
8 changed files with 79 additions and 58 deletions

View File

@ -50,6 +50,7 @@ function comicpress_admin() {
'disable_comment_note', 'disable_comment_note',
'enable_numbered_pagination', 'enable_numbered_pagination',
'enable_comment_count_in_rss', 'enable_comment_count_in_rss',
'enable_post_thumbnail_rss',
'comic_clicks_next', 'comic_clicks_next',
'disable_default_comic_nav', 'disable_default_comic_nav',
'enable_widgetarea_use_sidebar_css', 'enable_widgetarea_use_sidebar_css',

View File

@ -119,6 +119,7 @@ function comicpress_load_options() {
'disable_page_titles' => false, 'disable_page_titles' => false,
'static_blog' => false, 'static_blog' => false,
'disable_default_comic_nav' => false, 'disable_default_comic_nav' => false,
'enable_post_thumbnail_rss' => true,
'cp_theme_layout' => 'standard', 'cp_theme_layout' => 'standard',
'transcript_in_posts' => false, 'transcript_in_posts' => false,
@ -721,7 +722,7 @@ function comicpress_list_storyline_categories($args = "") {
*/ */
function the_hovertext() { function the_hovertext() {
$hovertext = get_post_meta( get_the_ID(), "hovertext", true ); $hovertext = get_post_meta( get_the_ID(), "hovertext", true );
echo (empty($hovertext)) ? get_the_title() : $hovertext; return (empty($hovertext)) ? get_the_title() : $hovertext;
} }
/** /**
@ -762,26 +763,6 @@ function the_transcript($displaymode = 'raw') {
} }
} }
//Insert the comic image into the RSS feed
function comic_feed() {
foreach (array("rss", "archive", "mini", "comic") as $type) {
if (($requested_thumbnail_image = get_comic_url($type, $first_comic_in_category)) !== false) {
$thumbnail_image = $requested_thumbnail_image; break;
}
}
?>
<p><a href="<?php the_permalink() ?>"><img src="<?php echo $thumbnail_image; ?>" border="0" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" /></a></p><?php
}
function insert_comic_feed($content) {
if (is_feed() && in_comic_category()) {
return comic_feed() . $content;
} else {
return $content;
}
}
add_filter('the_content','insert_comic_feed');
// Register Sidebar and Define Widgets // Register Sidebar and Define Widgets
if ( function_exists('register_sidebar') ) { if ( function_exists('register_sidebar') ) {
@ -802,16 +783,10 @@ if ( function_exists('register_sidebar') ) {
) as $label) { ) as $label) {
register_sidebar(array( register_sidebar(array(
'name'=> $label, 'name'=> $label,
'before_widget' => ' 'before_widget' => "<div class=\"widget-head\"></div>\r\n<div id=\"".'%1$s'."\" class=\"widget ".'%2$s'."\">\r\n",
<div class="widget-head"></div> 'after_widget' => "</div>\r\n<div class=\"widget-foot\"></div>\r\n",
<div id="%1$s" class="widget %2$s"> 'before_title' => "<h2 class=\"widgettitle\">\r\n",
', 'after_title' => "</h2>\r\n"
'after_widget' => '
</div>
<div class="widget-foot"></div>
',
'before_title' => ' <h2 class="widgettitle">',
'after_title' => '</h2>'
)); ));
} }
} }

View File

@ -1,13 +1,37 @@
<?php <?php
function display_comic_area() { function comicpress_display_comic_image($searchorder = "comic",$use_post_image = false) {
global $post;
if ($use_post_image) {
if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail($post->ID) ) {
$comic_image = get_the_post_thumbnail($post->ID,'full');
$comic_image = preg_replace('#title="([^*]*)"#', 'title="'.the_hovertext().'"', $comic_image);
}
}
}
if (!isset($comic_image)) {
$searchorder = explode(',',$searchorder);
$requested_archive_image = '';
foreach ($searchorder as $type) {
if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
$comic_image = "<img src=\"$requested_archive_image\" alt=\"".get_the_title()."\" title=\"".the_hovertext()."\" />";
break;
}
}
}
return apply_filters('comicpress_display_comic_image',$comic_image);
}
function comicpress_display_comic_area() {
global $post, $wp_query, $comicpress_options; global $post, $wp_query, $comicpress_options;
if (comicpress_check_child_file('partials/displaycomic') == false) { ?> if (comicpress_check_child_file('partials/displaycomic') == false) { ?>
<div id="comic-wrap"> <div id="comic-wrap">
<div id="comic-head"><?php get_sidebar('over'); ?></div> <div id="comic-head"><?php get_sidebar('over'); ?></div>
<div class="clear"></div> <div class="clear"></div>
<?php get_sidebar('comicleft'); ?> <?php get_sidebar('comicleft'); ?>
<div id="comic"><?php display_comic(); ?></div> <div id="comic"><?php comicpress_display_comic(); ?></div>
<?php get_sidebar('comicright'); ?> <?php get_sidebar('comicright'); ?>
<div class="clear"></div> <div class="clear"></div>
<div id="comic-foot"><?php get_sidebar('under'); ?></div> <div id="comic-foot"><?php get_sidebar('under'); ?></div>
@ -15,7 +39,7 @@ function display_comic_area() {
<?php } <?php }
} }
function display_comic() { function comicpress_display_comic() {
global $post, $wp_query, $rascal_says, $comicpress_options, $comic_filename_filters; global $post, $wp_query, $rascal_says, $comicpress_options, $comic_filename_filters;
$next_comic = get_next_comic_permalink(); $next_comic = get_next_comic_permalink();
$comic = explode(".", the_comic_filename()); $comic = explode(".", the_comic_filename());

View File

@ -12,7 +12,7 @@ function display_comics_multi() {
if (($result = get_comic_path('comic', '', '', 1)) !== false) { if (($result = get_comic_path('comic', '', '', 1)) !== false) {
foreach ($result as $pathto_comic) { ?> foreach ($result as $pathto_comic) { ?>
<div class="comicdisp"> <div class="comicdisp">
<img src="<?php echo get_option('home'). '/' .$pathto_comic; ?>" alt="<?php the_title(); ?>" title="<?php the_hovertext(); ?>" /> <img src="<?php echo get_option('home'). '/' .$pathto_comic; ?>" alt="<?php the_title(); ?>" title="<?php echo the_hovertext(); ?>" />
</div> </div>
<?php } <?php }
} }

View File

@ -75,7 +75,7 @@ function comicpress_the_title_rss($title = '') {
$title_pattern = sprintf(__('%%s (%d Comments)', 'comicpress'), $count); $title_pattern = sprintf(__('%%s (%d Comments)', 'comicpress'), $count);
break; break;
} }
return sprintf($title_pattern, $title); return sprintf($title_pattern, $title);
} }
@ -91,3 +91,23 @@ if ($comicpress_options['enable_comment_count_in_rss']) {
add_filter('the_title_rss', 'comicpress_the_title_rss'); add_filter('the_title_rss', 'comicpress_the_title_rss');
add_action('export_wp', 'comicpress_export_wp'); add_action('export_wp', 'comicpress_export_wp');
} }
//Insert the comic image into the RSS feed
function comicpress_comic_feed() {
global $post, $comicpress_options; ?>
<p><a href="<?php the_permalink() ?>"><?php echo comicpress_display_comic_image('rss,comic',$comicpress_options['enable_post_thumbnail_rss']); ?></a></p><?php
}
// removed the in_comic_category so that if it has a post-image it will add it to the rss feed (else rss comic thumb)
function comicpress_insert_comic_feed($content) {
global $post, $wp_query;
if (is_feed()) {
return comicpress_comic_feed() . $content;
} else {
return $content;
}
}
add_filter('the_content','comicpress_insert_comic_feed');
?>

View File

@ -27,7 +27,7 @@
if (have_posts()) { if (have_posts()) {
while (have_posts()) : the_post(); while (have_posts()) : the_post();
$wp_query->is_single = true; $wp_query->is_single = true;
display_comic_area(); comicpress_display_comic_area();
endwhile; endwhile;
} }
Restore(); Restore();
@ -35,7 +35,7 @@
wp_reset_query(); wp_reset_query();
} }
if (is_single() & in_comic_category()) { if (is_single() & in_comic_category()) {
display_comic_area(); comicpress_display_comic_area();
} }
?> ?>

View File

@ -47,6 +47,14 @@
<?php _e('Checkmark this and your site will not display the contents of #blogheader.','comicpress'); ?> <?php _e('Checkmark this and your site will not display the contents of #blogheader.','comicpress'); ?>
</td> </td>
</tr> </tr>
</table>
<table class="widefat">
<thead>
<tr>
<th colspan="3"><?php _e('RSS','comicpress'); ?></th>
</tr>
</thead>
<tr class="alternate"> <tr class="alternate">
<th scope="row"><label for="enable_comment_count_in_rss"><?php _e('Enable the comment count to show in feed title.','comicpress'); ?></label></th> <th scope="row"><label for="enable_comment_count_in_rss"><?php _e('Enable the comment count to show in feed title.','comicpress'); ?></label></th>
<td> <td>
@ -56,6 +64,15 @@
<?php _e('Will show how many comments there are in the title of the post in the feed.','comicpress'); ?> <?php _e('Will show how many comments there are in the title of the post in the feed.','comicpress'); ?>
</td> </td>
</tr> </tr>
<tr>
<th scope="row"><label for="enable_post_thumbnail_rss"><?php _e('Enable the post thumbnails in the RSS feed?','comicpress'); ?></label></th>
<td>
<input id="enable_post_thumbnail_rss" name="enable_post_thumbnail_rss" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_post_thumbnail_rss']); ?> />
</td>
<td>
<?php _e('If enabled will show the post thumbnail of the post in the RSS feed.','comicpress'); ?>
</td>
</tr>
</table> </table>
<table class="widefat"> <table class="widefat">

View File

@ -32,26 +32,10 @@ class ComicPressLatestThumbnailWidget extends WP_Widget {
$archive_image = null; $archive_image = null;
if (have_posts()) { if (have_posts()) {
while (have_posts()) : the_post(); while (have_posts()) : the_post();
if (!empty($post->post_content)) { $temp_query = $wp_query->is_single;
echo $before_widget; $wp_query->is_single = true;
$temp_query = $wp_query->is_single; echo "<a href=\"".get_permalink()."\">".comicpress_display_comic_image('rss,archive,mini,comic',true)."</a>\r\n";
$wp_query->is_single = true; $wp_query->is_single = $temp_query;
foreach (array("archive", "rss", "mini", "comic") as $type) {
if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
$archive_image = "<img src=\"$requested_archive_image\" alt=\"".get_the_title()."\" title=\"".get_the_title()."\" />";
break;
}
}
if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail($post->ID) ) {
$archive_image = get_the_post_thumbnail($post->ID,'full');
}
} ?>
<a href="<?php the_permalink(); ?>"><?php echo $archive_image; ?></a>
<?php
$wp_query->is_single = $temp_query;
echo $after_widget;
}
endwhile; endwhile;
} }
Restore(); Restore();