Testimonials Widget - Version 0.2.3

Version Description

  • Allow testimonials to have multiple tags
  • Show only quotes with all tags
Download this release

Release Info

Developer comprock
Plugin Icon wp plugin Testimonials Widget
Version 0.2.3
Comparing to
See all releases

Code changes from version 0.2.2 to 0.2.3

languages/testimonials-widget.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2010 Testimonials Widget
2
  # This file is distributed under the same license as the Testimonials Widget package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Testimonials Widget 0.2.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/testimonials-widget\n"
7
- "POT-Creation-Date: 2012-01-14 08:49:15+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
@@ -206,79 +206,87 @@ msgid_plural "%d testimonials"
206
  msgstr[0] ""
207
  msgstr[1] ""
208
 
209
- #: testimonials-widget-widget.php:23
210
  msgid ""
211
  "Testimonial widget plugin allows you display testimonials in a sidebar on "
212
  "your WordPress blog."
213
  msgstr ""
214
 
215
- #. #-#-#-#-# testimonials-widget.pot (Testimonials Widget 0.2.1) #-#-#-#-#
216
  #. Plugin Name of the plugin/theme
217
- #: testimonials-widget-widget.php:29
218
  msgid "Testimonials Widget"
219
  msgstr ""
220
 
221
- #: testimonials-widget-widget.php:79
222
  msgid "none"
223
  msgstr ""
224
 
225
- #: testimonials-widget-widget.php:96
226
  msgid "Testimonials"
227
  msgstr ""
228
 
229
- #: testimonials-widget-widget.php:116
230
  msgid "Title"
231
  msgstr ""
232
 
233
- #: testimonials-widget-widget.php:117
234
  msgid "Minimum Height"
235
  msgstr ""
236
 
237
- #: testimonials-widget-widget.php:117
238
  msgid ""
239
  "Minimum height in px, this must be set to a value that suits your logest "
240
  "testimonial (increase this value if you find that your testimonials are "
241
  "getting cut off)."
242
  msgstr ""
243
 
244
- #: testimonials-widget-widget.php:118
245
  msgid "Show author?"
246
  msgstr ""
247
 
248
- #: testimonials-widget-widget.php:119
249
  msgid "Show source?"
250
  msgstr ""
251
 
252
- #: testimonials-widget-widget.php:120
253
  msgid "Advanced options"
254
  msgstr ""
255
 
256
- #: testimonials-widget-widget.php:122
257
  msgid "Refresh Interval"
258
  msgstr ""
259
 
260
- #: testimonials-widget-widget.php:122
261
  msgid "In seconds or 0 for no refresh."
262
  msgstr ""
263
 
264
- #: testimonials-widget-widget.php:123
265
  msgid "Random order"
266
  msgstr ""
267
 
268
- #: testimonials-widget-widget.php:123
269
  msgid ""
270
  "Unchecking this will rotate testimonials in the order added, latest first."
271
  msgstr ""
272
 
273
- #: testimonials-widget-widget.php:124
274
  msgid "Tags filter"
275
  msgstr ""
276
 
277
- #: testimonials-widget-widget.php:124
278
  msgid "Comma separated"
279
  msgstr ""
280
 
281
- #: testimonials-widget-widget.php:125
 
 
 
 
 
 
 
 
282
  msgid "Character limit"
283
  msgstr ""
284
 
1
+ # Copyright (C) 2012 Testimonials Widget
2
  # This file is distributed under the same license as the Testimonials Widget package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Testimonials Widget 0.2.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/testimonials-widget\n"
7
+ "POT-Creation-Date: 2012-02-20 09:21:45+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
206
  msgstr[0] ""
207
  msgstr[1] ""
208
 
209
+ #: testimonials-widget-widget.php:24
210
  msgid ""
211
  "Testimonial widget plugin allows you display testimonials in a sidebar on "
212
  "your WordPress blog."
213
  msgstr ""
214
 
215
+ #. #-#-#-#-# testimonials-widget.pot (Testimonials Widget 0.2.3) #-#-#-#-#
216
  #. Plugin Name of the plugin/theme
217
+ #: testimonials-widget-widget.php:30
218
  msgid "Testimonials Widget"
219
  msgstr ""
220
 
