2009-08-21 19:29:45 +00:00
< ? php
/*
2009-08-27 02:08:01 +00:00
Widget Name : ComicPress Calendar
2009-08-21 19:29:45 +00:00
Widget URI : http :// comicpress . org /
Description : Display a calendar of this months posts .
Author : Philip M . Hofer ( Frumph )
Version : 1.01
Author URI : http :// webcomicplanet . com /
*/
2009-08-28 14:26:26 +00:00
function comicpress_calendar ( $instance = null ) {
2009-08-27 02:08:01 +00:00
global $post ;
2009-08-28 14:26:26 +00:00
if ( ! empty ( $instance )) {
$thumbnail = $instance [ 'thumbnail' ];
$small = $instance [ 'small' ];
$medium = $instance [ 'medium' ];
$large = $instance [ 'large' ];
2009-10-22 01:24:37 +00:00
$link = $instance [ 'link' ];
2009-08-28 14:26:26 +00:00
}
2009-08-27 02:08:01 +00:00
?>
2009-10-21 01:14:59 +00:00
< center >
2009-11-02 12:23:41 +00:00
< div id = " wp-calendar-head " ></ div >
2009-08-26 08:22:29 +00:00
< div id = " wp-calendar-wrap " >
2009-08-27 02:08:01 +00:00
< ? php if ( ! empty ( $thumbnail )) { ?>
2009-08-29 01:22:32 +00:00
< div class = " wp-calendar-download " >
2009-10-22 01:24:37 +00:00
< ? php if ( ! empty ( $link )) { ?>
< a href = " <?php echo $link ; ?> " >< img src = " <?php echo $thumbnail ; ?> " class = " wp-calendar-thumb " alt = " " /></ a >
< ? php } else { ?>
< img src = " <?php echo $thumbnail ; ?> " class = " wp-calendar-thumb " alt = " " />
2009-08-27 19:48:09 +00:00
< ? php } ?>
2009-10-22 01:24:37 +00:00
< div class = " wp-clendar-download-links " >
< ? php if ( ! empty ( $small ) || ! empty ( $medium ) || ! empty ( $large )) { ?>
< ? php _e ( 'DOWNLOAD' , 'comicpress' ); ?> <?php if (!empty($small)) { ?><a href="<?php echo $small; ?>" title="<?php _e('Download Small','comicpress'); ?>"><?php _e('S','comicpress'); ?></a><?php } ?><?php if (!empty($medium)) { ?><a href="<?php echo $medium; ?>" title="<?php _e('Download Medium','comicpress'); ?>"><?php _e('M','comicpress'); ?></a><?php } ?><?php if (!empty($large)) { ?><a href="<?php echo $large; ?>" title="<?php _e('Download Large','comicpress'); ?>"><?php _e('L','comicpress'); ?></a><?php } ?>
< ? php } ?>
</ div >
2009-08-29 01:22:32 +00:00
</ div >
2009-08-27 02:08:01 +00:00
< ? php } ?>
2009-08-26 08:22:29 +00:00
< ? php get_calendar (); ?>
</ div >
2009-11-02 12:23:41 +00:00
< div id = " wp-calendar-foot " ></ div >
2009-10-21 01:14:59 +00:00
</ center >
2009-08-26 08:22:29 +00:00
< ? php }
2009-10-21 01:14:59 +00:00
2009-08-21 19:29:45 +00:00
class widget_comicpress_calendar extends WP_Widget {
function widget_comicpress_calendar () {
2009-10-05 06:08:01 +00:00
$widget_ops = array ( 'classname' => 'widget_comicpress_calendar' , 'description' => __ ( 'Display a calendar showing this months posts. (this calendar does not drop lines if there is no title given.)' , 'comicpress' ) );
$this -> WP_Widget ( 'comicpress_calendar' , __ ( 'Comicpress Calendar' , 'comicpress' ), $widget_ops );
2009-08-21 19:29:45 +00:00
}
function widget ( $args , $instance ) {
global $post ;
extract ( $args , EXTR_SKIP );
echo $before_widget ;
2009-08-27 02:08:01 +00:00
comicpress_calendar ( $instance );
2009-08-21 19:29:45 +00:00
echo $after_widget ;
}
function update ( $new_instance , $old_instance ) {
$instance = $old_instance ;
2009-08-27 02:08:01 +00:00
$instance [ 'thumbnail' ] = strip_tags ( $new_instance [ 'thumbnail' ]);
$instance [ 'small' ] = strip_tags ( $new_instance [ 'small' ]);
$instance [ 'medium' ] = strip_tags ( $new_instance [ 'medium' ]);
$instance [ 'large' ] = strip_tags ( $new_instance [ 'large' ]);
2009-10-22 01:24:37 +00:00
$instance [ 'link' ] = $new_instance [ 'link' ];
2009-08-21 19:29:45 +00:00
return $instance ;
}
function form ( $instance ) {
2009-11-10 02:15:39 +00:00
$instance = wp_parse_args ( ( array ) $instance , array ( 'thumbnail' => '' , 'small' => '' , 'medium' => '' , 'large' => '' , 'link' => '' ) );
2009-08-27 02:08:01 +00:00
$thumbnail = strip_tags ( $instance [ 'thumbnail' ]);
$small = strip_tags ( $instance [ 'small' ]);
$medium = strip_tags ( $instance [ 'medium' ]);
$large = strip_tags ( $instance [ 'large' ]);
2009-10-22 01:24:37 +00:00
$link = $instance [ 'link' ];
2009-08-21 19:29:45 +00:00
?>
2009-10-05 06:08:01 +00:00
< p >< label for = " <?php echo $this->get_field_id ('thumbnail'); ?> " >< ? php _e ( 'Thumbnail URL (178px by 130px):' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('thumbnail'); ?>" name="<?php echo $this->get_field_name('thumbnail'); ?>" type="text" value="<?php echo attribute_escape($thumbnail); ?>" /></label></p>
2009-10-22 01:24:37 +00:00
< p >< label for = " <?php echo $this->get_field_id ('link'); ?> " >< ? php _e ( 'Add link on thumbnail:' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" type="text" value="<?php echo attribute_escape($link); ?>" /></label></p>
< hr >
2009-10-05 06:08:01 +00:00
< p >< label for = " <?php echo $this->get_field_id ('small'); ?> " >< ? php _e ( 'Wallpaper URL (Small):' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('small'); ?>" name="<?php echo $this->get_field_name('small'); ?>" type="text" value="<?php echo attribute_escape($small); ?>" /></label></p>
< p >< label for = " <?php echo $this->get_field_id ('medium'); ?> " >< ? php _e ( 'Wallpaper URL (Medium):' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('medium'); ?>" name="<?php echo $this->get_field_name('medium'); ?>" type="text" value="<?php echo attribute_escape($medium); ?>" /></label></p>
< p >< label for = " <?php echo $this->get_field_id ('large'); ?> " >< ? php _e ( 'Wallpaper URL (Large):' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('large'); ?>" name="<?php echo $this->get_field_name('large'); ?>" type="text" value="<?php echo attribute_escape($large); ?>" /></label></p>
2009-10-22 01:24:37 +00:00
< p >< label for = " <?php echo $this->get_field_id ('link'); ?> " >< ? php _e ( 'Add link on thumbnail:' , 'comicpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" type="text" value="<?php echo attribute_escape($link); ?>" /></label></p>
2009-08-21 19:29:45 +00:00
< ? php
}
}
register_widget ( 'widget_comicpress_calendar' );
function widget_comicpress_calendar_init () {
new widget_comicpress_calendar ();
}
add_action ( 'widgets_init' , 'widget_comicpress_calendar_init' );
2009-08-21 17:45:23 +00:00
?>