PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.14
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 +242 -731 6.4.25.0.14 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.0.14';
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 *
@@ -2013,38 +1804,21 @@
2013 1804 }
2014 1805
2015 1806 $key = self::prevent_numeric_and_reserved_keys( $key );
2016 1807
2017 - $similar_keys = FrmDb::get_col(
1808 + $key_check = FrmDb::get_var(
2018 1809 $table_name,
2019 1810 array(
2020 - $column . ' like%' => $key,
2021 - 'ID !' => $id,
1811 + $column => $key,
1812 + 'ID !' => $id,
2022 1813 ),
2023 1814 $column
2024 1815 );
2025 1816
2026 - // Create a unique field id if it has already been used.
2027 - if ( in_array( $key, $similar_keys, true ) ) {
1817 + if ( $key_check || is_numeric( $key_check ) ) {
2028 1818 $key = self::maybe_truncate_key_before_appending( $column, $key );
2029 -
2030 - /**
2031 - * Allow for a custom separator between the attempted key and the generated suffix.
2032 - *
2033 - * @since 5.2.03
2034 - *
2035 - * @param string $separator. Default empty.
2036 - * @param string $key the key without the added suffix.
2037 - */
2038 - $separator = apply_filters( 'frm_unique_' . $column . '_separator', '', $key );
2039 -
2040 - $suffix = 2;
2041 - do {
2042 - $key_check = $key . $separator . $suffix;
2043 - ++$suffix;
2044 - } while ( in_array( $key_check, $similar_keys, true ) );
2045 -
2046 - $key = $key_check;
1819 + // Create a unique field id if it has already been used.
1820 + $key = $key . substr( md5( microtime() . rand() ), 0, 10 );
2047 1821 }
2048 1822
2049 1823 return $key;
2050 1824 }
@@ -2061,11 +1835,8 @@
2061 1835 if ( in_array( $column, array( 'form_key', 'field_key' ), true ) ) {
2062 1836 $max_key_length_before_truncating = 60;
2063 1837 if ( strlen( $key ) > $max_key_length_before_truncating ) {
2064 1838 $key = substr( $key, 0, $max_key_length_before_truncating );
2065 - if ( is_numeric( $key ) ) {
2066 - $key .= 'a';
2067 - }
2068 1839 }
2069 1840 }
2070 1841 return $key;
2071 1842 }
@@ -2431,9 +2202,9 @@
2431 2202 *
2432 2203 * @return string $time_ago
2433 2204 */
2434 2205 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2435 - if ( empty( $to ) && 0 !== $to ) {
2206 + if ( empty( $to ) ) {
2436 2207 $now = new DateTime();
2437 2208 } else {
2438 2209 $now = new DateTime( '@' . $to );
2439 2210 }
@@ -2684,9 +2455,8 @@
2684 2455 '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 2456 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
2686 2457 /* translators: %1$s: Form name, %2$s: Date */
2687 2458 '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 2459 );
2690 2460
2691 2461 if ( ! isset( $tooltips[ $name ] ) ) {
2692 2462 return;
@@ -2713,12 +2483,8 @@
2713 2483 return;
2714 2484 }
2715 2485
2716 2486 $frm_action = self::simple_get( 'frm_action', 'sanitize_title' );
2717 - if ( 'lite-reports' === $frm_action ) {
2718 - $frm_action = 'reports';
2719 - }
2720 -
2721 2487 if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) {
2722 2488 echo ' class="current_page"';
2723 2489 }
2724 2490 }
@@ -2775,15 +2541,12 @@
2775 2541 }
2776 2542 }
2777 2543
2778 2544 /**
2779 - * Check for either json or serialized data. This is temporary while transitioning
2545 + * Check for either json or serilized data. This is temporary while transitioning
2780 2546 * all data to json.
2781 2547 *
2782 2548 * @since 4.02.03
2783 - *
2784 - * @param array|string $value
2785 - * @return void
2786 2549 */
2787 2550 public static function unserialize_or_decode( &$value ) {
2788 2551 if ( is_array( $value ) ) {
2789 2552 return;
@@ -2789,9 +2552,9 @@
2789 2552 return;
2790 2553 }
2791 2554
2792 2555 if ( is_serialized( $value ) ) {
2793 - $value = self::maybe_unserialize_array( $value );
2556 + $value = maybe_unserialize( $value );
2794 2557 } else {
2795 2558 $value = self::maybe_json_decode( $value, false );
2796 2559 }
2797 2560 }
@@ -2796,44 +2559,13 @@
2796 2559 }
2797 2560 }
2798 2561
2799 2562 /**
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 2563 * Decode a JSON string.
2828 2564 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2829 - *
2830 - * @param mixed $string
2831 - * @param bool $single_to_array
2832 - * @return mixed
2833 2565 */
2834 2566 public static function maybe_json_decode( $string, $single_to_array = true ) {
2835 - if ( is_array( $string ) || is_null( $string ) ) {
2567 + if ( is_array( $string ) ) {
2836 2568 return $string;
2837 2569 }
2838 2570
2839 2571 $new_string = json_decode( $string, true );
@@ -2851,36 +2583,8 @@
2851 2583 return $string;
2852 2584 }
2853 2585
2854 2586 /**
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 2587 * Reformat the json serialized array in name => value array.
2884 2588 *
2885 2589 * @since 4.02.03
2886 2590 */
@@ -2946,17 +2650,14 @@
2946 2650 $version = self::plugin_version();
2947 2651 wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
2948 2652
2949 2653 $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' ),
2654 + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2655 + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2656 + 'url' => self::plugin_url(),
2657 + 'app_url' => 'https://formidableforms.com/',
2658 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2659 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2959 2660 );
2960 2661 wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings );
2961 2662
2962 2663 if ( $load ) {
@@ -2980,21 +2681,19 @@
2980 2681 $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2981 2682 $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2982 2683
2983 2684 $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(),
2685 + 'ajax_url' => $ajax_url,
2686 + 'images_url' => self::plugin_url() . '/images',
2687 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2688 + 'remove' => __( 'Remove', 'formidable' ),
2689 + 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2690 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2691 + 'id' => __( 'ID', 'formidable' ),
2692 + 'no_results' => __( 'No results match', 'formidable' ),
2693 + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2694 + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2695 + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
2997 2696 );
2998 2697
2999 2698 $data = $wp_scripts->get_data( 'formidable', 'data' );
3000 2699 if ( empty( $data ) ) {
@@ -3006,10 +2705,10 @@
3006 2705 $admin_script_strings = array(
3007 2706 'desc' => __( '(Click to add description)', 'formidable' ),
3008 2707 'blank' => __( '(Blank)', 'formidable' ),
3009 2708 'no_label' => __( '(no label)', 'formidable' ),
3010 - 'saving' => '', // Deprecated in 6.0.
3011 - 'saved' => '', // Deprecated in 6.0.
2709 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2710 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
3012 2711 'ok' => __( 'OK', 'formidable' ),
3013 2712 'cancel' => __( 'Cancel', 'formidable' ),
3014 2713 'default_label' => __( 'Default', 'formidable' ),
3015 2714 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
@@ -3015,8 +2714,9 @@
3015 2714 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
3016 2715 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
3017 2716 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
3018 2717 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2718 + 'caution' => __( 'Heads up', 'formidable' ),
3019 2719 'confirm' => __( 'Are you sure?', 'formidable' ),
3020 2720 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
3021 2721 '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 2722 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
@@ -3051,9 +2751,8 @@
3051 2751 'install' => __( 'Install', 'formidable' ),
3052 2752 'active' => __( 'Active', 'formidable' ),
3053 2753 'select_a_field' => __( 'Select a Field', 'formidable' ),
3054 2754 'no_items_found' => __( 'No items found.', 'formidable' ),
3055 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3056 2755 );
3057 2756 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3058 2757
3059 2758 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
@@ -3063,30 +2762,8 @@
3063 2762 }
3064 2763 }
3065 2764
3066 2765 /**
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 2766 * Echo the message on the plugins listing page
3090 2767 *
3091 2768 * @since 1.07.10
3092 2769 *
@@ -3109,10 +2786,8 @@
3109 2786 /**
3110 2787 * If Pro is far outdated, show a message.
3111 2788 *
3112 2789 * @since 4.0.01
3113 - *
3114 - * @return void
3115 2790 */
3116 2791 public static function min_pro_version_notice( $min_version ) {
3117 2792 if ( ! self::is_formidable_admin() ) {
3118 2793 // Don't show admin-wide.
@@ -3128,9 +2803,9 @@
3128 2803
3129 2804 $pro_version = FrmProDb::$plug_version;
3130 2805 $expired = FrmAddonsController::is_license_expired();
3131 2806 ?>
3132 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2807 + <div class="error frm_previous_install">
3133 2808 <?php
3134 2809 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 2810 if ( empty( $expired ) ) {
3136 2811 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3169,9 +2844,9 @@
3169 2844 }
3170 2845
3171 2846 foreach ( $message as $m ) {
3172 2847 ?>
3173 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2848 + <div class="error frm_previous_install">
3174 2849 <?php echo esc_html( $m ); ?>
3175 2850 </div>
3176 2851 <?php
3177 2852 }
@@ -3176,25 +2851,17 @@
3176 2851 <?php
3177 2852 }
3178 2853 }
3179 2854
3180 - /**
3181 - * @param string $type
3182 - * @return array<string,string>
3183 - */
3184 2855 public static function locales( $type = 'date' ) {
3185 2856 $locales = array(
3186 2857 'en' => __( 'English', 'formidable' ),
3187 2858 'af' => __( 'Afrikaans', 'formidable' ),
3188 2859 'sq' => __( 'Albanian', 'formidable' ),
3189 - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ),
3190 - 'am' => __( 'Amharic', 'formidable' ),
3191 2860 'ar' => __( 'Arabic', 'formidable' ),
3192 2861 'hy' => __( 'Armenian', 'formidable' ),
3193 2862 'az' => __( 'Azerbaijani', 'formidable' ),
3194 2863 'eu' => __( 'Basque', 'formidable' ),
3195 - 'be' => __( 'Belarusian', 'formidable' ),
3196 - 'bn' => __( 'Bengali', 'formidable' ),
3197 2864 'bs' => __( 'Bosnian', 'formidable' ),
3198 2865 'bg' => __( 'Bulgarian', 'formidable' ),
3199 2866 'ca' => __( 'Catalan', 'formidable' ),
3200 2867 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
@@ -3213,15 +2880,12 @@
3213 2880 'fi' => __( 'Finnish', 'formidable' ),
3214 2881 'fr' => __( 'French', 'formidable' ),
3215 2882 'fr-CA' => __( 'French/Canadian', 'formidable' ),
3216 2883 'fr-CH' => __( 'French/Swiss', 'formidable' ),
3217 - 'gl' => __( 'Galician', 'formidable' ),
3218 - 'ka' => __( 'Georgian', 'formidable' ),
3219 2884 'de' => __( 'German', 'formidable' ),
3220 2885 'de-AT' => __( 'German/Austria', 'formidable' ),
3221 2886 'de-CH' => __( 'German/Switzerland', 'formidable' ),
3222 2887 'el' => __( 'Greek', 'formidable' ),
3223 - 'gu' => __( 'Gujarati', 'formidable' ),
3224 2888 'he' => __( 'Hebrew', 'formidable' ),
3225 2889 'iw' => __( 'Hebrew', 'formidable' ),
3226 2890 'hi' => __( 'Hindi', 'formidable' ),
3227 2891 'hu' => __( 'Hungarian', 'formidable' ),
@@ -3228,84 +2892,52 @@
3228 2892 'is' => __( 'Icelandic', 'formidable' ),
3229 2893 'id' => __( 'Indonesian', 'formidable' ),
3230 2894 'it' => __( 'Italian', 'formidable' ),
3231 2895 'ja' => __( 'Japanese', 'formidable' ),
3232 - 'kn' => __( 'Kannada', 'formidable' ),
3233 - 'kk' => __( 'Kazakh', 'formidable' ),
3234 - 'km' => __( 'Khmer', 'formidable' ),
3235 2896 'ko' => __( 'Korean', 'formidable' ),
3236 - 'ky' => __( 'Kyrgyz', 'formidable' ),
3237 - 'lo' => __( 'Laothian', 'formidable' ),
3238 2897 'lv' => __( 'Latvian', 'formidable' ),
3239 2898 'lt' => __( 'Lithuanian', 'formidable' ),
3240 - 'lb' => __( 'Luxembourgish', 'formidable' ),
3241 - 'mk' => __( 'Macedonian', 'formidable' ),
3242 - 'ml' => __( 'Malayalam', 'formidable' ),
3243 2899 'ms' => __( 'Malaysian', 'formidable' ),
3244 - 'mr' => __( 'Marathi', 'formidable' ),
3245 2900 'no' => __( 'Norwegian', 'formidable' ),
3246 - 'nb' => __( 'Norwegian Bokmål', 'formidable' ),
3247 - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ),
3248 2901 'pl' => __( 'Polish', 'formidable' ),
3249 2902 'pt' => __( 'Portuguese', 'formidable' ),
3250 2903 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
3251 2904 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ),
3252 - 'rm' => __( 'Romansh', 'formidable' ),
3253 2905 'ro' => __( 'Romanian', 'formidable' ),
3254 2906 'ru' => __( 'Russian', 'formidable' ),
3255 2907 'sr' => __( 'Serbian', 'formidable' ),
3256 2908 'sr-SR' => __( 'Serbian', 'formidable' ),
3257 - 'si' => __( 'Sinhalese', 'formidable' ),
3258 2909 'sk' => __( 'Slovak', 'formidable' ),
3259 2910 'sl' => __( 'Slovenian', 'formidable' ),
3260 2911 'es' => __( 'Spanish', 'formidable' ),
3261 2912 'es-419' => __( 'Spanish/Latin America', 'formidable' ),
3262 - 'sw' => __( 'Swahili', 'formidable' ),
3263 2913 'sv' => __( 'Swedish', 'formidable' ),
3264 2914 'ta' => __( 'Tamil', 'formidable' ),
3265 - 'te' => __( 'Telugu', 'formidable' ),
3266 2915 'th' => __( 'Thai', 'formidable' ),
3267 - 'tj' => __( 'Tajiki', 'formidable' ),
3268 2916 'tr' => __( 'Turkish', 'formidable' ),
3269 2917 'uk' => __( 'Ukrainian', 'formidable' ),
3270 - 'ur' => __( 'Urdu', 'formidable' ),
3271 2918 'vi' => __( 'Vietnamese', 'formidable' ),
3272 - 'cy-GB' => __( 'Welsh', 'formidable' ),
3273 - 'zu' => __( 'Zulu', 'formidable' ),
3274 2919 );
3275 2920
3276 2921 if ( $type === 'captcha' ) {
3277 2922 // 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' );
2923 + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
3279 2924 } else {
3280 2925 // 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' );
2926 + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
3282 2927 }
3283 2928
3284 2929 $locales = array_diff_key( $locales, array_flip( $unset ) );
2930 + $locales = apply_filters( 'frm_locales', $locales );
3285 2931
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 2932 return $locales;
3299 2933 }
3300 2934
3301 2935 /**
3302 2936 * Output HTML containing reference text for accessibility
3303 - *
3304 - * @deprecated 5.1
3305 2937 */
3306 2938 public static function multiselect_accessibility() {
3307 - _deprecated_function( __METHOD__, '5.1' );
2939 + include_once self::plugin_path() . '/classes/views/frm-forms/multiselect-accessibility.php';
3308 2940 }
3309 2941
3310 2942 public static function get_menu_icon_class() {
3311 2943 if ( is_callable( 'FrmProAppHelper::get_settings' ) ) {
@@ -3586,281 +3218,232 @@
3586 3218 return $value;
3587 3219 }
3588 3220
3589 3221 /**
3590 - * @since 5.0.16
3591 - *
3592 - * @return bool
3222 + * @since 4.07
3223 + * @deprecated 4.09.01
3593 3224 */
3594 - public static function show_landing_pages() {
3595 - return self::show_new_feature( 'landing' );
3225 + public static function renewal_message() {
3226 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
3227 + FrmProAddonsController::renewal_message();
3228 + return;
3229 + }
3230 +
3231 + if ( ! FrmAddonsController::is_license_expired() ) {
3232 + return;
3233 + }
3234 +
3235 + ?>
3236 + <div class="frm_error_style" style="text-align:left">
3237 + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
3238 + &nbsp;
3239 + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
3240 + <div style="float:right">
3241 + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
3242 + <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
3243 + </a>
3244 + </div>
3245 + </div>
3246 + <?php
3596 3247 }
3597 3248
3598 3249 /**
3599 - * @since 5.0.16
3600 - *
3601 - * @return array
3250 + * @since 4.08
3251 + * @deprecated 4.09.01
3602 3252 */
3603 - public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) {
3604 - $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',
3609 - );
3610 - return self::get_upgrade_data_params( 'landing', $params );
3253 + public static function expiring_message() {
3254 + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3255 + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3256 + FrmProAddonsController::expiring_message();
3257 + }
3611 3258 }
3612 3259
3613 3260 /**
3614 - * @since 5.0.17
3261 + * Use the WP 4.7 wp_doing_ajax function
3615 3262 *
3616 - * @param string $plugin
3617 - * @return string|false
3263 + * @since 2.05.07
3264 + * @deprecated 4.04.04
3618 3265 */
3619 - private static function get_plan_required( $plugin ) {
3620 - $link = FrmAddonsController::install_link( $plugin );
3621 - return FrmFormsHelper::get_plan_required( $link );
3266 + public static function wp_doing_ajax() {
3267 + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3268 + return wp_doing_ajax();
3622 3269 }
3623 3270
3624 3271 /**
3625 - * @since 5.0.17
3626 - *
3627 - * @param string
3628 - * @return bool
3272 + * @deprecated 4.0
3629 3273 */
3630 - public static function show_new_feature( $feature ) {
3631 - $link = FrmAddonsController::install_link( $feature );
3632 - return array_key_exists( 'status', $link ) || array_key_exists( 'class', $link );
3274 + public static function insert_opt_html( $args ) {
3275 + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3276 + FrmFormsHelper::insert_opt_html( $args );
3633 3277 }
3634 3278
3635 3279 /**
3636 - * @since 5.0.17
3280 + * Used to filter shortcode in text widgets
3637 3281 *
3638 - * @param string $plugin
3639 - * @param array $params
3640 - * @return array
3282 + * @deprecated 2.5.4
3283 + * @codeCoverageIgnore
3641 3284 */
3642 - public static function get_upgrade_data_params( $plugin, $params ) {
3643 - $link = FrmAddonsController::install_link( $plugin );
3644 - if ( ! $link ) {
3645 - return $params;
3646 - }
3285 + public static function widget_text_filter_callback( $matches ) {
3286 + return FrmDeprecated::widget_text_filter_callback( $matches );
3287 + }
3647 3288
3648 - if ( ! empty( $link['url'] ) && self::pro_is_installed() ) {
3649 - $params['oneclick'] = json_encode( $link );
3650 - unset( $params['message'] );
3651 - if ( ! isset( $params['medium'] ) ) {
3652 - $params['medium'] = $plugin;
3653 - }
3654 - } else {
3655 - $params['requires'] = FrmFormsHelper::get_plan_required( $link );
3656 - }
3657 -
3658 - return $params;
3289 + /**
3290 + * @deprecated 3.01
3291 + * @codeCoverageIgnore
3292 + */
3293 + public static function sanitize_array( &$values ) {
3294 + FrmDeprecated::sanitize_array( $values );
3659 3295 }
3660 3296
3661 3297 /**
3662 - * Returns true if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f], false otherwise.
3663 - * Not every server installs the ctype extension, so use a fallback if the function does not exist.
3298 + * @param array $settings
3299 + * @param string $group
3664 3300 *
3665 - * @since 5.0.17
3666 - *
3667 - * @param string $text
3668 - * @return bool
3301 + * @since 2.0.6
3302 + * @deprecated 2.05.06
3303 + * @codeCoverageIgnore
3669 3304 */
3670 - public static function ctype_xdigit( $text ) {
3671 - if ( function_exists( 'ctype_xdigit' ) ) {
3672 - return ctype_xdigit( $text );
3673 - }
3674 - return is_string( $text ) && '' !== $text && ! preg_match( '/[^A-Fa-f0-9]/', $text );
3305 + public static function save_settings( $settings, $group ) {
3306 + return FrmDeprecated::save_settings( $settings, $group );
3675 3307 }
3676 3308
3677 3309 /**
3678 - * Set the current screen to avoid undefined notices.
3679 - *
3680 - * @since 5.2.01
3310 + * @since 2.0.4
3311 + * @deprecated 2.05.06
3312 + * @codeCoverageIgnore
3681 3313 */
3682 - public static function set_current_screen_and_hook_suffix() {
3683 - global $hook_suffix;
3684 - if ( is_null( $hook_suffix ) ) {
3685 - // $hook_suffix gets used in substr so make sure it's not null. PHP 8.1 deprecates null in substr.
3686 - $hook_suffix = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
3687 - }
3688 - set_current_screen();
3314 + public static function save_json_post( $settings ) {
3315 + return FrmDeprecated::save_json_post( $settings );
3689 3316 }
3690 3317
3691 3318 /**
3692 - * Shows pill text.
3319 + * @since 2.0
3320 + * @deprecated 2.05.06
3321 + * @codeCoverageIgnore
3693 3322 *
3694 - * @since 5.2.02
3323 + * @param string $cache_key The unique name for this cache
3324 + * @param string $group The name of the cache group
3325 + * @param string $query If blank, don't run a db call
3326 + * @param string $type The wpdb function to use with this query
3695 3327 *
3696 - * @param string $text Text in the pill. Default is NEW.
3328 + * @return mixed $results The cache or query results
3697 3329 */
3698 - public static function show_pill_text( $text = null ) {
3699 - if ( null === $text ) {
3700 - $text = __( 'NEW', 'formidable' );
3701 - }
3702 - echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
3330 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3331 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3703 3332 }
3704 3333
3705 3334 /**
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.
3335 + * @deprecated 2.05.06
3336 + * @codeCoverageIgnore
3712 3337 */
3713 - public static function count_decimals( $num ) {
3714 - if ( ! is_numeric( $num ) ) {
3715 - return false;
3716 - }
3338 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3339 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3340 + }
3717 3341
3718 - $num = (string) $num;
3719 - $parts = explode( '.', $num );
3720 - if ( 1 === count( $parts ) ) {
3721 - return 0;
3722 - }
3342 + /**
3343 + * @deprecated 2.05.06
3344 + * @codeCoverageIgnore
3345 + */
3346 + public static function add_key_to_group_cache( $key, $group ) {
3347 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3348 + }
3723 3349
3724 - return strlen( $parts[ count( $parts ) - 1 ] );
3350 + /**
3351 + * @deprecated 2.05.06
3352 + * @codeCoverageIgnore
3353 + */
3354 + public static function get_group_cached_keys( $group ) {
3355 + return FrmDeprecated::get_group_cached_keys( $group );
3725 3356 }
3726 3357
3727 3358 /**
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.
3731 - *
3732 - * @since 5.3.1
3733 - *
3734 - * @return void
3359 + * @since 2.0
3360 + * @deprecated 2.05.06
3361 + * @codeCoverageIgnore
3362 + * @return mixed The cached value or false
3735 3363 */
3736 - public static function filter_gmt_offset() {
3737 - if ( self::$added_gmt_offset_filter ) {
3738 - // Avoid adding twice.
3739 - return;
3740 - }
3741 -
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;
3364 + public static function check_cache_and_transient( $cache_key ) {
3365 + return FrmDeprecated::check_cache( $cache_key );
3754 3366 }
3755 3367
3756 3368 /**
3757 - * @since 5.3.1
3369 + * @since 2.0
3370 + * @deprecated 2.05.06
3371 + * @codeCoverageIgnore
3758 3372 *
3759 - * @return bool
3373 + * @param string $cache_key
3760 3374 */
3761 - public static function on_form_listing_page() {
3762 - if ( ! self::is_admin_page( 'formidable' ) ) {
3763 - return false;
3764 - }
3765 -
3766 - $action = self::simple_get( 'frm_action', 'sanitize_title' );
3767 - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true );
3375 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3376 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3768 3377 }
3769 3378
3770 3379 /**
3771 - * Get all actions that also display the forms list.
3380 + * @since 2.0
3381 + * @deprecated 2.05.06
3382 + * @codeCoverageIgnore
3772 3383 *
3773 - * @since 5.3.1
3774 - *
3775 - * @return array<string>
3384 + * @param string $group The name of the cache group
3776 3385 */
3777 - private static function get_form_listing_page_actions() {
3778 - return array( 'list', 'trash', 'untrash', 'destroy' );
3386 + public static function cache_delete_group( $group ) {
3387 + FrmDeprecated::cache_delete_group( $group );
3779 3388 }
3780 3389
3781 3390 /**
3782 - * Safely call get_plugins, importing the required files if they are not yet loaded.
3391 + * @since 1.07.10
3392 + * @deprecated 2.05.06
3393 + * @codeCoverageIgnore
3783 3394 *
3784 - * @since 5.5
3395 + * @param string $term The value to escape
3785 3396 *
3786 - * @return array
3397 + * @return string The escaped value
3787 3398 */
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();
3399 + public static function esc_like( $term ) {
3400 + return FrmDeprecated::esc_like( $term );
3793 3401 }
3794 3402
3795 3403 /**
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.
3404 + * @param string $order_query
3798 3405 *
3799 - * @since 5.5.5
3800 - *
3801 - * @param string $url
3802 - * @param string $expected_extension
3803 - * @return bool
3406 + * @deprecated 2.05.06
3407 + * @codeCoverageIgnore
3804 3408 */
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;
3409 + public static function esc_order( $order_query ) {
3410 + return FrmDeprecated::esc_order( $order_query );
3825 3411 }
3826 3412
3827 3413 /**
3828 - * @since 4.08
3829 - * @deprecated 4.09.01
3414 + * @deprecated 2.05.06
3415 + * @codeCoverageIgnore
3830 3416 */
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 - }
3417 + public static function esc_order_by( &$order_by ) {
3418 + FrmDeprecated::esc_order_by( $order_by );
3836 3419 }
3837 3420
3838 3421 /**
3839 - * Use the WP 4.7 wp_doing_ajax function
3422 + * @param string $limit
3840 3423 *
3841 - * @since 2.05.07
3842 - * @deprecated 4.04.04
3424 + * @deprecated 2.05.06
3425 + * @codeCoverageIgnore
3843 3426 */
3844 - public static function wp_doing_ajax() {
3845 - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3846 - return wp_doing_ajax();
3427 + public static function esc_limit( $limit ) {
3428 + return FrmDeprecated::esc_limit( $limit );
3847 3429 }
3848 3430
3849 3431 /**
3850 - * @deprecated 4.0
3432 + * @since 2.0
3433 + * @deprecated 2.05.06
3434 + * @codeCoverageIgnore
3851 3435 */
3852 - public static function insert_opt_html( $args ) {
3853 - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3854 - FrmFormsHelper::insert_opt_html( $args );
3436 + public static function prepare_array_values( $array, $type = '%s' ) {
3437 + return FrmDeprecated::prepare_array_values( $array, $type );
3855 3438 }
3856 3439
3857 3440 /**
3858 - * @deprecated 3.01
3441 + * @deprecated 2.05.06
3859 3442 * @codeCoverageIgnore
3860 3443 */
3861 - public static function sanitize_array( &$values ) {
3862 - FrmDeprecated::sanitize_array( $values );
3444 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3445 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3863 3446 }
3864 3447
3865 3448 /**
3866 3449 * @since 2.0
@@ -3870,78 +3453,6 @@
3870 3453 */
3871 3454 public static function jquery_ui_base_url() {
3872 3455 _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3873 3456 return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3874 - }
3875 -
3876 - /**
3877 - * @since 4.07
3878 - * @deprecated 6.0
3879 - */
3880 - public static function renewal_message() {
3881 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3882 - }
3883 -
3884 - /**
3885 - * Display a dismissable warning message and save its dismissal state.
3886 - *
3887 - * @since 6.3
3888 - *
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
3892 - */
3893 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3894 - if ( ! $message || ! $option ) {
3895 - return;
3896 - }
3897 -
3898 - $ajax_callback = function() use ( $option ) {
3899 - self::dismiss_warning_message( $option );
3900 - };
3901 -
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 );
3905 -
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 - }
3912 -
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 - );
3920 -
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 - );
3927 - }
3928 -
3929 - /**
3930 - * Dismiss a warning message and update the dismissal state.
3931 - *
3932 - * @since 6.3
3933 - *
3934 - * @param string $option The unique identifier for the dismissal state of the message.
3935 - * @return void
3936 - */
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();
3946 3457 }
3947 3458 }