PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.5
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 +251 -439 6.5.2 → 5.4.5 View file →
@@ -15,9 +15,9 @@
15 15
16 16 /**
17 17 * @since 2.0
18 18 */
19 - public static $plug_version = '6.5.2';
19 + public static $plug_version = '5.4.5';
20 20
21 21 /**
22 22 * @since 1.07.02
23 23 *
@@ -148,28 +148,12 @@
148 148
149 149 public static function get_menu_name() {
150 150 $frm_settings = self::get_settings();
151 151
152 - return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu;
152 + return $frm_settings->menu;
153 153 }
154 154
155 155 /**
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 156 * @since 3.05
173 157 */
174 158 public static function svg_logo( $atts = array() ) {
175 159 $defaults = array(
@@ -268,15 +252,15 @@
268 252 global $pagenow;
269 253 $get_page = self::simple_get( 'page', 'sanitize_title' );
270 254 if ( $pagenow ) {
271 255 // 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;
256 + $is_page = ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page;
273 257 if ( $is_page ) {
274 258 return true;
275 259 }
276 260 }
277 261
278 - return is_admin() && $get_page === $page;
262 + return is_admin() && $get_page == $page;
279 263 }
280 264
281 265 /**
282 266 * If the current page is for editing or creating a view.
@@ -348,18 +332,14 @@
348 332 * Check if on an admin page
349 333 *
350 334 * @since 2.0
351 335 *
336 + * @param None
337 + *
352 338 * @return boolean
353 339 */
354 340 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 );
341 + return is_admin() && ! wp_doing_ajax();
362 342 }
363 343
364 344 /**
365 345 * Check if value contains blank value or empty array
@@ -392,37 +372,26 @@
392 372 return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
393 373 }
394 374
395 375 /**
396 - * Get the server OS
376 + * Check for the IP address in several places
377 + * Used by [ip] shortcode
397 378 *
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 379 * @return string The IP address of the current user
420 380 */
421 381 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 -
382 + $ip_options = array(
383 + 'HTTP_CLIENT_IP',
384 + 'HTTP_CF_CONNECTING_IP',
385 + 'HTTP_X_FORWARDED_FOR',
386 + 'HTTP_X_FORWARDED',
387 + 'HTTP_X_CLUSTER_CLIENT_IP',
388 + 'HTTP_X_REAL_IP',
389 + 'HTTP_FORWARDED_FOR',
390 + 'HTTP_FORWARDED',
391 + 'REMOTE_ADDR',
392 + );
393 + $ip = '';
425 394 foreach ( $ip_options as $key ) {
426 395 if ( ! isset( $_SERVER[ $key ] ) ) {
427 396 continue;
428 397 }
@@ -428,9 +397,9 @@
428 397 }
429 398
430 399 $key = self::get_server_value( $key );
431 400 foreach ( explode( ',', $key ) as $ip ) {
432 - $ip = trim( $ip ); // Just to be safe.
401 + $ip = trim( $ip ); // just to be safe.
433 402
434 403 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
435 404 return sanitize_text_field( $ip );
436 405 }
@@ -439,52 +408,8 @@
439 408
440 409 return sanitize_text_field( $ip );
441 410 }
442 411
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 412 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
488 413 if ( strpos( $param, '[' ) ) {
489 414 $params = explode( '[', $param );
490 415 $param = $params[0];
@@ -573,14 +498,14 @@
573 498 );
574 499 $args = wp_parse_args( $args, $defaults );
575 500
576 501 $value = $args['default'];
577 - if ( $args['type'] === 'get' ) {
502 + if ( $args['type'] == 'get' ) {
578 503 if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
579 504 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
580 505 $value = wp_unslash( $_GET[ $args['param'] ] );
581 506 }
582 - } elseif ( $args['type'] === 'post' ) {
507 + } elseif ( $args['type'] == 'post' ) {
583 508 if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
584 509 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
585 510 $value = wp_unslash( $_POST[ $args['param'] ] );
586 511 if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
@@ -1001,18 +926,8 @@
1001 926
1002 927 $html_atts = self::array_to_html_params( $atts );
1003 928
1004 929 $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 930 if ( $icon === $class ) {
1016 931 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
1017 932 } else {
1018 933 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1069,9 +984,9 @@
1069 984 * @param array $allowed_attr
1070 985 * @return array
1071 986 */
1072 987 public static function allow_vars_in_styles( $allowed_attr ) {
1073 - $allowed_attr[] = '--primary-700';
988 + $allowed_attr[] = '--primary-hover';
1074 989 return $allowed_attr;
1075 990 }
1076 991
1077 992 /**
@@ -1080,9 +995,9 @@
1080 995 * @param bool $allow_css
1081 996 * @param string $css_string
1082 997 */
1083 998 public static function allow_style( $allow_css, $css_string ) {
1084 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
999 + if ( ! $allow_css && 0 === strpos( $css_string, '--primary-hover:' ) ) {
1085 1000 $split = explode( ':', $css_string, 2 );
1086 1001 $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1087 1002 }
1088 1003 return $allow_css;
@@ -1149,11 +1064,9 @@
1149 1064 if ( ! $echo ) {
1150 1065 ob_start();
1151 1066 }
1152 1067
1153 - if ( is_callable( $echo_function ) ) {
1154 - $echo_function();
1155 - }
1068 + $echo_function();
1156 1069
1157 1070 if ( ! $echo ) {
1158 1071 $return = ob_get_contents();
1159 1072 ob_end_clean();
@@ -1176,22 +1089,8 @@
1176 1089 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1177 1090 }
1178 1091
1179 1092 /**
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 1093 * Print applicable admin banner.
1195 1094 *
1196 1095 * @since 5.4.2
1197 1096 *
@@ -1249,9 +1148,9 @@
1249 1148 return;
1250 1149 }
1251 1150
1252 1151 $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1253 - $class = 'button button-primary frm-button-primary';
1152 + $class = 'button button-primary frm-button-primary frm-with-plus';
1254 1153
1255 1154 if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1256 1155 $class .= ' frm-trigger-new-form-modal';
1257 1156 }
@@ -1321,14 +1220,11 @@
1321 1220 }
1322 1221 }
1323 1222
1324 1223 /**
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.
1224 + * Save all front-end js scripts into a single file
1327 1225 *
1328 1226 * @since 3.0
1329 - *
1330 - * @return void
1331 1227 */
1332 1228 public static function save_combined_js() {
1333 1229 $file_atts = apply_filters(
1334 1230 'frm_js_location',
@@ -1341,34 +1237,10 @@
1341 1237
1342 1238 $files = array(
1343 1239 self::plugin_path() . '/js/formidable.min.js',
1344 1240 );
1345 - /**
1346 - * @param array $files
1347 - */
1348 1241 $files = apply_filters( 'frm_combined_js_files', $files );
1349 1242 $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 1243 }
1372 1244
1373 1245 /**
1374 1246 * Check a value from a shortcode to see if true or false.
@@ -1529,8 +1401,9 @@
1529 1401 public static function post_edit_link( $post_id ) {
1530 1402 $post = get_post( $post_id );
1531 1403 if ( $post ) {
1532 1404 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1405 + $post_url = self::maybe_full_screen_link( $post_url );
1533 1406
1534 1407 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1535 1408 }
1536 1409
@@ -1545,59 +1418,22 @@
1545 1418 * @return bool
1546 1419 */
1547 1420 public static function is_full_screen() {
1548 1421 return self::is_form_builder_page() ||
1549 - self::is_style_editor_page() ||
1550 - self::is_full_screen_view_builder_page();
1422 + self::is_admin_page( 'formidable-styles' ) ||
1423 + self::is_admin_page( 'formidable-styles2' ) ||
1424 + self::simple_get( 'frm-full', 'absint' ) ||
1425 + self::is_view_builder_page();
1551 1426 }
1552 1427
1553 1428 /**
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;
1583 - }
1584 -
1585 - /**
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 1429 * @since 4.0
1596 - * @deprecated 5.5.3
1597 1430 */
1598 1431 public static function maybe_full_screen_link( $link ) {
1599 - _deprecated_function( __METHOD__, '5.5.3' );
1432 + $is_full = self::simple_get( 'frm-full', 'absint' );
1433 + if ( $is_full && ! empty( $link ) && $link !== '#' ) {
1434 + $link .= '&frm-full=1';
1435 + }
1600 1436 return $link;
1601 1437 }
1602 1438
1603 1439 /**
@@ -1901,9 +1737,9 @@
1901 1737 foreach ( $array as $key => $value ) {
1902 1738 if ( is_array( $value ) ) {
1903 1739 $return = array_merge( $return, self::array_flatten( $value, $keys ) );
1904 1740 } else {
1905 - if ( $keys === 'keep' ) {
1741 + if ( $keys == 'keep' ) {
1906 1742 $return[ $key ] = $value;
1907 1743 } else {
1908 1744 $return[] = $value;
1909 1745 }
@@ -1987,9 +1823,9 @@
1987 1823 return $user_id;
1988 1824 }
1989 1825
1990 1826 $user_id = sanitize_text_field( $user_id );
1991 - if ( $user_id === 'current' ) {
1827 + if ( $user_id == 'current' ) {
1992 1828 $user_id = get_current_user_id();
1993 1829 } else {
1994 1830 if ( is_email( $user_id ) ) {
1995 1831 $user = get_user_by( 'email', $user_id );
@@ -2457,9 +2293,9 @@
2457 2293 *
2458 2294 * @return string $time_ago
2459 2295 */
2460 2296 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2461 - if ( empty( $to ) && 0 !== $to ) {
2297 + if ( empty( $to ) ) {
2462 2298 $now = new DateTime();
2463 2299 } else {
2464 2300 $now = new DateTime( '@' . $to );
2465 2301 }
@@ -2710,9 +2546,8 @@
2710 2546 'reply_to' => __( 'If you would like a different reply to address than the "from" address, add a single address here. FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
2711 2547 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
2712 2548 /* translators: %1$s: Form name, %2$s: Date */
2713 2549 '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 2550 );
2716 2551
2717 2552 if ( ! isset( $tooltips[ $name ] ) ) {
2718 2553 return;
@@ -2801,15 +2636,12 @@
2801 2636 }
2802 2637 }
2803 2638
2804 2639 /**
2805 - * Check for either json or serialized data. This is temporary while transitioning
2640 + * Check for either json or serilized data. This is temporary while transitioning
2806 2641 * all data to json.
2807 2642 *
2808 2643 * @since 4.02.03
2809 - *
2810 - * @param array|string $value
2811 - * @return void
2812 2644 */
2813 2645 public static function unserialize_or_decode( &$value ) {
2814 2646 if ( is_array( $value ) ) {
2815 2647 return;
@@ -2815,9 +2647,9 @@
2815 2647 return;
2816 2648 }
2817 2649
2818 2650 if ( is_serialized( $value ) ) {
2819 - $value = self::maybe_unserialize_array( $value );
2651 + $value = maybe_unserialize( $value );
2820 2652 } else {
2821 2653 $value = self::maybe_json_decode( $value, false );
2822 2654 }
2823 2655 }
@@ -2822,35 +2654,8 @@
2822 2654 }
2823 2655 }
2824 2656
2825 2657 /**
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 2658 * Decode a JSON string.
2854 2659 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2855 2660 *
2856 2661 * @param mixed $string
@@ -2877,36 +2682,8 @@
2877 2682 return $string;
2878 2683 }
2879 2684
2880 2685 /**
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 2686 * Reformat the json serialized array in name => value array.
2910 2687 *
2911 2688 * @since 4.02.03
2912 2689 */
@@ -3002,10 +2779,13 @@
3002 2779 */
3003 2780 public static function localize_script( $location ) {
3004 2781 global $wp_scripts;
3005 2782
2783 + $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2784 + $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2785 +
3006 2786 $script_strings = array(
3007 - 'ajax_url' => esc_url_raw( self::get_ajax_url() ),
2787 + 'ajax_url' => $ajax_url,
3008 2788 'images_url' => self::plugin_url() . '/images',
3009 2789 'loading' => __( 'Loading&hellip;', 'formidable' ),
3010 2790 'remove' => __( 'Remove', 'formidable' ),
3011 2791 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
@@ -3019,72 +2799,69 @@
3019 2799 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
3020 2800 );
3021 2801
3022 2802 $data = $wp_scripts->get_data( 'formidable', 'data' );
3023 - if ( ! $data ) {
2803 + if ( empty( $data ) ) {
3024 2804 wp_localize_script( 'formidable', 'frm_js', $script_strings );
3025 2805 }
3026 2806
3027 - if ( $location === 'admin' ) {
2807 + if ( $location == 'admin' ) {
3028 2808 $frm_settings = self::get_settings();
3029 2809 $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(),
2810 + 'desc' => __( '(Click to add description)', 'formidable' ),
2811 + 'blank' => __( '(Blank)', 'formidable' ),
2812 + 'no_label' => __( '(no label)', 'formidable' ),
2813 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2814 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
2815 + 'ok' => __( 'OK', 'formidable' ),
2816 + 'cancel' => __( 'Cancel', 'formidable' ),
2817 + 'default_label' => __( 'Default', 'formidable' ),
2818 + 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
2819 + 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
2820 + 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
2821 + 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2822 + 'caution' => __( 'Heads up', 'formidable' ),
2823 + 'confirm' => __( 'Are you sure?', 'formidable' ),
2824 + 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
2825 + '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' ),
2826 + 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
2827 + 'default_unique' => $frm_settings->unique_msg,
2828 + 'default_conf' => __( 'The entered values do not match', 'formidable' ),
2829 + 'enter_email' => __( 'Enter Email', 'formidable' ),
2830 + 'confirm_email' => __( 'Confirm Email', 'formidable' ),
2831 + 'conditional_text' => __( 'Conditional content here', 'formidable' ),
2832 + 'new_option' => __( 'New Option', 'formidable' ),
2833 + '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' ),
2834 + 'enter_password' => __( 'Enter Password', 'formidable' ),
2835 + 'confirm_password' => __( 'Confirm Password', 'formidable' ),
2836 + 'import_complete' => __( 'Import Complete', 'formidable' ),
2837 + 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
2838 + 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
2839 + 'private_label' => __( 'Private', 'formidable' ),
2840 + 'jquery_ui_url' => '',
2841 + 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
2842 + 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
2843 + 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
2844 + 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
2845 + 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
2846 + 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
2847 + 'unsafe_params' => FrmFormsHelper::reserved_words(),
3065 2848 /* 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' ), '****' ),
2849 + 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ),
3067 2850 /* 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.
2851 + 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
2852 + 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
2853 + 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
2854 + 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
2855 + 'install' => __( 'Install', 'formidable' ),
2856 + 'active' => __( 'Active', 'formidable' ),
2857 + 'select_a_field' => __( 'Select a Field', 'formidable' ),
2858 + 'no_items_found' => __( 'No items found.', 'formidable' ),
3079 2859 );
3080 - /**
3081 - * @param array $admin_script_strings
3082 - */
3083 2860 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3084 2861
3085 2862 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
3086 - if ( ! $data ) {
2863 + if ( empty( $data ) ) {
3087 2864 wp_localize_script( 'formidable_admin', 'frm_admin_js', $admin_script_strings );
3088 2865 }
3089 2866 }
3090 2867 }
@@ -3089,24 +2866,8 @@
3089 2866 }
3090 2867 }
3091 2868
3092 2869 /**
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 2870 * Returns whether or not the first errored input should be auto-focused (default true).
3110 2871 *
3111 2872 * @since 5.2.05
3112 2873 *
@@ -3170,9 +2931,9 @@
3170 2931
3171 2932 $pro_version = FrmProDb::$plug_version;
3172 2933 $expired = FrmAddonsController::is_license_expired();
3173 2934 ?>
3174 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2935 + <div class="error frm_previous_install">
3175 2936 <?php
3176 2937 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 2938 if ( empty( $expired ) ) {
3178 2939 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3211,9 +2972,9 @@
3211 2972 }
3212 2973
3213 2974 foreach ( $message as $m ) {
3214 2975 ?>
3215 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2976 + <div class="error frm_previous_install">
3216 2977 <?php echo esc_html( $m ); ?>
3217 2978 </div>
3218 2979 <?php
3219 2980 }
@@ -3327,9 +3088,9 @@
3327 3088
3328 3089 /**
3329 3090 * Filter available locale options.
3330 3091 *
3331 - * @since 5.4.5 Added $args parameter with type.
3092 + * @since x.x Added $args parameter with type.
3332 3093 *
3333 3094 * @param array<string,string> $locales
3334 3095 * @param array $args {
3335 3096 * @type string $type
@@ -3820,54 +3581,8 @@
3820 3581 return array( 'list', 'trash', 'untrash', 'destroy' );
3821 3582 }
3822 3583
3823 3584 /**
3824 - * Safely call get_plugins, importing the required files if they are not yet loaded.
3825 - *
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 3585 * @since 4.08
3871 3586 * @deprecated 4.09.01
3872 3587 */
3873 3588 public static function expiring_message() {
@@ -3896,8 +3611,18 @@
3896 3611 FrmFormsHelper::insert_opt_html( $args );
3897 3612 }
3898 3613
3899 3614 /**
3615 + * Used to filter shortcode in text widgets
3616 + *
3617 + * @deprecated 2.5.4
3618 + * @codeCoverageIgnore
3619 + */
3620 + public static function widget_text_filter_callback( $matches ) {
3621 + return FrmDeprecated::widget_text_filter_callback( $matches );
3622 + }
3623 +
3624 + /**
3900 3625 * @deprecated 3.01
3901 3626 * @codeCoverageIgnore
3902 3627 */
3903 3628 public static function sanitize_array( &$values ) {
@@ -3904,86 +3629,173 @@
3904 3629 FrmDeprecated::sanitize_array( $values );
3905 3630 }
3906 3631
3907 3632 /**
3908 - * @since 2.0
3909 - * @deprecated 5.0.13
3633 + * @param array $settings
3634 + * @param string $group
3910 3635 *
3911 - * @return string The base Google APIS url for the current version of jQuery UI
3636 + * @since 2.0.6
3637 + * @deprecated 2.05.06
3638 + * @codeCoverageIgnore
3912 3639 */
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() : '';
3640 + public static function save_settings( $settings, $group ) {
3641 + return FrmDeprecated::save_settings( $settings, $group );
3916 3642 }
3917 3643
3918 3644 /**
3919 - * @since 4.07
3920 - * @deprecated 6.0
3645 + * @since 2.0.4
3646 + * @deprecated 2.05.06
3647 + * @codeCoverageIgnore
3921 3648 */
3922 - public static function renewal_message() {
3923 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3649 + public static function save_json_post( $settings ) {
3650 + return FrmDeprecated::save_json_post( $settings );
3924 3651 }
3925 3652
3926 3653 /**
3927 - * Display a dismissable warning message and save its dismissal state.
3654 + * @since 2.0
3655 + * @deprecated 2.05.06
3656 + * @codeCoverageIgnore
3928 3657 *
3929 - * @since 6.3
3658 + * @param string $cache_key The unique name for this cache
3659 + * @param string $group The name of the cache group
3660 + * @param string $query If blank, don't run a db call
3661 + * @param string $type The wpdb function to use with this query
3930 3662 *
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
3663 + * @return mixed $results The cache or query results
3934 3664 */
3935 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3936 - if ( ! $message || ! $option ) {
3937 - return;
3938 - }
3665 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3666 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3667 + }
3939 3668
3940 - $ajax_callback = function() use ( $option ) {
3941 - self::dismiss_warning_message( $option );
3942 - };
3669 + /**
3670 + * @deprecated 2.05.06
3671 + * @codeCoverageIgnore
3672 + */
3673 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3674 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3675 + }
3943 3676
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 );
3677 + /**
3678 + * @deprecated 2.05.06
3679 + * @codeCoverageIgnore
3680 + */
3681 + public static function add_key_to_group_cache( $key, $group ) {
3682 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3683 + }
3947 3684
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 - }
3685 + /**
3686 + * @deprecated 2.05.06
3687 + * @codeCoverageIgnore
3688 + */
3689 + public static function get_group_cached_keys( $group ) {
3690 + return FrmDeprecated::get_group_cached_keys( $group );
3691 + }
3954 3692
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 - );
3693 + /**
3694 + * @since 2.0
3695 + * @deprecated 2.05.06
3696 + * @codeCoverageIgnore
3697 + * @return mixed The cached value or false
3698 + */
3699 + public static function check_cache_and_transient( $cache_key ) {
3700 + return FrmDeprecated::check_cache( $cache_key );
3701 + }
3962 3702
3963 - $show_messages[] = $message;
3964 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3703 + /**
3704 + * @since 2.0
3705 + * @deprecated 2.05.06
3706 + * @codeCoverageIgnore
3707 + *
3708 + * @param string $cache_key
3709 + */
3710 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3711 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3712 + }
3965 3713
3966 - return $show_messages;
3967 - }
3968 - );
3714 + /**
3715 + * @since 2.0
3716 + * @deprecated 2.05.06
3717 + * @codeCoverageIgnore
3718 + *
3719 + * @param string $group The name of the cache group
3720 + */
3721 + public static function cache_delete_group( $group ) {
3722 + FrmDeprecated::cache_delete_group( $group );
3969 3723 }
3970 3724
3971 3725 /**
3972 - * Dismiss a warning message and update the dismissal state.
3726 + * @since 1.07.10
3727 + * @deprecated 2.05.06
3728 + * @codeCoverageIgnore
3973 3729 *
3974 - * @since 6.3
3730 + * @param string $term The value to escape
3975 3731 *
3976 - * @param string $option The unique identifier for the dismissal state of the message.
3977 - * @return void
3732 + * @return string The escaped value
3978 3733 */
3979 - public static function dismiss_warning_message( $option = '' ) {
3980 - self::permission_check( 'frm_change_settings' );
3981 - check_ajax_referer( 'frm_ajax', 'nonce' );
3734 + public static function esc_like( $term ) {
3735 + return FrmDeprecated::esc_like( $term );
3736 + }
3982 3737
3983 - if ( $option ) {
3984 - update_option( $option, true, 'no' );
3985 - }
3738 + /**
3739 + * @param string $order_query
3740 + *
3741 + * @deprecated 2.05.06
3742 + * @codeCoverageIgnore
3743 + */
3744 + public static function esc_order( $order_query ) {
3745 + return FrmDeprecated::esc_order( $order_query );
3746 + }
3986 3747
3987 - wp_send_json_success();
3748 + /**
3749 + * @deprecated 2.05.06
3750 + * @codeCoverageIgnore
3751 + */
3752 + public static function esc_order_by( &$order_by ) {
3753 + FrmDeprecated::esc_order_by( $order_by );
3754 + }
3755 +
3756 + /**
3757 + * @param string $limit
3758 + *
3759 + * @deprecated 2.05.06
3760 + * @codeCoverageIgnore
3761 + */
3762 + public static function esc_limit( $limit ) {
3763 + return FrmDeprecated::esc_limit( $limit );
3764 + }
3765 +
3766 + /**
3767 + * @since 2.0
3768 + * @deprecated 2.05.06
3769 + * @codeCoverageIgnore
3770 + */
3771 + public static function prepare_array_values( $array, $type = '%s' ) {
3772 + return FrmDeprecated::prepare_array_values( $array, $type );
3773 + }
3774 +
3775 + /**
3776 + * @deprecated 2.05.06
3777 + * @codeCoverageIgnore
3778 + */
3779 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3780 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3781 + }
3782 +
3783 + /**
3784 + * @since 2.0
3785 + * @deprecated 5.0.13
3786 + *
3787 + * @return string The base Google APIS url for the current version of jQuery UI
3788 + */
3789 + public static function jquery_ui_base_url() {
3790 + _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3791 + return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3792 + }
3793 +
3794 + /**
3795 + * @since 4.07
3796 + * @deprecated x.x
3797 + */
3798 + public static function renewal_message() {
3799 + _deprecated_function( __METHOD__, 'x.x', 'FrmProAddonsController::renewal_message' );
3988 3800 }
3989 3801 }