* sep. the comic_display_comic() function into individual parts so it isn't as lengthy to read

* new feature, Hoverbox, aka ComicPress Rascal - TODO: Needs new mascot
This commit is contained in:
Frumph
2013-08-10 05:50:08 -07:00
parent a57ff01cda
commit 9e5ee0fa53
8 changed files with 218 additions and 107 deletions

View File

@@ -40,7 +40,8 @@ if ( isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-op
'display_first_comic_on_home_page',
'disable_style_sheet',
'enable_transcripts_in_comic_posts',
'enable_motion_artist_support'
'enable_motion_artist_support',
'enable_hoverbox'
) as $key) {
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
$ceo_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );

View File

@@ -320,7 +320,8 @@ function ceo_load_options($reset = false) {
'disable_style_sheet' => false,
'enable_transcripts_in_comic_posts' => false,
'enable_chapter_only_random' => false,
'enable_motion_artist_support' => false
'enable_motion_artist_support' => false,
'enable_hoverbox' => false
) as $field => $value) {
$ceo_config[$field] = $value;
}

View File

@@ -260,4 +260,66 @@ a.transcript-title {
.MADoc {
margin: 0 auto !important;
padding: 0 !important;
}
}
/* Tool Tips (ComicPress Rascal) */
.tt a {
position: relative;
z-index: 1000;
color: #3CA3FF;
font-weight: bold;
text-decoration: none;
margin-bottom: -110px;
}
a.tt span {
display: none;
}
a.tt:hover span.tooltip {
position: absolute;
display: block;
width: 200px;
color: #000;
margin: 0 auto;
text-align: center;
height: 164px;
background: url('../images/comicpress-rascal.png') no-repeat;
z-index: 1000;
}
a.tt:hover span.top {
display: block;
width: 200px;
height: 35px;
padding-top: 2px;
margin-top: 55px;
margin-left: 25px;
background: url('../images/bubble.png') 0 0 no-repeat;
z-index: 1000;
}
a.tt:hover span.middle {
/* different middle bg for stretch */
display: block;
width: 180px;
margin: 0 0 0 25px;
padding: 0 10px;
background: url('../images/bubble.png') -200px 0 repeat-y;
z-index: 1000;
}
a.tt:hover span.bottom {
display: block;
width: 200px;
height: 15px;
background-position: -100px;
color: #548912;
margin-left: 25px;
background: url('../images/bubble.png') 0 -35px no-repeat;
z-index: 1000;
}
.ie .tt a:hover {
z-index: 1000;
color: #aaaaff;
background-color: Transparent;
}

View File

