Enhanced Text Widget - Version 1.3.4

Version Description

This adds option to hide the title

Download this release

Release Info

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

Code changes from version 1.3.3 to 1.3.4

Files changed (2) hide show
  1. enhanced-text-widget.php +32 -13
  2. readme.txt +19 -11
enhanced-text-widget.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
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
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  class EnhancedTextWidget extends WP_Widget {
27
 
28
  function EnhancedTextWidget() {
29
- $widget_ops = array('classname' => 'widget_text', 'description' => __('Linkable titles with text, HTML, CSS, PHP, Flash and/or Javascript.'));
30
  $control_ops = array('width' => 400, 'height' => 350);
31
  $this->WP_Widget('EnhancedTextWidget', __('Enhanced Text'), $widget_ops, $control_ops);
32
  }
@@ -34,6 +34,7 @@ class EnhancedTextWidget extends WP_Widget {
34
  function widget( $args, $instance ) {
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);
@@ -47,17 +48,34 @@ class EnhancedTextWidget extends WP_Widget {
47
  }
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
55
  echo $bare ? '' : $after_widget;
56
  }
57
-
58
  function update( $new_instance, $old_instance ) {
59
  $instance = $old_instance;
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']);
@@ -93,14 +111,15 @@ class EnhancedTextWidget extends WP_Widget {
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>
100
  <p><label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Content:'); ?></label>
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
2
  /*
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.4
7
  Author: Pomelo Design
8
  Author URI: http://pomelodesign.com/
9
  License: GPL2
26
  class EnhancedTextWidget extends WP_Widget {
27
 
28
  function EnhancedTextWidget() {
29
+ $widget_ops = array('classname' => 'widget_text', 'description' => __('Widget supporting Text, HTML, CSS, PHP, Flash, JavaScript, Shortcodes'));
30
  $control_ops = array('width' => 400, 'height' => 350);
31
  $this->WP_Widget('EnhancedTextWidget', __('Enhanced Text'), $widget_ops, $control_ops);
32
  }
34
  function widget( $args, $instance ) {
35
  extract($args);
36
  $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
37
+ $hideTitle = $instance['hideTitle'] ? true : false;
38
  $titleUrl = apply_filters('widget_title', empty($instance['titleUrl']) ? '' : $instance['titleUrl'], $instance);
39
  $newWindow = $instance['newWindow'] ? true : false;
40
  $cssClass = apply_filters('widget_title', empty($instance['cssClass']) ? '' : $instance['cssClass'], $instance);
48
  }
49
  }
50
  echo $bare ? '' : $before_widget;
51
+ if($hideTitle == false) {
52
+ if( $titleUrl && $title ) {
53
+ $title = '<a href="'.$titleUrl.'"'.($newWindow == true?' target="_blank"':'').' title="'.$title.'">'.$title.'</a>';
54
+ }
55
+ if ( !empty( $title ) ) {
56
+ echo $bare ? $title : $before_title . $title . $after_title;
57
+ }
58
+ }
59
+ ?>
60
+ <div class="textwidget">
61
+ <?php if($instance['filter']) {
62
+ ob_start();
63
+ eval("?>$text<?php ");
64
+ $output = ob_get_contents();
65
+ ob_end_clean();
66
+ echo wpautop($output);
67
+ } else {
68
+ eval("?>".$text."<?php ");
69
+ } ?>
70
+ </div>
71
  <?php
72
  echo $bare ? '' : $after_widget;
73
  }
74
+
75
  function update( $new_instance, $old_instance ) {
76
  $instance = $old_instance;
77
  $instance['title'] = strip_tags($new_instance['title']);
78
+ $instance['hideTitle'] = isset($new_instance['hideTitle']);
79
  $instance['titleUrl'] = strip_tags($new_instance['titleUrl']);
80
  $instance['cssClass'] = strip_tags($new_instance['cssClass']);
81
  $instance['newWindow'] = isset($new_instance['newWindow']);
111
  <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>
112
  <p><label for="<?php echo $this->get_field_id('titleUrl'); ?>"><?php _e('URL:'); ?></label>
113
  <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>
114
+
115
+ <p><label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Classes:'); ?></label>
 
116
  <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>
117
  <p><label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Content:'); ?></label>
118
  <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>
119
+ <p><input id="<?php echo $this->get_field_id('hideTitle'); ?>" name="<?php echo $this->get_field_name('hideTitle'); ?>" type="checkbox" <?php checked(isset($instance['hideTitle']) ? $instance['hideTitle'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('hideTitle'); ?>"><?php _e('Do not display the title'); ?></label></p>
120
+ <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); ?> />
121
+ <label for="<?php echo $this->get_field_id('newWindow'); ?>"><?php _e('Open the URL in a new window'); ?></label></p>
122
+ <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 to the content'); ?></label></p>
123
  <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>
124
  <p class="credits"><small>Developed by <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
125
  <?php
readme.txt CHANGED
@@ -1,30 +1,31 @@
1
  === Enhanced Text Widget ===
2
  Contributors: bostondv
3
  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.3
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- 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.
12
 
13
  == Description ==
14
 
15
- 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.
16
 
17
  Options:
18
 
19
  * Title
20
- * Title URL
21
- * Open URL in new window
22
  * Widget CSS class
23
- * Content which support HTML, JavaScript, Flash, PHP, CSS.
 
 
24
  * Automatically add paragraphs
25
- * Bare widget (do not output before/after_widget/title)
26
 
27
- For support please use [github issues](https://github.com/bostondv/enhanced-text-widget/issues). Visit [our website](http://pomelodesign.com), follow [@pomelod](http://twitter.com/pomelod/) or like [on facebook](http://www.facebook.com/pomelodesign/) for updates.
28
 
29
  == Installation ==
30
 
@@ -43,6 +44,9 @@ Nothing right now.
43
 
44
  == Upgrade Notice ==
45
 
 
 
 
46
  = 1.2 =
47
  This adds option to display bare text (no before/after widget/title elements are shown).
48
 
@@ -54,6 +58,10 @@ This is the initial release.
54
 
55
  == Changelog ==
56
 
 
 
 
 
57
  = 1.3.3 =
58
  * Fixes "Do not output before/after_widget/title" option
59
  * Code cleanup
1
  === Enhanced Text Widget ===
2
  Contributors: bostondv
3
  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, widget shortcodes
5
+ Requires at least: 3.0
6
+ Tested up to: 3.5.1
7
+ Stable tag: 1.3.4
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, WordPress Shortcodes and/or PHP as content with linkable widget title.
12
 
13
  == Description ==
14
 
15
+ An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, WordPress Shortcodes and/or PHP as content with linkable widget title.
16
 
17
  Options:
18
 
19
  * Title
20
+ * URL
 
21
  * Widget CSS class
22
+ * Content which supports Text, HTML, CSS, JavaScript, Flash, WordPress Shortcodes and PHP
23
+ * Do not display title
24
+ * Open URL in new window
25
  * Automatically add paragraphs
26
+ * Do not output before/after_widget/title
27
 
28
+ For support please [wordpress.org](http://wordpress.org/support/plugin/enhanced-text-widget). Visit [our website](http://pomelodesign.com), follow [@pomelod](http://twitter.com/pomelod/) or like [on facebook](http://www.facebook.com/pomelodesign/) for updates.
29
 
30
  == Installation ==
31
 
44
 
45
  == Upgrade Notice ==
46
 
47
+ = 1.3.4 =
48
+ This adds option to hide the title
49
+
50
  = 1.2 =
51
  This adds option to display bare text (no before/after widget/title elements are shown).
52
 
58
 
59
  == Changelog ==
60
 
61
+ = 1.3.4 =
62
+ * This adds option to hide the title
63
+ * Tested up to 3.5.1
64
+
65
  = 1.3.3 =
66
  * Fixes "Do not output before/after_widget/title" option
67
  * Code cleanup