221
+ #: testimonials-widget-widget.php:82
222
  msgid "none"
223
  msgstr ""
224
 
225
+ #: testimonials-widget-widget.php:99
226
  msgid "Testimonials"
227
  msgstr ""
228
 
229
+ #: testimonials-widget-widget.php:123
230
  msgid "Title"
231
  msgstr ""
232
 
233
+ #: testimonials-widget-widget.php:124
234
  msgid "Minimum Height"
235
  msgstr ""
236
 
237
+ #: testimonials-widget-widget.php:124
238
  msgid ""
239
  "Minimum height in px, this must be set to a value that suits your logest "
240
  "testimonial (increase this value if you find that your testimonials are "
241
  "getting cut off)."
242
  msgstr ""
243
 
244
+ #: testimonials-widget-widget.php:125
245
  msgid "Show author?"
246
  msgstr ""
247
 
248
+ #: testimonials-widget-widget.php:126
249
  msgid "Show source?"
250
  msgstr ""
251
 
252
+ #: testimonials-widget-widget.php:127
253
  msgid "Advanced options"
254
  msgstr ""
255
 
256
+ #: testimonials-widget-widget.php:129
257
  msgid "Refresh Interval"
258
  msgstr ""
259
 
260
+ #: testimonials-widget-widget.php:129
261
  msgid "In seconds or 0 for no refresh."
262
  msgstr ""
263
 
264
+ #: testimonials-widget-widget.php:130
265
  msgid "Random order"
266
  msgstr ""
267
 
268
+ #: testimonials-widget-widget.php:130
269
  msgid ""
270
  "Unchecking this will rotate testimonials in the order added, latest first."
271
  msgstr ""
272
 
273
+ #: testimonials-widget-widget.php:131
274
  msgid "Tags filter"
275
  msgstr ""
276
 
277
+ #: testimonials-widget-widget.php:131
278
  msgid "Comma separated"
279
  msgstr ""
280
 
281
+ #: testimonials-widget-widget.php:132
282
+ msgid "Require all tags"
283
+ msgstr ""
284
+
285
+ #: testimonials-widget-widget.php:132
286
+ msgid "Checking this will select only testimonials with all of the given tags."
287
+ msgstr ""
288
+
289
+ #: testimonials-widget-widget.php:133
290
  msgid "Character limit"
291
  msgstr ""
292
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: testimonials, quotes, quotations, random quote, sidebar, widget
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
- Stable tag: 0.2.2
8
 
9
  Testimonials widget plugin allows you display testimonials in a widget on your WordPress blog.
10
 
@@ -29,6 +29,7 @@ You can make a simple client or portfolio rotator by using the testimonial field
29
  * Choose refresh interval in seconds or set to 0 for static display
30
  * Choose random or sequential order for refresh
31
  * Show only quotes with certain tags
 
32
  * Specify a character limit to filter out longer quotes
33
  * Allows for multiple widgets. Useful for using tags to keep widgets separated.
34
  * Compatible with WordPress 3.0 multi-site functionality.
