Version Description
- June 1, 2018 =
- Fix XSS vulnerablilities reported by DefenseCode using Thunderscan.
- Add spinner UI element while form is being submitted to deter visitor from navigating away.
- Minor admin UI improvements.
Download this release
Release Info
Developer | cdillon27 |
Plugin | Strong Testimonials |
Version | 2.31.5 |
Comparing to | |
See all releases |
Code changes from version 2.31.4 to 2.31.5
- admin/about/class-strong-testimonials-about.php +1 -1
- admin/about/whats-new.php +2 -1
- admin/css/views.css +1 -1
- admin/js/views.js +21 -3
- admin/partials/views/group-compat.php +8 -1
- admin/partials/views/group-extra.php +12 -2
- admin/partials/views/group-fields.php +61 -6
- admin/partials/views/group-form.php +12 -2
- admin/partials/views/group-query.php +22 -5
- admin/partials/views/group-slideshow.php +12 -2
- admin/partials/views/group-style.php +12 -2
- admin/partials/views/view-mode.php +2 -2
- admin/partials/views/view-shortcode.php +12 -3
- admin/scss/_partials/_custom-fields.scss +1 -1
- admin/settings/class-strong-testimonials-settings-compat.php +13 -8
- admin/views-validate.php +2 -2
- admin/views.php +123 -110
- includes/class-strong-view-form.php +25 -1
- public/js/controller.js +10 -0
- public/js/controller.min.js +1 -1
- public/js/lib/form-validation/form-validation.js +31 -2
- public/js/lib/form-validation/form-validation.min.js +1 -1
- readme.txt +10 -2
- strong-testimonials.php +2 -2
- templates-scss/_partials/_structure-form.scss +21 -0
- templates/default-form/form.css +20 -0
- templates/default-form/form.php +4 -0
- templates/simple-form/form.css +20 -0
- templates/simple-form/form.php +4 -0
- templates/unstyled-form/form.php +4 -0
admin/about/class-strong-testimonials-about.php
CHANGED
@@ -63,7 +63,7 @@ class Strong_Testimonials_About {
|
|
63 |
<p class="about-text">
|
64 |
<?php _e( 'Thank you for updating to the latest version!' ); ?>
|
65 |
<?php /* translators: %s is the plugin version number */ ?>
|
66 |
-
<?php printf( 'Strong Testimonials %s
|
67 |
</p>
|
68 |
|
69 |
<div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
|
63 |
<p class="about-text">
|
64 |
<?php _e( 'Thank you for updating to the latest version!' ); ?>
|
65 |
<?php /* translators: %s is the plugin version number */ ?>
|
66 |
+
<?php printf( 'Strong Testimonials %s fixes minor security vulnerabilities, adds a shortcode for your average rating and has more compatibility options.', $major_minor ); ?>
|
67 |
</p>
|
68 |
|
69 |
<div class="wp-badge strong-testimonials"><?php printf( __( 'Version %s' ), $major_minor ); ?></div>
|
admin/about/whats-new.php
CHANGED
@@ -14,13 +14,14 @@
|
|
14 |
|
15 |
<h3 class="heading">Point Releases</h3>
|
16 |
|
17 |
-
<p>
|
18 |
|
19 |
<ul>
|
20 |
<li>Version 2.31.1</li>
|
21 |
<li>Version 2.31.2</li>
|
22 |
<li>Version 2.31.3</li>
|
23 |
<li>Version 2.31.4</li>
|
|
|
24 |
</ul>
|
25 |
|
26 |
</div>
|
14 |
|
15 |
<h3 class="heading">Point Releases</h3>
|
16 |
|
17 |
+
<p>Security fixes, bug fixes and improved compatibility. <a href="https://wordpress.org/plugins/strong-testimonials/#developers" target="_blank">Read changelog on wordpress.org</a>.</p>
|
18 |
|
19 |
<ul>
|
20 |
<li>Version 2.31.1</li>
|
21 |
<li>Version 2.31.2</li>
|
22 |
<li>Version 2.31.3</li>
|
23 |
<li>Version 2.31.4</li>
|
24 |
+
<li>Version 2.31.5</li>
|
25 |
</ul>
|
26 |
|
27 |
</div>
|
admin/css/views.css
CHANGED
@@ -782,7 +782,7 @@ ul.radio-list.template-list li {
|
|
782 |
border-color: #444; }
|
783 |
.fields .field3 {
|
784 |
flex: 20; }
|
785 |
-
.fields
|
786 |
display: inline-block;
|
787 |
cursor: pointer;
|
788 |
padding: 10px 10px 8px;
|
782 |
border-color: #444; }
|
783 |
.fields .field3 {
|
784 |
flex: 20; }
|
785 |
+
.fields div.link {
|
786 |
display: inline-block;
|
787 |
cursor: pointer;
|
788 |
padding: 10px 10px 8px;
|
admin/js/views.js
CHANGED
@@ -101,10 +101,26 @@ Array.max = function (array) {
|
|
101 |
}(jQuery));
|
102 |
|
103 |
/**
|
104 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
*/
|
106 |
jQuery(document).ready(function ($) {
|
107 |
-
|
|
|
108 |
$('.view-layout-masonry .example-container')
|
109 |
.find('.box')
|
110 |
.width(jQuery('.grid-sizer').width())
|
@@ -113,6 +129,8 @@ jQuery(document).ready(function ($) {
|
|
113 |
|
114 |
// Category select width
|
115 |
$.fn.afterToggle();
|
|
|
|
|
116 |
});
|
117 |
|
118 |
(function ($) {
|
@@ -189,7 +207,7 @@ jQuery(document).ready(function ($) {
|
|
189 |
* Restore defaults
|
190 |
*/
|
191 |
// TODO i18n
|
192 |
-
$('#restore-defaults').click
|
193 |
return confirm('Restore the default settings?');
|
194 |
});
|
195 |
|
101 |
}(jQuery));
|
102 |
|
103 |
/**
|
104 |
+
* Remove 'result' query argument.
|
105 |
+
*/
|
106 |
+
removeResultArg = function () {
|
107 |
+
var urlParams = new URLSearchParams(window.location.search);
|
108 |
+
if (urlParams.has('result')) {
|
109 |
+
urlParams.delete('result');
|
110 |
+
var newURL = window.location.pathname;
|
111 |
+
if (urlParams.toString()) {
|
112 |
+
newURL = newURL + '?' + urlParams.toString();
|
113 |
+
}
|
114 |
+
window.history.replaceState({}, document.title, newURL);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Initial actions on document.ready
|
120 |
*/
|
121 |
jQuery(document).ready(function ($) {
|
122 |
+
|
123 |
+
// Masonry in the Layout section
|
124 |
$('.view-layout-masonry .example-container')
|
125 |
.find('.box')
|
126 |
.width(jQuery('.grid-sizer').width())
|
129 |
|
130 |
// Category select width
|
131 |
$.fn.afterToggle();
|
132 |
+
|
133 |
+
removeResultArg();
|
134 |
});
|
135 |
|
136 |
(function ($) {
|
207 |
* Restore defaults
|
208 |
*/
|
209 |
// TODO i18n
|
210 |
+
$('#restore-defaults').on('click', function () {
|
211 |
return confirm('Restore the default settings?');
|
212 |
});
|
213 |
|
admin/partials/views/group-compat.php
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<h3>
|
|
|
3 |
<?php _e( 'Compatibility', 'strong-testimonials' ); ?>
|
4 |
</h3>
|
5 |
<table class="form-table multiple group-general">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
apply_filters( 'wpmtst_view_section', '', 'compat' ),
|
5 |
+
);
|
6 |
+
?>
|
7 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
8 |
<h3>
|
9 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
10 |
<?php _e( 'Compatibility', 'strong-testimonials' ); ?>
|
11 |
</h3>
|
12 |
<table class="form-table multiple group-general">
|
admin/partials/views/group-extra.php
CHANGED
@@ -1,6 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Extra', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-layout">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_display',
|
5 |
+
'then_not_form',
|
6 |
+
'then_slideshow',
|
7 |
+
'then_not_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'extra' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
14 |
<?php _e( 'Extra', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-layout">
|
admin/partials/views/group-fields.php
CHANGED
@@ -1,20 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Fields', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-show">
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<?php include( 'option-title.php' ); ?>
|
9 |
</tr>
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
<?php include( 'option-thumbnail.php' ); ?>
|
12 |
</tr>
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<?php include( 'option-content.php' ); ?>
|
15 |
</tr>
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
<?php include( 'option-client-section.php' ); ?>
|
18 |
</tr>
|
|
|
19 |
</table>
|
20 |
</div>
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_display',
|
5 |
+
'then_not_form',
|
6 |
+
'then_slideshow',
|
7 |
+
'then_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'fields' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
14 |
<?php _e( 'Fields', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-show">
|
17 |
+
|
18 |
+
<?php
|
19 |
+
$then_classes = array(
|
20 |
+
'then',
|
21 |
+
'then_display',
|
22 |
+
'then_not_form',
|
23 |
+
'then_slideshow',
|
24 |
+
'then_not_single_template',
|
25 |
+
apply_filters( 'wpmtst_view_section', '', 'title' ),
|
26 |
+
);
|
27 |
+
?>
|
28 |
+
<tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
29 |
<?php include( 'option-title.php' ); ?>
|
30 |
</tr>
|
31 |
+
|
32 |
+
<?php
|
33 |
+
$then_classes = array(
|
34 |
+
'then',
|
35 |
+
'then_display',
|
36 |
+
'then_not_form',
|
37 |
+
'then_slideshow',
|
38 |
+
'then_not_single_template',
|
39 |
+
apply_filters( 'wpmtst_view_section', '', 'thumbnail' ),
|
40 |
+
);
|
41 |
+
?>
|
42 |
+
<tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
43 |
<?php include( 'option-thumbnail.php' ); ?>
|
44 |
</tr>
|
45 |
+
|
46 |
+
<?php
|
47 |
+
$then_classes = array(
|
48 |
+
'then',
|
49 |
+
'then_display',
|
50 |
+
'then_not_form',
|
51 |
+
'then_slideshow',
|
52 |
+
'then_not_single_template',
|
53 |
+
apply_filters( 'wpmtst_view_section', '', 'content' ),
|
54 |
+
);
|
55 |
+
?>
|
56 |
+
<tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
57 |
<?php include( 'option-content.php' ); ?>
|
58 |
</tr>
|
59 |
+
|
60 |
+
<?php
|
61 |
+
$then_classes = array(
|
62 |
+
'then',
|
63 |
+
'then_display',
|
64 |
+
'then_not_form',
|
65 |
+
'then_slideshow',
|
66 |
+
'then_single_template',
|
67 |
+
apply_filters( 'wpmtst_view_section', '', 'client-section' ),
|
68 |
+
);
|
69 |
+
?>
|
70 |
+
<tr class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
71 |
<?php include( 'option-client-section.php' ); ?>
|
72 |
</tr>
|
73 |
+
|
74 |
</table>
|
75 |
</div>
|
admin/partials/views/group-form.php
CHANGED
@@ -1,6 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Actions', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-select">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_not_display',
|
5 |
+
'then_not_slideshow',
|
6 |
+
'then_form',
|
7 |
+
'then_not_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'form' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
14 |
<?php _e( 'Actions', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-select">
|
admin/partials/views/group-query.php
CHANGED
@@ -1,13 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Query', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-select">
|
7 |
<tr class="subheading">
|
8 |
-
<td
|
9 |
-
<td
|
10 |
-
<td class="divider" colspan="2">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
<td>Example</td>
|
12 |
</tr>
|
13 |
<tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_display',
|
5 |
+
'then_not_form',
|
6 |
+
'then_slideshow',
|
7 |
+
'then_not_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'select' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
14 |
<?php _e( 'Query', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-select">
|
17 |
<tr class="subheading">
|
18 |
+
<td><?php _e( 'Option', 'strong-testimonials' ); ?></td>
|
19 |
+
<td><?php _e( 'Setting', 'strong-testimonials' ); ?></td>
|
20 |
+
<td class="divider" colspan="2">
|
21 |
+
<?php _e( 'or Shortcode Attribute', 'strong-testimonials' ); ?>
|
22 |
+
<span class="help-links">
|
23 |
+
<span class="description">
|
24 |
+
<a href="#tab-panel-wpmtst-help-shortcode" class="open-help-tab"><?php _e( 'Help' ); ?></a>
|
25 |
+
</span>
|
26 |
+
</span>
|
27 |
+
</td>
|
28 |
<td>Example</td>
|
29 |
</tr>
|
30 |
<tr class="then then_display then_not_slideshow then_not_form" style="display: none;">
|
admin/partials/views/group-slideshow.php
CHANGED
@@ -1,6 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Slideshow', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-select">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_not_display',
|
5 |
+
'then_not_form',
|
6 |
+
'then_slideshow',
|
7 |
+
'then_not_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'slideshow' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: In the view editor. */ ?>
|
14 |
<?php _e( 'Slideshow', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-select">
|
admin/partials/views/group-style.php
CHANGED
@@ -1,6 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<h3>
|
|
|
4 |
<?php _e( 'Style', 'strong-testimonials' ); ?>
|
5 |
</h3>
|
6 |
<table class="form-table multiple group-style">
|
1 |
+
<?php
|
2 |
+
$then_classes = array(
|
3 |
+
'then',
|
4 |
+
'then_display',
|
5 |
+
'then_form',
|
6 |
+
'then_slideshow',
|
7 |
+
'then_not_single_template',
|
8 |
+
apply_filters( 'wpmtst_view_section', '', 'style' ),
|
9 |
+
);
|
10 |
+
?>
|
11 |
+
<div class="<?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>" style="display: none;">
|
12 |
<h3>
|
13 |
+
<?php /* translators: On the Views admin screen. */ ?>
|
14 |
<?php _e( 'Style', 'strong-testimonials' ); ?>
|
15 |
</h3>
|
16 |
<table class="form-table multiple group-style">
|
admin/partials/views/view-mode.php
CHANGED
@@ -6,8 +6,8 @@
|
|
6 |
<div class="mode-list">
|
7 |
<?php foreach ( $view_options['mode'] as $mode ) : ?>
|
8 |
<label>
|
9 |
-
<input id="<?php echo $mode['name']; ?>" type="radio" name="view[data][mode]"
|
10 |
-
value="<?php echo $mode['name']; ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
|
11 |
<?php echo $mode['label']; ?>
|
12 |
<div class="mode-line"></div>
|
13 |
</label>
|
6 |
<div class="mode-list">
|
7 |
<?php foreach ( $view_options['mode'] as $mode ) : ?>
|
8 |
<label>
|
9 |
+
<input id="<?php echo esc_attr( $mode['name'] ); ?>" type="radio" name="view[data][mode]"
|
10 |
+
value="<?php echo esc_attr( $mode['name'] ); ?>" <?php checked( $view['mode'], $mode['name'] ); ?>>
|
11 |
<?php echo $mode['label']; ?>
|
12 |
<div class="mode-line"></div>
|
13 |
</label>
|
admin/partials/views/view-shortcode.php
CHANGED
@@ -2,16 +2,25 @@
|
|
2 |
// avoiding the tab character before the shortcode for better copy-n-paste
|
3 |
if ( 'edit' == $action ) {
|
4 |
$shortcode = '<div class="saved">';
|
5 |
-
$shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id="' . $view_id . '"]" readonly />';
|
6 |
-
$shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' .
|
7 |
$shortcode .= '<span id="copy-message">copied</span>';
|
8 |
$shortcode .= '</div>';
|
9 |
} else {
|
10 |
$shortcode = '<div class="unsaved">' . _x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
|
11 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
?>
|
13 |
|
14 |
-
<div class="table-row form-view-shortcode
|
15 |
<div class="table-cell">
|
16 |
<label for="view-shortcode">
|
17 |
<?php _e( 'Shortcode', 'strong-testimonials' ); ?>
|
2 |
// avoiding the tab character before the shortcode for better copy-n-paste
|
3 |
if ( 'edit' == $action ) {
|
4 |
$shortcode = '<div class="saved">';
|
5 |
+
$shortcode .= '<input id="view-shortcode" type="text" value="[testimonial_view id="' . esc_attr( $view_id ) . '"]" readonly />';
|
6 |
+
$shortcode .= '<input id="copy-shortcode" class="button small" type="button" value="' . esc_attr__( 'copy to clipboard', 'strong-testimonials' ) . '" data-copytarget="#view-shortcode" />';
|
7 |
$shortcode .= '<span id="copy-message">copied</span>';
|
8 |
$shortcode .= '</div>';
|
9 |
} else {
|
10 |
$shortcode = '<div class="unsaved">' . _x( 'will be available after you save this', 'The shortcode for a new View.', 'strong-testimonials' ) . '</div>';
|
11 |
}
|
12 |
+
|
13 |
+
$then_classes = array(
|
14 |
+
'then',
|
15 |
+
'then_display',
|
16 |
+
'then_form',
|
17 |
+
'then_slideshow',
|
18 |
+
'then_not_single_template',
|
19 |
+
apply_filters( 'wpmtst_view_section', '', 'shortcode' ),
|
20 |
+
);
|
21 |
?>
|
22 |
|
23 |
+
<div class="table-row form-view-shortcode <?php echo esc_attr( join( array_filter( $then_classes ), ' ' ) ); ?>">
|
24 |
<div class="table-cell">
|
25 |
<label for="view-shortcode">
|
26 |
<?php _e( 'Shortcode', 'strong-testimonials' ); ?>
|
admin/scss/_partials/_custom-fields.scss
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
flex: 20;
|
23 |
}
|
24 |
|
25 |
-
|
26 |
display: inline-block;
|
27 |
cursor: pointer;
|
28 |
padding: 10px 10px 8px;
|
22 |
flex: 20;
|
23 |
}
|
24 |
|
25 |
+
div.link {
|
26 |
display: inline-block;
|
27 |
cursor: pointer;
|
28 |
padding: 10px 10px 8px;
|
admin/settings/class-strong-testimonials-settings-compat.php
CHANGED
@@ -98,12 +98,15 @@ class Strong_Testimonials_Settings_Compat {
|
|
98 |
|
99 |
$input['lazyload']['enabled'] = wpmtst_sanitize_checkbox( $input['lazyload'], 'enabled' );
|
100 |
// may be multiple pairs
|
101 |
-
|
102 |
-
|
103 |
-
$
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
107 |
}
|
108 |
}
|
109 |
|
@@ -847,8 +850,10 @@ class Strong_Testimonials_Settings_Compat {
|
|
847 |
</div>
|
848 |
<div class="lazyload-pairs">
|
849 |
<?php
|
850 |
-
|
851 |
-
$this->
|
|
|
|
|
852 |
}
|
853 |
?>
|
854 |
<div class="pair-actions">
|
98 |
|
99 |
$input['lazyload']['enabled'] = wpmtst_sanitize_checkbox( $input['lazyload'], 'enabled' );
|
100 |
// may be multiple pairs
|
101 |
+
if ( isset( $input['lazyload']['classes'] ) ) {
|
102 |
+
foreach ( $input['lazyload']['classes'] as $key => $classes ) {
|
103 |
+
if ( $classes['start'] || $classes['finish'] ) {
|
104 |
+
$input['lazyload']['classes'][ $key ]['start'] = str_replace( '.', '', sanitize_text_field( $classes['start'] ) );
|
105 |
+
$input['lazyload']['classes'][ $key ]['finish'] = str_replace( '.', '', sanitize_text_field( $classes['finish'] ) );
|
106 |
+
}
|
107 |
+
else {
|
108 |
+
unset( $input['lazyload']['classes'][ $key ] );
|
109 |
+
}
|
110 |
}
|
111 |
}
|
112 |
|
850 |
</div>
|
851 |
<div class="lazyload-pairs">
|
852 |
<?php
|
853 |
+
if ( isset( $this->options['lazyload']['classes'] ) ) {
|
854 |
+
foreach ( $this->options['lazyload']['classes'] as $key => $pair ) {
|
855 |
+
$this->settings_page_lazyload_class_inputs( $key, $pair );
|
856 |
+
}
|
857 |
}
|
858 |
?>
|
859 |
<div class="pair-actions">
|
admin/views-validate.php
CHANGED
@@ -13,10 +13,10 @@
|
|
13 |
function wpmtst_validate_view_name( $name, $view_id ){
|
14 |
if ( '' == $name ) {
|
15 |
$name = "Testimonial View $view_id";
|
16 |
-
}
|
17 |
-
else {
|
18 |
$name = sanitize_text_field( stripslashes( $name ) );
|
19 |
}
|
|
|
20 |
return $name;
|
21 |
}
|
22 |
|
13 |
function wpmtst_validate_view_name( $name, $view_id ){
|
14 |
if ( '' == $name ) {
|
15 |
$name = "Testimonial View $view_id";
|
16 |
+
}else {
|
|
|
17 |
$name = sanitize_text_field( stripslashes( $name ) );
|
18 |
}
|
19 |
+
|
20 |
return $name;
|
21 |
}
|
22 |
|
admin/views.php
CHANGED
@@ -16,46 +16,50 @@ function wpmtst_views_admin() {
|
|
16 |
if ( ! current_user_can( 'strong_testimonials_views' ) )
|
17 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
?>
|
20 |
<div class="wrap wpmtst2">
|
21 |
|
22 |
<?php
|
23 |
-
if ( isset( $_REQUEST['
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
34 |
|
35 |
-
if ( $message ) {
|
36 |
-
printf( '<div class="notice is-dismissible updated"><p>%s</p></div>', $message );
|
37 |
}
|
38 |
|
39 |
if ( isset( $_REQUEST['error'] ) ) {
|
40 |
|
41 |
echo '<h1>' . __( 'Edit View', 'strong-testimonials' ) . '</h1>';
|
42 |
-
$message = __( 'An error occurred.', 'strong-testimonials' ) . ' ' . sprintf( __( 'Please <a href="%s" target="_blank">open a support ticket</a>.', 'strong-testimonials' ), esc_url( 'https://support.strongplugins.com/new-ticket/' ) );
|
43 |
-
wp_die( sprintf( '<div class="error strong-view-error"><p>%s</p></div>', $message ) );
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
echo '<p>' . __( 'Invalid request. Please try again.', 'strong-testimonials' ) . '</p>';
|
58 |
-
}
|
59 |
|
60 |
} else {
|
61 |
|
@@ -105,6 +109,11 @@ function wpmtst_views_admin() {
|
|
105 |
*/
|
106 |
function wpmtst_view_settings( $action = '', $view_id = null ) {
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
if ( ( 'edit' == $action || 'duplicate' == $action ) && ! $view_id ) return;
|
109 |
|
110 |
global $view;
|
@@ -163,9 +172,9 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
|
|
163 |
$view['pagination_settings']['per_page'] = 5;
|
164 |
}
|
165 |
|
166 |
-
$custom_list
|
167 |
-
$pages_list
|
168 |
-
$posts_list
|
169 |
|
170 |
$view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
|
171 |
|
@@ -173,8 +182,7 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
|
|
173 |
if ( !$view['template'] ) {
|
174 |
if ( 'form' == $view['mode'] ) {
|
175 |
$view['template'] = 'default-form';
|
176 |
-
}
|
177 |
-
else {
|
178 |
$view['template'] = 'default';
|
179 |
}
|
180 |
}
|
@@ -205,14 +213,14 @@ function wpmtst_view_settings( $action = '', $view_id = null ) {
|
|
205 |
<?php endif; ?>
|
206 |
</h1>
|
207 |
|
208 |
-
<form id="wpmtst-views-form" method="post" action="<?php echo
|
209 |
|
210 |
<?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
|
211 |
|
212 |
-
<input type="hidden" name="action" value="view_<?php echo $action; ?>_form">
|
213 |
-
<input type="hidden" name="view[id]" value="<?php echo $view_id; ?>">
|
214 |
-
<input type="hidden" name="view_original_mode" value="<?php echo $view['mode']; ?>">
|
215 |
-
<input type="hidden" name="view[data][_form_id]" value="<?php echo $view['form_id']; ?>">
|
216 |
|
217 |
<div class="table view-info">
|
218 |
<?php include( 'partials/views/view-name.php' ); ?>
|
@@ -271,56 +279,58 @@ function wpmtst_view_edit_form() {
|
|
271 |
|
272 |
$goback = wp_get_referer();
|
273 |
|
274 |
-
if (
|
275 |
-
|
276 |
-
$
|
277 |
-
|
|
|
278 |
|
279 |
-
|
|
|
280 |
|
281 |
-
|
282 |
-
$goback = remove_query_arg( array( 'defaults-restored', 'view-saved' ), $goback );
|
283 |
-
$goback = add_query_arg( 'cancelled', true, $goback );
|
284 |
|
285 |
-
|
|
|
286 |
|
287 |
-
|
288 |
-
$default_view = wpmtst_get_view_default();
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
'name' => $view_name,
|
293 |
-
'data' => $default_view
|
294 |
-
);
|
295 |
-
$success = wpmtst_save_view( $view ); // num_rows
|
296 |
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
302 |
|
|
|
|
|
303 |
} else {
|
|
|
|
|
304 |
|
305 |
-
|
306 |
-
$view = array(
|
307 |
-
'id' => $view_id,
|
308 |
-
'name' => $view_name,
|
309 |
-
'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
|
310 |
-
);
|
311 |
-
$success = wpmtst_save_view( $view ); // num_rows
|
312 |
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
319 |
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
} else {
|
323 |
-
|
|
|
|
|
324 |
}
|
325 |
|
326 |
wp_redirect( $goback );
|
@@ -339,48 +349,52 @@ function wpmtst_view_add_form() {
|
|
339 |
|
340 |
$goback = wp_get_referer();
|
341 |
|
342 |
-
if (
|
|
|
|
|
|
|
|
|
343 |
|
344 |
-
|
345 |
-
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
350 |
-
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
|
359 |
-
|
360 |
|
361 |
-
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
|
371 |
-
|
372 |
|
373 |
-
|
374 |
|
375 |
-
$
|
376 |
-
|
377 |
-
$goback = add_query_arg( array( 'action' => 'edit', 'id' => $success, $query_arg => true ), $goback );
|
378 |
-
} else {
|
379 |
-
$goback = add_query_arg( 'error', true, $goback );
|
380 |
-
}
|
381 |
|
|
|
|
|
|
|
|
|
382 |
} else {
|
383 |
-
$goback = add_query_arg( '
|
384 |
}
|
385 |
|
386 |
wp_redirect( $goback );
|
@@ -507,7 +521,7 @@ function wpmtst_view_field_inputs( $key, $field, $adding = false ) {
|
|
507 |
|
508 |
<div class="field3" data-key="<?php echo $key; ?>">
|
509 |
|
510 |
-
<
|
511 |
|
512 |
<a href="#" class="field-description <?php echo $label_class; ?>"><?php echo $field_label; ?></a>
|
513 |
|
@@ -523,7 +537,7 @@ function wpmtst_view_field_inputs( $key, $field, $adding = false ) {
|
|
523 |
title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>"></span>
|
524 |
</div>
|
525 |
|
526 |
-
</
|
527 |
|
528 |
<div class="field-properties" style="display: none;">
|
529 |
|
@@ -734,15 +748,14 @@ function wpmtst_delete_view( $id ) {
|
|
734 |
*/
|
735 |
function wpmtst_action_delete_view() {
|
736 |
if ( isset( $_REQUEST['action'] ) && 'delete-strong-view' == $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) {
|
737 |
-
$id = (int)
|
738 |
check_admin_referer( 'delete-strong-view_' . $id );
|
739 |
wpmtst_delete_view( $id );
|
740 |
-
$goback = add_query_arg( 'view-deleted',
|
741 |
wp_redirect( $goback );
|
742 |
exit;
|
743 |
}
|
744 |
}
|
745 |
-
|
746 |
add_action( 'admin_action_delete-strong-view', 'wpmtst_action_delete_view' );
|
747 |
|
748 |
|
@@ -808,7 +821,7 @@ function wpmtst_form_category_checklist( $view_cats_array ) {
|
|
808 |
* @since 2.22.0
|
809 |
*/
|
810 |
function wpmtst_save_view_sticky() {
|
811 |
-
$id =
|
812 |
$stickies = get_option( 'wpmtst_sticky_views', array() );
|
813 |
if ( in_array( $id, $stickies ) ) {
|
814 |
$stickies = array_diff( $stickies, array( $id ) );
|
16 |
if ( ! current_user_can( 'strong_testimonials_views' ) )
|
17 |
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
18 |
|
19 |
+
$tags = array(
|
20 |
+
'a' => array(
|
21 |
+
'href' => array(),
|
22 |
+
'target' => array(),
|
23 |
+
),
|
24 |
+
);
|
25 |
+
|
26 |
?>
|
27 |
<div class="wrap wpmtst2">
|
28 |
|
29 |
<?php
|
30 |
+
if ( isset( $_REQUEST['result'] ) ) {
|
31 |
+
|
32 |
+
$result = filter_input( INPUT_GET, 'result', FILTER_SANITIZE_STRING );
|
33 |
+
|
34 |
+
$result_messages = array(
|
35 |
+
'cancelled' => __( 'Changes cancelled.', 'strong-testimonials' ),
|
36 |
+
'defaults-restored' => __( 'Defaults restored.', 'strong-testimonials' ),
|
37 |
+
'view-saved' => __( 'View saved.', 'strong-testimonials' ),
|
38 |
+
'view-deleted' => __( 'View deleted.', 'strong-testimonials' ),
|
39 |
+
);
|
40 |
+
|
41 |
+
if ( in_array( $result, array_keys( $result_messages ) ) ) {
|
42 |
+
printf( '<div class="notice notice-success is-dismissible"><p>%s</p></div>', $result_messages[ $result ] );
|
43 |
+
}
|
44 |
|
|
|
|
|
45 |
}
|
46 |
|
47 |
if ( isset( $_REQUEST['error'] ) ) {
|
48 |
|
49 |
echo '<h1>' . __( 'Edit View', 'strong-testimonials' ) . '</h1>';
|
|
|
|
|
50 |
|
51 |
+
$message = __( 'An error occurred.', 'strong-testimonials' ) . ' ' . sprintf( wp_kses( __( 'Please <a href="%s" target="_blank">open a support ticket</a>.', 'strong-testimonials' ), $tags ), esc_url( 'https://support.strongplugins.com/new-ticket/' ) );
|
52 |
|
53 |
+
wp_die( sprintf( '<div class="notice notice-error"><p>%s</p></div>', $message ) );
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( isset( $_REQUEST['action'] ) ) {
|
58 |
+
|
59 |
+
$action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
|
60 |
+
$id = abs( filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
|
61 |
+
|
62 |
+
wpmtst_view_settings( $action, $id );
|
|
|
|
|
63 |
|
64 |
} else {
|
65 |
|
109 |
*/
|
110 |
function wpmtst_view_settings( $action = '', $view_id = null ) {
|
111 |
|
112 |
+
$actions = array( 'edit', 'duplicate', 'add' );
|
113 |
+
if ( ! in_array( $action, $actions ) ) {
|
114 |
+
wp_die( __( 'Invalid request. Please try again.', 'strong-testimonials' ) );
|
115 |
+
}
|
116 |
+
|
117 |
if ( ( 'edit' == $action || 'duplicate' == $action ) && ! $view_id ) return;
|
118 |
|
119 |
global $view;
|
172 |
$view['pagination_settings']['per_page'] = 5;
|
173 |
}
|
174 |
|
175 |
+
$custom_list = apply_filters( 'wpmtst_custom_pages_list', array(), $view );
|
176 |
+
$pages_list = apply_filters( 'wpmtst_pages_list', wpmtst_get_pages() );
|
177 |
+
$posts_list = apply_filters( 'wpmtst_posts_list', wpmtst_get_posts() );
|
178 |
|
179 |
$view_options = apply_filters( 'wpmtst_view_options', get_option( 'wpmtst_view_options' ) );
|
180 |
|
182 |
if ( !$view['template'] ) {
|
183 |
if ( 'form' == $view['mode'] ) {
|
184 |
$view['template'] = 'default-form';
|
185 |
+
} else {
|
|
|
186 |
$view['template'] = 'default';
|
187 |
}
|
188 |
}
|
213 |
<?php endif; ?>
|
214 |
</h1>
|
215 |
|
216 |
+
<form id="wpmtst-views-form" method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>" autocomplete="off">
|
217 |
|
218 |
<?php wp_nonce_field( 'view_form_submit', 'view_form_nonce', true, true ); ?>
|
219 |
|
220 |
+
<input type="hidden" name="action" value="view_<?php echo esc_attr( $action ); ?>_form">
|
221 |
+
<input type="hidden" name="view[id]" value="<?php echo esc_attr( $view_id ); ?>">
|
222 |
+
<input type="hidden" name="view_original_mode" value="<?php echo esc_attr( $view['mode'] ); ?>">
|
223 |
+
<input type="hidden" name="view[data][_form_id]" value="<?php echo esc_attr( $view['form_id'] ); ?>">
|
224 |
|
225 |
<div class="table view-info">
|
226 |
<?php include( 'partials/views/view-name.php' ); ?>
|
279 |
|
280 |
$goback = wp_get_referer();
|
281 |
|
282 |
+
if ( empty( $_POST ) || ! check_admin_referer( 'view_form_submit', 'view_form_nonce' ) ) {
|
283 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
284 |
+
wp_redirect( $goback );
|
285 |
+
exit;
|
286 |
+
}
|
287 |
|
288 |
+
$view_id = abs( filter_var( $_POST['view']['id'], FILTER_SANITIZE_NUMBER_INT ) );
|
289 |
+
$view_name = wpmtst_validate_view_name( $_POST['view']['name'], $view_id );
|
290 |
|
291 |
+
if ( isset( $_POST['reset'] ) ) {
|
|
|
|
|
292 |
|
293 |
+
// Undo changes
|
294 |
+
$goback = add_query_arg( 'result', 'cancelled', $goback );
|
295 |
|
296 |
+
} elseif ( isset( $_POST['restore-defaults'] ) ) {
|
|
|
297 |
|
298 |
+
// Restore defaults
|
299 |
+
$default_view = wpmtst_get_view_default();
|
|
|
|
|
|
|
|
|
300 |
|
301 |
+
$view = array(
|
302 |
+
'id' => $view_id,
|
303 |
+
'name' => $view_name,
|
304 |
+
'data' => $default_view
|
305 |
+
);
|
306 |
+
$success = wpmtst_save_view( $view ); // num_rows
|
307 |
|
308 |
+
if ( $success ) {
|
309 |
+
$goback = add_query_arg( 'result', 'defaults-restored', $goback );
|
310 |
} else {
|
311 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
312 |
+
}
|
313 |
|
314 |
+
} elseif ( isset( $_POST['submit-form'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
+
// Sanitize & validate
|
317 |
+
$view = array(
|
318 |
+
'id' => $view_id,
|
319 |
+
'name' => $view_name,
|
320 |
+
'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
|
321 |
+
);
|
322 |
+
$success = wpmtst_save_view( $view ); // num_rows
|
323 |
|
324 |
+
if ( $success ) {
|
325 |
+
$goback = add_query_arg( 'result', 'view-saved', $goback );
|
326 |
+
} else {
|
327 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
328 |
}
|
329 |
|
330 |
} else {
|
331 |
+
|
332 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
333 |
+
|
334 |
}
|
335 |
|
336 |
wp_redirect( $goback );
|
349 |
|
350 |
$goback = wp_get_referer();
|
351 |
|
352 |
+
if ( empty( $_POST ) || ! check_admin_referer( 'view_form_submit', 'view_form_nonce' ) ) {
|
353 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
354 |
+
wp_redirect( $goback );
|
355 |
+
exit;
|
356 |
+
}
|
357 |
|
358 |
+
$view_id = 0;
|
359 |
+
$view_name = wpmtst_validate_view_name( $_POST['view']['name'], $view_id );
|
360 |
|
361 |
+
if ( isset( $_POST['restore-defaults'] ) ) {
|
362 |
|
363 |
+
// Restore defaults
|
364 |
+
$default_view = wpmtst_get_view_default();
|
365 |
|
366 |
+
$view = array(
|
367 |
+
'id' => $view_id,
|
368 |
+
'name' => $view_name,
|
369 |
+
'data' => $default_view,
|
370 |
+
);
|
371 |
+
$success = wpmtst_save_view( $view, 'add' ); // view ID
|
372 |
|
373 |
+
$query_arg = 'defaults-restored';
|
374 |
|
375 |
+
} elseif ( isset( $_POST['submit-form'] ) ) {
|
376 |
|
377 |
+
// Sanitize & validate
|
378 |
+
$view = array(
|
379 |
+
'id' => 0,
|
380 |
+
'name' => $view_name,
|
381 |
+
'data' => wpmtst_sanitize_view( stripslashes_deep( $_POST['view']['data'] ) ),
|
382 |
+
);
|
383 |
+
$success = wpmtst_save_view( $view, 'add' ); // view ID
|
384 |
|
385 |
+
$query_arg = 'view-saved';
|
386 |
|
387 |
+
} else {
|
388 |
|
389 |
+
$success = false;
|
390 |
+
$query_arg = 'error';
|
|
|
|
|
|
|
|
|
391 |
|
392 |
+
}
|
393 |
+
|
394 |
+
if ( $success ) {
|
395 |
+
$goback = add_query_arg( array( 'action' => 'edit', 'id' => $success, 'result' => $query_arg ), $goback );
|
396 |
} else {
|
397 |
+
$goback = add_query_arg( 'result', 'error', $goback );
|
398 |
}
|
399 |
|
400 |
wp_redirect( $goback );
|
521 |
|
522 |
<div class="field3" data-key="<?php echo $key; ?>">
|
523 |
|
524 |
+
<div class="link" title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>">
|
525 |
|
526 |
<a href="#" class="field-description <?php echo $label_class; ?>"><?php echo $field_label; ?></a>
|
527 |
|
537 |
title="<?php _e( 'click to open or close', 'strong-testimonials' ); ?>"></span>
|
538 |
</div>
|
539 |
|
540 |
+
</div>
|
541 |
|
542 |
<div class="field-properties" style="display: none;">
|
543 |
|
748 |
*/
|
749 |
function wpmtst_action_delete_view() {
|
750 |
if ( isset( $_REQUEST['action'] ) && 'delete-strong-view' == $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) {
|
751 |
+
$id = abs( (int) filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT ) );
|
752 |
check_admin_referer( 'delete-strong-view_' . $id );
|
753 |
wpmtst_delete_view( $id );
|
754 |
+
$goback = add_query_arg( 'result', 'view-deleted', wp_get_referer() );
|
755 |
wp_redirect( $goback );
|
756 |
exit;
|
757 |
}
|
758 |
}
|
|
|
759 |
add_action( 'admin_action_delete-strong-view', 'wpmtst_action_delete_view' );
|
760 |
|
761 |
|
821 |
* @since 2.22.0
|
822 |
*/
|
823 |
function wpmtst_save_view_sticky() {
|
824 |
+
$id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
|
825 |
$stickies = get_option( 'wpmtst_sticky_views', array() );
|
826 |
if ( in_array( $id, $stickies ) ) {
|
827 |
$stickies = array_diff( $stickies, array( $id ) );
|
includes/class-strong-view-form.php
CHANGED
@@ -37,6 +37,26 @@ class Strong_View_Form extends Strong_View {
|
|
37 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Build the view.
|
42 |
*/
|
@@ -58,7 +78,6 @@ class Strong_View_Form extends Strong_View {
|
|
58 |
$this->load_extra_stylesheets();
|
59 |
$this->custom_background();
|
60 |
$this->load_validator();
|
61 |
-
//$this->load_honeypots();
|
62 |
|
63 |
/*
|
64 |
* If we cannot preprocess, add the inline style to the footer.
|
@@ -87,6 +106,7 @@ class Strong_View_Form extends Strong_View {
|
|
87 |
/**
|
88 |
* Add filters here.
|
89 |
*/
|
|
|
90 |
|
91 |
/**
|
92 |
* Locate template.
|
@@ -110,7 +130,11 @@ class Strong_View_Form extends Strong_View {
|
|
110 |
/**
|
111 |
* Remove filters here.
|
112 |
*/
|
|
|
113 |
|
|
|
|
|
|
|
114 |
do_action( 'wpmtst_form_rendered', $this->atts );
|
115 |
|
116 |
$this->html = apply_filters( 'strong_view_form_html', $html, $this );
|
37 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_custom_style' ), 20 );
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Print overlay while form data is submitted.
|
42 |
+
*
|
43 |
+
* This helps when uploading large files and on slow connections.
|
44 |
+
*
|
45 |
+
* @since 2.31.5
|
46 |
+
*/
|
47 |
+
public function print_overlay() {
|
48 |
+
if ( apply_filters( 'wpmtst_form_wait', true ) ) {
|
49 |
+
WPMST()->render->add_style( 'wpmtst-font-awesome' );
|
50 |
+
?>
|
51 |
+
<div class="strong-form-wait">
|
52 |
+
<div class="message">
|
53 |
+
<?php echo wp_kses_post( apply_filters( 'wpmtst_form_wait_message', '<i class="fa fa-2x fa-spinner fa-pulse" aria-hidden="true"></i>' ) ); ?>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
<?php
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
/**
|
61 |
* Build the view.
|
62 |
*/
|
78 |
$this->load_extra_stylesheets();
|
79 |
$this->custom_background();
|
80 |
$this->load_validator();
|
|
|
81 |
|
82 |
/*
|
83 |
* If we cannot preprocess, add the inline style to the footer.
|
106 |
/**
|
107 |
* Add filters here.
|
108 |
*/
|
109 |
+
add_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
|
110 |
|
111 |
/**
|
112 |
* Locate template.
|
130 |
/**
|
131 |
* Remove filters here.
|
132 |
*/
|
133 |
+
remove_action( 'wpmtst_before_form', array( $this, 'print_overlay' ) );
|
134 |
|
135 |
+
/**
|
136 |
+
* Trigger stuff.
|
137 |
+
*/
|
138 |
do_action( 'wpmtst_form_rendered', $this->atts );
|
139 |
|
140 |
$this->html = apply_filters( 'strong_view_form_html', $html, $this );
|
public/js/controller.js
CHANGED
@@ -113,6 +113,16 @@ var strongController = {
|
|
113 |
if (forms.length) {
|
114 |
strongValidation.init();
|
115 |
// initialize Captcha plugins here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
},
|
118 |
|
113 |
if (forms.length) {
|
114 |
strongValidation.init();
|
115 |
// initialize Captcha plugins here
|
116 |
+
} else {
|
117 |
+
var urlParams = new URLSearchParams(window.location.search);
|
118 |
+
if (urlParams.has('success')) {
|
119 |
+
urlParams.delete('success');
|
120 |
+
var newURL = window.location.pathname;
|
121 |
+
if (urlParams.toString()) {
|
122 |
+
newURL = newURL + '?' + urlParams.toString();
|
123 |
+
}
|
124 |
+
window.history.replaceState({}, document.title, newURL);
|
125 |
+
}
|
126 |
}
|
127 |
},
|
128 |
|
public/js/controller.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"use strict";var debugit=false;var strongController={grids:{},iframes:{},defaults:{initializeOn:"windowLoad",method:"",universalTimer:500,observerTimer:500,containerId:"page",addedNodeId:"content",event:"",script:"",debug:false},config:{},setup:function(settings){settings.universalTimer=parseInt(settings.universalTimer);settings.observerTimer=parseInt(settings.observerTimer);settings.debug=!!settings.debug;debugit=settings.debug;this.config=jQuery.extend({},this.defaults,settings)},mutationObserver:window.MutationObserver||window.WebKitMutationObserver,eventListenerSupported:window.addEventListener,checkInit:function(){return jQuery('.strong-view[data-state="idle"]').length},initSliders:function(){var sliders=jQuery('.strong-view.slider-container[data-state="idle"]');if(debugit)console.log("sliders found:",sliders.length);if(sliders.length){sliders.each(function(){jQuery(this).strongSlider()})}},initPagers:function(){var pagers=jQuery('.strong-pager[data-state="idle"]');if(debugit)console.log("pagers found:",pagers.length);if(pagers.length){pagers.each(function(){jQuery(this).strongPager()})}},initLayouts:function(){this.grids=jQuery('.strong-view[data-state="idle"] .strong-masonry');if(debugit)console.log("Masonry found:",this.grids.length);if(this.grids.length){this.grids.prepend('<div class="grid-sizer"></div><div class="gutter-sizer"></div>');this.grids.imagesLoaded(function(){strongController.grids.masonry({columnWidth:".grid-sizer",gutter:".gutter-sizer",itemSelector:".testimonial",percentPosition:true});strongController.grids.closest(".strong-view").attr("data-state","init")})}},initForm:function(){var forms=jQuery('.strong-form[data-state="idle"]');if(debugit)console.log("forms found:",forms.length);if(forms.length){strongValidation.init()}},initIframes:function(){this.iframes=jQuery("iframe")},observer:function(obj,callback){if(this.mutationObserver){var obs=new this.mutationObserver(function(mutations){for(var i=0;i<mutations.length;i++){if(mutations[i].addedNodes.length){if(debugit)console.log("mutation observed",mutations);for(var j=0;j<mutations[i].addedNodes.length;j++){if(mutations[i].addedNodes[j].id===strongController.config.containerId){if(debugit)console.log("+",strongController.config.containerId);callback();return}}}}});obs.observe(obj,{childList:true,subtree:true})}else if(this.eventListenerSupported){obj.addEventListener("DOMNodeInserted",function(e){if(e.currentTarget.id===obj.id){if(debugit)console.log("DOMNodeInserted:",e.currentTarget.id);callback()}},false)}},intervalId:null,timeoutId:null,newInterval:function(){strongController.intervalId=setInterval(function tick(){if(debugit)console.log("tick > checkInit",strongController.checkInit());if(strongController.checkInit()){strongController.start()}},strongController.config.universalTimer)},newTimeout:function(){strongController.timeoutId=setTimeout(function tick(){if(debugit)console.log("tick > checkInit",strongController.checkInit());if(strongController.checkInit()){strongController.start()}},strongController.config.observerTimer)},init:function(){if(debugit)console.log("strongController init");var settings={};if(typeof window.strongControllerParms!=="undefined"){settings=window.strongControllerParms}else{if(debugit)console.log("settings not found")}this.setup(settings);if(debugit)console.log("config",this.config);if("documentReady"===this.config.initializeOn){jQuery(document).ready(function(){if(debugit)console.log("document ready");strongController.start();strongController.listen()})}else{jQuery(window).on("load",function(){if(debugit)console.log("window load");strongController.start();strongController.listen()})}jQuery(window).on("load",function(){strongController.listenForIframeReady()})},start:function(){if(debugit)console.log("start");strongController.initSliders();strongController.initPagers();strongController.initLayouts();strongController.initForm();strongController.initIframes()},listen:function(){if(debugit)console.log("listen");switch(this.config.method){case"universal":this.newInterval();break;case"observer":this.observer(document.getElementById(this.config.containerId),this.newTimeout);break;case"event":document.addEventListener(this.config.event,this.start);break;case"script":switch(this.config.script){case"barba":if(typeof Barba==="object"&&Barba.hasOwnProperty("Dispatcher")){Barba.Dispatcher.on("transitionCompleted",this.start)}break;default:}break;default:}},listenForIframeReady:function(){if(debugit)console.log("listenForIframeReady");if(strongController.iframes.length&&strongController.grids.length){strongController.iframes.ready(function(){setTimeout(function(){strongController.grids.masonry();if(debugit)console.log("listenForIframeReady","timeout 1")},1e3);setTimeout(function(){strongController.grids.masonry();if(debugit)console.log("listenForIframeReady","timeout 2")},2e3)})}else{if(debugit)console.log("listenForIframeReady","no iframes or Masonry found")}}};strongController.init();
|
1 |
+
"use strict";var debugit=false;var strongController={grids:{},iframes:{},defaults:{initializeOn:"windowLoad",method:"",universalTimer:500,observerTimer:500,containerId:"page",addedNodeId:"content",event:"",script:"",debug:false},config:{},setup:function(settings){settings.universalTimer=parseInt(settings.universalTimer);settings.observerTimer=parseInt(settings.observerTimer);settings.debug=!!settings.debug;debugit=settings.debug;this.config=jQuery.extend({},this.defaults,settings)},mutationObserver:window.MutationObserver||window.WebKitMutationObserver,eventListenerSupported:window.addEventListener,checkInit:function(){return jQuery('.strong-view[data-state="idle"]').length},initSliders:function(){var sliders=jQuery('.strong-view.slider-container[data-state="idle"]');if(debugit)console.log("sliders found:",sliders.length);if(sliders.length){sliders.each(function(){jQuery(this).strongSlider()})}},initPagers:function(){var pagers=jQuery('.strong-pager[data-state="idle"]');if(debugit)console.log("pagers found:",pagers.length);if(pagers.length){pagers.each(function(){jQuery(this).strongPager()})}},initLayouts:function(){this.grids=jQuery('.strong-view[data-state="idle"] .strong-masonry');if(debugit)console.log("Masonry found:",this.grids.length);if(this.grids.length){this.grids.prepend('<div class="grid-sizer"></div><div class="gutter-sizer"></div>');this.grids.imagesLoaded(function(){strongController.grids.masonry({columnWidth:".grid-sizer",gutter:".gutter-sizer",itemSelector:".testimonial",percentPosition:true});strongController.grids.closest(".strong-view").attr("data-state","init")})}},initForm:function(){var forms=jQuery('.strong-form[data-state="idle"]');if(debugit)console.log("forms found:",forms.length);if(forms.length){strongValidation.init()}else{var urlParams=new URLSearchParams(window.location.search);if(urlParams.has("success")){urlParams.delete("success");var newURL=window.location.pathname;if(urlParams.toString()){newURL=newURL+"?"+urlParams.toString()}window.history.replaceState({},document.title,newURL)}}},initIframes:function(){this.iframes=jQuery("iframe")},observer:function(obj,callback){if(this.mutationObserver){var obs=new this.mutationObserver(function(mutations){for(var i=0;i<mutations.length;i++){if(mutations[i].addedNodes.length){if(debugit)console.log("mutation observed",mutations);for(var j=0;j<mutations[i].addedNodes.length;j++){if(mutations[i].addedNodes[j].id===strongController.config.containerId){if(debugit)console.log("+",strongController.config.containerId);callback();return}}}}});obs.observe(obj,{childList:true,subtree:true})}else if(this.eventListenerSupported){obj.addEventListener("DOMNodeInserted",function(e){if(e.currentTarget.id===obj.id){if(debugit)console.log("DOMNodeInserted:",e.currentTarget.id);callback()}},false)}},intervalId:null,timeoutId:null,newInterval:function(){strongController.intervalId=setInterval(function tick(){if(debugit)console.log("tick > checkInit",strongController.checkInit());if(strongController.checkInit()){strongController.start()}},strongController.config.universalTimer)},newTimeout:function(){strongController.timeoutId=setTimeout(function tick(){if(debugit)console.log("tick > checkInit",strongController.checkInit());if(strongController.checkInit()){strongController.start()}},strongController.config.observerTimer)},init:function(){if(debugit)console.log("strongController init");var settings={};if(typeof window.strongControllerParms!=="undefined"){settings=window.strongControllerParms}else{if(debugit)console.log("settings not found")}this.setup(settings);if(debugit)console.log("config",this.config);if("documentReady"===this.config.initializeOn){jQuery(document).ready(function(){if(debugit)console.log("document ready");strongController.start();strongController.listen()})}else{jQuery(window).on("load",function(){if(debugit)console.log("window load");strongController.start();strongController.listen()})}jQuery(window).on("load",function(){strongController.listenForIframeReady()})},start:function(){if(debugit)console.log("start");strongController.initSliders();strongController.initPagers();strongController.initLayouts();strongController.initForm();strongController.initIframes()},listen:function(){if(debugit)console.log("listen");switch(this.config.method){case"universal":this.newInterval();break;case"observer":this.observer(document.getElementById(this.config.containerId),this.newTimeout);break;case"event":document.addEventListener(this.config.event,this.start);break;case"script":switch(this.config.script){case"barba":if(typeof Barba==="object"&&Barba.hasOwnProperty("Dispatcher")){Barba.Dispatcher.on("transitionCompleted",this.start)}break;default:}break;default:}},listenForIframeReady:function(){if(debugit)console.log("listenForIframeReady");if(strongController.iframes.length&&strongController.grids.length){strongController.iframes.ready(function(){setTimeout(function(){strongController.grids.masonry();if(debugit)console.log("listenForIframeReady","timeout 1")},1e3);setTimeout(function(){strongController.grids.masonry();if(debugit)console.log("listenForIframeReady","timeout 2")},2e3)})}else{if(debugit)console.log("listenForIframeReady","no iframes or Masonry found")}}};strongController.init();
|
public/js/lib/form-validation/form-validation.js
CHANGED
@@ -17,7 +17,7 @@ var strongValidation = {
|
|
17 |
onSuccess: true,
|
18 |
onSuccessOffset: 100
|
19 |
},
|
20 |
-
fields: {}
|
21 |
},
|
22 |
|
23 |
settings: {},
|
@@ -151,18 +151,29 @@ var strongValidation = {
|
|
151 |
},
|
152 |
|
153 |
submitHandler: function (form) {
|
|
|
|
|
|
|
154 |
// If Ajax
|
155 |
if (strongValidation.settings.ajaxUrl !== '') {
|
|
|
|
|
|
|
|
|
|
|
156 |
var formOptions = {
|
157 |
url: strongValidation.settings.ajaxUrl,
|
158 |
data: {
|
159 |
action: 'wpmtst_form2'
|
160 |
},
|
161 |
-
success: strongValidation.showResponse
|
162 |
};
|
163 |
jQuery(form).ajaxSubmit(formOptions);
|
|
|
164 |
} else {
|
|
|
165 |
form.submit();
|
|
|
166 |
}
|
167 |
},
|
168 |
|
@@ -207,6 +218,8 @@ var strongValidation = {
|
|
207 |
* @param response
|
208 |
*/
|
209 |
showResponse: function (response) {
|
|
|
|
|
210 |
var obj = JSON.parse(response);
|
211 |
if (obj.success) {
|
212 |
jQuery('#wpmtst-form').html(obj.message);
|
@@ -240,5 +253,21 @@ var strongValidation = {
|
|
240 |
jQuery('html, body').animate({scrollTop: scrollTop}, 800);
|
241 |
}
|
242 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
}
|
244 |
};
|
17 |
onSuccess: true,
|
18 |
onSuccessOffset: 100
|
19 |
},
|
20 |
+
fields: {},
|
21 |
},
|
22 |
|
23 |
settings: {},
|
151 |
},
|
152 |
|
153 |
submitHandler: function (form) {
|
154 |
+
|
155 |
+
strongValidation.disableForm();
|
156 |
+
|
157 |
// If Ajax
|
158 |
if (strongValidation.settings.ajaxUrl !== '') {
|
159 |
+
|
160 |
+
window.onbeforeunload = function() {
|
161 |
+
return "Please wait while the form is submitted.";
|
162 |
+
}
|
163 |
+
|
164 |
var formOptions = {
|
165 |
url: strongValidation.settings.ajaxUrl,
|
166 |
data: {
|
167 |
action: 'wpmtst_form2'
|
168 |
},
|
169 |
+
success: strongValidation.showResponse,
|
170 |
};
|
171 |
jQuery(form).ajaxSubmit(formOptions);
|
172 |
+
|
173 |
} else {
|
174 |
+
|
175 |
form.submit();
|
176 |
+
|
177 |
}
|
178 |
},
|
179 |
|
218 |
* @param response
|
219 |
*/
|
220 |
showResponse: function (response) {
|
221 |
+
window.onbeforeunload = null;
|
222 |
+
strongValidation.enableForm();
|
223 |
var obj = JSON.parse(response);
|
224 |
if (obj.success) {
|
225 |
jQuery('#wpmtst-form').html(obj.message);
|
253 |
jQuery('html, body').animate({scrollTop: scrollTop}, 800);
|
254 |
}
|
255 |
}
|
256 |
+
},
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Show overlay during form submission.
|
260 |
+
*/
|
261 |
+
disableForm: function () {
|
262 |
+
jQuery('.strong-form-wait').show();
|
263 |
+
jQuery('#wpmtst_submit_testimonial').prop('disabled',true);
|
264 |
+
},
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Hide overlay after form submission.
|
268 |
+
*/
|
269 |
+
enableForm: function () {
|
270 |
+
jQuery('.strong-form-wait').hide();
|
271 |
+
jQuery('#wpmtst_submit_testimonial').prop('disabled',false);
|
272 |
}
|
273 |
};
|
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="http://"+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){if(strongValidation.settings.ajaxUrl!==""){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){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)}}}};
|
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="http://"+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)}};
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: cdillon27
|
3 |
Tags: testimonials, testimonial slider, testimonial form, reviews, star ratings
|
4 |
Requires at least: 3.7
|
5 |
-
Requires PHP: 5.2
|
6 |
Tested up to: 4.9.6
|
7 |
-
Stable tag: 2.31.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -215,6 +215,11 @@ If you prefer, start a private support ticket at [support.strongplugins.com](htt
|
|
215 |
|
216 |
== Changelog ==
|
217 |
|
|
|
|
|
|
|
|
|
|
|
218 |
= 2.31.4 - May 22, 2018 =
|
219 |
* Add integration with WordPress privacy exporter and eraser features.
|
220 |
|
@@ -308,3 +313,6 @@ New [testimonial_average_rating] shortcode. More compatibility options.
|
|
308 |
|
309 |
= 2.31.4 =
|
310 |
Privacy exporter and eraser integration.
|
|
|
|
|
|
2 |
Contributors: cdillon27
|
3 |
Tags: testimonials, testimonial slider, testimonial form, reviews, star ratings
|
4 |
Requires at least: 3.7
|
5 |
+
Requires PHP: 5.2.4
|
6 |
Tested up to: 4.9.6
|
7 |
+
Stable tag: 2.31.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
215 |
|
216 |
== Changelog ==
|
217 |
|
218 |
+
= 2.31.5 - June 1, 2018 =
|
219 |
+
* Fix XSS vulnerablilities reported by DefenseCode using Thunderscan.
|
220 |
+
* Add spinner UI element while form is being submitted to deter visitor from navigating away.
|
221 |
+
* Minor admin UI improvements.
|
222 |
+
|
223 |
= 2.31.4 - May 22, 2018 =
|
224 |
* Add integration with WordPress privacy exporter and eraser features.
|
225 |
|
313 |
|
314 |
= 2.31.4 =
|
315 |
Privacy exporter and eraser integration.
|
316 |
+
|
317 |
+
= 2.31.5 =
|
318 |
+
Fix XSS security vulnerabilities.
|
strong-testimonials.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: https://strongplugins.com/plugins/strong-testimonials/
|
5 |
* Description: Collect and display your testimonials or reviews.
|
6 |
* Author: Chris Dillon
|
7 |
-
* Version: 2.31.
|
8 |
*
|
9 |
* Author URI: https://strongplugins.com/
|
10 |
* Text Domain: strong-testimonials
|
@@ -34,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
34 |
exit;
|
35 |
}
|
36 |
|
37 |
-
define( 'WPMTST_VERSION', '2.31.
|
38 |
define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
|
39 |
define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
|
40 |
define( 'STRONGPLUGINS_STORE_URL', 'https://strongplugins.com' );
|
4 |
* Plugin URI: https://strongplugins.com/plugins/strong-testimonials/
|
5 |
* Description: Collect and display your testimonials or reviews.
|
6 |
* Author: Chris Dillon
|
7 |
+
* Version: 2.31.5
|
8 |
*
|
9 |
* Author URI: https://strongplugins.com/
|
10 |
* Text Domain: strong-testimonials
|
34 |
exit;
|
35 |
}
|
36 |
|
37 |
+
define( 'WPMTST_VERSION', '2.31.5' );
|
38 |
define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
|
39 |
define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
|
40 |
define( 'STRONGPLUGINS_STORE_URL', 'https://strongplugins.com' );
|
templates-scss/_partials/_structure-form.scss
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
.strong-form {
|
|
|
2 |
margin: 0 auto;
|
3 |
|
4 |
.form-field {
|
@@ -119,3 +120,23 @@ img.captcha {
|
|
119 |
}
|
120 |
|
121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.strong-form {
|
2 |
+
position: relative;
|
3 |
margin: 0 auto;
|
4 |
|
5 |
.form-field {
|
120 |
}
|
121 |
|
122 |
}
|
123 |
+
|
124 |
+
.strong-form-wait {
|
125 |
+
display: none;
|
126 |
+
position: absolute;
|
127 |
+
top: 0;
|
128 |
+
bottom: 0;
|
129 |
+
left: 0;
|
130 |
+
right: 0;
|
131 |
+
background: rgba(255,255,255,0.7);
|
132 |
+
|
133 |
+
.message {
|
134 |
+
position: absolute;
|
135 |
+
top: calc( 50% - 25px );
|
136 |
+
text-align: center;
|
137 |
+
width: 100%;
|
138 |
+
height: 50px;
|
139 |
+
line-height: 50px;
|
140 |
+
color: #111;
|
141 |
+
}
|
142 |
+
}
|
templates/default-form/form.css
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
* Strong Testimonials Default Form template
|
3 |
*/
|
4 |
.strong-form {
|
|
|
5 |
margin: 0 auto;
|
6 |
}
|
7 |
.strong-form .form-field {
|
@@ -100,6 +101,25 @@ img.captcha {
|
|
100 |
padding-left: 0;
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
.strong-form {
|
104 |
/* error indicators */
|
105 |
/* field-wrap is used for checkboxes, radios, star ratings */
|
2 |
* Strong Testimonials Default Form template
|
3 |
*/
|
4 |
.strong-form {
|
5 |
+
position: relative;
|
6 |
margin: 0 auto;
|
7 |
}
|
8 |
.strong-form .form-field {
|
101 |
padding-left: 0;
|
102 |
}
|
103 |
|
104 |
+
.strong-form-wait {
|
105 |
+
display: none;
|
106 |
+
position: absolute;
|
107 |
+
top: 0;
|
108 |
+
bottom: 0;
|
109 |
+
left: 0;
|
110 |
+
right: 0;
|
111 |
+
background: rgba(255, 255, 255, 0.7);
|
112 |
+
}
|
113 |
+
.strong-form-wait .message {
|
114 |
+
position: absolute;
|
115 |
+
top: calc( 50% - 25px );
|
116 |
+
text-align: center;
|
117 |
+
width: 100%;
|
118 |
+
height: 50px;
|
119 |
+
line-height: 50px;
|
120 |
+
color: #111;
|
121 |
+
}
|
122 |
+
|
123 |
.strong-form {
|
124 |
/* error indicators */
|
125 |
/* field-wrap is used for checkboxes, radios, star ratings */
|
templates/default-form/form.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
|
|
|
|
9 |
<div id="wpmtst-form">
|
10 |
|
11 |
<div class="strong-form-inner">
|
@@ -30,4 +32,6 @@
|
|
30 |
|
31 |
</div>
|
32 |
|
|
|
|
|
33 |
</div>
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
9 |
+
<?php do_action( 'wpmtst_before_form' ); ?>
|
10 |
+
|
11 |
<div id="wpmtst-form">
|
12 |
|
13 |
<div class="strong-form-inner">
|
32 |
|
33 |
</div>
|
34 |
|
35 |
+
<?php do_action( 'wpmtst_after_form' ); ?>
|
36 |
+
|
37 |
</div>
|
templates/simple-form/form.css
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
* Strong Testimonials Simple Form template
|
3 |
*/
|
4 |
.strong-form {
|
|
|
5 |
margin: 0 auto;
|
6 |
}
|
7 |
.strong-form .form-field {
|
@@ -100,6 +101,25 @@ img.captcha {
|
|
100 |
padding-left: 0;
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
.strong-form {
|
104 |
/* error indicators */
|
105 |
/* field-wrap is used for checkboxes, radios, star ratings */
|
2 |
* Strong Testimonials Simple Form template
|
3 |
*/
|
4 |
.strong-form {
|
5 |
+
position: relative;
|
6 |
margin: 0 auto;
|
7 |
}
|
8 |
.strong-form .form-field {
|
101 |
padding-left: 0;
|
102 |
}
|
103 |
|
104 |
+
.strong-form-wait {
|
105 |
+
display: none;
|
106 |
+
position: absolute;
|
107 |
+
top: 0;
|
108 |
+
bottom: 0;
|
109 |
+
left: 0;
|
110 |
+
right: 0;
|
111 |
+
background: rgba(255, 255, 255, 0.7);
|
112 |
+
}
|
113 |
+
.strong-form-wait .message {
|
114 |
+
position: absolute;
|
115 |
+
top: calc( 50% - 25px );
|
116 |
+
text-align: center;
|
117 |
+
width: 100%;
|
118 |
+
height: 50px;
|
119 |
+
line-height: 50px;
|
120 |
+
color: #111;
|
121 |
+
}
|
122 |
+
|
123 |
.strong-form {
|
124 |
/* error indicators */
|
125 |
/* field-wrap is used for checkboxes, radios, star ratings */
|
templates/simple-form/form.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
|
|
|
|
9 |
<div id="wpmtst-form">
|
10 |
|
11 |
<div class="strong-form-inner">
|
@@ -30,4 +32,6 @@
|
|
30 |
|
31 |
</div>
|
32 |
|
|
|
|
|
33 |
</div>
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
9 |
+
<?php do_action( 'wpmtst_before_form' ); ?>
|
10 |
+
|
11 |
<div id="wpmtst-form">
|
12 |
|
13 |
<div class="strong-form-inner">
|
32 |
|
33 |
</div>
|
34 |
|
35 |
+
<?php do_action( 'wpmtst_after_form' ); ?>
|
36 |
+
|
37 |
</div>
|
templates/unstyled-form/form.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
|
|
|
|
9 |
<div id="wpmtst-form">
|
10 |
|
11 |
<div class="strong-form-inner">
|
@@ -30,4 +32,6 @@
|
|
30 |
|
31 |
</div>
|
32 |
|
|
|
|
|
33 |
</div>
|
6 |
?>
|
7 |
<div class="strong-view strong-form <?php wpmtst_container_class(); ?>"<?php wpmtst_container_data(); ?>>
|
8 |
|
9 |
+
<?php do_action( 'wpmtst_before_form' ); ?>
|
10 |
+
|
11 |
<div id="wpmtst-form">
|
12 |
|
13 |
<div class="strong-form-inner">
|
32 |
|
33 |
</div>
|
34 |
|
35 |
+
<?php do_action( 'wpmtst_after_form' ); ?>
|
36 |
+
|
37 |
</div>
|