diff --git a/ceo-config.php b/ceo-config.php index bb40988..bc94f71 100644 --- a/ceo-config.php +++ b/ceo-config.php @@ -39,7 +39,8 @@ if ( isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-op 'disable_related_comics', 'display_first_comic_on_home_page', 'disable_style_sheet', - 'enable_transcripts_in_comic_posts' + 'enable_transcripts_in_comic_posts', + 'enable_motion_artist_support' ) 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 00c4396..6584c88 100644 --- a/comiceasel.php +++ b/comiceasel.php @@ -3,7 +3,7 @@ Plugin Name: Comic Easel Plugin URI: http://comiceasel.com Description: Comic Easel allows you to incorporate a WebComic using the WordPress Media Library functionality with Navigation into almost all WordPress themes. With just a few modifications of adding injection do_action locations into a theme, you can have the theme of your choice display and manage a webcomic. -Version: 1.3.12 +Version: 1.3.13 Author: Philip M. Hofer (Frumph) Author URI: http://frumph.net/ @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA add_action('init', 'ceo_initialize_post_types'); +define('CEO_FEATURE_DISABLE_MOTION_ARTIST', true); + function ceo_initialize_post_types() { if (!post_type_exists('comic')) { $labels = array( @@ -311,7 +313,8 @@ function ceo_load_options($reset = false) { 'display_first_comic_on_home_page' => false, 'disable_style_sheet' => false, 'enable_transcripts_in_comic_posts' => false, - 'enable_chapter_only_random' => false + 'enable_chapter_only_random' => false, + 'enable_motion_artist_support' => false ) as $field => $value) { $ceo_config[$field] = $value; } @@ -352,7 +355,7 @@ function ceo_pluginfo($whichinfo = null) { // comic-easel plugin directory/url 'plugin_url' => plugin_dir_url(dirname (__FILE__)) . 'comic-easel', 'plugin_path' => trailingslashit(ABSPATH) . ceo_get_plugin_path(), - 'version' => '1.3.12-github' + 'version' => '1.3.13-github' ); // Combine em. $ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_addinfo); diff --git a/css/comiceasel.css b/css/comiceasel.css index dd1ae09..a68d5b5 100644 --- a/css/comiceasel.css +++ b/css/comiceasel.css @@ -223,4 +223,9 @@ a.transcript-title { .comicbutton { margin: 0 5px; display: inline-block; +} + +.MADoc { + margin: 0 auto !important; + padding: 0 !important; } \ No newline at end of file diff --git a/functions/admin-meta.php b/functions/admin-meta.php index a48c053..f264240 100644 --- a/functions/admin-meta.php +++ b/functions/admin-meta.php @@ -159,6 +159,66 @@ function ceo_manage_comic_columns($column_name, $id) { } // end switch } +function ceo_edit_select_motion_artist_directory_in_post($post) { + + $current_directory = get_post_meta( $post->ID, 'ma-directory', true ); + + if (empty($current_directory) || is_wp_error($current_directory)) $current_directory = ''; + + $dirs_to_search = array_unique(array(get_template_directory(),get_stylesheet_directory())); + + $ma_directories = array(); + $ma_dir = get_stylesheet_directory() . '/motion-artist'; + if (is_dir($ma_dir)) { + $thisdir = null; + $thisdir = array(); + $thisdir = glob($ma_dir. '/*'); + $ma_directories = array_merge($ma_directories, $thisdir); + } + if (empty($ma_directories) || is_wp_error($ma_directories)) echo "No 'motion-artist' directory found in theme."; +?> +
+ + + + + + No 'motion-artist' directory found in theme.
+ID, 'ma-height', true ); +$current_width = get_post_meta( $post->ID, 'ma-width', true ); +if (empty($current_height) || is_wp_error($current_height)) $current_height = ''; +if (empty($current_height) || is_wp_error($current_width)) $current_width = ''; +?> + + + + +
+ + +
+Height: + +Width: +
+
+
@@ -265,6 +325,8 @@ function ceo_add_comic_in_post() { add_meta_box('ceo_html_above_comic', __('HTML (Above) Comic', 'comiceasel'), 'ceo_edit_html_above_comic', 'comic', 'normal', 'high'); add_meta_box('ceo_html_below_comic', __('HTML (Below) Comic', 'comiceasel'), 'ceo_edit_html_below_comic', 'comic', 'normal', 'high'); } + if (!defined('CEO_FEATURE_DISABLE_MOTION_ARTIST') && ceo_pluginfo('enable_motion_artist_support')) + add_meta_box('ceo_select_motion_artist_directory_in_post', __('Select Motion Artist Comic', 'comiceasel'), 'ceo_edit_select_motion_artist_directory_in_post', 'comic', 'side', 'high'); } function ceo_handle_edit_save_comic($post_id, $post) { @@ -294,7 +356,10 @@ function ceo_handle_edit_save_comic($post_id, $post) { 'comic-gallery-columns', 'comic-open-lightbox', 'comic-gallery-full', - 'comic-gallery-jquery' + 'comic-gallery-jquery', + 'ma-directory', + 'ma-height', + 'ma-width' ); foreach ($meta_array as $meta_key) { @@ -307,4 +372,20 @@ function ceo_handle_edit_save_comic($post_id, $post) { elseif ( '' == $new_meta_value && $meta_value ) delete_post_meta( $post_id, $meta_key, $meta_value ); } + if (isset($_POST['ma-directory']) && !empty($_POST['ma-directory'])) { + $ma_directories = array(); + $ma_dir = esc_textarea( $_POST['ma-directory'] ); + $ma_dir = get_stylesheet_directory() . '/motion-artist/'.$ma_dir.'/scripts'; + if (is_dir($ma_dir)) { + $thisdir = null; + $thisdir = array(); + $thisdir = glob($ma_dir. '/*.js'); + $ma_script = str_replace('.js', '', basename(reset($thisdir))); + update_post_meta( $post_id, 'ma-id', $ma_script ); + } + } else { + delete_post_meta($post_id, 'ma-id'); + delete_post_meta($post_id, 'ma-height'); + delete_post_meta($post_id, 'ma-width'); + } } diff --git a/functions/displaycomic.php b/functions/displaycomic.php index e903014..ab33d19 100644 --- a/functions/displaycomic.php +++ b/functions/displaycomic.php @@ -1,98 +1,130 @@ ID, 'ma-directory', true ); + $motion_artist_id = get_post_meta( $post->ID, 'ma-id', true ); + if (!empty($motion_artist_comic)) { + echo ''."\r\n"; + echo ''."\r\n"; + echo ''; + } + } +} + function ceo_display_comic($size = 'full') { global $post; if ( post_password_required() ) { return __('This comic is password protected.','comiceasel'); } $output = ''; - $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 (ceo_the_above_html()) $output .= html_entity_decode(ceo_the_above_html())."\r\n"; - 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; + $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"; + echo '
'."\r\n"; + echo "
\r\n"; + } 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_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 (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); + } } } diff --git a/functions/injections.php b/functions/injections.php index 6b7f54d..12fbe2b 100644 --- a/functions/injections.php +++ b/functions/injections.php @@ -74,7 +74,7 @@ function ceo_display_comic_navigation() { $stay = ''; if (ceo_pluginfo('enable_chapter_only_random')) { $chapter = get_the_terms($post->ID, 'chapters'); - if (!empty($chapter)) $stay = '&stay='.reset($chapter)->term_id; + if (!empty($chapter) && !is_wp_error($chapter)) $stay = '&stay='.reset($chapter)->term_id; } ?> diff --git a/options/general.php b/options/general.php index e1867b2..446cf79 100644 --- a/options/general.php +++ b/options/general.php @@ -89,10 +89,32 @@ - +
+ + + + + + + + + + + + +
+ /> + + +
+
+ diff --git a/readme.txt b/readme.txt index 68d8add..93b380d 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: Frumph Tags: comiceasel, easel, webcomic, comic, webcomic Requires at least: 3.2 Tested up to: 3.5.1 -Stable tag: 1.3.12 +Stable tag: 1.3.13 Donate link: http://frumph.net License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -126,6 +126,12 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled == Changelog == += 1.4 COMING SOON = +* Added support for 'motion artist' comics. Read documentation at comiceasel.com + += 1.3.13 = +* Added the random comic in navigation to work like the default one if set to chapter only + = 1.3.12 = * make it so the chapter dropdown doesn't show empty chapters it just doesn't work * check for 404 pages for the thumbnail casthover and comblogpost widgets and do not execute if it's a 404 page, or even page diff --git a/widgets/navigation.php b/widgets/navigation.php index 83864ff..d176b70 100644 --- a/widgets/navigation.php +++ b/widgets/navigation.php @@ -94,8 +94,16 @@ class ceo_comic_navigation_widget extends WP_Widget { if ($instance['archives'] && !empty($instance['archive_path'])) { ?> - + if ($instance['random']) { + $stay = ''; + if (ceo_pluginfo('enable_random_nav')) { + + if (ceo_pluginfo('enable_chapter_only_random')) { + $chapter = get_the_terms($post->ID, 'chapters'); + if (!empty($chapter) && !is_wp_error($chapter)) $stay = '&stay='.reset($chapter)->term_id; + } + } ?> +