Testimonials Widget - Version 3.4.6

Version Description

= 3.0.0 =

This is a major overhaul without backwards compliance of over 80 changes. Please read the Testimonials Widget 3.0 and Testimonials Widget Premium 2.0 Upgrade Notice for more help.

If you use custom CSS, actions, or filters to modify Testimonials Widget and Testimonials Widget Premium actions or output, this upgrade will not be compatible with those modifications until corrections are made.

= Older Versions =

Read UPGRADING.

Download this release

Release Info

Developer saurabhd
Plugin Icon wp plugin Testimonials Widget
Version 3.4.6
Comparing to
See all releases

Code changes from version 3.4.5 to 3.4.6

CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
 
3
  ## master
4
 
 
 
 
5
  ## 3.4.5
6
  * Fix issue with slider/list to filter/display testimonials using category and tags.
7
 
2
 
3
  ## master
4
 
5
+ ## 3.4.6
6
+ * Update Gamajo-Template-Loader template
7
+
8
  ## 3.4.5
9
  * Fix issue with slider/list to filter/display testimonials using category and tags.
10
 
includes/libraries/Gamajo-Template-Loader/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
 
3
  ## [Unreleased]
4
 
 
 
 
 
 
 
 
 
 
 
 
5
  ## [1.2.0] - 2016-03-26
6
 
7
  - Support adding custom template data.
@@ -25,6 +36,7 @@
25
 
26
  - Initial release.
27
 
28
- [Unreleased]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.2.0...HEAD
 
29
  [1.2.0]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.1.0...1.2.0
30
  [1.1.0]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.0.0...1.1.0
2
 
3
  ## [Unreleased]
4
 
5
+ _Nothing yet._
6
+
7
+ ## [1.3.0] - 2017-03-24
8
+
9
+ - Add prefixed get_template_part filter.
10
+ - Add a template cache to store previously located template paths.
11
+ - Add a custom data variable name cache, so `unset_template_data()` can remove all custom references.
12
+ - Update `set_template_data()` and `unset_template_data()` to become fluent methods.
13
+ - Remove array type hint from `set_template_data()` argument.
14
+ - Update documentation.
15
+
16
  ## [1.2.0] - 2016-03-26
17
 
18
  - Support adding custom template data.
36
 
37
  - Initial release.
38
 
39
+ [Unreleased]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.3.0...HEAD
40
+ [1.3.0]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.2.0...1.3.0
41
  [1.2.0]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.1.0...1.2.0
42
  [1.1.0]: https://github.com/GaryJones/Gamajo-Template-Loader/compare/1.0.0...1.1.0
includes/libraries/Gamajo-Template-Loader/README.md CHANGED
@@ -29,25 +29,27 @@ This isn't a WordPress plugin on its own, so the usual instructions don't apply.
29
  ~~~php
30
  $meal_planner_template_loader->get_template_part( 'recipe' );
31
  ~~~
32
- * If you want to pass data to the template, call the `set_template_data()` method with an array before calling `get_template_part()`.
33
 
34
  ~~~php
35
  $data = array( 'foo' => 'bar', 'baz' => 'boom' );
36
- $meal_planner_template_loader->set_template_data( $data );
37
- $meal_planner_template_loader->get_template_part( 'recipe' );
 
38
  ~~~
39
 
40
- The value of `bar` is now available inside the recipe template as `$data['foo']`.
41
 
42
  If you wish to use a different variable name, add a second parameter to `set_template_data()`:
43
 
44
  ~~~php
45
  $data = array( 'foo' => 'bar', 'baz' => 'boom' );
46
- $meal_planner_template_loader->set_template_data( $data, 'context' );
47
- $meal_planner_template_loader->get_template_part( 'recipe', 'ingredients' );
 
48
  ~~~
49
 
50
- The value of `bar` is now available inside the recipe template as `$context['foo']`.
51
 
52
  This will try to load up `wp-content/themes/my-theme/meal-planner/recipe-ingredients.php`, or `wp-content/themes/my-theme/meal-planner/recipe.php`, then fallback to `wp-content/plugins/meal-planner/templates/recipe-ingredients.php` or `wp-content/plugins/meal-planner/templates/recipe.php`.
53
 
29
  ~~~php
30
  $meal_planner_template_loader->get_template_part( 'recipe' );
31
  ~~~
32
+ * If you want to pass data to the template, call the `set_template_data()` method with an array before calling `get_template_part()`. `set_template_data()` returns the loader object to allow for method chaining.
33
 
34
  ~~~php
35
  $data = array( 'foo' => 'bar', 'baz' => 'boom' );
36
+ $meal_planner_template_loader
37
+ ->set_template_data( $data );
38
+ ->get_template_part( 'recipe' );
39
  ~~~
40
 
41
+ The value of `bar` is now available inside the recipe template as `$data->foo`.
42
 
43
  If you wish to use a different variable name, add a second parameter to `set_template_data()`:
