Enhanced Text Widget - Version 1.3.3

Version Description

  • Fixes "Do not output before/after_widget/title" option
  • Code cleanup
Download this release

Release Info

Developer bostondv
Plugin Icon wp plugin Enhanced Text Widget
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

Files changed (2) hide show
  1. enhanced-text-widget.php +7 -16
  2. readme.txt +5 -1
enhanced-text-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Enhanced Text Widget
4
  Plugin URI: http://pomelodesign.com/enhanced-text-widget
5
  Description: An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, and/or PHP as content with linkable widget title.
6
- Version: 1.3.2
7
  Author: Pomelo Design
8
  Author URI: http://pomelodesign.com/
9
  License: GPL2
@@ -35,7 +35,7 @@ class EnhancedTextWidget extends WP_Widget {
35
  extract($args);
36
  $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
37
  $titleUrl = apply_filters('widget_title', empty($instance['titleUrl']) ? '' : $instance['titleUrl'], $instance);
38
- $newWindow = $instance['newWindow'] ? '1' : '0';
39
  $cssClass = apply_filters('widget_title', empty($instance['cssClass']) ? '' : $instance['cssClass'], $instance);
40
  $bare = $instance['bare'] ? true : false;
41
  $text = apply_filters( 'widget_text', $instance['text'], $instance );
@@ -48,7 +48,7 @@ class EnhancedTextWidget extends WP_Widget {
48
  }
49
  echo $bare ? '' : $before_widget;
50
  if( $titleUrl && $title )
51
- $title = '<a href="'.$titleUrl.'"'.($newWindow == '1'?' target="_blank"':'').' title="'.$title.'">'.$title.'</a>';
52
  if ( !empty( $title ) ) { echo $bare ? $title : $before_title . $title . $after_title; } ?>
53
  <div class="textwidget"><?php if($instance['filter']) { ob_start(); eval("?>$text<?php "); $output = ob_get_contents(); ob_end_clean(); echo wpautop($output); } else eval("?>".$text."<?php "); ?></div>
54
  <?php
@@ -60,13 +60,13 @@ class EnhancedTextWidget extends WP_Widget {
60
  $instance['title'] = strip_tags($new_instance['title']);
61
  $instance['titleUrl'] = strip_tags($new_instance['titleUrl']);
62
  $instance['cssClass'] = strip_tags($new_instance['cssClass']);
63
- $instance['bare'] = $new_instance['bare'] ? 1 : 0;
64
- $instance['newWindow'] = $new_instance['newWindow'] ? 1 : 0;
65
  if ( current_user_can('unfiltered_html') )
66
  $instance['text'] = $new_instance['text'];
67
  else
68
  $instance['text'] = wp_filter_post_kses( $new_instance['text'] );
69
  $instance['filter'] = isset($new_instance['filter']);
 
70
  return $instance;
71
  }
72
 
@@ -80,18 +80,10 @@ class EnhancedTextWidget extends WP_Widget {
80
  if(isset($instance['titleUrl'])){
81
  $titleUrl = strip_tags($instance['titleUrl']);
82
  }
83
- $newWindow = "";
84
- if(isset($instance['newWindow'])){
85
- $newWindow = 'checked="checked"';
86
- }
87
  $cssClass = "";
88
  if(isset($instance['cssClass'])){
89
  $cssClass = strip_tags($instance['cssClass']);
90
  }
91
- $bare = "";
92
- if(isset($instance['bare'])){
93
- $bare = 'checked="checked"';
94
- }
95
  $text = "";
96
  if(isset($instance['text'])){
97
  $text = format_to_edit($instance['text']);
@@ -101,7 +93,7 @@ class EnhancedTextWidget extends WP_Widget {
101
  <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
102
  <p><label for="<?php echo $this->get_field_id('titleUrl'); ?>"><?php _e('URL:'); ?></label>
103
  <input class="widefat" id="<?php echo $this->get_field_id('titleUrl'); ?>" name="<?php echo $this->get_field_name('titleUrl'); ?>" type="text" value="<?php echo esc_attr($titleUrl); ?>" /></p>
104
- <p><input class="checkbox" type="checkbox" <?php echo $newWindow; ?> id="<?php echo $this->get_field_id('newWindow'); ?>" name="<?php echo $this->get_field_name('newWindow'); ?>" />
105
  <label for="<?php echo $this->get_field_id('newWindow'); ?>"><?php _e('Open the URL in a new window'); ?></label></p>
106
  <p><label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Class:'); ?></label>
107
  <input class="widefat" id="<?php echo $this->get_field_id('cssClass'); ?>" name="<?php echo $this->get_field_name('cssClass'); ?>" type="text" value="<?php echo esc_attr($cssClass); ?>" /></p>
@@ -109,8 +101,7 @@ class EnhancedTextWidget extends WP_Widget {
109
  <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
110
 
111
  <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
112
- <p><input class="checkbox" type="checkbox" <?php echo $bare; ?> id="<?php echo $this->get_field_id('bare'); ?>" name="<?php echo $this->get_field_name('bare'); ?>" />
113
- <label for="<?php echo $this->get_field_id('bare'); ?>"><?php _e('Do not output before/after_widget/title'); ?></label></p>
114
  <p class="credits"><small>Developed by <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
115
  <?php
116
  }
3
  Plugin Name: Enhanced Text Widget
4
  Plugin URI: http://pomelodesign.com/enhanced-text-widget
5
  Description: An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, and/or PHP as content with linkable widget title.
6
+ Version: 1.3.3
7
  Author: Pomelo Design
8
  Author URI: http://pomelodesign.com/
9
  License: GPL2
35
  extract($args);
36
  $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
37
  $titleUrl = apply_filters('widget_title', empty($instance['titleUrl']) ? '' : $instance['titleUrl'], $instance);
38
+ $newWindow = $instance['newWindow'] ? true : false;
39
  $cssClass = apply_filters('widget_title', empty($instance['cssClass']) ? '' : $instance['cssClass'], $instance);
40
  $bare = $instance['bare'] ? true : false;
41
  $text = apply_filters( 'widget_text', $instance['text'], $instance );
48
  }
49
  echo $bare ? '' : $before_widget;
50
  if( $titleUrl && $title )
51
+ $title = '<a href="'.$titleUrl.'"'.($newWindow == true?' target="_blank"':'').' title="'.$title.'">'.$title.'</a>';
52
  if ( !empty( $title ) ) { echo $bare ? $title : $before_title . $title . $after_title; } ?>
53
  <div class="textwidget"><?php if($instance['filter']) { ob_start(); eval("?>$text<?php "); $output = ob_get_contents(); ob_end_clean(); echo wpautop($output); } else eval("?>".$text."<?php "); ?></div>
54
  <?php
60
  $instance['title'] = strip_tags($new_instance['title']);
61
  $instance['titleUrl'] = strip_tags($new_instance['titleUrl']);
62
  $instance['cssClass'] = strip_tags($new_instance['cssClass']);
63
+ $instance['newWindow'] = isset($new_instance['newWindow']);
 
64
  if ( current_user_can('unfiltered_html') )
65
  $instance['text'] = $new_instance['text'];
66
  else
67
  $instance['text'] = wp_filter_post_kses( $new_instance['text'] );
68
  $instance['filter'] = isset($new_instance['filter']);
69
+ $instance['bare'] = isset($new_instance['bare']);
70
  return $instance;
71
  }
72
 
80
  if(isset($instance['titleUrl'])){
81
  $titleUrl = strip_tags($instance['titleUrl']);
82
  }
 
 
 
 
83
  $cssClass = "";
84
  if(isset($instance['cssClass'])){
85
  $cssClass = strip_tags($instance['cssClass']);
86
  }
 
 
 
 
87
  $text = "";
88
  if(isset($instance['text'])){
89
  $text = format_to_edit($instance['text']);
93
  <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
94
  <p><label for="<?php echo $this->get_field_id('titleUrl'); ?>"><?php _e('URL:'); ?></label>
95
  <input class="widefat" id="<?php echo $this->get_field_id('titleUrl'); ?>" name="<?php echo $this->get_field_name('titleUrl'); ?>" type="text" value="<?php echo esc_attr($titleUrl); ?>" /></p>
96
+ <p><input type="checkbox" id="<?php echo $this->get_field_id('newWindow'); ?>" name="<?php echo $this->get_field_name('newWindow'); ?>" <?php checked(isset($instance['newWindow']) ? $instance['newWindow'] : 0); ?> />
97
  <label for="<?php echo $this->get_field_id('newWindow'); ?>"><?php _e('Open the URL in a new window'); ?></label></p>
98
  <p><label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Class:'); ?></label>
99
  <input class="widefat" id="<?php echo $this->get_field_id('cssClass'); ?>" name="<?php echo $this->get_field_name('cssClass'); ?>" type="text" value="<?php echo esc_attr($cssClass); ?>" /></p>
101
  <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
102
 
103
  <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
104
+ <p><input id="<?php echo $this->get_field_id('bare'); ?>" name="<?php echo $this->get_field_name('bare'); ?>" type="checkbox" <?php checked(isset($instance['bare']) ? $instance['bare'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('bare'); ?>"><?php _e('Do not output before/after_widget/title'); ?></label></p>
 
105
  <p class="credits"><small>Developed by <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
106
  <?php
107
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://pomelodesign.com/donate/
4
  Tags: widget, clickable, linkable, linked title, text, php, javascript, flash, linked title text, linked, text widget, PHP Widget, link widget title, bare widget
5
  Requires at least: 2.8
6
  Tested up to: 3.4
7
- Stable tag: 1.3.2
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -54,6 +54,10 @@ This is the initial release.
54
 
55
  == Changelog ==
56
 
 
 
 
 
57
  = 1.3.2 =
58
  * Bug fixes
59
 
4
  Tags: widget, clickable, linkable, linked title, text, php, javascript, flash, linked title text, linked, text widget, PHP Widget, link widget title, bare widget
5
  Requires at least: 2.8
6
  Tested up to: 3.4
7
+ Stable tag: 1.3.3
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.3.3 =
58
+ * Fixes "Do not output before/after_widget/title" option
59
+ * Code cleanup
60
+
61
  = 1.3.2 =
62
  * Bug fixes
63