Deleting Deprecated files, moved widgets to .inc (most)

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-21 15:07:40 -08:00
parent c7b9335b59
commit e8f665c721
17 changed files with 766 additions and 9 deletions

View File

@ -1,3 +0,0 @@
<?php
// Depreciated
?>

View File

@ -1,3 +0,0 @@
<?php
// Depreciated
?>

10
functions/shortcodes.php Normal file
View File

@ -0,0 +1,10 @@
<?php
add_shortcode( 'version', 'comicpress_ver_shortcode' );
function comicpress_ver_shortcode( $atts, $content = null ) {
global $comicpress_options;
return '<div class="comicpress_ver">'.$comicpress_version['comicpress_version'].'</div>';
}
?>

View File

@ -1,3 +0,0 @@
<?php
// Depreciated
?>

View File

@ -0,0 +1,63 @@
<?php
/*
Widget Name: Buy Print
Widget URI: http://comicpress.org/
Description: Places a button that works with the Buy This template.
Author: Philip M. Hofer (Frumph)
Version: 1.01
Author URI: http://frumph.net/
*/
class ComicPressBuyPrintWidget extends WP_Widget {
function ComicPressBuyPrintWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Adds a button that goes to the buy print template page.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Buy This Print','comicpress'), $widget_ops);
}
}
function init() {
add_filter('comicpress_buy_print_structure', array(&$this, 'buy_print_structure'));
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
if ( get_post_meta( get_the_ID(), "buythiscomic", true ) !== 'sold' ) {
echo apply_filters('comicpress_buy_print_structure', '');
}
echo $after_widget;
}
function buy_print_structure($content = '') {
$comicpress_options = comicpress_load_options(); ?>
<div class="buythis"><form method="post" action="<?php echo $comicpress_options['buy_print_url']; ?>">
<input type="hidden" name="comic" value="<?php echo get_the_ID(); ?>" />
<button class="buythisbutton" type="submit" value="submit" name="submit"></button></form></div>
<div class="clear"></div>
<?php
}
function update($new_instance, $old_instance = array()) {
$instance = array();
foreach (array('title') as $field) {
if (isset($new_instance[$field])) { $instance[$field] = strip_tags($new_instance[$field]); }
}
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
Widget Name: Comic Blog Post Widget
Widget URI: http://comicpress.org/
Description: Display's the comic's blog post.
Author: Philip M. Hofer (Frumph)
Version: 1.05
Author URI: http://frumph.net/
*/
class ComicPressComicBlogPostWidget extends WP_Widget {
function ComicPressComicBlogPostWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays the comic blog post, ..used to be around the comic areas.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Comic Blog Post','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post, $wp_query;
if (is_home() || is_single()) {
extract($args, EXTR_SKIP);
if (!empty($post->post_content)) {
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo '<div class="heading">'.$title.'</div>'; }
display_comic_post();
echo $after_widget;
}
}
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Heading:<br /><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,53 @@
<?php
/*
Widget Name: Comic Date
Widget URI: http://comicpress.org/
Description: Display's the date of post of the comic.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressComicDateWidget extends WP_Widget {
function ComicPressComicDateWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays the date of the post of the comic.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Comic Date','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $title; } ?> <?php the_time($instance['format']); ?>
<?php echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['format'] = strip_tags($new_instance['format']);
if (empty($instance['format'])) $instance['format'] = 'F jS, Y';
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'format' => '' ) );
$title = strip_tags($instance['title']);
$format = strip_tags($instance['format']);
if (empty($format)) $format = 'F jS, Y';
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Words to use before date:','comicpress'); ?><br /><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('Format of the Time/Date:','comicpress'); ?><br /><input class="widefat" id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>" type="text" value="<?php echo attribute_escape($format); ?>" /></label></p>
<p><a href="http://us.php.net/manual/en/function.date.php" target="_blank"><?php _e('Date String Examples','comicpress'); ?></a></p>
<?php
}
}
?>

View File

@ -0,0 +1,39 @@
<?php
/*
Widget Name: Comic Title Widget
Widget URI: http://comicpress.org/
Description: Display a Title of the Comic that can be used in any area around the comic.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressComicTitleWidget extends WP_Widget {
function ComicPressComicTitleWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays the title of the comic. (used in comic sidebars)','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Comic Title','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
return $instance;
}
function form($instance) {
}
}
?>

View File

@ -0,0 +1,55 @@
<?php
/*
Widget Name: Comic Comments Widget
Widget URI: http://comicpress.org/
Description: Display a comments link to put inside the comic area.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressCommentsWidget extends WP_Widget {
function ComicPressCommentsWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays a comments link. (used in comic sidebars)','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Comic Comments','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? __('Permalink','comicpress') : apply_filters('widget_title', $instance['title']); ?>
<?php if ('open' == $post->comment_status) { ?><div class="comment-link"><?php comments_popup_link('<span class="comment-balloon comment-balloon-empty">&rdquo;</span>Comment ', '<span class="comment-balloon">1</span>Comment ', '<span class="comment-balloon">%</span>Comment '); ?></div><?php } ?>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('New Link name:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
register_widget('widget_comicpress_comments');
function widget_comicpress_comments_init() {
new widget_comicpress_comments();
}
add_action('widgets_init', 'widget_comicpress_comments_init');
?>

View File

@ -0,0 +1,82 @@
<?php
/*
Widget Name: Control Panel
Widget URI: http://comicpress.org/
Description: Display an area for login and logout, forgot password and register.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressControlPanelWidget extends WP_Widget {
function ComicPressControlPanelWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Login/Logoff menu with register/lost password links if not logged on. (use only if registrations are enabled.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Control Panel','comicpress'), $widget_ops);
}
}
function comicpress_show_control_panel() {
global $wpmu_version; ?>
<?php if (!is_user_logged_in()) { ?>
<form action="<?php bloginfo('wpurl') ?>/wp-login.php" method="post">
<?php _e('UserName:','comicpress'); ?><br />
<input type="text" name="log" id="sname" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /><br /><br />
<?php _e('Password:','comicpress'); ?><br />
<input type="password" name="pwd" id="spassword" size="22" /><br />
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
<br />
<button type="submit" class="button"><?php _e('Login','comicpress'); ?></button>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>
<br />
<ul>
<?php if (!empty($wpmu_version)) { ?>
<li><a href="<?php bloginfo('wpurl') ?>/wp-signup.php"><?php _e('Register','comicpress'); ?></a></li>
<?php } else { ?>
<li><a href="<?php bloginfo('wpurl') ?>/wp-register.php"><?php _e('Register','comicpress'); ?></a></li>
<?php } ?>
<li><a href="<?php bloginfo('wpurl') ?>/wp-login.php?action=lostpassword"><?php _e('Recover password','comicpress'); ?></a></li>
</ul>
<?php } else { ?>
<ul>
<?php $redirect = '&amp;redirect_to='.urlencode(wp_make_link_relative(get_bloginfo('wpurl')));
$uri = wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' ); ?>
<li><a href="<?php echo $uri; ?>"><?php _e('Logout','comicpress'); ?></a></li>
<?php wp_register(); ?>
<li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/profile.php"><?php _e('Profile','comicpress'); ?></a></li>
</ul>
<?php } ?>
<?php
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? __('Control Panel','comicpress') : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
$this->comicpress_show_control_panel();
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,62 @@
<?php
/*
Widget Name: Latest Thumbnail
Widget URI: http://comicpress.org/
Description: Display a thumbnail of the latest comic.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressLatestThumbnailWidget extends WP_Widget {
function ComicPressLatestThumbnailWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a thumbnail of the latest comic, clickable to go to the comic post.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Latest Thumbnail','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
if (is_home()) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? __('Latest Comic','comicpress') : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
$latestcomics = get_posts('numberposts=1&category='.get_all_comic_categories_as_cat_string());
$archive_image = null;
foreach($latestcomics as $post) :
foreach (array("archive", "rss", "mini", "comic") as $type) {
if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
$archive_image = $requested_archive_image; break;
}
} ?>
<center>
<a href="<?php the_permalink(); ?>"><img src="<?php echo $archive_image ?>" alt="<?php the_title() ?> - <?php the_date(); ?>" title="<?php the_hovertext() ?>" /></a><br />
<span class="latest_thumbnail_date"><?php the_date(); ?></span>
</center>
<?php endforeach;
echo $after_widget;
}
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,50 @@
<?php
/*
Widget Name: Non-Member text widget
Widget URI: http://comicpress.org/
Description: Displays whatever inside to non-members.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressNonMemberTextWidget extends WP_Widget {
function ComicPressNonMemberTextWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays Whatever is in the text box to non-members only.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Non-Member Text','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post, $wp_query;
if (!comicpress_is_member()) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '': apply_filters('widget_title', $instance['title']);
echo stripslashes($instance['textinfo']);
echo $after_widget;
}
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['textinfo'] = addslashes($new_instance['textinfo']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' , 'textinfo' => '') );
$title = strip_tags($instance['title']);
$textinfo = stripslashes($instance['textinfo']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label><textarea style="width: 400px; height: 280px;" name="<?php echo $this->get_field_name('textinfo'); ?>" name="<?php echo $this->get_field_name('textinfo'); ?>"><?php echo $textinfo; ?></textarea></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,51 @@
<?php
/*
Widget Name: Permalink
Widget URI: http://comicpress.org/
Description: Display a permalink link that can be used in any area around the comic.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressPermalinkWidget extends WP_Widget {
function ComicPressPermalinkWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays a permalink. (used in comic sidebars)','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Permalink','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); ?>
<a href="<?php the_permalink(); ?><?php if ($instance['comment'] == 'yes') { ?>#comment<?php } ?>" class="widget_permalink_href"><?php echo $title; ?></a>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['comment'] = strip_tags($new_instance['comment']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' , 'comment' => '') );
$title = strip_tags($instance['title']);
$comment = strip_tags($instance['comment']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('New Link name:','comicpress'); ?><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label><input name="<?php echo $this->get_field_name('comment'); ?>" id="<?php echo $this->get_field_id('comment'); ?>-comment" type="radio" value="yes"<?php if ( $comment == "yes") { echo " checked"; } ?> />Yes <input name="<?php echo $this->get_field_name('comment'); ?>" id="<?php echo $this->get_field_id('comment'); ?>-comment" type="radio" value="no"<?php if ( $comment == "no") { echo " checked"; } ?> />No<br />Add #comment to href?</label></p>
<?php
}
}
?>

View File

@ -0,0 +1,57 @@
<?php
/*
Widget Name: Scheduled Posts
Widget URI: http://comicpress.org/
Description: Display a list of posts that are due to be scheduled.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressScheduledPostsWidget extends WP_Widget {
function ComicPressScheduledPostsWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a list of posts that are scheduled to be published.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Scheduled Posts','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo '<div class="scheduled-post-wrap">';
echo $before_widget;
$title = empty($instance['title']) ? __('Scheduled Posts','comicpress') : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
$scheduled_posts = get_posts('post_status=future&numberposts=-1');
if (empty($scheduled_posts)) {
echo '<ul><li>None.</li></ul>';
} else { ?>
<ul>
<?php foreach($scheduled_posts as $post) : ?>
<li><span class="scheduled-post-date"><?php echo date('m/d/Y',strtotime($post->post_date)); ?></span> <span class="scheduled-post-title"><?php echo $post->post_title; ?></span></li>
<?php endforeach; ?>
</ul>
<?php }
echo $after_widget;
echo '</div>';
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
?>

89
widgets/SocialWidget.inc Normal file
View File

@ -0,0 +1,89 @@
<?php
/*
Widget Name: ComicPress Social
Widget URI: http://comicpress.org/
Description: Translates a user's URL line into a social widget, associating it to images.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicPressSocialWidget extends WP_Widget {
function ComicPressSocialWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a user defined social button, with translated URL.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Social','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
/* Get the info necessary */
$permalink = get_permalink($post->ID);
$posttitle = $post->post_title;
$posttitle = str_replace(' ', '%20', $posttitle);
$title = $instance['title'];
if (empty($title)) $title = $posttitle;
$rss = get_bloginfo('rss2_url');
$blogname = urlencode(get_bloginfo('name')." ".get_bloginfo('description'));
// Grab the excerpt, if there is no excerpt, create one
$excerpt = urlencode(strip_tags(strip_shortcodes($post->post_excerpt)));
if ($excerpt == "") {
$excerpt = urlencode(substr(strip_tags(strip_shortcodes($post->post_content)),0,250));
}
// Clean the excerpt for use with links
$excerpt = str_replace('+','%20',$excerpt);
echo $before_widget;
$url = $instance['urlstr'];
$url = str_replace('[URL]', $permalink, $url);
$url = str_replace('[TITLE]', $posttitle, $url);
$url = str_replace('[RSS]', $rss, $url);
$url = str_replace('[BLOGNAME]', $blogname, $url);
$url = str_replace('[EXCERPT]', $excerpt, $url); ?>
<div class="social-<?php echo sanitize_title($title); ?>">
<?php if (!empty($instance['image'])) { ?>
<a href="<?php echo $url; ?>" target="_blank" class="social-<?php echo sanitize_title($title); ?>"><img src="<?php echo $instance['image']; ?>" alt="<?php echo $title; ?>" /></a>
<?php } else { ?>
<a href="<?php echo $url; ?>" target="_blank" class="social-<?php echo sanitize_title($title); ?>"><?php echo $title; ?></a>
<?php } ?>
</div>
<?php echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['urlstr'] = strip_tags($new_instance['urlstr']);
$instance['image'] = strip_tags($new_instance['image']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => 'Share This!', 'urlstr' => '', 'image' => '') );
$title = strip_tags($instance['title']);
if (empty($title)) $title = 'Share This!';
$urlstr = strip_tags($instance['urlstr']);
$image = strip_tags($instance['image']);
?>
<small>
<strong>Translated Strings:</strong> [URL] [TITLE] [RSS] [BLOGNAME] [EXCERPT]<br />
<strong>Examples:</strong><br />
http://twitter.com/home?status=[TITLE]%20-%20[URL]<br />
http://www.stumbleupon.com/submit?url=[URL]&amp;title=[TITLE]<br />
</small>
<br />
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (used as CSS marker too):','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('urlstr'); ?>"><?php _e('URL','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('urlstr'); ?>" name="<?php echo $this->get_field_name('urlstr'); ?>" type="text" value="<?php echo attribute_escape($urlstr); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('image'); ?>"><?php _e('Image','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('image'); ?>" name="<?php echo $this->get_field_name('image'); ?>" type="text" value="<?php echo attribute_escape($image); ?>" /></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,47 @@
<?php
/*
Widget Name: Search Transcript
Widget URI: http://comicpress.org/
Description: Link to the form template for searching transcripts.
Author: Philip M. Hofer (Frumph)
Version: 1.01
Author URI: http://frumph.net/
*/
class ComicPressTranscriptSearchWidget extends WP_Widget {
function ComicPressTranscriptSearchWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays a form input box for searching transcripts.','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Search Transcripts','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
include(get_template_directory() . '/searchform-transcript.php');
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
?>

View File

@ -0,0 +1,56 @@
<?php
/*
Widget Name: Transcript Widget
Widget URI: http://comicpress.org/
Description: Show the stylized transcription in a widget area.
Author: Philip M. Hofer (Frumph)
Version: 1.02
Author URI: http://frumph.net/
*/
class ComicpressTranscriptWidget extends WP_Widget {
function ComicpressTranscriptWidget($skip_widget_init = false) {
if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display the transcription of the current post if there is one. (used in comic sidebars)','comicpress') );
$this->WP_Widget(__CLASS__, __('ComicPress Transcript','comicpress'), $widget_ops);
}
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$transtype = empty($instance['transtype']) ? 'empty' : apply_filters('widget_transtype', $instance['transtype']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
the_transcript($transtype);
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['transtype'] = strip_tags($new_instance['transtype']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'transtype' => '' ) );
$title = strip_tags($instance['title']);
$transtype = strip_tags($instance['transtype']);
if (empty($transtype)) $transtype = 'styled';
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p>
<label><input name="<?php echo $this->get_field_name('transtype'); ?>" id="<?php echo $this->get_field_id('transtype'); ?>-styled" type="radio" value="styled"<?php if ( $transtype == "styled") { echo " checked"; } ?> /><?php _e('Styled','comicpress'); ?></label><br />
<label><input name="<?php echo $this->get_field_name('transtype'); ?>" id="<?php echo $this->get_field_id('transtype'); ?>-br" type="radio" value="br"<?php if ( $transtype == "br") { echo " checked"; } ?> /><?php _e('Add BR','comicpress'); ?></label><br />
<label><input name="<?php echo $this->get_field_name('transtype'); ?>" id="<?php echo $this->get_field_id('transtype'); ?>-raw" type="radio" value="raw"<?php if ( $transtype == "raw") { echo " checked"; } ?> /><?php _e('Raw Output','comicpress'); ?></label>
</p>
<?php
}
}
?>