PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.01
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.01
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 +339 -1364 6.5.25.0.01 View file →
@@ -3,21 +3,16 @@
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 13 */
19 - public static $plug_version = '6.5.2';
14 + public static $plug_version = '5.0.01';
20 15
21 16 /**
22 17 * @since 1.07.02
23 18 *
@@ -148,28 +143,12 @@
148 143
149 144 public static function get_menu_name() {
150 145 $frm_settings = self::get_settings();
151 146
152 - return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu;
147 + return $frm_settings->menu;
153 148 }
154 149
155 150 /**
156 - * Determine if the current branding is set to 'formidable'.
157 - *
158 - * Checks the menu title, retrieved through get_menu_name,
159 - * and verifies if it matches the 'formidable' branding.
160 - *
161 - * @since 6.4.2
162 - *
163 - * @return bool True if the menu title is 'formidable', false otherwise.
164 - */
165 - public static function is_formidable_branding() {
166 - $menu_title = self::get_menu_name();
167 -
168 - return 'formidable' === strtolower( trim( $menu_title ) );
169 - }
170 -
171 - /**
172 151 * @since 3.05
173 152 */
174 153 public static function svg_logo( $atts = array() ) {
175 154 $defaults = array(
@@ -189,9 +168,9 @@
189 168 /**
190 169 * @since 4.0
191 170 */
192 171 public static function show_logo( $atts = array() ) {
193 - 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.
194 173 }
195 174
196 175 /**
197 176 * @since 4.03.02
@@ -212,9 +191,9 @@
212 191 // Show nothing if it isn't an SVG.
213 192 $icon = '<div style="height:39px"></div>';
214 193 }
215 194 }
216 - echo self::kses( $icon, 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
195 + echo self::kses( $icon, 'all' ); // WPCS: XSS ok.
217 196 }
218 197
219 198 /**
220 199 * @since 2.02.04
@@ -268,15 +247,15 @@
268 247 global $pagenow;
269 248 $get_page = self::simple_get( 'page', 'sanitize_title' );
270 249 if ( $pagenow ) {
271 250 // allow this to be true during ajax load i.e. ajax form builder loading
272 - $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;
273 252 if ( $is_page ) {
274 253 return true;
275 254 }
276 255 }
277 256
278 - return is_admin() && $get_page === $page;
257 + return is_admin() && $get_page == $page;
279 258 }
280 259
281 260 /**
282 261 * If the current page is for editing or creating a view.
@@ -348,18 +327,14 @@
348 327 * Check if on an admin page
349 328 *
350 329 * @since 2.0
351 330 *
331 + * @param None
332 + *
352 333 * @return boolean
353 334 */
354 335 public static function is_admin() {
355 - $is_admin = is_admin() && ! wp_doing_ajax();
356 -
357 - /**
358 - * @since 6.0
359 - * @param bool $is_admin
360 - */
361 - return apply_filters( 'frm_is_admin', $is_admin );
336 + return is_admin() && ! wp_doing_ajax();
362 337 }
363 338
364 339 /**
365 340 * Check if value contains blank value or empty array
@@ -392,37 +367,26 @@
392 367 return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
393 368 }
394 369
395 370 /**
396 - * Get the server OS
371 + * Check for the IP address in several places
372 + * Used by [ip] shortcode
397 373 *
398 - * @since 6.4.2
399 - *
400 - * @return string
401 - */
402 - public static function get_server_os() {
403 - if ( function_exists( 'php_uname' ) ) {
404 - return php_uname( 's' );
405 - }
406 -
407 - if ( ! defined( 'PHP_OS' ) ) {
408 - return '';
409 - }
410 -
411 - // match the same response for Windows server as php_uname('s')
412 - return in_array( PHP_OS, array( 'WIN32', 'WINNT', 'Windows_NT' ), true ) ? 'Windows NT' : PHP_OS;
413 - }
414 -
415 - /**
416 - * Check for the IP address in several places (when custom headers are enabled).
417 - * Used by [ip] shortcode.
418 - *
419 374 * @return string The IP address of the current user
420 375 */
421 376 public static function get_ip_address() {
422 - $ip_options = self::should_use_custom_header_ip() ? self::get_custom_header_keys_for_ip() : array( 'REMOTE_ADDR' );
423 - $ip = '';
424 -
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 = '';
425 389 foreach ( $ip_options as $key ) {
426 390 if ( ! isset( $_SERVER[ $key ] ) ) {
427 391 continue;
428 392 }
@@ -428,9 +392,9 @@
428 392 }
429 393
430 394 $key = self::get_server_value( $key );
431 395 foreach ( explode( ',', $key ) as $ip ) {
432 - $ip = trim( $ip ); // Just to be safe.
396 + $ip = trim( $ip ); // just to be safe.
433 397
434 398 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
435 399 return sanitize_text_field( $ip );
436 400 }
@@ -439,52 +403,8 @@
439 403
440 404 return sanitize_text_field( $ip );
441 405 }
442 406
443 - /**
444 - * @since 6.1
445 - *
446 - * @return array
447 - */
448 - public static function get_custom_header_keys_for_ip() {
449 - return array(
450 - 'HTTP_CLIENT_IP',
451 - 'HTTP_CF_CONNECTING_IP',
452 - 'HTTP_X_FORWARDED_FOR',
453 - 'HTTP_X_FORWARDED',
454 - 'HTTP_X_CLUSTER_CLIENT_IP',
455 - 'HTTP_X_REAL_IP',
456 - 'HTTP_FORWARDED_FOR',
457 - 'HTTP_FORWARDED',
458 - 'REMOTE_ADDR',
459 - );
460 - }
461 -
462 - /**
463 - * Check if we should check every HTTP header or just $_SERVER['REMOTE_ADDR'].
464 - * The other HTTP headers can be spoofed so this isn't recommended.
465 - * But in some cases (like reverse proxies), the IP may be empty if you use $_SERVER['REMOTE_ADDR'].
466 - *
467 - * @since 6.1
468 - *
469 - * @return bool
470 - */
471 - private static function should_use_custom_header_ip() {
472 - $settings = self::get_settings();
473 - $should_use_custom_header_ip = ! $settings->no_ips && $settings->custom_header_ip;
474 -
475 - /**
476 - * Filter whether to check spoofable HTTP headers.
477 - * This uses the custom_header_ip setting, but it is hidden if the GDPR option is also on.
478 - * 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.
479 - *
480 - * @since 6.1
481 - *
482 - * @param bool $should_use_custom_header_ip
483 - */
484 - return apply_filters( 'frm_use_custom_header_ip', $should_use_custom_header_ip );
485 - }
486 -
487 407 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
488 408 if ( strpos( $param, '[' ) ) {
489 409 $params = explode( '[', $param );
490 410 $param = $params[0];
@@ -489,11 +409,12 @@
489 409 $params = explode( '[', $param );
490 410 $param = $params[0];
491 411 }
492 412
493 - if ( $src === 'get' ) {
494 - $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
495 - 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 ) ) {
496 417 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
497 418 $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) );
498 419 }
499 420 self::sanitize_value( $sanitize, $value );
@@ -573,16 +494,16 @@
573 494 );
574 495 $args = wp_parse_args( $args, $defaults );
575 496
576 497 $value = $args['default'];
577 - if ( $args['type'] === 'get' ) {
498 + if ( $args['type'] == 'get' ) {
578 499 if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
579 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
500 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
580 501 $value = wp_unslash( $_GET[ $args['param'] ] );
581 502 }
582 - } elseif ( $args['type'] === 'post' ) {
583 - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
584 - // 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
585 506 $value = wp_unslash( $_POST[ $args['param'] ] );
586 507 if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
587 508 self::unserialize_or_decode( $value );
588 509 }
@@ -587,9 +508,9 @@
587 508 self::unserialize_or_decode( $value );
588 509 }
589 510 }
590 511 } else {
591 - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
512 + if ( isset( $_REQUEST[ $args['param'] ] ) ) {
592 513 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
593 514 $value = wp_unslash( $_REQUEST[ $args['param'] ] );
594 515 }
595 516 }
@@ -724,80 +645,14 @@
724 645 return wp_kses( $value, $allowed_html );
725 646 }
726 647
727 648 /**
728 - * The regular kses function strips [button_action] from submit button HTML.
729 - *
730 - * @since 5.0.13
731 - *
732 - * @param string $html
733 - * @return string
734 - */
735 - public static function kses_submit_button( $html ) {
736 - $included_button_action = false !== strpos( $html, '[button_action]' );
737 - $included_back_hook = false !== strpos( $html, '[back_hook]' );
738 - $included_draft_hook = false !== strpos( $html, '[draft_hook]' );
739 - add_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' );
740 - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' );
741 - $html = self::kses( $html, 'all' );
742 - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' );
743 - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' );
744 - if ( $included_button_action ) {
745 - if ( false !== strpos( $html, '<input type="submit"' ) ) {
746 - $pattern = '/(<input type="submit")([^>]*)(\/>)/';
747 - $html = preg_replace( $pattern, '$1$2[button_action] $3', $html, 1 );
748 - } else {
749 - $pattern = '/(<button)(.*)(class=")(.*)(frm_button_submit)(.*)(")(.*)([^>]+)(>)/';
750 - $html = preg_replace( $pattern, '$1$2$3$4$5$6$7 [button_action]$8$9$10', $html, 1 );
751 - }
752 - }
753 - if ( $included_back_hook ) {
754 - $html = str_replace( 'class="frm_prev_page"', 'class="frm_prev_page" [back_hook]', $html );
755 - }
756 - if ( $included_draft_hook ) {
757 - $html = str_replace( 'class="frm_save_draft"', 'class="frm_save_draft" [draft_hook]', $html );
758 - }
759 - return $html;
760 - }
761 -
762 - /**
763 - * @since 5.0.13
764 - *
765 - * @param array $allowed_attr
766 - * @return array
767 - */
768 - public static function allow_visibility_style( $allowed_attr ) {
769 - $allowed_attr[] = 'visibility';
770 - return $allowed_attr;
771 - }
772 -
773 - /**
774 - * @since 5.0.13
775 - *
776 - * @param array $allowed_html
777 - * @return array
778 - */
779 - public static function add_allowed_submit_button_tags( $allowed_html ) {
780 - $allowed_html['input'] = array(
781 - 'type' => true,
782 - 'value' => true,
783 - 'formnovalidate' => true,
784 - 'name' => true,
785 - 'class' => true,
786 - );
787 - $allowed_html['button']['formnovalidate'] = true;
788 - $allowed_html['button']['name'] = true;
789 - $allowed_html['img']['style'] = true;
790 - return $allowed_html;
791 - }
792 -
793 - /**
794 649 * @since 2.05.03
795 650 */
796 651 private static function allowed_html( $allowed ) {
797 652 $html = self::safe_html();
798 653 $allowed_html = array();
799 - if ( $allowed === 'all' ) {
654 + if ( $allowed == 'all' ) {
800 655 $allowed_html = $html;
801 656 } elseif ( ! empty( $allowed ) ) {
802 657 foreach ( (array) $allowed as $a ) {
803 658 $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
@@ -816,16 +671,15 @@
816 671 'id' => true,
817 672 );
818 673
819 674 return array(
820 - 'a' => array(
821 - 'class' => true,
822 - 'href' => true,
823 - 'id' => true,
824 - 'rel' => true,
825 - 'target' => true,
826 - 'title' => true,
827 - 'tabindex' => true,
675 + 'a' => array(
676 + 'class' => true,
677 + 'href' => true,
678 + 'id' => true,
679 + 'rel' => true,
680 + 'target' => true,
681 + 'title' => true,
828 682 ),
829 683 'abbr' => array(
830 684 'title' => true,
831 685 ),
@@ -849,9 +703,8 @@
849 703 'class' => true,
850 704 'id' => true,
851 705 'title' => true,
852 706 'style' => true,
853 - 'role' => true,
854 707 ),
855 708 'dl' => array(),
856 709 'dt' => array(),
857 710 'em' => array(),
@@ -900,13 +753,12 @@
900 753 'stroke-width' => true,
901 754 ),
902 755 'section' => $allow_class,
903 756 'span' => array(
904 - 'class' => true,
905 - 'id' => true,
906 - 'title' => true,
907 - 'style' => true,
908 - 'aria-hidden' => true,
757 + 'class' => true,
758 + 'id' => true,
759 + 'title' => true,
760 + 'style' => true,
909 761 ),
910 762 'strike' => array(),
911 763 'strong' => array(),
912 764 'symbol' => array(
@@ -914,36 +766,22 @@
914 766 'id' => true,
915 767 'viewbox' => true,
916 768 ),
917 769 'svg' => array(
918 - 'class' => true,
919 - 'id' => true,
920 - 'xmlns' => true,
921 - 'viewbox' => true,
922 - 'width' => true,
923 - 'height' => true,
924 - 'style' => true,
925 - 'fill' => true,
926 - 'aria-label' => true,
927 - 'aria-hidden' => true,
770 + 'class' => true,
771 + 'id' => true,
772 + 'xmlns' => true,
773 + 'viewbox' => true,
774 + 'width' => true,
775 + 'height' => true,
776 + 'style' => true,
777 + 'fill' => true,
928 778 ),
929 779 'use' => array(
930 - 'href' => true,
780 + 'href' => true,
931 781 'xlink:href' => true,
932 782 ),
933 783 'ul' => $allow_class,
934 - 'label' => array(
935 - 'for' => true,
936 - 'class' => true,
937 - 'id' => true,
938 - ),
939 - 'button' => array(
940 - 'class' => true,
941 - 'type' => true,
942 - ),
943 - 'legend' => array(
944 - 'class' => true,
945 - ),
946 784 );
947 785 }
948 786
949 787 /**
@@ -1001,18 +839,8 @@
1001 839
1002 840 $html_atts = self::array_to_html_params( $atts );
1003 841
1004 842 $icon = trim( str_replace( array( 'frm_icon_font', 'frmfont ' ), '', $class ) );
1005 -
1006 - // Replace icons that have been removed.
1007 - $deprecated = array(
1008 - 'frm_clone_solid_icon' => 'frm_clone_icon',
1009 - );
1010 - if ( isset( $deprecated[ $icon ] ) ) {
1011 - $icon = $deprecated[ $icon ];
1012 - $class = str_replace( $icon, $deprecated[ $icon ], $class );
1013 - }
1014 -
1015 843 if ( $icon === $class ) {
1016 844 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
1017 845 } else {
1018 846 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1019,15 +847,15 @@
1019 847 if ( strpos( $icon, ' ' ) ) {
1020 848 $icon = explode( ' ', $icon );
1021 849 $icon = reset( $icon );
1022 850 }
1023 - $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '>
851 + $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '>
1024 852 <use xlink:href="#' . esc_attr( $icon ) . '" />
1025 853 </svg>';
1026 854 }
1027 855
1028 856 if ( $echo ) {
1029 - echo self::kses_icon( $icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
857 + echo $icon; // WPCS: XSS ok.
1030 858 } else {
1031 859 return $icon;
1032 860 }
1033 861 }
@@ -1032,88 +860,14 @@
1032 860 }
1033 861 }
1034 862
1035 863 /**
1036 - * Run kses for icons. It needs to add a few filters first in order to preserve some custom style values.
1037 - *
1038 - * @since 5.0.13
1039 - *
1040 - * @param string $icon
1041 - * @return string
1042 - */
1043 - public static function kses_icon( $icon ) {
1044 - add_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' );
1045 - add_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style', 10, 2 );
1046 - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' );
1047 - $icon = self::kses( $icon, 'all' );
1048 - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' );
1049 - remove_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style' );
1050 - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' );
1051 - return $icon;
1052 - }
1053 -
1054 - /**
1055 - * @since 5.0.13.1
1056 - *
1057 - * @param array $allowed_html
1058 - * @return array
1059 - */
1060 - public static function add_allowed_icon_tags( $allowed_html ) {
1061 - $allowed_html['svg']['data-open'] = true;
1062 - $allowed_html['svg']['title'] = true;
1063 - return $allowed_html;
1064 - }
1065 -
1066 - /**
1067 - * @since 5.0.13
1068 - *
1069 - * @param array $allowed_attr
1070 - * @return array
1071 - */
1072 - public static function allow_vars_in_styles( $allowed_attr ) {
1073 - $allowed_attr[] = '--primary-700';
1074 - return $allowed_attr;
1075 - }
1076 -
1077 - /**
1078 - * @since 5.0.13
1079 - *
1080 - * @param bool $allow_css
1081 - * @param string $css_string
1082 - */
1083 - public static function allow_style( $allow_css, $css_string ) {
1084 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
1085 - $split = explode( ':', $css_string, 2 );
1086 - $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1087 - }
1088 - return $allow_css;
1089 - }
1090 -
1091 - /**
1092 - * @since 5.0.13
1093 - *
1094 - * @param string $value
1095 - * @return bool
1096 - */
1097 - private static function is_a_valid_color( $value ) {
1098 - $match = 0;
1099 - if ( 0 === strpos( $value, 'rgba(' ) ) {
1100 - $match = preg_match( '/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/', $value );
1101 - } elseif ( 0 === strpos( $value, 'rgb(' ) ) {
1102 - $match = preg_match( '/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/', $value );
1103 - } elseif ( 0 === strpos( $value, '#' ) ) {
1104 - $match = preg_match( '/^#([a-f0-9]{6}|[a-f0-9]{3})\b$/', $value );
1105 - }
1106 - return (bool) $match;
1107 - }
1108 -
1109 - /**
1110 864 * Include svg images.
1111 865 *
1112 866 * @since 4.0.02
1113 867 */
1114 868 public static function include_svg() {
1115 - include_once self::plugin_path() . '/images/icons.svg';
869 + include_once( self::plugin_path() . '/images/icons.svg' );
1116 870 }
1117 871
1118 872 /**
1119 873 * Convert an associative array to HTML values.
@@ -1118,48 +872,19 @@
1118 872 /**
1119 873 * Convert an associative array to HTML values.
1120 874 *
1121 875 * @since 4.0.02
1122 - * @since 5.0.13 added $echo parameter.
1123 - *
1124 876 * @param array $atts
1125 - * @param bool $echo
1126 - * @return string|void
877 + * @return string
1127 878 */
1128 - public static function array_to_html_params( $atts, $echo = false ) {
1129 - $callback = function() use ( $atts ) {
1130 - if ( $atts ) {
1131 - foreach ( $atts as $key => $value ) {
1132 - echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
1133 - }
879 + public static function array_to_html_params( $atts ) {
880 + $html = '';
881 + if ( ! empty( $atts ) ) {
882 + foreach ( $atts as $key => $value ) {
883 + $html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
1134 884 }
1135 - };
1136 - return self::clip( $callback, $echo );
1137 - }
1138 -
1139 - /**
1140 - * Call an echo function and either echo it or return the result as a string.
1141 - *
1142 - * @since 5.0.13
1143 - *
1144 - * @param Closure $echo_function
1145 - * @param bool $echo
1146 - * @return string|void
1147 - */
1148 - public static function clip( $echo_function, $echo = false ) {
1149 - if ( ! $echo ) {
1150 - ob_start();
1151 885 }
1152 -
1153 - if ( is_callable( $echo_function ) ) {
1154 - $echo_function();
1155 - }
1156 -
1157 - if ( ! $echo ) {
1158 - $return = ob_get_contents();
1159 - ob_end_clean();
1160 - return $return;
1161 - }
886 + return $html;
1162 887 }
1163 888
1164 889 /**
1165 890 * @since 3.0
@@ -1176,94 +901,31 @@
1176 901 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1177 902 }
1178 903
1179 904 /**
1180 - * @since 6.0
1181 - *
1182 - * @param string $type
1183 - * @return void
1184 - */
1185 - public static function import_link( $type = 'secondary' ) {
1186 - ?>
1187 - <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">
1188 - <?php esc_html_e( 'Import', 'formidable' ); ?>
1189 - </a>
1190 - <?php
1191 - }
1192 -
1193 - /**
1194 - * Print applicable admin banner.
1195 - *
1196 - * @since 5.4.2
1197 - *
1198 - * @param bool $should_show_lite_upgrade
1199 - * @return void
1200 - */
1201 - public static function print_admin_banner( $should_show_lite_upgrade ) {
1202 - if ( ! current_user_can( 'administrator' ) ) {
1203 - FrmInbox::maybe_show_banner();
1204 - return;
1205 - }
1206 -
1207 - if ( self::maybe_show_license_warning() || FrmInbox::maybe_show_banner() || ! $should_show_lite_upgrade || self::pro_is_installed() ) {
1208 - // Print license warning or inbox banner and exit if either prints.
1209 - // And exit before printing the upgrade bar if it shouldn't be shown.
1210 - return;
1211 - }
1212 - ?>
1213 - <div class="frm-upgrade-bar">
1214 - <span>You're using Formidable Forms Lite. To unlock more features consider</span>
1215 - <a href="<?php echo esc_url( self::admin_upgrade_link( 'top-bar' ) ); ?>" target="_blank" rel="noopener">upgrading to Pro</a>.
1216 - </div>
1217 - <?php
1218 - }
1219 -
1220 - /**
1221 - * @since 5.4.2
1222 - *
1223 - * @return bool True if a banner is available and shown.
1224 - */
1225 - private static function maybe_show_license_warning() {
1226 - return is_callable( 'FrmProAddonsController::admin_banner' ) && FrmProAddonsController::admin_banner();
1227 - }
1228 -
1229 - /**
1230 - * Render a button for a new item (Form, Application, etc).
1231 - *
1232 905 * @since 3.0
1233 - * @param array $atts {
1234 - * @type array $link_hook Custom link hook, calls do_action and exits early.
1235 - * @type string $new_link Href value, default #.
1236 - * @type string $class Custom class names, space separated.
1237 - * @type string $button_text Button text. Default "Add New".
1238 - * }
1239 - * @return void
906 + * @param array $atts
1240 907 */
1241 908 public static function add_new_item_link( $atts ) {
1242 - if ( isset( $atts['link_hook'] ) ) {
909 + if ( ! empty( $atts['new_link'] ) ) {
910 + ?>
911 + <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus">
912 + <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?>
913 + <?php esc_html_e( 'Add New', 'formidable' ); ?>
914 + </a>
915 + <?php
916 + } elseif ( ! empty( $atts['trigger_new_form_modal'] ) ) {
917 + ?>
918 + <a href="#" class="button button-primary frm-button-primary frm-with-plus frm-trigger-new-form-modal">
919 + <?php
920 + self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' );
921 + esc_html_e( 'Add New', 'formidable' );
922 + ?>
923 + </a>
924 + <?php
925 + } elseif ( isset( $atts['link_hook'] ) ) {
1243 926 do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1244 - return;
1245 927 }
1246 -
1247 - if ( empty( $atts['new_link'] ) && empty( $atts['trigger_new_form_modal'] ) && empty( $atts['class'] ) ) {
1248 - // Do not render a button if none of these attributes are set.
1249 - return;
1250 - }
1251 -
1252 - $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1253 - $class = 'button button-primary frm-button-primary';
1254 -
1255 - if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1256 - $class .= ' frm-trigger-new-form-modal';
1257 - }
1258 -
1259 - if ( ! empty( $atts['class'] ) ) {
1260 - $class .= ' ' . $atts['class'];
1261 - }
1262 -
1263 - $button_text = ! empty( $atts['button_text'] ) ? $atts['button_text'] : __( 'Add New', 'formidable' );
1264 -
1265 - require self::plugin_path() . '/classes/views/shared/add-button.php';
1266 928 }
1267 929
1268 930 /**
1269 931 * @since 3.06
@@ -1321,14 +983,11 @@
1321 983 }
1322 984 }
1323 985
1324 986 /**
1325 - * Save all front-end js scripts into a single file.
1326 - * And save an additional single file of all front-end Stripe JS scripts.
987 + * Save all front-end js scripts into a single file
1327 988 *
1328 989 * @since 3.0
1329 - *
1330 - * @return void
1331 990 */
1332 991 public static function save_combined_js() {
1333 992 $file_atts = apply_filters(
1334 993 'frm_js_location',
@@ -1339,36 +998,13 @@
1339 998 );
1340 999 $new_file = new FrmCreateFile( $file_atts );
1341 1000
1342 1001 $files = array(
1002 + self::plugin_path() . '/js/jquery/jquery.placeholder.min.js',
1343 1003 self::plugin_path() . '/js/formidable.min.js',
1344 1004 );
1345 - /**
1346 - * @param array $files
1347 - */
1348 1005 $files = apply_filters( 'frm_combined_js_files', $files );
1349 1006 $new_file->combine_files( $files );
1350 -
1351 - // Create the minified Stripe Script.
1352 - $file_atts = apply_filters(
1353 - 'frm_stripe_js_location',
1354 - array(
1355 - 'file_name' => 'frmstrp.min.js',
1356 - 'new_file_path' => self::plugin_path() . '/js',
1357 - )
1358 - );
1359 - $new_file = new FrmCreateFile( $file_atts );
1360 - $files = array(
1361 - FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js',
1362 - );
1363 -
1364 - /**
1365 - * @since 6.5
1366 - *
1367 - * @param array $files
1368 - */
1369 - $files = apply_filters( 'frm_stripe_combined_js_files', $files );
1370 - $new_file->combine_files( $files );
1371 1007 }
1372 1008
1373 1009 /**
1374 1010 * Check a value from a shortcode to see if true or false.
@@ -1385,9 +1021,8 @@
1385 1021 }
1386 1022
1387 1023 /**
1388 1024 * Gets all post from a specific post type.
1389 - * 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.
1390 1025 *
1391 1026 * @since 4.10.01 Add `$post_type` argument.
1392 1027 *
1393 1028 * @param string $post_type Post type to query. Default is `page`.
@@ -1405,30 +1040,8 @@
1405 1040 return get_posts( $query );
1406 1041 }
1407 1042
1408 1043 /**
1409 - * Gets post ids and titles for a specific post type.
1410 - *
1411 - * @since 5.0.09
1412 - *
1413 - * @param string $post_type Post type to query. Default is `page`.
1414 - * @return array
1415 - */
1416 - public static function get_post_ids_and_titles( $post_type = 'page' ) {
1417 - return FrmDb::get_results(
1418 - 'posts',
1419 - array(
1420 - 'post_type' => $post_type,
1421 - 'post_status' => array( 'publish', 'private' ),
1422 - ),
1423 - 'ID, post_title',
1424 - array(
1425 - 'order_by' => 'post_title ASC',
1426 - )
1427 - );
1428 - }
1429 -
1430 - /**
1431 1044 * Renders an autocomplete page selection or a regular dropdown depending on
1432 1045 * the total page count
1433 1046 *
1434 1047 * @since 4.03.06
@@ -1473,9 +1086,9 @@
1473 1086 */
1474 1087 public static function wp_pages_dropdown( $args = array(), $page_id = '', $truncate = false ) {
1475 1088 self::prep_page_dropdown_params( $page_id, $truncate, $args );
1476 1089
1477 - $pages = self::get_post_ids_and_titles( $args['post_type'] );
1090 + $pages = self::get_pages( $args['post_type'] );
1478 1091 $selected = self::get_post_param( $args['field_name'], $args['page_id'], 'absint' );
1479 1092
1480 1093 ?>
1481 1094 <select name="<?php echo esc_attr( $args['field_name'] ); ?>" id="<?php echo esc_attr( $args['field_name'] ); ?>" class="frm-pages-dropdown">
@@ -1529,8 +1142,9 @@
1529 1142 public static function post_edit_link( $post_id ) {
1530 1143 $post = get_post( $post_id );
1531 1144 if ( $post ) {
1532 1145 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1146 + $post_url = self::maybe_full_screen_link( $post_url );
1533 1147
1534 1148 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1535 1149 }
1536 1150
@@ -1540,64 +1154,25 @@
1540 1154 /**
1541 1155 * Hide the WordPress menus on some pages.
1542 1156 *
1543 1157 * @since 4.0
1544 - *
1545 - * @return bool
1546 1158 */
1547 1159 public static function is_full_screen() {
1548 - return self::is_form_builder_page() ||
1549 - self::is_style_editor_page() ||
1550 - self::is_full_screen_view_builder_page();
1551 - }
1160 + $full_builder = self::is_form_builder_page();
1161 + $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' );
1162 + $full_entries = self::simple_get( 'frm-full', 'absint' );
1552 1163
1553 - /**
1554 - * Check if user is on the style editor or its alternative URL.
1555 - * The first URL is a submenu "Styles" in the Formidable menu /wp-admin/admin.php?page=formidable-styles.
1556 - * The alternative URL is linked as a submenu "Forms" item of the Appearance menu /wp-admin/themes.php?page=formidable-styles2.
1557 - *
1558 - * @since 5.5.3
1559 - * @since 6.0 Added the $view parameter. Previously there was only a 'edit' view.
1560 - *
1561 - * @param string $view Supports 'edit', 'list', and ''. If '', both 'edit' and 'list' will match.
1562 - * @return bool
1563 - */
1564 - public static function is_style_editor_page( $view = '' ) {
1565 - if ( ! self::is_admin_page( 'formidable-styles' ) && ! self::is_admin_page( 'formidable-styles2' ) ) {
1566 - return false;
1567 - }
1568 -
1569 - if ( ! in_array( $view, array( 'list', 'edit' ), true ) ) {
1570 - return true;
1571 - }
1572 -
1573 - $action = self::simple_get( 'frm_action' );
1574 - $is_edit_mode = 'edit' === $action || ( ! $action && ! self::simple_get( 'id' ) && ! self::simple_get( 'form' ) );
1575 -
1576 - if ( ! $is_edit_mode && class_exists( 'FrmProStylesController' ) && in_array( $action, array( 'new_style', 'duplicate' ), true ) ) {
1577 - $is_edit_mode = true;
1578 - }
1579 -
1580 - $checking_for_edit_mode = 'edit' === $view;
1581 -
1582 - return $is_edit_mode === $checking_for_edit_mode;
1164 + return $full_builder || $full_entries || $styler || self::is_view_builder_page();
1583 1165 }
1584 1166
1585 1167 /**
1586 - * @since 5.5.3
1587 - *
1588 - * @return bool
1589 - */
1590 - private static function is_full_screen_view_builder_page() {
1591 - return self::is_admin_page( 'formidable-views-editor' );
1592 - }
1593 -
1594 - /**
1595 1168 * @since 4.0
1596 - * @deprecated 5.5.3
1597 1169 */
1598 1170 public static function maybe_full_screen_link( $link ) {
1599 - _deprecated_function( __METHOD__, '5.5.3' );
1171 + $is_full = self::simple_get( 'frm-full', 'absint' );
1172 + if ( $is_full && ! empty( $link ) && $link !== '#' ) {
1173 + $link .= '&frm-full=1';
1174 + }
1600 1175 return $link;
1601 1176 }
1602 1177
1603 1178 /**
@@ -1657,10 +1232,19 @@
1657 1232 * @param string $type Supports `auto`, `pro`, or `pro_only`.
1658 1233 * @return array
1659 1234 */
1660 1235 public static function frm_capabilities( $type = 'auto' ) {
1661 - if ( ! self::pro_is_installed() && ! in_array( $type, array( 'pro', 'pro_only' ), true ) ) {
1662 - return self::get_lite_capabilities();
1236 + $cap = array(
1237 + 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1238 + 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1239 + 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1240 + 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1241 + 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1242 + 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1243 + );
1244 +
1245 + if ( ! self::pro_is_installed() && 'pro' !== $type && 'pro_only' !== $type ) {
1246 + return $cap;
1663 1247 }
1664 1248
1665 1249 $pro_cap = array(
1666 1250 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ),
@@ -1667,41 +1251,17 @@
1667 1251 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ),
1668 1252 'frm_view_reports' => __( 'View Reports', 'formidable' ),
1669 1253 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ),
1670 1254 );
1671 - /**
1672 - * @since 5.3.1
1673 - *
1674 - * @param array<string,string> $pro_cap
1675 - */
1676 - $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap );
1677 1255
1678 1256 if ( 'pro_only' === $type ) {
1679 1257 return $pro_cap;
1680 1258 }
1681 1259
1682 - return self::get_lite_capabilities() + $pro_cap;
1260 + return $cap + $pro_cap;
1683 1261 }
1684 1262
1685 1263 /**
1686 - * Get the list of lite plugin capabilities.
1687 - *
1688 - * @since 5.3.1
1689 - *
1690 - * @return array<string,string>
1691 - */
1692 - private static function get_lite_capabilities() {
1693 - return array(
1694 - 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1695 - 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1696 - 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1697 - 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1698 - 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1699 - 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1700 - );
1701 - }
1702 -
1703 - /**
1704 1264 * Call the WordPress current_user_can but also validate empty strings as true for any logged in user
1705 1265 *
1706 1266 * @since 4.06.03
1707 1267 *
@@ -1901,9 +1461,9 @@
1901 1461 foreach ( $array as $key => $value ) {
1902 1462 if ( is_array( $value ) ) {
1903 1463 $return = array_merge( $return, self::array_flatten( $value, $keys ) );
1904 1464 } else {
1905 - if ( $keys === 'keep' ) {
1465 + if ( $keys == 'keep' ) {
1906 1466 $return[ $key ] = $value;
1907 1467 } else {
1908 1468 $return[] = $value;
1909 1469 }
@@ -1946,8 +1506,19 @@
1946 1506 return $val;
1947 1507 }
1948 1508
1949 1509 /**
1510 + * @since 2.0
1511 + * @return string The base Google APIS url for the current version of jQuery UI
1512 + */
1513 + public static function jquery_ui_base_url() {
1514 + $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
1515 + $url = apply_filters( 'frm_jquery_ui_base_url', $url );
1516 +
1517 + return $url;
1518 + }
1519 +
1520 + /**
1950 1521 * @param string $handle
1951 1522 */
1952 1523 public static function script_version( $handle, $default = 0 ) {
1953 1524 global $wp_scripts;
@@ -1967,20 +1538,10 @@
1967 1538
1968 1539 return $ver;
1969 1540 }
1970 1541
1971 - /**
1972 - * @since 5.0.13 added $echo param.
1973 - *
1974 - * @param string $url
1975 - * @param bool $echo
1976 - * @return string|void
1977 - */
1978 - public static function js_redirect( $url, $echo = false ) {
1979 - $callback = function() use ( $url ) {
1980 - echo '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
1981 - };
1982 - return self::clip( $callback, $echo );
1542 + public static function js_redirect( $url ) {
1543 + return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
1983 1544 }
1984 1545
1985 1546 public static function get_user_id_param( $user_id ) {
1986 1547 if ( ! $user_id || is_numeric( $user_id ) ) {
@@ -1987,9 +1548,9 @@
1987 1548 return $user_id;
1988 1549 }
1989 1550
1990 1551 $user_id = sanitize_text_field( $user_id );
1991 - if ( $user_id === 'current' ) {
1552 + if ( $user_id == 'current' ) {
1992 1553 $user_id = get_current_user_id();
1993 1554 } else {
1994 1555 if ( is_email( $user_id ) ) {
1995 1556 $user = get_user_by( 'email', $user_id );
@@ -2039,38 +1600,21 @@
2039 1600 }
2040 1601
2041 1602 $key = self::prevent_numeric_and_reserved_keys( $key );
2042 1603
2043 - $similar_keys = FrmDb::get_col(
1604 + $key_check = FrmDb::get_var(
2044 1605 $table_name,
2045 1606 array(
2046 - $column . ' like%' => $key,
2047 - 'ID !' => $id,
1607 + $column => $key,
1608 + 'ID !' => $id,
2048 1609 ),
2049 1610 $column
2050 1611 );
2051 1612
2052 - // Create a unique field id if it has already been used.
2053 - if ( in_array( $key, $similar_keys, true ) ) {
1613 + if ( $key_check || is_numeric( $key_check ) ) {
2054 1614 $key = self::maybe_truncate_key_before_appending( $column, $key );
2055 -
2056 - /**
2057 - * Allow for a custom separator between the attempted key and the generated suffix.
2058 - *
2059 - * @since 5.2.03
2060 - *
2061 - * @param string $separator. Default empty.
2062 - * @param string $key the key without the added suffix.
2063 - */
2064 - $separator = apply_filters( 'frm_unique_' . $column . '_separator', '', $key );
2065 -
2066 - $suffix = 2;
2067 - do {
2068 - $key_check = $key . $separator . $suffix;
2069 - ++$suffix;
2070 - } while ( in_array( $key_check, $similar_keys, true ) );
2071 -
2072 - $key = $key_check;
1615 + // Create a unique field id if it has already been used.
1616 + $key = $key . substr( md5( microtime() . rand() ), 0, 10 );
2073 1617 }
2074 1618
2075 1619 return $key;
2076 1620 }
@@ -2087,11 +1631,8 @@
2087 1631 if ( in_array( $column, array( 'form_key', 'field_key' ), true ) ) {
2088 1632 $max_key_length_before_truncating = 60;
2089 1633 if ( strlen( $key ) > $max_key_length_before_truncating ) {
2090 1634 $key = substr( $key, 0, $max_key_length_before_truncating );
2091 - if ( is_numeric( $key ) ) {
2092 - $key .= 'a';
2093 - }
2094 1635 }
2095 1636 }
2096 1637 return $key;
2097 1638 }
@@ -2156,9 +1697,9 @@
2156 1697 return false;
2157 1698 }
2158 1699
2159 1700 if ( empty( $post_values ) ) {
2160 - $post_values = wp_unslash( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1701 + $post_values = wp_unslash( $_POST );
2161 1702 }
2162 1703
2163 1704 $values = array(
2164 1705 'id' => $record->id,
@@ -2176,11 +1717,11 @@
2176 1717 self::fill_form_opts( $record, $table, $post_values, $values );
2177 1718
2178 1719 self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
2179 1720
2180 - if ( $table === 'entries' ) {
1721 + if ( $table == 'entries' ) {
2181 1722 $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
2182 - } elseif ( $table === 'forms' ) {
1723 + } elseif ( $table == 'forms' ) {
2183 1724 $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
2184 1725 }
2185 1726
2186 1727 return $values;
@@ -2457,9 +1998,9 @@
2457 1998 *
2458 1999 * @return string $time_ago
2459 2000 */
2460 2001 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2461 - if ( empty( $to ) && 0 !== $to ) {
2002 + if ( empty( $to ) ) {
2462 2003 $now = new DateTime();
2463 2004 } else {
2464 2005 $now = new DateTime( '@' . $to );
2465 2006 }
@@ -2710,9 +2251,8 @@
2710 2251 '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' ),
2711 2252 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ),
2712 2253 /* translators: %1$s: Form name, %2$s: Date */
2713 2254 '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() ) ),
2714 - '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' ),
2715 2255 );
2716 2256
2717 2257 if ( ! isset( $tooltips[ $name ] ) ) {
2718 2258 return;
@@ -2739,12 +2279,8 @@
2739 2279 return;
2740 2280 }
2741 2281
2742 2282 $frm_action = self::simple_get( 'frm_action', 'sanitize_title' );
2743 - if ( 'lite-reports' === $frm_action ) {
2744 - $frm_action = 'reports';
2745 - }
2746 -
2747 2283 if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) {
2748 2284 echo ' class="current_page"';
2749 2285 }
2750 2286 }
@@ -2801,15 +2337,12 @@
2801 2337 }
2802 2338 }
2803 2339
2804 2340 /**
2805 - * Check for either json or serialized data. This is temporary while transitioning
2341 + * Check for either json or serilized data. This is temporary while transitioning
2806 2342 * all data to json.
2807 2343 *
2808 2344 * @since 4.02.03
2809 - *
2810 - * @param array|string $value
2811 - * @return void
2812 2345 */
2813 2346 public static function unserialize_or_decode( &$value ) {
2814 2347 if ( is_array( $value ) ) {
2815 2348 return;
@@ -2815,9 +2348,9 @@
2815 2348 return;
2816 2349 }
2817 2350
2818 2351 if ( is_serialized( $value ) ) {
2819 - $value = self::maybe_unserialize_array( $value );
2352 + $value = maybe_unserialize( $value );
2820 2353 } else {
2821 2354 $value = self::maybe_json_decode( $value, false );
2822 2355 }
2823 2356 }
@@ -2822,44 +2355,13 @@
2822 2355 }
2823 2356 }
2824 2357
2825 2358 /**
2826 - * Safely unserialize an array if necessary.
2827 - * This function doesn't actually use unserialize. The string is parsed instead.
2828 - *
2829 - * @since 6.2
2830 - *
2831 - * @param mixed $value
2832 - * @return mixed
2833 - */
2834 - public static function maybe_unserialize_array( $value ) {
2835 - if ( ! is_string( $value ) ) {
2836 - return $value;
2837 - }
2838 -
2839 - // Since we only expect an array, skip anything that doesn't start with a:.
2840 - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) {
2841 - return $value;
2842 - }
2843 -
2844 - $parsed = FrmSerializedStringParserHelper::get()->parse( $value );
2845 - if ( is_array( $parsed ) ) {
2846 - $value = $parsed;
2847 - }
2848 -
2849 - return $value;
2850 - }
2851 -
2852 - /**
2853 2359 * Decode a JSON string.
2854 2360 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2855 - *
2856 - * @param mixed $string
2857 - * @param bool $single_to_array
2858 - * @return mixed
2859 2361 */
2860 2362 public static function maybe_json_decode( $string, $single_to_array = true ) {
2861 - if ( is_array( $string ) || is_null( $string ) ) {
2363 + if ( is_array( $string ) ) {
2862 2364 return $string;
2863 2365 }
2864 2366
2865 2367 $new_string = json_decode( $string, true );
@@ -2877,36 +2379,8 @@
2877 2379 return $string;
2878 2380 }
2879 2381
2880 2382 /**
2881 - * @since 6.2.3
2882 - *
2883 - * @param string $value
2884 - * @return string
2885 - */
2886 - public static function maybe_utf8_encode( $value ) {
2887 - $from_format = 'ISO-8859-1';
2888 - $to_format = 'UTF-8';
2889 -
2890 - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) {
2891 - if ( mb_check_encoding( $value, $from_format ) ) {
2892 - return mb_convert_encoding( $value, $to_format, $from_format );
2893 - }
2894 - return $value;
2895 - }
2896 -
2897 - if ( function_exists( 'iconv' ) ) {
2898 - $converted = iconv( $from_format, $to_format, $value );
2899 - // Value is false if $value is not ISO-8859-1.
2900 - if ( false !== $converted ) {
2901 - return $converted;
2902 - }
2903 - }
2904 -
2905 - return $value;
2906 - }
2907 -
2908 - /**
2909 2383 * Reformat the json serialized array in name => value array.
2910 2384 *
2911 2385 * @since 4.02.03
2912 2386 */
@@ -2972,17 +2446,14 @@
2972 2446 $version = self::plugin_version();
2973 2447 wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
2974 2448
2975 2449 $global_strings = array(
2976 - 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2977 - 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2978 - 'url' => self::plugin_url(),
2979 - 'app_url' => 'https://formidableforms.com/',
2980 - 'applicationsUrl' => admin_url( 'admin.php?page=formidable-applications' ),
2981 - 'canAccessApplicationDashboard' => current_user_can( is_callable( 'FrmProApplicationsHelper::get_required_templates_capability' ) ? FrmProApplicationsHelper::get_required_templates_capability() : 'frm_edit_forms' ),
2982 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2983 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2984 - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ),
2450 + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2451 + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2452 + 'url' => self::plugin_url(),
2453 + 'app_url' => 'https://formidableforms.com/',
2454 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2455 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2985 2456 );
2986 2457 wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings );
2987 2458
2988 2459 if ( $load ) {
@@ -3002,89 +2473,87 @@
3002 2473 */
3003 2474 public static function localize_script( $location ) {
3004 2475 global $wp_scripts;
3005 2476
2477 + $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2478 + $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2479 +
3006 2480 $script_strings = array(
3007 - 'ajax_url' => esc_url_raw( self::get_ajax_url() ),
3008 - 'images_url' => self::plugin_url() . '/images',
3009 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
3010 - 'remove' => __( 'Remove', 'formidable' ),
3011 - 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
3012 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
3013 - 'id' => __( 'ID', 'formidable' ),
3014 - 'no_results' => __( 'No results match', 'formidable' ),
3015 - 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
3016 - 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
3017 - 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
3018 - 'focus_first_error' => self::should_focus_first_error(),
3019 - 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
2481 + 'ajax_url' => $ajax_url,
2482 + 'images_url' => self::plugin_url() . '/images',
2483 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2484 + 'remove' => __( 'Remove', 'formidable' ),
2485 + 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2486 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2487 + 'id' => __( 'ID', 'formidable' ),
2488 + 'no_results' => __( 'No results match', 'formidable' ),
2489 + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2490 + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2491 + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
3020 2492 );
3021 2493
3022 2494 $data = $wp_scripts->get_data( 'formidable', 'data' );
3023 - if ( ! $data ) {
2495 + if ( empty( $data ) ) {
3024 2496 wp_localize_script( 'formidable', 'frm_js', $script_strings );
3025 2497 }
3026 2498
3027 - if ( $location === 'admin' ) {
2499 + if ( $location == 'admin' ) {
3028 2500 $frm_settings = self::get_settings();
3029 2501 $admin_script_strings = array(
3030 - 'desc' => __( '(Click to add description)', 'formidable' ),
3031 - 'blank' => __( '(Blank)', 'formidable' ),
3032 - 'no_label' => __( '(no label)', 'formidable' ),
3033 - 'ok' => __( 'OK', 'formidable' ),
3034 - 'cancel' => __( 'Cancel', 'formidable' ),
3035 - 'default_label' => __( 'Default', 'formidable' ),
3036 - 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
3037 - 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
3038 - 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
3039 - 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
3040 - 'confirm' => __( 'Are you sure?', 'formidable' ),
3041 - 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
3042 - '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' ),
3043 - 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
3044 - 'default_unique' => $frm_settings->unique_msg,
3045 - 'default_conf' => __( 'The entered values do not match', 'formidable' ),
3046 - 'enter_email' => __( 'Enter Email', 'formidable' ),
3047 - 'confirm_email' => __( 'Confirm Email', 'formidable' ),
3048 - 'conditional_text' => __( 'Conditional content here', 'formidable' ),
3049 - 'new_option' => __( 'New Option', 'formidable' ),
3050 - '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' ),
3051 - 'enter_password' => __( 'Enter Password', 'formidable' ),
3052 - 'confirm_password' => __( 'Confirm Password', 'formidable' ),
3053 - 'import_complete' => __( 'Import Complete', 'formidable' ),
3054 - 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
3055 - 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
3056 - 'private_label' => __( 'Private', 'formidable' ),
3057 - 'jquery_ui_url' => '',
3058 - 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
3059 - 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
3060 - 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
3061 - 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
3062 - 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
3063 - 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
3064 - 'unsafe_params' => FrmFormsHelper::reserved_words(),
2502 + 'desc' => __( '(Click to add description)', 'formidable' ),
2503 + 'blank' => __( '(Blank)', 'formidable' ),
2504 + 'no_label' => __( '(no label)', 'formidable' ),
2505 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2506 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
2507 + 'ok' => __( 'OK', 'formidable' ),
2508 + 'cancel' => __( 'Cancel', 'formidable' ),
2509 + 'default_label' => __( 'Default', 'formidable' ),
2510 + 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
2511 + 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
2512 + 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
2513 + 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2514 + 'caution' => __( 'Heads up', 'formidable' ),
2515 + 'confirm' => __( 'Are you sure?', 'formidable' ),
2516 + 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
2517 + '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' ),
2518 + 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
2519 + 'default_unique' => $frm_settings->unique_msg,
2520 + 'default_conf' => __( 'The entered values do not match', 'formidable' ),
2521 + 'enter_email' => __( 'Enter Email', 'formidable' ),
2522 + 'confirm_email' => __( 'Confirm Email', 'formidable' ),
2523 + 'conditional_text' => __( 'Conditional content here', 'formidable' ),
2524 + 'new_option' => __( 'New Option', 'formidable' ),
2525 + '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' ),
2526 + 'enter_password' => __( 'Enter Password', 'formidable' ),
2527 + 'confirm_password' => __( 'Confirm Password', 'formidable' ),
2528 + 'import_complete' => __( 'Import Complete', 'formidable' ),
2529 + 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
2530 + 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
2531 + 'private_label' => __( 'Private', 'formidable' ),
2532 + 'jquery_ui_url' => self::jquery_ui_base_url(),
2533 + 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
2534 + 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
2535 + 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
2536 + 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
2537 + 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
2538 + 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
2539 + 'unsafe_params' => FrmFormsHelper::reserved_words(),
3065 2540 /* Translators: %s is the name of a Detail Page Slug that is a reserved word.*/
3066 - 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ),
2541 + 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ),
3067 2542 /* 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. */
3068 - 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
3069 - 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
3070 - 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
3071 - 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
3072 - 'install' => __( 'Install', 'formidable' ),
3073 - 'active' => __( 'Active', 'formidable' ),
3074 - 'select_a_field' => __( 'Select a Field', 'formidable' ),
3075 - 'no_items_found' => __( 'No items found.', 'formidable' ),
3076 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3077 - 'saving' => '', // Deprecated in 6.0.
3078 - 'saved' => '', // Deprecated in 6.0.
2543 + 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
2544 + 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
2545 + 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
2546 + 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
2547 + 'install' => __( 'Install', 'formidable' ),
2548 + 'active' => __( 'Active', 'formidable' ),
2549 + 'select_a_field' => __( 'Select a Field', 'formidable' ),
2550 + 'no_items_found' => __( 'No items found.', 'formidable' ),
3079 2551 );
3080 - /**
3081 - * @param array $admin_script_strings
3082 - */
3083 2552 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3084 2553
3085 2554 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
3086 - if ( ! $data ) {
2555 + if ( empty( $data ) ) {
3087 2556 wp_localize_script( 'formidable_admin', 'frm_admin_js', $admin_script_strings );
3088 2557 }
3089 2558 }
3090 2559 }
@@ -3089,46 +2558,8 @@
3089 2558 }
3090 2559 }
3091 2560
3092 2561 /**
3093 - * @since 6.5
3094 - *
3095 - * @return string
3096 - */
3097 - public static function get_ajax_url() {
3098 - $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
3099 -
3100 - /**
3101 - * @since 2.0.13
3102 - *
3103 - * @param string $ajax_url
3104 - */
3105 - return apply_filters( 'frm_ajax_url', $ajax_url );
3106 - }
3107 -
3108 - /**
3109 - * Returns whether or not the first errored input should be auto-focused (default true).
3110 - *
3111 - * @since 5.2.05
3112 - *
3113 - * @return bool
3114 - */
3115 - private static function should_focus_first_error() {
3116 - return (bool) apply_filters( 'frm_focus_first_error', true );
3117 - }
3118 -
3119 - /**
3120 - * Returns whether or not field errors should include role="alert" (default true).
3121 - *
3122 - * @since 5.2.05
3123 - *
3124 - * @return bool
3125 - */
3126 - public static function should_include_alert_role_on_field_errors() {
3127 - return (bool) apply_filters( 'frm_include_alert_role_on_field_errors', true );
3128 - }
3129 -
3130 - /**
3131 2562 * Echo the message on the plugins listing page
3132 2563 *
3133 2564 * @since 1.07.10
3134 2565 *
@@ -3151,10 +2582,8 @@
3151 2582 /**
3152 2583 * If Pro is far outdated, show a message.
3153 2584 *
3154 2585 * @since 4.0.01
3155 - *
3156 - * @return void
3157 2586 */
3158 2587 public static function min_pro_version_notice( $min_version ) {
3159 2588 if ( ! self::is_formidable_admin() ) {
3160 2589 // Don't show admin-wide.
@@ -3170,9 +2599,9 @@
3170 2599
3171 2600 $pro_version = FrmProDb::$plug_version;
3172 2601 $expired = FrmAddonsController::is_license_expired();
3173 2602 ?>
3174 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2603 + <div class="error frm_previous_install">
3175 2604 <?php
3176 2605 esc_html_e( 'You are running a version of Formidable Forms that may not be compatible with your version of Formidable Forms Pro.', 'formidable' );
3177 2606 if ( empty( $expired ) ) {
3178 2607 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3211,9 +2640,9 @@
3211 2640 }
3212 2641
3213 2642 foreach ( $message as $m ) {
3214 2643 ?>
3215 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2644 + <div class="error frm_previous_install">
3216 2645 <?php echo esc_html( $m ); ?>
3217 2646 </div>
3218 2647 <?php
3219 2648 }
@@ -3218,25 +2647,17 @@
3218 2647 <?php
3219 2648 }
3220 2649 }
3221 2650
3222 - /**
3223 - * @param string $type
3224 - * @return array<string,string>
3225 - */
3226 2651 public static function locales( $type = 'date' ) {
3227 2652 $locales = array(
3228 2653 'en' => __( 'English', 'formidable' ),
3229 2654 'af' => __( 'Afrikaans', 'formidable' ),
3230 2655 'sq' => __( 'Albanian', 'formidable' ),
3231 - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ),
3232 - 'am' => __( 'Amharic', 'formidable' ),
3233 2656 'ar' => __( 'Arabic', 'formidable' ),
3234 2657 'hy' => __( 'Armenian', 'formidable' ),
3235 2658 'az' => __( 'Azerbaijani', 'formidable' ),
3236 2659 'eu' => __( 'Basque', 'formidable' ),
3237 - 'be' => __( 'Belarusian', 'formidable' ),
3238 - 'bn' => __( 'Bengali', 'formidable' ),
3239 2660 'bs' => __( 'Bosnian', 'formidable' ),
3240 2661 'bg' => __( 'Bulgarian', 'formidable' ),
3241 2662 'ca' => __( 'Catalan', 'formidable' ),
3242 2663 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
@@ -3255,15 +2676,12 @@
3255 2676 'fi' => __( 'Finnish', 'formidable' ),
3256 2677 'fr' => __( 'French', 'formidable' ),
3257 2678 'fr-CA' => __( 'French/Canadian', 'formidable' ),
3258 2679 'fr-CH' => __( 'French/Swiss', 'formidable' ),
3259 - 'gl' => __( 'Galician', 'formidable' ),
3260 - 'ka' => __( 'Georgian', 'formidable' ),
3261 2680 'de' => __( 'German', 'formidable' ),
3262 2681 'de-AT' => __( 'German/Austria', 'formidable' ),
3263 2682 'de-CH' => __( 'German/Switzerland', 'formidable' ),
3264 2683 'el' => __( 'Greek', 'formidable' ),
3265 - 'gu' => __( 'Gujarati', 'formidable' ),
3266 2684 'he' => __( 'Hebrew', 'formidable' ),
3267 2685 'iw' => __( 'Hebrew', 'formidable' ),
3268 2686 'hi' => __( 'Hindi', 'formidable' ),
3269 2687 'hu' => __( 'Hungarian', 'formidable' ),
@@ -3270,720 +2688,277 @@
3270 2688 'is' => __( 'Icelandic', 'formidable' ),
3271 2689 'id' => __( 'Indonesian', 'formidable' ),
3272 2690 'it' => __( 'Italian', 'formidable' ),
3273 2691 'ja' => __( 'Japanese', 'formidable' ),
3274 - 'kn' => __( 'Kannada', 'formidable' ),
3275 - 'kk' => __( 'Kazakh', 'formidable' ),
3276 - 'km' => __( 'Khmer', 'formidable' ),
3277 2692 'ko' => __( 'Korean', 'formidable' ),
3278 - 'ky' => __( 'Kyrgyz', 'formidable' ),
3279 - 'lo' => __( 'Laothian', 'formidable' ),
3280 2693 'lv' => __( 'Latvian', 'formidable' ),
3281 2694 'lt' => __( 'Lithuanian', 'formidable' ),
3282 - 'lb' => __( 'Luxembourgish', 'formidable' ),
3283 - 'mk' => __( 'Macedonian', 'formidable' ),
3284 - 'ml' => __( 'Malayalam', 'formidable' ),
3285 2695 'ms' => __( 'Malaysian', 'formidable' ),
3286 - 'mr' => __( 'Marathi', 'formidable' ),
3287 2696 'no' => __( 'Norwegian', 'formidable' ),
3288 - 'nb' => __( 'Norwegian Bokmål', 'formidable' ),
3289 - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ),
3290 2697 'pl' => __( 'Polish', 'formidable' ),
3291 2698 'pt' => __( 'Portuguese', 'formidable' ),
3292 2699 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
3293 2700 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ),
3294 - 'rm' => __( 'Romansh', 'formidable' ),
3295 2701 'ro' => __( 'Romanian', 'formidable' ),
3296 2702 'ru' => __( 'Russian', 'formidable' ),
3297 2703 'sr' => __( 'Serbian', 'formidable' ),
3298 2704 'sr-SR' => __( 'Serbian', 'formidable' ),
3299 - 'si' => __( 'Sinhalese', 'formidable' ),
3300 2705 'sk' => __( 'Slovak', 'formidable' ),
3301 2706 'sl' => __( 'Slovenian', 'formidable' ),
3302 2707 'es' => __( 'Spanish', 'formidable' ),
3303 2708 'es-419' => __( 'Spanish/Latin America', 'formidable' ),
3304 - 'sw' => __( 'Swahili', 'formidable' ),
3305 2709 'sv' => __( 'Swedish', 'formidable' ),
3306 2710 'ta' => __( 'Tamil', 'formidable' ),
3307 - 'te' => __( 'Telugu', 'formidable' ),
3308 2711 'th' => __( 'Thai', 'formidable' ),
3309 - 'tj' => __( 'Tajiki', 'formidable' ),
3310 2712 'tr' => __( 'Turkish', 'formidable' ),
3311 - 'uk' => __( 'Ukrainian', 'formidable' ),
3312 - 'ur' => __( 'Urdu', 'formidable' ),
2713 + 'uk' => __( 'Ukranian', 'formidable' ),
3313 2714 'vi' => __( 'Vietnamese', 'formidable' ),
3314 - 'cy-GB' => __( 'Welsh', 'formidable' ),
3315 - 'zu' => __( 'Zulu', 'formidable' ),
3316 2715 );
3317 2716
3318 2717 if ( $type === 'captcha' ) {
3319 2718 // remove the languages unavailable for the captcha
3320 - $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' );
2719 + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
3321 2720 } else {
3322 2721 // remove the languages unavailable for the datepicker
3323 - $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' );
2722 + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
3324 2723 }
3325 2724
3326 2725 $locales = array_diff_key( $locales, array_flip( $unset ) );
2726 + $locales = apply_filters( 'frm_locales', $locales );
3327 2727
3328 - /**
3329 - * Filter available locale options.
3330 - *
3331 - * @since 5.4.5 Added $args parameter with type.
3332 - *
3333 - * @param array<string,string> $locales
3334 - * @param array $args {
3335 - * @type string $type
3336 - * }
3337 - */
3338 - $locales = apply_filters( 'frm_locales', $locales, compact( 'type' ) );
3339 -
3340 2728 return $locales;
3341 2729 }
3342 2730
3343 2731 /**
3344 2732 * Output HTML containing reference text for accessibility
3345 - *
3346 - * @deprecated 5.1
3347 2733 */
3348 2734 public static function multiselect_accessibility() {
3349 - _deprecated_function( __METHOD__, '5.1' );
2735 + include_once self::plugin_path() . '/classes/views/frm-forms/multiselect-accessibility.php';
3350 2736 }
3351 2737
3352 - public static function get_menu_icon_class() {
3353 - if ( is_callable( 'FrmProAppHelper::get_settings' ) ) {
3354 - $settings = FrmProAppHelper::get_settings();
3355 - if ( is_object( $settings ) && ! empty( $settings->menu_icon ) ) {
3356 - return $settings->menu_icon;
3357 - }
3358 - }
3359 - return 'frmfont frm_logo_icon';
3360 - }
3361 -
3362 2738 /**
3363 - * Shows the images dropdown.
3364 - *
3365 - * @since 5.0.04
3366 - *
3367 - * @param array $args {
3368 - * Arguments.
3369 - *
3370 - * @type string $selected Selected value.
3371 - * @type array[] $options Array of options with keys are option values and values are array.
3372 - * The option array contains `text`, `svg` and `custom_atts`.
3373 - * @type string $classes Custom CSS classes for the wrapper element.
3374 - * @type array $input_attrs Attributes of value input.
3375 - * }
2739 + * @since 4.07
2740 + * @deprecated 4.09.01
3376 2741 */
3377 - public static function images_dropdown( $args ) {
3378 - $args = self::fill_default_images_dropdown_args( $args );
3379 -
3380 - $input_attrs_str = self::get_images_dropdown_input_attrs( $args );
3381 - ob_start();
3382 - include self::plugin_path() . '/classes/views/shared/images-dropdown.php';
3383 - $output = ob_get_clean();
3384 -
3385 - /**
3386 - * Allows modifying the output of FrmAppHelper::images_dropdown() method.
3387 - *
3388 - * @since 5.0.04
3389 - *
3390 - * @param string $output The output.
3391 - * @param array $args Passed arguments.
3392 - */
3393 - echo apply_filters( 'frm_images_dropdown_output', $output, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3394 - }
3395 -
3396 - /**
3397 - * Fills the default images_dropdown() arguments.
3398 - *
3399 - * @since 5.0.04
3400 - *
3401 - * @param array $args The arguments.
3402 - * @return array
3403 - */
3404 - private static function fill_default_images_dropdown_args( $args ) {
3405 - $defaults = array(
3406 - 'selected' => '',
3407 - 'options' => array(),
3408 - 'classes' => '',
3409 - 'input_attrs' => array(),
3410 - );
3411 - $new_args = wp_parse_args( $args, $defaults );
3412 -
3413 - $new_args['options'] = (array) $new_args['options'];
3414 - $new_args['input_attrs'] = (array) $new_args['input_attrs'];
3415 -
3416 - // Set the number of columns.
3417 - $new_args['col_class'] = ceil( 12 / count( $new_args['options'] ) );
3418 - if ( $new_args['col_class'] > 6 ) {
3419 - $new_args['col_class'] = ceil( $new_args['col_class'] / 2 );
2742 + public static function renewal_message() {
2743 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
2744 + FrmProAddonsController::renewal_message();
2745 + return;
3420 2746 }
3421 2747
3422 - /**
3423 - * Allows modifying the arguments of images_dropdown() method.
3424 - *
3425 - * @since 5.0.04
3426 - *
3427 - * @param array $new_args Arguments after filling the defaults.
3428 - * @param array $args Arguments passed to the method, before filling the defaults.
3429 - */
3430 - return apply_filters( 'frm_images_dropdown_args', $new_args, $args );
3431 - }
3432 -
3433 - /**
3434 - * Gets HTML attributes of the input in images_dropdown() method.
3435 - *
3436 - * @since 5.0.04
3437 - *
3438 - * @param array $args The arguments.
3439 - * @return string
3440 - */
3441 - private static function get_images_dropdown_input_attrs( $args ) {
3442 - $input_attrs = $args['input_attrs'];
3443 - $input_attrs['type'] = 'radio';
3444 - $input_attrs['name'] = $args['name'];
3445 -
3446 - $input_attrs_str = '';
3447 - foreach ( $input_attrs as $key => $input_attr ) {
3448 - $input_attrs_str .= ' ' . sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $input_attr ) );
2748 + if ( ! FrmAddonsController::is_license_expired() ) {
2749 + return;
3449 2750 }
3450 2751
3451 - /**
3452 - * Allows modifying the HTML attributes of the input in images_dropdown() method.
3453 - *
3454 - * @since 5.0.04
3455 - *
3456 - * @param string $input_attrs_str HTML attributes string.
3457 - * @param array $args The arguments of images_dropdown() method.
3458 - */
3459 - return apply_filters( 'frm_images_dropdown_input_attrs', $input_attrs_str, $args );
2752 + ?>
2753 + <div class="frm_error_style" style="text-align:left">
2754 + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
2755 + &nbsp;
2756 + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
2757 + <div style="float:right">
2758 + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
2759 + <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
2760 + </a>
2761 + </div>
2762 + </div>
2763 + <?php
3460 2764 }
3461 2765
3462 2766 /**
3463 - * Gets the image of each option in images_dropdown() method.
3464 - *
3465 - * @since 5.0.04
3466 - *
3467 - * @param array $option Option data.
3468 - * @param array $args The arguments of images_dropdown() method.
3469 - * @return string
2767 + * @since 4.08
2768 + * @deprecated 4.09.01
3470 2769 */
3471 - private static function get_images_dropdown_option_image( $option, $args ) {
3472 - $image = self::icon_by_class(
3473 - 'frmfont ' . $option['svg'],
3474 - array(
3475 - 'echo' => false,
3476 - )
3477 - );
3478 -
3479 - $args['option'] = $option;
3480 -
3481 - /**
3482 - * Allows modifying the image of each option in images_dropdown() method.
3483 - *
3484 - * @since 5.0.04
3485 - *
3486 - * @param string $image The image HTML.
3487 - * @param array $args The arguments of images_dropdown() method, with `option` array is added.
3488 - */
3489 - return apply_filters( 'frm_images_dropdown_option_image', $image, $args );
3490 - }
3491 -
3492 - /**
3493 - * Gets the HTML classes of each option in images_dropdown() method.
3494 - *
3495 - * @since 5.0.04
3496 - *
3497 - * @param array $option Option data.
3498 - * @param array $args The arguments of images_dropdown() method.
3499 - * @return string
3500 - */
3501 - private static function get_images_dropdown_option_classes( $option, $args ) {
3502 - $classes = '';
3503 -
3504 - if ( ! empty( $option['custom_attrs']['class'] ) ) {
3505 - $classes .= ' ' . $option['custom_attrs']['class'];
2770 + public static function expiring_message() {
2771 + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
2772 + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
2773 + FrmProAddonsController::expiring_message();
3506 2774 }
3507 -
3508 - $args['option'] = $option;
3509 -
3510 - /**
3511 - * Allows modifying the CSS classes of each option in images_dropdown() method.
3512 - *
3513 - * @since 5.0.04
3514 - *
3515 - * @param string $classes CSS classes.
3516 - * @param array $args The arguments of images_dropdown() method, with `option` array is added.
3517 - */
3518 - return apply_filters( 'frm_images_dropdown_option_classes', $classes, $args );
3519 2775 }
3520 2776
3521 2777 /**
3522 - * Gets the custom HTML attributes of each option in images_dropdown() method.
2778 + * Use the WP 4.7 wp_doing_ajax function
3523 2779 *
3524 - * @since 5.0.04
3525 - *
3526 - * @param array $option Option data.
3527 - * @param array $args The arguments of images_dropdown() method.
3528 - * @return string
2780 + * @since 2.05.07
2781 + * @deprecated 4.04.04
3529 2782 */
3530 - private static function get_images_dropdown_option_html_attrs( $option, $args ) {
3531 - $html_attrs = '';
3532 - if ( ! empty( $option['custom_attrs'] ) && is_array( $option['custom_attrs'] ) ) {
3533 - $html_attrs_arr = array();
3534 -
3535 - foreach ( $option['custom_attrs'] as $key => $value ) {
3536 - if ( in_array( $key, array( 'type', 'class', 'data-value' ) ) ) {
3537 - continue;
3538 - }
3539 -
3540 - $html_attrs_arr[] = sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $value ) );
3541 - }
3542 -
3543 - $html_attrs = implode( ' ', $html_attrs_arr );
3544 - }
3545 -
3546 - $args['option'] = $option;
3547 -
3548 - /**
3549 - * Allows modifying the custom HTML attributes of each option in images_dropdown() method.
3550 - *
3551 - * @since 5.0.04
3552 - *
3553 - * @param string $html_attrs The HTML attributes string.
3554 - * @param array $args The arguments of images_dropdown() method, with `option` array is added.
3555 - */
3556 - return apply_filters( 'frm_images_dropdown_option_html_attrs', $html_attrs, $args );
2783 + public static function wp_doing_ajax() {
2784 + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
2785 + return wp_doing_ajax();
3557 2786 }
3558 2787
3559 2788 /**
3560 - * @since 5.0.07
3561 - *
3562 - * @return bool true if the current user is allowed to save unfiltered HTML.
2789 + * @deprecated 4.0
3563 2790 */
3564 - public static function allow_unfiltered_html() {
3565 - if ( self::should_never_allow_unfiltered_html() ) {
3566 - return false;
3567 - }
3568 - return current_user_can( 'unfiltered_html' );
2791 + public static function insert_opt_html( $args ) {
2792 + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
2793 + FrmFormsHelper::insert_opt_html( $args );
3569 2794 }
3570 2795
3571 2796 /**
3572 - * @since 5.0.13
2797 + * Used to filter shortcode in text widgets
3573 2798 *
3574 - * @return bool
2799 + * @deprecated 2.5.4
2800 + * @codeCoverageIgnore
3575 2801 */
3576 - public static function should_never_allow_unfiltered_html() {
3577 - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
3578 - return true;
3579 - }
3580 -
3581 - /**
3582 - * Formidable will check DISALLOW_UNFILTERED_HTML to determine if some form HTML should be filtered or not.
3583 - * In many cases, scripts are added intentionally to forms and will not be stripped if DISALLOW_UNFILTERED_HTML is not set.
3584 - * It is also possible to filter Formidable without defining DISALLOW_UNFILTERED_HTML, with add_filter( 'frm_disallow_unfiltered_html', '__return_true' );
3585 - *
3586 - * @since 5.0.13
3587 - */
3588 - return apply_filters( 'frm_disallow_unfiltered_html', false );
2802 + public static function widget_text_filter_callback( $matches ) {
2803 + return FrmDeprecated::widget_text_filter_callback( $matches );
3589 2804 }
3590 2805
3591 2806 /**
3592 - * @since 5.0.07
3593 - *
3594 - * @param array $values
3595 - * @param array $keys
3596 - * @return array
2807 + * @deprecated 3.01
2808 + * @codeCoverageIgnore
3597 2809 */
3598 - public static function maybe_filter_array( $values, $keys ) {
3599 - $allow_unfiltered_html = self::allow_unfiltered_html();
3600 -
3601 - if ( $allow_unfiltered_html ) {
3602 - return $values;
3603 - }
3604 -
3605 - foreach ( $keys as $key ) {
3606 - if ( isset( $values[ $key ] ) ) {
3607 - $values[ $key ] = self::kses( $values[ $key ], 'all' );
3608 - }
3609 - }
3610 -
3611 - return $values;
2810 + public static function sanitize_array( &$values ) {
2811 + FrmDeprecated::sanitize_array( $values );
3612 2812 }
3613 2813
3614 2814 /**
3615 - * Some back end fields allow privleged users to add scripts.
3616 - * A site that uses the DISALLOW_UNFILTERED_HTML always remove scripts on echo.
2815 + * @param array $settings
2816 + * @param string $group
3617 2817 *
3618 - * @since 5.0.13
3619 - *
3620 - * @param string $value
3621 - * @param array|string $allowed 'all' for everything included as defaults
3622 - * @return string
2818 + * @since 2.0.6
2819 + * @deprecated 2.05.06
2820 + * @codeCoverageIgnore
3623 2821 */
3624 - public static function maybe_kses( $value, $allowed = 'all' ) {
3625 - if ( self::should_never_allow_unfiltered_html() ) {
3626 - $value = self::kses( $value, $allowed );
3627 - }
3628 - return $value;
2822 + public static function save_settings( $settings, $group ) {
2823 + return FrmDeprecated::save_settings( $settings, $group );
3629 2824 }
3630 2825
3631 2826 /**
3632 - * @since 5.0.16
3633 - *
3634 - * @return bool
2827 + * @since 2.0.4
2828 + * @deprecated 2.05.06
2829 + * @codeCoverageIgnore
3635 2830 */
3636 - public static function show_landing_pages() {
3637 - return self::show_new_feature( 'landing' );
2831 + public static function save_json_post( $settings ) {
2832 + return FrmDeprecated::save_json_post( $settings );
3638 2833 }
3639 2834
3640 2835 /**
3641 - * @since 5.0.16
2836 + * @since 2.0
2837 + * @deprecated 2.05.06
2838 + * @codeCoverageIgnore
3642 2839 *
3643 - * @return array
3644 - */
3645 - public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) {
3646 - $params = array(
3647 - 'medium' => $medium,
3648 - 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3649 - 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3650 - 'screenshot' => 'landing.png',
3651 - );
3652 - return self::get_upgrade_data_params( 'landing', $params );
3653 - }
3654 -
3655 - /**
3656 - * @since 5.0.17
2840 + * @param string $cache_key The unique name for this cache
2841 + * @param string $group The name of the cache group
2842 + * @param string $query If blank, don't run a db call
2843 + * @param string $type The wpdb function to use with this query
3657 2844 *
3658 - * @param string $plugin
3659 - * @return string|false
2845 + * @return mixed $results The cache or query results
3660 2846 */
3661 - private static function get_plan_required( $plugin ) {
3662 - $link = FrmAddonsController::install_link( $plugin );
3663 - return FrmFormsHelper::get_plan_required( $link );
2847 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
2848 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3664 2849 }
3665 2850
3666 2851 /**
3667 - * @since 5.0.17
3668 - *
3669 - * @param string
3670 - * @return bool
2852 + * @deprecated 2.05.06
2853 + * @codeCoverageIgnore
3671 2854 */
3672 - public static function show_new_feature( $feature ) {
3673 - $link = FrmAddonsController::install_link( $feature );
3674 - return array_key_exists( 'status', $link ) || array_key_exists( 'class', $link );
2855 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
2856 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3675 2857 }
3676 2858
3677 2859 /**
3678 - * @since 5.0.17
3679 - *
3680 - * @param string $plugin
3681 - * @param array $params
3682 - * @return array
2860 + * @deprecated 2.05.06
2861 + * @codeCoverageIgnore
3683 2862 */
3684 - public static function get_upgrade_data_params( $plugin, $params ) {
3685 - $link = FrmAddonsController::install_link( $plugin );
3686 - if ( ! $link ) {
3687 - return $params;
3688 - }
3689 -
3690 - if ( ! empty( $link['url'] ) && self::pro_is_installed() ) {
3691 - $params['oneclick'] = json_encode( $link );
3692 - unset( $params['message'] );
3693 - if ( ! isset( $params['medium'] ) ) {
3694 - $params['medium'] = $plugin;
3695 - }
3696 - } else {
3697 - $params['requires'] = FrmFormsHelper::get_plan_required( $link );
3698 - }
3699 -
3700 - return $params;
2863 + public static function add_key_to_group_cache( $key, $group ) {
2864 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3701 2865 }
3702 2866
3703 2867 /**
3704 - * 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.
3705 - * Not every server installs the ctype extension, so use a fallback if the function does not exist.
3706 - *
3707 - * @since 5.0.17
3708 - *
3709 - * @param string $text
3710 - * @return bool
2868 + * @deprecated 2.05.06
2869 + * @codeCoverageIgnore
3711 2870 */
3712 - public static function ctype_xdigit( $text ) {
3713 - if ( function_exists( 'ctype_xdigit' ) ) {
3714 - return ctype_xdigit( $text );
3715 - }
3716 - return is_string( $text ) && '' !== $text && ! preg_match( '/[^A-Fa-f0-9]/', $text );
2871 + public static function get_group_cached_keys( $group ) {
2872 + return FrmDeprecated::get_group_cached_keys( $group );
3717 2873 }
3718 2874
3719 2875 /**
3720 - * Set the current screen to avoid undefined notices.
3721 - *
3722 - * @since 5.2.01
2876 + * @since 2.0
2877 + * @deprecated 2.05.06
2878 + * @codeCoverageIgnore
2879 + * @return mixed The cached value or false
3723 2880 */
3724 - public static function set_current_screen_and_hook_suffix() {
3725 - global $hook_suffix;
3726 - if ( is_null( $hook_suffix ) ) {
3727 - // $hook_suffix gets used in substr so make sure it's not null. PHP 8.1 deprecates null in substr.
3728 - $hook_suffix = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
3729 - }
3730 - set_current_screen();
2881 + public static function check_cache_and_transient( $cache_key ) {
2882 + return FrmDeprecated::check_cache( $cache_key );
3731 2883 }
3732 2884
3733 2885 /**
3734 - * Shows pill text.
2886 + * @since 2.0
2887 + * @deprecated 2.05.06
2888 + * @codeCoverageIgnore
3735 2889 *
3736 - * @since 5.2.02
3737 - *
3738 - * @param string $text Text in the pill. Default is NEW.
2890 + * @param string $cache_key
3739 2891 */
3740 - public static function show_pill_text( $text = null ) {
3741 - if ( null === $text ) {
3742 - $text = __( 'NEW', 'formidable' );
3743 - }
3744 - echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
2892 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
2893 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3745 2894 }
3746 2895
3747 2896 /**
3748 - * Count the number of decimals digits.
2897 + * @since 2.0
2898 + * @deprecated 2.05.06
2899 + * @codeCoverageIgnore
3749 2900 *
3750 - * @since 5.2.07
3751 - *
3752 - * @param mixed $num Number.
3753 - * @return int|false Returns `false` if the passed parameter is not number.
2901 + * @param string $group The name of the cache group
3754 2902 */
3755 - public static function count_decimals( $num ) {
3756 - if ( ! is_numeric( $num ) ) {
3757 - return false;
3758 - }
3759 -
3760 - $num = (string) $num;
3761 - $parts = explode( '.', $num );
3762 - if ( 1 === count( $parts ) ) {
3763 - return 0;
3764 - }
3765 -
3766 - return strlen( $parts[ count( $parts ) - 1 ] );
2903 + public static function cache_delete_group( $group ) {
2904 + FrmDeprecated::cache_delete_group( $group );
3767 2905 }
3768 2906
3769 2907 /**
3770 - * Prevent a fatal error in PHP8 if gmt_offset happens to be set an empty string.
3771 - * This is a bug in WordPress. It isn't safe to call current_time( 'timestamp' ) without this with an empty string offset.
3772 - * In the future this might be safe to remove. Keep an eye on the current_time function in functions.php.
2908 + * @since 1.07.10
2909 + * @deprecated 2.05.06
2910 + * @codeCoverageIgnore
3773 2911 *
3774 - * @since 5.3.1
2912 + * @param string $term The value to escape
3775 2913 *
3776 - * @return void
2914 + * @return string The escaped value
3777 2915 */
3778 - public static function filter_gmt_offset() {
3779 - if ( self::$added_gmt_offset_filter ) {
3780 - // Avoid adding twice.
3781 - return;
3782 - }
3783 -
3784 - add_filter(
3785 - 'option_gmt_offset',
3786 - function( $offset ) {
3787 - if ( ! is_string( $offset ) || is_numeric( $offset ) ) {
3788 - // Leave a valid value alone.
3789 - return $offset;
3790 - }
3791 -
3792 - return 0;
3793 - }
3794 - );
3795 - self::$added_gmt_offset_filter = true;
2916 + public static function esc_like( $term ) {
2917 + return FrmDeprecated::esc_like( $term );
3796 2918 }
3797 2919
3798 2920 /**
3799 - * @since 5.3.1
2921 + * @param string $order_query
3800 2922 *
3801 - * @return bool
2923 + * @deprecated 2.05.06
2924 + * @codeCoverageIgnore
3802 2925 */
3803 - public static function on_form_listing_page() {
3804 - if ( ! self::is_admin_page( 'formidable' ) ) {
3805 - return false;
3806 - }
3807 -
3808 - $action = self::simple_get( 'frm_action', 'sanitize_title' );
3809 - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true );
2926 + public static function esc_order( $order_query ) {
2927 + return FrmDeprecated::esc_order( $order_query );
3810 2928 }
3811 2929
3812 2930 /**
3813 - * Get all actions that also display the forms list.
3814 - *
3815 - * @since 5.3.1
3816 - *
3817 - * @return array<string>
2931 + * @deprecated 2.05.06
2932 + * @codeCoverageIgnore
3818 2933 */
3819 - private static function get_form_listing_page_actions() {
3820 - return array( 'list', 'trash', 'untrash', 'destroy' );
2934 + public static function esc_order_by( &$order_by ) {
2935 + FrmDeprecated::esc_order_by( $order_by );
3821 2936 }
3822 2937
3823 2938 /**
3824 - * Safely call get_plugins, importing the required files if they are not yet loaded.
2939 + * @param string $limit
3825 2940 *
3826 - * @since 5.5
3827 - *
3828 - * @return array
3829 - */
3830 - public static function get_plugins() {
3831 - if ( ! function_exists( 'get_plugins' ) ) {
3832 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
3833 - }
3834 - return get_plugins();
3835 - }
3836 -
3837 - /**
3838 - * 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.
3839 - * This is to make sure that the URL can't be exploited for a SSRF attack.
3840 - *
3841 - * @since 5.5.5
3842 - *
3843 - * @param string $url
3844 - * @param string $expected_extension
3845 - * @return bool
3846 - */
3847 - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) {
3848 - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' );
3849 - if ( ! $file_is_in_expected_s3_bucket ) {
3850 - return false;
3851 - }
3852 -
3853 - $parsed = parse_url( $url );
3854 - if ( ! is_array( $parsed ) ) {
3855 - // URL is malformed.
3856 - return false;
3857 - }
3858 -
3859 - $path = $parsed['path'];
3860 - $ext = pathinfo( $path, PATHINFO_EXTENSION );
3861 - if ( $expected_extension !== $ext ) {
3862 - // The URL isn't to an XML file.
3863 - return false;
3864 - }
3865 -
3866 - return true;
3867 - }
3868 -
3869 - /**
3870 - * @since 4.08
3871 - * @deprecated 4.09.01
3872 - */
3873 - public static function expiring_message() {
3874 - _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3875 - if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3876 - FrmProAddonsController::expiring_message();
3877 - }
3878 - }
3879 -
3880 - /**
3881 - * Use the WP 4.7 wp_doing_ajax function
3882 - *
3883 - * @since 2.05.07
3884 - * @deprecated 4.04.04
3885 - */
3886 - public static function wp_doing_ajax() {
3887 - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3888 - return wp_doing_ajax();
3889 - }
3890 -
3891 - /**
3892 - * @deprecated 4.0
3893 - */
3894 - public static function insert_opt_html( $args ) {
3895 - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3896 - FrmFormsHelper::insert_opt_html( $args );
3897 - }
3898 -
3899 - /**
3900 - * @deprecated 3.01
2941 + * @deprecated 2.05.06
3901 2942 * @codeCoverageIgnore
3902 2943 */
3903 - public static function sanitize_array( &$values ) {
3904 - FrmDeprecated::sanitize_array( $values );
2944 + public static function esc_limit( $limit ) {
2945 + return FrmDeprecated::esc_limit( $limit );
3905 2946 }
3906 2947
3907 2948 /**
3908 2949 * @since 2.0
3909 - * @deprecated 5.0.13
3910 - *
3911 - * @return string The base Google APIS url for the current version of jQuery UI
2950 + * @deprecated 2.05.06
2951 + * @codeCoverageIgnore
3912 2952 */
3913 - public static function jquery_ui_base_url() {
3914 - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3915 - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
2953 + public static function prepare_array_values( $array, $type = '%s' ) {
2954 + return FrmDeprecated::prepare_array_values( $array, $type );
3916 2955 }
3917 2956
3918 2957 /**
3919 - * @since 4.07
3920 - * @deprecated 6.0
2958 + * @deprecated 2.05.06
2959 + * @codeCoverageIgnore
3921 2960 */
3922 - public static function renewal_message() {
3923 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3924 - }
3925 -
3926 - /**
3927 - * Display a dismissable warning message and save its dismissal state.
3928 - *
3929 - * @since 6.3
3930 - *
3931 - * @param string $message The warning message to display.
3932 - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action.
3933 - * @return void
3934 - */
3935 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3936 - if ( ! $message || ! $option ) {
3937 - return;
3938 - }
3939 -
3940 - $ajax_callback = function() use ( $option ) {
3941 - self::dismiss_warning_message( $option );
3942 - };
3943 -
3944 - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action.
3945 - // To prevent any issues, we add 'frm_' from the beginning of the action.
3946 - add_action( 'wp_ajax_frm_' . $option, $ajax_callback );
3947 -
3948 - add_filter(
3949 - 'frm_message_list',
3950 - function( $show_messages ) use ( $message, $option ) {
3951 - if ( get_option( $option, false ) ) {
3952 - return $show_messages;
3953 - }
3954 -
3955 - $dismiss_icon = self::icon_by_class(
3956 - 'frmfont frm_close_icon',
3957 - array(
3958 - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ),
3959 - 'echo' => false,
3960 - )
3961 - );
3962 -
3963 - $show_messages[] = $message;
3964 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3965 -
3966 - return $show_messages;
3967 - }
3968 - );
3969 - }
3970 -
3971 - /**
3972 - * Dismiss a warning message and update the dismissal state.
3973 - *
3974 - * @since 6.3
3975 - *
3976 - * @param string $option The unique identifier for the dismissal state of the message.
3977 - * @return void
3978 - */
3979 - public static function dismiss_warning_message( $option = '' ) {
3980 - self::permission_check( 'frm_change_settings' );
3981 - check_ajax_referer( 'frm_ajax', 'nonce' );
3982 -
3983 - if ( $option ) {
3984 - update_option( $option, true, 'no' );
3985 - }
3986 -
3987 - wp_send_json_success();
2961 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
2962 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3988 2963 }
3989 2964 }