Strong Testimonials - Version 2.39.1

Version Description

Download this release

Release Info

Developer machothemes
Plugin Icon 128x128 Strong Testimonials
Version 2.39.1
Comparing to
See all releases

Code changes from version 2.39 to 2.39.1

admin/class-strong-testimonials-post-editor.php CHANGED
@@ -119,6 +119,9 @@ class Strong_Testimonials_Post_Editor {
119
  case 'shortcode' :
120
  self::meta_option__shortcode( $field, $post, $is_new );
121
  break;
 
 
 
122
  default :
123
  self::meta_option__text( $field, $post, $is_new );
124
  }
@@ -150,6 +153,21 @@ class Strong_Testimonials_Post_Editor {
150
  $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
151
  }
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  /**
154
  * URL input.
155
  *
119
  case 'shortcode' :
120
  self::meta_option__shortcode( $field, $post, $is_new );
121
  break;
122
+ case 'textarea' :
123
+ self::meta_option__textarea( $field, $post, $is_new );
124
+ break;
125
  default :
126
  self::meta_option__text( $field, $post, $is_new );
127
  }
153
  $field['input_type'], $field['name'], esc_attr( $post->{$field['name']} ) );
154
  }
155
 
156
+ /**
157
+ * Textarea.
158
+ *
159
+ * @param $field
160
+ * @param $post
161
+ * @param $is_new
162
+ */
163
+ private static function meta_option__textarea( $field, $post, $is_new ) {
164
+ printf(
165
+ '<textarea id="%1$s" name="custom[%1$s]" class="custom-input">%2$s</textarea>',
166
+ esc_attr( $field['name'] ),
167
+ esc_attr( $post->{$field['name']} )
168
+ );
169
+ }
170
+
171
  /**
172
  * URL input.
173
  *
admin/css/post-editor.css CHANGED
@@ -23,7 +23,8 @@
23
 
24
  input[type="text"].custom-input,
25
  input[type="email"].custom-input,
26
- input[type="url"].custom-input {
 
27
  width: 100%;
28
  }
29
 
23
 
24
  input[type="text"].custom-input,
25
  input[type="email"].custom-input,
26
+ input[type="url"].custom-input,
27
+ textarea.custom-input {
28
  width: 100%;
29
  }
30
 
admin/custom-fields.php CHANGED
@@ -109,7 +109,9 @@ function wpmtst_update_custom_fields() {
109
  $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
  $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
  $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
- $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
 
 
113
 
114
  // add to fields array in display order
115
  $fields[ $new_key++ ] = $field;
109
  $field['show_admin_table_option'] = $field['show_admin_table_option'] ? 1 : 0;
110
  $field['show_text_option'] = $field['show_text_option'] ? 1 : 0;
111
  $field['show_placeholder_option'] = $field['show_placeholder_option'] ? 1 : 0;
112
+ $field['show_default_options'] = $field['show_default_options'] ? 1 : 0;
113
+
114
+ $field = apply_filters( 'wpmtst_sanitize_form_field_options', $field );
115
 
116
  // add to fields array in display order
117
  $fields[ $new_key++ ] = $field;
changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 2.39 - May. 24, 2019 =
2
  * added compatibility with Strong Testimonials: Captcha extension
3
 
1
+ = 2.39.1 - Jun. 14, 2019 =
2
+ * improved compatibility with Strong Testimonials: Custom Fields extension
3
+
4
  = 2.39 - May. 24, 2019 =
5
  * added compatibility with Strong Testimonials: Captcha extension
6
 
includes/class-strong-form.php CHANGED
@@ -210,7 +210,7 @@ class Strong_Testimonials_Form {
210
  $testimonial_meta[ $field['name'] ] = esc_url_raw( wpmtst_get_website( $new_post[ $field['name'] ] ) );
211
  }
212
  } elseif ( 'textarea' == $field['input_type'] ) {
213
- $testimonial_post[ $field['name'] ] = wpmtst_sanitize_textarea( $new_post[ $field['name'] ] );
214
  } elseif ( 'checkbox' == $field['input_type'] ) {
215
  $testimonial_meta[ $field['name'] ] = wpmtst_sanitize_checkbox( $new_post, $field['name'] );
216
  } else {
210
  $testimonial_meta[ $field['name'] ] = esc_url_raw( wpmtst_get_website( $new_post[ $field['name'] ] ) );
211
  }
212
  } elseif ( 'textarea' == $field['input_type'] ) {
213
+ $testimonial_meta[ $field['name'] ] = sanitize_text_field( $new_post[ $field['name'] ] );
214
  } elseif ( 'checkbox' == $field['input_type'] ) {
215
  $testimonial_meta[ $field['name'] ] = wpmtst_sanitize_checkbox( $new_post, $field['name'] );
216
  } else {
public/js/lib/form-validation/form-validation.js CHANGED
@@ -4,268 +4,268 @@
4
 
5
  var strongValidation = {
6
 
7
- defaults: {
8
- ajaxUrl: '',
9
- display: {
10
- successMessage: false
11
- },
12
- scroll: {
13
- onError: true,
14
- onErrorOffset: 100,
15
- onSuccess: true,
16
- onSuccessOffset: 100
17
- },
18
- fields: {},
19
- },
20
-
21
- settings: {},
22
-
23
- setOpts: function (options) {
24
- this.settings = jQuery.extend({}, this.defaults, options);
25
- },
26
-
27
- rules: {},
28
-
29
- /**
30
- * Add custom validation rule to star-rating pseudo elements.
31
- */
32
- setRules: function () {
33
- for (var i = 0; i < this.settings.fields.length; i++) {
34
-
35
- if ('rating' === this.settings.fields[i].type) {
36
- if (1 === this.settings.fields[i].required) {
37
- this.rules[this.settings.fields[i].name] = {ratingRequired: true};
38
- }
39
- }
40
-
41
- }
42
- },
43
-
44
- /**
45
- * Initialize.
46
- */
47
- init: function () {
48
-
49
- var strongForm = {};
50
- if (typeof window['strongForm'] !== 'undefined') {
51
- strongForm = window['strongForm'];
52
- }
53
- this.setOpts(strongForm);
54
-
55
- if (this.settings.display.successMessage) {
56
-
57
- this.scrollOnSuccess();
58
-
59
- } else {
60
-
61
- this.setRules();
62
- this.changeEvents();
63
- this.customValidators();
64
- this.validateForm();
65
-
66
- }
67
-
68
- },
69
-
70
- changeEvents: function () {
71
-
72
- // Trim blanks
73
- jQuery('input[type="text"], input[type="url"], input[type="email"], textarea', '#wpmtst-submission-form').on('change blur', function (e) {
74
- e.target.value = e.target.value.trim();
75
- });
76
-
77
- // Add protocol if missing
78
- // Thanks http://stackoverflow.com/a/36429927/51600
79
- jQuery('input[type=url]').change(function () {
80
- if (this.value.length && !/^https*:\/\//.test(this.value)) {
81
- this.value = 'https://' + this.value;
82
- }
83
- });
84
-
85
- // Star ratings
86
- var ratings = document.getElementsByClassName('strong-rating');
87
- for (var i = 0; i < ratings.length; i++) {
88
- // Handle keystrokes
89
- ratings[i].addEventListener('click', this.handleRadioEvent, true);
90
- ratings[i].addEventListener('keyup', this.handleRadioEvent, true);
91
- // Validate on change
92
- ratings[i].addEventListener('change', function () { jQuery(this).valid(); }, true);
93
- }
94
-
95
- },
96
-
97
- handleRadioEvent: function (e) {
98
- // If key 0-5 fired the event, trigger click on that star (including hidden zero).
99
- if (e.keyCode >= 48 && e.keyCode <= 53) {
100
- var key = e.keyCode - 48;
101
- jQuery(this).find('input[type="radio"][value=' + key + ']').click();
102
- }
103
- },
104
-
105
- customValidators: function () {
106
- /**
107
- * Only use elements that can legitimately have a 'name' attribute:
108
- * <button>, <form>, <fieldset>, <iframe>, <input>, <keygen>, <object>,
109
- * <output>, <select>, <textarea>, <map>, <meta>, <param>
110
- *
111
- * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
112
- *
113
- * jQuery Validate v1.16.0
114
- * As of 6/10/2017
115
- */
116
- jQuery.validator.addMethod('ratingRequired', function (value, element) {
117
- return jQuery(element).find('input:checked').val() > 0;
118
- }, jQuery.validator.messages.required);
119
- },
120
-
121
- validateForm: function () {
122
-
123
- /**
124
- * Validate the form
125
- */
126
- var theForm = jQuery('#wpmtst-submission-form');
127
-
128
- theForm.validate({
129
-
130
- onfocusout: false,
131
-
132
- focusInvalid: false,
133
-
134
- invalidHandler: function (form, validator) {
135
- // Focus first invalid input
136
- var errors = validator.numberOfInvalids();
137
- if (errors) {
138
- if (strongValidation.settings.scroll.onError) {
139
- if (typeof validator.errorList[0] !== 'undefined') {
140
- var firstError = jQuery(validator.errorList[0].element);
141
- var fieldOffset = firstError.closest('.form-field').offset();
142
- var scrollTop = fieldOffset.top - strongValidation.settings.scroll.onErrorOffset;
143
- jQuery('html, body').animate({scrollTop: scrollTop}, 800, function () { firstError.focus(); });
144
- }
145
- } else {
146
- validator.errorList[0].element.focus();
147
- }
148
- }
149
- },
150
-
151
- submitHandler: function (form) {
152
-
153
- strongValidation.disableForm();
154
-
155
- // If Ajax
156
- if (strongValidation.settings.ajaxUrl !== '') {
157
-
158
- window.onbeforeunload = function() {
159
- return "Please wait while the form is submitted.";
160
- }
161
-
162
- var formOptions = {
163
- url: strongValidation.settings.ajaxUrl,
164
- data: {
165
- action: 'wpmtst_form2'
166
- },
167
- success: strongValidation.showResponse,
168
- };
169
- jQuery(form).ajaxSubmit(formOptions);
170
-
171
- } else {
172
-
173
- form.submit();
174
-
175
- }
176
- },
177
-
178
- /* Normalizer not working */
179
- // normalizer: function( value ) {
180
- // return jQuery.trim( value )
181
- // },
182
-
183
- rules: strongValidation.rules,
184
-
185
- errorPlacement: function (error, element) {
186
- error.appendTo(element.closest('div.form-field'));
187
- },
188
-
189
- highlight: function (element, errorClass, validClass) {
190
- if (element.type === 'checkbox') {
191
- jQuery(element).closest('.field-wrap').addClass(errorClass).removeClass(validClass);
192
- } else if ('rating' === jQuery(element).data('fieldType')) {
193
- jQuery(element).closest('.field-wrap').addClass(errorClass).removeClass(validClass);
194
- } else {
195
- jQuery(element).addClass(errorClass).removeClass(validClass);
196
- }
197
- },
198
-
199
- unhighlight: function (element, errorClass, validClass) {
200
- if (element.type === 'checkbox') {
201
- jQuery(element).closest('.field-wrap').removeClass(errorClass).addClass(validClass);
202
- } else if ('rating' === jQuery(element).data('fieldType')) {
203
- jQuery(element).closest('.field-wrap').removeClass(errorClass).addClass(validClass);
204
- } else {
205
- jQuery(element).removeClass(errorClass).addClass(validClass);
206
- }
207
- }
208
-
209
- });
210
-
211
- },
212
-
213
- /**
214
- * Display message/errors upon Ajax submission
215
- *
216
- * @param response
217
- */
218
- showResponse: function (response) {
219
- window.onbeforeunload = null;
220
- strongValidation.enableForm();
221
- var obj = JSON.parse(response);
222
- if (obj.success) {
223
- jQuery('#wpmtst-form').html(obj.message);
224
- strongValidation.scrollOnSuccess();
225
- } else {
226
- for (var key in obj.errors) {
227
- if (obj.errors.hasOwnProperty(key)) {
228
- jQuery('div.wpmtst-' + key)
229
- .find('span.error')
230
- .remove()
231
- .end()
232
- .append('<span class="error">' + obj.errors[key] + '</span>');
233
- }
234
- }
235
- }
236
- },
237
-
238
- /**
239
- * Scroll to success message
240
- */
241
- scrollOnSuccess: function () {
242
- if (strongValidation.settings.scroll.onSuccess) {
243
- var containerOffset, scrollTop;
244
- containerOffset = jQuery('.testimonial-success').offset();
245
- if (containerOffset) {
246
- scrollTop = containerOffset.top - strongValidation.settings.scroll.onSuccessOffset;
247
- // is WordPress admin bar showing?
248
- if (jQuery('#wpadminbar').length) {
249
- scrollTop -= 32;
250
- }
251
- jQuery('html, body').animate({scrollTop: scrollTop}, 800);
252
- }
253
- }
254
- },
255
-
256
- /**
257
- * Show overlay during form submission.
258
- */
259
- disableForm: function () {
260
- jQuery('.strong-form-wait').show();
261
- jQuery('#wpmtst_submit_testimonial').prop('disabled',true);
262
- },
263
-
264
- /**
265
- * Hide overlay after form submission.
266
- */
267
- enableForm: function () {
268
- jQuery('.strong-form-wait').hide();
269
- jQuery('#wpmtst_submit_testimonial').prop('disabled',false);
270
- }
271
- };
4
 
