From c7d22e146469cb3e204cedd765d7bc5337c6a90f Mon Sep 17 00:00:00 2001 From: "Philip M. Hofer (Frumph)" Date: Mon, 21 Dec 2009 15:32:36 -0800 Subject: [PATCH] Finishing up the widget conversions, fixed ArchiveDropdownWidget class name adjustments for all the test files, moved some code into functions.php for the random comic/post. Signed-off-by: Philip M. Hofer (Frumph) --- widgets/ArchiveDropdownWidget.inc | 4 +-- widgets/LatestComicLink.inc | 48 +++++++++++++++++++++++++++++++ widgets/LatestComicLinkWidget.inc | 48 +++++++++++++++++++++++++++++++ widgets/RandomComicLinkWidget.inc | 48 +++++++++++++++++++++++++++++++ widgets/RandomPostLinkWidget.inc | 48 +++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 widgets/LatestComicLink.inc create mode 100644 widgets/LatestComicLinkWidget.inc create mode 100644 widgets/RandomComicLinkWidget.inc create mode 100644 widgets/RandomPostLinkWidget.inc diff --git a/widgets/ArchiveDropdownWidget.inc b/widgets/ArchiveDropdownWidget.inc index 2180930..ece03dd 100644 --- a/widgets/ArchiveDropdownWidget.inc +++ b/widgets/ArchiveDropdownWidget.inc @@ -35,7 +35,7 @@ class ComicPressArchiveDropdownWidget extends WP_Widget { function _verify_nonce() { return __comicpress_verify_nonce(); } function template_redirect() { - if (ArchiveDropdownWidget::_verify_nonce() == 'follow-archive-dropdown') { + if (ComicPressArchiveDropdownWidget::_verify_nonce() == 'follow-archive-dropdown') { wp_redirect($_GET['cp']['urls']); } } @@ -242,4 +242,4 @@ class ComicPressArchiveDropdownWidget extends WP_Widget { } } -add_action('template_redirect', array('ArchiveDropdownWidget', 'template_redirect')); +add_action('template_redirect', array('ComicPressArchiveDropdownWidget', 'template_redirect')); diff --git a/widgets/LatestComicLink.inc b/widgets/LatestComicLink.inc new file mode 100644 index 0000000..1ef451c --- /dev/null +++ b/widgets/LatestComicLink.inc @@ -0,0 +1,48 @@ + __CLASS__, 'description' => __('Displays a link to click to go to the latest comic.','comicpress') ); + $this->WP_Widget(__CLASS__, __('ComicPress Latest Comic Link','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; }; ?> +

? Latest Comic

+ '' ) ); + $title = strip_tags($instance['title']); + ?> +

+ \ No newline at end of file diff --git a/widgets/LatestComicLinkWidget.inc b/widgets/LatestComicLinkWidget.inc new file mode 100644 index 0000000..8c38504 --- /dev/null +++ b/widgets/LatestComicLinkWidget.inc @@ -0,0 +1,48 @@ + __CLASS__, 'description' => __('Displays a link to click to go to the latest comic.','comicpress') ); + $this->WP_Widget(__CLASS__, __('ComicPress Latest Comic Link','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; }; ?> +

? Latest Comic

+ '' ) ); + $title = strip_tags($instance['title']); + ?> +

+ \ No newline at end of file diff --git a/widgets/RandomComicLinkWidget.inc b/widgets/RandomComicLinkWidget.inc new file mode 100644 index 0000000..0b4e2a1 --- /dev/null +++ b/widgets/RandomComicLinkWidget.inc @@ -0,0 +1,48 @@ + __CLASS__, 'description' => __('Displays a link to click to trigger a random comic.','comicpress') ); + $this->WP_Widget(__CLASS__, __('ComicPress Random Comic Link','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; }; ?> +

?

+ '' ) ); + $title = strip_tags($instance['title']); + ?> +

+ \ No newline at end of file diff --git a/widgets/RandomPostLinkWidget.inc b/widgets/RandomPostLinkWidget.inc new file mode 100644 index 0000000..d21cb02 --- /dev/null +++ b/widgets/RandomPostLinkWidget.inc @@ -0,0 +1,48 @@ + __CLASS__, 'description' => __('Displays a link to click to trigger a random blog post.','comicpress') ); + $this->WP_Widget(__CLASS__, __('ComicPress Random Post Link','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; }; ?> +

?

+ '' ) ); + $title = strip_tags($instance['title']); + ?> +

+ \ No newline at end of file