PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.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 +249 -424 6.55.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';
19 + public static $plug_version = '5.5';
20 20
21 21 /**
22 22 * @since 1.07.02
23 23 *
@@ -152,24 +152,8 @@
152 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,38 +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.x
399 - *
400 - * @return string
401 - */
402 - public static function get_server_os() {
403 -
404 - if ( function_exists( 'php_uname' ) ) {
405 - return php_uname( 's' );
406 - }
407 -
408 - if ( ! defined( 'PHP_OS' ) ) {
409 - return '';
410 - }
411 -
412 - // match the same response for Windows server as php_uname('s')
413 - return in_array( PHP_OS, array( 'WIN32', 'WINNT', 'Windows_NT' ), true ) ? 'Windows NT' : PHP_OS;
414 - }
415 -
416 - /**
417 - * Check for the IP address in several places (when custom headers are enabled).
418 - * Used by [ip] shortcode.
419 - *
420 379 * @return string The IP address of the current user
421 380 */
422 381 public static function get_ip_address() {
423 - $ip_options = self::should_use_custom_header_ip() ? self::get_custom_header_keys_for_ip() : array( 'REMOTE_ADDR' );
424 - $ip = '';
425 -
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 = '';
426 394 foreach ( $ip_options as $key ) {
427 395 if ( ! isset( $_SERVER[ $key ] ) ) {
428 396 continue;
429 397 }
@@ -429,9 +397,9 @@
429 397 }
430 398
431 399 $key = self::get_server_value( $key );
432 400 foreach ( explode( ',', $key ) as $ip ) {
433 - $ip = trim( $ip ); // Just to be safe.
401 + $ip = trim( $ip ); // just to be safe.
434 402
435 403 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
436 404 return sanitize_text_field( $ip );
437 405 }
@@ -440,52 +408,8 @@
440 408
441 409 return sanitize_text_field( $ip );
442 410 }
443 411
444 - /**
445 - * @since 6.1
446 - *
447 - * @return array
448 - */
449 - public static function get_custom_header_keys_for_ip() {
450 - return array(
451 - 'HTTP_CLIENT_IP',
452 - 'HTTP_CF_CONNECTING_IP',
453 - 'HTTP_X_FORWARDED_FOR',
454 - 'HTTP_X_FORWARDED',
455 - 'HTTP_X_CLUSTER_CLIENT_IP',
456 - 'HTTP_X_REAL_IP',
457 - 'HTTP_FORWARDED_FOR',
458 - 'HTTP_FORWARDED',
459 - 'REMOTE_ADDR',
460 - );
461 - }
462 -
463 - /**
464 - * Check if we should check every HTTP header or just $_SERVER['REMOTE_ADDR'].
465 - * The other HTTP headers can be spoofed so this isn't recommended.
466 - * But in some cases (like reverse proxies), the IP may be empty if you use $_SERVER['REMOTE_ADDR'].
467 - *
468 - * @since 6.1
469 - *
470 - * @return bool
471 - */
472 - private static function should_use_custom_header_ip() {
473 - $settings = self::get_settings();
474 - $should_use_custom_header_ip = ! $settings->no_ips && $settings->custom_header_ip;
475 -
476 - /**
477 - * Filter whether to check spoofable HTTP headers.
478 - * This uses the custom_header_ip setting, but it is hidden if the GDPR option is also on.
479 - * 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.
480 - *
481 - * @since 6.1
482 - *
483 - * @param bool $should_use_custom_header_ip
484 - */
485 - return apply_filters( 'frm_use_custom_header_ip', $should_use_custom_header_ip );
486 - }
487 -
488 412 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
489 413 if ( strpos( $param, '[' ) ) {
490 414 $params = explode( '[', $param );
491 415 $param = $params[0];
@@ -574,14 +498,14 @@
574 498 );
575 499 $args = wp_parse_args( $args, $defaults );
576 500
577 501 $value = $args['default'];
578 - if ( $args['type'] === 'get' ) {
502 + if ( $args['type'] == 'get' ) {
579 503 if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
580 504 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
581 505 $value = wp_unslash( $_GET[ $args['param'] ] );
582 506 }
583 - } elseif ( $args['type'] === 'post' ) {
507 + } elseif ( $args['type'] == 'post' ) {
584 508 if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
585 509 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
586 510 $value = wp_unslash( $_POST[ $args['param'] ] );
587 511 if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
@@ -1002,18 +926,8 @@
1002 926
1003 927 $html_atts = self::array_to_html_params( $atts );
1004 928
1005 929 $icon = trim( str_replace( array( 'frm_icon_font', 'frmfont ' ), '', $class ) );
1006 -
1007 - // Replace icons that have been removed.
1008 - $deprecated = array(
1009 - 'frm_clone_solid_icon' => 'frm_clone_icon',
1010 - );
1011 - if ( isset( $deprecated[ $icon ] ) ) {
1012 - $icon = $deprecated[ $icon ];
1013 - $class = str_replace( $icon, $deprecated[ $icon ], $class );
1014 - }
1015 -
1016 930 if ( $icon === $class ) {
1017 931 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
1018 932 } else {
1019 933 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1070,9 +984,9 @@
1070 984 * @param array $allowed_attr
1071 985 * @return array
1072 986 */
1073 987 public static function allow_vars_in_styles( $allowed_attr ) {
1074 - $allowed_attr[] = '--primary-700';
988 + $allowed_attr[] = '--primary-hover';
1075 989 return $allowed_attr;
1076 990 }
1077 991
1078 992 /**
@@ -1081,9 +995,9 @@
1081 995 * @param bool $allow_css
1082 996 * @param string $css_string
1083 997 */
1084 998 public static function allow_style( $allow_css, $css_string ) {
1085 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
999 + if ( ! $allow_css && 0 === strpos( $css_string, '--primary-hover:' ) ) {
1086 1000 $split = explode( ':', $css_string, 2 );
1087 1001 $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1088 1002 }
1089 1003 return $allow_css;
@@ -1150,11 +1064,9 @@
1150 1064 if ( ! $echo ) {
1151 1065 ob_start();
1152 1066 }
1153 1067
1154 - if ( is_callable( $echo_function ) ) {
1155 - $echo_function();
1156 - }
1068 + $echo_function();
1157 1069
1158 1070 if ( ! $echo ) {
1159 1071 $return = ob_get_contents();
1160 1072 ob_end_clean();
@@ -1177,22 +1089,8 @@
1177 1089 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1178 1090 }
1179 1091
1180 1092 /**
1181 - * @since 6.0
1182 - *
1183 - * @param string $type
1184 - * @return void
1185 - */
1186 - public static function import_link( $type = 'secondary' ) {
1187 - ?>
1188 - <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">
1189 - <?php esc_html_e( 'Import', 'formidable' ); ?>
1190 - </a>
1191 - <?php
1192 - }
1193 -
1194 - /**
1195 1093 * Print applicable admin banner.
1196 1094 *
1197 1095 * @since 5.4.2
1198 1096 *
@@ -1250,9 +1148,9 @@
1250 1148 return;
1251 1149 }
1252 1150
1253 1151 $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1254 - $class = 'button button-primary frm-button-primary';
1152 + $class = 'button button-primary frm-button-primary frm-with-plus';
1255 1153
1256 1154 if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1257 1155 $class .= ' frm-trigger-new-form-modal';
1258 1156 }
@@ -1322,14 +1220,11 @@
1322 1220 }
1323 1221 }
1324 1222
1325 1223 /**
1326 - * Save all front-end js scripts into a single file.
1327 - * And save an additional single file of all front-end Stripe JS scripts.
1224 + * Save all front-end js scripts into a single file
1328 1225 *
1329 1226 * @since 3.0
1330 - *
1331 - * @return void
1332 1227 */
1333 1228 public static function save_combined_js() {
1334 1229 $file_atts = apply_filters(
1335 1230 'frm_js_location',
@@ -1342,34 +1237,10 @@
1342 1237
1343 1238 $files = array(
1344 1239 self::plugin_path() . '/js/formidable.min.js',
1345 1240 );
1346 - /**
1347 - * @param array $files
1348 - */
1349 1241 $files = apply_filters( 'frm_combined_js_files', $files );
1350 1242 $new_file->combine_files( $files );
1351 -
1352 - // Create the minified Stripe Script.
1353 - $file_atts = apply_filters(
1354 - 'frm_stripe_js_location',
1355 - array(
1356 - 'file_name' => 'frmstrp.min.js',
1357 - 'new_file_path' => self::plugin_path() . '/js',
1358 - )
1359 - );
1360 - $new_file = new FrmCreateFile( $file_atts );
1361 - $files = array(
1362 - FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js',
1363 - );
1364 -
1365 - /**
1366 - * @since 6.5
1367 - *
1368 - * @param array $files
1369 - */
1370 - $files = apply_filters( 'frm_stripe_combined_js_files', $files );
1371 - $new_file->combine_files( $files );
1372 1243 }
1373 1244
1374 1245 /**
1375 1246 * Check a value from a shortcode to see if true or false.
@@ -1530,8 +1401,9 @@
1530 1401 public static function post_edit_link( $post_id ) {
1531 1402 $post = get_post( $post_id );
1532 1403 if ( $post ) {
1533 1404 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1405 + $post_url = self::maybe_full_screen_link( $post_url );
1534 1406
1535 1407 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1536 1408 }
1537 1409
@@ -1546,59 +1418,22 @@
1546 1418 * @return bool
1547 1419 */
1548 1420 public static function is_full_screen() {
1549 1421 return self::is_form_builder_page() ||
1550 - self::is_style_editor_page() ||
1551 - 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();
1552 1426 }
1553 1427
1554 1428 /**
1555 - * Check if user is on the style editor or its alternative URL.
1556 - * The first URL is a submenu "Styles" in the Formidable menu /wp-admin/admin.php?page=formidable-styles.
1557 - * The alternative URL is linked as a submenu "Forms" item of the Appearance menu /wp-admin/themes.php?page=formidable-styles2.
1558 - *
1559 - * @since 5.5.3
1560 - * @since 6.0 Added the $view parameter. Previously there was only a 'edit' view.
1561 - *
1562 - * @param string $view Supports 'edit', 'list', and ''. If '', both 'edit' and 'list' will match.
1563 - * @return bool
1564 - */
1565 - public static function is_style_editor_page( $view = '' ) {
1566 - if ( ! self::is_admin_page( 'formidable-styles' ) && ! self::is_admin_page( 'formidable-styles2' ) ) {
1567 - return false;
1568 - }
1569 -
1570 - if ( ! in_array( $view, array( 'list', 'edit' ), true ) ) {
1571 - return true;
1572 - }
1573 -
1574 - $action = self::simple_get( 'frm_action' );
1575 - $is_edit_mode = 'edit' === $action || ( ! $action && ! self::simple_get( 'id' ) && ! self::simple_get( 'form' ) );
1576 -
1577 - if ( ! $is_edit_mode && class_exists( 'FrmProStylesController' ) && in_array( $action, array( 'new_style', 'duplicate' ), true ) ) {
1578 - $is_edit_mode = true;
1579 - }
1580 -
1581 - $checking_for_edit_mode = 'edit' === $view;
1582 -
1583 - return $is_edit_mode === $checking_for_edit_mode;
1584 - }
1585 -
1586 - /**
1587 - * @since 5.5.3
1588 - *
1589 - * @return bool
1590 - */
1591 - private static function is_full_screen_view_builder_page() {
1592 - return self::is_admin_page( 'formidable-views-editor' );
1593 - }
1594 -
1595 - /**
1596 1429 * @since 4.0
1597 - * @deprecated 5.5.3
1598 1430 */
1599 1431 public static function maybe_full_screen_link( $link ) {
1600 - _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 + }
1601 1436 return $link;
1602 1437 }
1603 1438
1604 1439 /**
@@ -1902,9 +1737,9 @@
1902 1737 foreach ( $array as $key => $value ) {
1903 1738 if ( is_array( $value ) ) {
1904 1739 $return = array_merge( $return, self::array_flatten( $value, $keys ) );
1905 1740 } else {
1906 - if ( $keys === 'keep' ) {
1741 + if ( $keys == 'keep' ) {
1907 1742 $return[ $key ] = $value;
1908 1743 } else {
1909 1744 $return[] = $value;
1910 1745 }
@@ -1988,9 +1823,9 @@
1988 1823 return $user_id;
1989 1824 }
1990 1825
1991 1826 $user_id = sanitize_text_field( $user_id );
1992 - if ( $user_id === 'current' ) {
1827 + if ( $user_id == 'current' ) {
1993 1828 $user_id = get_current_user_id();
1994 1829 } else {
1995 1830 if ( is_email( $user_id ) ) {
1996 1831 $user = get_user_by( 'email', $user_id );
@@ -2458,9 +2293,9 @@
2458 2293 *
2459 2294 * @return string $time_ago
2460 2295 */
2461 2296 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2462 - if ( empty( $to ) && 0 !== $to ) {
2297 + if ( empty( $to ) ) {
2463 2298 $now = new DateTime();
2464 2299 } else {
2465 2300 $now = new DateTime( '@' . $to );
2466 2301 }
@@ -2711,9 +2546,8 @@
2711 2546 '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' ),
2712 2547 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ),
2713 2548 /* translators: %1$s: Form name, %2$s: Date */
2714 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() ) ),
2715 - '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' ),
2716 2550 );
2717 2551
2718 2552 if ( ! isset( $tooltips[ $name ] ) ) {
2719 2553 return;
@@ -2802,15 +2636,12 @@
2802 2636 }
2803 2637 }
2804 2638
2805 2639 /**
2806 - * 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
2807 2641 * all data to json.
2808 2642 *
2809 2643 * @since 4.02.03
2810 - *
2811 - * @param array|string $value
2812 - * @return void
2813 2644 */
2814 2645 public static function unserialize_or_decode( &$value ) {
2815 2646 if ( is_array( $value ) ) {
2816 2647 return;
@@ -2816,9 +2647,9 @@
2816 2647 return;
2817 2648 }
2818 2649
2819 2650 if ( is_serialized( $value ) ) {
2820 - $value = self::maybe_unserialize_array( $value );
2651 + $value = maybe_unserialize( $value );
2821 2652 } else {
2822 2653 $value = self::maybe_json_decode( $value, false );
2823 2654 }
2824 2655 }
@@ -2823,35 +2654,8 @@
2823 2654 }
2824 2655 }
2825 2656
2826 2657 /**
2827 - * Safely unserialize an array if necessary.
2828 - * This function doesn't actually use unserialize. The string is parsed instead.
2829 - *
2830 - * @since 6.2
2831 - *
2832 - * @param mixed $value
2833 - * @return mixed
2834 - */
2835 - public static function maybe_unserialize_array( $value ) {
2836 - if ( ! is_string( $value ) ) {
2837 - return $value;
2838 - }
2839 -
2840 - // Since we only expect an array, skip anything that doesn't start with a:.
2841 - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) {
2842 - return $value;
2843 - }
2844 -
2845 - $parsed = FrmSerializedStringParserHelper::get()->parse( $value );
2846 - if ( is_array( $parsed ) ) {
2847 - $value = $parsed;
2848 - }
2849 -
2850 - return $value;
2851 - }
2852 -
2853 - /**
2854 2658 * Decode a JSON string.
2855 2659 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2856 2660 *
2857 2661 * @param mixed $string
@@ -2878,36 +2682,8 @@
2878 2682 return $string;
2879 2683 }
2880 2684
2881 2685 /**
2882 - * @since 6.2.3
2883 - *
2884 - * @param string $value
2885 - * @return string
2886 - */
2887 - public static function maybe_utf8_encode( $value ) {
2888 - $from_format = 'ISO-8859-1';
2889 - $to_format = 'UTF-8';
2890 -
2891 - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) {
2892 - if ( mb_check_encoding( $value, $from_format ) ) {
2893 - return mb_convert_encoding( $value, $to_format, $from_format );
2894 - }
2895 - return $value;
2896 - }
2897 -
2898 - if ( function_exists( 'iconv' ) ) {
2899 - $converted = iconv( $from_format, $to_format, $value );
2900 - // Value is false if $value is not ISO-8859-1.
2901 - if ( false !== $converted ) {
2902 - return $converted;
2903 - }
2904 - }
2905 -
2906 - return $value;
2907 - }
2908 -
2909 - /**
2910 2686 * Reformat the json serialized array in name => value array.
2911 2687 *
2912 2688 * @since 4.02.03
2913 2689 */
@@ -3003,10 +2779,13 @@
3003 2779 */
3004 2780 public static function localize_script( $location ) {
3005 2781 global $wp_scripts;
3006 2782
2783 + $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2784 + $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2785 +
3007 2786 $script_strings = array(
3008 - 'ajax_url' => esc_url_raw( self::get_ajax_url() ),
2787 + 'ajax_url' => $ajax_url,
3009 2788 'images_url' => self::plugin_url() . '/images',
3010 2789 'loading' => __( 'Loading&hellip;', 'formidable' ),
3011 2790 'remove' => __( 'Remove', 'formidable' ),
3012 2791 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
@@ -3020,72 +2799,69 @@
3020 2799 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
3021 2800 );
3022 2801
3023 2802 $data = $wp_scripts->get_data( 'formidable', 'data' );
3024 - if ( ! $data ) {
2803 + if ( empty( $data ) ) {
3025 2804 wp_localize_script( 'formidable', 'frm_js', $script_strings );
3026 2805 }
3027 2806
3028 - if ( $location === 'admin' ) {
2807 + if ( $location == 'admin' ) {
3029 2808 $frm_settings = self::get_settings();
3030 2809 $admin_script_strings = array(
3031 - 'desc' => __( '(Click to add description)', 'formidable' ),
3032 - 'blank' => __( '(Blank)', 'formidable' ),
3033 - 'no_label' => __( '(no label)', 'formidable' ),
3034 - 'ok' => __( 'OK', 'formidable' ),
3035 - 'cancel' => __( 'Cancel', 'formidable' ),
3036 - 'default_label' => __( 'Default', 'formidable' ),
3037 - 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
3038 - 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
3039 - 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
3040 - 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
3041 - 'confirm' => __( 'Are you sure?', 'formidable' ),
3042 - 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
3043 - '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' ),
3044 - 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
3045 - 'default_unique' => $frm_settings->unique_msg,
3046 - 'default_conf' => __( 'The entered values do not match', 'formidable' ),
3047 - 'enter_email' => __( 'Enter Email', 'formidable' ),
3048 - 'confirm_email' => __( 'Confirm Email', 'formidable' ),
3049 - 'conditional_text' => __( 'Conditional content here', 'formidable' ),
3050 - 'new_option' => __( 'New Option', 'formidable' ),
3051 - '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' ),
3052 - 'enter_password' => __( 'Enter Password', 'formidable' ),
3053 - 'confirm_password' => __( 'Confirm Password', 'formidable' ),
3054 - 'import_complete' => __( 'Import Complete', 'formidable' ),
3055 - 'updating' => __( 'Please wait while your site updates.', 'formidable' ),
3056 - 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
3057 - 'private_label' => __( 'Private', 'formidable' ),
3058 - 'jquery_ui_url' => '',
3059 - 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
3060 - 'no_licenses' => __( 'No new licenses were found', 'formidable' ),
3061 - 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ),
3062 - 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ),
3063 - 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ),
3064 - 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ),
3065 - '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(),
3066 2848 /* Translators: %s is the name of a Detail Page Slug that is a reserved word.*/
3067 - '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' ), '****' ),
3068 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. */
3069 - 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ),
3070 - 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ),
3071 - 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ),
3072 - 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ),
3073 - 'install' => __( 'Install', 'formidable' ),
3074 - 'active' => __( 'Active', 'formidable' ),
3075 - 'select_a_field' => __( 'Select a Field', 'formidable' ),
3076 - 'no_items_found' => __( 'No items found.', 'formidable' ),
3077 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3078 - 'saving' => '', // Deprecated in 6.0.
3079 - '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' ),
3080 2859 );
3081 - /**
3082 - * @param array $admin_script_strings
3083 - */
3084 2860 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3085 2861
3086 2862 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
3087 - if ( ! $data ) {
2863 + if ( empty( $data ) ) {
3088 2864 wp_localize_script( 'formidable_admin', 'frm_admin_js', $admin_script_strings );
3089 2865 }
3090 2866 }
3091 2867 }
@@ -3090,24 +2866,8 @@
3090 2866 }
3091 2867 }
3092 2868
3093 2869 /**
3094 - * @since 6.5
3095 - *
3096 - * @return string
3097 - */
3098 - public static function get_ajax_url() {
3099 - $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
3100 -
3101 - /**
3102 - * @since 2.0.13
3103 - *
3104 - * @param string $ajax_url
3105 - */
3106 - return apply_filters( 'frm_ajax_url', $ajax_url );
3107 - }
3108 -
3109 - /**
3110 2870 * Returns whether or not the first errored input should be auto-focused (default true).
3111 2871 *
3112 2872 * @since 5.2.05
3113 2873 *
@@ -3171,9 +2931,9 @@
3171 2931
3172 2932 $pro_version = FrmProDb::$plug_version;
3173 2933 $expired = FrmAddonsController::is_license_expired();
3174 2934 ?>
3175 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2935 + <div class="error frm_previous_install">
3176 2936 <?php
3177 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' );
3178 2938 if ( empty( $expired ) ) {
3179 2939 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3212,9 +2972,9 @@
3212 2972 }
3213 2973
3214 2974 foreach ( $message as $m ) {
3215 2975 ?>
3216 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2976 + <div class="error frm_previous_install">
3217 2977 <?php echo esc_html( $m ); ?>
3218 2978 </div>
3219 2979 <?php
3220 2980 }
@@ -3835,40 +3595,8 @@
3835 3595 return get_plugins();
3836 3596 }
3837 3597
3838 3598 /**
3839 - * 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.
3840 - * This is to make sure that the URL can't be exploited for a SSRF attack.
3841 - *
3842 - * @since 5.5.5
3843 - *
3844 - * @param string $url
3845 - * @param string $expected_extension
3846 - * @return bool
3847 - */
3848 - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) {
3849 - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' );
3850 - if ( ! $file_is_in_expected_s3_bucket ) {
3851 - return false;
3852 - }
3853 -
3854 - $parsed = parse_url( $url );
3855 - if ( ! is_array( $parsed ) ) {
3856 - // URL is malformed.
3857 - return false;
3858 - }
3859 -
3860 - $path = $parsed['path'];
3861 - $ext = pathinfo( $path, PATHINFO_EXTENSION );
3862 - if ( $expected_extension !== $ext ) {
3863 - // The URL isn't to an XML file.
3864 - return false;
3865 - }
3866 -
3867 - return true;
3868 - }
3869 -
3870 - /**
3871 3599 * @since 4.08
3872 3600 * @deprecated 4.09.01
3873 3601 */
3874 3602 public static function expiring_message() {
@@ -3897,8 +3625,18 @@
3897 3625 FrmFormsHelper::insert_opt_html( $args );
3898 3626 }
3899 3627
3900 3628 /**
3629 + * Used to filter shortcode in text widgets
3630 + *
3631 + * @deprecated 2.5.4
3632 + * @codeCoverageIgnore
3633 + */
3634 + public static function widget_text_filter_callback( $matches ) {
3635 + return FrmDeprecated::widget_text_filter_callback( $matches );
3636 + }
3637 +
3638 + /**
3901 3639 * @deprecated 3.01
3902 3640 * @codeCoverageIgnore
3903 3641 */
3904 3642 public static function sanitize_array( &$values ) {
@@ -3905,86 +3643,173 @@
3905 3643 FrmDeprecated::sanitize_array( $values );
3906 3644 }
3907 3645
3908 3646 /**
3909 - * @since 2.0
3910 - * @deprecated 5.0.13
3647 + * @param array $settings
3648 + * @param string $group
3911 3649 *
3912 - * @return string The base Google APIS url for the current version of jQuery UI
3650 + * @since 2.0.6
3651 + * @deprecated 2.05.06
3652 + * @codeCoverageIgnore
3913 3653 */
3914 - public static function jquery_ui_base_url() {
3915 - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3916 - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3654 + public static function save_settings( $settings, $group ) {
3655 + return FrmDeprecated::save_settings( $settings, $group );
3917 3656 }
3918 3657
3919 3658 /**
3920 - * @since 4.07
3921 - * @deprecated 6.0
3659 + * @since 2.0.4
3660 + * @deprecated 2.05.06
3661 + * @codeCoverageIgnore
3922 3662 */
3923 - public static function renewal_message() {
3924 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3663 + public static function save_json_post( $settings ) {
3664 + return FrmDeprecated::save_json_post( $settings );
3925 3665 }
3926 3666
3927 3667 /**
3928 - * Display a dismissable warning message and save its dismissal state.
3668 + * @since 2.0
3669 + * @deprecated 2.05.06
3670 + * @codeCoverageIgnore
3929 3671 *
3930 - * @since 6.3
3672 + * @param string $cache_key The unique name for this cache
3673 + * @param string $group The name of the cache group
3674 + * @param string $query If blank, don't run a db call
3675 + * @param string $type The wpdb function to use with this query
3931 3676 *
3932 - * @param string $message The warning message to display.
3933 - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action.
3934 - * @return void
3677 + * @return mixed $results The cache or query results
3935 3678 */
3936 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3937 - if ( ! $message || ! $option ) {
3938 - return;
3939 - }
3679 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3680 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3681 + }
3940 3682
3941 - $ajax_callback = function() use ( $option ) {
3942 - self::dismiss_warning_message( $option );
3943 - };
3683 + /**
3684 + * @deprecated 2.05.06
3685 + * @codeCoverageIgnore
3686 + */
3687 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3688 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3689 + }
3944 3690
3945 - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action.
3946 - // To prevent any issues, we add 'frm_' from the beginning of the action.
3947 - add_action( 'wp_ajax_frm_' . $option, $ajax_callback );
3691 + /**
3692 + * @deprecated 2.05.06
3693 + * @codeCoverageIgnore
3694 + */
3695 + public static function add_key_to_group_cache( $key, $group ) {
3696 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3697 + }
3948 3698
3949 - add_filter(
3950 - 'frm_message_list',
3951 - function( $show_messages ) use ( $message, $option ) {
3952 - if ( get_option( $option, false ) ) {
3953 - return $show_messages;
3954 - }
3699 + /**
3700 + * @deprecated 2.05.06
3701 + * @codeCoverageIgnore
3702 + */
3703 + public static function get_group_cached_keys( $group ) {
3704 + return FrmDeprecated::get_group_cached_keys( $group );
3705 + }
3955 3706
3956 - $dismiss_icon = self::icon_by_class(
3957 - 'frmfont frm_close_icon',
3958 - array(
3959 - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ),
3960 - 'echo' => false,
3961 - )
3962 - );
3707 + /**
3708 + * @since 2.0
3709 + * @deprecated 2.05.06
3710 + * @codeCoverageIgnore
3711 + * @return mixed The cached value or false
3712 + */
3713 + public static function check_cache_and_transient( $cache_key ) {
3714 + return FrmDeprecated::check_cache( $cache_key );
3715 + }
3963 3716
3964 - $show_messages[] = $message;
3965 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3717 + /**
3718 + * @since 2.0
3719 + * @deprecated 2.05.06
3720 + * @codeCoverageIgnore
3721 + *
3722 + * @param string $cache_key
3723 + */
3724 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3725 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3726 + }
3966 3727
3967 - return $show_messages;
3968 - }
3969 - );
3728 + /**
3729 + * @since 2.0
3730 + * @deprecated 2.05.06
3731 + * @codeCoverageIgnore
3732 + *
3733 + * @param string $group The name of the cache group
3734 + */
3735 + public static function cache_delete_group( $group ) {
3736 + FrmDeprecated::cache_delete_group( $group );
3970 3737 }
3971 3738
3972 3739 /**
3973 - * Dismiss a warning message and update the dismissal state.
3740 + * @since 1.07.10
3741 + * @deprecated 2.05.06
3742 + * @codeCoverageIgnore
3974 3743 *
3975 - * @since 6.3
3744 + * @param string $term The value to escape
3976 3745 *
3977 - * @param string $option The unique identifier for the dismissal state of the message.
3978 - * @return void
3746 + * @return string The escaped value
3979 3747 */
3980 - public static function dismiss_warning_message( $option = '' ) {
3981 - self::permission_check( 'frm_change_settings' );
3982 - check_ajax_referer( 'frm_ajax', 'nonce' );
3748 + public static function esc_like( $term ) {
3749 + return FrmDeprecated::esc_like( $term );
3750 + }
3983 3751
3984 - if ( $option ) {
3985 - update_option( $option, true, 'no' );
3986 - }
3752 + /**
3753 + * @param string $order_query
3754 + *
3755 + * @deprecated 2.05.06
3756 + * @codeCoverageIgnore
3757 + */
3758 + public static function esc_order( $order_query ) {
3759 + return FrmDeprecated::esc_order( $order_query );
3760 + }
3987 3761
3988 - wp_send_json_success();
3762 + /**
3763 + * @deprecated 2.05.06
3764 + * @codeCoverageIgnore
3765 + */
3766 + public static function esc_order_by( &$order_by ) {
3767 + FrmDeprecated::esc_order_by( $order_by );
3768 + }
3769 +
3770 + /**
3771 + * @param string $limit
3772 + *
3773 + * @deprecated 2.05.06
3774 + * @codeCoverageIgnore
3775 + */
3776 + public static function esc_limit( $limit ) {
3777 + return FrmDeprecated::esc_limit( $limit );
3778 + }
3779 +
3780 + /**
3781 + * @since 2.0
3782 + * @deprecated 2.05.06
3783 + * @codeCoverageIgnore
3784 + */
3785 + public static function prepare_array_values( $array, $type = '%s' ) {
3786 + return FrmDeprecated::prepare_array_values( $array, $type );
3787 + }
3788 +
3789 + /**
3790 + * @deprecated 2.05.06
3791 + * @codeCoverageIgnore
3792 + */
3793 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3794 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3795 + }
3796 +
3797 + /**
3798 + * @since 2.0
3799 + * @deprecated 5.0.13
3800 + *
3801 + * @return string The base Google APIS url for the current version of jQuery UI
3802 + */
3803 + public static function jquery_ui_base_url() {
3804 + _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3805 + return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3806 + }
3807 +
3808 + /**
3809 + * @since 4.07
3810 + * @deprecated x.x
3811 + */
3812 + public static function renewal_message() {
3813 + _deprecated_function( __METHOD__, 'x.x', 'FrmProAddonsController::renewal_message' );
3989 3814 }
3990 3815 }