Testimonials by WooThemes - Version 1.3.0

Version Description

  • Adds "woothemes_testimonials_content" filter and shortcode support. Adds "testimonial-category" taxonomy.
Download this release

Release Info

Developer mattyza
Plugin Icon wp plugin Testimonials by WooThemes
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.1 to 1.3.0

classes/class-woothemes-testimonials-taxonomy.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
3
+
4
+ /**
5
+ * WooThemes Testimonials Taxonomy Class
6
+ *
7
+ * Re-usable class for registering testimonial taxonomies.
8
+ *
9
+ * @package WordPress
10
+ * @subpackage Woothemes_Testimonials
11
+ * @category Plugin
12
+ * @author Matty
13
+ * @since 1.3.0
14
+ */
15
+ class Woothemes_Testimonials_Taxonomy {
16
+ /**
17
+ * The post type to register the taxonomy for.
18
+ * @access private
19
+ * @since 1.3.0
20
+ * @var string
21
+ */
22
+ private $post_type;
23
+
24
+ /**
25
+ * The key of the taxonomy.
26
+ * @access private
27
+ * @since 1.3.0
28
+ * @var string
29
+ */
30
+ private $token;
31
+
32
+ /**
33
+ * The singular name for the taxonomy.
34
+ * @access private
35
+ * @since 1.3.0
36
+ * @var string
37
+ */
38
+ private $singular;
39
+
40
+ /**
41
+ * The plural name for the taxonomy.
42
+ * @access private
43
+ * @since 1.3.0
44
+ * @var string
45
+ */
46
+ private $plural;
47
+
48
+ /**
49
+ * The arguments to use when registering the taxonomy.
50
+ * @access private
51
+ * @since 1.3.0
52
+ * @var string
53
+ */
54
+ private $args;
55
+
56
+ /**
57
+ * Class constructor.
58
+ * @access public
59
+ * @since 1.3.0
60
+ * @param string $token The taxonomy key.
61
+ * @param string $singular Singular name.
62
+ * @param string $plural Plural name.
63
+ * @param array $args Array of argument overrides.
64
+ */
65
+ public function __construct ( $token = 'testimonial-category', $singular = '', $plural = '', $args = array() ) {
66
+ $this->post_type = 'testimonial';
67
+ $this->token = esc_attr( $token );
68
+ $this->singular = esc_html( $singular );
69
+ $this->plural = esc_html( $plural );
70
+
71
+ if ( '' == $this->singular ) $this->singular = __( 'Category', 'woothemes-testimonials' );
72
+ if ( '' == $this->plural ) $this->plural = __( 'Categories', 'woothemes-testimonials' );
73
+
74
+ $this->args = wp_parse_args( $args, $this->_get_default_args() );
75
+ } // End __construct()
76
+
77
+ /**
78
+ * Return an array of default arguments.
79
+ * @access private
80
+ * @since 1.3.0
81
+ * @return array Default arguments.
82
+ */
83
+ private function _get_default_args () {
84
+ return array( 'labels' => $this->_get_default_labels(), 'public' => true, 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'show_in_nav_menus' => false, 'show_tagcloud' => false );
85
+ } // End _get_default_args()
86
+
87
+ /**
88
+ * Return an array of default labels.
89
+ * @access private
90
+ * @since 1.3.0
91
+ * @return array Default labels.
92
+ */
93
+ private function _get_default_labels () {
94
+ return array(
95
+ 'name' => sprintf( _x( '%s', 'taxonomy general name', 'woothemes-testimonials' ), $this->plural ),
96
+ 'singular_name' => sprintf( _x( '%s', 'taxonomy singular name', 'woothemes-testimonials' ), $this->singular ),
97
+ 'search_items' => sprintf( __( 'Search %s', 'woothemes-testimonials' ), $this->plural ),
98
+ 'all_items' => sprintf( __( 'All %s', 'woothemes-testimonials' ), $this->plural ),
99
+ 'parent_item' => sprintf( __( 'Parent %s', 'woothemes-testimonials' ), $this->singular ),
100
+ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'woothemes-testimonials' ), $this->singular ),
101
+ 'edit_item' => sprintf( __( 'Edit %s', 'woothemes-testimonials' ), $this->singular ),
102
+ 'update_item' => sprintf( __( 'Update %s', 'woothemes-testimonials' ), $this->singular ),
103
+ 'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-testimonials' ), $this->singular ),
104
+ 'new_item_name' => sprintf( __( 'New %s Name', 'woothemes-testimonials' ), $this->singular ),
105
+ 'menu_name' => sprintf( __( '%s', 'woothemes-testimonials' ), $this->plural )
106
+ );
107
+ } // End _get_default_labels()
108
+
109
+ /**
110
+ * Register the taxonomy.
111
+ * @access public
112
+ * @since 1.3.0
113
+ * @return void
114
+ */
115
+ public function register () {
116
+ register_taxonomy( esc_attr( $this->token ), esc_attr( $this->post_type ), (array)$this->args );
117
+ } // End register()
118
+ } // End Class
119
+ ?>
classes/class-woothemes-testimonials.php CHANGED
@@ -22,7 +22,7 @@ class Woothemes_Testimonials {
22
 
23
  /**
24
  * Constructor function.
25
- *
26
  * @access public
27
  * @since 1.0.0
28
  * @return void
@@ -41,6 +41,7 @@ class Woothemes_Testimonials {
41
  register_activation_hook( $this->file, array( &$this, 'activation' ) );
42
 
43
  add_action( 'init', array( &$this, 'register_post_type' ) );
 
44
 
45
  if ( is_admin() ) {
46
  global $pagenow;
@@ -62,7 +63,7 @@ class Woothemes_Testimonials {
62
 
63
  /**
64
  * Register the post type.
65
- *
66
  * @access public
67
  * @param string $token
68
  * @param string 'Testimonial'
@@ -98,16 +99,27 @@ class Woothemes_Testimonials {
98
  'capability_type' => 'post',
99
  'has_archive' => 'testimonials',
100
  'hierarchical' => false,
101
- 'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
102
- 'menu_position' => 5,
103
  'menu_icon' => ''
104
  );
105
  register_post_type( $this->token, $args );
106
  } // End register_post_type()
107
 
 
 
 
 
 
 
 
 
 
 
 
108
  /**
109
  * Add custom columns for the "manage" screen of this post type.
110
- *
111
  * @access public
112
  * @param string $column_name
113
  * @param int $id
@@ -116,11 +128,11 @@ class Woothemes_Testimonials {
116
  */
117
  public function register_custom_columns ( $column_name, $id ) {
118
  global $wpdb, $post;
119
-
120
  $meta = get_post_custom( $id );
121
 
122
  switch ( $column_name ) {
123
-
124
  case 'image':
125
  $value = '';
126
 
@@ -131,13 +143,13 @@ class Woothemes_Testimonials {
131
 
132
  default:
133
  break;
134
-
135
  }
136
  } // End register_custom_columns()
137
-
138
  /**
139
  * Add custom column headings for the "manage" screen of this post type.
140
- *
141
  * @access public
142
  * @param array $defaults
143
  * @since 1.0.0
@@ -145,25 +157,25 @@ class Woothemes_Testimonials {
145
  */
146
  public function register_custom_column_headings ( $defaults ) {
147
  $new_columns = array( 'image' => __( 'Image', 'woothemes-testimonials' ) );
148
-
149
  $last_item = '';
150
 
151
  if ( isset( $defaults['date'] ) ) { unset( $defaults['date'] ); }
152
 
153
- if ( count( $defaults ) > 2 ) {
154
  $last_item = array_slice( $defaults, -1 );
155
 
156
  array_pop( $defaults );
157
  }
158
  $defaults = array_merge( $defaults, $new_columns );
159
-
160
  if ( $last_item != '' ) {
161
  foreach ( $last_item as $k => $v ) {
162
  $defaults[$k] = $v;
163
  break;
164
  }
165
  }
166
-
167
  return $defaults;
168
  } // End register_custom_column_headings()
169
 
@@ -198,18 +210,18 @@ class Woothemes_Testimonials {
198
 
199
  /**
200
  * Setup the meta box.
201
- *
202
  * @access public
203
  * @since 1.0.0
204
  * @return void
205
  */
206
- public function meta_box_setup () {
207
  add_meta_box( 'testimonial-data', __( 'Testimonial Details', 'woothemes-testimonials' ), array( &$this, 'meta_box_content' ), $this->token, 'normal', 'high' );
208
  } // End meta_box_setup()
209
-
210
  /**
211
  * The contents of our meta box.
212
- *
213
  * @access public
214
  * @since 1.0.0
215
  * @return void
@@ -220,9 +232,9 @@ class Woothemes_Testimonials {
220
  $field_data = $this->get_custom_fields_settings();
221
 
222
  $html = '';
223
-
224
  $html .= '<input type="hidden" name="woo_' . $this->token . '_noonce" id="woo_' . $this->token . '_noonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />';
225
-
226
  if ( 0 < count( $field_data ) ) {
227
  $html .= '<table class="form-table">' . "\n";
228
  $html .= '<tbody>' . "\n";
@@ -241,13 +253,13 @@ class Woothemes_Testimonials {
241
  $html .= '</tbody>' . "\n";
242
  $html .= '</table>' . "\n";
243
  }
244
-
245
- echo $html;
246
  } // End meta_box_content()
247
-
248
  /**
249
  * Save meta box fields.
250
- *
251
  * @access public
252
  * @since 1.0.0
253
  * @param int $post_id
@@ -257,45 +269,45 @@ class Woothemes_Testimonials {
257
  global $post, $messages;
258
 
259
  // Verify
260
- if ( ( get_post_type() != $this->token ) || ! wp_verify_nonce( $_POST['woo_' . $this->token . '_noonce'], plugin_basename( $this->dir ) ) ) {
261
- return $post_id;
262
  }
263
-
264
- if ( 'page' == $_POST['post_type'] ) {
265
- if ( ! current_user_can( 'edit_page', $post_id ) ) {
266
  return $post_id;
267
  }
268
- } else {
269
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
270
  return $post_id;
271
  }
272
  }
273
-
274
  $field_data = $this->get_custom_fields_settings();
275
  $fields = array_keys( $field_data );
276
-
277
  foreach ( $fields as $f ) {
278
-
279
  ${$f} = strip_tags(trim($_POST[$f]));
280
 
281
  // Escape the URLs.
282
  if ( 'url' == $field_data[$f]['type'] ) {
283
  ${$f} = esc_url( ${$f} );
284
  }
285
-
286
- if ( get_post_meta( $post_id, '_' . $f ) == '' ) {
287
- add_post_meta( $post_id, '_' . $f, ${$f}, true );
288
- } elseif( ${$f} != get_post_meta( $post_id, '_' . $f, true ) ) {
289
  update_post_meta( $post_id, '_' . $f, ${$f} );
290
- } elseif ( ${$f} == '' ) {
291
  delete_post_meta( $post_id, '_' . $f, get_post_meta( $post_id, '_' . $f, true ) );
292
- }
293
  }
294
  } // End meta_box_save()
295
 
296
  /**
297
  * Customise the "Enter title here" text.
298
- *
299
  * @access public
300
  * @since 1.0.0
301
  * @param string $title
@@ -310,7 +322,7 @@ class Woothemes_Testimonials {
310
 
311
  /**
312
  * Enqueue post type admin CSS.
313
- *
314
  * @access public
315
  * @since 1.0.0
316
  * @return void
@@ -329,26 +341,26 @@ class Woothemes_Testimonials {
329
  $fields = array();
330
 
331
  $fields['gravatar_email'] = array(
332
- 'name' => __( 'Gravatar E-mail Address', 'woothemes-testimonials' ),
333
- 'description' => sprintf( __( 'Enter in an e-mail address, to use a %sGravatar%s, instead of using the "Featured Image".', 'woothemes-testimonials' ), '<a href="' . esc_url( 'http://gravatar.com/' ) . '" target="_blank">', '</a>' ),
334
- 'type' => 'text',
335
- 'default' => '',
336
  'section' => 'info'
337
  );
338
 
339
  $fields['byline'] = array(
340
- 'name' => __( 'Byline', 'woothemes-testimonials' ),
341
- 'description' => __( 'Enter a byline for the customer giving this testimonial (for example: "CEO of WooThemes").', 'woothemes-testimonials' ),
342
- 'type' => 'text',
343
- 'default' => '',
344
  'section' => 'info'
345
  );
346
 
347
  $fields['url'] = array(
348
- 'name' => __( 'URL', 'woothemes-testimonials' ),
349
- 'description' => __( 'Enter a URL that applies to this customer (for example: http://woothemes.com/).', 'woothemes-testimonials' ),
350
- 'type' => 'url',
351
- 'default' => '',
352
  'section' => 'info'
353
  );
354
 
@@ -372,7 +384,7 @@ class Woothemes_Testimonials {
372
  } elseif ( ! is_string( $size ) && ! is_array( $size ) ) {
373
  $size = array( 50, 50 );
374
  }
375
- $response = get_the_post_thumbnail( intval( $id ), $size );
376
  } else {
377
  $gravatar_email = get_post_meta( $id, '_gravatar_email', true );
378
  if ( '' != $gravatar_email && is_email( $gravatar_email ) ) {
@@ -391,17 +403,18 @@ class Woothemes_Testimonials {
391
  */
392
  public function get_testimonials ( $args = '' ) {
393
  $defaults = array(
394
- 'limit' => 5,
395
- 'orderby' => 'menu_order',
396
- 'order' => 'DESC',
397
- 'id' => 0
 
398
  );
399
-
400
  $args = wp_parse_args( $args, $defaults );
401
-
402
  // Allow child themes/plugins to filter here.
403
  $args = apply_filters( 'woothemes_get_testimonials_args', $args );
404
-
405
  // The Query Arguments.
406
  $query_args = array();
407
  $query_args['post_type'] = 'testimonial';
@@ -409,27 +422,46 @@ class Woothemes_Testimonials {
409
  $query_args['orderby'] = $args['orderby'];
410
  $query_args['order'] = $args['order'];
411
  $query_args['suppress_filters'] = false;
412
-
413
  if ( is_numeric( $args['id'] ) && ( intval( $args['id'] ) > 0 ) ) {
414
  $query_args['p'] = intval( $args['id'] );
415
  }
416
-
417
  // Whitelist checks.
418
  if ( ! in_array( $query_args['orderby'], array( 'none', 'ID', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order', 'meta_value', 'meta_value_num' ) ) ) {
419
  $query_args['orderby'] = 'date';
420
  }
421
-
422
  if ( ! in_array( $query_args['order'], array( 'ASC', 'DESC' ) ) ) {
423
  $query_args['order'] = 'DESC';
424
  }
425
-
426
  if ( ! in_array( $query_args['post_type'], get_post_types() ) ) {
427
  $query_args['post_type'] = 'testimonial';
428
  }
429
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  // The Query.
431
  $query = get_posts( $query_args );
432
-
433
  // The Display.
434
  if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
435
  foreach ( $query as $k => $v ) {
@@ -449,7 +481,7 @@ class Woothemes_Testimonials {
449
  } else {
450
  $query = false;
451
  }
452
-
453
  return $query;
454
  } // End get_testimonials()
455
 
@@ -472,7 +504,7 @@ class Woothemes_Testimonials {
472
  $domain = 'woothemes-testimonials';
473
  // The "plugin_locale" filter is also used in load_plugin_textdomain()
474
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
475
-
476
  load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
477
  load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( $this->file ) ) . '/lang/' );
478
  } // End load_plugin_textdomain()
22
 
23
  /**
24
  * Constructor function.
25
+ *
26
  * @access public
27
  * @since 1.0.0
28
  * @return void
41
  register_activation_hook( $this->file, array( &$this, 'activation' ) );
42
 
43
  add_action( 'init', array( &$this, 'register_post_type' ) );
44
+ add_action( 'init', array( $this, 'register_taxonomy' ) );
45
 
46
  if ( is_admin() ) {
47
  global $pagenow;
63
 
64
  /**
65
  * Register the post type.
66
+ *
67
  * @access public
68
  * @param string $token
69
  * @param string 'Testimonial'
99
  'capability_type' => 'post',
100
  'has_archive' => 'testimonials',
101
  'hierarchical' => false,
102
+ 'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
103
+ 'menu_position' => 5,
104
  'menu_icon' => ''
105
  );
106
  register_post_type( $this->token, $args );
107
  } // End register_post_type()
108
 
109
+ /**
110
+ * Register the "testimonial-category" taxonomy.
111
+ * @access public
112
+ * @since 1.3.0
113
+ * @return void
114
+ */
115
+ public function register_taxonomy () {
116
+ $this->taxonomy_category = new Woothemes_Testimonials_Taxonomy(); // Leave arguments empty, to use the default arguments.
117
+ $this->taxonomy_category->register();
118
+ } // End register_taxonomy()
119
+
120
  /**
121
  * Add custom columns for the "manage" screen of this post type.
122
+ *
123
  * @access public
124
  * @param string $column_name
125
  * @param int $id
128
  */
129
  public function register_custom_columns ( $column_name, $id ) {
130
  global $wpdb, $post;
131
+
132
  $meta = get_post_custom( $id );
133
 
134
  switch ( $column_name ) {
135
+
136
  case 'image':
137
  $value = '';
138
 
143
 
144
  default:
145
  break;
146
+
147
  }
148
  } // End register_custom_columns()
149
+
150
  /**
151
  * Add custom column headings for the "manage" screen of this post type.
152
+ *
153
  * @access public
154
  * @param array $defaults
155
  * @since 1.0.0
157
  */
158
  public function register_custom_column_headings ( $defaults ) {
159
  $new_columns = array( 'image' => __( 'Image', 'woothemes-testimonials' ) );
160
+
161
  $last_item = '';
162
 
163
  if ( isset( $defaults['date'] ) ) { unset( $defaults['date'] ); }
164
 
165
+ if ( count( $defaults ) > 2 ) {
166
  $last_item = array_slice( $defaults, -1 );
167
 
168
  array_pop( $defaults );
169
  }
170
  $defaults = array_merge( $defaults, $new_columns );
171
+
172
  if ( $last_item != '' ) {
173
  foreach ( $last_item as $k => $v ) {
174
  $defaults[$k] = $v;
175
  break;
176
  }
177
  }
178
+
179
  return $defaults;
180
  } // End register_custom_column_headings()
181
 
210
 
211
  /**
212
  * Setup the meta box.
213
+ *
214
  * @access public
215
  * @since 1.0.0
216
  * @return void
217
  */
218
+ public function meta_box_setup () {
219
  add_meta_box( 'testimonial-data', __( 'Testimonial Details', 'woothemes-testimonials' ), array( &$this, 'meta_box_content' ), $this->token, 'normal', 'high' );
220
  } // End meta_box_setup()
221
+
222
  /**
223
  * The contents of our meta box.
224
+ *
225
  * @access public
226
  * @since 1.0.0
227
  * @return void
232
  $field_data = $this->get_custom_fields_settings();
233
 
234
  $html = '';
235
+
236
  $html .= '<input type="hidden" name="woo_' . $this->token . '_noonce" id="woo_' . $this->token . '_noonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />';
237
+
238
  if ( 0 < count( $field_data ) ) {
239
  $html .= '<table class="form-table">' . "\n";
240
  $html .= '<tbody>' . "\n";
253
  $html .= '</tbody>' . "\n";
254
  $html .= '</table>' . "\n";
255
  }
256
+
257
+ echo $html;
258
  } // End meta_box_content()
259
+
260
  /**
261
  * Save meta box fields.
262
+ *
263
  * @access public
264
  * @since 1.0.0
265
  * @param int $post_id
269
  global $post, $messages;
270
 
271
  // Verify
272
+ if ( ( get_post_type() != $this->token ) || ! wp_verify_nonce( $_POST['woo_' . $this->token . '_noonce'], plugin_basename( $this->dir ) ) ) {
273
+ return $post_id;
274
  }
275
+
276
+ if ( 'page' == $_POST['post_type'] ) {
277
+ if ( ! current_user_can( 'edit_page', $post_id ) ) {
278
  return $post_id;
279
  }
280
+ } else {
281
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
282
  return $post_id;
283
  }
284
  }
285
+
286
  $field_data = $this->get_custom_fields_settings();
287
  $fields = array_keys( $field_data );
288
+
289
  foreach ( $fields as $f ) {
290
+
291
  ${$f} = strip_tags(trim($_POST[$f]));
292
 
293
  // Escape the URLs.
294
  if ( 'url' == $field_data[$f]['type'] ) {
295
  ${$f} = esc_url( ${$f} );
296
  }
297
+
298
+ if ( get_post_meta( $post_id, '_' . $f ) == '' ) {
299
+ add_post_meta( $post_id, '_' . $f, ${$f}, true );
300
+ } elseif( ${$f} != get_post_meta( $post_id, '_' . $f, true ) ) {
301
  update_post_meta( $post_id, '_' . $f, ${$f} );
302
+ } elseif ( ${$f} == '' ) {
303
  delete_post_meta( $post_id, '_' . $f, get_post_meta( $post_id, '_' . $f, true ) );
304
+ }
305
  }
306
  } // End meta_box_save()
307
 
308
  /**
309
  * Customise the "Enter title here" text.
310
+ *
311
  * @access public
312
  * @since 1.0.0
313
  * @param string $title
322
 
323
  /**
324
  * Enqueue post type admin CSS.
325
+ *
326
  * @access public
327
  * @since 1.0.0
328
  * @return void
341
  $fields = array();
342
 
343
  $fields['gravatar_email'] = array(
344
+ 'name' => __( 'Gravatar E-mail Address', 'woothemes-testimonials' ),
345
+ 'description' => sprintf( __( 'Enter in an e-mail address, to use a %sGravatar%s, instead of using the "Featured Image".', 'woothemes-testimonials' ), '<a href="' . esc_url( 'http://gravatar.com/' ) . '" target="_blank">', '</a>' ),
346
+ 'type' => 'text',
347
+ 'default' => '',
348
  'section' => 'info'
349
  );
350
 
351
  $fields['byline'] = array(
352
+ 'name' => __( 'Byline', 'woothemes-testimonials' ),
353
+ 'description' => __( 'Enter a byline for the customer giving this testimonial (for example: "CEO of WooThemes").', 'woothemes-testimonials' ),
354
+ 'type' => 'text',
355
+ 'default' => '',
356
  'section' => 'info'
357
  );
358
 
359
  $fields['url'] = array(
360
+ 'name' => __( 'URL', 'woothemes-testimonials' ),
361
+ 'description' => __( 'Enter a URL that applies to this customer (for example: http://woothemes.com/).', 'woothemes-testimonials' ),
362
+ 'type' => 'url',
363
+ 'default' => '',
364
  'section' => 'info'
365
  );
366
 
384
  } elseif ( ! is_string( $size ) && ! is_array( $size ) ) {
385
  $size = array( 50, 50 );
386
  }
387
+ $response = get_the_post_thumbnail( intval( $id ), $size, array( 'class' => 'avatar' ) );
388
  } else {
389
  $gravatar_email = get_post_meta( $id, '_gravatar_email', true );
390
  if ( '' != $gravatar_email && is_email( $gravatar_email ) ) {
403
  */
404
  public function get_testimonials ( $args = '' ) {
405
  $defaults = array(
406
+ 'limit' => 5,
407
+ 'orderby' => 'menu_order',
408
+ 'order' => 'DESC',
409
+ 'id' => 0,
410
+ 'category' => 0
411
  );
412
+
413
  $args = wp_parse_args( $args, $defaults );
414
+
415
  // Allow child themes/plugins to filter here.
416
  $args = apply_filters( 'woothemes_get_testimonials_args', $args );
417
+
418
  // The Query Arguments.
419
  $query_args = array();
420
  $query_args['post_type'] = 'testimonial';
422
  $query_args['orderby'] = $args['orderby'];
423
  $query_args['order'] = $args['order'];
424
  $query_args['suppress_filters'] = false;
425
+
426
  if ( is_numeric( $args['id'] ) && ( intval( $args['id'] ) > 0 ) ) {
427
  $query_args['p'] = intval( $args['id'] );
428
  }
429
+
430
  // Whitelist checks.
431
  if ( ! in_array( $query_args['orderby'], array( 'none', 'ID', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order', 'meta_value', 'meta_value_num' ) ) ) {
432
  $query_args['orderby'] = 'date';
433
  }
434
+
435
  if ( ! in_array( $query_args['order'], array( 'ASC', 'DESC' ) ) ) {
436
  $query_args['order'] = 'DESC';
437
  }
438
+
439
  if ( ! in_array( $query_args['post_type'], get_post_types() ) ) {
440
  $query_args['post_type'] = 'testimonial';
441
  }
442
+
443
+ $tax_field_type = '';
444
+
445
+ // If the category ID is specified.
446
+ if ( is_numeric( $args['category'] ) && 0 < intval( $args['category'] ) ) {
447
+ $tax_field_type = 'id';
448
+ }
449
+
450
+ // If the category slug is specified.
451
+ if ( ! is_numeric( $args['category'] ) && is_string( $args['category'] ) ) {
452
+ $tax_field_type = 'slug';
453
+ }
454
+
455
+ // Setup the taxonomy query.
456
+ if ( '' != $tax_field_type ) {
457
+ $term = $args['category'];
458
+ if ( is_string( $term ) ) { $term = esc_html( $term ); } else { $term = intval( $term ); }
459
+ $query_args['tax_query'] = array( array( 'taxonomy' => 'testimonial-category', 'field' => $tax_field_type, 'terms' => array( $term ) ) );
460
+ }
461
+
462
  // The Query.
463
  $query = get_posts( $query_args );
464
+
465
  // The Display.
466
  if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
467
  foreach ( $query as $k => $v ) {
481
  } else {
482
  $query = false;
483
  }
484
+
485
  return $query;
486
  } // End get_testimonials()
487
 
504
  $domain = 'woothemes-testimonials';
505
  // The "plugin_locale" filter is also used in load_plugin_textdomain()
506
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
507
+
508
  load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
509
  load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( $this->file ) ) . '/lang/' );
510
  } // End load_plugin_textdomain()
classes/class-woothemes-widget-testimonials.php CHANGED
@@ -18,14 +18,14 @@ if ( ! defined( 'ABSPATH' ) || ! function_exists( 'woothemes_testimonials' ) ) e
18
  * protected $woothemes_widget_description
19
  * protected $woothemes_widget_idbase
20
  * protected $woothemes_widget_title
21
- *
22
  * - __construct()
23
  * - widget()
24
  * - update()
25
  * - form()
26
  * - get_orderby_options()
27
  */
28
- class Woothemes_Widget_Testmonials extends WP_Widget {
29
  protected $woothemes_widget_cssclass;
30
  protected $woothemes_widget_description;
31
  protected $woothemes_widget_idbase;
@@ -50,7 +50,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
50
  $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woothemes_widget_idbase );
51
 
52
  /* Create the widget. */
53
- $this->WP_Widget( $this->woothemes_widget_idbase, $this->woothemes_widget_title, $widget_ops, $control_ops );
54
  } // End __construct()
55
 
56
  /**
@@ -60,12 +60,12 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
60
  * @param array $instance Widget settings for this instance.
61
  * @return void
62
  */
63
- public function widget( $args, $instance ) {
64
  extract( $args, EXTR_SKIP );
65
-
66
  /* Our variables from the widget settings. */
67
  $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
68
-
69
  /* Before widget (defined by themes). */
70
  $args = array();
71
 
@@ -78,7 +78,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
78
  $args['title'] = $title;
79
  $args['after_title'] = $after_title;
80
  }
81
-
82
  /* Widget content. */
83
  // Add actions for plugins/themes to hook onto.
84
  do_action( $this->woothemes_widget_cssclass . '_top' );
@@ -87,6 +87,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
87
  if ( isset( $instance['limit'] ) && ( 0 < count( $instance['limit'] ) ) ) { $args['limit'] = intval( $instance['limit'] ); }
88
  if ( isset( $instance['specific_id'] ) && ( 0 < count( $instance['specific_id'] ) ) ) { $args['id'] = intval( $instance['specific_id'] ); }
89
  if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) { $args['size'] = intval( $instance['size'] ); }
 
90
 
91
  // Boolean values.
92
  if ( isset( $instance['display_author'] ) && ( 1 == $instance['display_author'] ) ) { $args['display_author'] = true; } else { $args['display_author'] = false; }
@@ -121,6 +122,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
121
  $instance['limit'] = intval( $new_instance['limit'] );
122
  $instance['specific_id'] = intval( $new_instance['specific_id'] );
123
  $instance['size'] = intval( $new_instance['size'] );
 
124
 
125
  /* The select box is returning a text value, so we escape it. */
126
  $instance['orderby'] = esc_attr( $new_instance['orderby'] );
@@ -141,24 +143,25 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
141
  * @param array $instance The settings for this instance.
142
  * @return void
143
  */
144
- public function form( $instance ) {
145
-
146
  /* Set up some default widget settings. */
147
  /* Make sure all keys are added here, even with empty string values. */
148
  $defaults = array(
149
- 'title' => '',
150
- 'limit' => 5,
151
- 'orderby' => 'menu_order',
152
- 'order' => 'DESC',
153
- 'specific_id' => '',
154
- 'display_author' => true,
155
- 'display_avatar' => true,
156
- 'display_url' => true,
157
  'effect' => 'fade', // Options: 'fade', 'none'
158
- 'pagination' => false,
159
- 'size' => 50
 
160
  );
161
-
162
  $instance = wp_parse_args( (array) $instance, $defaults );
163
  ?>
164
  <!-- Widget Title: Text Input -->
@@ -182,7 +185,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
182
  <select name="<?php echo $this->get_field_name( 'orderby' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
183
  <?php foreach ( $this->get_orderby_options() as $k => $v ) { ?>
184
  <option value="<?php echo $k; ?>"<?php selected( $instance['orderby'], $k ); ?>><?php echo $v; ?></option>
185
- <?php } ?>
186
  </select>
187
  </p>
188
  <!-- Widget Order: Select Input -->
@@ -191,7 +194,7 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
191
  <select name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>">
192
  <?php foreach ( $this->get_order_options() as $k => $v ) { ?>
193
  <option value="<?php echo $k; ?>"<?php selected( $instance['order'], $k ); ?>><?php echo $v; ?></option>
194
- <?php } ?>
195
  </select>
196
  </p>
197
  <!-- Widget Display Author: Checkbox Input -->
@@ -209,6 +212,14 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
209
  <input id="<?php echo $this->get_field_id( 'display_url' ); ?>" name="<?php echo $this->get_field_name( 'display_url' ); ?>" type="checkbox"<?php checked( $instance['display_url'], 1 ); ?> />
210
  <label for="<?php echo $this->get_field_id( 'display_url' ); ?>"><?php _e( 'Display URL', 'woothemes-testimonials' ); ?></label>
211
  </p>
 
 
 
 
 
 
 
 
212
  <!-- Widget ID: Text Input -->
213
  <p>
214
  <label for="<?php echo $this->get_field_id( 'specific_id' ); ?>"><?php _e( 'Specific ID (optional):', 'woothemes-testimonials' ); ?></label>
@@ -225,11 +236,11 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
225
  */
226
  protected function get_orderby_options () {
227
  return array(
228
- 'none' => __( 'No Order', 'woothemes-testimonials' ),
229
- 'ID' => __( 'Entry ID', 'woothemes-testimonials' ),
230
- 'title' => __( 'Title', 'woothemes-testimonials' ),
231
- 'date' => __( 'Date Added', 'woothemes-testimonials' ),
232
- 'menu_order' => __( 'Specified Order Setting', 'woothemes-testimonials' ),
233
  'rand' => __( 'Random Order', 'woothemes-testimonials' )
234
  );
235
  } // End get_orderby_options()
@@ -241,12 +252,12 @@ class Woothemes_Widget_Testmonials extends WP_Widget {
241
  */
242
  protected function get_order_options () {
243
  return array(
244
- 'ASC' => __( 'Ascending', 'woothemes-testimonials' ),
245
  'DESC' => __( 'Descending', 'woothemes-testimonials' )
246
  );
247
  } // End get_order_options()
248
  } // End Class
249
 
250
  /* Register the widget. */
251
- add_action( 'widgets_init', create_function( '', 'return register_widget("Woothemes_Widget_Testmonials");' ), 1 );
252
  ?>
18
  * protected $woothemes_widget_description
19
  * protected $woothemes_widget_idbase
20
  * protected $woothemes_widget_title
21
+ *
22
  * - __construct()
23
  * - widget()
24
  * - update()
25
  * - form()
26
  * - get_orderby_options()
27
  */
28
+ class Woothemes_Widget_Testimonials extends WP_Widget {
29
  protected $woothemes_widget_cssclass;
30
  protected $woothemes_widget_description;
31
  protected $woothemes_widget_idbase;
50
  $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woothemes_widget_idbase );
51
 
52
  /* Create the widget. */
53
+ $this->WP_Widget( $this->woothemes_widget_idbase, $this->woothemes_widget_title, $widget_ops, $control_ops );
54
  } // End __construct()
55
 
56
  /**
60
  * @param array $instance Widget settings for this instance.
61
  * @return void
62
  */
63
+ public function widget( $args, $instance ) {
64
  extract( $args, EXTR_SKIP );
65
+
66
  /* Our variables from the widget settings. */
67
  $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
68
+
69
  /* Before widget (defined by themes). */
70
  $args = array();
71
 
78
  $args['title'] = $title;
79
  $args['after_title'] = $after_title;
80
  }
81
+
82
  /* Widget content. */
83
  // Add actions for plugins/themes to hook onto.
84
  do_action( $this->woothemes_widget_cssclass . '_top' );
87
  if ( isset( $instance['limit'] ) && ( 0 < count( $instance['limit'] ) ) ) { $args['limit'] = intval( $instance['limit'] ); }
88
  if ( isset( $instance['specific_id'] ) && ( 0 < count( $instance['specific_id'] ) ) ) { $args['id'] = intval( $instance['specific_id'] ); }
89
  if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) { $args['size'] = intval( $instance['size'] ); }
90
+ if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $args['category'] = intval( $instance['category'] );
91
 
92
  // Boolean values.
93
  if ( isset( $instance['display_author'] ) && ( 1 == $instance['display_author'] ) ) { $args['display_author'] = true; } else { $args['display_author'] = false; }
122
  $instance['limit'] = intval( $new_instance['limit'] );
123
  $instance['specific_id'] = intval( $new_instance['specific_id'] );
124
  $instance['size'] = intval( $new_instance['size'] );
125
+ $instance['category'] = intval( $new_instance['category'] );
126
 
127
  /* The select box is returning a text value, so we escape it. */
128
  $instance['orderby'] = esc_attr( $new_instance['orderby'] );
143
  * @param array $instance The settings for this instance.
144
  * @return void
145
  */
146
+ public function form( $instance ) {
147
+
148
  /* Set up some default widget settings. */
149
  /* Make sure all keys are added here, even with empty string values. */
150
  $defaults = array(
151
+ 'title' => '',
152
+ 'limit' => 5,
153
+ 'orderby' => 'menu_order',
154
+ 'order' => 'DESC',
155
+ 'specific_id' => '',
156
+ 'display_author' => true,
157
+ 'display_avatar' => true,
158
+ 'display_url' => true,
159
  'effect' => 'fade', // Options: 'fade', 'none'
160
+ 'pagination' => false,
161
+ 'size' => 50,
162
+ 'category' => 0
163
  );
164
+
165
  $instance = wp_parse_args( (array) $instance, $defaults );
166
  ?>
167
  <!-- Widget Title: Text Input -->
185
  <select name="<?php echo $this->get_field_name( 'orderby' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
186
  <?php foreach ( $this->get_orderby_options() as $k => $v ) { ?>
187
  <option value="<?php echo $k; ?>"<?php selected( $instance['orderby'], $k ); ?>><?php echo $v; ?></option>
188
+ <?php } ?>
189
  </select>
190
  </p>
191
  <!-- Widget Order: Select Input -->
194
  <select name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>">
195
  <?php foreach ( $this->get_order_options() as $k => $v ) { ?>
196
  <option value="<?php echo $k; ?>"<?php selected( $instance['order'], $k ); ?>><?php echo $v; ?></option>
197
+ <?php } ?>
198
  </select>
199
  </p>
200
  <!-- Widget Display Author: Checkbox Input -->
212
  <input id="<?php echo $this->get_field_id( 'display_url' ); ?>" name="<?php echo $this->get_field_name( 'display_url' ); ?>" type="checkbox"<?php checked( $instance['display_url'], 1 ); ?> />
213
  <label for="<?php echo $this->get_field_id( 'display_url' ); ?>"><?php _e( 'Display URL', 'woothemes-testimonials' ); ?></label>
214
  </p>
215
+ <!-- Widget Category: Select Input -->
216
+ <p>
217
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Category:', 'woothemes-testimonials' ); ?></label>
218
+ <?php
219
+ $dropdown_args = array( 'taxonomy' => 'testimonial-category', 'class' => 'widefat', 'show_option_all' => __( 'All', 'woothemes-testimonials' ), 'id' => $this->get_field_id( 'category' ), 'name' => $this->get_field_name( 'category' ), 'selected' => $instance['category'] );
220
+ wp_dropdown_categories( $dropdown_args );
221
+ ?>
222
+ </p>
223
  <!-- Widget ID: Text Input -->
224
  <p>
225
  <label for="<?php echo $this->get_field_id( 'specific_id' ); ?>"><?php _e( 'Specific ID (optional):', 'woothemes-testimonials' ); ?></label>
236
  */
237
  protected function get_orderby_options () {
238
  return array(
239
+ 'none' => __( 'No Order', 'woothemes-testimonials' ),
240
+ 'ID' => __( 'Entry ID', 'woothemes-testimonials' ),
241
+ 'title' => __( 'Title', 'woothemes-testimonials' ),
242
+ 'date' => __( 'Date Added', 'woothemes-testimonials' ),
243
+ 'menu_order' => __( 'Specified Order Setting', 'woothemes-testimonials' ),
244
  'rand' => __( 'Random Order', 'woothemes-testimonials' )
245
  );
246
  } // End get_orderby_options()
252
  */
253
  protected function get_order_options () {
254
  return array(
255
+ 'ASC' => __( 'Ascending', 'woothemes-testimonials' ),
256
  'DESC' => __( 'Descending', 'woothemes-testimonials' )
257
  );
258
  } // End get_order_options()
259
  } // End Class
260
 
261
  /* Register the widget. */
262
+ add_action( 'widgets_init', create_function( '', 'return register_widget("Woothemes_Widget_Testimonials");' ), 1 );
263
  ?>
lang/woothemes-testimonials-en_GB.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Testimonials v1.2.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2013-01-03 08:54:32+0000\n"
7
  "Last-Translator: Matty <matt@woothemes.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -19,194 +19,197 @@ msgstr ""
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Textdomain-Support: yes"
21
 
22
- #: classes/class-woothemes-testimonials.php:75
23
  #@ woothemes-testimonials
24
  msgctxt "post type general name"
25
  msgid "Testimonials"
26
  msgstr ""
27
 
28
- #: classes/class-woothemes-testimonials.php:76
29
  #@ woothemes-testimonials
30
  msgctxt "post type singular name"
31
  msgid "Testimonial"
32
  msgstr ""
33
 
34
- #: classes/class-woothemes-testimonials.php:77
35
  #@ woothemes-testimonials
36
  msgctxt "testimonial"
37
  msgid "Add New"
38
  msgstr ""
39
 
40
- #: classes/class-woothemes-testimonials.php:78
 
41
  #, php-format
42
  #@ woothemes-testimonials
43
  msgid "Add New %s"
44
  msgstr ""
45
 
46
- #: classes/class-woothemes-testimonials.php:78
47
  #: classes/class-woothemes-testimonials.php:79
48
  #: classes/class-woothemes-testimonials.php:80
49
- #: classes/class-woothemes-testimonials.php:82
 
50
  #@ woothemes-testimonials
51
  msgid "Testimonial"
52
  msgstr ""
53
 
54
- #: classes/class-woothemes-testimonials.php:79
 
55
  #, php-format
56
  #@ woothemes-testimonials
57
  msgid "Edit %s"
58
  msgstr ""
59
 
60
- #: classes/class-woothemes-testimonials.php:80
61
  #, php-format
62
  #@ woothemes-testimonials
63
  msgid "New %s"
64
  msgstr ""
65
 
66
- #: classes/class-woothemes-testimonials.php:81
 
67
  #, php-format
68
  #@ woothemes-testimonials
69
  msgid "All %s"
70
  msgstr ""
71
 
72
- #: classes/class-woothemes-testimonials.php:81
73
- #: classes/class-woothemes-testimonials.php:83
74
  #: classes/class-woothemes-testimonials.php:84
75
  #: classes/class-woothemes-testimonials.php:85
76
- #: classes/class-woothemes-testimonials.php:87
 
77
  #: classes/class-woothemes-widget-testimonials.php:44
78
  #@ woothemes-testimonials
79
  msgid "Testimonials"
80
  msgstr ""
81
 
82
- #: classes/class-woothemes-testimonials.php:82
83
  #, php-format
84
  #@ woothemes-testimonials
85
  msgid "View %s"
86
  msgstr ""
87
 
88
- #: classes/class-woothemes-testimonials.php:83
89
  #, php-format
90
  #@ woothemes-testimonials
91
  msgid "Search %a"
92
  msgstr ""
93
 
94
- #: classes/class-woothemes-testimonials.php:84
95
  #, php-format
96
  #@ woothemes-testimonials
97
  msgid "No %s Found"
98
  msgstr ""
99
 
100
- #: classes/class-woothemes-testimonials.php:85
101
  #, php-format
102
  #@ woothemes-testimonials
103
  msgid "No %s Found In Trash"
104
  msgstr ""
105
 
106
- #: classes/class-woothemes-testimonials.php:147
107
  #@ woothemes-testimonials
108
  msgid "Image"
109
  msgstr ""
110
 
111
- #: classes/class-woothemes-testimonials.php:181
112
  #, php-format
113
  #@ woothemes-testimonials
114
  msgid "Testimonial updated. %sView testimonial%s"
115
  msgstr ""
116
 
117
- #: classes/class-woothemes-testimonials.php:182
118
  #@ woothemes-testimonials
119
  msgid "Custom field updated."
120
  msgstr ""
121
 
122
- #: classes/class-woothemes-testimonials.php:183
123
  #@ woothemes-testimonials
124
  msgid "Custom field deleted."
125
  msgstr ""
126
 
127
- #: classes/class-woothemes-testimonials.php:184
128
  #@ woothemes-testimonials
129
  msgid "Testimonial updated."
130
  msgstr ""
131
 
132
- #. translators: %s: date and time of the revision
133
- #: classes/class-woothemes-testimonials.php:186
134
  #, php-format
135
  #@ woothemes-testimonials
136
  msgid "Testimonial restored to revision from %s"
137
  msgstr ""
138
 
139
- #: classes/class-woothemes-testimonials.php:187
140
  #, php-format
141
  #@ woothemes-testimonials
142
  msgid "Testimonial published. %sView testimonial%s"
143
  msgstr ""
144
 
145
- #: classes/class-woothemes-testimonials.php:188
146
  #@ default
147
  msgid "Testimonial saved."
148
  msgstr ""
149
 
150
- #: classes/class-woothemes-testimonials.php:189
151
  #, php-format
152
  #@ woothemes-testimonials
153
  msgid "Testimonial submitted. %sPreview testimonial%s"
154
  msgstr ""
155
 
156
- #: classes/class-woothemes-testimonials.php:190
157
  #, php-format
158
  #@ woothemes-testimonials
159
  msgid "Testimonial scheduled for: %1$s. %2$sPreview testimonial%3$s"
160
  msgstr ""
161
 
162
- #: classes/class-woothemes-testimonials.php:192
163
  #@ default
164
  msgid "M j, Y @ G:i"
165
  msgstr ""
166
 
167
- #: classes/class-woothemes-testimonials.php:193
168
  #, php-format
169
  #@ woothemes-testimonials
170
  msgid "Testimonial draft updated. %sPreview testimonial%s"
171
  msgstr ""
172
 
173
- #: classes/class-woothemes-testimonials.php:207
174
  #@ woothemes-testimonials
175
  msgid "Testimonial Details"
176
  msgstr ""
177
 
178
- #: classes/class-woothemes-testimonials.php:306
179
  #@ woothemes-testimonials
180
  msgid "Enter the customer's name here"
181
  msgstr ""
182
 
183
- #: classes/class-woothemes-testimonials.php:332
184
  #@ woothemes-testimonials
185
  msgid "Gravatar E-mail Address"
186
  msgstr ""
187
 
188
- #: classes/class-woothemes-testimonials.php:333
189
  #, php-format
190
  #@ woothemes-testimonials
191
  msgid "Enter in an e-mail address, to use a %sGravatar%s, instead of using the \"Featured Image\"."
192
  msgstr ""
193
 
194
- #: classes/class-woothemes-testimonials.php:340
195
  #@ woothemes-testimonials
196
  msgid "Byline"
197
  msgstr ""
198
 
199
- #: classes/class-woothemes-testimonials.php:341
200
  #@ woothemes-testimonials
201
  msgid "Enter a byline for the customer giving this testimonial (for example: \"CEO of WooThemes\")."
202
  msgstr ""
203
 
204
- #: classes/class-woothemes-testimonials.php:348
205
  #@ woothemes-testimonials
206
  msgid "URL"
207
  msgstr ""
208
 
209
- #: classes/class-woothemes-testimonials.php:349
210
  #@ woothemes-testimonials
211
  msgid "Enter a URL that applies to this customer (for example: http://woothemes.com/)."
212
  msgstr ""
@@ -216,103 +219,173 @@ msgstr ""
216
  msgid "Recent testimonials on your site."
217
  msgstr ""
218
 
219
- #: classes/class-woothemes-widget-testimonials.php:166
220
  #@ woothemes-testimonials
221
  msgid "Title (optional):"
222
  msgstr ""
223
 
224
- #: classes/class-woothemes-widget-testimonials.php:171
225
  #@ woothemes-testimonials
226
  msgid "Limit:"
227
  msgstr ""
228
 
229
- #: classes/class-woothemes-widget-testimonials.php:176
230
  #@ woothemes-testimonials
231
  msgid "Image Size (in pixels):"
232
  msgstr ""
233
 
234
- #: classes/class-woothemes-widget-testimonials.php:181
235
  #@ woothemes-testimonials
236
  msgid "Order By:"
237
  msgstr ""
238
 
239
- #: classes/class-woothemes-widget-testimonials.php:190
240
  #@ woothemes-testimonials
241
  msgid "Order Direction:"
242
  msgstr ""
243
 
244
- #: classes/class-woothemes-widget-testimonials.php:200
245
  #@ woothemes-testimonials
246
  msgid "Display Author"
247
  msgstr ""
248
 
249
- #: classes/class-woothemes-widget-testimonials.php:210
250
  #@ woothemes-testimonials
251
  msgid "Display URL"
252
  msgstr ""
253
 
254
- #: classes/class-woothemes-widget-testimonials.php:214
255
  #@ woothemes-testimonials
256
  msgid "Specific ID (optional):"
257
  msgstr ""
258
 
259
- #: classes/class-woothemes-widget-testimonials.php:217
260
  #@ woothemes-testimonials
261
  msgid "Display a specific testimonial, rather than a list."
262
  msgstr ""
263
 
264
- #: classes/class-woothemes-widget-testimonials.php:228
265
  #@ woothemes-testimonials
266
  msgid "No Order"
267
  msgstr ""
268
 
269
- #: classes/class-woothemes-widget-testimonials.php:229
270
  #@ woothemes-testimonials
271
  msgid "Entry ID"
272
  msgstr ""
273
 
274
- #: classes/class-woothemes-widget-testimonials.php:230
275
  #@ woothemes-testimonials
276
  msgid "Title"
277
  msgstr ""
278
 
279
- #: classes/class-woothemes-widget-testimonials.php:231
280
  #@ woothemes-testimonials
281
  msgid "Date Added"
282
  msgstr ""
283
 
284
- #: classes/class-woothemes-widget-testimonials.php:232
285
  #@ woothemes-testimonials
286
  msgid "Specified Order Setting"
287
  msgstr ""
288
 
289
- #: classes/class-woothemes-widget-testimonials.php:244
290
  #@ woothemes-testimonials
291
  msgid "Ascending"
292
  msgstr ""
293
 
294
- #: classes/class-woothemes-widget-testimonials.php:245
295
  #@ woothemes-testimonials
296
  msgid "Descending"
297
  msgstr ""
298
 
299
- #: woothemes-testimonials-template.php:145
300
  #@ woothemes-testimonials
301
  msgid "Previous"
302
  msgstr ""
303
 
304
- #: woothemes-testimonials-template.php:146
305
  #@ woothemes-testimonials
306
  msgid "Next"
307
  msgstr ""
308
 
309
- #: classes/class-woothemes-widget-testimonials.php:205
310
  #@ woothemes-testimonials
311
  msgid "Display Avatar"
312
  msgstr ""
313
 
314
- #: classes/class-woothemes-widget-testimonials.php:233
315
  #@ woothemes-testimonials
316
  msgid "Random Order"
317
  msgstr ""
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Testimonials v1.3.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2013-04-30 12:40:13+0000\n"
7
  "Last-Translator: Matty <matt@woothemes.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Textdomain-Support: yes"
21
 
22
+ #: classes/class-woothemes-testimonials.php:76
23
  #@ woothemes-testimonials
24
  msgctxt "post type general name"
25
  msgid "Testimonials"
26
  msgstr ""
27
 
28
+ #: classes/class-woothemes-testimonials.php:77
29
  #@ woothemes-testimonials
30
  msgctxt "post type singular name"
31
  msgid "Testimonial"
32
  msgstr ""
33
 
34
+ #: classes/class-woothemes-testimonials.php:78
35
  #@ woothemes-testimonials
36
  msgctxt "testimonial"
37
  msgid "Add New"
38
  msgstr ""
39
 
40
+ #: classes/class-woothemes-testimonials-taxonomy.php:103
41
+ #: classes/class-woothemes-testimonials.php:79
42
  #, php-format
43
  #@ woothemes-testimonials
44
  msgid "Add New %s"
45
  msgstr ""
46
 
 
47
  #: classes/class-woothemes-testimonials.php:79
48
  #: classes/class-woothemes-testimonials.php:80
49
+ #: classes/class-woothemes-testimonials.php:81
50
+ #: classes/class-woothemes-testimonials.php:83
51
  #@ woothemes-testimonials
52
  msgid "Testimonial"
53
  msgstr ""
54
 
55
+ #: classes/class-woothemes-testimonials-taxonomy.php:101
56
+ #: classes/class-woothemes-testimonials.php:80
57
  #, php-format
58
  #@ woothemes-testimonials
59
  msgid "Edit %s"
60
  msgstr ""
61
 
62
+ #: classes/class-woothemes-testimonials.php:81
63
  #, php-format
64
  #@ woothemes-testimonials
65
  msgid "New %s"
66
  msgstr ""
67
 
68
+ #: classes/class-woothemes-testimonials-taxonomy.php:98
69
+ #: classes/class-woothemes-testimonials.php:82
70
  #, php-format
71
  #@ woothemes-testimonials
72
  msgid "All %s"
73
  msgstr ""
74
 
75
+ #: classes/class-woothemes-testimonials.php:82
 
76
  #: classes/class-woothemes-testimonials.php:84
77
  #: classes/class-woothemes-testimonials.php:85
78
+ #: classes/class-woothemes-testimonials.php:86
79
+ #: classes/class-woothemes-testimonials.php:88
80
  #: classes/class-woothemes-widget-testimonials.php:44
81
  #@ woothemes-testimonials
82
  msgid "Testimonials"
83
  msgstr ""
84
 
85
+ #: classes/class-woothemes-testimonials.php:83
86
  #, php-format
87
  #@ woothemes-testimonials
88
  msgid "View %s"
89
  msgstr ""
90
 
91
+ #: classes/class-woothemes-testimonials.php:84
92
  #, php-format
93
  #@ woothemes-testimonials
94
  msgid "Search %a"
95
  msgstr ""
96
 
97
+ #: classes/class-woothemes-testimonials.php:85
98
  #, php-format
99
  #@ woothemes-testimonials
100
  msgid "No %s Found"
101
  msgstr ""
102
 
103
+ #: classes/class-woothemes-testimonials.php:86
104
  #, php-format
105
  #@ woothemes-testimonials
106
  msgid "No %s Found In Trash"
107
  msgstr ""
108
 
109
+ #: classes/class-woothemes-testimonials.php:159
110
  #@ woothemes-testimonials
111
  msgid "Image"
112
  msgstr ""
113
 
114
+ #: classes/class-woothemes-testimonials.php:193
115
  #, php-format
116
  #@ woothemes-testimonials
117
  msgid "Testimonial updated. %sView testimonial%s"
118
  msgstr ""
119
 
120
+ #: classes/class-woothemes-testimonials.php:194
121
  #@ woothemes-testimonials
122
  msgid "Custom field updated."
123
  msgstr ""
124
 
125
+ #: classes/class-woothemes-testimonials.php:195
126
  #@ woothemes-testimonials
127
  msgid "Custom field deleted."
128
  msgstr ""
129
 
130
+ #: classes/class-woothemes-testimonials.php:196
131
  #@ woothemes-testimonials
132
  msgid "Testimonial updated."
133
  msgstr ""
134
 
135
+ #. translators: %s: date and time of the revision
136
+ #: classes/class-woothemes-testimonials.php:198
137
  #, php-format
138
  #@ woothemes-testimonials
139
  msgid "Testimonial restored to revision from %s"
140
  msgstr ""
141
 
142
+ #: classes/class-woothemes-testimonials.php:199
143
  #, php-format
144
  #@ woothemes-testimonials
145
  msgid "Testimonial published. %sView testimonial%s"
146
  msgstr ""
147
 
148
+ #: classes/class-woothemes-testimonials.php:200
149
  #@ default
150
  msgid "Testimonial saved."
151
  msgstr ""
152
 
153
+ #: classes/class-woothemes-testimonials.php:201
154
  #, php-format
155
  #@ woothemes-testimonials
156
  msgid "Testimonial submitted. %sPreview testimonial%s"
157
  msgstr ""
158
 
159
+ #: classes/class-woothemes-testimonials.php:202
160
  #, php-format
161
  #@ woothemes-testimonials
162
  msgid "Testimonial scheduled for: %1$s. %2$sPreview testimonial%3$s"
163
  msgstr ""
164
 
165
+ #: classes/class-woothemes-testimonials.php:204
166
  #@ default
167
  msgid "M j, Y @ G:i"
168
  msgstr ""
169
 
170
+ #: classes/class-woothemes-testimonials.php:205
171
  #, php-format
172
  #@ woothemes-testimonials
173
  msgid "Testimonial draft updated. %sPreview testimonial%s"
174
  msgstr ""
175
 
176
+ #: classes/class-woothemes-testimonials.php:219
177
  #@ woothemes-testimonials
178
  msgid "Testimonial Details"
179
  msgstr ""
180
 
181
+ #: classes/class-woothemes-testimonials.php:318
182
  #@ woothemes-testimonials
183
  msgid "Enter the customer's name here"
184
  msgstr ""
185
 
186
+ #: classes/class-woothemes-testimonials.php:344
187
  #@ woothemes-testimonials
188
  msgid "Gravatar E-mail Address"
189
  msgstr ""
190
 
191
+ #: classes/class-woothemes-testimonials.php:345
192
  #, php-format
193
  #@ woothemes-testimonials
194
  msgid "Enter in an e-mail address, to use a %sGravatar%s, instead of using the \"Featured Image\"."
195
  msgstr ""
196
 
197
+ #: classes/class-woothemes-testimonials.php:352
198
  #@ woothemes-testimonials
199
  msgid "Byline"
200
  msgstr ""
201
 
202
+ #: classes/class-woothemes-testimonials.php:353
203
  #@ woothemes-testimonials
204
  msgid "Enter a byline for the customer giving this testimonial (for example: \"CEO of WooThemes\")."
205
  msgstr ""
206
 
207
+ #: classes/class-woothemes-testimonials.php:360
208
  #@ woothemes-testimonials
209
  msgid "URL"
210
  msgstr ""
211
 
212
+ #: classes/class-woothemes-testimonials.php:361
213
  #@ woothemes-testimonials
214
  msgid "Enter a URL that applies to this customer (for example: http://woothemes.com/)."
215
  msgstr ""
219
  msgid "Recent testimonials on your site."
220
  msgstr ""
221
 
222
+ #: classes/class-woothemes-widget-testimonials.php:169
223
  #@ woothemes-testimonials
224
  msgid "Title (optional):"
225
  msgstr ""
226
 
227
+ #: classes/class-woothemes-widget-testimonials.php:174
228
  #@ woothemes-testimonials
229
  msgid "Limit:"
230
  msgstr ""
231
 
232
+ #: classes/class-woothemes-widget-testimonials.php:179
233
  #@ woothemes-testimonials
234
  msgid "Image Size (in pixels):"
235
  msgstr ""
236
 
237
+ #: classes/class-woothemes-widget-testimonials.php:184
238
  #@ woothemes-testimonials
239
  msgid "Order By:"
240
  msgstr ""
241
 
242
+ #: classes/class-woothemes-widget-testimonials.php:193
243
  #@ woothemes-testimonials
244
  msgid "Order Direction:"
245
  msgstr ""
246
 
247
+ #: classes/class-woothemes-widget-testimonials.php:203
248
  #@ woothemes-testimonials
249
  msgid "Display Author"
250
  msgstr ""
251
 
252
+ #: classes/class-woothemes-widget-testimonials.php:213
253
  #@ woothemes-testimonials
254
  msgid "Display URL"
255
  msgstr ""
256
 
257
+ #: classes/class-woothemes-widget-testimonials.php:225
258
  #@ woothemes-testimonials
259
  msgid "Specific ID (optional):"
260
  msgstr ""
261
 
262
+ #: classes/class-woothemes-widget-testimonials.php:228
263
  #@ woothemes-testimonials
264
  msgid "Display a specific testimonial, rather than a list."
265
  msgstr ""
266
 
267
+ #: classes/class-woothemes-widget-testimonials.php:239
268
  #@ woothemes-testimonials
269
  msgid "No Order"
270
  msgstr ""
271
 
272
+ #: classes/class-woothemes-widget-testimonials.php:240
273
  #@ woothemes-testimonials
274
  msgid "Entry ID"
275
  msgstr ""
276
 
277
+ #: classes/class-woothemes-widget-testimonials.php:241
278
  #@ woothemes-testimonials
279
  msgid "Title"
280
  msgstr ""
281
 
282
+ #: classes/class-woothemes-widget-testimonials.php:242
283
  #@ woothemes-testimonials
284
  msgid "Date Added"
285
  msgstr ""
286
 
287
+ #: classes/class-woothemes-widget-testimonials.php:243
288
  #@ woothemes-testimonials
289
  msgid "Specified Order Setting"
290
  msgstr ""
291
 
292
+ #: classes/class-woothemes-widget-testimonials.php:255
293
  #@ woothemes-testimonials
294
  msgid "Ascending"
295
  msgstr ""
296
 
297
+ #: classes/class-woothemes-widget-testimonials.php:256
298
  #@ woothemes-testimonials
299
  msgid "Descending"
300
  msgstr ""
301
 
302
+ #: woothemes-testimonials-template.php:146
303
  #@ woothemes-testimonials
304
  msgid "Previous"
305
  msgstr ""
306
 
307
+ #: woothemes-testimonials-template.php:147
308
  #@ woothemes-testimonials
309
  msgid "Next"
310
  msgstr ""
311
 
312
+ #: classes/class-woothemes-widget-testimonials.php:208
313
  #@ woothemes-testimonials
314
  msgid "Display Avatar"
315
  msgstr ""
316
 
317
+ #: classes/class-woothemes-widget-testimonials.php:244
318
  #@ woothemes-testimonials
319
  msgid "Random Order"
320
  msgstr ""
321
 
322
+ #: classes/class-woothemes-testimonials-taxonomy.php:71
323
+ #@ woothemes-testimonials
324
+ msgid "Category"
325
+ msgstr ""
326
+
327
+ #: classes/class-woothemes-testimonials-taxonomy.php:72
328
+ #@ woothemes-testimonials
329
+ msgid "Categories"
330
+ msgstr ""
331
+
332
+ #: classes/class-woothemes-testimonials-taxonomy.php:95
333
+ #, php-format
334
+ #@ woothemes-testimonials
335
+ msgctxt "taxonomy general name"
336
+ msgid "%s"
337
+ msgstr ""
338
+
339
+ #: classes/class-woothemes-testimonials-taxonomy.php:96
340
+ #, php-format
341
+ #@ woothemes-testimonials
342
+ msgctxt "taxonomy singular name"
343
+ msgid "%s"
344
+ msgstr ""
345
+
346
+ #: classes/class-woothemes-testimonials-taxonomy.php:97
347
+ #, php-format
348
+ #@ woothemes-testimonials
349
+ msgid "Search %s"
350
+ msgstr ""
351
+
352
+ #: classes/class-woothemes-testimonials-taxonomy.php:99
353
+ #, php-format
354
+ #@ woothemes-testimonials
355
+ msgid "Parent %s"
356
+ msgstr ""
357
+
358
+ #: classes/class-woothemes-testimonials-taxonomy.php:100
359
+ #, php-format
360
+ #@ woothemes-testimonials
361
+ msgid "Parent %s:"
362
+ msgstr ""
363
+
364
+ #: classes/class-woothemes-testimonials-taxonomy.php:102
365
+ #, php-format
366
+ #@ woothemes-testimonials
367
+ msgid "Update %s"
368
+ msgstr ""
369
+
370
+ #: classes/class-woothemes-testimonials-taxonomy.php:104
371
+ #, php-format
372
+ #@ woothemes-testimonials
373
+ msgid "New %s Name"
374
+ msgstr ""
375
+
376
+ #: classes/class-woothemes-testimonials-taxonomy.php:105
377
+ #, php-format
378
+ #@ woothemes-testimonials
379
+ msgid "%s"
380
+ msgstr ""
381
+
382
+ #: classes/class-woothemes-widget-testimonials.php:217
383
+ #@ woothemes-testimonials
384
+ msgid "Category:"
385
+ msgstr ""
386
+
387
+ #: classes/class-woothemes-widget-testimonials.php:219
388
+ #@ woothemes-testimonials
389
+ msgid "All"
390
+ msgstr ""
391
+
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: woothemes, mattyza, jameskoster
3
  Donate link: http://woothemes.com/
4
  Tags: testimonials, widget, shortcode, template-tag, feedback, customers
5
  Requires at least: 3.4.2
6
- Tested up to: 3.5
7
- Stable tag: 1.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -41,6 +41,7 @@ To add arguments to this, please use any of the following arguments, using the s
41
  * 'after' => '&lt;/div&gt;' (the ending HTML, wrapping the testimonials)
42
  * 'before_title' => '&lt;h2&gt;' (the starting HTML, wrapping the title)
43
  * 'after_title' => '&lt;/h2&gt;' (the ending HTML, wrapping the title)
 
44
 
45
  The various options for the "orderby" parameter are:
46
 
@@ -95,6 +96,9 @@ We encourage everyone to contribute their ideas, thoughts and code snippets. Thi
95
 
96
  == Upgrade Notice ==
97
 
 
 
 
98
  = 1.2.1 =
99
  * Minor bugfixes in the "order" directions options.
100
  * Adds support for random ordering in the widget.
@@ -112,6 +116,14 @@ We encourage everyone to contribute their ideas, thoughts and code snippets. Thi
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
 
 
115
  = 1.2.1 =
116
  * 2013-01-03
117
  * Minor bugfixes in the "order" directions options.
3
  Donate link: http://woothemes.com/
4
  Tags: testimonials, widget, shortcode, template-tag, feedback, customers
5
  Requires at least: 3.4.2
6
+ Tested up to: 3.5.1
7
+ Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
41
  * 'after' => '&lt;/div&gt;' (the ending HTML, wrapping the testimonials)
42
  * 'before_title' => '&lt;h2&gt;' (the starting HTML, wrapping the title)
43
  * 'after_title' => '&lt;/h2&gt;' (the ending HTML, wrapping the title)
44
+ * 'category' => 0 (the ID/slug of the category to filter by)
45
 
46
  The various options for the "orderby" parameter are:
47
 
96
 
97
  == Upgrade Notice ==
98
 
99
+ = 1.3.0 =
100
+ * Adds "woothemes_testimonials_content" filter and shortcode support. Adds "testimonial-category" taxonomy.
101
+
102
  = 1.2.1 =
103
  * Minor bugfixes in the "order" directions options.
104
  * Adds support for random ordering in the widget.
116
 
117
  == Changelog ==
118
 
119
+ = 1.3.0 =
120
+ * 2013-04-30.
121
+ * Adds "woothemes_testimonials_content" filter for modifying the content of testimonials when outputting the testimonials list.
122
+ * Adds default filters to the "woothemes_testimonials_content" hook, enabling shortcodes in the content field.
123
+ * Adds "testimonial-category" taxonomy and necessary logic for displaying testimonials from a specified category.
124
+ * Makes sure the ".avatar" CSS class is applied when using the featured image instead of a Gravatar.
125
+ * Fixes typo in the widget's class name.
126
+
127
  = 1.2.1 =
128
  * 2013-01-03
129
  * Minor bugfixes in the "order" directions options.
woothemes-testimonials-template.php CHANGED
@@ -32,50 +32,51 @@ function woothemes_testimonials ( $args = '' ) {
32
  global $post;
33
 
34
  $defaults = array(
35
- 'limit' => 5,
36
- 'orderby' => 'menu_order',
37
- 'order' => 'DESC',
38
- 'id' => 0,
39
- 'display_author' => true,
40
- 'display_avatar' => true,
41
- 'display_url' => true,
42
  'effect' => 'fade', // Options: 'fade', 'none'
43
- 'pagination' => false,
44
- 'echo' => true,
45
- 'size' => 50,
46
- 'title' => '',
47
- 'before' => '<div class="widget widget_woothemes_testimonials">',
48
- 'after' => '</div>',
49
- 'before_title' => '<h2>',
50
- 'after_title' => '</h2>'
 
51
  );
52
-
53
  $args = wp_parse_args( $args, $defaults );
54
-
55
  // Allow child themes/plugins to filter here.
56
  $args = apply_filters( 'woothemes_testimonials_args', $args );
57
  $html = '';
58
 
59
  do_action( 'woothemes_testimonials_before', $args );
60
-
61
  // The Query.
62
  $query = woothemes_get_testimonials( $args );
63
 
64
  // The Display.
65
  if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
66
-
67
  if ( $args['effect'] != 'none' ) {
68
  $effect = ' ' . $args['effect'];
69
  }
70
-
71
  $html .= $args['before'] . "\n";
72
  if ( '' != $args['title'] ) {
73
  $html .= $args['before_title'] . esc_html( $args['title'] ) . $args['after_title'] . "\n";
74
  }
75
- $html .= '<div class="testimonials component' . $effect . '">' . "\n";
76
 
77
  $html .= '<div class="testimonials-list">' . "\n";
78
-
79
  // Begin templating logic.
80
  $tpl = '<div id="quote-%%ID%%" class="%%CLASS%%"><blockquote class="testimonials-text">%%TEXT%%</blockquote>%%AVATAR%% %%AUTHOR%%<div class="fix"></div></div>';
81
  $tpl = apply_filters( 'woothemes_testimonials_item_template', $tpl, $args );
@@ -89,10 +90,10 @@ function woothemes_testimonials ( $args = '' ) {
89
  if ( count( $query ) == $count ) { $css_class .= ' last'; }
90
 
91
  setup_postdata( $post );
92
-
93
  $author = '';
94
  $author_text = '';
95
-
96
  // If we need to display the author, get the data.
97
  if ( ( get_the_title( $post ) != '' ) && true == $args['display_author'] ) {
98
  $author .= '<cite class="author">';
@@ -108,7 +109,7 @@ function woothemes_testimonials ( $args = '' ) {
108
  if ( true == $args['display_url'] && '' != $post->url ) {
109
  $author .= ' <span class="url"><a href="' . esc_url( $post->url ) . '">' . $post->url . '</a></span><!--/.excerpt-->' . "\n";
110
  }
111
-
112
  $author .= '</cite><!--/.author-->' . "\n";
113
 
114
  // Templating engine replacement.
@@ -129,17 +130,17 @@ function woothemes_testimonials ( $args = '' ) {
129
 
130
  // Remove any remaining %%AVATAR%% template tags.
131
  $template = str_replace( '%%AVATAR%%', '', $template );
132
-
133
- $template = str_replace( '%%TEXT%%', get_the_content(), $template );
134
 
135
  // Assign for output.
136
  $html .= $template;
137
  }
138
 
139
  wp_reset_postdata();
140
-
141
  $html .= '</div><!--/.testimonials-list-->' . "\n";
142
-
143
  if ( $args['pagination'] == true && count( $query ) > 1 && $args['effect'] != 'none' ) {
144
  $html .= '<div class="pagination">' . "\n";
145
  $html .= '<a href="#" class="btn-prev">' . apply_filters( 'woothemes_testimonials_prev_btn', '&larr; ' . __( 'Previous', 'woothemes-testimonials' ) ) . '</a>' . "\n";
@@ -150,35 +151,43 @@ function woothemes_testimonials ( $args = '' ) {
150
  $html .= '</div><!--/.testimonials-->' . "\n";
151
  $html .= $args['after'] . "\n";
152
  }
153
-
154
  // Allow child themes/plugins to filter here.
155
  $html = apply_filters( 'woothemes_testimonials_html', $html, $query, $args );
156
-
157
  if ( $args['echo'] != true ) { return $html; }
158
-
159
  // Should only run is "echo" is set to true.
160
  echo $html;
161
-
162
  do_action( 'woothemes_testimonials_after', $args ); // Only if "echo" is set to true.
163
  } // End woothemes_testimonials()
164
  }
165
 
166
  if ( ! function_exists( 'woothemes_testimonials_shortcode' ) ) {
 
 
 
 
 
 
 
167
  function woothemes_testimonials_shortcode ( $atts, $content = null ) {
168
  $args = (array)$atts;
169
 
170
  $defaults = array(
171
- 'limit' => 5,
172
- 'orderby' => 'menu_order',
173
- 'order' => 'DESC',
174
- 'id' => 0,
175
- 'display_author' => true,
176
- 'display_avatar' => true,
177
- 'display_url' => true,
178
  'effect' => 'fade', // Options: 'fade', 'none'
179
- 'pagination' => false,
180
- 'echo' => true,
181
- 'size' => 50
 
182
  );
183
 
184
  $args = shortcode_atts( $defaults, $atts );
@@ -190,6 +199,7 @@ function woothemes_testimonials_shortcode ( $atts, $content = null ) {
190
  if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] );
191
  if ( isset( $args['id'] ) ) $args['id'] = intval( $args['id'] );
192
  if ( isset( $args['size'] ) && ( 0 < intval( $args['size'] ) ) ) $args['size'] = intval( $args['size'] );
 
193
 
194
  // Fix booleans.
195
  foreach ( array( 'display_author', 'display_url', 'pagination', 'display_avatar' ) as $k => $v ) {
@@ -205,4 +215,17 @@ function woothemes_testimonials_shortcode ( $atts, $content = null ) {
205
  }
206
 
207
  add_shortcode( 'woothemes_testimonials', 'woothemes_testimonials_shortcode' );
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  ?>
32
  global $post;
33
 
34
  $defaults = array(
35
+ 'limit' => 5,
36
+ 'orderby' => 'menu_order',
37
+ 'order' => 'DESC',
38
+ 'id' => 0,
39
+ 'display_author' => true,
40
+ 'display_avatar' => true,
41
+ 'display_url' => true,
42
  'effect' => 'fade', // Options: 'fade', 'none'
43
+ 'pagination' => false,
44
+ 'echo' => true,
45
+ 'size' => 50,
46
+ 'title' => '',
47
+ 'before' => '<div class="widget widget_woothemes_testimonials">',
48
+ 'after' => '</div>',
49
+ 'before_title' => '<h2>',
50
+ 'after_title' => '</h2>',
51
+ 'category' => 0
52
  );
53
+
54
  $args = wp_parse_args( $args, $defaults );
55
+
56
  // Allow child themes/plugins to filter here.
57
  $args = apply_filters( 'woothemes_testimonials_args', $args );
58
  $html = '';
59
 
60
  do_action( 'woothemes_testimonials_before', $args );
61
+
62
  // The Query.
63
  $query = woothemes_get_testimonials( $args );
64
 
65
  // The Display.
66
  if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
67
+
68
  if ( $args['effect'] != 'none' ) {
69
  $effect = ' ' . $args['effect'];
70
  }
71
+
72
  $html .= $args['before'] . "\n";
73
  if ( '' != $args['title'] ) {
74
  $html .= $args['before_title'] . esc_html( $args['title'] ) . $args['after_title'] . "\n";
75
  }
76
+ $html .= '<div class="testimonials component' . esc_attr( $effect ) . '">' . "\n";
77
 
78
  $html .= '<div class="testimonials-list">' . "\n";
79
+
80
  // Begin templating logic.
81
  $tpl = '<div id="quote-%%ID%%" class="%%CLASS%%"><blockquote class="testimonials-text">%%TEXT%%</blockquote>%%AVATAR%% %%AUTHOR%%<div class="fix"></div></div>';
82
  $tpl = apply_filters( 'woothemes_testimonials_item_template', $tpl, $args );
90
  if ( count( $query ) == $count ) { $css_class .= ' last'; }
91
 
92
  setup_postdata( $post );
93
+
94
  $author = '';
95
  $author_text = '';
96
+
97
  // If we need to display the author, get the data.
98
  if ( ( get_the_title( $post ) != '' ) && true == $args['display_author'] ) {
99
  $author .= '<cite class="author">';
109
  if ( true == $args['display_url'] && '' != $post->url ) {
110
  $author .= ' <span class="url"><a href="' . esc_url( $post->url ) . '">' . $post->url . '</a></span><!--/.excerpt-->' . "\n";
111
  }
112
+
113
  $author .= '</cite><!--/.author-->' . "\n";
114
 
115
  // Templating engine replacement.
130
 
131
  // Remove any remaining %%AVATAR%% template tags.
132
  $template = str_replace( '%%AVATAR%%', '', $template );
133
+ $content = apply_filters( 'woothemes_testimonials_content', get_the_content(), $post );
134
+ $template = str_replace( '%%TEXT%%', $content, $template );
135
 
136
  // Assign for output.
137
  $html .= $template;
138
  }
139
 
140
  wp_reset_postdata();
141
+
142
  $html .= '</div><!--/.testimonials-list-->' . "\n";
143
+
144
  if ( $args['pagination'] == true && count( $query ) > 1 && $args['effect'] != 'none' ) {
145
  $html .= '<div class="pagination">' . "\n";
146
  $html .= '<a href="#" class="btn-prev">' . apply_filters( 'woothemes_testimonials_prev_btn', '&larr; ' . __( 'Previous', 'woothemes-testimonials' ) ) . '</a>' . "\n";
151
  $html .= '</div><!--/.testimonials-->' . "\n";
152
  $html .= $args['after'] . "\n";
153
  }
154
+
155
  // Allow child themes/plugins to filter here.
156
  $html = apply_filters( 'woothemes_testimonials_html', $html, $query, $args );
157
+
158
  if ( $args['echo'] != true ) { return $html; }
159
+
160
  // Should only run is "echo" is set to true.
161
  echo $html;
162
+
163
  do_action( 'woothemes_testimonials_after', $args ); // Only if "echo" is set to true.
164
  } // End woothemes_testimonials()
165
  }
166
 
167
  if ( ! function_exists( 'woothemes_testimonials_shortcode' ) ) {
168
+ /**
169
+ * The shortcode function.
170
+ * @since 1.0.0
171
+ * @param array $atts Shortcode attributes.
172
+ * @param string $content If the shortcode is a wrapper, this is the content being wrapped.
173
+ * @return string Output using the template tag.
174
+ */
175
  function woothemes_testimonials_shortcode ( $atts, $content = null ) {
176
  $args = (array)$atts;
177
 
178
  $defaults = array(
179
+ 'limit' => 5,
180
+ 'orderby' => 'menu_order',
181
+ 'order' => 'DESC',
182
+ 'id' => 0,
183
+ 'display_author' => true,
184
+ 'display_avatar' => true,
185
+ 'display_url' => true,
186
  'effect' => 'fade', // Options: 'fade', 'none'
187
+ 'pagination' => false,
188
+ 'echo' => true,
189
+ 'size' => 50,
190
+ 'category' => 0
191
  );
192
 
193
  $args = shortcode_atts( $defaults, $atts );
199
  if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] );
200
  if ( isset( $args['id'] ) ) $args['id'] = intval( $args['id'] );
201
  if ( isset( $args['size'] ) && ( 0 < intval( $args['size'] ) ) ) $args['size'] = intval( $args['size'] );
202
+ if ( isset( $args['category'] ) && is_numeric( $args['category'] ) ) $args['category'] = intval( $args['category'] );
203
 
204
  // Fix booleans.
205
  foreach ( array( 'display_author', 'display_url', 'pagination', 'display_avatar' ) as $k => $v ) {
215
  }
216
 
217
  add_shortcode( 'woothemes_testimonials', 'woothemes_testimonials_shortcode' );
218
+
219
+ if ( ! function_exists( 'woothemes_testimonials_content_default_filters' ) ) {
220
+ /**
221
+ * Adds default filters to the "woothemes_testimonials_content" filter point.
222
+ * @since 1.3.0
223
+ * @return void
224
+ */
225
+ function woothemes_testimonials_content_default_filters () {
226
+ add_filter( 'woothemes_testimonials_content', 'do_shortcode' );
227
+ } // End woothemes_testimonials_content_default_filters()
228
+
229
+ add_action( 'woothemes_testimonials_content', 'woothemes_testimonials_content_default_filters' );
230
+ }
231
  ?>
woothemes-testimonials.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your testimonials management plugin for WordPress. Show off what your customers or website users are saying about your business and how great they say you are, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
- * Version: 1.2.1
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
@@ -14,8 +14,10 @@
14
  */
15
 
16
  require_once( 'classes/class-woothemes-testimonials.php' );
 
17
  require_once( 'woothemes-testimonials-template.php' );
18
  require_once( 'classes/class-woothemes-widget-testimonials.php' );
19
  global $woothemes_testimonials;
20
  $woothemes_testimonials = new Woothemes_Testimonials( __FILE__ );
 
21
  ?>
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your testimonials management plugin for WordPress. Show off what your customers or website users are saying about your business and how great they say you are, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
+ * Version: 1.3.0
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
14
  */
15
 
16
  require_once( 'classes/class-woothemes-testimonials.php' );
17
+ require_once( 'classes/class-woothemes-testimonials-taxonomy.php' );
18
  require_once( 'woothemes-testimonials-template.php' );
19
  require_once( 'classes/class-woothemes-widget-testimonials.php' );
20
  global $woothemes_testimonials;
21
  $woothemes_testimonials = new Woothemes_Testimonials( __FILE__ );
22
+ $woothemes_testimonials->version = '1.3.0';
23
  ?>