5
  var strongValidation = {
6
 
7
+ defaults: {
8
+ ajaxUrl: '',
9
+ display: {
10
+ successMessage: false
11
+ },
12
+ scroll: {
13
+ onError: true,
14
+ onErrorOffset: 100,
15
+ onSuccess: true,
16
+ onSuccessOffset: 100
17
+ },
18
+ fields: {},
19
+ },
20
+
21
+ settings: {},
22
+
23
+ setOpts: function (options) {
24
+ this.settings = jQuery.extend({}, this.defaults, options);
25
+ },
26
+
27
+ rules: {},
28
+
29
+ /**
30
+ * Add custom validation rule to star-rating pseudo elements.
31
+ */
32
+ setRules: function () {
33
+ for (var i = 0; i < this.settings.fields.length; i++) {
34
+
35
+ if ('rating' === this.settings.fields[i].type) {
36
+ if (1 === this.settings.fields[i].required) {
37
+ this.rules[this.settings.fields[i].name] = {ratingRequired: true};
38
+ }
39
+ }
40
+
41
+ }
42
+ },
43
+
44
+ /**
45
+ * Initialize.
46
+ */
47
+ init: function () {
48
+
49
+ var strongForm = {};
50
+ if (typeof window['strongForm'] !== 'undefined') {
51
+ strongForm = window['strongForm'];
52
+ }
53
+ this.setOpts(strongForm);
54
+
55
+ if (this.settings.display.successMessage) {
56
+
57
+ this.scrollOnSuccess();
58
+
59
+ } else {
60
+
61
+ this.setRules();
62
+ this.changeEvents();
63
+ this.customValidators();
64
+ this.validateForm();
65
+
66
+ }
67
+
68
+ },
69
+
70
+ changeEvents: function () {
71
+
72
+ // Trim blanks
73
+ jQuery('input[type="text"], input[type="url"], input[type="email"], textarea', '#wpmtst-submission-form').on('change blur', function (e) {
74
+ e.target.value = e.target.value.trim();
75
+ });
76
+
77
+ // Add protocol if missing
78
+ // Thanks http://stackoverflow.com/a/36429927/51600
79
+ jQuery('input[type=url]').change(function () {
80
+ if (this.value.length && !/^https*:\/\//.test(this.value)) {
81
+ this.value = 'https://' + this.value;
82
+ }
83
+ });
84
+
85
+ // Star ratings
86
+ var ratings = document.getElementsByClassName('strong-rating');
87
+ for (var i = 0; i < ratings.length; i++) {
88
+ // Handle keystrokes
89
+ ratings[i].addEventListener('click', this.handleRadioEvent, true);
90
+ ratings[i].addEventListener('keyup', this.handleRadioEvent, true);
91
+ // Validate on change
92
+ ratings[i].addEventListener('change', function () { jQuery(this).valid(); }, true);
93
+ }
94
+
95
+ },
96
+
97
+ handleRadioEvent: function (e) {
98
+ // If key 0-5 fired the event, trigger click on that star (including hidden zero).
99
+ if (e.keyCode >= 48 && e.keyCode <= 53) {
100
+ var key = e.keyCode - 48;
101
+ jQuery(this).find('input[type="radio"][value=' + key + ']').click();
102
+ }
103
+ },
104
+
105
+ customValidators: function () {
106
+ /**
107
+ * Only use elements that can legitimately have a 'name' attribute:
108
+ * <button>, <form>, <fieldset>, <iframe>, <input>, <keygen>, <object>,
109
+ * <output>, <select>, <textarea>, <map>, <meta>, <param>
110
+ *
111
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
112
+ *
113
+ * jQuery Validate v1.16.0
114
+ * As of 6/10/2017
115
+ */
116
+ jQuery.validator.addMethod('ratingRequired', function (value, element) {
117
+ return jQuery(element).find('input:checked').val() > 0;
118
+ }, jQuery.validator.messages.required);
119
+ },
120
+
121
+ validateForm: function () {
122
+
123
+ /**
124
+ * Validate the form
125
+ */
126
+ var theForm = jQuery('#wpmtst-submission-form');
127
+
128
+ theForm.validate({
129
+
130
+ onfocusout: false,
131
+
132
+ focusInvalid: false,
133
+
134
+ invalidHandler: function (form, validator) {
135
+ // Focus first invalid input
136
+ var errors = validator.numberOfInvalids();
137
+ if (errors) {
138
+ if (strongValidation.settings.scroll.onError) {
139
+ if (typeof validator.errorList[0] !== 'undefined') {
140
+ var firstError = jQuery(validator.errorList[0].element);
141
+ var fieldOffset = firstError.closest('.form-field').offset();
142
+ var scrollTop = fieldOffset.top - strongValidation.settings.scroll.onErrorOffset;
143
+ jQuery('html, body').animate({scrollTop: scrollTop}, 800, function () { firstError.focus(); });
144
+ }
145
+ } else {
146
+ validator.errorList[0].element.focus();
147
+ }
148
+ }
149
+ },
150
+
151
+ submitHandler: function (form) {
152
+
153
+ strongValidation.disableForm();
154
+
155
+ // If Ajax
156
+ if (strongValidation.settings.ajaxUrl !== '') {
157
+
158
+ window.onbeforeunload = function() {
159
+ return "Please wait while the form is submitted.";
160
+ }
161
+
162
+ var formOptions = {
163
+ url: strongValidation.settings.ajaxUrl,
164
+ data: {
165
+ action: 'wpmtst_form2'
166
+ },
167
+ success: strongValidation.showResponse,
168
+ };
169
+ jQuery(form).ajaxSubmit(formOptions);
170
+
171
+ } else {
172
+
173
+ form.submit();
174
+
175
+ }
176
+ },
177
+
178
+ /* Normalizer not working */
179
+ // normalizer: function( value ) {
180
+ // return jQuery.trim( value )
181
+ // },
182
+
183
+ rules: strongValidation.rules,
184
+
185
+ errorPlacement: function (error, element) {
186
+ error.appendTo(element.closest('div.form-field'));
187
+ },
188
+
189
+ highlight: function (element, errorClass, validClass) {
190
+ if (element.type === 'checkbox') {
191
+ jQuery(element).closest('.field-wrap').addClass(errorClass).removeClass(validClass);
192
+ } else if ('rating' === jQuery(element).data('fieldType')) {
193
+ jQuery(element).closest('.field-wrap').addClass(errorClass).removeClass(validClass);
194
+ } else {
195
+ jQuery(element).addClass(errorClass).removeClass(validClass);
196
+ }
197
+ },
198
+
199
+ unhighlight: function (element, errorClass, validClass) {
200
+ if (element.type === 'checkbox') {
201
+ jQuery(element).closest('.field-wrap').removeClass(errorClass).addClass(validClass);
202
+ } else if ('rating' === jQuery(element).data('fieldType')) {
203
+ jQuery(element).closest('.field-wrap').removeClass(errorClass).addClass(validClass);
204
+ } else {
205
+ jQuery(element).removeClass(errorClass).addClass(validClass);
206
+ }
207
+ }
208
+
209
+ });
210
+
211
+ },
212
+
213
+ /**
214
+ * Display message/errors upon Ajax submission
215
+ *
216
+ * @param response
217
+ */
218
+ showResponse: function (response) {
219
+ window.onbeforeunload = null;
220
+ strongValidation.enableForm();
221
+ var obj = JSON.parse(response);
222
+ if (obj.success) {
223
+ jQuery('#wpmtst-form').html(obj.message);
224
+ strongValidation.scrollOnSuccess();
225
+ } else {
226
+ for (var key in obj.errors) {
227
+ if (obj.errors.hasOwnProperty(key)) {
228
+ jQuery('#wpmtst-submission-form').children('.field-' + key)
229
+ .find('span.error')
230
+ .remove()
231
+ .end()
232
+ .append('<span class="error">' + obj.errors[key] + '</span>');
233
+ }
234
+ }
235
+ }
236
+ },
237
+
238
+ /**
239
+ * Scroll to success message
240
+ */
241
+ scrollOnSuccess: function () {
242
+ if (strongValidation.settings.scroll.onSuccess) {
243
+ var containerOffset, scrollTop;
244
+ containerOffset = jQuery('.testimonial-success').offset();
245
+ if (containerOffset) {
246
+ scrollTop = containerOffset.top - strongValidation.settings.scroll.onSuccessOffset;
247
+ // is WordPress admin bar showing?
248
+ if (jQuery('#wpadminbar').length) {
249
+ scrollTop -= 32;
250
+ }
251
+ jQuery('html, body').animate({scrollTop: scrollTop}, 800);
252
+ }
253
+ }
254
+ },
255
+
256
+ /**
257
+ * Show overlay during form submission.
258
+ */
259
+ disableForm: function () {
260
+ jQuery('.strong-form-wait').show();
261
+ jQuery('#wpmtst_submit_testimonial').prop('disabled',true);
262
+ },
263
+
264
+ /**
265
+ * Hide overlay after form submission.
266
+ */
267
+ enableForm: function () {
268
+ jQuery('.strong-form-wait').hide();
269
+ jQuery('#wpmtst_submit_testimonial').prop('disabled',false);
270
+ }
271
+ };
public/js/lib/form-validation/form-validation.min.js CHANGED
@@ -1 +1 @@
1
- var strongValidation={defaults:{ajaxUrl:"",display:{successMessage:false},scroll:{onError:true,onErrorOffset:100,onSuccess:true,onSuccessOffset:100},fields:{}},settings:{},setOpts:function(options){this.settings=jQuery.extend({},this.defaults,options)},rules:{},setRules:function(){for(var i=0;i<this.settings.fields.length;i++){if("rating"===this.settings.fields[i].type){if(1===this.settings.fields[i].required){this.rules[this.settings.fields[i].name]={ratingRequired:true}}}}},init:function(){var strongForm={};if(typeof window["strongForm"]!=="undefined"){strongForm=window["strongForm"]}this.setOpts(strongForm);if(this.settings.display.successMessage){this.scrollOnSuccess()}else{this.setRules();this.changeEvents();this.customValidators();this.validateForm()}},changeEvents:function(){jQuery('input[type="text"], input[type="url"], input[type="email"], textarea',"#wpmtst-submission-form").on("change blur",function(e){e.target.value=e.target.value.trim()});jQuery("input[type=url]").change(function(){if(this.value.length&&!/^https*:\/\//.test(this.value)){this.value="https://"+this.value}});var ratings=document.getElementsByClassName("strong-rating");for(var i=0;i<ratings.length;i++){ratings[i].addEventListener("click",this.handleRadioEvent,true);ratings[i].addEventListener("keyup",this.handleRadioEvent,true);ratings[i].addEventListener("change",function(){jQuery(this).valid()},true)}},handleRadioEvent:function(e){if(e.keyCode>=48&&e.keyCode<=53){var key=e.keyCode-48;jQuery(this).find('input[type="radio"][value='+key+"]").click()}},customValidators:function(){jQuery.validator.addMethod("ratingRequired",function(value,element){return jQuery(element).find("input:checked").val()>0},jQuery.validator.messages.required)},validateForm:function(){var theForm=jQuery("#wpmtst-submission-form");theForm.validate({onfocusout:false,focusInvalid:false,invalidHandler:function(form,validator){var errors=validator.numberOfInvalids();if(errors){if(strongValidation.settings.scroll.onError){if(typeof validator.errorList[0]!=="undefined"){var firstError=jQuery(validator.errorList[0].element);var fieldOffset=firstError.closest(".form-field").offset();var scrollTop=fieldOffset.top-strongValidation.settings.scroll.onErrorOffset;jQuery("html, body").animate({scrollTop:scrollTop},800,function(){firstError.focus()})}}else{validator.errorList[0].element.focus()}}},submitHandler:function(form){strongValidation.disableForm();if(strongValidation.settings.ajaxUrl!==""){window.onbeforeunload=function(){return"Please wait while the form is submitted."};var formOptions={url:strongValidation.settings.ajaxUrl,data:{action:"wpmtst_form2"},success:strongValidation.showResponse};jQuery(form).ajaxSubmit(formOptions)}else{form.submit()}},rules:strongValidation.rules,errorPlacement:function(error,element){error.appendTo(element.closest("div.form-field"))},highlight:function(element,errorClass,validClass){if(element.type==="checkbox"){jQuery(element).closest(".field-wrap").addClass(errorClass).removeClass(validClass)}else if("rating"===jQuery(element).data("fieldType")){jQuery(element).closest(".field-wrap").addClass(errorClass).removeClass(validClass)}else{jQuery(element).addClass(errorClass).removeClass(validClass)}},unhighlight:function(element,errorClass,validClass){if(element.type==="checkbox"){jQuery(element).closest(".field-wrap").removeClass(errorClass).addClass(validClass)}else if("rating"===jQuery(element).data("fieldType")){jQuery(element).closest(".field-wrap").removeClass(errorClass).addClass(validClass)}else{jQuery(element).removeClass(errorClass).addClass(validClass)}}})},showResponse:function(response){window.onbeforeunload=null;strongValidation.enableForm();var obj=JSON.parse(response);if(obj.success){jQuery("#wpmtst-form").html(obj.message);strongValidation.scrollOnSuccess()}else{for(var key in obj.errors){if(obj.errors.hasOwnProperty(key)){jQuery("div.wpmtst-"+key).find("span.error").remove().end().append('<span class="error">'+obj.errors[key]+"</span>")}}}},scrollOnSuccess:function(){if(strongValidation.settings.scroll.onSuccess){var containerOffset,scrollTop;containerOffset=jQuery(".testimonial-success").offset();if(containerOffset){scrollTop=containerOffset.top-strongValidation.settings.scroll.onSuccessOffset;if(jQuery("#wpadminbar").length){scrollTop-=32}jQuery("html, body").animate({scrollTop:scrollTop},800)}}},disableForm:function(){jQuery(".strong-form-wait").show();jQuery("#wpmtst_submit_testimonial").prop("disabled",true)},enableForm:function(){jQuery(".strong-form-wait").hide();jQuery("#wpmtst_submit_testimonial").prop("disabled",false)}};
1
+ var strongValidation={defaults:{ajaxUrl:"",display:{successMessage:!1},scroll:{onError:!0,onErrorOffset:100,onSuccess:!0,onSuccessOffset:100},fields:{}},settings:{},setOpts:function(e){this.settings=jQuery.extend({},this.defaults,e)},rules:{},setRules:function(){for(var e=0;e<this.settings.fields.length;e++)"rating"===this.settings.fields[e].type&&1===this.settings.fields[e].required&&(this.rules[this.settings.fields[e].name]={ratingRequired:!0})},init:function(){var e={};void 0!==window.strongForm&&(e=window.strongForm),this.setOpts(e),this.settings.display.successMessage?this.scrollOnSuccess():(this.setRules(),this.changeEvents(),this.customValidators(),this.validateForm())},changeEvents:function(){jQuery('input[type="text"], input[type="url"], input[type="email"], textarea',"#wpmtst-submission-form").on("change blur",function(e){e.target.value=e.target.value.trim()}),jQuery("input[type=url]").change(function(){this.value.length&&!/^https*:\/\//.test(this.value)&&(this.value="https://"+this.value)});for(var e=document.getElementsByClassName("strong-rating"),s=0;s<e.length;s++)e[s].addEventListener("click",this.handleRadioEvent,!0),e[s].addEventListener("keyup",this.handleRadioEvent,!0),e[s].addEventListener("change",function(){jQuery(this).valid()},!0)},handleRadioEvent:function(e){if(48<=e.keyCode&&e.keyCode<=53){var s=e.keyCode-48;jQuery(this).find('input[type="radio"][value='+s+"]").click()}},customValidators:function(){jQuery.validator.addMethod("ratingRequired",function(e,s){return 0<jQuery(s).find("input:checked").val()},jQuery.validator.messages.required)},validateForm:function(){jQuery("#wpmtst-submission-form").validate({onfocusout:!1,focusInvalid:!1,invalidHandler:function(e,s){if(s.numberOfInvalids())if(strongValidation.settings.scroll.onError){if(void 0!==s.errorList[0]){var t=jQuery(s.errorList[0].element),i=t.closest(".form-field").offset().top-strongValidation.settings.scroll.onErrorOffset;jQuery("html, body").animate({scrollTop:i},800,function(){t.focus()})}}else s.errorList[0].element.focus()},submitHandler:function(e){if(strongValidation.disableForm(),""!==strongValidation.settings.ajaxUrl){window.onbeforeunload=function(){return"Please wait while the form is submitted."};var s={url:strongValidation.settings.ajaxUrl,data:{action:"wpmtst_form2"},success:strongValidation.showResponse};jQuery(e).ajaxSubmit(s)}else e.submit()},rules:strongValidation.rules,errorPlacement:function(e,s){e.appendTo(s.closest("div.form-field"))},highlight:function(e,s,t){"checkbox"===e.type?jQuery(e).closest(".field-wrap").addClass(s).removeClass(t):"rating"===jQuery(e).data("fieldType")?jQuery(e).closest(".field-wrap").addClass(s).removeClass(t):jQuery(e).addClass(s).removeClass(t)},unhighlight:function(e,s,t){"checkbox"===e.type?jQuery(e).closest(".field-wrap").removeClass(s).addClass(t):"rating"===jQuery(e).data("fieldType")?jQuery(e).closest(".field-wrap").removeClass(s).addClass(t):jQuery(e).removeClass(s).addClass(t)}})},showResponse:function(e){window.onbeforeunload=null,strongValidation.enableForm();var s=JSON.parse(e);if(s.success)jQuery("#wpmtst-form").html(s.message),strongValidation.scrollOnSuccess();else for(var t in s.errors)s.errors.hasOwnProperty(t)&&jQuery("#wpmtst-submission-form").children(".field-"+t).find("span.error").remove().end().append('<span class="error">'+s.errors[t]+"</span>")},scrollOnSuccess:function(){var e,s;strongValidation.settings.scroll.onSuccess&&(e=jQuery(".testimonial-success").offset())&&(s=e.top-strongValidation.settings.scroll.onSuccessOffset,jQuery("#wpadminbar").length&&(s-=32),jQuery("html, body").animate({scrollTop:s},800))},disableForm:function(){jQuery(".strong-form-wait").show(),jQuery("#wpmtst_submit_testimonial").prop("disabled",!0)},enableForm:function(){jQuery(".strong-form-wait").hide(),jQuery("#wpmtst_submit_testimonial").prop("disabled",!1)}};
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: testimonials, testimonial slider, testimonial form, star ratings
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.2
7
- Stable tag: 2.39
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.2
7
+ Stable tag: 2.39.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
strong-testimonials.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
- * Version: 2.39
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  exit;
45
  }
46
 
47
- define( 'WPMTST_VERSION', '2.39' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  defined( 'WPMTST_STORE_URL' ) || define( 'WPMTST_STORE_URL', 'https://strongtestimonials.com' );
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
+ * Version: 2.39.1
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
44
  exit;
45
  }
46
 
47
+ define( 'WPMTST_VERSION', '2.39.1' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  defined( 'WPMTST_STORE_URL' ) || define( 'WPMTST_STORE_URL', 'https://strongtestimonials.com' );