PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2.04
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2.04
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 +260 -608 6.4.25.2.04 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.4.2';
14 + public static $plug_version = '5.2.04';
20 15
21 16 /**
22 17 * @since 1.07.02
23 18 *
@@ -152,24 +147,8 @@
152 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 x.x
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(
@@ -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,38 +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.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 374 * @return string The IP address of the current user
421 375 */
422 376 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 -
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 = '';
426 389 foreach ( $ip_options as $key ) {
427 390 if ( ! isset( $_SERVER[ $key ] ) ) {
428 391 continue;
429 392 }
@@ -429,9 +392,9 @@
429 392 }
430 393
431 394 $key = self::get_server_value( $key );
432 395 foreach ( explode( ',', $key ) as $ip ) {
433 - $ip = trim( $ip ); // Just to be safe.
396 + $ip = trim( $ip ); // just to be safe.
434 397
435 398 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
436 399 return sanitize_text_field( $ip );
437 400 }
@@ -440,52 +403,8 @@
440 403
441 404 return sanitize_text_field( $ip );
442 405 }
443 406
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 407 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
489 408 if ( strpos( $param, '[' ) ) {
490 409 $params = explode( '[', $param );
491 410 $param = $params[0];
@@ -1002,18 +921,8 @@
1002 921
1003 922 $html_atts = self::array_to_html_params( $atts );
1004 923
1005 924 $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 925 if ( $icon === $class ) {
1017 926 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
1018 927 } else {
1019 928 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1070,9 +979,9 @@
1070 979 * @param array $allowed_attr
1071 980 * @return array
1072 981 */
1073 982 public static function allow_vars_in_styles( $allowed_attr ) {
1074 - $allowed_attr[] = '--primary-700';
983 + $allowed_attr[] = '--primary-hover';
1075 984 return $allowed_attr;
1076 985 }
1077 986
1078 987 /**
@@ -1081,9 +990,9 @@
1081 990 * @param bool $allow_css
1082 991 * @param string $css_string
1083 992 */
1084 993 public static function allow_style( $allow_css, $css_string ) {
1085 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
994 + if ( ! $allow_css && 0 === strpos( $css_string, '--primary-hover:' ) ) {
1086 995 $split = explode( ':', $css_string, 2 );
1087 996 $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1088 997 }
1089 998 return $allow_css;
@@ -1112,9 +1021,9 @@
1112 1021 *
1113 1022 * @since 4.0.02
1114 1023 */
1115 1024 public static function include_svg() {
1116 - include_once self::plugin_path() . '/images/icons.svg';
1025 + include_once( self::plugin_path() . '/images/icons.svg' );
1117 1026 }
1118 1027
1119 1028 /**
1120 1029 * Convert an associative array to HTML values.
@@ -1150,11 +1059,9 @@
1150 1059 if ( ! $echo ) {
1151 1060 ob_start();
1152 1061 }
1153 1062
1154 - if ( is_callable( $echo_function ) ) {
1155 - $echo_function();
1156 - }
1063 + $echo_function();
1157 1064
1158 1065 if ( ! $echo ) {
1159 1066 $return = ob_get_contents();
1160 1067 ob_end_clean();
@@ -1177,94 +1084,31 @@
1177 1084 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1178 1085 }
1179 1086
1180 1087 /**
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 - * Print applicable admin banner.
1196 - *
1197 - * @since 5.4.2
1198 - *
1199 - * @param bool $should_show_lite_upgrade
1200 - * @return void
1201 - */
1202 - public static function print_admin_banner( $should_show_lite_upgrade ) {
1203 - if ( ! current_user_can( 'administrator' ) ) {
1204 - FrmInbox::maybe_show_banner();
1205 - return;
1206 - }
1207 -
1208 - if ( self::maybe_show_license_warning() || FrmInbox::maybe_show_banner() || ! $should_show_lite_upgrade || self::pro_is_installed() ) {
1209 - // Print license warning or inbox banner and exit if either prints.
1210 - // And exit before printing the upgrade bar if it shouldn't be shown.
1211 - return;
1212 - }
1213 - ?>
1214 - <div class="frm-upgrade-bar">
1215 - <span>You're using Formidable Forms Lite. To unlock more features consider</span>
1216 - <a href="<?php echo esc_url( self::admin_upgrade_link( 'top-bar' ) ); ?>" target="_blank" rel="noopener">upgrading to Pro</a>.
1217 - </div>
1218 - <?php
1219 - }
1220 -
1221 - /**
1222 - * @since 5.4.2
1223 - *
1224 - * @return bool True if a banner is available and shown.
1225 - */
1226 - private static function maybe_show_license_warning() {
1227 - return is_callable( 'FrmProAddonsController::admin_banner' ) && FrmProAddonsController::admin_banner();
1228 - }
1229 -
1230 - /**
1231 - * Render a button for a new item (Form, Application, etc).
1232 - *
1233 1088 * @since 3.0
1234 - * @param array $atts {
1235 - * @type array $link_hook Custom link hook, calls do_action and exits early.
1236 - * @type string $new_link Href value, default #.
1237 - * @type string $class Custom class names, space separated.
1238 - * @type string $button_text Button text. Default "Add New".
1239 - * }
1240 - * @return void
1089 + * @param array $atts
1241 1090 */
1242 1091 public static function add_new_item_link( $atts ) {
1243 - if ( isset( $atts['link_hook'] ) ) {
1092 + if ( ! empty( $atts['new_link'] ) ) {
1093 + ?>
1094 + <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus">
1095 + <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?>
1096 + <?php esc_html_e( 'Add New', 'formidable' ); ?>
1097 + </a>
1098 + <?php
1099 + } elseif ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1100 + ?>
1101 + <a href="#" class="button button-primary frm-button-primary frm-with-plus frm-trigger-new-form-modal">
1102 + <?php
1103 + self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' );
1104 + esc_html_e( 'Add New', 'formidable' );
1105 + ?>
1106 + </a>
1107 + <?php
1108 + } elseif ( isset( $atts['link_hook'] ) ) {
1244 1109 do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1245 - return;
1246 1110 }
1247 -
1248 - if ( empty( $atts['new_link'] ) && empty( $atts['trigger_new_form_modal'] ) && empty( $atts['class'] ) ) {
1249 - // Do not render a button if none of these attributes are set.
1250 - return;
1251 - }
1252 -
1253 - $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1254 - $class = 'button button-primary frm-button-primary';
1255 -
1256 - if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1257 - $class .= ' frm-trigger-new-form-modal';
1258 - }
1259 -
1260 - if ( ! empty( $atts['class'] ) ) {
1261 - $class .= ' ' . $atts['class'];
1262 - }
1263 -
1264 - $button_text = ! empty( $atts['button_text'] ) ? $atts['button_text'] : __( 'Add New', 'formidable' );
1265 -
1266 - require self::plugin_path() . '/classes/views/shared/add-button.php';
1267 1111 }
1268 1112
1269 1113 /**
1270 1114 * @since 3.06
@@ -1503,8 +1347,9 @@
1503 1347 public static function post_edit_link( $post_id ) {
1504 1348 $post = get_post( $post_id );
1505 1349 if ( $post ) {
1506 1350 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1351 + $post_url = self::maybe_full_screen_link( $post_url );
1507 1352
1508 1353 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1509 1354 }
1510 1355
@@ -1514,64 +1359,25 @@
1514 1359 /**
1515 1360 * Hide the WordPress menus on some pages.
1516 1361 *
1517 1362 * @since 4.0
1518 - *
1519 - * @return bool
1520 1363 */
1521 1364 public static function is_full_screen() {
1522 - return self::is_form_builder_page() ||
1523 - self::is_style_editor_page() ||
1524 - self::is_full_screen_view_builder_page();
1525 - }
1365 + $full_builder = self::is_form_builder_page();
1366 + $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' );
1367 + $full_entries = self::simple_get( 'frm-full', 'absint' );
1526 1368
1527 - /**
1528 - * Check if user is on the style editor or its alternative URL.
1529 - * The first URL is a submenu "Styles" in the Formidable menu /wp-admin/admin.php?page=formidable-styles.
1530 - * The alternative URL is linked as a submenu "Forms" item of the Appearance menu /wp-admin/themes.php?page=formidable-styles2.
1531 - *
1532 - * @since 5.5.3
1533 - * @since 6.0 Added the $view parameter. Previously there was only a 'edit' view.
1534 - *
1535 - * @param string $view Supports 'edit', 'list', and ''. If '', both 'edit' and 'list' will match.
1536 - * @return bool
1537 - */
1538 - public static function is_style_editor_page( $view = '' ) {
1539 - if ( ! self::is_admin_page( 'formidable-styles' ) && ! self::is_admin_page( 'formidable-styles2' ) ) {
1540 - return false;
1541 - }
1542 -
1543 - if ( ! in_array( $view, array( 'list', 'edit' ), true ) ) {
1544 - return true;
1545 - }
1546 -
1547 - $action = self::simple_get( 'frm_action' );
1548 - $is_edit_mode = 'edit' === $action || ( ! $action && ! self::simple_get( 'id' ) && ! self::simple_get( 'form' ) );
1549 -
1550 - if ( ! $is_edit_mode && class_exists( 'FrmProStylesController' ) && in_array( $action, array( 'new_style', 'duplicate' ), true ) ) {
1551 - $is_edit_mode = true;
1552 - }
1553 -
1554 - $checking_for_edit_mode = 'edit' === $view;
1555 -
1556 - return $is_edit_mode === $checking_for_edit_mode;
1369 + return $full_builder || $full_entries || $styler || self::is_view_builder_page();
1557 1370 }
1558 1371
1559 1372 /**
1560 - * @since 5.5.3
1561 - *
1562 - * @return bool
1563 - */
1564 - private static function is_full_screen_view_builder_page() {
1565 - return self::is_admin_page( 'formidable-views-editor' );
1566 - }
1567 -
1568 - /**
1569 1373 * @since 4.0
1570 - * @deprecated 5.5.3
1571 1374 */
1572 1375 public static function maybe_full_screen_link( $link ) {
1573 - _deprecated_function( __METHOD__, '5.5.3' );
1376 + $is_full = self::simple_get( 'frm-full', 'absint' );
1377 + if ( $is_full && ! empty( $link ) && $link !== '#' ) {
1378 + $link .= '&frm-full=1';
1379 + }
1574 1380 return $link;
1575 1381 }
1576 1382
1577 1383 /**
@@ -1631,10 +1437,19 @@
1631 1437 * @param string $type Supports `auto`, `pro`, or `pro_only`.
1632 1438 * @return array
1633 1439 */
1634 1440 public static function frm_capabilities( $type = 'auto' ) {
1635 - if ( ! self::pro_is_installed() && ! in_array( $type, array( 'pro', 'pro_only' ), true ) ) {
1636 - return self::get_lite_capabilities();
1441 + $cap = array(
1442 + 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1443 + 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1444 + 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1445 + 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1446 + 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1447 + 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1448 + );
1449 +
1450 + if ( ! self::pro_is_installed() && 'pro' !== $type && 'pro_only' !== $type ) {
1451 + return $cap;
1637 1452 }
1638 1453
1639 1454 $pro_cap = array(
1640 1455 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ),
@@ -1641,41 +1456,17 @@
1641 1456 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ),
1642 1457 'frm_view_reports' => __( 'View Reports', 'formidable' ),
1643 1458 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ),
1644 1459 );
1645 - /**
1646 - * @since 5.3.1
1647 - *
1648 - * @param array<string,string> $pro_cap
1649 - */
1650 - $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap );
1651 1460
1652 1461 if ( 'pro_only' === $type ) {
1653 1462 return $pro_cap;
1654 1463 }
1655 1464
1656 - return self::get_lite_capabilities() + $pro_cap;
1465 + return $cap + $pro_cap;
1657 1466 }
1658 1467
1659 1468 /**
1660 - * Get the list of lite plugin capabilities.
1661 - *
1662 - * @since 5.3.1
1663 - *
1664 - * @return array<string,string>
1665 - */
1666 - private static function get_lite_capabilities() {
1667 - return array(
1668 - 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1669 - 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1670 - 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1671 - 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1672 - 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1673 - 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1674 - );
1675 - }
1676 -
1677 - /**
1678 1469 * Call the WordPress current_user_can but also validate empty strings as true for any logged in user
1679 1470 *
1680 1471 * @since 4.06.03
1681 1472 *
@@ -2431,9 +2222,9 @@
2431 2222 *
2432 2223 * @return string $time_ago
2433 2224 */
2434 2225 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2435 - if ( empty( $to ) && 0 !== $to ) {
2226 + if ( empty( $to ) ) {
2436 2227 $now = new DateTime();
2437 2228 } else {
2438 2229 $now = new DateTime( '@' . $to );
2439 2230 }
@@ -2684,9 +2475,8 @@
2684 2475 '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' ),
2685 2476 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
2686 2477 /* translators: %1$s: Form name, %2$s: Date */
2687 2478 '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() ) ),
2688 - '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' ),
2689 2479 );
2690 2480
2691 2481 if ( ! isset( $tooltips[ $name ] ) ) {
2692 2482 return;
@@ -2713,12 +2503,8 @@
2713 2503 return;
2714 2504 }
2715 2505
2716 2506 $frm_action = self::simple_get( 'frm_action', 'sanitize_title' );
2717 - if ( 'lite-reports' === $frm_action ) {
2718 - $frm_action = 'reports';
2719 - }
2720 -
2721 2507 if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) {
2722 2508 echo ' class="current_page"';
2723 2509 }
2724 2510 }
@@ -2775,15 +2561,12 @@
2775 2561 }
2776 2562 }
2777 2563
2778 2564 /**
2779 - * Check for either json or serialized data. This is temporary while transitioning
2565 + * Check for either json or serilized data. This is temporary while transitioning
2780 2566 * all data to json.
2781 2567 *
2782 2568 * @since 4.02.03
2783 - *
2784 - * @param array|string $value
2785 - * @return void
2786 2569 */
2787 2570 public static function unserialize_or_decode( &$value ) {
2788 2571 if ( is_array( $value ) ) {
2789 2572 return;
@@ -2789,9 +2572,9 @@
2789 2572 return;
2790 2573 }
2791 2574
2792 2575 if ( is_serialized( $value ) ) {
2793 - $value = self::maybe_unserialize_array( $value );
2576 + $value = maybe_unserialize( $value );
2794 2577 } else {
2795 2578 $value = self::maybe_json_decode( $value, false );
2796 2579 }
2797 2580 }
@@ -2796,35 +2579,8 @@
2796 2579 }
2797 2580 }
2798 2581
2799 2582 /**
2800 - * Safely unserialize an array if necessary.
2801 - * This function doesn't actually use unserialize. The string is parsed instead.
2802 - *
2803 - * @since 6.2
2804 - *
2805 - * @param mixed $value
2806 - * @return mixed
2807 - */
2808 - public static function maybe_unserialize_array( $value ) {
2809 - if ( ! is_string( $value ) ) {
2810 - return $value;
2811 - }
2812 -
2813 - // Since we only expect an array, skip anything that doesn't start with a:.
2814 - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) {
2815 - return $value;
2816 - }
2817 -
2818 - $parsed = FrmSerializedStringParserHelper::get()->parse( $value );
2819 - if ( is_array( $parsed ) ) {
2820 - $value = $parsed;
2821 - }
2822 -
2823 - return $value;
2824 - }
2825 -
2826 - /**
2827 2583 * Decode a JSON string.
2828 2584 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2829 2585 *
2830 2586 * @param mixed $string
@@ -2851,36 +2607,8 @@
2851 2607 return $string;
2852 2608 }
2853 2609
2854 2610 /**
2855 - * @since 6.2.3
2856 - *
2857 - * @param string $value
2858 - * @return string
2859 - */
2860 - public static function maybe_utf8_encode( $value ) {
2861 - $from_format = 'ISO-8859-1';
2862 - $to_format = 'UTF-8';
2863 -
2864 - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) {
2865 - if ( mb_check_encoding( $value, $from_format ) ) {
2866 - return mb_convert_encoding( $value, $to_format, $from_format );
2867 - }
2868 - return $value;
2869 - }
2870 -
2871 - if ( function_exists( 'iconv' ) ) {
2872 - $converted = iconv( $from_format, $to_format, $value );
2873 - // Value is false if $value is not ISO-8859-1.
2874 - if ( false !== $converted ) {
2875 - return $converted;
2876 - }
2877 - }
2878 -
2879 - return $value;
2880 - }
2881 -
2882 - /**
2883 2611 * Reformat the json serialized array in name => value array.
2884 2612 *
2885 2613 * @since 4.02.03
2886 2614 */
@@ -2946,17 +2674,14 @@
2946 2674 $version = self::plugin_version();
2947 2675 wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
2948 2676
2949 2677 $global_strings = array(
2950 - 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2951 - 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2952 - 'url' => self::plugin_url(),
2953 - 'app_url' => 'https://formidableforms.com/',
2954 - 'applicationsUrl' => admin_url( 'admin.php?page=formidable-applications' ),
2955 - 'canAccessApplicationDashboard' => current_user_can( is_callable( 'FrmProApplicationsHelper::get_required_templates_capability' ) ? FrmProApplicationsHelper::get_required_templates_capability() : 'frm_edit_forms' ),
2956 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2957 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2958 - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ),
2678 + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2679 + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2680 + 'url' => self::plugin_url(),
2681 + 'app_url' => 'https://formidableforms.com/',
2682 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2683 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2959 2684 );
2960 2685 wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings );
2961 2686
2962 2687 if ( $load ) {
@@ -2980,21 +2705,19 @@
2980 2705 $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2981 2706 $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2982 2707
2983 2708 $script_strings = array(
2984 - 'ajax_url' => $ajax_url,
2985 - 'images_url' => self::plugin_url() . '/images',
2986 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2987 - 'remove' => __( 'Remove', 'formidable' ),
2988 - 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2989 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2990 - 'id' => __( 'ID', 'formidable' ),
2991 - 'no_results' => __( 'No results match', 'formidable' ),
2992 - 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2993 - 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2994 - 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
2995 - 'focus_first_error' => self::should_focus_first_error(),
2996 - 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
2709 + 'ajax_url' => $ajax_url,
2710 + 'images_url' => self::plugin_url() . '/images',
2711 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2712 + 'remove' => __( 'Remove', 'formidable' ),
2713 + 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2714 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2715 + 'id' => __( 'ID', 'formidable' ),
2716 + 'no_results' => __( 'No results match', 'formidable' ),
2717 + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2718 + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2719 + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
2997 2720 );
2998 2721
2999 2722 $data = $wp_scripts->get_data( 'formidable', 'data' );
3000 2723 if ( empty( $data ) ) {
@@ -3006,10 +2729,10 @@
3006 2729 $admin_script_strings = array(
3007 2730 'desc' => __( '(Click to add description)', 'formidable' ),
3008 2731 'blank' => __( '(Blank)', 'formidable' ),
3009 2732 'no_label' => __( '(no label)', 'formidable' ),
3010 - 'saving' => '', // Deprecated in 6.0.
3011 - 'saved' => '', // Deprecated in 6.0.
2733 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2734 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
3012 2735 'ok' => __( 'OK', 'formidable' ),
3013 2736 'cancel' => __( 'Cancel', 'formidable' ),
3014 2737 'default_label' => __( 'Default', 'formidable' ),
3015 2738 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
@@ -3015,8 +2738,9 @@
3015 2738 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
3016 2739 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
3017 2740 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
3018 2741 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2742 + 'caution' => __( 'Heads up', 'formidable' ),
3019 2743 'confirm' => __( 'Are you sure?', 'formidable' ),
3020 2744 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
3021 2745 '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' ),
3022 2746 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
@@ -3051,9 +2775,8 @@
3051 2775 'install' => __( 'Install', 'formidable' ),
3052 2776 'active' => __( 'Active', 'formidable' ),
3053 2777 'select_a_field' => __( 'Select a Field', 'formidable' ),
3054 2778 'no_items_found' => __( 'No items found.', 'formidable' ),
3055 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3056 2779 );
3057 2780 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3058 2781
3059 2782 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
@@ -3063,30 +2786,8 @@
3063 2786 }
3064 2787 }
3065 2788
3066 2789 /**
3067 - * Returns whether or not the first errored input should be auto-focused (default true).
3068 - *
3069 - * @since 5.2.05
3070 - *
3071 - * @return bool
3072 - */
3073 - private static function should_focus_first_error() {
3074 - return (bool) apply_filters( 'frm_focus_first_error', true );
3075 - }
3076 -
3077 - /**
3078 - * Returns whether or not field errors should include role="alert" (default true).
3079 - *
3080 - * @since 5.2.05
3081 - *
3082 - * @return bool
3083 - */
3084 - public static function should_include_alert_role_on_field_errors() {
3085 - return (bool) apply_filters( 'frm_include_alert_role_on_field_errors', true );
3086 - }
3087 -
3088 - /**
3089 2790 * Echo the message on the plugins listing page
3090 2791 *
3091 2792 * @since 1.07.10
3092 2793 *
@@ -3109,10 +2810,8 @@
3109 2810 /**
3110 2811 * If Pro is far outdated, show a message.
3111 2812 *
3112 2813 * @since 4.0.01
3113 - *
3114 - * @return void
3115 2814 */
3116 2815 public static function min_pro_version_notice( $min_version ) {
3117 2816 if ( ! self::is_formidable_admin() ) {
3118 2817 // Don't show admin-wide.
@@ -3128,9 +2827,9 @@
3128 2827
3129 2828 $pro_version = FrmProDb::$plug_version;
3130 2829 $expired = FrmAddonsController::is_license_expired();
3131 2830 ?>
3132 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2831 + <div class="error frm_previous_install">
3133 2832 <?php
3134 2833 esc_html_e( 'You are running a version of Formidable Forms that may not be compatible with your version of Formidable Forms Pro.', 'formidable' );
3135 2834 if ( empty( $expired ) ) {
3136 2835 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3169,9 +2868,9 @@
3169 2868 }
3170 2869
3171 2870 foreach ( $message as $m ) {
3172 2871 ?>
3173 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2872 + <div class="error frm_previous_install">
3174 2873 <?php echo esc_html( $m ); ?>
3175 2874 </div>
3176 2875 <?php
3177 2876 }
@@ -3176,25 +2875,17 @@
3176 2875 <?php
3177 2876 }
3178 2877 }
3179 2878
3180 - /**
3181 - * @param string $type
3182 - * @return array<string,string>
3183 - */
3184 2879 public static function locales( $type = 'date' ) {
3185 2880 $locales = array(
3186 2881 'en' => __( 'English', 'formidable' ),
3187 2882 'af' => __( 'Afrikaans', 'formidable' ),
3188 2883 'sq' => __( 'Albanian', 'formidable' ),
3189 - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ),
3190 - 'am' => __( 'Amharic', 'formidable' ),
3191 2884 'ar' => __( 'Arabic', 'formidable' ),
3192 2885 'hy' => __( 'Armenian', 'formidable' ),
3193 2886 'az' => __( 'Azerbaijani', 'formidable' ),
3194 2887 'eu' => __( 'Basque', 'formidable' ),
3195 - 'be' => __( 'Belarusian', 'formidable' ),
3196 - 'bn' => __( 'Bengali', 'formidable' ),
3197 2888 'bs' => __( 'Bosnian', 'formidable' ),
3198 2889 'bg' => __( 'Bulgarian', 'formidable' ),
3199 2890 'ca' => __( 'Catalan', 'formidable' ),
3200 2891 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
@@ -3213,15 +2904,12 @@
3213 2904 'fi' => __( 'Finnish', 'formidable' ),
3214 2905 'fr' => __( 'French', 'formidable' ),
3215 2906 'fr-CA' => __( 'French/Canadian', 'formidable' ),
3216 2907 'fr-CH' => __( 'French/Swiss', 'formidable' ),
3217 - 'gl' => __( 'Galician', 'formidable' ),
3218 - 'ka' => __( 'Georgian', 'formidable' ),
3219 2908 'de' => __( 'German', 'formidable' ),
3220 2909 'de-AT' => __( 'German/Austria', 'formidable' ),
3221 2910 'de-CH' => __( 'German/Switzerland', 'formidable' ),
3222 2911 'el' => __( 'Greek', 'formidable' ),
3223 - 'gu' => __( 'Gujarati', 'formidable' ),
3224 2912 'he' => __( 'Hebrew', 'formidable' ),
3225 2913 'iw' => __( 'Hebrew', 'formidable' ),
3226 2914 'hi' => __( 'Hindi', 'formidable' ),
3227 2915 'hu' => __( 'Hungarian', 'formidable' ),
@@ -3228,74 +2916,44 @@
3228 2916 'is' => __( 'Icelandic', 'formidable' ),
3229 2917 'id' => __( 'Indonesian', 'formidable' ),
3230 2918 'it' => __( 'Italian', 'formidable' ),
3231 2919 'ja' => __( 'Japanese', 'formidable' ),
3232 - 'kn' => __( 'Kannada', 'formidable' ),
3233 - 'kk' => __( 'Kazakh', 'formidable' ),
3234 - 'km' => __( 'Khmer', 'formidable' ),
3235 2920 'ko' => __( 'Korean', 'formidable' ),
3236 - 'ky' => __( 'Kyrgyz', 'formidable' ),
3237 - 'lo' => __( 'Laothian', 'formidable' ),
3238 2921 'lv' => __( 'Latvian', 'formidable' ),
3239 2922 'lt' => __( 'Lithuanian', 'formidable' ),
3240 - 'lb' => __( 'Luxembourgish', 'formidable' ),
3241 - 'mk' => __( 'Macedonian', 'formidable' ),
3242 - 'ml' => __( 'Malayalam', 'formidable' ),
3243 2923 'ms' => __( 'Malaysian', 'formidable' ),
3244 - 'mr' => __( 'Marathi', 'formidable' ),
3245 2924 'no' => __( 'Norwegian', 'formidable' ),
3246 - 'nb' => __( 'Norwegian Bokmål', 'formidable' ),
3247 - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ),
3248 2925 'pl' => __( 'Polish', 'formidable' ),
3249 2926 'pt' => __( 'Portuguese', 'formidable' ),
3250 2927 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
3251 2928 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ),
3252 - 'rm' => __( 'Romansh', 'formidable' ),
3253 2929 'ro' => __( 'Romanian', 'formidable' ),
3254 2930 'ru' => __( 'Russian', 'formidable' ),
3255 2931 'sr' => __( 'Serbian', 'formidable' ),
3256 2932 'sr-SR' => __( 'Serbian', 'formidable' ),
3257 - 'si' => __( 'Sinhalese', 'formidable' ),
3258 2933 'sk' => __( 'Slovak', 'formidable' ),
3259 2934 'sl' => __( 'Slovenian', 'formidable' ),
3260 2935 'es' => __( 'Spanish', 'formidable' ),
3261 2936 'es-419' => __( 'Spanish/Latin America', 'formidable' ),
3262 - 'sw' => __( 'Swahili', 'formidable' ),
3263 2937 'sv' => __( 'Swedish', 'formidable' ),
3264 2938 'ta' => __( 'Tamil', 'formidable' ),
3265 - 'te' => __( 'Telugu', 'formidable' ),
3266 2939 'th' => __( 'Thai', 'formidable' ),
3267 - 'tj' => __( 'Tajiki', 'formidable' ),
3268 2940 'tr' => __( 'Turkish', 'formidable' ),
3269 2941 'uk' => __( 'Ukrainian', 'formidable' ),
3270 - 'ur' => __( 'Urdu', 'formidable' ),
3271 2942 'vi' => __( 'Vietnamese', 'formidable' ),
3272 - 'cy-GB' => __( 'Welsh', 'formidable' ),
3273 - 'zu' => __( 'Zulu', 'formidable' ),
3274 2943 );
3275 2944
3276 2945 if ( $type === 'captcha' ) {
3277 2946 // remove the languages unavailable for the captcha
3278 - $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' );
2947 + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
3279 2948 } else {
3280 2949 // remove the languages unavailable for the datepicker
3281 - $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' );
2950 + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
3282 2951 }
3283 2952
3284 2953 $locales = array_diff_key( $locales, array_flip( $unset ) );
2954 + $locales = apply_filters( 'frm_locales', $locales );
3285 2955
3286 - /**
3287 - * Filter available locale options.
3288 - *
3289 - * @since 5.4.5 Added $args parameter with type.
3290 - *
3291 - * @param array<string,string> $locales
3292 - * @param array $args {
3293 - * @type string $type
3294 - * }
3295 - */
3296 - $locales = apply_filters( 'frm_locales', $locales, compact( 'type' ) );
3297 -
3298 2956 return $locales;
3299 2957 }
3300 2958
3301 2959 /**
@@ -3601,12 +3259,11 @@
3601 3259 * @return array
3602 3260 */
3603 3261 public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) {
3604 3262 $params = array(
3605 - 'medium' => $medium,
3606 - 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3607 - 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3608 - 'screenshot' => 'landing.png',
3263 + 'medium' => $medium,
3264 + 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3265 + 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3609 3266 );
3610 3267 return self::get_upgrade_data_params( 'landing', $params );
3611 3268 }
3612 3269
@@ -3688,8 +3345,36 @@
3688 3345 set_current_screen();
3689 3346 }
3690 3347
3691 3348 /**
3349 + * @since 4.07
3350 + * @deprecated 4.09.01
3351 + */
3352 + public static function renewal_message() {
3353 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
3354 + FrmProAddonsController::renewal_message();
3355 + return;
3356 + }
3357 +
3358 + if ( ! FrmAddonsController::is_license_expired() ) {
3359 + return;
3360 + }
3361 +
3362 + ?>
3363 + <div class="frm_error_style" style="text-align:left">
3364 + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
3365 + &nbsp;
3366 + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
3367 + <div style="float:right">
3368 + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
3369 + <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
3370 + </a>
3371 + </div>
3372 + </div>
3373 + <?php
3374 + }
3375 +
3376 + /**
3692 3377 * Shows pill text.
3693 3378 *
3694 3379 * @since 5.2.02
3695 3380 *
@@ -3702,246 +3387,213 @@
3702 3387 echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
3703 3388 }
3704 3389
3705 3390 /**
3706 - * Count the number of decimals digits.
3707 - *
3708 - * @since 5.2.07
3709 - *
3710 - * @param mixed $num Number.
3711 - * @return int|false Returns `false` if the passed parameter is not number.
3391 + * @since 4.08
3392 + * @deprecated 4.09.01
3712 3393 */
3713 - public static function count_decimals( $num ) {
3714 - if ( ! is_numeric( $num ) ) {
3715 - return false;
3394 + public static function expiring_message() {
3395 + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3396 + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3397 + FrmProAddonsController::expiring_message();
3716 3398 }
3717 -
3718 - $num = (string) $num;
3719 - $parts = explode( '.', $num );
3720 - if ( 1 === count( $parts ) ) {
3721 - return 0;
3722 - }
3723 -
3724 - return strlen( $parts[ count( $parts ) - 1 ] );
3725 3399 }
3726 3400
3727 3401 /**
3728 - * Prevent a fatal error in PHP8 if gmt_offset happens to be set an empty string.
3729 - * This is a bug in WordPress. It isn't safe to call current_time( 'timestamp' ) without this with an empty string offset.
3730 - * In the future this might be safe to remove. Keep an eye on the current_time function in functions.php.
3402 + * Use the WP 4.7 wp_doing_ajax function
3731 3403 *
3732 - * @since 5.3.1
3733 - *
3734 - * @return void
3404 + * @since 2.05.07
3405 + * @deprecated 4.04.04
3735 3406 */
3736 - public static function filter_gmt_offset() {
3737 - if ( self::$added_gmt_offset_filter ) {
3738 - // Avoid adding twice.
3739 - return;
3740 - }
3407 + public static function wp_doing_ajax() {
3408 + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3409 + return wp_doing_ajax();
3410 + }
3741 3411
3742 - add_filter(
3743 - 'option_gmt_offset',
3744 - function( $offset ) {
3745 - if ( ! is_string( $offset ) || is_numeric( $offset ) ) {
3746 - // Leave a valid value alone.
3747 - return $offset;
3748 - }
3749 -
3750 - return 0;
3751 - }
3752 - );
3753 - self::$added_gmt_offset_filter = true;
3412 + /**
3413 + * @deprecated 4.0
3414 + */
3415 + public static function insert_opt_html( $args ) {
3416 + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3417 + FrmFormsHelper::insert_opt_html( $args );
3754 3418 }
3755 3419
3756 3420 /**
3757 - * @since 5.3.1
3421 + * Used to filter shortcode in text widgets
3758 3422 *
3759 - * @return bool
3423 + * @deprecated 2.5.4
3424 + * @codeCoverageIgnore
3760 3425 */
3761 - public static function on_form_listing_page() {
3762 - if ( ! self::is_admin_page( 'formidable' ) ) {
3763 - return false;
3764 - }
3426 + public static function widget_text_filter_callback( $matches ) {
3427 + return FrmDeprecated::widget_text_filter_callback( $matches );
3428 + }
3765 3429
3766 - $action = self::simple_get( 'frm_action', 'sanitize_title' );
3767 - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true );
3430 + /**
3431 + * @deprecated 3.01
3432 + * @codeCoverageIgnore
3433 + */
3434 + public static function sanitize_array( &$values ) {
3435 + FrmDeprecated::sanitize_array( $values );
3768 3436 }
3769 3437
3770 3438 /**
3771 - * Get all actions that also display the forms list.
3439 + * @param array $settings
3440 + * @param string $group
3772 3441 *
3773 - * @since 5.3.1
3774 - *
3775 - * @return array<string>
3442 + * @since 2.0.6
3443 + * @deprecated 2.05.06
3444 + * @codeCoverageIgnore
3776 3445 */
3777 - private static function get_form_listing_page_actions() {
3778 - return array( 'list', 'trash', 'untrash', 'destroy' );
3446 + public static function save_settings( $settings, $group ) {
3447 + return FrmDeprecated::save_settings( $settings, $group );
3779 3448 }
3780 3449
3781 3450 /**
3782 - * Safely call get_plugins, importing the required files if they are not yet loaded.
3783 - *
3784 - * @since 5.5
3785 - *
3786 - * @return array
3451 + * @since 2.0.4
3452 + * @deprecated 2.05.06
3453 + * @codeCoverageIgnore
3787 3454 */
3788 - public static function get_plugins() {
3789 - if ( ! function_exists( 'get_plugins' ) ) {
3790 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
3791 - }
3792 - return get_plugins();
3455 + public static function save_json_post( $settings ) {
3456 + return FrmDeprecated::save_json_post( $settings );
3793 3457 }
3794 3458
3795 3459 /**
3796 - * 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.
3797 - * This is to make sure that the URL can't be exploited for a SSRF attack.
3460 + * @since 2.0
3461 + * @deprecated 2.05.06
3462 + * @codeCoverageIgnore
3798 3463 *
3799 - * @since 5.5.5
3464 + * @param string $cache_key The unique name for this cache
3465 + * @param string $group The name of the cache group
3466 + * @param string $query If blank, don't run a db call
3467 + * @param string $type The wpdb function to use with this query
3800 3468 *
3801 - * @param string $url
3802 - * @param string $expected_extension
3803 - * @return bool
3469 + * @return mixed $results The cache or query results
3804 3470 */
3805 - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) {
3806 - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' );
3807 - if ( ! $file_is_in_expected_s3_bucket ) {
3808 - return false;
3809 - }
3810 -
3811 - $parsed = parse_url( $url );
3812 - if ( ! is_array( $parsed ) ) {
3813 - // URL is malformed.
3814 - return false;
3815 - }
3816 -
3817 - $path = $parsed['path'];
3818 - $ext = pathinfo( $path, PATHINFO_EXTENSION );
3819 - if ( $expected_extension !== $ext ) {
3820 - // The URL isn't to an XML file.
3821 - return false;
3822 - }
3823 -
3824 - return true;
3471 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3472 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3825 3473 }
3826 3474
3827 3475 /**
3828 - * @since 4.08
3829 - * @deprecated 4.09.01
3476 + * @deprecated 2.05.06
3477 + * @codeCoverageIgnore
3830 3478 */
3831 - public static function expiring_message() {
3832 - _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3833 - if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3834 - FrmProAddonsController::expiring_message();
3835 - }
3479 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3480 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3836 3481 }
3837 3482
3838 3483 /**
3839 - * Use the WP 4.7 wp_doing_ajax function
3840 - *
3841 - * @since 2.05.07
3842 - * @deprecated 4.04.04
3484 + * @deprecated 2.05.06
3485 + * @codeCoverageIgnore
3843 3486 */
3844 - public static function wp_doing_ajax() {
3845 - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3846 - return wp_doing_ajax();
3487 + public static function add_key_to_group_cache( $key, $group ) {
3488 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3847 3489 }
3848 3490
3849 3491 /**
3850 - * @deprecated 4.0
3492 + * @deprecated 2.05.06
3493 + * @codeCoverageIgnore
3851 3494 */
3852 - public static function insert_opt_html( $args ) {
3853 - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3854 - FrmFormsHelper::insert_opt_html( $args );
3495 + public static function get_group_cached_keys( $group ) {
3496 + return FrmDeprecated::get_group_cached_keys( $group );
3855 3497 }
3856 3498
3857 3499 /**
3858 - * @deprecated 3.01
3500 + * @since 2.0
3501 + * @deprecated 2.05.06
3859 3502 * @codeCoverageIgnore
3503 + * @return mixed The cached value or false
3860 3504 */
3861 - public static function sanitize_array( &$values ) {
3862 - FrmDeprecated::sanitize_array( $values );
3505 + public static function check_cache_and_transient( $cache_key ) {
3506 + return FrmDeprecated::check_cache( $cache_key );
3863 3507 }
3864 3508
3865 3509 /**
3866 3510 * @since 2.0
3867 - * @deprecated 5.0.13
3511 + * @deprecated 2.05.06
3512 + * @codeCoverageIgnore
3868 3513 *
3869 - * @return string The base Google APIS url for the current version of jQuery UI
3514 + * @param string $cache_key
3870 3515 */
3871 - public static function jquery_ui_base_url() {
3872 - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3873 - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3516 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3517 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3874 3518 }
3875 3519
3876 3520 /**
3877 - * @since 4.07
3878 - * @deprecated 6.0
3521 + * @since 2.0
3522 + * @deprecated 2.05.06
3523 + * @codeCoverageIgnore
3524 + *
3525 + * @param string $group The name of the cache group
3879 3526 */
3880 - public static function renewal_message() {
3881 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3527 + public static function cache_delete_group( $group ) {
3528 + FrmDeprecated::cache_delete_group( $group );
3882 3529 }
3883 3530
3884 3531 /**
3885 - * Display a dismissable warning message and save its dismissal state.
3532 + * @since 1.07.10
3533 + * @deprecated 2.05.06
3534 + * @codeCoverageIgnore
3886 3535 *
3887 - * @since 6.3
3536 + * @param string $term The value to escape
3888 3537 *
3889 - * @param string $message The warning message to display.
3890 - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action.
3891 - * @return void
3538 + * @return string The escaped value
3892 3539 */
3893 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3894 - if ( ! $message || ! $option ) {
3895 - return;
3896 - }
3540 + public static function esc_like( $term ) {
3541 + return FrmDeprecated::esc_like( $term );
3542 + }
3897 3543
3898 - $ajax_callback = function() use ( $option ) {
3899 - self::dismiss_warning_message( $option );
3900 - };
3544 + /**
3545 + * @param string $order_query
3546 + *
3547 + * @deprecated 2.05.06
3548 + * @codeCoverageIgnore
3549 + */
3550 + public static function esc_order( $order_query ) {
3551 + return FrmDeprecated::esc_order( $order_query );
3552 + }
3901 3553
3902 - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action.
3903 - // To prevent any issues, we add 'frm_' from the beginning of the action.
3904 - add_action( 'wp_ajax_frm_' . $option, $ajax_callback );
3554 + /**
3555 + * @deprecated 2.05.06
3556 + * @codeCoverageIgnore
3557 + */
3558 + public static function esc_order_by( &$order_by ) {
3559 + FrmDeprecated::esc_order_by( $order_by );
3560 + }
3905 3561
3906 - add_filter(
3907 - 'frm_message_list',
3908 - function( $show_messages ) use ( $message, $option ) {
3909 - if ( get_option( $option, false ) ) {
3910 - return $show_messages;
3911 - }
3562 + /**
3563 + * @param string $limit
3564 + *
3565 + * @deprecated 2.05.06
3566 + * @codeCoverageIgnore
3567 + */
3568 + public static function esc_limit( $limit ) {
3569 + return FrmDeprecated::esc_limit( $limit );
3570 + }
3912 3571
3913 - $dismiss_icon = self::icon_by_class(
3914 - 'frmfont frm_close_icon',
3915 - array(
3916 - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ),
3917 - 'echo' => false,
3918 - )
3919 - );
3572 + /**
3573 + * @since 2.0
3574 + * @deprecated 2.05.06
3575 + * @codeCoverageIgnore
3576 + */
3577 + public static function prepare_array_values( $array, $type = '%s' ) {
3578 + return FrmDeprecated::prepare_array_values( $array, $type );
3579 + }
3920 3580
3921 - $show_messages[] = $message;
3922 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3923 -
3924 - return $show_messages;
3925 - }
3926 - );
3581 + /**
3582 + * @deprecated 2.05.06
3583 + * @codeCoverageIgnore
3584 + */
3585 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3586 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3927 3587 }
3928 3588
3929 3589 /**
3930 - * Dismiss a warning message and update the dismissal state.
3590 + * @since 2.0
3591 + * @deprecated 5.0.13
3931 3592 *
3932 - * @since 6.3
3933 - *
3934 - * @param string $option The unique identifier for the dismissal state of the message.
3935 - * @return void
3593 + * @return string The base Google APIS url for the current version of jQuery UI
3936 3594 */
3937 - public static function dismiss_warning_message( $option = '' ) {
3938 - self::permission_check( 'frm_change_settings' );
3939 - check_ajax_referer( 'frm_ajax', 'nonce' );
3940 -
3941 - if ( $option ) {
3942 - update_option( $option, true, 'no' );
3943 - }
3944 -
3945 - wp_send_json_success();
3595 + public static function jquery_ui_base_url() {
3596 + _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3597 + return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3946 3598 }
3947 3599 }