@@ -7,7 +7,7 @@ function ceo_add_motion_artist_header_info() {
global $post;
if (!is_admin()) {
if ((is_home() || is_front_page()) && !is_paged() && !ceo_pluginfo('disable_comic_on_home_page')) {
$order = (ceo_pluginfo('display_first_comic_on_home_page')) ? 'asc' : 'desc';
$order = (ceo_pluginfo('display_first_comic_on_home_page')) ? 'ASC' : 'DESC';
$args = array(
'showposts' => 1,
'posts_per_page' => 1,
@@ -31,6 +31,127 @@ function ceo_add_motion_artist_header_info() {
}
}
function ceo_display_motion_artist_comic($motion_artist_comic = '') {
global $post;
$output = '';
if (!empty($motion_artist_comic)){
$motion_artist_id = get_post_meta( $post->ID, 'ma-id', true );
$motion_artist_height = get_post_meta( $post->ID, 'ma-height', true);
$motion_artist_width = get_post_meta( $post->ID, 'ma-width', true);
$output .= '<center>'."\r\n";
$output .= '<div class="MADoc">'."\r\n";
$output .= ' <canvas id="'.$motion_artist_id.'_canvas" width="'.$motion_artist_width.'px" height="'.$motion_artist_height.'px"></canvas>'."\r\n";
$output .= '</div>'."\r\n";
$output .= '<div class="MAButtons">'."\r\n";
$output .= ' <ul class="MAButtonSet">'."\r\n";
$output .= ' <li><button class="MAButton" id="'.$motion_artist_id.'_pauseButton">Play</button></li>'."\r\n";
$output .= ' </ul>'."\r\n";
$output .= '</div>'."\r\n";
$output .= '</center>'."\r\n";
}
return apply_filters('ceo_display_motion_artist_comic', $output);
}
function ceo_display_featured_image_comic($size = 'full') {
global $post;
$output = '';
$post_image_id = get_post_thumbnail_id($post->ID);
if ($post_image_id) { // If there's a featured image.
$hoverbox_enabled = (ceo_pluginfo('enable_hoverbox')) ? ' class="tt"' : '';
$hovertext = ceo_the_hovertext();
$thumbnail = wp_get_attachment_image_src( $post_image_id, $size, false);
if (is_array($thumbnail)) {
$thumbnail = reset($thumbnail);
$comic_lightbox = get_post_meta( $post->ID, 'comic-open-lightbox', true );
if (is_wp_error($comic_lightbox)) $comic_lightbox = false;
if (ceo_pluginfo('navigate_only_chapters')) {
$next_comic = ceo_get_next_comic_in_chapter_permalink();
} else {
$next_comic = ceo_get_next_comic_permalink();
}
if ($comic_lightbox) {
$output .= '<a href="'.$thumbnail.'" title="'.$hovertext.'" rel="lightbox"'.$hoverbox_enabled.'>';
}
if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) {
$output .= '<a href="'.$next_comic.'" title="'.$hovertext.'"'.$hoverbox_enabled.'>';
}
if (ceo_pluginfo('enable_hoverbox') && !empty($hovertext)) $output .= '<span class="tooltip"><span class="top">&nbsp;</span><span class="middle">'.$hovertext.'</span><span class="bottom">&nbsp;</span></span>';
$output .= '<img src="'.$thumbnail.'" alt="'.$hovertext.'" title="'.$hovertext.'" />';
if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) {
$output .= '</a>';
}
if ($comic_lightbox) $output .= '<div class="comic-lightbox-text">'.__('Click comic to view larger version.','comiceasel').'</div>';
}
}
return apply_filters('ceo_display_featured_image_comic', $output);
}
function ceo_display_comic_gallery($size = 'full') {
global $post;
$output = '';
if (ceo_pluginfo('click_comic_next')) {
if (ceo_pluginfo('navigate_only_chapters')) {
$next_comic = ceo_get_next_comic_in_chapter_permalink();
} else {
$next_comic = ceo_get_next_comic_permalink();
}
}
$hovertext = ceo_the_hovertext();
$hoverbox_enabled = (ceo_pluginfo('enable_hoverbox')) ? ' class="tt"' : '';
$comic_galleries_full = get_post_meta( $post->ID, 'comic-gallery-full', true );
if ($comic_galleries_full) {
$comic_lightbox = get_post_meta( $post->ID, 'comic-open-lightbox', true );
$comic_galleries_jquery = get_post_meta( $post->ID, 'comic-gallery-jquery', true );
if ($images = get_posts(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC'
))) {
$count = 0;
if ($comic_galleries_jquery) wp_enqueue_script('multicomic', ceo_pluginfo('plugin_url') . '/js/multicomic.js', null, null, true);
foreach($images as $image) {
if ($comic_galleries_jquery) $output .= '<div id="comic-'.$count.'" class="comicpane">';
$thumbnail = wp_get_attachment_image_src($image->ID, 'full');
$thumbnail = reset($thumbnail);
if ($comic_lightbox || ceo_pluginfo('enable_hoverbox')) {
$output .= '<a href="'.$thumbnail.'" title="'.$hovertext.'" rel="lightbox" '.$hoverbox_enabled.'>';
}
if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) {
$output .= '<a href="'.$next_comic.'" title="'.$hovertext.'" '.$hoverbox_enabled.'>';
}
$output .= '<img src="'.$thumbnail.'" alt="'.$hovertext.'" title="'.$hovertext.'" />';
if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox || ceo_pluginfo('enable_hoverbox')) {
$output .= '</a>';
}
if (ceo_pluginfo('enable_hoverbox')) $output .= '<span class="tooltip"><span class="top">&nbsp;</span><span class="middle">'.$hovertext.'</span><span class="bottom">&nbsp;</span></span>';
if ($comic_galleries_jquery) $output .= "</div>\r\n";
$count += 1;
}
if ($comic_galleries_jquery) $output .= "<button id=\"show-".$count."\" type=\"button\" style=\"display:none;\">".$count."</button>\r\n";
if ($comic_lightbox) $output .= '<div class="comic-lightbox-text">'.__('Click comic to view larger version.','comiceasel').'</div>';
}
} else {
$columns = get_post_meta( $post->ID, 'comic-gallery-columns', true );
if (empty($columns)) $columns = 5;
$args = array(
'id' => $post->ID,
'columns' => $columns,
'exclude' => $post_image_id
);
$output .= gallery_shortcode($args);
}
return apply_filters('ceo_display_comic_gallery', $output);
}
function ceo_display_comic($size = 'full') {
global $post;
if ( post_password_required() ) {
@@ -40,115 +161,29 @@ function ceo_display_comic($size = 'full') {
if (ceo_the_above_html()) $output .= html_entity_decode(ceo_the_above_html())."\r\n";
$motion_artist_comic = get_post_meta( $post->ID, 'ma-directory', true );
if (!empty($motion_artist_comic) && !is_wp_error($motion_artist_comic) && !defined('CEO_FEATURE_DISABLE_MOTION_ARTIST')) {
$motion_artist_id = get_post_meta( $post->ID, 'ma-id', true );
$motion_artist_height = get_post_meta( $post->ID, 'ma-height', true);
$motion_artist_width = get_post_meta( $post->ID, 'ma-width', true);
echo "<center>\r\n";
echo '<div class="MADoc">'."\r\n";
echo ' <canvas id="'.$motion_artist_id.'_canvas" width="'.$motion_artist_width.'px" height="'.$motion_artist_height.'px"></canvas>'."\r\n";
echo '</div>'."\r\n";
echo '<div class="MAButtons">'."\r\n";
echo ' <ul class="MAButtonSet">'."\r\n";
echo ' <li><button class="MAButton" id="'.$motion_artist_id.'_pauseButton">Play</button></li>'."\r\n";
echo ' </ul>'."\r\n";
echo '</div>'."\r\n";
echo "</center>\r\n";
if ($motion_artist_comic && !defined('CEO_FEATURE_DISABLE_MOTION_ARTIST')) {
$output .= ceo_display_motion_artist_comic($motion_artist_comic);
} else {
$comic_galleries = get_post_meta( $post->ID, 'comic-gallery', true );
if (is_wp_error($comic_galleries)) $comic_galleries = false;
$comic_galleries_full = get_post_meta( $post->ID, 'comic-gallery-full', true );
if (is_wp_error($comic_galleries_full)) $comic_galleries_full = false;
$post_image_id = get_post_thumbnail_id($post->ID);
if ((is_numeric($post_image_id) && !$comic_galleries) || ($comic_galleries && !$comic_galleries_full)) {
$thumbnail = wp_get_attachment_image_src( $post_image_id, $size, false);
if (is_array($thumbnail)) {
$thumbnail = reset($thumbnail);
$hovertext = ceo_the_hovertext();
$comic_lightbox = get_post_meta( $post->ID, 'comic-open-lightbox', true );
if (is_wp_error($comic_lightbox)) $comic_lightbox = false;
if (ceo_pluginfo('navigate_only_chapters')) {
$next_comic = ceo_get_next_comic_in_chapter_permalink();
} else {
$next_comic = ceo_get_next_comic_permalink();
}
if ($comic_lightbox) {
$output .= '<a href="'.$thumbnail.'" title="'.$hovertext.'" rel="lightbox">';
}
if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) {
$output .= '<a href="'.$next_comic.'" title="'.$hovertext.'">';
}
$output .= '<img src="'.$thumbnail.'" alt="'.$hovertext.'" title="'.$hovertext.'" />';
if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) {
$output .= '</a>';
}
if ($comic_lightbox) $output .= '<div class="comic-lightbox-text">'.__('Click comic to view larger version.','comiceasel').'</div>';
}
}
if (is_numeric($post_image_id) && $comic_galleries) {
if ($comic_galleries_full) {
$hovertext = ceo_the_hovertext();
$comic_lightbox = get_post_meta( $post->ID, 'comic-open-lightbox', true );
$comic_galleries_jquery = get_post_meta( $post->ID, 'comic-gallery-jquery', true );
if($images = get_posts(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC'
))) {
$count = 0;
if ($comic_galleries_jquery) wp_enqueue_script('multicomic', ceo_pluginfo('plugin_url') . '/js/multicomic.js', null, null, true);
foreach($images as $image) {
if ($comic_galleries_jquery) $output .= '<div id="comic-'.$count.'" class="comicpane">';
$thumbnail = wp_get_attachment_image_src($image->ID, 'full');
$thumbnail = reset($thumbnail);
if (ceo_pluginfo('navigate_only_chapters')) {
$next_comic = ceo_get_next_comic_in_chapter_permalink();
} else {
$next_comic = ceo_get_next_comic_permalink();
}
if ($comic_lightbox) {
$output .= '<a href="'.$thumbnail.'" title="'.$hovertext.'" rel="lightbox">';
}
if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) {
$output .= '<a href="'.$next_comic.'" title="'.$hovertext.'">';
}
$output .= '<img src="'.$thumbnail.'" alt="'.$hovertext.'" title="'.$hovertext.'" />';
if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) {
$output .= '</a>';
}
if ($comic_galleries_jquery) $output .= "</div>\r\n";
$count += 1;
}
if ($comic_galleries_jquery) $output .= "<button id=\"show-".$count."\" type=\"button\" style=\"display:none;\">".$count."</button>\r\n";
if ($comic_lightbox) $output .= '<div class="comic-lightbox-text">'.__('Click comic to view larger version.','comiceasel').'</div>';
}
} else {
$columns = get_post_meta( $post->ID, 'comic-gallery-columns', true );
if (empty($columns)) $columns = 5;
$args = array(
'id' => $post->ID,
'columns' => $columns,
'exclude' => $post_image_id
);
$output .= gallery_shortcode($args);
}
if ($comic_galleries) {
$output .= ceo_display_comic_gallery($size);
} else {
$output .= ceo_display_featured_image_comic($size);
}
}
if (ceo_the_below_html()) $output .= html_entity_decode(ceo_the_below_html())."\r\n";
if ($output) {
return apply_filters('ceo_comics_display_comic', $output);
} else
return __('<!-- No HTML, Gallery or featured image Found. //-->', 'comiceasel');
return apply_filters('ceo_comics_display_comic', __('<!-- No HTML, Gallery, Motion Artist Comic or Featured Image Found. //-->', 'comiceasel'));
}
add_filter('ceo_comics_display_comic', 'ceo_filter_comic_output',10,1);
function ceo_filter_comic_output($output = '') {
global $post;
return $output;
}
function ceo_the_hovertext($override_post = null) {
@@ -156,7 +191,8 @@ function ceo_the_hovertext($override_post = null) {
$post_to_use = !is_null($override_post) ? $override_post : $post;
$hovertext = esc_attr( get_post_meta( $post_to_use->ID, 'comic-hovertext', true ) );
if (empty($hovertext)) $hovertext = esc_attr( get_post_meta($post_to_use->ID, 'hovertext', true) ); // check if using old hovertext
return (empty($hovertext)) ? get_the_title($post_to_use->ID) : $hovertext;
// return (empty($hovertext)) ? get_the_title($post_to_use->ID) : $hovertext;
return (empty($hovertext)) ? '' : $hovertext;
}
function ceo_the_above_html($override_post = null) {

BIN
images/bubble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -54,6 +54,15 @@
</td>
</tr>
<tr>
<th scope="row"><label for="enable_hoverbox"><?php _e('Enable Hoverbox?','comiceasel'); ?></label></th>
<td>
<input id="enable_hoverbox" name="enable_hoverbox" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_hoverbox']); ?> />
</td>
<td>
<?php _e('Hoverbox is the equivelant of Rascal in ComicPress, mouse-hover over comic leads to a skinnable section that can be customized for viewing the hovertext.','comiceasel'); ?>
</td>
</tr>
<tr class="alternate">
<th scope="row"><label for="disable_related_comics"><?php _e('Disable the displaying of related comics?','comiceasel'); ?></label></th>
<td>
<input id="disable_related_comics" name="disable_related_comics" type="checkbox" value="1" <?php checked(true, $ceo_options['disable_related_comics']); ?> />
@@ -62,7 +71,7 @@
<?php _e('If you have a theme that has related comics do_action code installed, this will disable it from displaying.','comiceasel'); ?>
</td>
</tr>
<tr class="alternate">
<tr>
<th scope="row"><label for="display_first_comic_on_home_page"><?php _e('Show the first comic on the home page?','comiceasel'); ?></label></th>
<td>
<input id="display_first_comic_on_home_page" name="display_first_comic_on_home_page" type="checkbox" value="1" <?php checked(true, $ceo_options['display_first_comic_on_home_page']); ?> />
@@ -71,7 +80,7 @@
<?php _e('Enabling this will make it so that the comic on the home page is the first comic.','comiceasel'); ?>
</td>
</tr>
<tr>
<tr class="alternate">
<th scope="row"><label for="disable_style_sheet"><?php _e('Disable the default stylesheets. comiceasel.css and navstyle.css','comiceasel'); ?></label></th>
<td>
<input id="disable_style_sheet" name="disable_style_sheet" type="checkbox" value="1" <?php checked(true, $ceo_options['disable_style_sheet']); ?> />

View File

@@ -131,6 +131,8 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled
* Change menu position to 6 if Jetpack comics is activated so they don't overwrite each other.
* Fixed some localization strings being the wrong designation
* added some extra classes to the nav buttons in the default nav so it can be skinned properly
* sep. the comic_display_comic() function into individual parts so it isn't as lengthy to read
* new feature, Hoverbox, aka ComicPress Rascal - TODO: Needs new mascot
= 1.4.2 =
* shortcodes: fixed the 'ordering' of the thumbnail=1 in the comic-archive for list=0