Version Description
Download this release
Release Info
Developer | machothemes |
Plugin | Strong Testimonials |
Version | 2.39 |
Comparing to | |
See all releases |
Code changes from version 2.38.1 to 2.39
- admin/about/class-strong-testimonials-about.php +1 -2
- admin/admin.php +1 -3
- admin/class-strong-testimonials-defaults.php +4 -48
- admin/class-strong-testimonials-updater.php +101 -163
- admin/class-strong-testimonials-upsell.php +104 -5
- admin/custom-fields.php +1 -0
- admin/settings/class-strong-testimonials-settings-form.php +1 -5
- admin/settings/partials/form.php +1 -146
- assets/css/admin.css +5 -1
- changelog.txt +3 -0
- includes/class-strong-form.php +1 -95
- includes/class-strong-view-form.php +0 -32
- includes/class-strong-view.php +1 -1
- includes/functions-template-form.php +1 -109
- includes/integrations/class-integration-captcha-pro.php +0 -25
- includes/integrations/class-integration-captcha.php +0 -14
- includes/integrations/class-integration-google-captcha.php +0 -24
- includes/integrations/class-integration-really-simple-captcha.php +0 -40
- public/js/lib/strongslider/jquery.strongslider.js +5 -0
- public/js/lib/strongslider/jquery.strongslider.min.js +1 -1
- readme.txt +1 -7
- strong-testimonials.php +4 -2
admin/about/class-strong-testimonials-about.php
CHANGED
@@ -51,7 +51,6 @@ class Strong_Testimonials_About {
|
|
51 |
* Print the About page.
|
52 |
*/
|
53 |
public function about_page() {
|
54 |
-
$major_minor = strtok( WPMTST_VERSION, '.' ) . '.' . strtok( '.' );
|
55 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
|
56 |
$url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
|
57 |
?>
|
@@ -60,7 +59,7 @@ class Strong_Testimonials_About {
|
|
60 |
<img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
|
61 |
|
62 |
<?php /* translators: %s is the plugin version number */ ?>
|
63 |
-
<h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ),
|
64 |
|
65 |
<p class="about-text">
|
66 |
<?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
|
51 |
* Print the About page.
|
52 |
*/
|
53 |
public function about_page() {
|
|
|
54 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'how-to';
|
55 |
$url = admin_url( 'edit.php?post_type=wpm-testimonial&page=about-strong-testimonials' );
|
56 |
?>
|
59 |
<img class="wpmst-mascot" src="<?php echo esc_url( WPMTST_ADMIN_URL ); ?>/img/mascot.png" />
|
60 |
|
61 |
<?php /* translators: %s is the plugin version number */ ?>
|
62 |
+
<h1><?php printf( __( 'Welcome to Strong Testimonials %s', 'strong-testimonials' ), WPMTST_VERSION ); ?></h1>
|
63 |
|
64 |
<p class="about-text">
|
65 |
<?php esc_html_e( 'Thank you for updating to the latest version!', 'strong-testimonials' ); ?>
|
admin/admin.php
CHANGED
@@ -43,9 +43,7 @@ function wpmtst_update_check() {
|
|
43 |
add_option( 'wpmtst_do_activation_redirect', true );
|
44 |
}
|
45 |
|
46 |
-
|
47 |
-
$updater = new Strong_Testimonials_Updater();
|
48 |
-
$updater->update();
|
49 |
}
|
50 |
|
51 |
add_action( 'admin_init', 'wpmtst_update_check', 5 );
|
43 |
add_option( 'wpmtst_do_activation_redirect', true );
|
44 |
}
|
45 |
|
46 |
+
Strong_Testimonials_Updater::update();
|
|
|
|
|
47 |
}
|
48 |
|
49 |
add_action( 'admin_init', 'wpmtst_update_check', 5 );
|
admin/class-strong-testimonials-defaults.php
CHANGED
@@ -394,29 +394,22 @@ class Strong_Testimonials_Defaults {
|
|
394 |
'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
|
395 |
'enabled' => 1,
|
396 |
),
|
397 |
-
'captcha' => array(
|
398 |
-
'order' => 2,
|
399 |
-
/* translators: Settings > Form > Messages tab */
|
400 |
-
'description' => _x( 'Captcha Label', 'description', 'strong-testimonials' ),
|
401 |
-
'text' => _x( 'Captcha', 'Default label for Captcha field on submission form.', 'strong-testimonials' ),
|
402 |
-
'required' => false,
|
403 |
-
),
|
404 |
'form-submit-button' => array(
|
405 |
-
'order' =>
|
406 |
/* translators: Settings > Form > Messages tab */
|
407 |
'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
|
408 |
/* translators: Default label for the Submit button on testimonial form. */
|
409 |
'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
|
410 |
),
|
411 |
'submission-error' => array(
|
412 |
-
'order' =>
|
413 |
/* translators: Settings > Form > Messages tab */
|
414 |
'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
|
415 |
/* translators: Default message for submission form error. */
|
416 |
'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
|
417 |
),
|
418 |
'submission-success' => array(
|
419 |
-
'order' =>
|
420 |
/* translators: Settings > Form > Messages tab */
|
421 |
'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
|
422 |
/* translators: Default message for submission form success message. */
|
@@ -449,9 +442,6 @@ class Strong_Testimonials_Defaults {
|
|
449 |
'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
|
450 |
/* translators: Default message for new testimonial notification email. */
|
451 |
'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
|
452 |
-
'captcha' => '',
|
453 |
-
'honeypot_before' => false,
|
454 |
-
'honeypot_after' => false,
|
455 |
'messages' => $default_messages,
|
456 |
'scrolltop_success' => true,
|
457 |
'scrolltop_success_offset' => 80,
|
@@ -462,7 +452,7 @@ class Strong_Testimonials_Defaults {
|
|
462 |
'success_redirect_url' => '',
|
463 |
);
|
464 |
|
465 |
-
return $default_form_options;
|
466 |
}
|
467 |
|
468 |
/**
|
@@ -837,38 +827,4 @@ class Strong_Testimonials_Defaults {
|
|
837 |
return $options;
|
838 |
}
|
839 |
|
840 |
-
/**
|
841 |
-
* Build list of supported Captcha plugins.
|
842 |
-
*
|
843 |
-
* @since 2.28.5 In this class.
|
844 |
-
*/
|
845 |
-
public static function get_captcha_plugins() {
|
846 |
-
$plugins = array(
|
847 |
-
'google-captcha' => array(
|
848 |
-
'name' => 'Google Captcha by BestWebSoft (free)',
|
849 |
-
'desc' => __( '<strong>Recommended.</strong> The best choice for both Invisible reCAPTCHA and reCAPTCHA V2 ("I\'m not a robot" checkbox).', 'strong-testimonials' ),
|
850 |
-
'class' => 'Google_Captcha',
|
851 |
-
'file' => 'google-captcha/google-captcha.php',
|
852 |
-
'settings' => 'admin.php?page=google-captcha.php',
|
853 |
-
'search' => 'plugin-install.php?tab=search&s=Google+Captcha',
|
854 |
-
'url' => 'https://wordpress.org/plugins/google-captcha',
|
855 |
-
'installed' => false,
|
856 |
-
'active' => false,
|
857 |
-
),
|
858 |
-
'captcha-pro' => array(
|
859 |
-
'name' => 'Captcha Pro by BestWebSoft (premium)',
|
860 |
-
'desc' => __( 'An excellent plugin for math- and image-based captchas.', 'strong-testimonials' ),
|
861 |
-
'class' => 'Captcha_Pro',
|
862 |
-
'file' => 'captcha-pro/captcha_pro.php',
|
863 |
-
'settings' => 'admin.php?page=captcha_pro.php',
|
864 |
-
'search' => '',
|
865 |
-
'url' => 'https://bestwebsoft.com/products/wordpress/plugins/captcha/',
|
866 |
-
'installed' => false,
|
867 |
-
'active' => false,
|
868 |
-
),
|
869 |
-
);
|
870 |
-
|
871 |
-
return $plugins;
|
872 |
-
}
|
873 |
-
|
874 |
}
|
394 |
'text' => _x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ),
|
395 |
'enabled' => 1,
|
396 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
'form-submit-button' => array(
|
398 |
+
'order' => 2,
|
399 |
/* translators: Settings > Form > Messages tab */
|
400 |
'description' => _x( 'Submit Button', 'description', 'strong-testimonials' ),
|
401 |
/* translators: Default label for the Submit button on testimonial form. */
|
402 |
'text' => _x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ),
|
403 |
),
|
404 |
'submission-error' => array(
|
405 |
+
'order' => 3,
|
406 |
/* translators: Settings > Form > Messages tab */
|
407 |
'description' => _x( 'Submission Error', 'description', 'strong-testimonials' ),
|
408 |
/* translators: Default message for submission form error. */
|
409 |
'text' => _x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ),
|
410 |
),
|
411 |
'submission-success' => array(
|
412 |
+
'order' => 4,
|
413 |
/* translators: Settings > Form > Messages tab */
|
414 |
'description' => _x( 'Submission Success', 'description', 'strong-testimonials' ),
|
415 |
/* translators: Default message for submission form success message. */
|
442 |
'email_subject' => __( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ),
|
443 |
/* translators: Default message for new testimonial notification email. */
|
444 |
'email_message' => __( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ),
|
|
|
|
|
|
|
445 |
'messages' => $default_messages,
|
446 |
'scrolltop_success' => true,
|
447 |
'scrolltop_success_offset' => 80,
|
452 |
'success_redirect_url' => '',
|
453 |
);
|
454 |
|
455 |
+
return apply_filters( 'wpmtst_default_form_options', $default_form_options );
|
456 |
}
|
457 |
|
458 |
/**
|
827 |
return $options;
|
828 |
}
|
829 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
830 |
}
|
admin/class-strong-testimonials-updater.php
CHANGED
@@ -12,27 +12,20 @@ class Strong_Testimonials_Updater {
|
|
12 |
*
|
13 |
* @var string
|
14 |
*/
|
15 |
-
private $old_version;
|
16 |
|
17 |
/**
|
18 |
* Log steps during update process.
|
19 |
*
|
20 |
* @var array
|
21 |
*/
|
22 |
-
private $new_log;
|
23 |
|
24 |
/**
|
25 |
* Strong_Testimonials_Updater constructor.
|
26 |
*/
|
27 |
public function __construct() {
|
28 |
-
|
29 |
-
$this->old_version = get_option( 'wpmtst_plugin_version', false );
|
30 |
-
if ( $this->old_version ) {
|
31 |
-
$this->log( __CLASS__, 'old: ' . $this->old_version . ' --> new: ' . WPMTST_VERSION );
|
32 |
-
}
|
33 |
-
else {
|
34 |
-
$this->log( __CLASS__, 'NEW INSTALL', WPMTST_VERSION );
|
35 |
-
}
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -42,7 +35,7 @@ class Strong_Testimonials_Updater {
|
|
42 |
* @param string $entry
|
43 |
* @param string $var
|
44 |
*/
|
45 |
-
private function log( $name, $entry = '', $var = '' ) {
|
46 |
if ( $name ) {
|
47 |
$x = $name;
|
48 |
if ( $entry ) {
|
@@ -51,20 +44,20 @@ class Strong_Testimonials_Updater {
|
|
51 |
$x .= ' = ';
|
52 |
if ( is_array( $var ) || is_object( $var ) ) {
|
53 |
// log the text
|
54 |
-
|
55 |
// then log the variable
|
56 |
-
|
57 |
}
|
58 |
else {
|
59 |
-
|
60 |
}
|
61 |
}
|
62 |
else {
|
63 |
-
|
64 |
}
|
65 |
}
|
66 |
else {
|
67 |
-
|
68 |
}
|
69 |
}
|
70 |
}
|
@@ -83,7 +76,7 @@ class Strong_Testimonials_Updater {
|
|
83 |
* disabled (0) to enabled (1) in order for the property to
|
84 |
* be displayed in the form editor.
|
85 |
*/
|
86 |
-
public function update() {
|
87 |
if ( get_transient( 'wpmtst_update_in_progress' ) ) {
|
88 |
return;
|
89 |
}
|
@@ -95,12 +88,12 @@ class Strong_Testimonials_Updater {
|
|
95 |
*
|
96 |
* @since 2.27.1
|
97 |
*/
|
98 |
-
|
99 |
|
100 |
/**
|
101 |
* Check DB version.
|
102 |
*/
|
103 |
-
|
104 |
|
105 |
/**
|
106 |
* Let's start updating.
|
@@ -110,60 +103,54 @@ class Strong_Testimonials_Updater {
|
|
110 |
/**
|
111 |
* Options.
|
112 |
*/
|
113 |
-
update_option( 'wpmtst_options',
|
114 |
|
115 |
/**
|
116 |
* Custom fields.
|
117 |
*/
|
118 |
-
update_option( 'wpmtst_fields',
|
119 |
|
120 |
/**
|
121 |
* Forms.
|
122 |
*/
|
123 |
-
update_option( 'wpmtst_base_forms',
|
124 |
-
update_option( 'wpmtst_custom_forms',
|
125 |
-
update_option( 'wpmtst_form_options',
|
126 |
|
127 |
/**
|
128 |
* Compatibility options.
|
129 |
*
|
130 |
* @since 2.28.0
|
131 |
*/
|
132 |
-
update_option( 'wpmtst_compat_options',
|
133 |
|
134 |
/**
|
135 |
* Overwrite default view options.
|
136 |
*
|
137 |
* @since 2.15.0
|
138 |
*/
|
139 |
-
update_option( 'wpmtst_view_options',
|
140 |
|
141 |
/**
|
142 |
* Overwrite default view settings.
|
143 |
*
|
144 |
* @since 2.15.0
|
145 |
*/
|
146 |
-
update_option( 'wpmtst_view_default',
|
147 |
|
148 |
/**
|
149 |
* Update views.
|
150 |
*/
|
151 |
-
|
152 |
|
153 |
/**
|
154 |
* Convert nofollow
|
155 |
*/
|
156 |
if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
|
157 |
-
|
158 |
-
|
159 |
}
|
160 |
|
161 |
-
/**
|
162 |
-
* Captcha plugin integrations.
|
163 |
-
*
|
164 |
-
* @since 2.29.0
|
165 |
-
*/
|
166 |
-
update_option( 'wpmtst_captcha_plugins', $this->update_captcha_plugins() );
|
167 |
|
168 |
/**
|
169 |
* Legacy stuff.
|
@@ -178,13 +165,13 @@ class Strong_Testimonials_Updater {
|
|
178 |
// Remove older attempts at admin notices.
|
179 |
delete_option( 'wpmtst_news_flag' );
|
180 |
|
181 |
-
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
* Fix add-ons.
|
186 |
*/
|
187 |
-
|
188 |
|
189 |
/**
|
190 |
* Update the plugin version.
|
@@ -194,12 +181,12 @@ class Strong_Testimonials_Updater {
|
|
194 |
/**
|
195 |
* Update log.
|
196 |
*/
|
197 |
-
|
198 |
|
199 |
/**
|
200 |
* Update admin notices.
|
201 |
*/
|
202 |
-
|
203 |
|
204 |
delete_transient( 'wpmtst_update_in_progress' );
|
205 |
}
|
@@ -209,7 +196,7 @@ class Strong_Testimonials_Updater {
|
|
209 |
*
|
210 |
* @since 2.30.9
|
211 |
*/
|
212 |
-
public function update_addons() {
|
213 |
$addons = get_option( 'wpmtst_addons' );
|
214 |
if ( $addons ) {
|
215 |
foreach ( $addons as $addon => $data ) {
|
@@ -224,13 +211,13 @@ class Strong_Testimonials_Updater {
|
|
224 |
/**
|
225 |
* Update the log in options table.
|
226 |
*/
|
227 |
-
public function update_log() {
|
228 |
$log = get_option( 'wpmtst_update_log', array() );
|
229 |
-
$log[ current_time( 'mysql' ) ] =
|
230 |
update_option( 'wpmtst_update_log', $log );
|
231 |
}
|
232 |
|
233 |
-
public function update_admin_notices() {
|
234 |
wpmtst_add_admin_notice( 'feedback-notice', true );
|
235 |
wpmtst_add_admin_notice( 'upsell-notice', true );
|
236 |
}
|
@@ -242,7 +229,7 @@ class Strong_Testimonials_Updater {
|
|
242 |
*
|
243 |
* @return bool|null|WP_Role
|
244 |
*/
|
245 |
-
public function get_admins() {
|
246 |
return get_role( 'administrator' );
|
247 |
}
|
248 |
|
@@ -251,8 +238,8 @@ class Strong_Testimonials_Updater {
|
|
251 |
*
|
252 |
* @since 2.27.1
|
253 |
*/
|
254 |
-
public function add_caps() {
|
255 |
-
$admins =
|
256 |
if ( $admins ) {
|
257 |
$admins->add_cap( 'strong_testimonials_views' );
|
258 |
$admins->add_cap( 'strong_testimonials_fields' );
|
@@ -260,7 +247,7 @@ class Strong_Testimonials_Updater {
|
|
260 |
$admins->add_cap( 'strong_testimonials_about' );
|
261 |
}
|
262 |
else {
|
263 |
-
|
264 |
}
|
265 |
}
|
266 |
|
@@ -273,8 +260,8 @@ class Strong_Testimonials_Updater {
|
|
273 |
*
|
274 |
* @since 2.27.1
|
275 |
*/
|
276 |
-
public function remove_caps() {
|
277 |
-
if ( $admins =
|
278 |
$admins->remove_cap( 'strong_testimonials_views' );
|
279 |
$admins->remove_cap( 'strong_testimonials_fields' );
|
280 |
$admins->remove_cap( 'strong_testimonials_options' );
|
@@ -287,10 +274,10 @@ class Strong_Testimonials_Updater {
|
|
287 |
*
|
288 |
* @since 1.21.0 Checking for new table version.
|
289 |
*/
|
290 |
-
public function update_db_check() {
|
291 |
if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
|
292 |
wpmtst_update_tables();
|
293 |
-
|
294 |
}
|
295 |
}
|
296 |
|
@@ -299,7 +286,7 @@ class Strong_Testimonials_Updater {
|
|
299 |
*
|
300 |
* @param $event
|
301 |
*/
|
302 |
-
public function update_history_log( $event ) {
|
303 |
$history = get_option( 'wpmtst_history', array() );
|
304 |
$history[ $event ] = current_time( 'mysql' );
|
305 |
update_option( 'wpmtst_history', $history );
|
@@ -310,7 +297,7 @@ class Strong_Testimonials_Updater {
|
|
310 |
*
|
311 |
* @return array
|
312 |
*/
|
313 |
-
public function update_options() {
|
314 |
$options = get_option( 'wpmtst_options' );
|
315 |
if ( ! $options ) {
|
316 |
return Strong_Testimonials_Defaults::get_options();
|
@@ -319,7 +306,7 @@ class Strong_Testimonials_Updater {
|
|
319 |
/**
|
320 |
* Remove version 1 options
|
321 |
*/
|
322 |
-
if ( version_compare( '2.0',
|
323 |
|
324 |
if ( isset( $options['captcha'] ) ) {
|
325 |
unset( $options['captcha'] );
|
@@ -404,7 +391,7 @@ class Strong_Testimonials_Updater {
|
|
404 |
*
|
405 |
* @return array
|
406 |
*/
|
407 |
-
public function update_fields() {
|
408 |
return Strong_Testimonials_Defaults::get_fields();
|
409 |
}
|
410 |
|
@@ -413,7 +400,7 @@ class Strong_Testimonials_Updater {
|
|
413 |
*
|
414 |
* @return array
|
415 |
*/
|
416 |
-
public function update_base_forms() {
|
417 |
return Strong_Testimonials_Defaults::get_base_forms();
|
418 |
}
|
419 |
|
@@ -422,7 +409,7 @@ class Strong_Testimonials_Updater {
|
|
422 |
*
|
423 |
* @return array
|
424 |
*/
|
425 |
-
public function update_custom_forms() {
|
426 |
$custom_forms = get_option( 'wpmtst_custom_forms' );
|
427 |
if ( ! $custom_forms ) {
|
428 |
return Strong_Testimonials_Defaults::get_custom_forms();
|
@@ -496,7 +483,7 @@ class Strong_Testimonials_Updater {
|
|
496 |
*
|
497 |
* @return array
|
498 |
*/
|
499 |
-
public function update_form_options() {
|
500 |
$form_options = get_option( 'wpmtst_form_options' );
|
501 |
if ( ! $form_options ) {
|
502 |
return Strong_Testimonials_Defaults::get_form_options();
|
@@ -515,15 +502,6 @@ class Strong_Testimonials_Updater {
|
|
515 |
$form_options['admin_email'] = $options['admin_email'];
|
516 |
unset( $options['admin_email'] );
|
517 |
|
518 |
-
$form_options['captcha'] = $options['captcha'];
|
519 |
-
unset( $options['captcha'] );
|
520 |
-
|
521 |
-
$form_options['honeypot_before'] = $options['honeypot_before'];
|
522 |
-
unset( $options['honeypot_before'] );
|
523 |
-
|
524 |
-
$form_options['honeypot_after'] = $options['honeypot_after'];
|
525 |
-
unset( $options['honeypot_after'] );
|
526 |
-
|
527 |
update_option( 'wpmtst_options', $options );
|
528 |
}
|
529 |
|
@@ -556,6 +534,15 @@ class Strong_Testimonials_Updater {
|
|
556 |
$form_options['messages']['required-field']['enabled'] = 1;
|
557 |
}
|
558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
/**
|
560 |
* Merge in new options.
|
561 |
*/
|
@@ -566,56 +553,14 @@ class Strong_Testimonials_Updater {
|
|
566 |
// Merge nested arrays individually. Don't use array_merge_recursive.
|
567 |
|
568 |
$form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
/**
|
575 |
-
* Convert Captcha plugin name.
|
576 |
-
*
|
577 |
-
* @since 2.28.5
|
578 |
-
*/
|
579 |
-
switch ( $form_options['captcha'] ) {
|
580 |
-
|
581 |
-
case 'gglcptch' :
|
582 |
-
// Google Captcha by BestWebSoft
|
583 |
-
$form_options['captcha'] = 'google-captcha';
|
584 |
-
$notice = false;
|
585 |
-
break;
|
586 |
-
|
587 |
-
case 'bwsmathpro' :
|
588 |
-
// Captcha Pro by BestWebSoft
|
589 |
-
$form_options['captcha'] = 'captcha-pro';
|
590 |
-
$notice = false;
|
591 |
-
break;
|
592 |
-
|
593 |
-
case 'miyoshi' :
|
594 |
-
// Really Simple Captcha by Takayuki Miyoshi
|
595 |
-
$form_options['captcha'] = 'really-simple-captcha';
|
596 |
-
$notice = false;
|
597 |
-
break;
|
598 |
-
|
599 |
-
case 'advnore' :
|
600 |
-
// Advanced noCaptcha reCaptcha by Shamim Hasan
|
601 |
-
// Integration dropped @since 2.29.0
|
602 |
-
$form_options['captcha'] = '';
|
603 |
-
$notice = true;
|
604 |
-
break;
|
605 |
-
|
606 |
-
case 'bwsmath' :
|
607 |
-
// Craptcha by simplywordpress
|
608 |
-
// Integration dropped @since 2.29.0
|
609 |
-
$form_options['captcha'] = '';
|
610 |
-
$notice = true;
|
611 |
-
break;
|
612 |
-
|
613 |
-
default :
|
614 |
-
$notice = false;
|
615 |
}
|
616 |
|
617 |
if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
|
618 |
-
|
619 |
if ( $notice ) {
|
620 |
wpmtst_add_admin_notice( 'captcha-options-changed', true );
|
621 |
}
|
@@ -631,7 +576,7 @@ class Strong_Testimonials_Updater {
|
|
631 |
*
|
632 |
* @return array
|
633 |
*/
|
634 |
-
public function update_compat_options() {
|
635 |
$options = get_option( 'wpmtst_compat_options' );
|
636 |
if ( ! $options ) {
|
637 |
return Strong_Testimonials_Defaults::get_compat_options();
|
@@ -681,16 +626,7 @@ class Strong_Testimonials_Updater {
|
|
681 |
*
|
682 |
* @return array
|
683 |
*/
|
684 |
-
public function
|
685 |
-
return Strong_Testimonials_Defaults::get_captcha_plugins();
|
686 |
-
}
|
687 |
-
|
688 |
-
/**
|
689 |
-
* View options.
|
690 |
-
*
|
691 |
-
* @return array
|
692 |
-
*/
|
693 |
-
public function update_view_options() {
|
694 |
return Strong_Testimonials_Defaults::get_view_options();
|
695 |
}
|
696 |
|
@@ -699,7 +635,7 @@ class Strong_Testimonials_Updater {
|
|
699 |
*
|
700 |
* @return array
|
701 |
*/
|
702 |
-
public function update_default_view() {
|
703 |
return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
|
704 |
}
|
705 |
|
@@ -708,7 +644,7 @@ class Strong_Testimonials_Updater {
|
|
708 |
*
|
709 |
* @uses wpmtst_save_view
|
710 |
*/
|
711 |
-
public function update_views() {
|
712 |
$views = wpmtst_get_views();
|
713 |
|
714 |
if ( ! $views ) {
|
@@ -722,7 +658,7 @@ class Strong_Testimonials_Updater {
|
|
722 |
|
723 |
$view_data = unserialize( $view['value'] );
|
724 |
if ( ! is_array( $view_data ) ) {
|
725 |
-
|
726 |
continue;
|
727 |
}
|
728 |
|
@@ -737,30 +673,30 @@ class Strong_Testimonials_Updater {
|
|
737 |
*/
|
738 |
unset( $view_data['compat'] );
|
739 |
|
740 |
-
$view_data =
|
741 |
-
$view_data =
|
742 |
-
$view_data =
|
743 |
-
$view_data =
|
744 |
-
$view_data =
|
745 |
-
$view_data =
|
746 |
-
$view_data =
|
747 |
-
$view_data =
|
748 |
-
$view_data =
|
749 |
-
$view_data =
|
750 |
-
$view_data =
|
751 |
}
|
752 |
|
753 |
/**
|
754 |
* For version 2.30.
|
755 |
*/
|
756 |
if ( ! isset( $history['2.30_new_template_structure'] ) ) {
|
757 |
-
$view_data =
|
758 |
-
$view_data =
|
759 |
if ( isset( $view_data['background']['example-font-color'] ) ) {
|
760 |
unset( $view_data['background']['example-font-color'] );
|
761 |
}
|
762 |
|
763 |
-
|
764 |
}
|
765 |
|
766 |
/**
|
@@ -769,8 +705,8 @@ class Strong_Testimonials_Updater {
|
|
769 |
* @since 2.32.2
|
770 |
*/
|
771 |
if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
|
772 |
-
$view['data'] =
|
773 |
-
|
774 |
}
|
775 |
|
776 |
/**
|
@@ -832,7 +768,7 @@ class Strong_Testimonials_Updater {
|
|
832 |
*
|
833 |
* @return array
|
834 |
*/
|
835 |
-
public function add_carousel_breakpoints( $view_data ) {
|
836 |
if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
|
837 |
return $view_data;
|
838 |
}
|
@@ -880,7 +816,7 @@ class Strong_Testimonials_Updater {
|
|
880 |
*
|
881 |
* @return array
|
882 |
*/
|
883 |
-
public function convert_template_structure( $view_data ) {
|
884 |
/*
|
885 |
Array
|
886 |
(
|
@@ -962,7 +898,7 @@ class Strong_Testimonials_Updater {
|
|
962 |
*
|
963 |
* @return array
|
964 |
*/
|
965 |
-
public function convert_template_name( $view_data ) {
|
966 |
// Change default template from empty to 'default:{type}'
|
967 |
if ( ! $view_data['template'] ) {
|
968 |
if ( 'form' == $view_data['mode'] ) {
|
@@ -999,10 +935,10 @@ class Strong_Testimonials_Updater {
|
|
999 |
*
|
1000 |
* @return array
|
1001 |
*/
|
1002 |
-
public function convert_excerpt_length( $view_data ) {
|
1003 |
if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
|
1004 |
$default_view = Strong_Testimonials_Defaults::get_default_view();
|
1005 |
-
$average_word_length =
|
1006 |
|
1007 |
if ( isset( $view_data['length'] ) && $view_data['length'] ) {
|
1008 |
$word_count = round( $view_data['length'] / $average_word_length );
|
@@ -1029,7 +965,7 @@ class Strong_Testimonials_Updater {
|
|
1029 |
*
|
1030 |
* @return array
|
1031 |
*/
|
1032 |
-
public function convert_more_text( $view_data ) {
|
1033 |
if ( isset( $view_data['more_text'] ) ) {
|
1034 |
if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
|
1035 |
// convert more_page to toggle and move page id to more_page_id
|
@@ -1055,7 +991,7 @@ class Strong_Testimonials_Updater {
|
|
1055 |
*
|
1056 |
* @return array
|
1057 |
*/
|
1058 |
-
public function convert_slideshow( $view_data ) {
|
1059 |
if ( isset( $view_data['slideshow_settings'] ) ) {
|
1060 |
return $view_data;
|
1061 |
}
|
@@ -1128,7 +1064,7 @@ class Strong_Testimonials_Updater {
|
|
1128 |
*
|
1129 |
* @return array
|
1130 |
*/
|
1131 |
-
public function convert_count( $view_data ) {
|
1132 |
if ( isset( $view_data['all'] ) ) {
|
1133 |
if ( $view_data['all'] ) {
|
1134 |
$view_data['count'] = -1;
|
@@ -1146,7 +1082,7 @@ class Strong_Testimonials_Updater {
|
|
1146 |
*
|
1147 |
* @return array
|
1148 |
*/
|
1149 |
-
public function convert_background_color( $view_data ) {
|
1150 |
if ( ! is_array( $view_data['background'] ) ) {
|
1151 |
$view_data['background'] = array(
|
1152 |
'color' => $view_data['background'],
|
@@ -1164,7 +1100,7 @@ class Strong_Testimonials_Updater {
|
|
1164 |
*
|
1165 |
* @return array
|
1166 |
*/
|
1167 |
-
public function convert_form_ajax( $view_data ) {
|
1168 |
if ( isset( $view_data['form-ajax'] ) ) {
|
1169 |
$view_data['form_ajax'] = $view_data['form-ajax'];
|
1170 |
unset( $view_data['form-ajax'] );
|
@@ -1180,7 +1116,7 @@ class Strong_Testimonials_Updater {
|
|
1180 |
*
|
1181 |
* @return array
|
1182 |
*/
|
1183 |
-
public function convert_layout( $view_data ) {
|
1184 |
if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
|
1185 |
if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
|
1186 |
$view_data['layout'] = '';
|
@@ -1199,7 +1135,7 @@ class Strong_Testimonials_Updater {
|
|
1199 |
*
|
1200 |
* @return array
|
1201 |
*/
|
1202 |
-
public function convert_word_count( $view_data ) {
|
1203 |
if ( isset( $view_data['word_count'] ) ) {
|
1204 |
$view_data['excerpt_length'] = $view_data['word_count'];
|
1205 |
unset( $view_data['word_count'] );
|
@@ -1216,11 +1152,11 @@ class Strong_Testimonials_Updater {
|
|
1216 |
*
|
1217 |
* @return array
|
1218 |
*/
|
1219 |
-
public function convert_modern_title( $view_data ) {
|
1220 |
if ( 'modern:content' == $view_data['template'] ) {
|
1221 |
if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
|
1222 |
$view_data['title'] = 0;
|
1223 |
-
|
1224 |
}
|
1225 |
}
|
1226 |
|
@@ -1236,7 +1172,7 @@ class Strong_Testimonials_Updater {
|
|
1236 |
*
|
1237 |
* @return array
|
1238 |
*/
|
1239 |
-
public function convert_title_link( $view_data ) {
|
1240 |
if ( ! isset( $view_data['title_link'] ) ) {
|
1241 |
$view_data['title_link'] = 0;
|
1242 |
}
|
@@ -1249,7 +1185,7 @@ class Strong_Testimonials_Updater {
|
|
1249 |
*
|
1250 |
* @since 2.23.0
|
1251 |
*/
|
1252 |
-
public function convert_nofollow() {
|
1253 |
$args = array(
|
1254 |
'posts_per_page' => - 1,
|
1255 |
'post_type' => 'wpm-testimonial',
|
@@ -1302,7 +1238,7 @@ class Strong_Testimonials_Updater {
|
|
1302 |
*
|
1303 |
* @return mixed
|
1304 |
*/
|
1305 |
-
public function convert_pagination_type( $view_data ) {
|
1306 |
if ( isset( $view_data['pagination_type'] ) ) {
|
1307 |
$view_data['pagination_settings']['type'] = $view_data['pagination_type'];
|
1308 |
unset( $view_data['pagination_type'] );
|
@@ -1326,7 +1262,7 @@ class Strong_Testimonials_Updater {
|
|
1326 |
*
|
1327 |
* @since 2.10.0
|
1328 |
*/
|
1329 |
-
public function get_average_word_length() {
|
1330 |
$args = array(
|
1331 |
'posts_per_page' => - 1,
|
1332 |
'post_type' => 'wpm-testimonial',
|
@@ -1353,3 +1289,5 @@ class Strong_Testimonials_Updater {
|
|
1353 |
}
|
1354 |
|
1355 |
}
|
|
|
|
12 |
*
|
13 |
* @var string
|
14 |
*/
|
15 |
+
private static $old_version;
|
16 |
|
17 |
/**
|
18 |
* Log steps during update process.
|
19 |
*
|
20 |
* @var array
|
21 |
*/
|
22 |
+
private static $new_log;
|
23 |
|
24 |
/**
|
25 |
* Strong_Testimonials_Updater constructor.
|
26 |
*/
|
27 |
public function __construct() {
|
28 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/**
|
35 |
* @param string $entry
|
36 |
* @param string $var
|
37 |
*/
|
38 |
+
private static function log( $name, $entry = '', $var = '' ) {
|
39 |
if ( $name ) {
|
40 |
$x = $name;
|
41 |
if ( $entry ) {
|
44 |
$x .= ' = ';
|
45 |
if ( is_array( $var ) || is_object( $var ) ) {
|
46 |
// log the text
|
47 |
+
self::$new_log[] = $x;
|
48 |
// then log the variable
|
49 |
+
self::$new_log[] = $var;
|
50 |
}
|
51 |
else {
|
52 |
+
self::$new_log[] = $x . $var;
|
53 |
}
|
54 |
}
|
55 |
else {
|
56 |
+
self::$new_log[] = $x;
|
57 |
}
|
58 |
}
|
59 |
else {
|
60 |
+
self::$new_log[] = $x;
|
61 |
}
|
62 |
}
|
63 |
}
|
76 |
* disabled (0) to enabled (1) in order for the property to
|
77 |
* be displayed in the form editor.
|
78 |
*/
|
79 |
+
public static function update() {
|
80 |
if ( get_transient( 'wpmtst_update_in_progress' ) ) {
|
81 |
return;
|
82 |
}
|
88 |
*
|
89 |
* @since 2.27.1
|
90 |
*/
|
91 |
+
self::add_caps();
|
92 |
|
93 |
/**
|
94 |
* Check DB version.
|
95 |
*/
|
96 |
+
self::update_db_check();
|
97 |
|
98 |
/**
|
99 |
* Let's start updating.
|
103 |
/**
|
104 |
* Options.
|
105 |
*/
|
106 |
+
update_option( 'wpmtst_options', self::update_options() );
|
107 |
|
108 |
/**
|
109 |
* Custom fields.
|
110 |
*/
|
111 |
+
update_option( 'wpmtst_fields', self::update_fields() );
|
112 |
|
113 |
/**
|
114 |
* Forms.
|
115 |
*/
|
116 |
+
update_option( 'wpmtst_base_forms', self::update_base_forms() );
|
117 |
+
update_option( 'wpmtst_custom_forms', self::update_custom_forms() );
|
118 |
+
update_option( 'wpmtst_form_options', self::update_form_options() );
|
119 |
|
120 |
/**
|
121 |
* Compatibility options.
|
122 |
*
|
123 |
* @since 2.28.0
|
124 |
*/
|
125 |
+
update_option( 'wpmtst_compat_options', self::update_compat_options() );
|
126 |
|
127 |
/**
|
128 |
* Overwrite default view options.
|
129 |
*
|
130 |
* @since 2.15.0
|
131 |
*/
|
132 |
+
update_option( 'wpmtst_view_options', self::update_view_options() );
|
133 |
|
134 |
/**
|
135 |
* Overwrite default view settings.
|
136 |
*
|
137 |
* @since 2.15.0
|
138 |
*/
|
139 |
+
update_option( 'wpmtst_view_default', self::update_default_view() );
|
140 |
|
141 |
/**
|
142 |
* Update views.
|
143 |
*/
|
144 |
+
self::update_views();
|
145 |
|
146 |
/**
|
147 |
* Convert nofollow
|
148 |
*/
|
149 |
if ( ! isset( $history['2.23.0_convert_nofollow'] ) ) {
|
150 |
+
self::convert_nofollow();
|
151 |
+
self::update_history_log( '2.23.0_convert_nofollow' );
|
152 |
}
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
/**
|
156 |
* Legacy stuff.
|
165 |
// Remove older attempts at admin notices.
|
166 |
delete_option( 'wpmtst_news_flag' );
|
167 |
|
168 |
+
self::update_history_log( '2.28_new_update_process' );
|
169 |
}
|
170 |
|
171 |
/**
|
172 |
* Fix add-ons.
|
173 |
*/
|
174 |
+
self::update_addons();
|
175 |
|
176 |
/**
|
177 |
* Update the plugin version.
|
181 |
/**
|
182 |
* Update log.
|
183 |
*/
|
184 |
+
self::update_log();
|
185 |
|
186 |
/**
|
187 |
* Update admin notices.
|
188 |
*/
|
189 |
+
self::update_admin_notices();
|
190 |
|
191 |
delete_transient( 'wpmtst_update_in_progress' );
|
192 |
}
|
196 |
*
|
197 |
* @since 2.30.9
|
198 |
*/
|
199 |
+
public static function update_addons() {
|
200 |
$addons = get_option( 'wpmtst_addons' );
|
201 |
if ( $addons ) {
|
202 |
foreach ( $addons as $addon => $data ) {
|
211 |
/**
|
212 |
* Update the log in options table.
|
213 |
*/
|
214 |
+
public static function update_log() {
|
215 |
$log = get_option( 'wpmtst_update_log', array() );
|
216 |
+
$log[ current_time( 'mysql' ) ] = self::$new_log;
|
217 |
update_option( 'wpmtst_update_log', $log );
|
218 |
}
|
219 |
|
220 |
+
public static function update_admin_notices() {
|
221 |
wpmtst_add_admin_notice( 'feedback-notice', true );
|
222 |
wpmtst_add_admin_notice( 'upsell-notice', true );
|
223 |
}
|
229 |
*
|
230 |
* @return bool|null|WP_Role
|
231 |
*/
|
232 |
+
public static function get_admins() {
|
233 |
return get_role( 'administrator' );
|
234 |
}
|
235 |
|
238 |
*
|
239 |
* @since 2.27.1
|
240 |
*/
|
241 |
+
public static function add_caps() {
|
242 |
+
$admins = self::get_admins();
|
243 |
if ( $admins ) {
|
244 |
$admins->add_cap( 'strong_testimonials_views' );
|
245 |
$admins->add_cap( 'strong_testimonials_fields' );
|
247 |
$admins->add_cap( 'strong_testimonials_about' );
|
248 |
}
|
249 |
else {
|
250 |
+
self::log( __FUNCTION__, 'failed' );
|
251 |
}
|
252 |
}
|
253 |
|
260 |
*
|
261 |
* @since 2.27.1
|
262 |
*/
|
263 |
+
public static function remove_caps() {
|
264 |
+
if ( $admins = self::get_admins() ) {
|
265 |
$admins->remove_cap( 'strong_testimonials_views' );
|
266 |
$admins->remove_cap( 'strong_testimonials_fields' );
|
267 |
$admins->remove_cap( 'strong_testimonials_options' );
|
274 |
*
|
275 |
* @since 1.21.0 Checking for new table version.
|
276 |
*/
|
277 |
+
public static function update_db_check() {
|
278 |
if ( get_option( 'wpmtst_db_version' ) != WPMST()->get_db_version() ) {
|
279 |
wpmtst_update_tables();
|
280 |
+
self::log( __FUNCTION__, 'tables updated' );
|
281 |
}
|
282 |
}
|
283 |
|
286 |
*
|
287 |
* @param $event
|
288 |
*/
|
289 |
+
public static function update_history_log( $event ) {
|
290 |
$history = get_option( 'wpmtst_history', array() );
|
291 |
$history[ $event ] = current_time( 'mysql' );
|
292 |
update_option( 'wpmtst_history', $history );
|
297 |
*
|
298 |
* @return array
|
299 |
*/
|
300 |
+
public static function update_options() {
|
301 |
$options = get_option( 'wpmtst_options' );
|
302 |
if ( ! $options ) {
|
303 |
return Strong_Testimonials_Defaults::get_options();
|
306 |
/**
|
307 |
* Remove version 1 options
|
308 |
*/
|
309 |
+
if ( version_compare( '2.0', self::$old_version ) ) {
|
310 |
|
311 |
if ( isset( $options['captcha'] ) ) {
|
312 |
unset( $options['captcha'] );
|
391 |
*
|
392 |
* @return array
|
393 |
*/
|
394 |
+
public static function update_fields() {
|
395 |
return Strong_Testimonials_Defaults::get_fields();
|
396 |
}
|
397 |
|
400 |
*
|
401 |
* @return array
|
402 |
*/
|
403 |
+
public static function update_base_forms() {
|
404 |
return Strong_Testimonials_Defaults::get_base_forms();
|
405 |
}
|
406 |
|
409 |
*
|
410 |
* @return array
|
411 |
*/
|
412 |
+
public static function update_custom_forms() {
|
413 |
$custom_forms = get_option( 'wpmtst_custom_forms' );
|
414 |
if ( ! $custom_forms ) {
|
415 |
return Strong_Testimonials_Defaults::get_custom_forms();
|
483 |
*
|
484 |
* @return array
|
485 |
*/
|
486 |
+
public static function update_form_options() {
|
487 |
$form_options = get_option( 'wpmtst_form_options' );
|
488 |
if ( ! $form_options ) {
|
489 |
return Strong_Testimonials_Defaults::get_form_options();
|
502 |
$form_options['admin_email'] = $options['admin_email'];
|
503 |
unset( $options['admin_email'] );
|
504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
update_option( 'wpmtst_options', $options );
|
506 |
}
|
507 |
|
534 |
$form_options['messages']['required-field']['enabled'] = 1;
|
535 |
}
|
536 |
|
537 |
+
/**
|
538 |
+
* Delete form options
|
539 |
+
*
|
540 |
+
* @since 2.38
|
541 |
+
*/
|
542 |
+
unset( $form_options['captcha'] );
|
543 |
+
unset( $form_options['messages']['captcha'] );
|
544 |
+
|
545 |
+
|
546 |
/**
|
547 |
* Merge in new options.
|
548 |
*/
|
553 |
// Merge nested arrays individually. Don't use array_merge_recursive.
|
554 |
|
555 |
$form_options['default_recipient'] = array_merge( $defaults['default_recipient'], $form_options['default_recipient'] );
|
556 |
+
foreach ( $defaults['messages'] as $key => $message ) {
|
557 |
+
if( isset( $form_options['messages'][ $key ] ) ) {
|
558 |
+
$form_options['messages'][ $key ] = array_merge( $message, $form_options['messages'][ $key ] );
|
559 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
}
|
561 |
|
562 |
if ( ! isset( $history['2.29_captcha_options_changed'] ) ) {
|
563 |
+
self::update_history_log( '2.29_captcha_options_changed' );
|
564 |
if ( $notice ) {
|
565 |
wpmtst_add_admin_notice( 'captcha-options-changed', true );
|
566 |
}
|
576 |
*
|
577 |
* @return array
|
578 |
*/
|
579 |
+
public static function update_compat_options() {
|
580 |
$options = get_option( 'wpmtst_compat_options' );
|
581 |
if ( ! $options ) {
|
582 |
return Strong_Testimonials_Defaults::get_compat_options();
|
626 |
*
|
627 |
* @return array
|
628 |
*/
|
629 |
+
public static function update_view_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
return Strong_Testimonials_Defaults::get_view_options();
|
631 |
}
|
632 |
|
635 |
*
|
636 |
* @return array
|
637 |
*/
|
638 |
+
public static function update_default_view() {
|
639 |
return apply_filters( 'wpmtst_view_default', Strong_Testimonials_Defaults::get_default_view() );
|
640 |
}
|
641 |
|
644 |
*
|
645 |
* @uses wpmtst_save_view
|
646 |
*/
|
647 |
+
public static function update_views() {
|
648 |
$views = wpmtst_get_views();
|
649 |
|
650 |
if ( ! $views ) {
|
658 |
|
659 |
$view_data = unserialize( $view['value'] );
|
660 |
if ( ! is_array( $view_data ) ) {
|
661 |
+
self::log( __FUNCTION__, 'view ' . $view['id'] . ' data is not an array' );
|
662 |
continue;
|
663 |
}
|
664 |
|
673 |
*/
|
674 |
unset( $view_data['compat'] );
|
675 |
|
676 |
+
$view_data = self::convert_template_name( $view_data );
|
677 |
+
$view_data = self::convert_background_color( $view_data );
|
678 |
+
$view_data = self::convert_form_ajax( $view_data );
|
679 |
+
$view_data = self::convert_layout( $view_data );
|
680 |
+
$view_data = self::convert_word_count( $view_data );
|
681 |
+
$view_data = self::convert_excerpt_length( $view_data );
|
682 |
+
$view_data = self::convert_more_text( $view_data );
|
683 |
+
$view_data = self::convert_modern_title( $view_data );
|
684 |
+
$view_data = self::convert_slideshow( $view_data );
|
685 |
+
$view_data = self::convert_title_link( $view_data );
|
686 |
+
$view_data = self::convert_pagination_type( $view_data );
|
687 |
}
|
688 |
|
689 |
/**
|
690 |
* For version 2.30.
|
691 |
*/
|
692 |
if ( ! isset( $history['2.30_new_template_structure'] ) ) {
|
693 |
+
$view_data = self::convert_template_structure( $view_data );
|
694 |
+
$view_data = self::convert_count( $view_data );
|
695 |
if ( isset( $view_data['background']['example-font-color'] ) ) {
|
696 |
unset( $view_data['background']['example-font-color'] );
|
697 |
}
|
698 |
|
699 |
+
self::update_history_log( '2.30_new_template_structure' );
|
700 |
}
|
701 |
|
702 |
/**
|
705 |
* @since 2.32.2
|
706 |
*/
|
707 |
if ( ! isset( $history['2.32.2_carousel_breakpoints'] ) ) {
|
708 |
+
$view['data'] = self::add_carousel_breakpoints( $view_data );
|
709 |
+
self::update_history_log( '2.32.2_carousel_breakpoints' );
|
710 |
}
|
711 |
|
712 |
/**
|
768 |
*
|
769 |
* @return array
|
770 |
*/
|
771 |
+
public static function add_carousel_breakpoints( $view_data ) {
|
772 |
if ( ! isset( $view_data['slideshow_settings']['max_slides'] ) ) {
|
773 |
return $view_data;
|
774 |
}
|
816 |
*
|
817 |
* @return array
|
818 |
*/
|
819 |
+
public static function convert_template_structure( $view_data ) {
|
820 |
/*
|
821 |
Array
|
822 |
(
|
898 |
*
|
899 |
* @return array
|
900 |
*/
|
901 |
+
public static function convert_template_name( $view_data ) {
|
902 |
// Change default template from empty to 'default:{type}'
|
903 |
if ( ! $view_data['template'] ) {
|
904 |
if ( 'form' == $view_data['mode'] ) {
|
935 |
*
|
936 |
* @return array
|
937 |
*/
|
938 |
+
public static function convert_excerpt_length( $view_data ) {
|
939 |
if ( ! isset( $view_data['excerpt_length'] ) || ! $view_data['excerpt_length'] ) {
|
940 |
$default_view = Strong_Testimonials_Defaults::get_default_view();
|
941 |
+
$average_word_length = self::get_average_word_length();
|
942 |
|
943 |
if ( isset( $view_data['length'] ) && $view_data['length'] ) {
|
944 |
$word_count = round( $view_data['length'] / $average_word_length );
|
965 |
*
|
966 |
* @return array
|
967 |
*/
|
968 |
+
public static function convert_more_text( $view_data ) {
|
969 |
if ( isset( $view_data['more_text'] ) ) {
|
970 |
if ( isset( $view_data['more_page'] ) && $view_data['more_page'] > 1 ) {
|
971 |
// convert more_page to toggle and move page id to more_page_id
|
991 |
*
|
992 |
* @return array
|
993 |
*/
|
994 |
+
public static function convert_slideshow( $view_data ) {
|
995 |
if ( isset( $view_data['slideshow_settings'] ) ) {
|
996 |
return $view_data;
|
997 |
}
|
1064 |
*
|
1065 |
* @return array
|
1066 |
*/
|
1067 |
+
public static function convert_count( $view_data ) {
|
1068 |
if ( isset( $view_data['all'] ) ) {
|
1069 |
if ( $view_data['all'] ) {
|
1070 |
$view_data['count'] = -1;
|
1082 |
*
|
1083 |
* @return array
|
1084 |
*/
|
1085 |
+
public static function convert_background_color( $view_data ) {
|
1086 |
if ( ! is_array( $view_data['background'] ) ) {
|
1087 |
$view_data['background'] = array(
|
1088 |
'color' => $view_data['background'],
|
1100 |
*
|
1101 |
* @return array
|
1102 |
*/
|
1103 |
+
public static function convert_form_ajax( $view_data ) {
|
1104 |
if ( isset( $view_data['form-ajax'] ) ) {
|
1105 |
$view_data['form_ajax'] = $view_data['form-ajax'];
|
1106 |
unset( $view_data['form-ajax'] );
|
1116 |
*
|
1117 |
* @return array
|
1118 |
*/
|
1119 |
+
public static function convert_layout( $view_data ) {
|
1120 |
if ( isset( $view_data['pagination'] ) && $view_data['pagination'] ) {
|
1121 |
if ( isset( $view_data['layout'] ) && 'masonry' == $view_data['layout'] ) {
|
1122 |
$view_data['layout'] = '';
|
1135 |
*
|
1136 |
* @return array
|
1137 |
*/
|
1138 |
+
public static function convert_word_count( $view_data ) {
|
1139 |
if ( isset( $view_data['word_count'] ) ) {
|
1140 |
$view_data['excerpt_length'] = $view_data['word_count'];
|
1141 |
unset( $view_data['word_count'] );
|
1152 |
*
|
1153 |
* @return array
|
1154 |
*/
|
1155 |
+
public static function convert_modern_title( $view_data ) {
|
1156 |
if ( 'modern:content' == $view_data['template'] ) {
|
1157 |
if ( ! isset( $history['2.12.4_convert_modern_template'] ) ) {
|
1158 |
$view_data['title'] = 0;
|
1159 |
+
self::update_history_log( '2.12.4_convert_modern_template' );
|
1160 |
}
|
1161 |
}
|
1162 |
|
1172 |
*
|
1173 |
* @return array
|
1174 |
*/
|
1175 |
+
public static function convert_title_link( $view_data ) {
|
1176 |
if ( ! isset( $view_data['title_link'] ) ) {
|
1177 |
$view_data['title_link'] = 0;
|
1178 |
}
|
1185 |
*
|
1186 |
* @since 2.23.0
|
1187 |
*/
|
1188 |
+
public static function convert_nofollow() {
|
1189 |
$args = array(
|
1190 |
'posts_per_page' => - 1,
|
1191 |
'post_type' => 'wpm-testimonial',
|
1238 |
*
|
1239 |
* @return mixed
|
1240 |
*/
|
1241 |
+
public static function convert_pagination_type( $view_data ) {
|
1242 |
if ( isset( $view_data['pagination_type'] ) ) {
|
1243 |
$view_data['pagination_settings']['type'] = $view_data['pagination_type'];
|
1244 |
unset( $view_data['pagination_type'] );
|
1262 |
*
|
1263 |
* @since 2.10.0
|
1264 |
*/
|
1265 |
+
public static function get_average_word_length() {
|
1266 |
$args = array(
|
1267 |
'posts_per_page' => - 1,
|
1268 |
'post_type' => 'wpm-testimonial',
|
1289 |
}
|
1290 |
|
1291 |
}
|
1292 |
+
|
1293 |
+
new Strong_Testimonials_Updater();
|
admin/class-strong-testimonials-upsell.php
CHANGED
@@ -12,6 +12,8 @@ class Strong_Testimonials_Upsell {
|
|
12 |
add_action( 'wpmtst_before_fields_settings', array( $this, 'add_upsells_2' ) );
|
13 |
add_action( 'wpmtst_view_editor_after_groups', array( $this, 'add_upsells_3' ) );
|
14 |
add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'add_upsells_4' ) );
|
|
|
|
|
15 |
}
|
16 |
|
17 |
public function add_general_upsell_notice() {
|
@@ -69,7 +71,10 @@ class Strong_Testimonials_Upsell {
|
|
69 |
)
|
70 |
);
|
71 |
?>
|
72 |
-
<
|
|
|
|
|
|
|
73 |
</div>
|
74 |
<?php
|
75 |
endif;
|
@@ -89,7 +94,10 @@ class Strong_Testimonials_Upsell {
|
|
89 |
)
|
90 |
);
|
91 |
?>
|
92 |
-
<
|
|
|
|
|
|
|
93 |
</div>
|
94 |
<?php
|
95 |
endif;
|
@@ -109,7 +117,10 @@ class Strong_Testimonials_Upsell {
|
|
109 |
)
|
110 |
);
|
111 |
?>
|
112 |
-
<
|
|
|
|
|
|
|
113 |
</div>
|
114 |
<?php
|
115 |
endif;
|
@@ -129,7 +140,10 @@ class Strong_Testimonials_Upsell {
|
|
129 |
)
|
130 |
);
|
131 |
?>
|
132 |
-
<
|
|
|
|
|
|
|
133 |
</div>
|
134 |
<?php
|
135 |
endif;
|
@@ -149,12 +163,97 @@ class Strong_Testimonials_Upsell {
|
|
149 |
)
|
150 |
);
|
151 |
?>
|
152 |
-
<
|
|
|
|
|
|
|
153 |
</div>
|
154 |
<?php
|
155 |
endif;
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
|
160 |
}
|
12 |
add_action( 'wpmtst_before_fields_settings', array( $this, 'add_upsells_2' ) );
|
13 |
add_action( 'wpmtst_view_editor_after_groups', array( $this, 'add_upsells_3' ) );
|
14 |
add_action( 'wpmtst_view_editor_after_group_select', array( $this, 'add_upsells_4' ) );
|
15 |
+
add_action( 'wpmtst_fields_before_fields_editor_preview', array( $this, 'add_upsells_5' ) );
|
16 |
+
add_action( 'wpmtst_after_form_settings', array( $this, 'add_upsells_6' ) );
|
17 |
}
|
18 |
|
19 |
public function add_general_upsell_notice() {
|
71 |
)
|
72 |
);
|
73 |
?>
|
74 |
+
<p>
|
75 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/country-selector?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
76 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-country-selector-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
77 |
+
</p>
|
78 |
</div>
|
79 |
<?php
|
80 |
endif;
|
94 |
)
|
95 |
);
|
96 |
?>
|
97 |
+
<p>
|
98 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/custom-fields?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
99 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-custom-fields-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
100 |
+
</p>
|
101 |
</div>
|
102 |
<?php
|
103 |
endif;
|
117 |
)
|
118 |
);
|
119 |
?>
|
120 |
+
<p>
|
121 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/multiple-forms?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
122 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=fields-multiple-forms-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
123 |
+
</p>
|
124 |
</div>
|
125 |
<?php
|
126 |
endif;
|
140 |
)
|
141 |
);
|
142 |
?>
|
143 |
+
<p>
|
144 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/review-markup?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
145 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-review-markup-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
146 |
+
</p>
|
147 |
</div>
|
148 |
<?php
|
149 |
endif;
|
163 |
)
|
164 |
);
|
165 |
?>
|
166 |
+
<p>
|
167 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/advanced-views?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
168 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=views-advanced-views-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
169 |
+
</p>
|
170 |
</div>
|
171 |
<?php
|
172 |
endif;
|
173 |
}
|
174 |
|
175 |
+
public function add_upsells_5() {
|
176 |
+
if ( ! defined( 'WPMTST_CAPTCHA_VERSION' ) ) :
|
177 |
+
?>
|
178 |
+
<div class="wpmtst-alert">
|
179 |
+
<?php
|
180 |
+
printf(
|
181 |
+
esc_html__( 'Protect your form against spam with the %s extension.', 'strong-testimonials' ),
|
182 |
+
sprintf(
|
183 |
+
'<a href="%s" target="_blank">%s</a>',
|
184 |
+
esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
|
185 |
+
esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
|
186 |
+
)
|
187 |
+
);
|
188 |
+
?>
|
189 |
+
<p>
|
190 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
191 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
192 |
+
</p>
|
193 |
+
</div>
|
194 |
+
<?php
|
195 |
+
endif;
|
196 |
+
}
|
197 |
+
|
198 |
+
public function add_upsells_6() {
|
199 |
+
if ( defined( 'WPMTST_CAPTCHA_VERSION' ) ) {
|
200 |
+
return;
|
201 |
+
}
|
202 |
+
?>
|
203 |
+
<hr>
|
204 |
+
|
205 |
+
<h3><?php esc_html_e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
|
206 |
+
|
207 |
+
<div class="wpmtst-alert">
|
208 |
+
<?php
|
209 |
+
printf(
|
210 |
+
esc_html__( 'Protect your form against spam. Add Google recaptcha or honeypots with the %s extension.', 'strong-testimonials' ),
|
211 |
+
sprintf(
|
212 |
+
'<a href="%s" target="_blank">%s</a>',
|
213 |
+
esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ),
|
214 |
+
esc_html__( 'Strong Testimonials: Captcha', 'strong-testimonials' )
|
215 |
+
)
|
216 |
+
);
|
217 |
+
?>
|
218 |
+
<p>
|
219 |
+
<a class="button" target="_blank" href="<?php echo esc_url( WPMTST_STORE_URL . '/extensions/captcha?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-upsell' ); ?>"><?php esc_html_e( 'Learn More', 'strong-testimonials' ); ?></a>
|
220 |
+
<a class="button button-primary" target="_blank" href="<?php echo esc_url( WPMTST_STORE_UPGRADE_URL . '?utm_source=st-lite&utm_campaign=upsell&utm_medium=form-settings-captcha-upsell' ); ?>"><?php esc_html_e( 'Upgrade', 'strong-testimonials' ); ?></a>
|
221 |
+
</p>
|
222 |
+
</div>
|
223 |
+
|
224 |
+
<table class="form-table" cellpadding="0" cellspacing="0">
|
225 |
+
<tr>
|
226 |
+
<th scope="row">
|
227 |
+
<label>
|
228 |
+
<?php esc_html_e( 'Honeypot', 'strong-testimonials' ); ?>
|
229 |
+
</label>
|
230 |
+
</th>
|
231 |
+
<td>
|
232 |
+
<p>
|
233 |
+
<?php esc_html_e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
|
234 |
+
</p>
|
235 |
+
</td>
|
236 |
+
</tr>
|
237 |
+
<tr valign="top">
|
238 |
+
<th scope="row">
|
239 |
+
<label>
|
240 |
+
<a name="captcha-section"></a><?php esc_html_e( 'Captcha', 'strong-testimonials' ); ?>
|
241 |
+
</label>
|
242 |
+
</th>
|
243 |
+
<td>
|
244 |
+
<?php esc_html_e( 'Google reCAPTCHA prompts visitors to check a box to prove that they’re not a robot before they submit the form.', 'strong-testimonials' ); ?>
|
245 |
+
<br/>
|
246 |
+
<?php esc_html_e( 'In some cases, they’re prompted to complete another task, like identify a string of letters.', 'strong-testimonials' ); ?>
|
247 |
+
<br/>
|
248 |
+
<?php esc_html_e( 'This method makes it difficult for spambots to complete form submissions.', 'strong-testimonials' ); ?>
|
249 |
+
</td>
|
250 |
+
</tr>
|
251 |
+
</table>
|
252 |
+
<?php
|
253 |
+
}
|
254 |
+
|
255 |
+
|
256 |
+
|
257 |
|
258 |
|
259 |
}
|
admin/custom-fields.php
CHANGED
@@ -205,6 +205,7 @@ function wpmtst_settings_custom_fields( $form_id = 1 ) {
|
|
205 |
<h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
|
206 |
<p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
|
207 |
</div>
|
|
|
208 |
<div id="fields-editor-preview">
|
209 |
<div><!-- placeholder --></div>
|
210 |
</div>
|
205 |
<h3><?php esc_html_e( 'Basic Preview', 'strong-testimonials' ); ?></h3>
|
206 |
<p><?php esc_html_e( 'Only to demonstrate the fields. May look different in your theme.', 'strong-testimonials' ); ?></p>
|
207 |
</div>
|
208 |
+
<?php do_action( 'wpmtst_fields_before_fields_editor_preview' ); ?>
|
209 |
<div id="fields-editor-preview">
|
210 |
<div><!-- placeholder --></div>
|
211 |
</div>
|
admin/settings/class-strong-testimonials-settings-form.php
CHANGED
@@ -137,10 +137,6 @@ class Strong_Testimonials_Settings_Form {
|
|
137 |
$input['email_subject'] = isset( $input['email_subject'] ) ? wp_kses_post( trim( $input['email_subject'] ) ) : '';
|
138 |
$input['email_message'] = isset( $input['email_message'] ) ? wp_kses_post( rtrim( $input['email_message'] ) ) : '';
|
139 |
|
140 |
-
$input['honeypot_before'] = wpmtst_sanitize_checkbox( $input, 'honeypot_before' );
|
141 |
-
$input['honeypot_after'] = wpmtst_sanitize_checkbox( $input, 'honeypot_after' );
|
142 |
-
$input['captcha'] = sanitize_text_field( $input['captcha'] );
|
143 |
-
|
144 |
foreach ( $input['messages'] as $key => $message ) {
|
145 |
if ( 'submission-success' == $key ) {
|
146 |
$input['messages'][ $key ]['text'] = $message['text'];
|
@@ -198,7 +194,7 @@ class Strong_Testimonials_Settings_Form {
|
|
198 |
unset( $input['success_redirect_2'] );
|
199 |
//ksort( $input );
|
200 |
|
201 |
-
return $input;
|
202 |
}
|
203 |
|
204 |
/**
|
137 |
$input['email_subject'] = isset( $input['email_subject'] ) ? wp_kses_post( trim( $input['email_subject'] ) ) : '';
|
138 |
$input['email_message'] = isset( $input['email_message'] ) ? wp_kses_post( rtrim( $input['email_message'] ) ) : '';
|
139 |
|
|
|
|
|
|
|
|
|
140 |
foreach ( $input['messages'] as $key => $message ) {
|
141 |
if ( 'submission-success' == $key ) {
|
142 |
$input['messages'][ $key ]['text'] = $message['text'];
|
194 |
unset( $input['success_redirect_2'] );
|
195 |
//ksort( $input );
|
196 |
|
197 |
+
return apply_filters( 'wpmtst_sanitize_form_options', $input );
|
198 |
}
|
199 |
|
200 |
/**
|
admin/settings/partials/form.php
CHANGED
@@ -6,34 +6,7 @@
|
|
6 |
*/
|
7 |
$pages_list = wpmtst_get_pages();
|
8 |
$form_options = get_option( 'wpmtst_form_options' );
|
9 |
-
$plugins = apply_filters( 'wpmtst_captcha_plugins', get_option( 'wpmtst_captcha_plugins', array() ) );
|
10 |
|
11 |
-
/**
|
12 |
-
* If integration with selected Captcha plugin has been removed, disable Captcha.
|
13 |
-
*/
|
14 |
-
if ( ! is_array( $plugins ) || ! in_array( $form_options['captcha'], array_keys( $plugins ) ) ) {
|
15 |
-
$form_options['captcha'] = '';
|
16 |
-
update_option( 'wpmtst_form_options', $form_options );
|
17 |
-
}
|
18 |
-
|
19 |
-
foreach ( $plugins as $key => $plugin ) {
|
20 |
-
|
21 |
-
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin['file'] ) ) {
|
22 |
-
$plugins[ $key ]['installed'] = true;
|
23 |
-
}
|
24 |
-
|
25 |
-
$plugins[ $key ]['active'] = is_plugin_active( $plugin['file'] );
|
26 |
-
|
27 |
-
/**
|
28 |
-
* If current Captcha plugin has been deactivated, disable Captcha
|
29 |
-
* so corresponding div does not appear on front-end form.
|
30 |
-
*/
|
31 |
-
if ( $key == $form_options['captcha'] && ! $plugins[ $key ]['active'] ) {
|
32 |
-
$form_options['captcha'] = '';
|
33 |
-
update_option( 'wpmtst_form_options', $form_options );
|
34 |
-
}
|
35 |
-
|
36 |
-
}
|
37 |
?>
|
38 |
<input type="hidden"
|
39 |
name="wpmtst_form_options[default_recipient]"
|
@@ -255,122 +228,4 @@ foreach ( $plugins as $key => $plugin ) {
|
|
255 |
</tr>
|
256 |
</table>
|
257 |
|
258 |
-
<?php
|
259 |
-
/**
|
260 |
-
* ========================================
|
261 |
-
* Spam Control
|
262 |
-
* ========================================
|
263 |
-
*/
|
264 |
-
?>
|
265 |
-
<hr>
|
266 |
-
<h3><?php _e( 'Form Spam Control', 'strong-testimonials' ); ?></h3>
|
267 |
-
|
268 |
-
<table class="form-table" cellpadding="0" cellspacing="0">
|
269 |
-
<tr>
|
270 |
-
<th scope="row">
|
271 |
-
<label>
|
272 |
-
<?php _ex( 'Honeypot', 'spam control techniques', 'strong-testimonials' ); ?>
|
273 |
-
</label>
|
274 |
-
</th>
|
275 |
-
<td>
|
276 |
-
<p>
|
277 |
-
<?php _e( 'These methods for trapping spambots are both time-tested and widely used. May be used simultaneously for more protection.', 'strong-testimonials' ); ?>
|
278 |
-
</p>
|
279 |
-
<p>
|
280 |
-
<?php _e( 'However, honeypots may not be compatible with WP-SpamShield, Ajax page loading, caching or minification.', 'strong-testimonials' ); ?>
|
281 |
-
</p>
|
282 |
-
<p>
|
283 |
-
<?php _e( 'If your form is not working properly, try disabling these.', 'strong-testimonials' ); ?>
|
284 |
-
</p>
|
285 |
-
<?php // TODO Add link to article that explains Ajax page loading. ?>
|
286 |
-
<ul>
|
287 |
-
<li class="checkbox">
|
288 |
-
<label>
|
289 |
-
<input type="checkbox"
|
290 |
-
name="wpmtst_form_options[honeypot_before]" <?php checked( $form_options['honeypot_before'] ); ?>/>
|
291 |
-
<?php _e( 'Before', 'strong-testimonials' ); ?>
|
292 |
-
</label>
|
293 |
-
<p class="description"><?php _e( 'Adds a new empty field that is invisible to humans. Spambots tend to fill in every field they find in the form. Empty field = human. Not empty = spambot.', 'strong-testimonials' ); ?></p>
|
294 |
-
</li>
|
295 |
-
<li class="checkbox">
|
296 |
-
<label>
|
297 |
-
<input type="checkbox"
|
298 |
-
name="wpmtst_form_options[honeypot_after]" <?php checked( $form_options['honeypot_after'] ); ?>/>
|
299 |
-
<?php _e( 'After', 'strong-testimonials' ); ?>
|
300 |
-
</label>
|
301 |
-
<p class="description"><?php _e( 'Adds a new field as soon as the form is submitted. Spambots cannot run JavaScript so the new field never gets added. New field = human. Missing = spambot.', 'strong-testimonials' ); ?></p>
|
302 |
-
</li>
|
303 |
-
</ul>
|
304 |
-
</td>
|
305 |
-
</tr>
|
306 |
-
<tr valign="top">
|
307 |
-
<th scope="row">
|
308 |
-
<label>
|
309 |
-
<a name="captcha-section"></a><?php _e( 'Captcha', 'strong-testimonials' ); ?>
|
310 |
-
</label>
|
311 |
-
</th>
|
312 |
-
<td class="stackem">
|
313 |
-
<p>
|
314 |
-
<?php _e( 'Enable Captcha using one of these plugins. Be sure to configure any plugins first, if necessary.', 'strong-testimonials' ); ?>
|
315 |
-
<?php _e( 'May be used alongside honeypot methods.', 'strong-testimonials' ); ?>
|
316 |
-
</p>
|
317 |
-
<p>
|
318 |
-
<?php _e( 'May not be compatible with Ajax page loading.', 'strong-testimonials' ); ?>
|
319 |
-
</p>
|
320 |
-
<ul>
|
321 |
-
<li>
|
322 |
-
<label>
|
323 |
-
<input type="radio"
|
324 |
-
name="wpmtst_form_options[captcha]" <?php checked( '', $form_options['captcha'] ); ?>
|
325 |
-
value=""/> none
|
326 |
-
</label>
|
327 |
-
</li>
|
328 |
-
|
329 |
-
<?php foreach ( $plugins as $key => $plugin ) : ?>
|
330 |
-
<li>
|
331 |
-
<label class="inline <?php if ( ! $plugin['active'] ) echo 'disabled'; ?>">
|
332 |
-
<input type="radio"
|
333 |
-
name="wpmtst_form_options[captcha]" <?php disabled( ! $plugin['active'] ); ?><?php checked( $key, $form_options['captcha'] ); ?>
|
334 |
-
value="<?php echo $key; ?>"/>
|
335 |
-
<?php echo $plugin['name']; ?>
|
336 |
-
</label>
|
337 |
-
|
338 |
-
<?php if ( isset( $plugin['installed'] ) && $plugin['installed'] ) : // installed ?>
|
339 |
-
|
340 |
-
<?php if ( $plugin['active'] ) : // active ?>
|
341 |
-
|
342 |
-
<?php if ( isset( $plugin['settings'] ) && $plugin['settings'] ) : ?>
|
343 |
-
<span class="link"><a href="<?php echo $plugin['settings']; ?>"><?php _ex( 'settings', 'link', 'strong-testimonials' ); ?></a></span>
|
344 |
-
<?php else : ?>
|
345 |
-
<span class="notice"><?php _e( 'no settings', 'strong-testimonials' ); ?></span>
|
346 |
-
<?php endif; ?>
|
347 |
-
|
348 |
-
<?php else : // inactive ?>
|
349 |
-
|
350 |
-
<span class="notice disabled"><?php _ex( 'inactive', 'adjective', 'strong-testimonials' ); ?></span>
|
351 |
-
|
352 |
-
<?php endif; ?>
|
353 |
-
|
|
354 |
-
|
355 |
-
<?php else : // not installed ?>
|
356 |
-
|
357 |
-
<span class="notice disabled">(<?php _e( 'not installed', 'strong-testimonials' ); ?>)</span>
|
358 |
-
|
359 |
-
<?php if ( isset( $plugin['search'] ) && $plugin['search'] ) : ?>
|
360 |
-
<span class="link"><a href="<?php echo $plugin['search']; ?>"><?php _ex( 'install plugin', 'link', 'strong-testimonials' ); ?></a></span>
|
361 |
-
|
|
362 |
-
<?php endif; ?>
|
363 |
-
|
364 |
-
<?php endif; // whether installed ?>
|
365 |
-
|
366 |
-
<span class="link"><a href="<?php echo $plugin['url']; ?>" target="_blank"><?php _ex( 'plugin page', 'link', 'strong-testimonials' ); ?></a></span>
|
367 |
-
|
368 |
-
<?php if ( isset( $plugin['desc'] ) && $plugin['desc'] ) : ?>
|
369 |
-
<p class="description <?php if ( isset( $plugin['style'] ) ) echo $plugin['style']; ?>"><?php echo $plugin['desc']; ?></p>
|
370 |
-
<?php endif; ?>
|
371 |
-
</li>
|
372 |
-
<?php endforeach; ?>
|
373 |
-
</ul>
|
374 |
-
</td>
|
375 |
-
</tr>
|
376 |
-
</table>
|
6 |
*/
|
7 |
$pages_list = wpmtst_get_pages();
|
8 |
$form_options = get_option( 'wpmtst_form_options' );
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
?>
|
11 |
<input type="hidden"
|
12 |
name="wpmtst_form_options[default_recipient]"
|
228 |
</tr>
|
229 |
</table>
|
230 |
|
231 |
+
<?php do_action( 'wpmtst_after_form_settings', $form_options, 'wpmtst_form_options' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/admin.css
CHANGED
@@ -819,7 +819,7 @@ ul.standard {
|
|
819 |
background: #f4daa4;
|
820 |
border-radius: 5px;
|
821 |
color: #8d6e30;
|
822 |
-
padding: 1rem
|
823 |
position: relative;
|
824 |
}
|
825 |
|
@@ -828,4 +828,8 @@ ul.standard {
|
|
828 |
right: 0.5rem;
|
829 |
top: 50%;
|
830 |
transform: translateY(-50%) !important;
|
|
|
|
|
|
|
|
|
831 |
}
|
819 |
background: #f4daa4;
|
820 |
border-radius: 5px;
|
821 |
color: #8d6e30;
|
822 |
+
padding: 1rem;
|
823 |
position: relative;
|
824 |
}
|
825 |
|
828 |
right: 0.5rem;
|
829 |
top: 50%;
|
830 |
transform: translateY(-50%) !important;
|
831 |
+
}
|
832 |
+
|
833 |
+
.wpmtst-alert > *:last-child {
|
834 |
+
margin-bottom: 0px !important;
|
835 |
}
|
changelog.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
= 2.38.1 - May. 14, 2019 =
|
2 |
* fixed placeholder issue for standard input fields
|
3 |
* fixed slideshow height issue
|
1 |
+
= 2.39 - May. 24, 2019 =
|
2 |
+
* added compatibility with Strong Testimonials: Captcha extension
|
3 |
+
|
4 |
= 2.38.1 - May. 14, 2019 =
|
5 |
* fixed placeholder issue for standard input fields
|
6 |
* fixed slideshow height issue
|
includes/class-strong-form.php
CHANGED
@@ -6,23 +6,16 @@ class Strong_Testimonials_Form {
|
|
6 |
|
7 |
public $form_options;
|
8 |
|
9 |
-
public $plugins;
|
10 |
-
|
11 |
public $form_values;
|
12 |
|
13 |
public $form_errors;
|
14 |
|
15 |
-
public $captcha;
|
16 |
-
|
17 |
/**
|
18 |
* Strong_Testimonials_Form constructor.
|
19 |
*/
|
20 |
public function __construct() {
|
21 |
$this->form_options = get_option( 'wpmtst_form_options' );
|
22 |
-
$this->plugins = apply_filters( 'wpmtst_captcha_plugins', get_option( 'wpmtst_captcha_plugins' ) );
|
23 |
$this->add_actions();
|
24 |
-
$this->load_captcha();
|
25 |
-
$this->load_honeypots();
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -35,50 +28,6 @@ class Strong_Testimonials_Form {
|
|
35 |
add_action( 'wp_ajax_nopriv_wpmtst_form2', array( $this, 'process_form_ajax' ) );
|
36 |
}
|
37 |
|
38 |
-
/**
|
39 |
-
* Load Captcha class.
|
40 |
-
*/
|
41 |
-
public function load_captcha() {
|
42 |
-
if ( ! isset( $this->form_options['captcha'] ) || ! $this->form_options['captcha'] ) {
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
|
46 |
-
$slug = $this->form_options['captcha'];
|
47 |
-
if ( ! $slug || ! isset( $this->plugins[ $slug ]['class'] ) ) {
|
48 |
-
return;
|
49 |
-
}
|
50 |
-
|
51 |
-
require_once WPMTST_INC . 'integrations/class-integration-captcha.php';
|
52 |
-
|
53 |
-
$file_name = "class-integration-$slug.php";
|
54 |
-
$file_path = WPMTST_INC . 'integrations/' . $file_name;
|
55 |
-
$class_name = 'Strong_Testimonials_Integration_' . $this->plugins[ $slug ]['class'];
|
56 |
-
|
57 |
-
if ( file_exists( $file_path ) ) {
|
58 |
-
require_once $file_path;
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( class_exists( $class_name ) ) {
|
62 |
-
$this->captcha = new $class_name();
|
63 |
-
add_filter( 'wpmtst_add_captcha', array( $this->captcha, 'add_captcha' ), 20 );
|
64 |
-
add_filter( 'wpmtst_check_captcha', array( $this->captcha, 'check_captcha' ) );
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Load honeypots.
|
71 |
-
*/
|
72 |
-
public function load_honeypots() {
|
73 |
-
if ( isset( $this->form_options['honeypot_before'] ) && $this->form_options['honeypot_before'] ) {
|
74 |
-
add_action( 'honeypot_before_spam_testimonial', array( $this, 'honeypot_error' ) );
|
75 |
-
}
|
76 |
-
|
77 |
-
if ( isset( $this->form_options['honeypot_after'] ) && $this->form_options['honeypot_after'] ) {
|
78 |
-
add_action( 'honeypot_after_spam_testimonial', array( $this, 'honeypot_error' ) );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
/**
|
83 |
* Process a form.
|
84 |
* Moved to `init` hook for strong_testimonials_view() template function.
|
@@ -210,17 +159,7 @@ class Strong_Testimonials_Form {
|
|
210 |
$form_name = isset( $new_post['form_id'] ) ? $new_post['form_id'] : 'custom';
|
211 |
$fields = wpmtst_get_form_fields( $form_name );
|
212 |
|
213 |
-
|
214 |
-
$form_errors = apply_filters( 'wpmtst_check_captcha', $form_errors );
|
215 |
-
}
|
216 |
-
|
217 |
-
if ( $form_options['honeypot_before'] ) {
|
218 |
-
$this->honeypot_before();
|
219 |
-
}
|
220 |
-
|
221 |
-
if ( $form_options['honeypot_after'] ) {
|
222 |
-
$this->honeypot_after();
|
223 |
-
}
|
224 |
|
225 |
/**
|
226 |
* sanitize & validate
|
@@ -467,39 +406,6 @@ class Strong_Testimonials_Form {
|
|
467 |
return false;
|
468 |
}
|
469 |
|
470 |
-
/**
|
471 |
-
* Honeypot preprocessor
|
472 |
-
*/
|
473 |
-
public function honeypot_before() {
|
474 |
-
if ( isset( $_POST['wpmtst_if_visitor'] ) && ! empty( $_POST['wpmtst_if_visitor'] ) ) {
|
475 |
-
do_action( 'honeypot_before_spam_testimonial', $_POST );
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
/**
|
480 |
-
* Honeypot preprocessor
|
481 |
-
*/
|
482 |
-
public function honeypot_after() {
|
483 |
-
if ( ! isset ( $_POST['wpmtst_after'] ) ) {
|
484 |
-
do_action( 'honeypot_after_spam_testimonial', $_POST );
|
485 |
-
}
|
486 |
-
}
|
487 |
-
|
488 |
-
/**
|
489 |
-
* Honeypot error
|
490 |
-
*/
|
491 |
-
public function honeypot_error() {
|
492 |
-
$form_options = get_option( 'wpmtst_form_options' );
|
493 |
-
$messages = $form_options['messages'];
|
494 |
-
$part = 'submission-error';
|
495 |
-
if ( isset( $messages[ $part ]['text'] ) ) {
|
496 |
-
$message = apply_filters( 'wpmtst_form_message', $messages['submission-error']['text'], $messages[ $part ] );
|
497 |
-
} else {
|
498 |
-
$message = __( 'Unknown error.', 'strong-testimonials' );
|
499 |
-
}
|
500 |
-
wp_die( $message );
|
501 |
-
}
|
502 |
-
|
503 |
/**
|
504 |
* Restrict MIME types for security reasons.
|
505 |
*
|
6 |
|
7 |
public $form_options;
|
8 |
|
|
|
|
|
9 |
public $form_values;
|
10 |
|
11 |
public $form_errors;
|
12 |
|
|
|
|
|
13 |
/**
|
14 |
* Strong_Testimonials_Form constructor.
|
15 |
*/
|
16 |
public function __construct() {
|
17 |
$this->form_options = get_option( 'wpmtst_form_options' );
|
|
|
18 |
$this->add_actions();
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
28 |
add_action( 'wp_ajax_nopriv_wpmtst_form2', array( $this, 'process_form_ajax' ) );
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* Process a form.
|
33 |
* Moved to `init` hook for strong_testimonials_view() template function.
|
159 |
$form_name = isset( $new_post['form_id'] ) ? $new_post['form_id'] : 'custom';
|
160 |
$fields = wpmtst_get_form_fields( $form_name );
|
161 |
|
162 |
+
$form_errors = apply_filters( 'wpmtst_form_additional_checks', $form_errors );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
/**
|
165 |
* sanitize & validate
|
406 |
return false;
|
407 |
}
|
408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
/**
|
410 |
* Restrict MIME types for security reasons.
|
411 |
*
|
includes/class-strong-view-form.php
CHANGED
@@ -102,7 +102,6 @@ class Strong_View_Form extends Strong_View {
|
|
102 |
|
103 |
// If we cannot preprocess, add the inline style to the footer.
|
104 |
add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
|
105 |
-
add_action( 'wp_footer', array( $this, 'load_honeypots' ) );
|
106 |
|
107 |
$form_values = array( 'category' => $this->atts['category'] );
|
108 |
|
@@ -256,37 +255,6 @@ class Strong_View_Form extends Strong_View {
|
|
256 |
WPMST()->render->add_script( 'wpmtst-controller' );
|
257 |
}
|
258 |
|
259 |
-
/**
|
260 |
-
* Load honeypots.
|
261 |
-
*/
|
262 |
-
public function load_honeypots() {
|
263 |
-
$form_options = get_option( 'wpmtst_form_options' );
|
264 |
-
|
265 |
-
if ( $form_options['honeypot_before'] ) {
|
266 |
-
?>
|
267 |
-
<script type="text/javascript">
|
268 |
-
(function () { document.getElementById("wpmtst_if_visitor").value = '' })()
|
269 |
-
</script>
|
270 |
-
<?php
|
271 |
-
}
|
272 |
-
|
273 |
-
if ( $form_options['honeypot_after'] ) {
|
274 |
-
?>
|
275 |
-
<script type="text/javascript">
|
276 |
-
(function () {
|
277 |
-
var myForm = document.getElementById("wpmtst-submission-form")
|
278 |
-
myForm.addEventListener("submit", function(e){
|
279 |
-
var x = document.createElement("input")
|
280 |
-
x.type = "hidden"
|
281 |
-
x.name = "wpmtst_after"
|
282 |
-
x.value = 1
|
283 |
-
myForm.appendChild(x)
|
284 |
-
});
|
285 |
-
})()
|
286 |
-
</script>
|
287 |
-
<?php
|
288 |
-
}
|
289 |
-
}
|
290 |
|
291 |
}
|
292 |
|
102 |
|
103 |
// If we cannot preprocess, add the inline style to the footer.
|
104 |
add_action( 'wp_footer', array( $this, 'add_custom_style' ) );
|
|
|
105 |
|
106 |
$form_values = array( 'category' => $this->atts['category'] );
|
107 |
|
255 |
WPMST()->render->add_script( 'wpmtst-controller' );
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
}
|
260 |
|
includes/class-strong-view.php
CHANGED
@@ -171,7 +171,7 @@ class Strong_View {
|
|
171 |
}
|
172 |
|
173 |
if ( ! $this->get_att( 'use_default_more' ) ) {
|
174 |
-
add_filter( 'excerpt_more', array( $this, 'excerpt_more' ),
|
175 |
}
|
176 |
}
|
177 |
|
171 |
}
|
172 |
|
173 |
if ( ! $this->get_att( 'use_default_more' ) ) {
|
174 |
+
add_filter( 'excerpt_more', array( $this, 'excerpt_more' ), 99999 );
|
175 |
}
|
176 |
}
|
177 |
|
includes/functions-template-form.php
CHANGED
@@ -412,11 +412,7 @@ function wpmtst_form_field_meta_l10n( $field_meta, $field, $meta ) {
|
|
412 |
add_filter( 'wpmtst_form_field_meta', 'wpmtst_form_field_meta_l10n', 10, 3 );
|
413 |
add_filter( 'wpmtst_form_field_meta', 'do_shortcode' );
|
414 |
|
415 |
-
|
416 |
-
* Print honeypot after.
|
417 |
-
*
|
418 |
-
* @param $field
|
419 |
-
*/
|
420 |
function wpmtst_field_error( $field ) {
|
421 |
$errors = WPMST()->form->get_form_errors();
|
422 |
if ( isset( $errors[ $field['name'] ] ) ) {
|
@@ -424,110 +420,6 @@ function wpmtst_field_error( $field ) {
|
|
424 |
}
|
425 |
}
|
426 |
|
427 |
-
/**
|
428 |
-
* Print honeypot before.
|
429 |
-
*/
|
430 |
-
function wpmtst_form_honeypot_before() {
|
431 |
-
$form_options = get_option( 'wpmtst_form_options' );
|
432 |
-
if ( $form_options['honeypot_before'] ) {
|
433 |
-
?>
|
434 |
-
<style>#wpmtst-form .wpmtst_if_visitor * { display: none !important; visibility: hidden !important; }</style>
|
435 |
-
<span class="wpmtst_if_visitor"><label for="wpmtst_if_visitor">Visitor?</label><input id="wpmtst_if_visitor" type="text" name="wpmtst_if_visitor" size="40" tabindex="-1" autocomplete="off"></span>
|
436 |
-
<?php
|
437 |
-
}
|
438 |
-
}
|
439 |
-
add_action( 'wpmtst_form_after_fields', 'wpmtst_form_honeypot_before' );
|
440 |
-
|
441 |
-
/**
|
442 |
-
* Print form catpcha.
|
443 |
-
*/
|
444 |
-
function wpmtst_form_captcha() {
|
445 |
-
$form_options = get_option( 'wpmtst_form_options' );
|
446 |
-
if ( ! isset( $form_options['captcha'] ) || ! $form_options['captcha'] ) {
|
447 |
-
return;
|
448 |
-
}
|
449 |
-
|
450 |
-
// removed `really simple captcha` as of 2.37
|
451 |
-
if ( 'really-simple-captcha' === $form_options['captcha'] ) {
|
452 |
-
return;
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Only display Captcha label if properly configured.
|
457 |
-
*/
|
458 |
-
$captcha_html = apply_filters( 'wpmtst_add_captcha', $form_options['captcha'] );
|
459 |
-
if ( ! $captcha_html ) {
|
460 |
-
return;
|
461 |
-
}
|
462 |
-
|
463 |
-
$invisible = wpmtst_form_captcha_invisible();
|
464 |
-
$errors = WPMST()->form->get_form_errors();
|
465 |
-
|
466 |
-
/**
|
467 |
-
* To display or not to display.
|
468 |
-
*/
|
469 |
-
if ( $invisible && 'captcha-pro' == $form_options['captcha']) {
|
470 |
-
|
471 |
-
echo '<div class="form-field wpmtst-captcha">';
|
472 |
-
echo $captcha_html;
|
473 |
-
echo '</div>';
|
474 |
-
|
475 |
-
} elseif ( $invisible ) {
|
476 |
-
echo $captcha_html;
|
477 |
-
|
478 |
-
} else {
|
479 |
-
?>
|
480 |
-
<div class="form-field wpmtst-captcha">
|
481 |
-
<?php if ( wpmtst_get_form_message( 'captcha' ) ) : ?>
|
482 |
-
<label for="wpmtst_captcha"><?php wpmtst_form_message( 'captcha' ); ?></label><span class="required symbol"></span>
|
483 |
-
<?php endif; ?>
|
484 |
-
|
485 |
-
<div>
|
486 |
-
<?php echo $captcha_html; ?>
|
487 |
-
<?php if ( isset( $errors['captcha'] ) ) : ?>
|
488 |
-
<p><label class="error"><?php echo esc_html( $errors['captcha'] ); ?></label></p>
|
489 |
-
<?php endif; ?>
|
490 |
-
</div>
|
491 |
-
</div>
|
492 |
-
<?php
|
493 |
-
|
494 |
-
}
|
495 |
-
}
|
496 |
-
add_action( 'wpmtst_form_after_fields', 'wpmtst_form_captcha' );
|
497 |
-
|
498 |
-
/**
|
499 |
-
* Determine if we are using Invisible reCAPTCHA.
|
500 |
-
*
|
501 |
-
* @since 2.28.5
|
502 |
-
*
|
503 |
-
* @return bool
|
504 |
-
*/
|
505 |
-
function wpmtst_form_captcha_invisible() {
|
506 |
-
$invisible = false;
|
507 |
-
$form_options = get_option( 'wpmtst_form_options' );
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Google Captcha plugin integration.
|
511 |
-
*/
|
512 |
-
if ( 'google-captcha' == $form_options['captcha'] ) {
|
513 |
-
$gglcptch_options = get_option( 'gglcptch_options' );
|
514 |
-
if ( isset( $gglcptch_options['recaptcha_version'] ) && 'invisible' == $gglcptch_options['recaptcha_version'] ) {
|
515 |
-
$invisible = true;
|
516 |
-
}
|
517 |
-
}
|
518 |
-
|
519 |
-
/**
|
520 |
-
* Captcha Pro plugin integration.
|
521 |
-
*/
|
522 |
-
if ( 'captcha-pro' == $form_options['captcha'] ) {
|
523 |
-
$cptch_options = get_option( 'cptch_options' );
|
524 |
-
if ( isset( $cptch_options['type'] ) && 'invisible' == $cptch_options['type'] ) {
|
525 |
-
$invisible = true;
|
526 |
-
}
|
527 |
-
}
|
528 |
-
|
529 |
-
return $invisible;
|
530 |
-
}
|
531 |
|
532 |
/**
|
533 |
* Print the submit button.
|
412 |
add_filter( 'wpmtst_form_field_meta', 'wpmtst_form_field_meta_l10n', 10, 3 );
|
413 |
add_filter( 'wpmtst_form_field_meta', 'do_shortcode' );
|
414 |
|
415 |
+
|
|
|
|
|
|
|
|
|
416 |
function wpmtst_field_error( $field ) {
|
417 |
$errors = WPMST()->form->get_form_errors();
|
418 |
if ( isset( $errors[ $field['name'] ] ) ) {
|
420 |
}
|
421 |
}
|
422 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
|
424 |
/**
|
425 |
* Print the submit button.
|
includes/integrations/class-integration-captcha-pro.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Strong_Testimonials_Integration_Captcha_Pro extends Strong_Testimonials_Integration_Captcha {
|
3 |
-
|
4 |
-
public function __construct() {
|
5 |
-
parent::__construct();
|
6 |
-
}
|
7 |
-
|
8 |
-
public function add_captcha() {
|
9 |
-
if ( function_exists( 'cptch_display_captcha_custom' ) ) {
|
10 |
-
return '<input type="hidden" name="cntctfrm_contact_action" value="true">' .
|
11 |
-
cptch_display_captcha_custom();
|
12 |
-
}
|
13 |
-
|
14 |
-
return '';
|
15 |
-
}
|
16 |
-
|
17 |
-
public function check_captcha( $form_errors ) {
|
18 |
-
if ( function_exists( 'cptch_check_custom_form' ) && cptch_check_custom_form() !== true ) {
|
19 |
-
$form_errors['captcha'] = __( 'The Captcha failed. Please try again.', 'strong-testimonials' );
|
20 |
-
}
|
21 |
-
|
22 |
-
return $form_errors;
|
23 |
-
}
|
24 |
-
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/integrations/class-integration-captcha.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Strong_Testimonials_Integration_Captcha {
|
3 |
-
|
4 |
-
public function __construct() {}
|
5 |
-
|
6 |
-
public function add_captcha() {
|
7 |
-
return '';
|
8 |
-
}
|
9 |
-
|
10 |
-
public function check_captcha( $form_errors ) {
|
11 |
-
return $form_errors;
|
12 |
-
}
|
13 |
-
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/integrations/class-integration-google-captcha.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Strong_Testimonials_Integration_Google_Captcha extends Strong_Testimonials_Integration_Captcha {
|
3 |
-
|
4 |
-
public function __construct() {
|
5 |
-
parent::__construct();
|
6 |
-
}
|
7 |
-
|
8 |
-
public function add_captcha() {
|
9 |
-
if ( function_exists( 'gglcptch_display_custom' ) ) {
|
10 |
-
return gglcptch_display_custom();
|
11 |
-
}
|
12 |
-
|
13 |
-
return '';
|
14 |
-
}
|
15 |
-
|
16 |
-
public function check_captcha( $form_errors ) {
|
17 |
-
if ( function_exists( 'gglcptch_check_custom' ) && gglcptch_check_custom() !== true ) {
|
18 |
-
$form_errors['captcha'] = __( 'The Captcha failed. Please try again.', 'strong-testimonials' );
|
19 |
-
}
|
20 |
-
|
21 |
-
return $form_errors;
|
22 |
-
}
|
23 |
-
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|