44
 
45
  ~~~php
46
  $data = array( 'foo' => 'bar', 'baz' => 'boom' );
47
+ $meal_planner_template_loader
48
+ ->set_template_data( $data, 'context' )
49
+ ->get_template_part( 'recipe', 'ingredients' );
50
  ~~~
51
 
52
+ The value of `bar` is now available inside the recipe template as `$context->foo`.
53
 
54
  This will try to load up `wp-content/themes/my-theme/meal-planner/recipe-ingredients.php`, or `wp-content/themes/my-theme/meal-planner/recipe.php`, then fallback to `wp-content/plugins/meal-planner/templates/recipe-ingredients.php` or `wp-content/plugins/meal-planner/templates/recipe.php`.
55
 
includes/libraries/Gamajo-Template-Loader/class-gamajo-template-loader.php CHANGED
@@ -7,7 +7,7 @@
7
  * @link http://github.com/GaryJones/Gamajo-Template-Loader
8
  * @copyright 2013 Gary Jones
9
  * @license GPL-2.0+
10
- * @version 1.2.0
11
  */
12
 
13
  if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
@@ -69,6 +69,24 @@ if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
69
  */
70
  protected $plugin_template_directory = 'templates';
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Clean up template data.
74
  *
@@ -92,6 +110,7 @@ if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
92
  public function get_template_part( $slug, $name = null, $load = true ) {
93
  // Execute code for this part.
94
  do_action( 'get_template_part_' . $slug, $slug, $name );
 
95
 
96
  // Get files names of templates, for given slug and name.
97
  $templates = $this->get_template_file_names( $slug, $name );
@@ -110,14 +129,23 @@ if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
110
  *
111
  * @since 1.2.0
112
  *
113
- * @param array $data Custom data for the template.
114
  * @param string $var_name Optional. Variable under which the custom data is available in the template.
115
  * Default is 'data'.
 
 
116
  */
117
- public function set_template_data( array $data, $var_name = 'data' ) {
118
  global $wp_query;
119
 
120
  $wp_query->query_vars[ $var_name ] = (object) $data;
 
 
 
 
 
 
 
121
  }
122
 
123
  /**
@@ -126,13 +154,23 @@ if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
126
  * Good to use once the final template part has been requested.
127
  *
128
  * @since 1.2.0
 
 
129
  */
130
  public function unset_template_data() {
131
  global $wp_query;
132
 
133
- if ( isset( $wp_query->query_vars['data'] ) ) {
134
- unset( $wp_query->query_vars['data'] );
 
 
 
 
 
 
135
  }
 
 
136
  }
137
 
138
  /**
@@ -184,23 +222,35 @@ if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
184
  * @return string The template filename if one is located.
185
  */
186
  public function locate_template( $template_names, $load = false, $require_once = true ) {
187
- // No file found yet.
188
- $located = false;
189
-
190
- // Remove empty entries.
191
- $template_names = array_filter( (array) $template_names );
192
- $template_paths = $this->get_template_paths();
193
-
194
- // Try to find a template file.
195
- foreach ( $template_names as $template_name ) {
196
- // Trim off any slashes from the template name.
197
- $template_name = ltrim( $template_name, '/' );
198
-
199
- // Try locating this template file by looping through the template paths.
200
- foreach ( $template_paths as $template_path ) {
201
- if ( file_exists( $template_path . $template_name ) ) {
202
- $located = $template_path . $template_name;
203
- break 2;
 
 
 
 
 
 
 
 
 
 
 
 
204
  }
205
  }
206
  }
7
  * @link http://github.com/GaryJones/Gamajo-Template-Loader
8
  * @copyright 2013 Gary Jones
9
  * @license GPL-2.0+
10
+ * @version 1.3.0
11
  */
12
 
13
  if ( ! class_exists( 'Gamajo_Template_Loader' ) ) {
69
  */
70
  protected $plugin_template_directory = 'templates';
71
 
72
+ /**
73
+ * Internal use only: Store located template paths.
74
+ *
75
+ * @var array
76
+ */
77
+ private $template_path_cache = array();
78
+
79
+ /**
80
+ * Internal use only: Store variable names used for template data.
81
+ *
82
+ * Means unset_template_data() can remove all custom references from $wp_query.
83
+ *
84
+ * Initialized to contain the default 'data'.
85
+ *
86
+ * @var array
87
+ */
88
+ private $template_data_var_names = array('data');
89
+
90
  /**
91
  * Clean up template data.
92
  *
110
  public function get_template_part( $slug, $name = null, $load = true ) {
111
  // Execute code for this part.
112
  do_action( 'get_template_part_' . $slug, $slug, $name );
113
+ do_action( $this->filter_prefix . '_get_template_part_' . $slug, $slug, $name );
114
 
115
  // Get files names of templates, for given slug and name.
116
  $templates = $this->get_template_file_names( $slug, $name );
129
  *
130
  * @since 1.2.0
131
  *
132
+ * @param mixed $data Custom data for the template.
133
  * @param string $var_name Optional. Variable under which the custom data is available in the template.
134
  * Default is 'data'.
135
+ *
136
+ * @return Gamajo_Template_Loader
137
  */
138
+ public function set_template_data( $data, $var_name = 'data' ) {
139
  global $wp_query;
140
 
141
  $wp_query->query_vars[ $var_name ] = (object) $data;
142
+
143
+ // Add $var_name to custom variable store if not default value
144
+ if( $var_name !== 'data' ) {
145
+ $this->template_data_var_names[] = $var_name;
146
+ }
147
+
148
+ return $this;
149
  }
150
 
151
  /**
154
  * Good to use once the final template part has been requested.
155
  *
156
  * @since 1.2.0
157
+ *
158
+ * @return Gamajo_Template_Loader
159
  */
160
  public function unset_template_data() {
161
  global $wp_query;
162
 
163
+ // Remove any duplicates from the custom variable store
164
+ $custom_var_names = array_unique( $this->template_data_var_names );
165
+
166
+ // Remove each custom data reference from $wp_query
167
+ foreach ( $custom_var_names as $var ) {
168
+ if ( isset( $wp_query->query_vars[$var] ) ) {
169
+ unset( $wp_query->query_vars[$var] );
170
+ }
171
  }
172
+
173
+ return $this;
174
  }
175
 
176
  /**
222
  * @return string The template filename if one is located.
223
  */
224
  public function locate_template( $template_names, $load = false, $require_once = true ) {
225
+
226
+ // Use $template_names as a cache key - either first element of array or the variable itself if it's a string
227
+ $cache_key = is_array( $template_names ) ? $template_names[0] : $template_names;
228
+
229
+ // If the key is in the cache array, we've already located this file.
230
+ if ( isset( $this->template_path_cache[$cache_key] ) ) {
231
+ $located = $this->template_path_cache[$cache_key];
232
+ } else {
233
+
234
+ // No file found yet.
235
+ $located = false;
236
+
237
+ // Remove empty entries.
238
+ $template_names = array_filter( (array) $template_names );
239
+ $template_paths = $this->get_template_paths();
240
+
241
+ // Try to find a template file.
242
+ foreach ( $template_names as $template_name ) {
243
+ // Trim off any slashes from the template name.
244
+ $template_name = ltrim( $template_name, '/' );
245
+
246
+ // Try locating this template file by looping through the template paths.
247
+ foreach ( $template_paths as $template_path ) {
248
+ if ( file_exists( $template_path . $template_name ) ) {
249
+ $located = $template_path . $template_name;
250
+ // Store the template path in the cache
251
+ $this->template_path_cache[$cache_key] = $located;
252
+ break 2;
253
+ }
254
  }
255
  }
256
  }
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: comprock,saurabhd,subharanjan
4
  Donate link: https://axelerant.com/about-axelerant/donate/
5
  Tags: axelerant, client, customer, portfolio, quote, quotes, random, recommendation, reference, review, reviews, slider, testimonial, testimonials, wpml
6
  Requires at least: 3.9.2
7
- Tested up to: 4.9.5
8
- Stable tag: 3.4.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
4
  Donate link: https://axelerant.com/about-axelerant/donate/
5
  Tags: axelerant, client, customer, portfolio, quote, quotes, random, recommendation, reference, review, reviews, slider, testimonial, testimonials, wpml
6
  Requires at least: 3.9.2
7
+ Tested up to: 4.9.8
8
+ Stable tag: 3.4.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
testimonials-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://wordpress.org/plugins/testimonials-widget/
5
  * Description: Easily add social proofing to your website with Testimonials Widget. List or slide reviews via functions, shortcodes, or widgets.
6
  * lets you socially randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site.
7
- * Version: 3.4.5
8
  * Author: Axelerant
9
  * Author URI: https://axelerant.com/
10
  * License: GPLv2 or later
@@ -64,7 +64,7 @@ if ( ! defined( 'TW_PREMIUM_LINK' ) ) {
64
  }
65
 
66
  if ( ! defined( 'TW_VERSION' ) ) {
67
- define( 'TW_VERSION', '3.4.5' );
68
  }
69
 
70
  require_once TW_DIR_INC . 'requirements.php';
4
  * Plugin URI: http://wordpress.org/plugins/testimonials-widget/
5
  * Description: Easily add social proofing to your website with Testimonials Widget. List or slide reviews via functions, shortcodes, or widgets.
6
  * lets you socially randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site.
7
+ * Version: 3.4.6
8
  * Author: Axelerant
9
  * Author URI: https://axelerant.com/
10
  * License: GPLv2 or later
64
  }
65
 
66
  if ( ! defined( 'TW_VERSION' ) ) {
67
+ define( 'TW_VERSION', '3.4.6' );
68
  }
69
 
70
  require_once TW_DIR_INC . 'requirements.php';