Changeset 1349153
- Timestamp:
- 02/12/2016 04:33:05 PM (10 years ago)
- Location:
- comic-easel/trunk
- Files:
-
- 1 added
- 7 edited
-
comiceasel.php (modified) (3 diffs)
-
functions/admin-meta.php (modified) (4 diffs)
-
functions/displaycomic.php (modified) (1 diff)
-
functions/injections.php (modified) (1 diff)
-
functions/library.php (modified) (1 diff)
-
js/content-warning.js (added)
-
readme.txt (modified) (2 diffs)
-
widgets/archive-dropdown.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
comic-easel/trunk/comiceasel.php
r1314912 r1349153 4 4 Plugin URI: http://comiceasel.com 5 5 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. 6 Version: 1.9. 96 Version: 1.9.10 7 7 Author: Philip M. Hofer (Frumph) 8 8 Author URI: http://frumph.net/ … … 309 309 310 310 function ceo_run_scripts() { 311 global $post; 312 if (!empty($post)) { 313 $comic_content_warning = get_post_meta( $post->ID, 'comic-content-warning', true ); 314 if ($comic_content_warning) { 315 wp_enqueue_script('ceo_comic_content_warning', ceo_pluginfo('plugin_url').'js/content-warning.js', null, null, true); 316 } 317 } 311 318 if (!ceo_pluginfo('disable_keynav')) { 312 wp_enqueue_script('c omicpress_keynav', ceo_pluginfo('plugin_url').'js/keynav.js', null, null, true);319 wp_enqueue_script('ceo_keynav', ceo_pluginfo('plugin_url').'js/keynav.js', null, null, true); 313 320 } 314 321 } … … 522 529 'plugin_url' => plugin_dir_url(__FILE__), 523 530 'plugin_path' => plugin_dir_path(__FILE__), 524 'version' => '1.9. 9'531 'version' => '1.9.10' 525 532 ); 526 533 // Combine em. -
comic-easel/trunk/functions/admin-meta.php
r1254711 r1349153 272 272 </td> 273 273 </tr> 274 <tr> 275 <th scope="row"><label for="comic-content-warning"><?php _e('Enable Content Warning?','comiceasel'); ?></label></th> 276 <td> 277 <input id="comic-content-warning" name="comic-content-warning" type="checkbox" value="1" <?php checked(1, get_post_meta( $post->ID, 'comic-content-warning', true )); ?> /> 278 </td> 279 </tr> 274 280 </table> 275 281 <em><?php _e('* usemap="#comicmap" will be added, add the map html to the below html box','comiceasel'); ?></em> … … 300 306 <br /> 301 307 <input id="link-to" name="link-to" type="input" style="width: 80%" value="<?php echo $linkto_url; ?>" /><br /> 308 <?php 309 } 310 311 function ceo_edit_refer_only_in_post($post) { 312 $refer_only = get_post_meta($post->ID, 'refer-only', true); 313 $refer_only_msg = get_post_meta($post->ID, 'refer-only-msg', true); 314 _e('Add url here of referring website to make it only visible when coming from that url.', 'comiceasel'); 315 ?> 316 <br /> 317 <input id="refer-only" name="refer-only" type="input" style="width: 80%" value="<?php echo $refer_only; ?>" /><br /> 318 <br /> 319 <?php _e("Message to display to users who don't visit from the referring site.",'comiceasel'); ?><br /> 320 <input id="refer-only-msg" name="refer-only-msg" type="input" style="width: 80%" value="<?php echo $refer_only_msg; ?>" /><br /> 302 321 <?php 303 322 } … … 421 440 if (!defined('CEO_FEATURE_LINKTO')) 422 441 add_meta_box('ceo_linkto_in_post', __('Links To', 'comiceasel'), 'ceo_edit_linkto_in_post', 'comic', 'normal', 'default'); 442 if (!defined('CEO_DISABLE_REFER_ONLY')) 443 add_meta_box('ceo_refer_only_in_post', __('Only show this comic if it comes from referring URL?', 'comiceasel'), 'ceo_edit_refer_only_in_post', 'comic', 'normal', 'default'); 423 444 if (!defined('CEO_FEATURE_DISABLE_MISC')) 424 445 add_meta_box('ceo_toggle_in_post', __('Misc. Comic Functionality', 'comiceasel'), 'ceo_edit_toggles_in_post', 'comic', 'side', 'low'); … … 507 528 'media_width', 508 529 'link-to', 530 'refer-only', 509 531 'comic-has-map', 510 'location-overwrite' 532 'location-overwrite', 533 'comic-content-warning' 511 534 ); 512 535 -
comic-easel/trunk/functions/displaycomic.php
r1254711 r1349153 156 156 return __('This comic is password protected.','comiceasel'); 157 157 } 158 $refer_only = get_post_meta( $post->ID, 'refer-only', 'true'); 159 160 if (!empty($refer_only) && !defined('CEO_DISABLE_REFER_ONLY')) { 161 $ref_only_msg = ''; 162 $refer_only_msg = get_post_meta( $post->ID, 'refer-only-msg', 'true') ? get_post_meta( $post->ID, 'refer-only-msg', 'true') : __('Read post message below to find out how to view this.', 'comic-easel'); 163 if (ceo_get_referer() !== $refer_only) { 164 return apply_filters('ceo_refer_only_msg', $refer_only_msg); 165 } 166 } 158 167 $output = ''; 159 168 if (ceo_the_above_html()) $output .= html_entity_decode(ceo_the_above_html())."\r\n"; -
comic-easel/trunk/functions/injections.php
r1254820 r1349153 28 28 function ceo_version_meta() { 29 29 echo apply_filters('ceo_version_meta', '<meta name="Comic-Easel" content="'.ceo_pluginfo('version').'" />'."\r\n"); 30 echo apply_filters('ceo_version_meta_referrer', '<meta name="Referrer" content="'.ceo_get_referer().'" />'."\r\n"); 30 31 } 31 32 -
comic-easel/trunk/functions/library.php
r914436 r1349153 116 116 117 117 add_filter('get_terms_orderby', 'ceo_apply_orderby_filter', 10, 2); 118 119 120 function ceo_get_referer() { 121 $ref = ''; 122 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) 123 $ref = $_REQUEST['_wp_http_referer']; 124 else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 125 $ref = $_SERVER['HTTP_REFERER']; 126 127 return $ref; 128 } 129 130 function ceo_content_warning() { 131 return apply_filters('ceo-content-warning', __('Warning, Mature Content.')); 132 } 133 134 add_action('wp_head', 'ceo_content_warning_in_head'); 135 136 function ceo_content_warning_in_head() { 137 ?> 138 <script> 139 var contentwarningtext = "<?php echo ceo_content_warning(); ?>"; 140 </script> 141 <?php 142 } -
comic-easel/trunk/readme.txt
r1314912 r1349153 4 4 Tags: comiceasel, easel, webcomic, comic, webcomic 5 5 Requires at least: 4.3 6 Tested up to: 4.4 7 Stable tag: 1.9. 96 Tested up to: 4.4.2 7 Stable tag: 1.9.10 8 8 Donate link: http://frumph.net 9 9 License: GPLv3 or later … … 129 129 130 130 == Changelog == 131 = 1.9.10 = 132 * Added Content Warning toggle which blur's individual comics in the comic editor (user can click to unblur) courtesy Ryan G. 133 * Added URL referrer ability to comics that makes it so that you can choose for comics only to be visible if they clicked a link from some place else 134 * @egypturnash - added option to render chapter dropdown as list of links 135 * @eypturnash - added highlighting of current chapter to list 131 136 132 137 = 1.9.9 = -
comic-easel/trunk/widgets/archive-dropdown.php
r1237568 r1349153 8 8 */ 9 9 10 class ceo_walker_taxonomy_dropdown extends Walker_CategoryDropdown { 11 12 function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 13 $pad = str_repeat(' ', $depth * 3); 14 $cat_name = apply_filters('list_cats', $category->name, $category); 15 16 if( !isset($args['value'])) { 17 $args['value'] = ( $category->taxonomy != 'category' ? 'slug' : 'id' ); 18 } 19 20 $value = ($args['value']=='slug' ? $category->slug : $category->term_id ); 21 22 $permalink = ''; 23 if (!isset($args['jumptoarchive'])) $args['jumptoarchive'] = false; 24 if (!$args['jumptoarchive']) { 25 $post_args = array( 26 'numberposts' => 1, 27 'post_type' => 'comic', 28 'order' => 'ASC', 29 'post_status' => 'publish', 30 'chapters' => $value, 31 ); 32 $qposts = get_posts( $post_args ); 33 if (is_array($qposts) && !is_wp_error($qposts) && !empty($qposts)) { 34 $qposts = reset($qposts); 35 $permalink = get_permalink($qposts->ID); 36 } 37 } else $permalink = get_term_link( $value, $category->taxonomy ); 38 10 function ceo_taxonomy_walker_dropdown_or_list_start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 11 12 // echo "<pre>args ";print_r($args); echo "</pre>"; 13 14 $pad = str_repeat(' ', $depth * 3); 15 $cat_name = apply_filters('list_cats', $category->name, $category); 16 17 if( !isset($args['value'])) { 18 $args['value'] = ( $category->taxonomy != 'category' ? 'slug' : 'id' ); 19 } 20 21 $value = ($args['value']=='slug' ? $category->slug : $category->term_id ); 22 23 $permalink = ''; 24 if (!isset($args['jumptoarchive'])) $args['jumptoarchive'] = false; 25 if (!$args['jumptoarchive']) { 26 $post_args = array( 27 'numberposts' => 1, 28 'post_type' => 'comic', 29 'order' => 'ASC', 30 'post_status' => 'publish', 31 'chapters' => $value, 32 ); 33 $qposts = get_posts( $post_args ); 34 if (is_array($qposts) && !is_wp_error($qposts) && !empty($qposts)) { 35 $qposts = reset($qposts); 36 $permalink = get_permalink($qposts->ID); 37 } 38 } else $permalink = get_term_link( $value, $category->taxonomy ); 39 40 $css_classes = array( 41 'cat-item', 42 'cat-item-' . $category->term_id, 43 ); 44 45 // echo "<pre>current cat ";print_r($args['current_category']); echo "</pre>"; 46 47 if ( ! empty( $args['current_category'] ) ) { 48 $_current_terms = $args['current_category']; 49 50 foreach ( $_current_terms as $_current_term ) { 51 if ( $category->term_id == $_current_term->term_id ) { 52 $css_classes[] = 'current-cat'; 53 } elseif ( $category->term_id == $_current_term->parent ) { 54 $css_classes[] = 'current-cat-parent'; 55 } 56 } 57 } 58 $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) ); 59 60 if ($args['render_as_list']) { 61 62 $output .= "\t<li class=\"level-$depth $css_classes\"><a href=\"".$permalink."\">"; 63 } else { 39 64 $output .= "\t<option class=\"level-$depth\" value=\"".$permalink."\""; 40 65 if ( $value === (string) $args['selected'] ) { 41 66 $output .= ' selected="selected"'; 42 67 } 43 $output .= '>'; 44 $output .= $pad.$cat_name; 45 if ( $args['show_count'] ) 46 $output .= ' ('. $category->count .')'; 47 $output .= "</option>\n"; 48 } 49 } 50 51 function ceo_comic_archive_jump_to_chapter($hide = true, $exclude = '', $showcount = false, $jumptoarchive = false, $echo = true) { 68 $output .= '>'; 69 } 70 $output .= $pad.$cat_name; 71 if ( $args['show_count'] ) 72 $output .= ' ('. $category->count .')'; 73 $output .= ($args['render_as_list']) ? "</a>" : "</option>\n"; 74 } 75 76 class ceo_walker_taxonomy_list extends Walker_Category { 77 78 function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 79 $args['render_as_list'] = true; 80 ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth = 0, $args, $id); 81 } 82 } 83 class ceo_walker_taxonomy_dropdown extends Walker_CategoryDropdown { 84 85 function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 86 $args['render_as_list'] = false; 87 ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth = 0, $args, $id); 88 } 89 } 90 91 function ceo_comic_archive_jump_to_chapter($hide = true, $exclude = '', $showcount = false, $jumptoarchive = false, $echo = true, $render_as_list = false) { 52 92 ceo_protect(); 53 $args = array( 54 'walker' => new ceo_walker_taxonomy_dropdown(), 55 'show_option_all' => __('Select','comiceasel').' '.ucwords(ceo_pluginfo('chapter_type_slug_name')), 56 'option_none_value' => '-1', 57 'orderby' => 'menu_order', 58 'order' => 'ASC', 59 'name' => ceo_pluginfo('chapter_type_slug_name'), 60 'show_count' => $showcount, 61 'hide_empty' => $hide, 62 'exclude' => $exclude, 63 'echo' => false, 64 'hierarchical' => 1, 65 'taxonomy' => 'chapters', 66 'hide_if_empty' => $hide, 67 'value_field' => 'slug', 68 'jumptoarchive' => $jumptoarchive, 69 ); 93 70 94 $output = ''; 71 $output .= '<form id="chapter-select" class="chapter-select" method="get">'."\r\n"; 72 $select = wp_dropdown_categories( $args ); 73 $replace = '<select$1 onchange="document.location.href=this.options[this.selectedIndex].value;">'; 74 $output .= preg_replace( '#<select([^>]*)>#', $replace, $select ); 75 $output .= "\t<noscript>\r\n"; 76 $output .= "\t\t<input type=\"submit\" value=\"View\" />\r\n"; 77 $output .= "\t</noscript>\r\n"; 78 $output .= "</form>\r\n"; 95 if ($render_as_list) { 96 global $post; 97 $the_terms = get_the_terms( $post->ID, 'chapters'); 98 // echo "<pre>the terms ";print_r($the_terms); echo "</pre>"; 99 $args = array( 100 'walker' => new ceo_walker_taxonomy_list(), 101 'orderby' => 'menu_order', 102 'order' => 'ASC', 103 'show_count' => $showcount, 104 'hide_empty' => $hide, 105 'exclude' => $exclude, 106 'echo' => false, 107 'hierarchical' => 1, 108 'taxonomy' => 'chapters', 109 'current_category' => $the_terms, 110 'title_li' => null, 111 'jumptoarchive' => $jumptoarchive, 112 'render_as_list' => $render_as_list, 113 ); 114 115 $output .= '<ul class="chapter-select">'; 116 $output .= wp_list_categories( $args ); 117 $output .= '</ul>'; 118 } else { 119 $args = array( 120 'walker' => new ceo_walker_taxonomy_dropdown(), 121 'show_option_all' => __('Select','comiceasel').' '.ucwords(ceo_pluginfo('chapter_type_slug_name')), 122 'option_none_value' => '-1', 123 'orderby' => 'menu_order', 124 'order' => 'ASC', 125 'name' => ceo_pluginfo('chapter_type_slug_name'), 126 'show_count' => $showcount, 127 'hide_empty' => $hide, 128 'exclude' => $exclude, 129 'echo' => false, 130 'hierarchical' => 1, 131 'taxonomy' => 'chapters', 132 'hide_if_empty' => $hide, 133 'value_field' => 'slug', 134 'jumptoarchive' => $jumptoarchive, 135 'render_as_list' => $render_as_list, 136 ); 137 $output .= '<form id="chapter-select" class="chapter-select" method="get">'."\r\n"; 138 $select = wp_dropdown_categories( $args ); 139 $replace = '<select$1 onchange="document.location.href=this.options[this.selectedIndex].value;">'; 140 $output .= preg_replace( '#<select([^>]*)>#', $replace, $select ); 141 $output .= "\t<noscript>\r\n"; 142 $output .= "\t\t<input type=\"submit\" value=\"View\" />\r\n"; 143 $output .= "\t</noscript>\r\n"; 144 $output .= "</form>\r\n"; 145 } 79 146 ceo_unprotect(); 80 147 if ($echo) { … … 82 149 } else return $output; 83 150 } 84 85 /*86 function ceo_comic_archive_jump_to_chapter($unhide = false, $exclude = '', $showcount = false, $jumptoarchive = true, $return = false) {87 ceo_protect();88 89 $args = array(90 'pad_counts' => 1,91 'orderby' => 'menu_order',92 'order' => 'ASC',93 'hide_empty' => $unhide,94 'exclude' => $exclude,95 'parent' => 096 );97 $parent_chapters = get_terms( 'chapters', $args );98 $output = '<form method="get" class="comic-archive-dropdown-form">';99 $output .= '<select onchange="document.location.href=this.options[this.selectedIndex].value;">';100 $level = 0;101 $output .= '<option class="level-select" value="">'.__('Select','comiceasel').' '.ucwords(ceo_pluginfo('chapter_type_slug_name')).'</option>';102 if (!is_null($parent_chapters)) {103 foreach($parent_chapters as $parent_chapter) {104 $thecount = ($showcount) ? ' ('.$parent_chapter->count.')' : '';105 if ($parent_chapter->count) {106 $permalink = '';107 if (!$jumptoarchive) {108 $parent_args = array(109 'numberposts' => 1,110 'post_type' => 'comic',111 'order' => 'ASC',112 'post_status' => 'publish',113 'chapters' => $parent_chapter->slug,114 );115 $qposts = get_posts( $parent_args );116 if (is_array($qposts) && !is_wp_error($qposts) && !empty($qposts)) {117 $qposts = reset($qposts);118 $permalink = get_permalink($qposts->ID);119 }120 } else $permalink = get_term_link($parent_chapter->slug, 'chapters');121 if (!empty($permalink)) $output .='<option class="level-0" value="'.esc_url($permalink).'">'.$parent_chapter->name.$thecount.'</option>';122 } elseif (!$unhide) {123 $output .='<option class="level-0" value="" disabled>'.$parent_chapter->name.'</option>';124 }125 126 $child_chapters = get_term_children($parent_chapter->term_id, 'chapters');127 $args = array(128 'pad_counts' => 1,129 'orderby' => 'menu_order',130 'order' => 'ASC',131 'hide_empty' => $unhide,132 'child_of' => $parent_chapter->term_id,133 'exclude' => array($exclude)134 );135 $child_chapters = get_terms( 'chapters', $args );136 foreach ($child_chapters as $child) {137 $child_term = get_term_by( 'id', $child->term_id, 'chapters' );138 $thecount = 0;139 $thecount = ($showcount) ? '('.$child_term->count.')' : '';140 if ($child_term->count) {141 $child_args = array(142 'numberposts' => 1,143 'post_type' => 'comic',144 'order' => 'ASC',145 'post_status' => 'publish',146 'chapters' => $child_term->slug147 );148 if (!$jumptoarchive) {149 $qcposts = get_posts( $child_args );150 if (is_array($qcposts)) {151 $qcposts = reset($qcposts);152 $permalink = get_permalink($qcposts->ID);153 }154 } else $permalink = get_term_link($child_term->slug, 'chapters');155 if (!empty($permalink)) $output .= '<option class="level-1" value="'.esc_url($permalink).'"> '.$child_term->name.' '.$thecount.'</option>';156 }157 }158 }159 }160 $output .= '</select>';161 $output .= '<noscript>';162 $output .= '<div><input type="submit" value="View" /></div>';163 $output .= '</noscript>';164 $output .= '</form>';165 if ($return) {166 return $output;167 } else echo $output;168 ceo_unprotect();169 }170 */171 151 172 152 class ceo_comic_archive_dropdown_widget extends WP_Widget { … … 189 169 $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); 190 170 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; 191 if (!isset($instance['hide'])) $instance['hide'] = 1; 192 ceo_comic_archive_jump_to_chapter($instance['hide'], $instance['exclude'], $instance['showcount'], $instance['jumptoarchive'] );171 if (!isset($instance['hide'])) $instance['hide'] = 1; 172 ceo_comic_archive_jump_to_chapter($instance['hide'], $instance['exclude'], $instance['showcount'], $instance['jumptoarchive'], true, $instance['render_as_list']); 193 173 echo $after_widget; 194 174 } … … 201 181 $instance['showcount'] = ($new_instance['showcount']) ? 1:0; 202 182 $instance['jumptoarchive'] = ($new_instance['jumptoarchive']) ? 1:0; 183 $instance['render_as_list'] = ($new_instance['render_as_list']) ? 1:0; 203 184 return $instance; 204 185 } 205 186 206 187 function form($instance) { 207 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'exclude' => '', 'hide' => 1, 'showcount' => 1, 'jumptoarchive' => 0 ) );188 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'exclude' => '', 'hide' => 1, 'showcount' => 1, 'jumptoarchive' => 0, 'render_as_list' => 0) ); 208 189 $title = $instance['title']; 209 190 $exclude = $instance['exclude']; … … 211 192 $showcount = ($instance['showcount']) ? 1:0; 212 193 $jumptoarchive = ($instance['jumptoarchive']) ? 1:0; 194 $render_as_list = ($instance['render_as_list']) ? 1:0; 213 195 ?> 214 196 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comiceasel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> … … 217 199 <p><label for="<?php echo $this->get_field_id('showcount'); ?>"><?php _e('Show the comic count in parenthesis?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('showcount'); ?>" name="<?php echo $this->get_field_name('showcount'); ?>" type="checkbox" value="1" <?php checked(1, $showcount); ?> /></label></p> 218 200 <p><label for="<?php echo $this->get_field_id('jumptoarchive'); ?>"><?php _e('Jump to archive and not first page?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('jumptoarchive'); ?>" name="<?php echo $this->get_field_name('jumptoarchive'); ?>" type="checkbox" value="1" <?php checked(1, $jumptoarchive); ?> /></label></p> 201 <p><label for="<?php echo $this->get_field_id('render_as_list'); ?>"><?php _e('Show as a list instead of a dropdown?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('render_as_list'); ?>" name="<?php echo $this->get_field_name('render_as_list'); ?>" type="checkbox" value="1" <?php checked(1, $render_as_list); ?> /></label></p> 219 202 <?php 220 203 }
Note: See TracChangeset
for help on using the changeset viewer.