Enhanced Text Widget - Version 1.3.1

Version Description

= 1.2 = This adds option to display bare text (no before/after widget/title elements are shown).

= 1.1 = This adds a CSS class parameter to each widget.

= 1.0 = This is the initial release.

Download this release

Release Info

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

Code changes from version 1.3 to 1.3.1

Files changed (2) hide show
  1. enhanced-text-widget.php +25 -12
  2. readme.txt +2 -17
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
7
  Author: Pomelo Design
8
  Author URI: http://pomelodesign.com/
9
  License: GPL2
@@ -37,7 +37,6 @@ class EnhancedTextWidget extends WP_Widget {
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 );
42
  if ( $cssClass ) {
43
  if( strpos($before_widget, 'class') === false ) {
@@ -46,13 +45,13 @@ class EnhancedTextWidget extends WP_Widget {
46
  $before_widget = str_replace('class="', 'class="'. $cssClass . ' ', $before_widget);
47
  }
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
55
- echo $bare ? '' : $after_widget;
56
  }
57
 
58
  function update( $new_instance, $old_instance ) {
@@ -60,7 +59,6 @@ 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'];
@@ -72,12 +70,26 @@ class EnhancedTextWidget extends WP_Widget {
72
 
73
  function form( $instance ) {
74
  $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'titleUrl' => '', 'text' => '' ) );
75
- $title = strip_tags($instance['title']);
76
- $titleUrl = strip_tags($instance['titleUrl']);
77
- $newWindow = $instance['newWindow'] ? 'checked="checked"' : '';
78
- $cssClass = strip_tags($instance['cssClass']);
79
- $bare = $instance['bare'] ? 'checked="checked"' : '';
80
- $text = format_to_edit($instance['text']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  ?>
82
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
83
  <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>
@@ -85,6 +97,7 @@ class EnhancedTextWidget extends WP_Widget {
85
  <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>
86
  <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'); ?>" />
87
  <label for="<?php echo $this->get_field_id('newWindow'); ?>"><?php _e('Open the URL in a new window'); ?></label></p>
 
88
  <p><label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Class:'); ?></label>
89
  <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>
90
  <p><label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Content:'); ?></label>
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.1
7
  Author: Pomelo Design
8
  Author URI: http://pomelodesign.com/
9
  License: GPL2
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
  $text = apply_filters( 'widget_text', $instance['text'], $instance );
41
  if ( $cssClass ) {
42
  if( strpos($before_widget, 'class') === false ) {
45
  $before_widget = str_replace('class="', 'class="'. $cssClass . ' ', $before_widget);
46
  }
47
  }
48
+ echo $before_widget;
49
  if( $titleUrl && $title )
50
  $title = '<a href="'.$titleUrl.'"'.($newWindow == '1'?' target="_blank"':'').' title="'.$title.'">'.$title.'</a>';
51
+ if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
52
  <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>
53
  <?php
54
+ echo $after_widget;
55
  }
56
 
57
  function update( $new_instance, $old_instance ) {
59
  $instance['title'] = strip_tags($new_instance['title']);
60
  $instance['titleUrl'] = strip_tags($new_instance['titleUrl']);
61
  $instance['cssClass'] = strip_tags($new_instance['cssClass']);
 
62
  $instance['newWindow'] = $new_instance['newWindow'] ? 1 : 0;
63
  if ( current_user_can('unfiltered_html') )
64
  $instance['text'] = $new_instance['text'];
70
 
71
  function form( $instance ) {
72
  $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'titleUrl' => '', 'text' => '' ) );
73
+ $title = "";
74
+ if(isset($instance['title'])){
75
+ $title = strip_tags($instance['title']);
76
+ }
77
+ $titleUrl = "";
78
+ if(isset($instance['titleUrl'])){
79
+ $titleUrl = strip_tags($instance['titleUrl']);
80
+ }
81
+ $newWindow = "";
82
+ if(isset($instance['newWindow'])){
83
+ $newWindow = 'checked="checked"';
84
+ }
85
+ $cssClass = "";
86
+ if(isset($instance['cssClass'])){
87
+ $cssClass = strip_tags($instance['cssClass']);
88
+ }
89
+ $text = "";
90
+ if(isset($instance['text'])){
91
+ $text = format_to_edit($instance['text']);
92
+ }
93
  ?>
94
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
95
  <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>
97
  <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>
98
  <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'); ?>" />
99
  <label for="<?php echo $this->get_field_id('newWindow'); ?>"><?php _e('Open the URL in a new window'); ?></label></p>
100
+
101
  <p><label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Class:'); ?></label>
102
  <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>
103
  <p><label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Content:'); ?></label>
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
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,24 +12,10 @@ An enhanced version of the default text widget where you may have Text, HTML, CS
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 supports Text, HTML, CSS, JavaScript, Flash and/or PHP.
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
- <<<<<<< HEAD
30
- =======
31
- Options:
32
-
33
  * Title
34
  * Title URL
35
  * Open URL in new window
@@ -40,7 +26,6 @@ Options:
40
 
41
  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.
42
 
43
- >>>>>>> fix merge
44
  == Installation ==
45
 
46
  1. Download and extract the zip archive
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.1
8
  License: GPL2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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
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
 
31
  1. Download and extract the zip archive