diff --git a/ceo-config.php b/ceo-config.php index bc94f71..83babc1 100644 --- a/ceo-config.php +++ b/ceo-config.php @@ -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 ); diff --git a/comiceasel.php b/comiceasel.php index f77e914..b77646d 100644 --- a/comiceasel.php +++ b/comiceasel.php @@ -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; } diff --git a/css/comiceasel.css b/css/comiceasel.css index 39b35c1..84b75d3 100644 --- a/css/comiceasel.css +++ b/css/comiceasel.css @@ -260,4 +260,66 @@ a.transcript-title { .MADoc { margin: 0 auto !important; padding: 0 !important; -} \ No newline at end of file +} + +/* 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; +} diff --git a/functions/displaycomic.php b/functions/displaycomic.php index 7bbb9db..ed1166e 100644 --- a/functions/displaycomic.php +++ b/functions/displaycomic.php @@ -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 .= '
'."\r\n"; + $output .= '
'."\r\n"; + $output .= ' '."\r\n"; + $output .= '
'."\r\n"; + $output .= '
'."\r\n"; + $output .= ' '."\r\n"; + $output .= '
'."\r\n"; + $output .= '
'."\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 .= ''; + } + if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) { + $output .= ''; + } + if (ceo_pluginfo('enable_hoverbox') && !empty($hovertext)) $output .= ' '.$hovertext.' '; + + $output .= ''.$hovertext.''; + if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) { + $output .= ''; + } + if ($comic_lightbox) $output .= '
'.__('Click comic to view larger version.','comiceasel').'
'; + } + } + 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 .= '
'; + $thumbnail = wp_get_attachment_image_src($image->ID, 'full'); + $thumbnail = reset($thumbnail); + + if ($comic_lightbox || ceo_pluginfo('enable_hoverbox')) { + $output .= ''; + } + if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) { + $output .= ''; + } + $output .= ''.$hovertext.''; + if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox || ceo_pluginfo('enable_hoverbox')) { + $output .= ''; + } + if (ceo_pluginfo('enable_hoverbox')) $output .= ' '.$hovertext.' '; + if ($comic_galleries_jquery) $output .= "
\r\n"; + $count += 1; + } + if ($comic_galleries_jquery) $output .= "\r\n"; + if ($comic_lightbox) $output .= '
'.__('Click comic to view larger version.','comiceasel').'
'; + } + } 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 "
\r\n"; - echo '
'."\r\n"; - echo ' '."\r\n"; - echo '
'."\r\n"; - echo '
'."\r\n"; - echo ' '."\r\n"; - echo '
'."\r\n"; - echo "
\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 .= ''; - } - if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) { - $output .= ''; - } - $output .= ''.$hovertext.''; - if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) { - $output .= ''; - } - if ($comic_lightbox) $output .= '
'.__('Click comic to view larger version.','comiceasel').'
'; - } - } - - 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 .= '
'; - $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 .= ''; - } - if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) { - $output .= ''; - } - $output .= ''.$hovertext.''; - if ((ceo_pluginfo('click_comic_next') && !empty($next_comic)) || $comic_lightbox) { - $output .= ''; - } - if ($comic_galleries_jquery) $output .= "
\r\n"; - $count += 1; - } - if ($comic_galleries_jquery) $output .= "\r\n"; - if ($comic_lightbox) $output .= '
'.__('Click comic to view larger version.','comiceasel').'
'; - } - } 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 __('', 'comiceasel'); + return apply_filters('ceo_comics_display_comic', __('', '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) { diff --git a/images/bubble.png b/images/bubble.png new file mode 100644 index 0000000..a9c78dd Binary files /dev/null and b/images/bubble.png differ diff --git a/images/comicpress-rascal.png b/images/comicpress-rascal.png new file mode 100644 index 0000000..68f590b Binary files /dev/null and b/images/comicpress-rascal.png differ diff --git a/options/general.php b/options/general.php index 446cf79..6ded076 100644 --- a/options/general.php +++ b/options/general.php @@ -54,6 +54,15 @@ + + + /> + + + + + + /> @@ -62,7 +71,7 @@ - + /> @@ -71,7 +80,7 @@ - + /> diff --git a/readme.txt b/readme.txt index 22add7c..40de85b 100644 --- a/readme.txt +++ b/readme.txt @@ -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