PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.08
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.08
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmAppHelper.php +341 -1125 6.5.35.0.08 View file →
@@ -3,30 +3,18 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmAppHelper {
7 - public static $db_version = 98; // Version of the database we are moving to.
7 + public static $db_version = 98; // Version of the database we are moving to.
8 8 public static $pro_db_version = 37; //deprecated
9 - public static $font_version = 7;
9 + public static $font_version = 7;
10 10
11 11 /**
12 - * @var bool $added_gmt_offset_filter
13 - */
14 - private static $added_gmt_offset_filter = false;
15 -
16 - /**
17 12 * @since 2.0
18 - *
19 - * @var string
20 13 */
21 - public static $plug_version = '6.5.3';
14 + public static $plug_version = '5.0.08';
22 15
23 16 /**
24 - * @var bool
25 - */
26 - private static $included_svg = false;
27 -
28 - /**
29 17 * @since 1.07.02
30 18 *
31 19 * @param none
32 20 *
@@ -155,28 +143,12 @@
155 143
156 144 public static function get_menu_name() {
157 145 $frm_settings = self::get_settings();
158 146
159 - return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu;
147 + return $frm_settings->menu;
160 148 }
161 149
162 150 /**
163 - * Determine if the current branding is set to 'formidable'.
164 - *
165 - * Checks the menu title, retrieved through get_menu_name,
166 - * and verifies if it matches the 'formidable' branding.
167 - *
168 - * @since 6.4.2
169 - *
170 - * @return bool True if the menu title is 'formidable', false otherwise.
171 - */
172 - public static function is_formidable_branding() {
173 - $menu_title = self::get_menu_name();
174 -
175 - return 'formidable' === strtolower( trim( $menu_title ) );
176 - }
177 -
178 - /**
179 151 * @since 3.05
180 152 */
181 153 public static function svg_logo( $atts = array() ) {
182 154 $defaults = array(
@@ -196,9 +168,9 @@
196 168 /**
197 169 * @since 4.0
198 170 */
199 171 public static function show_logo( $atts = array() ) {
200 - echo self::kses( self::svg_logo( $atts ), 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
172 + echo self::kses( self::svg_logo( $atts ), 'all' ); // WPCS: XSS ok.
201 173 }
202 174
203 175 /**
204 176 * @since 4.03.02
@@ -219,9 +191,9 @@
219 191 // Show nothing if it isn't an SVG.
220 192 $icon = '<div style="height:39px"></div>';
221 193 }
222 194 }
223 - echo self::kses( $icon, 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
195 + echo self::kses( $icon, 'all' ); // WPCS: XSS ok.
224 196 }
225 197
226 198 /**
227 199 * @since 2.02.04
@@ -275,15 +247,15 @@
275 247 global $pagenow;
276 248 $get_page = self::simple_get( 'page', 'sanitize_title' );
277 249 if ( $pagenow ) {
278 250 // allow this to be true during ajax load i.e. ajax form builder loading
279 - $is_page = ( $pagenow === 'admin.php' || $pagenow === 'admin-ajax.php' ) && $get_page === $page;
251 + $is_page = ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page;
280 252 if ( $is_page ) {
281 253 return true;
282 254 }
283 255 }
284 256
285 - return is_admin() && $get_page === $page;
257 + return is_admin() && $get_page == $page;
286 258 }
287 259
288 260 /**
289 261 * If the current page is for editing or creating a view.
@@ -355,18 +327,14 @@
355 327 * Check if on an admin page
356 328 *
357 329 * @since 2.0
358 330 *
331 + * @param None
332 + *
359 333 * @return boolean
360 334 */
361 335 public static function is_admin() {
362 - $is_admin = is_admin() && ! wp_doing_ajax();
363 -
364 - /**
365 - * @since 6.0
366 - * @param bool $is_admin
367 - */
368 - return apply_filters( 'frm_is_admin', $is_admin );
336 + return is_admin() && ! wp_doing_ajax();
369 337 }
370 338
371 339 /**
372 340 * Check if value contains blank value or empty array
@@ -399,37 +367,26 @@
399 367 return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
400 368 }
401 369
402 370 /**
403 - * Get the server OS
371 + * Check for the IP address in several places
372 + * Used by [ip] shortcode
404 373 *
405 - * @since 6.4.2
406 - *
407 - * @return string
408 - */
409 - public static function get_server_os() {
410 - if ( function_exists( 'php_uname' ) ) {
411 - return php_uname( 's' );
412 - }
413 -
414 - if ( ! defined( 'PHP_OS' ) ) {
415 - return '';
416 - }
417 -
418 - // match the same response for Windows server as php_uname('s')
419 - return in_array( PHP_OS, array( 'WIN32', 'WINNT', 'Windows_NT' ), true ) ? 'Windows NT' : PHP_OS;
420 - }
421 -
422 - /**
423 - * Check for the IP address in several places (when custom headers are enabled).
424 - * Used by [ip] shortcode.
425 - *
426 374 * @return string The IP address of the current user
427 375 */
428 376 public static function get_ip_address() {
429 - $ip_options = self::should_use_custom_header_ip() ? self::get_custom_header_keys_for_ip() : array( 'REMOTE_ADDR' );
430 - $ip = '';
431 -
377 + $ip_options = array(
378 + 'HTTP_CLIENT_IP',
379 + 'HTTP_CF_CONNECTING_IP',
380 + 'HTTP_X_FORWARDED_FOR',
381 + 'HTTP_X_FORWARDED',
382 + 'HTTP_X_CLUSTER_CLIENT_IP',
383 + 'HTTP_X_REAL_IP',
384 + 'HTTP_FORWARDED_FOR',
385 + 'HTTP_FORWARDED',
386 + 'REMOTE_ADDR',
387 + );
388 + $ip = '';
432 389 foreach ( $ip_options as $key ) {
433 390 if ( ! isset( $_SERVER[ $key ] ) ) {
434 391 continue;
435 392 }
@@ -435,9 +392,9 @@
435 392 }
436 393
437 394 $key = self::get_server_value( $key );
438 395 foreach ( explode( ',', $key ) as $ip ) {
439 - $ip = trim( $ip ); // Just to be safe.
396 + $ip = trim( $ip ); // just to be safe.
440 397
441 398 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
442 399 return sanitize_text_field( $ip );
443 400 }
@@ -446,52 +403,8 @@
446 403
447 404 return sanitize_text_field( $ip );
448 405 }
449 406
450 - /**
451 - * @since 6.1
452 - *
453 - * @return array
454 - */
455 - public static function get_custom_header_keys_for_ip() {
456 - return array(
457 - 'HTTP_CLIENT_IP',
458 - 'HTTP_CF_CONNECTING_IP',
459 - 'HTTP_X_FORWARDED_FOR',
460 - 'HTTP_X_FORWARDED',
461 - 'HTTP_X_CLUSTER_CLIENT_IP',
462 - 'HTTP_X_REAL_IP',
463 - 'HTTP_FORWARDED_FOR',
464 - 'HTTP_FORWARDED',
465 - 'REMOTE_ADDR',
466 - );
467 - }
468 -
469 - /**
470 - * Check if we should check every HTTP header or just $_SERVER['REMOTE_ADDR'].
471 - * The other HTTP headers can be spoofed so this isn't recommended.
472 - * But in some cases (like reverse proxies), the IP may be empty if you use $_SERVER['REMOTE_ADDR'].
473 - *
474 - * @since 6.1
475 - *
476 - * @return bool
477 - */
478 - private static function should_use_custom_header_ip() {
479 - $settings = self::get_settings();
480 - $should_use_custom_header_ip = ! $settings->no_ips && $settings->custom_header_ip;
481 -
482 - /**
483 - * Filter whether to check spoofable HTTP headers.
484 - * This uses the custom_header_ip setting, but it is hidden if the GDPR option is also on.
485 - * As the IP is still checked for blacklist checks, someone with the GDPR option may still want to enable this when behind a reverse proxy.
486 - *
487 - * @since 6.1
488 - *
489 - * @param bool $should_use_custom_header_ip
490 - */
491 - return apply_filters( 'frm_use_custom_header_ip', $should_use_custom_header_ip );
492 - }
493 -
494 407 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
495 408 if ( strpos( $param, '[' ) ) {
496 409 $params = explode( '[', $param );
497 410 $param = $params[0];
@@ -496,11 +409,12 @@
496 409 $params = explode( '[', $param );
497 410 $param = $params[0];
498 411 }
499 412
500 - if ( $src === 'get' ) {
501 - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
502 - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
413 + if ( $src == 'get' ) {
414 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
415 + $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default );
416 + if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
503 417 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
504 418 $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) );
505 419 }
506 420 self::sanitize_value( $sanitize, $value );
@@ -580,16 +494,16 @@
580 494 );
581 495 $args = wp_parse_args( $args, $defaults );
582 496
583 497 $value = $args['default'];
584 - if ( $args['type'] === 'get' ) {
498 + if ( $args['type'] == 'get' ) {
585 499 if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
586 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
500 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
587 501 $value = wp_unslash( $_GET[ $args['param'] ] );
588 502 }
589 - } elseif ( $args['type'] === 'post' ) {
590 - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
591 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
503 + } elseif ( $args['type'] == 'post' ) {
504 + if ( isset( $_POST[ $args['param'] ] ) ) {
505 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
592 506 $value = wp_unslash( $_POST[ $args['param'] ] );
593 507 if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
594 508 self::unserialize_or_decode( $value );
595 509 }
@@ -594,9 +508,9 @@
594 508 self::unserialize_or_decode( $value );
595 509 }
596 510 }
597 511 } else {
598 - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
512 + if ( isset( $_REQUEST[ $args['param'] ] ) ) {
599 513 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
600 514 $value = wp_unslash( $_REQUEST[ $args['param'] ] );
601 515 }
602 516 }
@@ -731,74 +645,8 @@
731 645 return wp_kses( $value, $allowed_html );
732 646 }
733 647
734 648 /**
735 - * The regular kses function strips [button_action] from submit button HTML.
736 - *
737 - * @since 5.0.13
738 - *
739 - * @param string $html
740 - * @return string
741 - */
742 - public static function kses_submit_button( $html ) {
743 - $included_button_action = false !== strpos( $html, '[button_action]' );
744 - $included_back_hook = false !== strpos( $html, '[back_hook]' );
745 - $included_draft_hook = false !== strpos( $html, '[draft_hook]' );
746 - add_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' );
747 - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' );
748 - $html = self::kses( $html, 'all' );
749 - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' );
750 - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' );
751 - if ( $included_button_action ) {
752 - if ( false !== strpos( $html, '<input type="submit"' ) ) {
753 - $pattern = '/(<input type="submit")([^>]*)(\/>)/';
754 - $html = preg_replace( $pattern, '$1$2[button_action] $3', $html, 1 );
755 - } else {
756 - $pattern = '/(<button)(.*)(class=")(.*)(frm_button_submit)(.*)(")(.*)([^>]+)(>)/';
757 - $html = preg_replace( $pattern, '$1$2$3$4$5$6$7 [button_action]$8$9$10', $html, 1 );
758 - }
759 - }
760 - if ( $included_back_hook ) {
761 - $html = str_replace( 'class="frm_prev_page"', 'class="frm_prev_page" [back_hook]', $html );
762 - }
763 - if ( $included_draft_hook ) {
764 - $html = str_replace( 'class="frm_save_draft"', 'class="frm_save_draft" [draft_hook]', $html );
765 - }
766 - return $html;
767 - }
768 -
769 - /**
770 - * @since 5.0.13
771 - *
772 - * @param array $allowed_attr
773 - * @return array
774 - */
775 - public static function allow_visibility_style( $allowed_attr ) {
776 - $allowed_attr[] = 'visibility';
777 - return $allowed_attr;
778 - }
779 -
780 - /**
781 - * @since 5.0.13
782 - *
783 - * @param array $allowed_html
784 - * @return array
785 - */
786 - public static function add_allowed_submit_button_tags( $allowed_html ) {
787 - $allowed_html['input'] = array(
788 - 'type' => true,
789 - 'value' => true,
790 - 'formnovalidate' => true,
791 - 'name' => true,
792 - 'class' => true,
793 - );
794 - $allowed_html['button']['formnovalidate'] = true;
795 - $allowed_html['button']['name'] = true;
796 - $allowed_html['img']['style'] = true;
797 - return $allowed_html;
798 - }
799 -
800 - /**
801 649 * @since 2.05.03
802 650 */
803 651 private static function allowed_html( $allowed ) {
804 652 $html = self::safe_html();
@@ -823,16 +671,15 @@
823 671 'id' => true,
824 672 );
825 673
826 674 return array(
827 - 'a' => array(
828 - 'class' => true,
829 - 'href' => true,
830 - 'id' => true,
831 - 'rel' => true,
832 - 'target' => true,
833 - 'title' => true,
834 - 'tabindex' => true,
675 + 'a' => array(
676 + 'class' => true,
677 + 'href' => true,
678 + 'id' => true,
679 + 'rel' => true,
680 + 'target' => true,
681 + 'title' => true,
835 682 ),
836 683 'abbr' => array(
837 684 'title' => true,
838 685 ),
@@ -856,9 +703,8 @@
856 703 'class' => true,
857 704 'id' => true,
858 705 'title' => true,
859 706 'style' => true,
860 - 'role' => true,
861 707 ),
862 708 'dl' => array(),
863 709 'dt' => array(),
864 710 'em' => array(),
@@ -921,21 +767,19 @@
921 767 'id' => true,
922 768 'viewbox' => true,
923 769 ),
924 770 'svg' => array(
925 - 'class' => true,
926 - 'id' => true,
927 - 'xmlns' => true,
928 - 'viewbox' => true,
929 - 'width' => true,
930 - 'height' => true,
931 - 'style' => true,
932 - 'fill' => true,
933 - 'aria-label' => true,
934 - 'aria-hidden' => true,
771 + 'class' => true,
772 + 'id' => true,
773 + 'xmlns' => true,
774 + 'viewbox' => true,
775 + 'width' => true,
776 + 'height' => true,
777 + 'style' => true,
778 + 'fill' => true,
935 779 ),
936 780 'use' => array(
937 - 'href' => true,
781 + 'href' => true,
938 782 'xlink:href' => true,
939 783 ),
940 784 'ul' => $allow_class,
941 785 'label' => array(
@@ -1008,18 +852,8 @@
1008 852
1009 853 $html_atts = self::array_to_html_params( $atts );
1010 854
1011 855 $icon = trim( str_replace( array( 'frm_icon_font', 'frmfont ' ), '', $class ) );
1012 -
1013 - // Replace icons that have been removed.
1014 - $deprecated = array(
1015 - 'frm_clone_solid_icon' => 'frm_clone_icon',
1016 - );
1017 - if ( isset( $deprecated[ $icon ] ) ) {
1018 - $icon = $deprecated[ $icon ];
1019 - $class = str_replace( $icon, $deprecated[ $icon ], $class );
1020 - }
1021 -
1022 856 if ( $icon === $class ) {
1023 857 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
1024 858 } else {
1025 859 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1026,15 +860,15 @@
1026 860 if ( strpos( $icon, ' ' ) ) {
1027 861 $icon = explode( ' ', $icon );
1028 862 $icon = reset( $icon );
1029 863 }
1030 - $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '>
864 + $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '>
1031 865 <use xlink:href="#' . esc_attr( $icon ) . '" />
1032 866 </svg>';
1033 867 }
1034 868
1035 869 if ( $echo ) {
1036 - echo self::kses_icon( $icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
870 + echo $icon; // WPCS: XSS ok.
1037 871 } else {
1038 872 return $icon;
1039 873 }
1040 874 }
@@ -1039,95 +873,14 @@
1039 873 }
1040 874 }
1041 875
1042 876 /**
1043 - * Run kses for icons. It needs to add a few filters first in order to preserve some custom style values.
1044 - *
1045 - * @since 5.0.13
1046 - *
1047 - * @param string $icon
1048 - * @return string
1049 - */
1050 - public static function kses_icon( $icon ) {
1051 - add_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' );
1052 - add_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style', 10, 2 );
1053 - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' );
1054 - $icon = self::kses( $icon, 'all' );
1055 - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' );
1056 - remove_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style' );
1057 - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' );
1058 - return $icon;
1059 - }
1060 -
1061 - /**
1062 - * @since 5.0.13.1
1063 - *
1064 - * @param array $allowed_html
1065 - * @return array
1066 - */
1067 - public static function add_allowed_icon_tags( $allowed_html ) {
1068 - $allowed_html['svg']['data-open'] = true;
1069 - $allowed_html['svg']['title'] = true;
1070 - return $allowed_html;
1071 - }
1072 -
1073 - /**
1074 - * @since 5.0.13
1075 - *
1076 - * @param array $allowed_attr
1077 - * @return array
1078 - */
1079 - public static function allow_vars_in_styles( $allowed_attr ) {
1080 - $allowed_attr[] = '--primary-700';
1081 - return $allowed_attr;
1082 - }
1083 -
1084 - /**
1085 - * @since 5.0.13
1086 - *
1087 - * @param bool $allow_css
1088 - * @param string $css_string
1089 - */
1090 - public static function allow_style( $allow_css, $css_string ) {
1091 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
1092 - $split = explode( ':', $css_string, 2 );
1093 - $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1094 - }
1095 - return $allow_css;
1096 - }
1097 -
1098 - /**
1099 - * @since 5.0.13
1100 - *
1101 - * @param string $value
1102 - * @return bool
1103 - */
1104 - private static function is_a_valid_color( $value ) {
1105 - $match = 0;
1106 - if ( 0 === strpos( $value, 'rgba(' ) ) {
1107 - $match = preg_match( '/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/', $value );
1108 - } elseif ( 0 === strpos( $value, 'rgb(' ) ) {
1109 - $match = preg_match( '/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/', $value );
1110 - } elseif ( 0 === strpos( $value, '#' ) ) {
1111 - $match = preg_match( '/^#([a-f0-9]{6}|[a-f0-9]{3})\b$/', $value );
1112 - }
1113 - return (bool) $match;
1114 - }
1115 -
1116 - /**
1117 877 * Include svg images.
1118 878 *
1119 879 * @since 4.0.02
1120 - * @return void
1121 880 */
1122 881 public static function include_svg() {
1123 - if ( self::$included_svg ) {
1124 - return;
1125 - }
1126 -
1127 - // Use readfile instead of include_once because of a default security rule in Snuffleupagus.
1128 - readfile( self::plugin_path() . '/images/icons.svg' );
1129 - self::$included_svg = true;
882 + include_once( self::plugin_path() . '/images/icons.svg' );
1130 883 }
1131 884
1132 885 /**
1133 886 * Convert an associative array to HTML values.
@@ -1132,48 +885,19 @@
1132 885 /**
1133 886 * Convert an associative array to HTML values.
1134 887 *
1135 888 * @since 4.0.02
1136 - * @since 5.0.13 added $echo parameter.
1137 - *
1138 889 * @param array $atts
1139 - * @param bool $echo
1140 - * @return string|void
890 + * @return string
1141 891 */
1142 - public static function array_to_html_params( $atts, $echo = false ) {
1143 - $callback = function() use ( $atts ) {
1144 - if ( $atts ) {
1145 - foreach ( $atts as $key => $value ) {
1146 - echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
1147 - }
892 + public static function array_to_html_params( $atts ) {
893 + $html = '';
894 + if ( ! empty( $atts ) ) {
895 + foreach ( $atts as $key => $value ) {
896 + $html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
1148 897 }
1149 - };
1150 - return self::clip( $callback, $echo );
1151 - }
1152 -
1153 - /**
1154 - * Call an echo function and either echo it or return the result as a string.
1155 - *
1156 - * @since 5.0.13
1157 - *
1158 - * @param Closure $echo_function
1159 - * @param bool $echo
1160 - * @return string|void
1161 - */
1162 - public static function clip( $echo_function, $echo = false ) {
1163 - if ( ! $echo ) {
1164 - ob_start();
1165 898 }
1166 -
1167 - if ( is_callable( $echo_function ) ) {
1168 - $echo_function();
1169 - }
1170 -
1171 - if ( ! $echo ) {
1172 - $return = ob_get_contents();
1173 - ob_end_clean();
1174 - return $return;
1175 - }
899 + return $html;
1176 900 }
1177 901
1178 902 /**
1179 903 * @since 3.0
@@ -1190,94 +914,31 @@
1190 914 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1191 915 }
1192 916
1193 917 /**
1194 - * @since 6.0
1195 - *
1196 - * @param string $type
1197 - * @return void
1198 - */
1199 - public static function import_link( $type = 'secondary' ) {
1200 - ?>
1201 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-import' ) ); ?>" class="button frm-button-<?php echo esc_attr( $type ); ?> frm_animate_bg">
1202 - <?php esc_html_e( 'Import', 'formidable' ); ?>
1203 - </a>
1204 - <?php
1205 - }
1206 -
1207 - /**
1208 - * Print applicable admin banner.
1209 - *
1210 - * @since 5.4.2
1211 - *
1212 - * @param bool $should_show_lite_upgrade
1213 - * @return void
1214 - */
1215 - public static function print_admin_banner( $should_show_lite_upgrade ) {
1216 - if ( ! current_user_can( 'administrator' ) ) {
1217 - FrmInbox::maybe_show_banner();
1218 - return;
1219 - }
1220 -
1221 - if ( self::maybe_show_license_warning() || FrmInbox::maybe_show_banner() || ! $should_show_lite_upgrade || self::pro_is_installed() ) {
1222 - // Print license warning or inbox banner and exit if either prints.
1223 - // And exit before printing the upgrade bar if it shouldn't be shown.
1224 - return;
1225 - }
1226 - ?>
1227 - <div class="frm-upgrade-bar">
1228 - <span>You're using Formidable Forms Lite. To unlock more features consider</span>
1229 - <a href="<?php echo esc_url( self::admin_upgrade_link( 'top-bar' ) ); ?>" target="_blank" rel="noopener">upgrading to Pro</a>.
1230 - </div>
1231 - <?php
1232 - }
1233 -
1234 - /**
1235 - * @since 5.4.2
1236 - *
1237 - * @return bool True if a banner is available and shown.
1238 - */
1239 - private static function maybe_show_license_warning() {
1240 - return is_callable( 'FrmProAddonsController::admin_banner' ) && FrmProAddonsController::admin_banner();
1241 - }
1242 -
1243 - /**
1244 - * Render a button for a new item (Form, Application, etc).
1245 - *
1246 918 * @since 3.0
1247 - * @param array $atts {
1248 - * @type array $link_hook Custom link hook, calls do_action and exits early.
1249 - * @type string $new_link Href value, default #.
1250 - * @type string $class Custom class names, space separated.
1251 - * @type string $button_text Button text. Default "Add New".
1252 - * }
1253 - * @return void
919 + * @param array $atts
1254 920 */
1255 921 public static function add_new_item_link( $atts ) {
1256 - if ( isset( $atts['link_hook'] ) ) {
922 + if ( ! empty( $atts['new_link'] ) ) {
923 + ?>
924 + <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus">
925 + <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?>
926 + <?php esc_html_e( 'Add New', 'formidable' ); ?>
927 + </a>
928 + <?php
929 + } elseif ( ! empty( $atts['trigger_new_form_modal'] ) ) {
930 + ?>
931 + <a href="#" class="button button-primary frm-button-primary frm-with-plus frm-trigger-new-form-modal">
932 + <?php
933 + self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' );
934 + esc_html_e( 'Add New', 'formidable' );
935 + ?>
936 + </a>
937 + <?php
938 + } elseif ( isset( $atts['link_hook'] ) ) {
1257 939 do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1258 - return;
1259 940 }
1260 -
1261 - if ( empty( $atts['new_link'] ) && empty( $atts['trigger_new_form_modal'] ) && empty( $atts['class'] ) ) {
1262 - // Do not render a button if none of these attributes are set.
1263 - return;
1264 - }
1265 -
1266 - $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1267 - $class = 'button button-primary frm-button-primary';
1268 -
1269 - if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1270 - $class .= ' frm-trigger-new-form-modal';
1271 - }
1272 -
1273 - if ( ! empty( $atts['class'] ) ) {
1274 - $class .= ' ' . $atts['class'];
1275 - }
1276 -
1277 - $button_text = ! empty( $atts['button_text'] ) ? $atts['button_text'] : __( 'Add New', 'formidable' );
1278 -
1279 - require self::plugin_path() . '/classes/views/shared/add-button.php';
1280 941 }
1281 942
1282 943 /**
1283 944 * @since 3.06
@@ -1335,14 +996,11 @@
1335 996 }
1336 997 }
1337 998
1338 999 /**
1339 - * Save all front-end js scripts into a single file.
1340 - * And save an additional single file of all front-end Stripe JS scripts.
1000 + * Save all front-end js scripts into a single file
1341 1001 *
1342 1002 * @since 3.0
1343 - *
1344 - * @return void
1345 1003 */
1346 1004 public static function save_combined_js() {
1347 1005 $file_atts = apply_filters(
1348 1006 'frm_js_location',
@@ -1353,36 +1011,13 @@
1353 1011 );
1354 1012 $new_file = new FrmCreateFile( $file_atts );
1355 1013
1356 1014 $files = array(
1015 + self::plugin_path() . '/js/jquery/jquery.placeholder.min.js',
1357 1016 self::plugin_path() . '/js/formidable.min.js',
1358 1017 );
1359 - /**
1360 - * @param array $files
1361 - */
1362 1018 $files = apply_filters( 'frm_combined_js_files', $files );
1363 1019 $new_file->combine_files( $files );
1364 -
1365 - // Create the minified Stripe Script.
1366 - $file_atts = apply_filters(
1367 - 'frm_stripe_js_location',
1368 - array(
1369 - 'file_name' => 'frmstrp.min.js',
1370 - 'new_file_path' => self::plugin_path() . '/js',
1371 - )
1372 - );
1373 - $new_file = new FrmCreateFile( $file_atts );
1374 - $files = array(
1375 - FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js',
1376 - );
1377 -
1378 - /**
1379 - * @since 6.5
1380 - *
1381 - * @param array $files
1382 - */
1383 - $files = apply_filters( 'frm_stripe_combined_js_files', $files );
1384 - $new_file->combine_files( $files );
1385 1020 }
1386 1021
1387 1022 /**
1388 1023 * Check a value from a shortcode to see if true or false.
@@ -1399,9 +1034,8 @@
1399 1034 }
1400 1035
1401 1036 /**
1402 1037 * Gets all post from a specific post type.
1403 - * This gets the entire WP_Post object so it can require a lot of memory. When only id and title are needed, consider using FrmAppHelper::get_post_ids_and_titles instead.
1404 1038 *
1405 1039 * @since 4.10.01 Add `$post_type` argument.
1406 1040 *
1407 1041 * @param string $post_type Post type to query. Default is `page`.
@@ -1419,30 +1053,8 @@
1419 1053 return get_posts( $query );
1420 1054 }
1421 1055
1422 1056 /**
1423 - * Gets post ids and titles for a specific post type.
1424 - *
1425 - * @since 5.0.09
1426 - *
1427 - * @param string $post_type Post type to query. Default is `page`.
1428 - * @return array
1429 - */
1430 - public static function get_post_ids_and_titles( $post_type = 'page' ) {
1431 - return FrmDb::get_results(
1432 - 'posts',
1433 - array(
1434 - 'post_type' => $post_type,
1435 - 'post_status' => array( 'publish', 'private' ),
1436 - ),
1437 - 'ID, post_title',
1438 - array(
1439 - 'order_by' => 'post_title ASC',
1440 - )
1441 - );
1442 - }
1443 -
1444 - /**
1445 1057 * Renders an autocomplete page selection or a regular dropdown depending on
1446 1058 * the total page count
1447 1059 *
1448 1060 * @since 4.03.06
@@ -1487,9 +1099,9 @@
1487 1099 */
1488 1100 public static function wp_pages_dropdown( $args = array(), $page_id = '', $truncate = false ) {
1489 1101 self::prep_page_dropdown_params( $page_id, $truncate, $args );
1490 1102
1491 - $pages = self::get_post_ids_and_titles( $args['post_type'] );
1103 + $pages = self::get_pages( $args['post_type'] );
1492 1104 $selected = self::get_post_param( $args['field_name'], $args['page_id'], 'absint' );
1493 1105
1494 1106 ?>
1495 1107 <select name="<?php echo esc_attr( $args['field_name'] ); ?>" id="<?php echo esc_attr( $args['field_name'] ); ?>" class="frm-pages-dropdown">
@@ -1543,8 +1155,9 @@
1543 1155 public static function post_edit_link( $post_id ) {
1544 1156 $post = get_post( $post_id );
1545 1157 if ( $post ) {
1546 1158 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1159 + $post_url = self::maybe_full_screen_link( $post_url );
1547 1160
1548 1161 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1549 1162 }
1550 1163
@@ -1554,64 +1167,25 @@
1554 1167 /**
1555 1168 * Hide the WordPress menus on some pages.
1556 1169 *
1557 1170 * @since 4.0
1558 - *
1559 - * @return bool
1560 1171 */
1561 1172 public static function is_full_screen() {
1562 - return self::is_form_builder_page() ||
1563 - self::is_style_editor_page() ||
1564 - self::is_full_screen_view_builder_page();
1565 - }
1173 + $full_builder = self::is_form_builder_page();
1174 + $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' );
1175 + $full_entries = self::simple_get( 'frm-full', 'absint' );
1566 1176
1567 - /**
1568 - * Check if user is on the style editor or its alternative URL.
1569 - * The first URL is a submenu "Styles" in the Formidable menu /wp-admin/admin.php?page=formidable-styles.
1570 - * The alternative URL is linked as a submenu "Forms" item of the Appearance menu /wp-admin/themes.php?page=formidable-styles2.
1571 - *
1572 - * @since 5.5.3
1573 - * @since 6.0 Added the $view parameter. Previously there was only a 'edit' view.
1574 - *
1575 - * @param string $view Supports 'edit', 'list', and ''. If '', both 'edit' and 'list' will match.
1576 - * @return bool
1577 - */
1578 - public static function is_style_editor_page( $view = '' ) {
1579 - if ( ! self::is_admin_page( 'formidable-styles' ) && ! self::is_admin_page( 'formidable-styles2' ) ) {
1580 - return false;
1581 - }
1582 -
1583 - if ( ! in_array( $view, array( 'list', 'edit' ), true ) ) {
1584 - return true;
1585 - }
1586 -
1587 - $action = self::simple_get( 'frm_action' );
1588 - $is_edit_mode = 'edit' === $action || ( ! $action && ! self::simple_get( 'id' ) && ! self::simple_get( 'form' ) );
1589 -
1590 - if ( ! $is_edit_mode && class_exists( 'FrmProStylesController' ) && in_array( $action, array( 'new_style', 'duplicate' ), true ) ) {
1591 - $is_edit_mode = true;
1592 - }
1593 -
1594 - $checking_for_edit_mode = 'edit' === $view;
1595 -
1596 - return $is_edit_mode === $checking_for_edit_mode;
1177 + return $full_builder || $full_entries || $styler || self::is_view_builder_page();
1597 1178 }
1598 1179
1599 1180 /**
1600 - * @since 5.5.3
1601 - *
1602 - * @return bool
1603 - */
1604 - private static function is_full_screen_view_builder_page() {
1605 - return self::is_admin_page( 'formidable-views-editor' );
1606 - }
1607 -
1608 - /**
1609 1181 * @since 4.0
1610 - * @deprecated 5.5.3
1611 1182 */
1612 1183 public static function maybe_full_screen_link( $link ) {
1613 - _deprecated_function( __METHOD__, '5.5.3' );
1184 + $is_full = self::simple_get( 'frm-full', 'absint' );
1185 + if ( $is_full && ! empty( $link ) && $link !== '#' ) {
1186 + $link .= '&frm-full=1';
1187 + }
1614 1188 return $link;
1615 1189 }
1616 1190
1617 1191 /**
@@ -1671,10 +1245,19 @@
1671 1245 * @param string $type Supports `auto`, `pro`, or `pro_only`.
1672 1246 * @return array
1673 1247 */
1674 1248 public static function frm_capabilities( $type = 'auto' ) {
1675 - if ( ! self::pro_is_installed() && ! in_array( $type, array( 'pro', 'pro_only' ), true ) ) {
1676 - return self::get_lite_capabilities();
1249 + $cap = array(
1250 + 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1251 + 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1252 + 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1253 + 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1254 + 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1255 + 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1256 + );
1257 +
1258 + if ( ! self::pro_is_installed() && 'pro' !== $type && 'pro_only' !== $type ) {
1259 + return $cap;
1677 1260 }
1678 1261
1679 1262 $pro_cap = array(
1680 1263 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ),
@@ -1681,41 +1264,17 @@
1681 1264 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ),
1682 1265 'frm_view_reports' => __( 'View Reports', 'formidable' ),
1683 1266 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ),
1684 1267 );
1685 - /**
1686 - * @since 5.3.1
1687 - *
1688 - * @param array<string,string> $pro_cap
1689 - */
1690 - $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap );
1691 1268
1692 1269 if ( 'pro_only' === $type ) {
1693 1270 return $pro_cap;
1694 1271 }
1695 1272
1696 - return self::get_lite_capabilities() + $pro_cap;
1273 + return $cap + $pro_cap;
1697 1274 }
1698 1275
1699 1276 /**
1700 - * Get the list of lite plugin capabilities.
1701 - *
1702 - * @since 5.3.1
1703 - *
1704 - * @return array<string,string>
1705 - */
1706 - private static function get_lite_capabilities() {
1707 - return array(
1708 - 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1709 - 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1710 - 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1711 - 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1712 - 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1713 - 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1714 - );
1715 - }
1716 -
1717 - /**
1718 1277 * Call the WordPress current_user_can but also validate empty strings as true for any logged in user
1719 1278 *
1720 1279 * @since 4.06.03
1721 1280 *
@@ -1915,9 +1474,9 @@
1915 1474 foreach ( $array as $key => $value ) {
1916 1475 if ( is_array( $value ) ) {
1917 1476 $return = array_merge( $return, self::array_flatten( $value, $keys ) );
1918 1477 } else {
1919 - if ( $keys === 'keep' ) {
1478 + if ( $keys == 'keep' ) {
1920 1479 $return[ $key ] = $value;
1921 1480 } else {
1922 1481 $return[] = $value;
1923 1482 }
@@ -1960,8 +1519,19 @@
1960 1519 return $val;
1961 1520 }
1962 1521
1963 1522 /**
1523 + * @since 2.0
1524 + * @return string The base Google APIS url for the current version of jQuery UI
1525 + */
1526 + public static function jquery_ui_base_url() {
1527 + $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
1528 + $url = apply_filters( 'frm_jquery_ui_base_url', $url );
1529 +
1530 + return $url;
1531 + }
1532 +
1533 + /**
1964 1534 * @param string $handle
1965 1535 */
1966 1536 public static function script_version( $handle, $default = 0 ) {
1967 1537 global $wp_scripts;
@@ -1981,20 +1551,10 @@
1981 1551
1982 1552 return $ver;
1983 1553 }
1984 1554
1985 - /**
1986 - * @since 5.0.13 added $echo param.
1987 - *
1988 - * @param string $url
1989 - * @param bool $echo
1990 - * @return string|void
1991 - */
1992 - public static function js_redirect( $url, $echo = false ) {
1993 - $callback = function() use ( $url ) {
1994 - echo '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
1995 - };
1996 - return self::clip( $callback, $echo );
1555 + public static function js_redirect( $url ) {
1556 + return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
1997 1557 }
1998 1558
1999 1559 public static function get_user_id_param( $user_id ) {
2000 1560 if ( ! $user_id || is_numeric( $user_id ) ) {
@@ -2001,9 +1561,9 @@
2001 1561 return $user_id;
2002 1562 }
2003 1563
2004 1564 $user_id = sanitize_text_field( $user_id );
2005 - if ( $user_id === 'current' ) {
1565 + if ( $user_id == 'current' ) {
2006 1566 $user_id = get_current_user_id();
2007 1567 } else {
2008 1568 if ( is_email( $user_id ) ) {
2009 1569 $user = get_user_by( 'email', $user_id );
@@ -2053,38 +1613,21 @@
2053 1613 }
2054 1614
2055 1615 $key = self::prevent_numeric_and_reserved_keys( $key );
2056 1616
2057 - $similar_keys = FrmDb::get_col(
1617 + $key_check = FrmDb::get_var(
2058 1618 $table_name,
2059 1619 array(
2060 - $column . ' like%' => $key,
2061 - 'ID !' => $id,
1620 + $column => $key,
1621 + 'ID !' => $id,
2062 1622 ),
2063 1623 $column
2064 1624 );
2065 1625
2066 - // Create a unique field id if it has already been used.
2067 - if ( in_array( $key, $similar_keys, true ) ) {
1626 + if ( $key_check || is_numeric( $key_check ) ) {
2068 1627 $key = self::maybe_truncate_key_before_appending( $column, $key );
2069 -
2070 - /**
2071 - * Allow for a custom separator between the attempted key and the generated suffix.
2072 - *
2073 - * @since 5.2.03
2074 - *
2075 - * @param string $separator. Default empty.
2076 - * @param string $key the key without the added suffix.
2077 - */
2078 - $separator = apply_filters( 'frm_unique_' . $column . '_separator', '', $key );
2079 -
2080 - $suffix = 2;
2081 - do {
2082 - $key_check = $key . $separator . $suffix;
2083 - ++$suffix;
2084 - } while ( in_array( $key_check, $similar_keys, true ) );
2085 -
2086 - $key = $key_check;
1628 + // Create a unique field id if it has already been used.
1629 + $key = $key . substr( md5( microtime() . rand() ), 0, 10 );
2087 1630 }
2088 1631
2089 1632 return $key;
2090 1633 }
@@ -2101,11 +1644,8 @@
2101 1644 if ( in_array( $column, array( 'form_key', 'field_key' ), true ) ) {
2102 1645 $max_key_length_before_truncating = 60;
2103 1646 if ( strlen( $key ) > $max_key_length_before_truncating ) {
2104 1647 $key = substr( $key, 0, $max_key_length_before_truncating );
2105 - if ( is_numeric( $key ) ) {
2106 - $key .= 'a';
2107 - }
2108 1648 }
2109 1649 }
2110 1650 return $key;
2111 1651 }
@@ -2170,9 +1710,9 @@
2170 1710 return false;
2171 1711 }
2172 1712
2173 1713 if ( empty( $post_values ) ) {
2174 - $post_values = wp_unslash( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1714 + $post_values = wp_unslash( $_POST );
2175 1715 }
2176 1716
2177 1717 $values = array(
2178 1718 'id' => $record->id,
@@ -2190,11 +1730,11 @@
2190 1730 self::fill_form_opts( $record, $table, $post_values, $values );
2191 1731
2192 1732 self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
2193 1733
2194 - if ( $table === 'entries' ) {
1734 + if ( $table == 'entries' ) {
2195 1735 $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
2196 - } elseif ( $table === 'forms' ) {
1736 + } elseif ( $table == 'forms' ) {
2197 1737 $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
2198 1738 }
2199 1739
2200 1740 return $values;
@@ -2471,9 +2011,9 @@
2471 2011 *
2472 2012 * @return string $time_ago
2473 2013 */
2474 2014 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2475 - if ( empty( $to ) && 0 !== $to ) {
2015 + if ( empty( $to ) ) {
2476 2016 $now = new DateTime();
2477 2017 } else {
2478 2018 $now = new DateTime( '@' . $to );
2479 2019 }
@@ -2724,9 +2264,8 @@
2724 2264 'reply_to' => __( 'If you would like a different reply to address than the "from" address, add a single address here. FORMAT: Name <name@email.com> or name@email.com.', 'formidable' ),
2725 2265 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ),
2726 2266 /* translators: %1$s: Form name, %2$s: Date */
2727 2267 'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
2728 - 'new_tab' => __( 'This option will open the link in a new browser tab. Please note that some popup blockers may prevent this from happening, in which case the link will be displayed.', 'formidable' ),
2729 2268 );
2730 2269
2731 2270 if ( ! isset( $tooltips[ $name ] ) ) {
2732 2271 return;
@@ -2753,12 +2292,8 @@
2753 2292 return;
2754 2293 }
2755 2294
2756 2295 $frm_action = self::simple_get( 'frm_action', 'sanitize_title' );
2757 - if ( 'lite-reports' === $frm_action ) {
2758 - $frm_action = 'reports';
2759 - }
2760 -
2761 2296 if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) {
2762 2297 echo ' class="current_page"';
2763 2298 }
2764 2299 }
@@ -2815,15 +2350,12 @@
2815 2350 }
2816 2351 }
2817 2352
2818 2353 /**
2819 - * Check for either json or serialized data. This is temporary while transitioning
2354 + * Check for either json or serilized data. This is temporary while transitioning
2820 2355 * all data to json.
2821 2356 *
2822 2357 * @since 4.02.03
2823 - *
2824 - * @param array|string $value
2825 - * @return void
2826 2358 */
2827 2359 public static function unserialize_or_decode( &$value ) {
2828 2360 if ( is_array( $value ) ) {
2829 2361 return;
@@ -2829,9 +2361,9 @@
2829 2361 return;
2830 2362 }
2831 2363
2832 2364 if ( is_serialized( $value ) ) {
2833 - $value = self::maybe_unserialize_array( $value );
2365 + $value = maybe_unserialize( $value );
2834 2366 } else {
2835 2367 $value = self::maybe_json_decode( $value, false );
2836 2368 }
2837 2369 }
@@ -2836,44 +2368,13 @@
2836 2368 }
2837 2369 }
2838 2370
2839 2371 /**
2840 - * Safely unserialize an array if necessary.
2841 - * This function doesn't actually use unserialize. The string is parsed instead.
2842 - *
2843 - * @since 6.2
2844 - *
2845 - * @param mixed $value
2846 - * @return mixed
2847 - */
2848 - public static function maybe_unserialize_array( $value ) {
2849 - if ( ! is_string( $value ) ) {
2850 - return $value;
2851 - }
2852 -
2853 - // Since we only expect an array, skip anything that doesn't start with a:.
2854 - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) {
2855 - return $value;
2856 - }
2857 -
2858 - $parsed = FrmSerializedStringParserHelper::get()->parse( $value );
2859 - if ( is_array( $parsed ) ) {
2860 - $value = $parsed;
2861 - }
2862 -
2863 - return $value;
2864 - }
2865 -
2866 - /**
2867 2372 * Decode a JSON string.
2868 2373 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2869 - *
2870 - * @param mixed $string
2871 - * @param bool $single_to_array
2872 - * @return mixed
2873 2374 */
2874 2375 public static function maybe_json_decode( $string, $single_to_array = true ) {
2875 - if ( is_array( $string ) || is_null( $string ) ) {
2376 + if ( is_array( $string ) ) {
2876 2377 return $string;
2877 2378 }
2878 2379
2879 2380 $new_string = json_decode( $string, true );
@@ -2891,36 +2392,8 @@
2891 2392 return $string;
2892 2393 }
2893 2394
2894 2395 /**
2895 - * @since 6.2.3
2896 - *
2897 - * @param string $value
2898 - * @return string
2899 - */
2900 - public static function maybe_utf8_encode( $value ) {
2901 - $from_format = 'ISO-8859-1';
2902 - $to_format = 'UTF-8';
2903 -
2904 - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) {
2905 - if ( mb_check_encoding( $value, $from_format ) ) {
2906 - return mb_convert_encoding( $value, $to_format, $from_format );
2907 - }
2908 - return $value;
2909 - }
2910 -
2911 - if ( function_exists( 'iconv' ) ) {
2912 - $converted = iconv( $from_format, $to_format, $value );
2913 - // Value is false if $value is not ISO-8859-1.
2914 - if ( false !== $converted ) {
2915 - return $converted;
2916 - }
2917 - }
2918 -
2919 - return $value;
2920 - }
2921 -
2922 - /**
2923 2396 * Reformat the json serialized array in name => value array.
2924 2397 *
2925 2398 * @since 4.02.03
2926 2399 */
@@ -2986,17 +2459,14 @@
2986 2459 $version = self::plugin_version();
2987 2460 wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
2988 2461
2989 2462 $global_strings = array(
2990 - 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2991 - 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2992 - 'url' => self::plugin_url(),
2993 - 'app_url' => 'https://formidableforms.com/',
2994 - 'applicationsUrl' => admin_url( 'admin.php?page=formidable-applications' ),
2995 - 'canAccessApplicationDashboard' => current_user_can( is_callable( 'FrmProApplicationsHelper::get_required_templates_capability' ) ? FrmProApplicationsHelper::get_required_templates_capability() : 'frm_edit_forms' ),
2996 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2997 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2998 - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ),
2463 + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2464 + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2465 + 'url' => self::plugin_url(),
2466 + 'app_url' => 'https://formidableforms.com/',
2467 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2468 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2999 2469 );
3000 2470 wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings );
3001 2471
3002 2472 if ( $load ) {
@@ -3016,89 +2486,87 @@
3016 2486 */
3017 2487 public static function localize_script( $location ) {
3018 2488 global $wp_scripts;
3019 2489
2490 + $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2491 + $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2492 +
3020 2493 $script_strings = array(
3021 - 'ajax_url' => esc_url_raw( self::get_ajax_url() ),
3022 - 'images_url' => self::plugin_url() . '/images',
3023 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
3024 - 'remove' => __( 'Remove', 'formidable' ),
3025 - 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
3026 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
3027 - 'id' => __( 'ID', 'formidable' ),
3028 - 'no_results' => __( 'No results match', 'formidable' ),
3029 - 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
3030 - 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
3031 - 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
3032 - 'focus_first_error' => self::should_focus_first_error(),
3033 - 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
2494 + 'ajax_url' => $ajax_url,
2495 + 'images_url' => self::plugin_url() . '/images',
2496 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2497 + 'remove' => __( 'Remove', 'formidable' ),
2498 + 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2499 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2500 + 'id' => __( 'ID', 'formidable' ),
2501 + 'no_results' => __( 'No results match', 'formidable' ),
2502 + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2503 + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2504 + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
3034 2505 );
3035 2506
3036 2507 $data = $wp_scripts->get_data( 'formidable', 'data' );
3037 - if ( ! $data ) {
2508 + if ( empty( $data ) ) {
3038 2509 wp_localize_script( 'formidable', 'frm_js', $script_strings );
3039 2510 }
3040 2511
3041 - if ( $location === 'admin' ) {
2512 + if ( $location == 'admin' ) {
3042 2513 $frm_settings = self::get_settings();
3043 2514 $admin_script_strings = array(
3044 - 'desc' => __( '(Click to add description)', 'formidable' ),
3045 - 'blank' => __( '(Blank)', 'formidable' ),
3046 - 'no_label' => __( '(no label)', 'formidable' ),
3047 - 'ok' => __( 'OK', 'formidable' ),
3048 - 'cancel' => __( 'Cancel', 'formidable' ),
3049 - 'default_label' => __( 'Default', 'formidable' ),
3050 - 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
3051 - 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
3052 - 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
3053 - 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
3054 - 'confirm' => __( 'Are you sure?', 'formidable' ),
3055 - 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
3056 - 'conf_delete_sec' => __( 'All fields inside this Section will be deleted along with their data. Are you sure you want to delete this group of fields?', 'formidable' ),
3057 - 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
3058 - 'default_unique' => $frm_settings->unique_msg,
3059 - 'default_conf' => __( 'The entered values do not match', 'formidable' ),
3060 - 'enter_email' => __( 'Enter Email', 'formidable' ),
3061 - 'confirm_email' => __( 'Confirm Email', 'formidable' ),
3062 - 'conditional_text' => __( 'Conditional content here', 'formidable' ),
3063 - 'new_option' => __( 'New Option', 'formidable' ),
3064 - 'css_invalid_size' => __( 'In certain browsers (e.g. Firefox) text will not display correctly if the field height is too small relative to the field padding and text size. Please increase your field height or decrease your field padding.', 'formidable' ),
3065 - 'enter_password' => __( 'Enter Password', 'formidable' ),
3066 - 'confirm_password' => __( 'Confirm Password', 'formidable' ),
3067 - 'import_complete' => __( 'Import Complete', 'formidable' ),
3068 - 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
3069 - 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
3070 - 'private_label' => __( 'Private', 'formidable' ),
3071 - 'jquery_ui_url' => '',
3072 - 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
3073 - 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
3074 - 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
3075 - 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
3076 - 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
3077 - 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
3078 - 'unsafe_params' => FrmFormsHelper::reserved_words(),
2515 + 'desc' => __( '(Click to add description)', 'formidable' ),
2516 + 'blank' => __( '(Blank)', 'formidable' ),
2517 + 'no_label' => __( '(no label)', 'formidable' ),
2518 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2519 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
2520 + 'ok' => __( 'OK', 'formidable' ),
2521 + 'cancel' => __( 'Cancel', 'formidable' ),
2522 + 'default_label' => __( 'Default', 'formidable' ),
2523 + 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
2524 + 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
2525 + 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
2526 + 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2527 + 'caution' => __( 'Heads up', 'formidable' ),
2528 + 'confirm' => __( 'Are you sure?', 'formidable' ),
2529 + 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
2530 + 'conf_delete_sec' => __( 'All fields inside this Section will be deleted along with their data. Are you sure you want to delete this group of fields?', 'formidable' ),
2531 + 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
2532 + 'default_unique' => $frm_settings->unique_msg,
2533 + 'default_conf' => __( 'The entered values do not match', 'formidable' ),
2534 + 'enter_email' => __( 'Enter Email', 'formidable' ),
2535 + 'confirm_email' => __( 'Confirm Email', 'formidable' ),
2536 + 'conditional_text' => __( 'Conditional content here', 'formidable' ),
2537 + 'new_option' => __( 'New Option', 'formidable' ),
2538 + 'css_invalid_size' => __( 'In certain browsers (e.g. Firefox) text will not display correctly if the field height is too small relative to the field padding and text size. Please increase your field height or decrease your field padding.', 'formidable' ),
2539 + 'enter_password' => __( 'Enter Password', 'formidable' ),
2540 + 'confirm_password' => __( 'Confirm Password', 'formidable' ),
2541 + 'import_complete' => __( 'Import Complete', 'formidable' ),
2542 + 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
2543 + 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
2544 + 'private_label' => __( 'Private', 'formidable' ),
2545 + 'jquery_ui_url' => self::jquery_ui_base_url(),
2546 + 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
2547 + 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
2548 + 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
2549 + 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
2550 + 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
2551 + 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
2552 + 'unsafe_params' => FrmFormsHelper::reserved_words(),
3079 2553 /* Translators: %s is the name of a Detail Page Slug that is a reserved word.*/
3080 - 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ),
2554 + 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ),
3081 2555 /* Translators: %s is the name of a parameter that is a reserved word. More than one word could be listed here, though that would not be common. */
3082 - 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
3083 - 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
3084 - 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
3085 - 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
3086 - 'install' => __( 'Install', 'formidable' ),
3087 - 'active' => __( 'Active', 'formidable' ),
3088 - 'select_a_field' => __( 'Select a Field', 'formidable' ),
3089 - 'no_items_found' => __( 'No items found.', 'formidable' ),
3090 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3091 - 'saving' => '', // Deprecated in 6.0.
3092 - 'saved' => '', // Deprecated in 6.0.
2556 + 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
2557 + 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
2558 + 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
2559 + 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
2560 + 'install' => __( 'Install', 'formidable' ),
2561 + 'active' => __( 'Active', 'formidable' ),
2562 + 'select_a_field' => __( 'Select a Field', 'formidable' ),
2563 + 'no_items_found' => __( 'No items found.', 'formidable' ),
3093 2564 );
3094 - /**
3095 - * @param array $admin_script_strings
3096 - */
3097 2565 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3098 2566
3099 2567 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
3100 - if ( ! $data ) {
2568 + if ( empty( $data ) ) {
3101 2569 wp_localize_script( 'formidable_admin', 'frm_admin_js', $admin_script_strings );
3102 2570 }
3103 2571 }
3104 2572 }
@@ -3103,46 +2571,8 @@
3103 2571 }
3104 2572 }
3105 2573
3106 2574 /**
3107 - * @since 6.5
3108 - *
3109 - * @return string
3110 - */
3111 - public static function get_ajax_url() {
3112 - $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
3113 -
3114 - /**
3115 - * @since 2.0.13
3116 - *
3117 - * @param string $ajax_url
3118 - */
3119 - return apply_filters( 'frm_ajax_url', $ajax_url );
3120 - }
3121 -
3122 - /**
3123 - * Returns whether or not the first errored input should be auto-focused (default true).
3124 - *
3125 - * @since 5.2.05
3126 - *
3127 - * @return bool
3128 - */
3129 - private static function should_focus_first_error() {
3130 - return (bool) apply_filters( 'frm_focus_first_error', true );
3131 - }
3132 -
3133 - /**
3134 - * Returns whether or not field errors should include role="alert" (default true).
3135 - *
3136 - * @since 5.2.05
3137 - *
3138 - * @return bool
3139 - */
3140 - public static function should_include_alert_role_on_field_errors() {
3141 - return (bool) apply_filters( 'frm_include_alert_role_on_field_errors', true );
3142 - }
3143 -
3144 - /**
3145 2575 * Echo the message on the plugins listing page
3146 2576 *
3147 2577 * @since 1.07.10
3148 2578 *
@@ -3165,10 +2595,8 @@
3165 2595 /**
3166 2596 * If Pro is far outdated, show a message.
3167 2597 *
3168 2598 * @since 4.0.01
3169 - *
3170 - * @return void
3171 2599 */
3172 2600 public static function min_pro_version_notice( $min_version ) {
3173 2601 if ( ! self::is_formidable_admin() ) {
3174 2602 // Don't show admin-wide.
@@ -3184,9 +2612,9 @@
3184 2612
3185 2613 $pro_version = FrmProDb::$plug_version;
3186 2614 $expired = FrmAddonsController::is_license_expired();
3187 2615 ?>
3188 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2616 + <div class="error frm_previous_install">
3189 2617 <?php
3190 2618 esc_html_e( 'You are running a version of Formidable Forms that may not be compatible with your version of Formidable Forms Pro.', 'formidable' );
3191 2619 if ( empty( $expired ) ) {
3192 2620 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3225,9 +2653,9 @@
3225 2653 }
3226 2654
3227 2655 foreach ( $message as $m ) {
3228 2656 ?>
3229 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2657 + <div class="error frm_previous_install">
3230 2658 <?php echo esc_html( $m ); ?>
3231 2659 </div>
3232 2660 <?php
3233 2661 }
@@ -3232,25 +2660,17 @@
3232 2660 <?php
3233 2661 }
3234 2662 }
3235 2663
3236 - /**
3237 - * @param string $type
3238 - * @return array<string,string>
3239 - */
3240 2664 public static function locales( $type = 'date' ) {
3241 2665 $locales = array(
3242 2666 'en' => __( 'English', 'formidable' ),
3243 2667 'af' => __( 'Afrikaans', 'formidable' ),
3244 2668 'sq' => __( 'Albanian', 'formidable' ),
3245 - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ),
3246 - 'am' => __( 'Amharic', 'formidable' ),
3247 2669 'ar' => __( 'Arabic', 'formidable' ),
3248 2670 'hy' => __( 'Armenian', 'formidable' ),
3249 2671 'az' => __( 'Azerbaijani', 'formidable' ),
3250 2672 'eu' => __( 'Basque', 'formidable' ),
3251 - 'be' => __( 'Belarusian', 'formidable' ),
3252 - 'bn' => __( 'Bengali', 'formidable' ),
3253 2673 'bs' => __( 'Bosnian', 'formidable' ),
3254 2674 'bg' => __( 'Bulgarian', 'formidable' ),
3255 2675 'ca' => __( 'Catalan', 'formidable' ),
3256 2676 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
@@ -3269,15 +2689,12 @@
3269 2689 'fi' => __( 'Finnish', 'formidable' ),
3270 2690 'fr' => __( 'French', 'formidable' ),
3271 2691 'fr-CA' => __( 'French/Canadian', 'formidable' ),
3272 2692 'fr-CH' => __( 'French/Swiss', 'formidable' ),
3273 - 'gl' => __( 'Galician', 'formidable' ),
3274 - 'ka' => __( 'Georgian', 'formidable' ),
3275 2693 'de' => __( 'German', 'formidable' ),
3276 2694 'de-AT' => __( 'German/Austria', 'formidable' ),
3277 2695 'de-CH' => __( 'German/Switzerland', 'formidable' ),
3278 2696 'el' => __( 'Greek', 'formidable' ),
3279 - 'gu' => __( 'Gujarati', 'formidable' ),
3280 2697 'he' => __( 'Hebrew', 'formidable' ),
3281 2698 'iw' => __( 'Hebrew', 'formidable' ),
3282 2699 'hi' => __( 'Hindi', 'formidable' ),
3283 2700 'hu' => __( 'Hungarian', 'formidable' ),
@@ -3284,84 +2701,52 @@
3284 2701 'is' => __( 'Icelandic', 'formidable' ),
3285 2702 'id' => __( 'Indonesian', 'formidable' ),
3286 2703 'it' => __( 'Italian', 'formidable' ),
3287 2704 'ja' => __( 'Japanese', 'formidable' ),
3288 - 'kn' => __( 'Kannada', 'formidable' ),
3289 - 'kk' => __( 'Kazakh', 'formidable' ),
3290 - 'km' => __( 'Khmer', 'formidable' ),
3291 2705 'ko' => __( 'Korean', 'formidable' ),
3292 - 'ky' => __( 'Kyrgyz', 'formidable' ),
3293 - 'lo' => __( 'Laothian', 'formidable' ),
3294 2706 'lv' => __( 'Latvian', 'formidable' ),
3295 2707 'lt' => __( 'Lithuanian', 'formidable' ),
3296 - 'lb' => __( 'Luxembourgish', 'formidable' ),
3297 - 'mk' => __( 'Macedonian', 'formidable' ),
3298 - 'ml' => __( 'Malayalam', 'formidable' ),
3299 2708 'ms' => __( 'Malaysian', 'formidable' ),
3300 - 'mr' => __( 'Marathi', 'formidable' ),
3301 2709 'no' => __( 'Norwegian', 'formidable' ),
3302 - 'nb' => __( 'Norwegian Bokmål', 'formidable' ),
3303 - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ),
3304 2710 'pl' => __( 'Polish', 'formidable' ),
3305 2711 'pt' => __( 'Portuguese', 'formidable' ),
3306 2712 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
3307 2713 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ),
3308 - 'rm' => __( 'Romansh', 'formidable' ),
3309 2714 'ro' => __( 'Romanian', 'formidable' ),
3310 2715 'ru' => __( 'Russian', 'formidable' ),
3311 2716 'sr' => __( 'Serbian', 'formidable' ),
3312 2717 'sr-SR' => __( 'Serbian', 'formidable' ),
3313 - 'si' => __( 'Sinhalese', 'formidable' ),
3314 2718 'sk' => __( 'Slovak', 'formidable' ),
3315 2719 'sl' => __( 'Slovenian', 'formidable' ),
3316 2720 'es' => __( 'Spanish', 'formidable' ),
3317 2721 'es-419' => __( 'Spanish/Latin America', 'formidable' ),
3318 - 'sw' => __( 'Swahili', 'formidable' ),
3319 2722 'sv' => __( 'Swedish', 'formidable' ),
3320 2723 'ta' => __( 'Tamil', 'formidable' ),
3321 - 'te' => __( 'Telugu', 'formidable' ),
3322 2724 'th' => __( 'Thai', 'formidable' ),
3323 - 'tj' => __( 'Tajiki', 'formidable' ),
3324 2725 'tr' => __( 'Turkish', 'formidable' ),
3325 2726 'uk' => __( 'Ukrainian', 'formidable' ),
3326 - 'ur' => __( 'Urdu', 'formidable' ),
3327 2727 'vi' => __( 'Vietnamese', 'formidable' ),
3328 - 'cy-GB' => __( 'Welsh', 'formidable' ),
3329 - 'zu' => __( 'Zulu', 'formidable' ),
3330 2728 );
3331 2729
3332 2730 if ( $type === 'captcha' ) {
3333 2731 // remove the languages unavailable for the captcha
3334 - $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' );
2732 + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
3335 2733 } else {
3336 2734 // remove the languages unavailable for the datepicker
3337 - $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419', 'mr', 'lo', 'kn', 'si', 'gu', 'bn', 'zu', 'ur', 'te', 'sw', 'am' );
2735 + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
3338 2736 }
3339 2737
3340 2738 $locales = array_diff_key( $locales, array_flip( $unset ) );
2739 + $locales = apply_filters( 'frm_locales', $locales );
3341 2740
3342 - /**
3343 - * Filter available locale options.
3344 - *
3345 - * @since 5.4.5 Added $args parameter with type.
3346 - *
3347 - * @param array<string,string> $locales
3348 - * @param array $args {
3349 - * @type string $type
3350 - * }
3351 - */
3352 - $locales = apply_filters( 'frm_locales', $locales, compact( 'type' ) );
3353 -
3354 2741 return $locales;
3355 2742 }
3356 2743
3357 2744 /**
3358 2745 * Output HTML containing reference text for accessibility
3359 - *
3360 - * @deprecated 5.1
3361 2746 */
3362 2747 public static function multiselect_accessibility() {
3363 - _deprecated_function( __METHOD__, '5.1' );
2748 + include_once self::plugin_path() . '/classes/views/frm-forms/multiselect-accessibility.php';
3364 2749 }
3365 2750
3366 2751 public static function get_menu_icon_class() {
3367 2752 if ( is_callable( 'FrmProAppHelper::get_settings' ) ) {
@@ -3575,9 +2960,9 @@
3575 2960 *
3576 2961 * @return bool true if the current user is allowed to save unfiltered HTML.
3577 2962 */
3578 2963 public static function allow_unfiltered_html() {
3579 - if ( self::should_never_allow_unfiltered_html() ) {
2964 + if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
3580 2965 return false;
3581 2966 }
3582 2967 return current_user_can( 'unfiltered_html' );
3583 2968 }
@@ -3582,28 +2967,8 @@
3582 2967 return current_user_can( 'unfiltered_html' );
3583 2968 }
3584 2969
3585 2970 /**
3586 - * @since 5.0.13
3587 - *
3588 - * @return bool
3589 - */
3590 - public static function should_never_allow_unfiltered_html() {
3591 - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
3592 - return true;
3593 - }
3594 -
3595 - /**
3596 - * Formidable will check DISALLOW_UNFILTERED_HTML to determine if some form HTML should be filtered or not.
3597 - * In many cases, scripts are added intentionally to forms and will not be stripped if DISALLOW_UNFILTERED_HTML is not set.
3598 - * It is also possible to filter Formidable without defining DISALLOW_UNFILTERED_HTML, with add_filter( 'frm_disallow_unfiltered_html', '__return_true' );
3599 - *
3600 - * @since 5.0.13
3601 - */
3602 - return apply_filters( 'frm_disallow_unfiltered_html', false );
3603 - }
3604 -
3605 - /**
3606 2971 * @since 5.0.07
3607 2972 *
3608 2973 * @param array $values
3609 2974 * @param array $keys
@@ -3625,379 +2990,230 @@
3625 2990 return $values;
3626 2991 }
3627 2992
3628 2993 /**
3629 - * Some back end fields allow privleged users to add scripts.
3630 - * A site that uses the DISALLOW_UNFILTERED_HTML always remove scripts on echo.
3631 - *
3632 - * @since 5.0.13
3633 - *
3634 - * @param string $value
3635 - * @param array|string $allowed 'all' for everything included as defaults
3636 - * @return string
2994 + * @since 4.07
2995 + * @deprecated 4.09.01
3637 2996 */
3638 - public static function maybe_kses( $value, $allowed = 'all' ) {
3639 - if ( self::should_never_allow_unfiltered_html() ) {
3640 - $value = self::kses( $value, $allowed );
2997 + public static function renewal_message() {
2998 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
2999 + FrmProAddonsController::renewal_message();
3000 + return;
3641 3001 }
3642 - return $value;
3002 +
3003 + if ( ! FrmAddonsController::is_license_expired() ) {
3004 + return;
3005 + }
3006 +
3007 + ?>
3008 + <div class="frm_error_style" style="text-align:left">
3009 + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
3010 + &nbsp;
3011 + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
3012 + <div style="float:right">
3013 + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
3014 + <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
3015 + </a>
3016 + </div>
3017 + </div>
3018 + <?php
3643 3019 }
3644 3020
3645 3021 /**
3646 - * @since 5.0.16
3647 - *
3648 - * @return bool
3022 + * @since 4.08
3023 + * @deprecated 4.09.01
3649 3024 */
3650 - public static function show_landing_pages() {
3651 - return self::show_new_feature( 'landing' );
3025 + public static function expiring_message() {
3026 + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3027 + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3028 + FrmProAddonsController::expiring_message();
3029 + }
3652 3030 }
3653 3031
3654 3032 /**
3655 - * @since 5.0.16
3033 + * Use the WP 4.7 wp_doing_ajax function
3656 3034 *
3657 - * @return array
3035 + * @since 2.05.07
3036 + * @deprecated 4.04.04
3658 3037 */
3659 - public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) {
3660 - $params = array(
3661 - 'medium' => $medium,
3662 - 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3663 - 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3664 - 'screenshot' => 'landing.png',
3665 - );
3666 - return self::get_upgrade_data_params( 'landing', $params );
3038 + public static function wp_doing_ajax() {
3039 + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3040 + return wp_doing_ajax();
3667 3041 }
3668 3042
3669 3043 /**
3670 - * @since 5.0.17
3671 - *
3672 - * @param string $plugin
3673 - * @return string|false
3044 + * @deprecated 4.0
3674 3045 */
3675 - private static function get_plan_required( $plugin ) {
3676 - $link = FrmAddonsController::install_link( $plugin );
3677 - return FrmFormsHelper::get_plan_required( $link );
3046 + public static function insert_opt_html( $args ) {
3047 + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3048 + FrmFormsHelper::insert_opt_html( $args );
3678 3049 }
3679 3050
3680 3051 /**
3681 - * @since 5.0.17
3052 + * Used to filter shortcode in text widgets
3682 3053 *
3683 - * @param string
3684 - * @return bool
3054 + * @deprecated 2.5.4
3055 + * @codeCoverageIgnore
3685 3056 */
3686 - public static function show_new_feature( $feature ) {
3687 - $link = FrmAddonsController::install_link( $feature );
3688 - return array_key_exists( 'status', $link ) || array_key_exists( 'class', $link );
3057 + public static function widget_text_filter_callback( $matches ) {
3058 + return FrmDeprecated::widget_text_filter_callback( $matches );
3689 3059 }
3690 3060
3691 3061 /**
3692 - * @since 5.0.17
3693 - *
3694 - * @param string $plugin
3695 - * @param array $params
3696 - * @return array
3062 + * @deprecated 3.01
3063 + * @codeCoverageIgnore
3697 3064 */
3698 - public static function get_upgrade_data_params( $plugin, $params ) {
3699 - $link = FrmAddonsController::install_link( $plugin );
3700 - if ( ! $link ) {
3701 - return $params;
3702 - }
3703 -
3704 - if ( ! empty( $link['url'] ) && self::pro_is_installed() ) {
3705 - $params['oneclick'] = json_encode( $link );
3706 - unset( $params['message'] );
3707 - if ( ! isset( $params['medium'] ) ) {
3708 - $params['medium'] = $plugin;
3709 - }
3710 - } else {
3711 - $params['requires'] = FrmFormsHelper::get_plan_required( $link );
3712 - }
3713 -
3714 - return $params;
3065 + public static function sanitize_array( &$values ) {
3066 + FrmDeprecated::sanitize_array( $values );
3715 3067 }
3716 3068
3717 3069 /**
3718 - * Returns true if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f], false otherwise.
3719 - * Not every server installs the ctype extension, so use a fallback if the function does not exist.
3070 + * @param array $settings
3071 + * @param string $group
3720 3072 *
3721 - * @since 5.0.17
3722 - *
3723 - * @param string $text
3724 - * @return bool
3073 + * @since 2.0.6
3074 + * @deprecated 2.05.06
3075 + * @codeCoverageIgnore
3725 3076 */
3726 - public static function ctype_xdigit( $text ) {
3727 - if ( function_exists( 'ctype_xdigit' ) ) {
3728 - return ctype_xdigit( $text );
3729 - }
3730 - return is_string( $text ) && '' !== $text && ! preg_match( '/[^A-Fa-f0-9]/', $text );
3077 + public static function save_settings( $settings, $group ) {
3078 + return FrmDeprecated::save_settings( $settings, $group );
3731 3079 }
3732 3080
3733 3081 /**
3734 - * Set the current screen to avoid undefined notices.
3735 - *
3736 - * @since 5.2.01
3082 + * @since 2.0.4
3083 + * @deprecated 2.05.06
3084 + * @codeCoverageIgnore
3737 3085 */
3738 - public static function set_current_screen_and_hook_suffix() {
3739 - global $hook_suffix;
3740 - if ( is_null( $hook_suffix ) ) {
3741 - // $hook_suffix gets used in substr so make sure it's not null. PHP 8.1 deprecates null in substr.
3742 - $hook_suffix = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
3743 - }
3744 - set_current_screen();
3086 + public static function save_json_post( $settings ) {
3087 + return FrmDeprecated::save_json_post( $settings );
3745 3088 }
3746 3089
3747 3090 /**
3748 - * Shows pill text.
3091 + * @since 2.0
3092 + * @deprecated 2.05.06
3093 + * @codeCoverageIgnore
3749 3094 *
3750 - * @since 5.2.02
3095 + * @param string $cache_key The unique name for this cache
3096 + * @param string $group The name of the cache group
3097 + * @param string $query If blank, don't run a db call
3098 + * @param string $type The wpdb function to use with this query
3751 3099 *
3752 - * @param string $text Text in the pill. Default is NEW.
3100 + * @return mixed $results The cache or query results
3753 3101 */
3754 - public static function show_pill_text( $text = null ) {
3755 - if ( null === $text ) {
3756 - $text = __( 'NEW', 'formidable' );
3757 - }
3758 - echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
3102 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3103 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3759 3104 }
3760 3105
3761 3106 /**
3762 - * Count the number of decimals digits.
3763 - *
3764 - * @since 5.2.07
3765 - *
3766 - * @param mixed $num Number.
3767 - * @return int|false Returns `false` if the passed parameter is not number.
3107 + * @deprecated 2.05.06
3108 + * @codeCoverageIgnore
3768 3109 */
3769 - public static function count_decimals( $num ) {
3770 - if ( ! is_numeric( $num ) ) {
3771 - return false;
3772 - }
3773 -
3774 - $num = (string) $num;
3775 - $parts = explode( '.', $num );
3776 - if ( 1 === count( $parts ) ) {
3777 - return 0;
3778 - }
3779 -
3780 - return strlen( $parts[ count( $parts ) - 1 ] );
3110 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3111 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3781 3112 }
3782 3113
3783 3114 /**
3784 - * Prevent a fatal error in PHP8 if gmt_offset happens to be set an empty string.
3785 - * This is a bug in WordPress. It isn't safe to call current_time( 'timestamp' ) without this with an empty string offset.
3786 - * In the future this might be safe to remove. Keep an eye on the current_time function in functions.php.
3787 - *
3788 - * @since 5.3.1
3789 - *
3790 - * @return void
3115 + * @deprecated 2.05.06
3116 + * @codeCoverageIgnore
3791 3117 */
3792 - public static function filter_gmt_offset() {
3793 - if ( self::$added_gmt_offset_filter ) {
3794 - // Avoid adding twice.
3795 - return;
3796 - }
3797 -
3798 - add_filter(
3799 - 'option_gmt_offset',
3800 - function( $offset ) {
3801 - if ( ! is_string( $offset ) || is_numeric( $offset ) ) {
3802 - // Leave a valid value alone.
3803 - return $offset;
3804 - }
3805 -
3806 - return 0;
3807 - }
3808 - );
3809 - self::$added_gmt_offset_filter = true;
3118 + public static function add_key_to_group_cache( $key, $group ) {
3119 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3810 3120 }
3811 3121
3812 3122 /**
3813 - * @since 5.3.1
3814 - *
3815 - * @return bool
3123 + * @deprecated 2.05.06
3124 + * @codeCoverageIgnore
3816 3125 */
3817 - public static function on_form_listing_page() {
3818 - if ( ! self::is_admin_page( 'formidable' ) ) {
3819 - return false;
3820 - }
3821 -
3822 - $action = self::simple_get( 'frm_action', 'sanitize_title' );
3823 - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true );
3126 + public static function get_group_cached_keys( $group ) {
3127 + return FrmDeprecated::get_group_cached_keys( $group );
3824 3128 }
3825 3129
3826 3130 /**
3827 - * Get all actions that also display the forms list.
3828 - *
3829 - * @since 5.3.1
3830 - *
3831 - * @return array<string>
3131 + * @since 2.0
3132 + * @deprecated 2.05.06
3133 + * @codeCoverageIgnore
3134 + * @return mixed The cached value or false
3832 3135 */
3833 - private static function get_form_listing_page_actions() {
3834 - return array( 'list', 'trash', 'untrash', 'destroy' );
3136 + public static function check_cache_and_transient( $cache_key ) {
3137 + return FrmDeprecated::check_cache( $cache_key );
3835 3138 }
3836 3139
3837 3140 /**
3838 - * Safely call get_plugins, importing the required files if they are not yet loaded.
3141 + * @since 2.0
3142 + * @deprecated 2.05.06
3143 + * @codeCoverageIgnore
3839 3144 *
3840 - * @since 5.5
3841 - *
3842 - * @return array
3145 + * @param string $cache_key
3843 3146 */
3844 - public static function get_plugins() {
3845 - if ( ! function_exists( 'get_plugins' ) ) {
3846 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
3847 - }
3848 - return get_plugins();
3147 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3148 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3849 3149 }
3850 3150
3851 3151 /**
3852 - * Make sure that the file we're trying to load is in fact the expected file type, and that it's coming from our S3 bucket.
3853 - * This is to make sure that the URL can't be exploited for a SSRF attack.
3152 + * @since 2.0
3153 + * @deprecated 2.05.06
3154 + * @codeCoverageIgnore
3854 3155 *
3855 - * @since 5.5.5
3856 - *
3857 - * @param string $url
3858 - * @param string $expected_extension
3859 - * @return bool
3156 + * @param string $group The name of the cache group
3860 3157 */
3861 - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) {
3862 - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' );
3863 - if ( ! $file_is_in_expected_s3_bucket ) {
3864 - return false;
3865 - }
3866 -
3867 - $parsed = parse_url( $url );
3868 - if ( ! is_array( $parsed ) ) {
3869 - // URL is malformed.
3870 - return false;
3871 - }
3872 -
3873 - $path = $parsed['path'];
3874 - $ext = pathinfo( $path, PATHINFO_EXTENSION );
3875 - if ( $expected_extension !== $ext ) {
3876 - // The URL isn't to an XML file.
3877 - return false;
3878 - }
3879 -
3880 - return true;
3158 + public static function cache_delete_group( $group ) {
3159 + FrmDeprecated::cache_delete_group( $group );
3881 3160 }
3882 3161
3883 3162 /**
3884 - * @since 4.08
3885 - * @deprecated 4.09.01
3163 + * @since 1.07.10
3164 + * @deprecated 2.05.06
3165 + * @codeCoverageIgnore
3166 + *
3167 + * @param string $term The value to escape
3168 + *
3169 + * @return string The escaped value
3886 3170 */
3887 - public static function expiring_message() {
3888 - _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3889 - if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3890 - FrmProAddonsController::expiring_message();
3891 - }
3171 + public static function esc_like( $term ) {
3172 + return FrmDeprecated::esc_like( $term );
3892 3173 }
3893 3174
3894 3175 /**
3895 - * Use the WP 4.7 wp_doing_ajax function
3176 + * @param string $order_query
3896 3177 *
3897 - * @since 2.05.07
3898 - * @deprecated 4.04.04
3178 + * @deprecated 2.05.06
3179 + * @codeCoverageIgnore
3899 3180 */
3900 - public static function wp_doing_ajax() {
3901 - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3902 - return wp_doing_ajax();
3181 + public static function esc_order( $order_query ) {
3182 + return FrmDeprecated::esc_order( $order_query );
3903 3183 }
3904 3184
3905 3185 /**
3906 - * @deprecated 4.0
3186 + * @deprecated 2.05.06
3187 + * @codeCoverageIgnore
3907 3188 */
3908 - public static function insert_opt_html( $args ) {
3909 - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3910 - FrmFormsHelper::insert_opt_html( $args );
3189 + public static function esc_order_by( &$order_by ) {
3190 + FrmDeprecated::esc_order_by( $order_by );
3911 3191 }
3912 3192
3913 3193 /**
3914 - * @deprecated 3.01
3194 + * @param string $limit
3195 + *
3196 + * @deprecated 2.05.06
3915 3197 * @codeCoverageIgnore
3916 3198 */
3917 - public static function sanitize_array( &$values ) {
3918 - FrmDeprecated::sanitize_array( $values );
3199 + public static function esc_limit( $limit ) {
3200 + return FrmDeprecated::esc_limit( $limit );
3919 3201 }
3920 3202
3921 3203 /**
3922 3204 * @since 2.0
3923 - * @deprecated 5.0.13
3924 - *
3925 - * @return string The base Google APIS url for the current version of jQuery UI
3205 + * @deprecated 2.05.06
3206 + * @codeCoverageIgnore
3926 3207 */
3927 - public static function jquery_ui_base_url() {
3928 - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3929 - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3208 + public static function prepare_array_values( $array, $type = '%s' ) {
3209 + return FrmDeprecated::prepare_array_values( $array, $type );
3930 3210 }
3931 3211
3932 3212 /**
3933 - * @since 4.07
3934 - * @deprecated 6.0
3213 + * @deprecated 2.05.06
3214 + * @codeCoverageIgnore
3935 3215 */
3936 - public static function renewal_message() {
3937 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3938 - }
3939 -
3940 - /**
3941 - * Display a dismissable warning message and save its dismissal state.
3942 - *
3943 - * @since 6.3
3944 - *
3945 - * @param string $message The warning message to display.
3946 - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action.
3947 - * @return void
3948 - */
3949 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3950 - if ( ! $message || ! $option ) {
3951 - return;
3952 - }
3953 -
3954 - $ajax_callback = function() use ( $option ) {
3955 - self::dismiss_warning_message( $option );
3956 - };
3957 -
3958 - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action.
3959 - // To prevent any issues, we add 'frm_' from the beginning of the action.
3960 - add_action( 'wp_ajax_frm_' . $option, $ajax_callback );
3961 -
3962 - add_filter(
3963 - 'frm_message_list',
3964 - function( $show_messages ) use ( $message, $option ) {
3965 - if ( get_option( $option, false ) ) {
3966 - return $show_messages;
3967 - }
3968 -
3969 - $dismiss_icon = self::icon_by_class(
3970 - 'frmfont frm_close_icon',
3971 - array(
3972 - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ),
3973 - 'echo' => false,
3974 - )
3975 - );
3976 -
3977 - $show_messages[] = $message;
3978 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3979 -
3980 - return $show_messages;
3981 - }
3982 - );
3983 - }
3984 -
3985 - /**
3986 - * Dismiss a warning message and update the dismissal state.
3987 - *
3988 - * @since 6.3
3989 - *
3990 - * @param string $option The unique identifier for the dismissal state of the message.
3991 - * @return void
3992 - */
3993 - public static function dismiss_warning_message( $option = '' ) {
3994 - self::permission_check( 'frm_change_settings' );
3995 - check_ajax_referer( 'frm_ajax', 'nonce' );
3996 -
3997 - if ( $option ) {
3998 - update_option( $option, true, 'no' );
3999 - }
4000 -
4001 - wp_send_json_success();
3216 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3217 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
4002 3218 }
4003 3219 }