2009-08-21 19:29:45 +00:00
< ? php
/*
Widget Name : Graphical Navigation
Widget URI : http :// comicpress . org /
2009-10-23 01:53:57 +00:00
Description : This widget places graphical navigation buttons on your comic . For ComicPress 2.8
Author : Philip M . Hofer ( Frumph ) & amp ; John Bintz
Version : 1.2
2009-11-14 15:12:36 +00:00
Author URI : http :// frumph . net /
2009-10-23 01:37:40 +00:00
*/
2009-10-22 00:11:22 +00:00
2009-10-23 01:53:57 +00:00
require_once ( dirname ( __FILE__ ) . '/../classes/ComicPressNavigation.inc' );
2009-11-26 15:19:40 +00:00
class GraphicalNavigationWidget extends WP_Widget {
2009-12-20 21:00:17 +00:00
function GraphicalNavigationWidget ( $skip_widget_init = false ) {
if ( ! $skip_widget_init ) {
$widget_ops = array ( 'classname' => __CLASS__ , 'description' => __ ( 'Displays Graphical Navigation Buttons. (used in comic sidebars)' , 'comicpress' ) );
2009-12-21 13:25:36 +00:00
$this -> WP_Widget ( __CLASS__ , __ ( 'ComicPress Comic Navigation' , 'comicpress' ), $widget_ops );
2009-12-20 21:00:17 +00:00
}
2009-08-21 19:29:45 +00:00
}
2009-10-23 01:53:57 +00:00
/**
* Initialize the widget class .
*/
function init () {
2009-12-20 21:00:17 +00:00
add_filter ( 'comicpress_display_navigation_order' , array ( $this , 'comicpress_display_navigation_order' ));
2009-10-23 01:53:57 +00:00
add_filter ( 'comicpress_display_navigation_link' , array ( & $this , 'comicpress_display_navigation_link' ), 10 , 5 );
add_filter ( 'comicpress_wrap_navigation_buttons' , array ( & $this , 'comicpress_wrap_navigation_buttons' ), 10 , 2 );
2009-11-04 12:17:45 +00:00
add_filter ( 'comicpress_navigation_grouping_details' , array ( & $this , 'comicpress_navigation_grouping_details' ));
2009-10-23 01:53:57 +00:00
2009-11-26 15:38:25 +00:00
add_filter ( 'comicpress_set_up_post_nav' , array ( & $this , 'comicpress_set_up_post_nav' ), 10 , 2 );
2009-10-23 01:53:57 +00:00
// these two need to be moved one level up
add_filter ( 'comicpress_get_random_link_url' , array ( & $this , 'comicpress_get_random_link_url' ));
add_filter ( 'comicpress_get_buy_print_url' , array ( & $this , 'comicpress_get_buy_print_url' ));
}
/**
* Get the random link URL .
*/
function comicpress_get_random_link_url ( $url = '' ) {
return get_bloginfo ( 'url' ) . '/?randomcomic' ;
}
/**
* Get the URL to buy a print .
* Handles hitting the global namespace for you .
*/
function comicpress_get_buy_print_url ( $url = '' ) {
2009-12-06 19:56:08 +00:00
$comicpress_options = comicpress_load_options ();
return $comicpress_options [ 'buy_print_url' ];
2009-10-23 01:53:57 +00:00
}
/**
* Render a button .
*/
function comicpress_display_navigation_link ( $which , $current , $target , $instance , $content = '' ) {
global $id ;
$css_name_mapping = array (
'story_prev' => 'prevchap' ,
'previous' => 'prev' ,
'story_next' => 'nextchap'
);
2009-11-10 00:58:27 +00:00
2009-10-23 01:53:57 +00:00
$ok = true ;
switch ( $which ) {
case 'first' :
case 'last' :
$ok = $this -> _will_display_nav_link ( $which , $current , $target );
break ;
case 'previous' :
case 'next' :
case 'story_prev' :
case 'story_next' :
2009-10-29 11:32:11 +00:00
case 'story_prev_in' :
case 'story_next_in' :
2009-10-23 01:53:57 +00:00
$ok = ! empty ( $target );
break ;
case 'archives' :
$ok = ! empty ( $instance [ 'archive_path' ]);
break ;
}
ob_start ();
switch ( $which ) {
case 'first' :
case 'previous' :
2009-11-04 11:09:56 +00:00
case 'next' :
case 'last' :
2009-10-23 01:53:57 +00:00
case 'story_prev' :
case 'story_next' :
2009-10-29 11:32:11 +00:00
case 'story_prev_in' :
case 'story_next_in' :
2009-11-23 04:25:36 +00:00
$obj_ok = false ;
2009-11-10 02:26:34 +00:00
$navi_class_names = array ( " navi- ${ which } " );
2009-11-26 16:48:08 +00:00
$link = false ;
2009-11-10 02:26:34 +00:00
if ( is_object ( $target )) {
2009-11-23 04:25:36 +00:00
$obj_ok = true ;
2009-11-10 02:26:34 +00:00
if ( isset ( $css_name_mapping [ $which ])) { $navi_class_names [] = " navi- { $css_name_mapping [ $which ] } " ; }
2009-11-10 00:58:27 +00:00
2009-11-10 02:26:34 +00:00
$link = get_permalink ( $target -> ID );
if (( $which == 'last' ) && ( $instance [ 'lastgohome' ] == 'on' )) { $link = get_bloginfo ( 'url' ); }
}
2009-11-26 16:48:08 +00:00
if (( $filter_link = array_shift ( apply_filters ( 'comicpress_display_navigation_link' , $link , $which , $current , $target , $instance ))) !== false ) {
$link = $filter_link ;
$obj_ok = true ;
}
2009-11-23 04:25:36 +00:00
if ( $ok && $obj_ok ) {
2009-10-23 01:53:57 +00:00
?> <a href="<?php echo $link; ?>"
class = " navi <?php echo implode( " " , $navi_class_names ); ?> "
2009-11-04 11:09:56 +00:00
title = " <?php echo $instance["${which}_title"] ; ?> " >< ? php echo htmlspecialchars_decode ( $instance [ " ${ which } _title " ]); ?> </a><?php
2009-10-23 01:53:57 +00:00
} else {
2009-11-10 13:44:30 +00:00
?> <span class="navi <?php echo implode(" ", $navi_class_names); ?> navi-void"><?php echo htmlspecialchars_decode($instance["${which}_title"]); ?></span><?php
2009-10-23 01:53:57 +00:00
}
break ;
case 'archives' :
?> <a href="<?php echo $instance['archive_path']; ?>"
class = " navi navi-archives navi-archive "
title = " <?php echo $instance['archives_title'] ; ?> " >< ? php echo $instance [ 'archives_title' ]; ?> </a><?php
break ;
case 'random' :
?> <a href="<?php echo apply_filters('comicpress_get_random_link_url', '') ?>"
class = " navi navi-random "
title = " <?php echo $instance['random_title'] ; ?> " >< ? php echo $instance [ 'random_title' ]; ?> </a><?php
break ;
case 'comictitle' :
2009-11-10 13:44:30 +00:00
?> <span class="navi-comictitle"><a href="<?php echo get_permalink($current) ?>"><?php echo get_the_title($current->ID); ?></a></span><?php
2009-10-23 01:53:57 +00:00
break ;
case 'comments' :
$temp_id = $id ;
$id = $current -> ID ;
2009-12-21 22:40:16 +00:00
?> <a href="<?php echo get_permalink($current); ?>#respond"
2009-10-23 01:53:57 +00:00
class = " navi navi-comments "
title = " <?php echo $instance['comments_title'] ; ?> " >< span class = " navi-comments-count " >< ? php comments_number ( '0' , '1' , '%' ); ?> </span><?php echo $instance['comments_title']; ?></a><?php
$id = $temp_id ;
break ;
case 'buyprint' :
?> <form method="post"
title = " <?php echo $instance['buyprint_title'] ; ?> "
2009-12-06 19:56:08 +00:00
action = " <?php echo apply_filters('comicpress_get_buy_print_url', ''); ?> "
2009-10-23 01:53:57 +00:00
class = " navi-buyprint-form " >
< input type = " hidden " name = " comic " value = " <?php echo $current->ID ; ?> " />
< button class = " navi navi-buyprint "
type = " submit "
value = " submit " >< ? php echo $instance [ 'buyprint_title' ]; ?> </button>
</ form >< ? php
break ;
}
return array ( $which , $current , $target , $instance , ob_get_clean ());
}
/**
* Returns true if the combination of target and current post will show or hide this nav link .
* Different from whether or not a user explicitly hid this link .
* @ param string $which The link to test .
* @ param object $current The currently visible post .
* @ param object $target The target post to comare to .
* @ return boolean True if this link should be visible .
*/
function _will_display_nav_link ( $which , $current , $target ) {
2009-11-26 16:48:08 +00:00
$return = true ;
2009-10-23 01:53:57 +00:00
switch ( $which ) {
case 'first' :
case 'last' :
2009-11-26 16:48:08 +00:00
$return = ( $target -> ID != $current -> ID );
break ;
2009-10-23 01:53:57 +00:00
default :
2009-11-26 16:48:08 +00:00
$return = true ;
break ;
2009-10-23 01:53:57 +00:00
}
2009-11-26 16:48:08 +00:00
return apply_filters ( 'comicpress_graphical_navigation_will_display_nav_link' , $return , $which , $current , $target );
2009-10-23 01:53:57 +00:00
}
/**
* Get the order of the buttons to be displayed on - screen .
*/
function comicpress_display_navigation_order ( $order = array ()) {
return array (
Adjusted navigation order back to original design. In order of how far you are navigating, and buttons size reduction. Perhaps we can get an option in this widget for ordering the buttons. Could be useful for switching up the order of non-navigation buttons in this widget as well.
Also I think we need to consider the user of Next and Previous in Chapter, we are treating and styling it like its similar to the chapter navigation button, but what it really is is a replacement for the Next and Previous buttons. As far as real world use of it, it acts exactly like the next and previous buttons for the chapter you are in, the only time it varies from the next previous is that it is disabled at the first and last comic of that chapter, therefor you would probably use it with chapter buttons, rather than with repetitive prev next buttons. The difference is if you have multiple series and then you would give them the option of next in series or next comic, again, both being next, and should probably duplicate the Next and Previous Graphic buttons or similar for the button images.
2009-11-30 00:39:05 +00:00
'first' , 'story_prev' , 'story_prev_in' , 'previous' , 'archives' , 'random' , 'comictitle' , 'comments' , 'buyprint' , 'next' , 'story_next_in' , 'story_next' , 'last'
2009-10-23 01:53:57 +00:00
);
}
2009-11-04 12:17:45 +00:00
function comicpress_navigation_grouping_details ( $details = array ()) {
return array (
Adjusted navigation order back to original design. In order of how far you are navigating, and buttons size reduction. Perhaps we can get an option in this widget for ordering the buttons. Could be useful for switching up the order of non-navigation buttons in this widget as well.
Also I think we need to consider the user of Next and Previous in Chapter, we are treating and styling it like its similar to the chapter navigation button, but what it really is is a replacement for the Next and Previous buttons. As far as real world use of it, it acts exactly like the next and previous buttons for the chapter you are in, the only time it varies from the next previous is that it is disabled at the first and last comic of that chapter, therefor you would probably use it with chapter buttons, rather than with repetitive prev next buttons. The difference is if you have multiple series and then you would give them the option of next in series or next comic, again, both being next, and should probably duplicate the Next and Previous Graphic buttons or similar for the button images.
2009-11-30 00:39:05 +00:00
'comic_navi_left' => array ( 'first' , 'story_prev' , 'story_prev_in' , 'previous' ),
2009-11-04 12:17:45 +00:00
'comic_navi_center' => true ,
Adjusted navigation order back to original design. In order of how far you are navigating, and buttons size reduction. Perhaps we can get an option in this widget for ordering the buttons. Could be useful for switching up the order of non-navigation buttons in this widget as well.
Also I think we need to consider the user of Next and Previous in Chapter, we are treating and styling it like its similar to the chapter navigation button, but what it really is is a replacement for the Next and Previous buttons. As far as real world use of it, it acts exactly like the next and previous buttons for the chapter you are in, the only time it varies from the next previous is that it is disabled at the first and last comic of that chapter, therefor you would probably use it with chapter buttons, rather than with repetitive prev next buttons. The difference is if you have multiple series and then you would give them the option of next in series or next comic, again, both being next, and should probably duplicate the Next and Previous Graphic buttons or similar for the button images.
2009-11-30 00:39:05 +00:00
'comic_navi_right' => array ( 'next' , 'story_next_in' , 'story_next' , 'last' )
2009-11-04 12:17:45 +00:00
);
}
function _group_navigation_buttons ( $buttons = array (), $grouped_buttons = array ()) {
$grouping_hash = array ();
$default_group = null ;
foreach ( apply_filters ( 'comicpress_navigation_grouping_details' , array ()) as $group => $members ) {
if ( $members === true ) {
$default_group = $group ;
} else {
2009-11-20 05:02:23 +00:00
if ( is_array ( $members )) {
foreach ( $members as $member ) { $grouping_hash [ $member ] = $group ; }
}
2009-11-04 12:17:45 +00:00
}
}
if ( is_null ( $default_group )) {
trigger_error ( 'No default group defined for filter comicpress_navigation_grouping_details' , E_USER_WARNING );
}
$groups = array ();
foreach ( $buttons as $key => $button ) {
$group = isset ( $grouping_hash [ $key ]) ? $grouping_hash [ $key ] : $default_group ;
if ( ! empty ( $group )) {
if ( ! isset ( $groups [ $group ])) { $groups [ $group ] = array (); }
$groups [ $group ][ $key ] = $button ;
}
}
return $groups ;
}
2009-10-23 01:53:57 +00:00
/**
* Wrap navigation buttons in a holder .
* @ param string | array $buttons The buttons to wrap .
* @ param string $content The wrapped content .
*/
function comicpress_wrap_navigation_buttons ( $buttons = '' , $content = '' ) {
$buttons_text = $buttons ;
2009-11-04 12:17:45 +00:00
if ( is_array ( $buttons )) {
$output = array ();
foreach ( $this -> _group_navigation_buttons ( $buttons ) as $group => $grouped_buttons ) {
2009-11-10 13:44:30 +00:00
$output [] = '<span class="' . $group . '">' . implode ( '' , array_values ( $grouped_buttons )) . '</span>' ;
2009-11-04 12:17:45 +00:00
}
$buttons_text = implode ( '' , $output );
}
2009-10-23 01:53:57 +00:00
ob_start (); ?>
< div id = " comic_navi_wrapper " >
2009-11-06 02:56:36 +00:00
< div class = " comic_navi " >
< ? php echo $buttons_text ; ?>
< div class = " clear " ></ div >
</ div >
2009-10-23 01:53:57 +00:00
</ div >
< ? php
return array ( $buttons , $content );
}
/**
* Render the widget .
*/
2009-08-21 19:29:45 +00:00
function widget ( $args , $instance ) {
2009-11-25 17:57:09 +00:00
global $post ;
2009-10-11 11:48:57 +00:00
if ( is_home () || is_single ()) {
2009-11-24 02:50:18 +00:00
$post_nav = $this -> set_up_post_nav ( $instance );
2009-10-31 19:46:01 +00:00
2009-10-23 01:53:57 +00:00
$storyline_to_nav_mapping = array (
'story_prev' => 'storyline-chapter-previous' ,
2009-10-29 11:32:11 +00:00
'story_next' => 'storyline-chapter-next' ,
'story_prev_in' => 'storyline-previous' ,
'story_next_in' => 'storyline-next'
2009-10-23 01:53:57 +00:00
);
$nav_links = array ();
foreach ( apply_filters ( 'comicpress_display_navigation_order' , array ()) as $order ) {
if ( $instance [ $order ] == " on " ) {
$target_post_nav = ( isset ( $storyline_to_nav_mapping [ $order ])) ? $storyline_to_nav_mapping [ $order ] : $order ;
$target_post = null ;
if ( isset ( $post_nav [ $target_post_nav ])) { $target_post = $post_nav [ $target_post_nav ]; }
2009-11-04 12:17:45 +00:00
$nav_links [ $order ] = end ( apply_filters ( 'comicpress_display_navigation_link' , $order , $post , $target_post , $instance , '' ));
2009-10-23 01:53:57 +00:00
}
2009-10-23 01:37:40 +00:00
}
2009-10-23 01:53:57 +00:00
echo end ( apply_filters ( 'comicpress_wrap_navigation_buttons' , $nav_links , '' ));
}
2009-10-11 11:48:57 +00:00
}
2009-10-23 01:53:57 +00:00
2009-11-24 02:50:18 +00:00
function _new_comicpress_storyline () { return new ComicPressStoryline (); }
function _new_comicpress_navigation () { return new ComicPressNavigation (); }
function set_up_post_nav ( $instance ) {
global $post ;
$storyline = $this -> _new_comicpress_storyline ();
$storyline -> set_order_via_flattened_storyline ( get_option ( 'comicpress-storyline-category-order' ));
$navigation = $this -> _new_comicpress_navigation ();
$navigation -> init ( $storyline );
$post_nav = $navigation -> get_post_nav ( $post );
2009-11-26 15:38:25 +00:00
$result = apply_filters ( 'comicpress_set_up_post_nav' , $post_nav , $instance );
if ( is_array ( $result )) {
return array_shift ( $result );
} else {
return $post_nav ;
}
}
function comicpress_set_up_post_nav ( $post_nav , $instance ) {
2009-11-24 02:50:18 +00:00
if ( $instance [ 'story_prev_acts_as_prev_in' ] == 'on' ) {
if ( $post_nav [ 'storyline-previous' ] !== false ) {
$post_nav [ 'storyline-chapter-previous' ] = $post_nav [ 'storyline-previous' ];
}
}
2009-11-26 15:38:25 +00:00
return array ( $post_nav , $instance );
2009-11-24 02:50:18 +00:00
}
2009-10-23 01:53:57 +00:00
/**
* Update the current widget instance .
* @ param array $new_instance The new widget instance data .
* @ param array $old_instance The old widget instance data .
*/
2009-08-21 19:29:45 +00:00
function update ( $new_instance , $old_instance ) {
2009-10-23 01:53:57 +00:00
$instance = array ();
2009-10-31 19:46:01 +00:00
$all_fields = array (
2009-11-04 11:09:56 +00:00
'first' , 'story_prev' , 'story_next' , 'story_prev_in' ,
2009-11-10 00:58:27 +00:00
'story_next_in' , 'previous' , 'random' , 'archives' ,
2009-11-07 04:36:53 +00:00
'comments' , 'next' , 'last' , 'buyprint' , 'comictitle' , 'lastgohome' ,
2009-10-31 19:46:01 +00:00
'story_prev_acts_as_prev_in'
);
2009-10-23 01:53:57 +00:00
foreach ( $all_fields as $field ) {
$instance [ $field ] = ( isset ( $new_instance [ $field ])) ? 'on' : 'off' ;
if ( isset ( $new_instance [ " ${ field } _title " ])) {
2009-11-04 11:09:56 +00:00
$instance [ " ${ field } _title " ] = strip_tags ( $new_instance [ " ${ field } _title " ]);
2009-10-23 01:53:57 +00:00
}
}
$instance [ 'archive_path' ] = strip_tags ( $new_instance [ 'archive_path' ]);
2009-08-25 12:37:13 +00:00
return $instance ;
2009-08-21 19:29:45 +00:00
}
2009-10-23 01:53:57 +00:00
2009-08-21 19:29:45 +00:00
function form ( $instance ) {
2009-10-23 01:53:57 +00:00
$field_defaults = array (
'first' => 'on' ,
'story_prev' => 'off' ,
2009-10-29 11:32:11 +00:00
'story_prev_in' => 'off' ,
2009-10-23 01:53:57 +00:00
'story_next' => 'off' ,
2009-10-29 11:32:11 +00:00
'story_next_in' => 'off' ,
2009-10-23 01:53:57 +00:00
'previous' => 'on' ,
'random' => 'off' ,
'archives' => 'off' ,
'comments' => 'off' ,
'next' => 'on' ,
2009-11-04 11:09:56 +00:00
'last' => 'on' ,
2009-10-23 01:53:57 +00:00
'archive_path' => '' ,
'buyprint' => 'off' ,
'comictitle' => 'off' ,
2009-11-07 04:36:53 +00:00
'lastgohome' => 'off' ,
2009-10-31 19:46:01 +00:00
'story_prev_acts_as_prev_in' => 'on'
2009-10-23 01:53:57 +00:00
);
$title_defaults = array (
2009-11-30 05:48:02 +00:00
'first_title' => __ ( 'First' , 'comicpress' ),
2009-10-23 01:53:57 +00:00
'story_prev_title' => __ ( 'Chapter' , 'comicpress' ),
'story_next_title' => __ ( 'Chapter' , 'comicpress' ),
2009-11-30 05:48:02 +00:00
'story_prev_in_title' => __ ( 'In Chapter' , 'comicpress' ),
'story_next_in_title' => __ ( 'In Chapter' , 'comicpress' ),
'previous_title' => __ ( 'Previous' , 'comicpress' ),
2009-10-23 01:53:57 +00:00
'random_title' => __ ( 'Random' , 'comicpress' ),
'archives_title' => __ ( 'Archives' , 'comicpress' ),
'comments_title' => __ ( 'Comments' , 'comicpress' ),
2009-11-30 05:48:02 +00:00
'next_title' => __ ( 'Next' , 'comicpress' ),
'last_title' => __ ( 'Last' , 'comicpress' ),
2009-10-23 01:53:57 +00:00
'buyprint_title' => __ ( 'Buy Print' , 'comicpress' )
);
$instance = wp_parse_args (( array ) $instance , array_merge ( $field_defaults , $title_defaults ));
foreach ( array (
2009-11-02 12:38:14 +00:00
'first' => __ ( '‹‹ First' , 'comicpress' ),
'previous' => __ ( '‹ Previous' , 'comicpress' ),
'next' => __ ( 'Next ›' , 'comicpress' ),
2009-11-04 11:09:56 +00:00
'last' => __ ( 'Last ››' , 'comicpress' ),
2009-10-23 01:53:57 +00:00
'story_prev' => __ ( 'Previous Chapter' , 'comicpress' ),
'story_next' => __ ( 'Next Chapter' , 'comicpress' ),
2009-10-29 11:32:11 +00:00
'story_prev_in' => __ ( 'Previous In Chapter' , 'comicpress' ),
'story_next_in' => __ ( 'Next In Chapter' , 'comicpress' ),
2009-10-23 01:53:57 +00:00
'comictitle' => __ ( 'Comic Title' , 'comicpress' ),
'archives' => __ ( 'Archives' , 'comicpress' ),
'comments' => __ ( 'Comments' , 'comicpress' ),
'random' => __ ( 'Random' , 'comicpress' ),
'buyprint' => __ ( 'Buy Print' , 'comicpress' )
) as $field => $label ) {
$title_field = " ${ field } _title " ; ?>
< div class = " comicpress-field-holder " >
< label >
< input id = " <?php echo $this->get_field_id ( $field ); ?> "
name = " <?php echo $this->get_field_name ( $field ); ?> "
type = " checkbox " class = " comicpress-field " value = " yes " < ? php if ( $instance [ $field ] == " on " ) { echo ' checked="checked"' ; } ?> />
2009-10-23 11:24:06 +00:00
< strong >< ? php echo $label ; ?> </strong>
2009-10-23 01:53:57 +00:00
</ label >
< div class = " comicpress-field " >
< ? php if ( isset ( $title_defaults [ $title_field ])) { ?>
< input class = " widefat "
id = " <?php echo $this->get_field_id ( $title_field ); ?> "
name = " <?php echo $this->get_field_name ( $title_field ); ?> "
type = " text "
2009-11-04 11:09:56 +00:00
value = " <?php echo htmlspecialchars( $instance[$title_field] ); ?> " />
2009-10-23 01:53:57 +00:00
< ? php } ?>
< ? php
switch ( $field ) {
case " archives " : ?>
< div >
< ? php _e ( 'Archive URL:' , 'comicpress' ) ?>
< br />
< input class = " widefat "
id = " <?php echo $this->get_field_id ('archive_path'); ?> "
name = " <?php echo $this->get_field_name ('archive_path'); ?> "
type = " text "
value = " <?php echo attribute_escape( $instance['archive_path'] ); ?> " />
</ div >
< ? php break ;
2009-11-07 04:36:53 +00:00
case " last " : ?>
2009-10-23 01:53:57 +00:00
< div >
< label >
2009-11-07 04:36:53 +00:00
< input id = " <?php echo $this->get_field_id ('lastgohome'); ?> "
name = " <?php echo $this->get_field_name ('lastgohome'); ?> "
type = " checkbox " class = " comicpress-field " value = " yes " < ? php if ( $instance [ 'lastgohome' ] == " on " ) { echo ' checked="checked"' ; } ?> />
2009-10-23 11:24:06 +00:00
< strong >< ? php _e ( '...go Home instead of Last' , 'comicpress' ); ?> </strong>
2009-10-23 01:53:57 +00:00
</ label >
</ div >
< ? php break ;
2009-10-31 19:46:01 +00:00
case " story_prev " : ?>
< div >
< label >
< input id = " <?php echo $this->get_field_id ('story_prev_acts_as_prev_in'); ?> "
name = " <?php echo $this->get_field_name ('story_prev_acts_as_prev_in'); ?> "
type = " checkbox " class = " comicpress-field " value = " yes " < ? php if ( $instance [ 'story_prev_acts_as_prev_in' ] == " on " ) { echo ' checked="checked"' ; } ?> />
2009-12-20 21:26:59 +00:00
< strong >< ? php _e ( 'Enable go to start of chapter category.' , 'comicpress' ); ?> </strong>
2009-11-24 02:00:48 +00:00
< p >
< em >
2009-12-20 21:26:59 +00:00
< ? php _e ( 'If the current post is not at the start of a chapter, the button will bring you back to the beginning of the chapter before going to a previous chapter.' , 'comicpress' ) ?>
2009-11-24 02:00:48 +00:00
</ em >
</ p >
2009-10-31 19:46:01 +00:00
</ label >
</ div >
< ? php break ;
2009-10-23 01:53:57 +00:00
}
?>
</ div >
</ div >
< ? php } ?>
< script type = " text/javascript " >
var _get_comicpress_show_hide_text = function ( container , immediate ) {
return function ( e ) {
var checkbox = jQuery ( '.comicpress-field[type=checkbox]' , container ) . get ( 0 );
if ( checkbox ) {
jQuery ( 'div.comicpress-field' , container )[ checkbox . checked ? 'show' : 'hide' ]( immediate ? null : 'fast' );
}
}
};
2009-11-10 00:58:27 +00:00
2009-10-23 01:53:57 +00:00
jQuery ( '.comicpress-field-holder' ) . each ( function ( fh ) {
jQuery ( '.comicpress-field[type=checkbox]' , this ) . bind ( 'click' , _get_comicpress_show_hide_text ( this , false ));
_get_comicpress_show_hide_text ( this , true )();
});
</ script >
2009-10-21 11:39:58 +00:00
< ? php
2009-08-21 19:29:45 +00:00
}
}