@@ -44,6 +45,10 @@ Check out the [Quotes Collection](http://wordpress.org/extend/plugins/quotes-col
44
 
45
  == Frequently Asked Questions ==
46
 
 
 
 
 
47
  = How to stop testimonial text/author/source being cut off? =
48
 
49
  Specify a larger minimum height in the testimonials widget, see screenshot 2.
@@ -82,6 +87,10 @@ Change the value of the variable `$testimonialswidget_admin_userlevel` on line 3
82
  = trunk =
83
  -
84
 
 
 
 
 
85
  = 0.2.2 =
86
  * Show newest testimonials first in admin list by default
87
  * Quick locallization
4
  Tags: testimonials, quotes, quotations, random quote, sidebar, widget
5
  Requires at least: 3.0
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.2.3
8
 
9
  Testimonials widget plugin allows you display testimonials in a widget on your WordPress blog.
10
 
29
  * Choose refresh interval in seconds or set to 0 for static display
30
  * Choose random or sequential order for refresh
31
  * Show only quotes with certain tags
32
+ * Show only quotes with all tags
33
  * Specify a character limit to filter out longer quotes
34
  * Allows for multiple widgets. Useful for using tags to keep widgets separated.
35
  * Compatible with WordPress 3.0 multi-site functionality.
45
 
46
  == Frequently Asked Questions ==
47
 
48
+ = I'm not seeing any testimonials but the title =
49
+
50
+ If you're not seeing any testimonials, even when not using tags filter, you might try increasing the Character limit or setting it to '0' or 'none' in the widget box.
51
+
52
  = How to stop testimonial text/author/source being cut off? =
53
 
54
  Specify a larger minimum height in the testimonials widget, see screenshot 2.
87
  = trunk =
88
  -
89
 
90
+ = 0.2.3 =
91
+ * Allow testimonials to have multiple tags
92
+ * Show only quotes with all tags
93
+
94
  = 0.2.2 =
95
  * Show newest testimonials first in admin list by default
96
  * Quick locallization
screenshot-3.png CHANGED
Binary file
testimonials-widget-widget.php CHANGED
@@ -42,11 +42,12 @@ class testimonials_widget extends WP_Widget {
42
  $show_author = $instance['show_author'];
43
  $show_source = $instance['show_source'];
44
  $random_order = $instance['random_order'];
 
45
  $refresh_interval = $instance['refresh_interval'];
46
  $char_limit = $instance['char_limit'];
47
  $tags = $instance['tags'];
48
 
49
- $testimonials = testimonialswidget_display_testimonials($title, $random_order, $min_height, $refresh_interval, $show_source, $show_author, $tags, $char_limit, $this->number);
50
 
51
  /* Before widget (defined by themes). */
52
  echo $before_widget;
@@ -74,6 +75,7 @@ class testimonials_widget extends WP_Widget {
74
  $instance['show_source'] = (isset($new_instance['show_source']) && $new_instance['show_source'])?1:0;
75
  $instance['refresh_interval'] = strip_tags(stripslashes($new_instance['refresh_interval']));
76
  $instance['random_order'] = (isset($new_instance['random_order']) && $new_instance['random_order'])?1:0;
 
77
  $instance['tags'] = strip_tags(stripslashes($new_instance['tags']));
78
  $instance['char_limit'] = strip_tags(stripslashes($new_instance['char_limit']));
79
  if(!$instance['char_limit'])
@@ -99,6 +101,7 @@ class testimonials_widget extends WP_Widget {
99
  'show_author' => 1,
100
  'show_source' => 1,
101
  'random_order' => 1,
 
102
  'refresh_interval' => 10,
103
  'tags' => '',
104
  'char_limit' => 500
@@ -106,13 +109,16 @@ class testimonials_widget extends WP_Widget {
106
  $instance = wp_parse_args( (array) $instance, $defaults );
107
 
108
  // Now we define the display of widget options menu
109
- $show_author_checked = $show_source_checked = $random_order_checked = '';
 
110
  if($instance['show_author'])
111
  $show_author_checked = ' checked="checked"';
112
  if($instance['show_source'])
113
  $show_source_checked = ' checked="checked"';
114
  if($instance['random_order'])
115
  $random_order_checked = ' checked="checked"';
 
 
116
 
117
  echo '<p><label for="'.$this->get_field_id( 'title' ).'">'.__('Title', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" value="'.htmlspecialchars($instance['title'], ENT_QUOTES).'" /></p>';
118
  echo '<p><label for="'.$this->get_field_id( 'min_height' ).'">'.__('Minimum Height', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'min_height' ).'" name="'.$this->get_field_name( 'min_height' ).'" value="'.htmlspecialchars($instance['min_height'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('Minimum height in px, this must be set to a value that suits your logest testimonial (increase this value if you find that your testimonials are getting cut off).', 'testimonials-widget').'</small></span></p>';
@@ -123,6 +129,7 @@ class testimonials_widget extends WP_Widget {
123
  echo '<p><label for="'.$this->get_field_id( 'refresh_interval' ).'">'.__('Refresh Interval', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'refresh_interval' ).'" name="'.$this->get_field_name( 'refresh_interval' ).'" value="'.htmlspecialchars($instance['refresh_interval'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('In seconds or 0 for no refresh.', 'testimonials-widget').'</small></span></p>';
124
  echo '<p><input type="checkbox" id="'.$this->get_field_id( 'random_order' ).'" name="'.$this->get_field_name( 'random_order' ).'" value="1"'.$random_order_checked.' /> <label for="'.$this->get_field_id( 'random_order' ).'">'.__('Random order', 'testimonials-widget').'</label><br/><span class="setting-description"><small>'.__('Unchecking this will rotate testimonials in the order added, latest first.', 'testimonials-widget').'</small></span></p>';
125
  echo '<p><label for="'.$this->get_field_id( 'tags' ).'">'.__('Tags filter', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'tags' ).'" name="'.$this->get_field_name( 'tags' ).'" value="'.htmlspecialchars($instance['tags'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('Comma separated', 'testimonials-widget').'</small></span></p>';
 
126
  echo '<p><label for="'.$this->get_field_id( 'char_limit' ).'">'.__('Character limit', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'char_limit' ).'" name="'.$this->get_field_name( 'char_limit' ).'" value="'.htmlspecialchars($instance['char_limit'], ENT_QUOTES).'" /></p>';
127
  echo '</div>';
128
  }
42
  $show_author = $instance['show_author'];
43
  $show_source = $instance['show_source'];
44
  $random_order = $instance['random_order'];
45
+ $tags_all = $instance['tags_all'];
46
  $refresh_interval = $instance['refresh_interval'];
47
  $char_limit = $instance['char_limit'];
48
  $tags = $instance['tags'];
49
 
50
+ $testimonials = testimonialswidget_display_testimonials($title, $random_order, $min_height, $refresh_interval, $show_source, $show_author, $tags, $char_limit, $this->number, $tags_all);
51
 
52
  /* Before widget (defined by themes). */
53
  echo $before_widget;
75
  $instance['show_source'] = (isset($new_instance['show_source']) && $new_instance['show_source'])?1:0;
76
  $instance['refresh_interval'] = strip_tags(stripslashes($new_instance['refresh_interval']));
77
  $instance['random_order'] = (isset($new_instance['random_order']) && $new_instance['random_order'])?1:0;
78
+ $instance['tags_all'] = (isset($new_instance['tags_all']) && $new_instance['tags_all'])?1:0;
79
  $instance['tags'] = strip_tags(stripslashes($new_instance['tags']));
80
  $instance['char_limit'] = strip_tags(stripslashes($new_instance['char_limit']));
81
  if(!$instance['char_limit'])
101
  'show_author' => 1,
102
  'show_source' => 1,
103
  'random_order' => 1,
104
+ 'tags_all' => 0,
105
  'refresh_interval' => 10,
106
  'tags' => '',
107
  'char_limit' => 500
109
  $instance = wp_parse_args( (array) $instance, $defaults );
110
 
111
  // Now we define the display of widget options menu
112
+ $show_author_checked = $show_source_checked = $random_order_checked = $tags_all_checked = '';
113
+
114
  if($instance['show_author'])
115
  $show_author_checked = ' checked="checked"';
116
  if($instance['show_source'])
117
  $show_source_checked = ' checked="checked"';
118
  if($instance['random_order'])
119
  $random_order_checked = ' checked="checked"';
120
+ if($instance['tags_all'])
121
+ $tags_all_checked = ' checked="checked"';
122
 
123
  echo '<p><label for="'.$this->get_field_id( 'title' ).'">'.__('Title', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" value="'.htmlspecialchars($instance['title'], ENT_QUOTES).'" /></p>';
124
  echo '<p><label for="'.$this->get_field_id( 'min_height' ).'">'.__('Minimum Height', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'min_height' ).'" name="'.$this->get_field_name( 'min_height' ).'" value="'.htmlspecialchars($instance['min_height'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('Minimum height in px, this must be set to a value that suits your logest testimonial (increase this value if you find that your testimonials are getting cut off).', 'testimonials-widget').'</small></span></p>';
129
  echo '<p><label for="'.$this->get_field_id( 'refresh_interval' ).'">'.__('Refresh Interval', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'refresh_interval' ).'" name="'.$this->get_field_name( 'refresh_interval' ).'" value="'.htmlspecialchars($instance['refresh_interval'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('In seconds or 0 for no refresh.', 'testimonials-widget').'</small></span></p>';
130
  echo '<p><input type="checkbox" id="'.$this->get_field_id( 'random_order' ).'" name="'.$this->get_field_name( 'random_order' ).'" value="1"'.$random_order_checked.' /> <label for="'.$this->get_field_id( 'random_order' ).'">'.__('Random order', 'testimonials-widget').'</label><br/><span class="setting-description"><small>'.__('Unchecking this will rotate testimonials in the order added, latest first.', 'testimonials-widget').'</small></span></p>';
131
  echo '<p><label for="'.$this->get_field_id( 'tags' ).'">'.__('Tags filter', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'tags' ).'" name="'.$this->get_field_name( 'tags' ).'" value="'.htmlspecialchars($instance['tags'], ENT_QUOTES).'" /><br/><span class="setting-description"><small>'.__('Comma separated', 'testimonials-widget').'</small></span></p>';
132
+ echo '<p><input type="checkbox" id="'.$this->get_field_id( 'tags_all' ).'" name="'.$this->get_field_name( 'tags_all' ).'" value="1"'.$tags_all_checked.' /> <label for="'.$this->get_field_id( 'tags_all' ).'">'.__('Require all tags', 'testimonials-widget').'</label><br/><span class="setting-description"><small>'.__('Checking this will select only testimonials with all of the given tags.', 'testimonials-widget').'</small></span></p>';
133
  echo '<p><label for="'.$this->get_field_id( 'char_limit' ).'">'.__('Character limit', 'testimonials-widget').' </label><input class="widefat" type="text" id="'.$this->get_field_id( 'char_limit' ).'" name="'.$this->get_field_name( 'char_limit' ).'" value="'.htmlspecialchars($instance['char_limit'], ENT_QUOTES).'" /></p>';
134
  echo '</div>';
135
  }
testimonials-widget.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /*
3
  Plugin Name: Testimonials Widget
4
- Description: Testimonial widget plugin helps you display testimonials in a widget on your WordPress blog.
5
- Version: 0.2.2
6
  Author: comprock, j0hnsmith
7
  License: GPL2
8
  */
@@ -41,7 +41,7 @@ require_once('testimonials-widget-widget.php');
41
  require_once('testimonials-widget-admin.php');
42
 
43
 
44
- function testimonialswidget_display_testimonials($title = '', $random = 1, $min_height, $refresh_interval = 10, $show_source = 0, $show_author = 1, $tags = '', $char_limit = 500, $widget_number = '') {
45
  $conditions = " WHERE public = 'yes'";
46
 
47
  if(char_limit && is_numeric($char_limit)) {
@@ -55,8 +55,14 @@ function testimonialswidget_display_testimonials($title = '', $random = 1, $min_
55
  $tag_conditions = '';
56
  foreach($taglist as $tag) {
57
  $tag = mysql_real_escape_string(strip_tags(trim($tag)));
58
- if($tag_conditions) $tag_conditions .= " OR ";
59
- $tag_conditions .= "tags = '{$tag}'";
 
 
 
 
 
 
60
  }
61
  $conditions .= " AND ({$tag_conditions})";
62
  }
1
  <?php
2
  /*
3
  Plugin Name: Testimonials Widget
4
+ Description: Testimonial widget plugin helps you display testimonials in a sidebar on your WordPress blog.
5
+ Version: 0.2.3
6
  Author: comprock, j0hnsmith
7
  License: GPL2
8
  */
41
  require_once('testimonials-widget-admin.php');
42
 
43
 
44
+ function testimonialswidget_display_testimonials($title = '', $random = 1, $min_height, $refresh_interval = 10, $show_source = 0, $show_author = 1, $tags = '', $char_limit = 500, $widget_number = '', $tags_all = 0) {
45
  $conditions = " WHERE public = 'yes'";
46
 
47
  if(char_limit && is_numeric($char_limit)) {
55
  $tag_conditions = '';
56
  foreach($taglist as $tag) {
57
  $tag = mysql_real_escape_string(strip_tags(trim($tag)));
58
+ if($tag_conditions) {
59
+ if ( $tags_all ) {
60
+ $tag_conditions .= ' AND ';
61
+ } else {
62
+ $tag_conditions .= ' OR ';
63
+ }
64
+ }
65
+ $tag_conditions .= "FIND_IN_SET('{$tag}', tags)";
66
  }
67
  $conditions .= " AND ({$tag_conditions})";
68
  }