From 44bbc079cd966cd8135a4e00b7aeb188ce042370 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 20 Oct 2009 21:52:59 -0400 Subject: [PATCH] working on cleanup --- widgets/graphical-navigation.php | 190 ++++++++++++------------------- 1 file changed, 71 insertions(+), 119 deletions(-) diff --git a/widgets/graphical-navigation.php b/widgets/graphical-navigation.php index abbb35b..f799414 100644 --- a/widgets/graphical-navigation.php +++ b/widgets/graphical-navigation.php @@ -10,7 +10,6 @@ Author URI: http://webcomicplanet.com/ */ class widget_comicpress_graphical_navigation extends WP_Widget { - function widget_comicpress_graphical_navigation() { $widget_ops = array('classname' => 'widget_comicpress_graphical_navigation', 'description' => __('Displays Graphical Navigation Buttons. (used in comic sidebars)','comicpress') ); $this->WP_Widget('graphicalnavigation', __('Comic Navigation','comicpress'), $widget_ops); @@ -130,132 +129,85 @@ class widget_comicpress_graphical_navigation extends WP_Widget { } function form($instance) { - $instance = wp_parse_args( (array) $instance, array( - 'first' => 'on', - 'last' => 'on', - 'story_prev' => 'off', - 'story_next' => 'off', - 'previous' => 'on', - 'random' => 'off', - 'archives' => 'off', - 'comments' => 'off', - 'next' => 'on', - 'archive_path' => '', - 'buyprint' => 'off', - 'first_title' => 'First', - 'last_title' => 'Latest', - 'story_prev_title' => 'Chapter', - 'story_next_title' => 'Chapter', - 'previous_title' => 'Previous', - 'random_title' => 'Random', - 'archives_title' => 'Archives', - 'comments_title' => 'Comments', - 'next_title' => 'Next', - 'buyprint_title' => 'Buy Print', - 'comictitle' => 'off' - ) ); - $first = $instance['first']; if (empty($first)) $first = 'on'; - $last = $instance['last']; if (empty($last)) $last = 'on'; - $story_prev = $instance['story_prev']; if (empty($story_prev)) $story_prev = 'off'; - $story_next = $instance['story_next']; if (empty($story_next)) $story_next = 'off'; - $previous = $instance['previous']; if (empty($previous)) $previous = 'on'; - $random = $instance['random']; if (empty($random)) $random = 'off'; - $archives = $instance['archives']; if (empty($archives)) $archives = 'off'; - $comments = $instance['comments']; if (empty($comments)) $comments = 'off'; - $archive_path = $instance['archive_path']; - $next = $instance['next']; if (empty($next)) $next = 'on'; - $buyprint = $instance['buyprint']; if (empty($buyprint)) $buyprint = 'off'; - $comictitle = $instance['comictitle']; if (empty($comictitle)) $comictitle = 'off'; + $field_defaults = array( + 'first' => 'on', + 'last' => 'on', + 'story_prev' => 'off', + 'story_next' => 'off', + 'previous' => 'on', + 'random' => 'off', + 'archives' => 'off', + 'comments' => 'off', + 'next' => 'on', + 'archive_path' => '', + 'buyprint' => 'off', + 'comictitle' => 'off' + ); + $title_defaults = array( + 'first_title' => __('First', 'comicpress'), + 'last_title' => __('Latest', 'comicpress'), + 'story_prev_title' => __('Chapter', 'comicpress'), + 'story_next_title' => __('Chapter', 'comicpress'), + 'previous_title' => __('Previous', 'comicpress'), + 'random_title' => __('Random', 'comicpress'), + 'archives_title' => __('Archives', 'comicpress'), + 'comments_title' => __('Comments', 'comicpress'), + 'next_title' => __('Next', 'comicpress'), + 'buyprint_title' => __('Buy Print', 'comicpress') + ); - $first_title = $instance['first_title']; - $last_title = $instance['last_title']; - $story_prev_title = $instance['story_prev_title']; - $story_next_title = $instance['story_next_title']; - $previous_title = $instance['previous_title']; - $random_title = $instance['random_title']; - $archives_title = $instance['archives_title']; - $comments_title = $instance['comments_title']; - $next_title = $instance['next_title']; - $buyprint_title = $instance['buyprint_title']; + $instance = wp_parse_args((array)$instance, array_merge($field_defaults, $title_defaults)); + foreach (array( + 'first' => __('First', 'comicpress'), + 'last' => __('Last', 'comicpress'), + 'previous' => __('Previous', 'comicpress'), + 'next' => __('Next', 'comicpress'), + 'story_prev' => __('Previous Chapter', 'comicpress'), + 'story_next' => __('Next Chapter', 'comicpress'), + 'comictitle' => __('Comic Title', 'comicpress'), + 'archives' => __('Archives', 'comicpress'), + 'comments' => __('Comments', 'comicpress'), + 'random' => __('Random', 'comicpress'), + 'buyprint' => __('Buy Print', 'comicpress'), + ) as $field => $label) { + $title_field = "${field}_title"; ?> +   + + + + - - - ?> - -   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- -
-   />Off
- Title:
-
- Archive URL:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- -
-   />Off
- Title:
-
- - - + +
+
+ + +
+