PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2.02
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 +266 -597 6.45.2.02 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';
14 + public static $plug_version = '5.2.02';
20 15
21 16 /**
22 17 * @since 1.07.02
23 18 *
@@ -252,15 +247,15 @@
252 247 global $pagenow;
253 248 $get_page = self::simple_get( 'page', 'sanitize_title' );
254 249 if ( $pagenow ) {
255 250 // allow this to be true during ajax load i.e. ajax form builder loading
256 - $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;
257 252 if ( $is_page ) {
258 253 return true;
259 254 }
260 255 }
261 256
262 - return is_admin() && $get_page === $page;
257 + return is_admin() && $get_page == $page;
263 258 }
264 259
265 260 /**
266 261 * If the current page is for editing or creating a view.
@@ -332,18 +327,14 @@
332 327 * Check if on an admin page
333 328 *
334 329 * @since 2.0
335 330 *
331 + * @param None
332 + *
336 333 * @return boolean
337 334 */
338 335 public static function is_admin() {
339 - $is_admin = is_admin() && ! wp_doing_ajax();
340 -
341 - /**
342 - * @since 6.0
343 - * @param bool $is_admin
344 - */
345 - return apply_filters( 'frm_is_admin', $is_admin );
336 + return is_admin() && ! wp_doing_ajax();
346 337 }
347 338
348 339 /**
349 340 * Check if value contains blank value or empty array
@@ -376,17 +367,26 @@
376 367 return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
377 368 }
378 369
379 370 /**
380 - * Check for the IP address in several places (when custom headers are enabled).
381 - * Used by [ip] shortcode.
371 + * Check for the IP address in several places
372 + * Used by [ip] shortcode
382 373 *
383 374 * @return string The IP address of the current user
384 375 */
385 376 public static function get_ip_address() {
386 - $ip_options = self::should_use_custom_header_ip() ? self::get_custom_header_keys_for_ip() : array( 'REMOTE_ADDR' );
387 - $ip = '';
388 -
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 = '';
389 389 foreach ( $ip_options as $key ) {
390 390 if ( ! isset( $_SERVER[ $key ] ) ) {
391 391 continue;
392 392 }
@@ -392,9 +392,9 @@
392 392 }
393 393
394 394 $key = self::get_server_value( $key );
395 395 foreach ( explode( ',', $key ) as $ip ) {
396 - $ip = trim( $ip ); // Just to be safe.
396 + $ip = trim( $ip ); // just to be safe.
397 397
398 398 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
399 399 return sanitize_text_field( $ip );
400 400 }
@@ -403,52 +403,8 @@
403 403
404 404 return sanitize_text_field( $ip );
405 405 }
406 406
407 - /**
408 - * @since 6.1
409 - *
410 - * @return array
411 - */
412 - public static function get_custom_header_keys_for_ip() {
413 - return array(
414 - 'HTTP_CLIENT_IP',
415 - 'HTTP_CF_CONNECTING_IP',
416 - 'HTTP_X_FORWARDED_FOR',
417 - 'HTTP_X_FORWARDED',
418 - 'HTTP_X_CLUSTER_CLIENT_IP',
419 - 'HTTP_X_REAL_IP',
420 - 'HTTP_FORWARDED_FOR',
421 - 'HTTP_FORWARDED',
422 - 'REMOTE_ADDR',
423 - );
424 - }
425 -
426 - /**
427 - * Check if we should check every HTTP header or just $_SERVER['REMOTE_ADDR'].
428 - * The other HTTP headers can be spoofed so this isn't recommended.
429 - * But in some cases (like reverse proxies), the IP may be empty if you use $_SERVER['REMOTE_ADDR'].
430 - *
431 - * @since 6.1
432 - *
433 - * @return bool
434 - */
435 - private static function should_use_custom_header_ip() {
436 - $settings = self::get_settings();
437 - $should_use_custom_header_ip = ! $settings->no_ips && $settings->custom_header_ip;
438 -
439 - /**
440 - * Filter whether to check spoofable HTTP headers.
441 - * This uses the custom_header_ip setting, but it is hidden if the GDPR option is also on.
442 - * 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.
443 - *
444 - * @since 6.1
445 - *
446 - * @param bool $should_use_custom_header_ip
447 - */
448 - return apply_filters( 'frm_use_custom_header_ip', $should_use_custom_header_ip );
449 - }
450 -
451 407 public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
452 408 if ( strpos( $param, '[' ) ) {
453 409 $params = explode( '[', $param );
454 410 $param = $params[0];
@@ -965,18 +921,8 @@
965 921
966 922 $html_atts = self::array_to_html_params( $atts );
967 923
968 924 $icon = trim( str_replace( array( 'frm_icon_font', 'frmfont ' ), '', $class ) );
969 -
970 - // Replace icons that have been removed.
971 - $deprecated = array(
972 - 'frm_clone_solid_icon' => 'frm_clone_icon',
973 - );
974 - if ( isset( $deprecated[ $icon ] ) ) {
975 - $icon = $deprecated[ $icon ];
976 - $class = str_replace( $icon, $deprecated[ $icon ], $class );
977 - }
978 -
979 925 if ( $icon === $class ) {
980 926 $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>';
981 927 } else {
982 928 $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon;
@@ -1033,9 +979,9 @@
1033 979 * @param array $allowed_attr
1034 980 * @return array
1035 981 */
1036 982 public static function allow_vars_in_styles( $allowed_attr ) {
1037 - $allowed_attr[] = '--primary-700';
983 + $allowed_attr[] = '--primary-hover';
1038 984 return $allowed_attr;
1039 985 }
1040 986
1041 987 /**
@@ -1044,9 +990,9 @@
1044 990 * @param bool $allow_css
1045 991 * @param string $css_string
1046 992 */
1047 993 public static function allow_style( $allow_css, $css_string ) {
1048 - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) {
994 + if ( ! $allow_css && 0 === strpos( $css_string, '--primary-hover:' ) ) {
1049 995 $split = explode( ':', $css_string, 2 );
1050 996 $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] );
1051 997 }
1052 998 return $allow_css;
@@ -1075,9 +1021,9 @@
1075 1021 *
1076 1022 * @since 4.0.02
1077 1023 */
1078 1024 public static function include_svg() {
1079 - include_once self::plugin_path() . '/images/icons.svg';
1025 + include_once( self::plugin_path() . '/images/icons.svg' );
1080 1026 }
1081 1027
1082 1028 /**
1083 1029 * Convert an associative array to HTML values.
@@ -1113,11 +1059,9 @@
1113 1059 if ( ! $echo ) {
1114 1060 ob_start();
1115 1061 }
1116 1062
1117 - if ( is_callable( $echo_function ) ) {
1118 - $echo_function();
1119 - }
1063 + $echo_function();
1120 1064
1121 1065 if ( ! $echo ) {
1122 1066 $return = ob_get_contents();
1123 1067 ob_end_clean();
@@ -1140,94 +1084,31 @@
1140 1084 include( self::plugin_path() . '/classes/views/shared/admin-header.php' );
1141 1085 }
1142 1086
1143 1087 /**
1144 - * @since 6.0
1145 - *
1146 - * @param string $type
1147 - * @return void
1148 - */
1149 - public static function import_link( $type = 'secondary' ) {
1150 - ?>
1151 - <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">
1152 - <?php esc_html_e( 'Import', 'formidable' ); ?>
1153 - </a>
1154 - <?php
1155 - }
1156 -
1157 - /**
1158 - * Print applicable admin banner.
1159 - *
1160 - * @since 5.4.2
1161 - *
1162 - * @param bool $should_show_lite_upgrade
1163 - * @return void
1164 - */
1165 - public static function print_admin_banner( $should_show_lite_upgrade ) {
1166 - if ( ! current_user_can( 'administrator' ) ) {
1167 - FrmInbox::maybe_show_banner();
1168 - return;
1169 - }
1170 -
1171 - if ( self::maybe_show_license_warning() || FrmInbox::maybe_show_banner() || ! $should_show_lite_upgrade || self::pro_is_installed() ) {
1172 - // Print license warning or inbox banner and exit if either prints.
1173 - // And exit before printing the upgrade bar if it shouldn't be shown.
1174 - return;
1175 - }
1176 - ?>
1177 - <div class="frm-upgrade-bar">
1178 - <span>You're using Formidable Forms Lite. To unlock more features consider</span>
1179 - <a href="<?php echo esc_url( self::admin_upgrade_link( 'top-bar' ) ); ?>" target="_blank" rel="noopener">upgrading to Pro</a>.
1180 - </div>
1181 - <?php
1182 - }
1183 -
1184 - /**
1185 - * @since 5.4.2
1186 - *
1187 - * @return bool True if a banner is available and shown.
1188 - */
1189 - private static function maybe_show_license_warning() {
1190 - return is_callable( 'FrmProAddonsController::admin_banner' ) && FrmProAddonsController::admin_banner();
1191 - }
1192 -
1193 - /**
1194 - * Render a button for a new item (Form, Application, etc).
1195 - *
1196 1088 * @since 3.0
1197 - * @param array $atts {
1198 - * @type array $link_hook Custom link hook, calls do_action and exits early.
1199 - * @type string $new_link Href value, default #.
1200 - * @type string $class Custom class names, space separated.
1201 - * @type string $button_text Button text. Default "Add New".
1202 - * }
1203 - * @return void
1089 + * @param array $atts
1204 1090 */
1205 1091 public static function add_new_item_link( $atts ) {
1206 - 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'] ) ) {
1207 1109 do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1208 - return;
1209 1110 }
1210 -
1211 - if ( empty( $atts['new_link'] ) && empty( $atts['trigger_new_form_modal'] ) && empty( $atts['class'] ) ) {
1212 - // Do not render a button if none of these attributes are set.
1213 - return;
1214 - }
1215 -
1216 - $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1217 - $class = 'button button-primary frm-button-primary';
1218 -
1219 - if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1220 - $class .= ' frm-trigger-new-form-modal';
1221 - }
1222 -
1223 - if ( ! empty( $atts['class'] ) ) {
1224 - $class .= ' ' . $atts['class'];
1225 - }
1226 -
1227 - $button_text = ! empty( $atts['button_text'] ) ? $atts['button_text'] : __( 'Add New', 'formidable' );
1228 -
1229 - require self::plugin_path() . '/classes/views/shared/add-button.php';
1230 1111 }
1231 1112
1232 1113 /**
1233 1114 * @since 3.06
@@ -1466,8 +1347,9 @@
1466 1347 public static function post_edit_link( $post_id ) {
1467 1348 $post = get_post( $post_id );
1468 1349 if ( $post ) {
1469 1350 $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
1351 + $post_url = self::maybe_full_screen_link( $post_url );
1470 1352
1471 1353 return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
1472 1354 }
1473 1355
@@ -1477,64 +1359,25 @@
1477 1359 /**
1478 1360 * Hide the WordPress menus on some pages.
1479 1361 *
1480 1362 * @since 4.0
1481 - *
1482 - * @return bool
1483 1363 */
1484 1364 public static function is_full_screen() {
1485 - return self::is_form_builder_page() ||
1486 - self::is_style_editor_page() ||
1487 - self::is_full_screen_view_builder_page();
1488 - }
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' );
1489 1368
1490 - /**
1491 - * Check if user is on the style editor or its alternative URL.
1492 - * The first URL is a submenu "Styles" in the Formidable menu /wp-admin/admin.php?page=formidable-styles.
1493 - * The alternative URL is linked as a submenu "Forms" item of the Appearance menu /wp-admin/themes.php?page=formidable-styles2.
1494 - *
1495 - * @since 5.5.3
1496 - * @since 6.0 Added the $view parameter. Previously there was only a 'edit' view.
1497 - *
1498 - * @param string $view Supports 'edit', 'list', and ''. If '', both 'edit' and 'list' will match.
1499 - * @return bool
1500 - */
1501 - public static function is_style_editor_page( $view = '' ) {
1502 - if ( ! self::is_admin_page( 'formidable-styles' ) && ! self::is_admin_page( 'formidable-styles2' ) ) {
1503 - return false;
1504 - }
1505 -
1506 - if ( ! in_array( $view, array( 'list', 'edit' ), true ) ) {
1507 - return true;
1508 - }
1509 -
1510 - $action = self::simple_get( 'frm_action' );
1511 - $is_edit_mode = 'edit' === $action || ( ! $action && ! self::simple_get( 'id' ) && ! self::simple_get( 'form' ) );
1512 -
1513 - if ( ! $is_edit_mode && class_exists( 'FrmProStylesController' ) && in_array( $action, array( 'new_style', 'duplicate' ), true ) ) {
1514 - $is_edit_mode = true;
1515 - }
1516 -
1517 - $checking_for_edit_mode = 'edit' === $view;
1518 -
1519 - return $is_edit_mode === $checking_for_edit_mode;
1369 + return $full_builder || $full_entries || $styler || self::is_view_builder_page();
1520 1370 }
1521 1371
1522 1372 /**
1523 - * @since 5.5.3
1524 - *
1525 - * @return bool
1526 - */
1527 - private static function is_full_screen_view_builder_page() {
1528 - return self::is_admin_page( 'formidable-views-editor' );
1529 - }
1530 -
1531 - /**
1532 1373 * @since 4.0
1533 - * @deprecated 5.5.3
1534 1374 */
1535 1375 public static function maybe_full_screen_link( $link ) {
1536 - _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 + }
1537 1380 return $link;
1538 1381 }
1539 1382
1540 1383 /**
@@ -1594,10 +1437,19 @@
1594 1437 * @param string $type Supports `auto`, `pro`, or `pro_only`.
1595 1438 * @return array
1596 1439 */
1597 1440 public static function frm_capabilities( $type = 'auto' ) {
1598 - if ( ! self::pro_is_installed() && ! in_array( $type, array( 'pro', 'pro_only' ), true ) ) {
1599 - 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;
1600 1452 }
1601 1453
1602 1454 $pro_cap = array(
1603 1455 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ),
@@ -1604,41 +1456,17 @@
1604 1456 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ),
1605 1457 'frm_view_reports' => __( 'View Reports', 'formidable' ),
1606 1458 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ),
1607 1459 );
1608 - /**
1609 - * @since 5.3.1
1610 - *
1611 - * @param array<string,string> $pro_cap
1612 - */
1613 - $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap );
1614 1460
1615 1461 if ( 'pro_only' === $type ) {
1616 1462 return $pro_cap;
1617 1463 }
1618 1464
1619 - return self::get_lite_capabilities() + $pro_cap;
1465 + return $cap + $pro_cap;
1620 1466 }
1621 1467
1622 1468 /**
1623 - * Get the list of lite plugin capabilities.
1624 - *
1625 - * @since 5.3.1
1626 - *
1627 - * @return array<string,string>
1628 - */
1629 - private static function get_lite_capabilities() {
1630 - return array(
1631 - 'frm_view_forms' => __( 'View Forms', 'formidable' ),
1632 - 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ),
1633 - 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ),
1634 - 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ),
1635 - 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ),
1636 - 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ),
1637 - );
1638 - }
1639 -
1640 - /**
1641 1469 * Call the WordPress current_user_can but also validate empty strings as true for any logged in user
1642 1470 *
1643 1471 * @since 4.06.03
1644 1472 *
@@ -1976,38 +1804,21 @@
1976 1804 }
1977 1805
1978 1806 $key = self::prevent_numeric_and_reserved_keys( $key );
1979 1807
1980 - $similar_keys = FrmDb::get_col(
1808 + $key_check = FrmDb::get_var(
1981 1809 $table_name,
1982 1810 array(
1983 - $column . ' like%' => $key,
1984 - 'ID !' => $id,
1811 + $column => $key,
1812 + 'ID !' => $id,
1985 1813 ),
1986 1814 $column
1987 1815 );
1988 1816
1989 - // Create a unique field id if it has already been used.
1990 - if ( in_array( $key, $similar_keys, true ) ) {
1817 + if ( $key_check || is_numeric( $key_check ) ) {
1991 1818 $key = self::maybe_truncate_key_before_appending( $column, $key );
1992 -
1993 - /**
1994 - * Allow for a custom separator between the attempted key and the generated suffix.
1995 - *
1996 - * @since 5.2.03
1997 - *
1998 - * @param string $separator. Default empty.
1999 - * @param string $key the key without the added suffix.
2000 - */
2001 - $separator = apply_filters( 'frm_unique_' . $column . '_separator', '', $key );
2002 -
2003 - $suffix = 2;
2004 - do {
2005 - $key_check = $key . $separator . $suffix;
2006 - ++$suffix;
2007 - } while ( in_array( $key_check, $similar_keys, true ) );
2008 -
2009 - $key = $key_check;
1819 + // Create a unique field id if it has already been used.
1820 + $key = $key . substr( md5( microtime() . rand() ), 0, 10 );
2010 1821 }
2011 1822
2012 1823 return $key;
2013 1824 }
@@ -2024,11 +1835,8 @@
2024 1835 if ( in_array( $column, array( 'form_key', 'field_key' ), true ) ) {
2025 1836 $max_key_length_before_truncating = 60;
2026 1837 if ( strlen( $key ) > $max_key_length_before_truncating ) {
2027 1838 $key = substr( $key, 0, $max_key_length_before_truncating );
2028 - if ( is_numeric( $key ) ) {
2029 - $key .= 'a';
2030 - }
2031 1839 }
2032 1840 }
2033 1841 return $key;
2034 1842 }
@@ -2394,9 +2202,9 @@
2394 2202 *
2395 2203 * @return string $time_ago
2396 2204 */
2397 2205 public static function human_time_diff( $from, $to = '', $levels = 1 ) {
2398 - if ( empty( $to ) && 0 !== $to ) {
2206 + if ( empty( $to ) ) {
2399 2207 $now = new DateTime();
2400 2208 } else {
2401 2209 $now = new DateTime( '@' . $to );
2402 2210 }
@@ -2647,9 +2455,8 @@
2647 2455 'reply_to' => __( 'If you would like a different reply to address than the "from" address, add a single address here. FORMAT: Name <name@email.com> or name@email.com.', 'formidable' ),
2648 2456 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ),
2649 2457 /* translators: %1$s: Form name, %2$s: Date */
2650 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() ) ),
2651 - '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' ),
2652 2459 );
2653 2460
2654 2461 if ( ! isset( $tooltips[ $name ] ) ) {
2655 2462 return;
@@ -2676,12 +2483,8 @@
2676 2483 return;
2677 2484 }
2678 2485
2679 2486 $frm_action = self::simple_get( 'frm_action', 'sanitize_title' );
2680 - if ( 'lite-reports' === $frm_action ) {
2681 - $frm_action = 'reports';
2682 - }
2683 -
2684 2487 if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) {
2685 2488 echo ' class="current_page"';
2686 2489 }
2687 2490 }
@@ -2738,15 +2541,12 @@
2738 2541 }
2739 2542 }
2740 2543
2741 2544 /**
2742 - * 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
2743 2546 * all data to json.
2744 2547 *
2745 2548 * @since 4.02.03
2746 - *
2747 - * @param array|string $value
2748 - * @return void
2749 2549 */
2750 2550 public static function unserialize_or_decode( &$value ) {
2751 2551 if ( is_array( $value ) ) {
2752 2552 return;
@@ -2752,9 +2552,9 @@
2752 2552 return;
2753 2553 }
2754 2554
2755 2555 if ( is_serialized( $value ) ) {
2756 - $value = self::maybe_unserialize_array( $value );
2556 + $value = maybe_unserialize( $value );
2757 2557 } else {
2758 2558 $value = self::maybe_json_decode( $value, false );
2759 2559 }
2760 2560 }
@@ -2759,35 +2559,8 @@
2759 2559 }
2760 2560 }
2761 2561
2762 2562 /**
2763 - * Safely unserialize an array if necessary.
2764 - * This function doesn't actually use unserialize. The string is parsed instead.
2765 - *
2766 - * @since 6.2
2767 - *
2768 - * @param mixed $value
2769 - * @return mixed
2770 - */
2771 - public static function maybe_unserialize_array( $value ) {
2772 - if ( ! is_string( $value ) ) {
2773 - return $value;
2774 - }
2775 -
2776 - // Since we only expect an array, skip anything that doesn't start with a:.
2777 - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) {
2778 - return $value;
2779 - }
2780 -
2781 - $parsed = FrmSerializedStringParserHelper::get()->parse( $value );
2782 - if ( is_array( $parsed ) ) {
2783 - $value = $parsed;
2784 - }
2785 -
2786 - return $value;
2787 - }
2788 -
2789 - /**
2790 2563 * Decode a JSON string.
2791 2564 * Do not switch shortcodes like [24] to array unless intentional ie XML values.
2792 2565 *
2793 2566 * @param mixed $string
@@ -2814,36 +2587,8 @@
2814 2587 return $string;
2815 2588 }
2816 2589
2817 2590 /**
2818 - * @since 6.2.3
2819 - *
2820 - * @param string $value
2821 - * @return string
2822 - */
2823 - public static function maybe_utf8_encode( $value ) {
2824 - $from_format = 'ISO-8859-1';
2825 - $to_format = 'UTF-8';
2826 -
2827 - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) {
2828 - if ( mb_check_encoding( $value, $from_format ) ) {
2829 - return mb_convert_encoding( $value, $to_format, $from_format );
2830 - }
2831 - return $value;
2832 - }
2833 -
2834 - if ( function_exists( 'iconv' ) ) {
2835 - $converted = iconv( $from_format, $to_format, $value );
2836 - // Value is false if $value is not ISO-8859-1.
2837 - if ( false !== $converted ) {
2838 - return $converted;
2839 - }
2840 - }
2841 -
2842 - return $value;
2843 - }
2844 -
2845 - /**
2846 2591 * Reformat the json serialized array in name => value array.
2847 2592 *
2848 2593 * @since 4.02.03
2849 2594 */
@@ -2909,17 +2654,14 @@
2909 2654 $version = self::plugin_version();
2910 2655 wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
2911 2656
2912 2657 $global_strings = array(
2913 - 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2914 - 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2915 - 'url' => self::plugin_url(),
2916 - 'app_url' => 'https://formidableforms.com/',
2917 - 'applicationsUrl' => admin_url( 'admin.php?page=formidable-applications' ),
2918 - 'canAccessApplicationDashboard' => current_user_can( is_callable( 'FrmProApplicationsHelper::get_required_templates_capability' ) ? FrmProApplicationsHelper::get_required_templates_capability() : 'frm_edit_forms' ),
2919 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2920 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2921 - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ),
2658 + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
2659 + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
2660 + 'url' => self::plugin_url(),
2661 + 'app_url' => 'https://formidableforms.com/',
2662 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2663 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2922 2664 );
2923 2665 wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings );
2924 2666
2925 2667 if ( $load ) {
@@ -2943,21 +2685,19 @@
2943 2685 $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
2944 2686 $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
2945 2687
2946 2688 $script_strings = array(
2947 - 'ajax_url' => $ajax_url,
2948 - 'images_url' => self::plugin_url() . '/images',
2949 - 'loading' => __( 'Loading&hellip;', 'formidable' ),
2950 - 'remove' => __( 'Remove', 'formidable' ),
2951 - 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2952 - 'nonce' => wp_create_nonce( 'frm_ajax' ),
2953 - 'id' => __( 'ID', 'formidable' ),
2954 - 'no_results' => __( 'No results match', 'formidable' ),
2955 - 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2956 - 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2957 - 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
2958 - 'focus_first_error' => self::should_focus_first_error(),
2959 - 'include_alert_role' => self::should_include_alert_role_on_field_errors(),
2689 + 'ajax_url' => $ajax_url,
2690 + 'images_url' => self::plugin_url() . '/images',
2691 + 'loading' => __( 'Loading&hellip;', 'formidable' ),
2692 + 'remove' => __( 'Remove', 'formidable' ),
2693 + 'offset' => apply_filters( 'frm_scroll_offset', 4 ),
2694 + 'nonce' => wp_create_nonce( 'frm_ajax' ),
2695 + 'id' => __( 'ID', 'formidable' ),
2696 + 'no_results' => __( 'No results match', 'formidable' ),
2697 + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ),
2698 + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ),
2699 + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ),
2960 2700 );
2961 2701
2962 2702 $data = $wp_scripts->get_data( 'formidable', 'data' );
2963 2703 if ( empty( $data ) ) {
@@ -2969,10 +2709,10 @@
2969 2709 $admin_script_strings = array(
2970 2710 'desc' => __( '(Click to add description)', 'formidable' ),
2971 2711 'blank' => __( '(Blank)', 'formidable' ),
2972 2712 'no_label' => __( '(no label)', 'formidable' ),
2973 - 'saving' => '', // Deprecated in 6.0.
2974 - 'saved' => '', // Deprecated in 6.0.
2713 + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ),
2714 + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
2975 2715 'ok' => __( 'OK', 'formidable' ),
2976 2716 'cancel' => __( 'Cancel', 'formidable' ),
2977 2717 'default_label' => __( 'Default', 'formidable' ),
2978 2718 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
@@ -2978,8 +2718,9 @@
2978 2718 'clear_default' => __( 'Clear default value when typing', 'formidable' ),
2979 2719 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
2980 2720 'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
2981 2721 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ),
2722 + 'caution' => __( 'Heads up', 'formidable' ),
2982 2723 'confirm' => __( 'Are you sure?', 'formidable' ),
2983 2724 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ),
2984 2725 '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' ),
2985 2726 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ),
@@ -3014,9 +2755,8 @@
3014 2755 'install' => __( 'Install', 'formidable' ),
3015 2756 'active' => __( 'Active', 'formidable' ),
3016 2757 'select_a_field' => __( 'Select a Field', 'formidable' ),
3017 2758 'no_items_found' => __( 'No items found.', 'formidable' ),
3018 - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3019 2759 );
3020 2760 $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings );
3021 2761
3022 2762 $data = $wp_scripts->get_data( 'formidable_admin', 'data' );
@@ -3026,30 +2766,8 @@
3026 2766 }
3027 2767 }
3028 2768
3029 2769 /**
3030 - * Returns whether or not the first errored input should be auto-focused (default true).
3031 - *
3032 - * @since 5.2.05
3033 - *
3034 - * @return bool
3035 - */
3036 - private static function should_focus_first_error() {
3037 - return (bool) apply_filters( 'frm_focus_first_error', true );
3038 - }
3039 -
3040 - /**
3041 - * Returns whether or not field errors should include role="alert" (default true).
3042 - *
3043 - * @since 5.2.05
3044 - *
3045 - * @return bool
3046 - */
3047 - public static function should_include_alert_role_on_field_errors() {
3048 - return (bool) apply_filters( 'frm_include_alert_role_on_field_errors', true );
3049 - }
3050 -
3051 - /**
3052 2770 * Echo the message on the plugins listing page
3053 2771 *
3054 2772 * @since 1.07.10
3055 2773 *
@@ -3072,10 +2790,8 @@
3072 2790 /**
3073 2791 * If Pro is far outdated, show a message.
3074 2792 *
3075 2793 * @since 4.0.01
3076 - *
3077 - * @return void
3078 2794 */
3079 2795 public static function min_pro_version_notice( $min_version ) {
3080 2796 if ( ! self::is_formidable_admin() ) {
3081 2797 // Don't show admin-wide.
@@ -3091,9 +2807,9 @@
3091 2807
3092 2808 $pro_version = FrmProDb::$plug_version;
3093 2809 $expired = FrmAddonsController::is_license_expired();
3094 2810 ?>
3095 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2811 + <div class="error frm_previous_install">
3096 2812 <?php
3097 2813 esc_html_e( 'You are running a version of Formidable Forms that may not be compatible with your version of Formidable Forms Pro.', 'formidable' );
3098 2814 if ( empty( $expired ) ) {
3099 2815 echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.';
@@ -3132,9 +2848,9 @@
3132 2848 }
3133 2849
3134 2850 foreach ( $message as $m ) {
3135 2851 ?>
3136 - <div class="frm-banner-alert frm_error_style frm_previous_install">
2852 + <div class="error frm_previous_install">
3137 2853 <?php echo esc_html( $m ); ?>
3138 2854 </div>
3139 2855 <?php
3140 2856 }
@@ -3139,25 +2855,17 @@
3139 2855 <?php
3140 2856 }
3141 2857 }
3142 2858
3143 - /**
3144 - * @param string $type
3145 - * @return array<string,string>
3146 - */
3147 2859 public static function locales( $type = 'date' ) {
3148 2860 $locales = array(
3149 2861 'en' => __( 'English', 'formidable' ),
3150 2862 'af' => __( 'Afrikaans', 'formidable' ),
3151 2863 'sq' => __( 'Albanian', 'formidable' ),
3152 - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ),
3153 - 'am' => __( 'Amharic', 'formidable' ),
3154 2864 'ar' => __( 'Arabic', 'formidable' ),
3155 2865 'hy' => __( 'Armenian', 'formidable' ),
3156 2866 'az' => __( 'Azerbaijani', 'formidable' ),
3157 2867 'eu' => __( 'Basque', 'formidable' ),
3158 - 'be' => __( 'Belarusian', 'formidable' ),
3159 - 'bn' => __( 'Bengali', 'formidable' ),
3160 2868 'bs' => __( 'Bosnian', 'formidable' ),
3161 2869 'bg' => __( 'Bulgarian', 'formidable' ),
3162 2870 'ca' => __( 'Catalan', 'formidable' ),
3163 2871 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
@@ -3176,15 +2884,12 @@
3176 2884 'fi' => __( 'Finnish', 'formidable' ),
3177 2885 'fr' => __( 'French', 'formidable' ),
3178 2886 'fr-CA' => __( 'French/Canadian', 'formidable' ),
3179 2887 'fr-CH' => __( 'French/Swiss', 'formidable' ),
3180 - 'gl' => __( 'Galician', 'formidable' ),
3181 - 'ka' => __( 'Georgian', 'formidable' ),
3182 2888 'de' => __( 'German', 'formidable' ),
3183 2889 'de-AT' => __( 'German/Austria', 'formidable' ),
3184 2890 'de-CH' => __( 'German/Switzerland', 'formidable' ),
3185 2891 'el' => __( 'Greek', 'formidable' ),
3186 - 'gu' => __( 'Gujarati', 'formidable' ),
3187 2892 'he' => __( 'Hebrew', 'formidable' ),
3188 2893 'iw' => __( 'Hebrew', 'formidable' ),
3189 2894 'hi' => __( 'Hindi', 'formidable' ),
3190 2895 'hu' => __( 'Hungarian', 'formidable' ),
@@ -3191,74 +2896,44 @@
3191 2896 'is' => __( 'Icelandic', 'formidable' ),
3192 2897 'id' => __( 'Indonesian', 'formidable' ),
3193 2898 'it' => __( 'Italian', 'formidable' ),
3194 2899 'ja' => __( 'Japanese', 'formidable' ),
3195 - 'kn' => __( 'Kannada', 'formidable' ),
3196 - 'kk' => __( 'Kazakh', 'formidable' ),
3197 - 'km' => __( 'Khmer', 'formidable' ),
3198 2900 'ko' => __( 'Korean', 'formidable' ),
3199 - 'ky' => __( 'Kyrgyz', 'formidable' ),
3200 - 'lo' => __( 'Laothian', 'formidable' ),
3201 2901 'lv' => __( 'Latvian', 'formidable' ),
3202 2902 'lt' => __( 'Lithuanian', 'formidable' ),
3203 - 'lb' => __( 'Luxembourgish', 'formidable' ),
3204 - 'mk' => __( 'Macedonian', 'formidable' ),
3205 - 'ml' => __( 'Malayalam', 'formidable' ),
3206 2903 'ms' => __( 'Malaysian', 'formidable' ),
3207 - 'mr' => __( 'Marathi', 'formidable' ),
3208 2904 'no' => __( 'Norwegian', 'formidable' ),
3209 - 'nb' => __( 'Norwegian Bokmål', 'formidable' ),
3210 - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ),
3211 2905 'pl' => __( 'Polish', 'formidable' ),
3212 2906 'pt' => __( 'Portuguese', 'formidable' ),
3213 2907 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
3214 2908 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ),
3215 - 'rm' => __( 'Romansh', 'formidable' ),
3216 2909 'ro' => __( 'Romanian', 'formidable' ),
3217 2910 'ru' => __( 'Russian', 'formidable' ),
3218 2911 'sr' => __( 'Serbian', 'formidable' ),
3219 2912 'sr-SR' => __( 'Serbian', 'formidable' ),
3220 - 'si' => __( 'Sinhalese', 'formidable' ),
3221 2913 'sk' => __( 'Slovak', 'formidable' ),
3222 2914 'sl' => __( 'Slovenian', 'formidable' ),
3223 2915 'es' => __( 'Spanish', 'formidable' ),
3224 2916 'es-419' => __( 'Spanish/Latin America', 'formidable' ),
3225 - 'sw' => __( 'Swahili', 'formidable' ),
3226 2917 'sv' => __( 'Swedish', 'formidable' ),
3227 2918 'ta' => __( 'Tamil', 'formidable' ),
3228 - 'te' => __( 'Telugu', 'formidable' ),
3229 2919 'th' => __( 'Thai', 'formidable' ),
3230 - 'tj' => __( 'Tajiki', 'formidable' ),
3231 2920 'tr' => __( 'Turkish', 'formidable' ),
3232 2921 'uk' => __( 'Ukrainian', 'formidable' ),
3233 - 'ur' => __( 'Urdu', 'formidable' ),
3234 2922 'vi' => __( 'Vietnamese', 'formidable' ),
3235 - 'cy-GB' => __( 'Welsh', 'formidable' ),
3236 - 'zu' => __( 'Zulu', 'formidable' ),
3237 2923 );
3238 2924
3239 2925 if ( $type === 'captcha' ) {
3240 2926 // remove the languages unavailable for the captcha
3241 - $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' );
2927 + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
3242 2928 } else {
3243 2929 // remove the languages unavailable for the datepicker
3244 - $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' );
2930 + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
3245 2931 }
3246 2932
3247 2933 $locales = array_diff_key( $locales, array_flip( $unset ) );
2934 + $locales = apply_filters( 'frm_locales', $locales );
3248 2935
3249 - /**
3250 - * Filter available locale options.
3251 - *
3252 - * @since 5.4.5 Added $args parameter with type.
3253 - *
3254 - * @param array<string,string> $locales
3255 - * @param array $args {
3256 - * @type string $type
3257 - * }
3258 - */
3259 - $locales = apply_filters( 'frm_locales', $locales, compact( 'type' ) );
3260 -
3261 2936 return $locales;
3262 2937 }
3263 2938
3264 2939 /**
@@ -3564,12 +3239,11 @@
3564 3239 * @return array
3565 3240 */
3566 3241 public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) {
3567 3242 $params = array(
3568 - 'medium' => $medium,
3569 - 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3570 - 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3571 - 'screenshot' => 'landing.png',
3243 + 'medium' => $medium,
3244 + 'upgrade' => __( 'Form Landing Pages', 'formidable' ),
3245 + 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ),
3572 3246 );
3573 3247 return self::get_upgrade_data_params( 'landing', $params );
3574 3248 }
3575 3249
@@ -3651,8 +3325,36 @@
3651 3325 set_current_screen();
3652 3326 }
3653 3327
3654 3328 /**
3329 + * @since 4.07
3330 + * @deprecated 4.09.01
3331 + */
3332 + public static function renewal_message() {
3333 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
3334 + FrmProAddonsController::renewal_message();
3335 + return;
3336 + }
3337 +
3338 + if ( ! FrmAddonsController::is_license_expired() ) {
3339 + return;
3340 + }
3341 +
3342 + ?>
3343 + <div class="frm_error_style" style="text-align:left">
3344 + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?>
3345 + &nbsp;
3346 + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
3347 + <div style="float:right">
3348 + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
3349 + <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
3350 + </a>
3351 + </div>
3352 + </div>
3353 + <?php
3354 + }
3355 +
3356 + /**
3655 3357 * Shows pill text.
3656 3358 *
3657 3359 * @since 5.2.02
3658 3360 *
@@ -3665,246 +3367,213 @@
3665 3367 echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
3666 3368 }
3667 3369
3668 3370 /**
3669 - * Count the number of decimals digits.
3670 - *
3671 - * @since 5.2.07
3672 - *
3673 - * @param mixed $num Number.
3674 - * @return int|false Returns `false` if the passed parameter is not number.
3371 + * @since 4.08
3372 + * @deprecated 4.09.01
3675 3373 */
3676 - public static function count_decimals( $num ) {
3677 - if ( ! is_numeric( $num ) ) {
3678 - return false;
3374 + public static function expiring_message() {
3375 + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3376 + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3377 + FrmProAddonsController::expiring_message();
3679 3378 }
3680 -
3681 - $num = (string) $num;
3682 - $parts = explode( '.', $num );
3683 - if ( 1 === count( $parts ) ) {
3684 - return 0;
3685 - }
3686 -
3687 - return strlen( $parts[ count( $parts ) - 1 ] );
3688 3379 }
3689 3380
3690 3381 /**
3691 - * Prevent a fatal error in PHP8 if gmt_offset happens to be set an empty string.
3692 - * This is a bug in WordPress. It isn't safe to call current_time( 'timestamp' ) without this with an empty string offset.
3693 - * In the future this might be safe to remove. Keep an eye on the current_time function in functions.php.
3382 + * Use the WP 4.7 wp_doing_ajax function
3694 3383 *
3695 - * @since 5.3.1
3696 - *
3697 - * @return void
3384 + * @since 2.05.07
3385 + * @deprecated 4.04.04
3698 3386 */
3699 - public static function filter_gmt_offset() {
3700 - if ( self::$added_gmt_offset_filter ) {
3701 - // Avoid adding twice.
3702 - return;
3703 - }
3387 + public static function wp_doing_ajax() {
3388 + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3389 + return wp_doing_ajax();
3390 + }
3704 3391
3705 - add_filter(
3706 - 'option_gmt_offset',
3707 - function( $offset ) {
3708 - if ( ! is_string( $offset ) || is_numeric( $offset ) ) {
3709 - // Leave a valid value alone.
3710 - return $offset;
3711 - }
3712 -
3713 - return 0;
3714 - }
3715 - );
3716 - self::$added_gmt_offset_filter = true;
3392 + /**
3393 + * @deprecated 4.0
3394 + */
3395 + public static function insert_opt_html( $args ) {
3396 + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3397 + FrmFormsHelper::insert_opt_html( $args );
3717 3398 }
3718 3399
3719 3400 /**
3720 - * @since 5.3.1
3401 + * Used to filter shortcode in text widgets
3721 3402 *
3722 - * @return bool
3403 + * @deprecated 2.5.4
3404 + * @codeCoverageIgnore
3723 3405 */
3724 - public static function on_form_listing_page() {
3725 - if ( ! self::is_admin_page( 'formidable' ) ) {
3726 - return false;
3727 - }
3406 + public static function widget_text_filter_callback( $matches ) {
3407 + return FrmDeprecated::widget_text_filter_callback( $matches );
3408 + }
3728 3409
3729 - $action = self::simple_get( 'frm_action', 'sanitize_title' );
3730 - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true );
3410 + /**
3411 + * @deprecated 3.01
3412 + * @codeCoverageIgnore
3413 + */
3414 + public static function sanitize_array( &$values ) {
3415 + FrmDeprecated::sanitize_array( $values );
3731 3416 }
3732 3417
3733 3418 /**
3734 - * Get all actions that also display the forms list.
3419 + * @param array $settings
3420 + * @param string $group
3735 3421 *
3736 - * @since 5.3.1
3737 - *
3738 - * @return array<string>
3422 + * @since 2.0.6
3423 + * @deprecated 2.05.06
3424 + * @codeCoverageIgnore
3739 3425 */
3740 - private static function get_form_listing_page_actions() {
3741 - return array( 'list', 'trash', 'untrash', 'destroy' );
3426 + public static function save_settings( $settings, $group ) {
3427 + return FrmDeprecated::save_settings( $settings, $group );
3742 3428 }
3743 3429
3744 3430 /**
3745 - * Safely call get_plugins, importing the required files if they are not yet loaded.
3746 - *
3747 - * @since 5.5
3748 - *
3749 - * @return array
3431 + * @since 2.0.4
3432 + * @deprecated 2.05.06
3433 + * @codeCoverageIgnore
3750 3434 */
3751 - public static function get_plugins() {
3752 - if ( ! function_exists( 'get_plugins' ) ) {
3753 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
3754 - }
3755 - return get_plugins();
3435 + public static function save_json_post( $settings ) {
3436 + return FrmDeprecated::save_json_post( $settings );
3756 3437 }
3757 3438
3758 3439 /**
3759 - * 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.
3760 - * This is to make sure that the URL can't be exploited for a SSRF attack.
3440 + * @since 2.0
3441 + * @deprecated 2.05.06
3442 + * @codeCoverageIgnore
3761 3443 *
3762 - * @since 5.5.5
3444 + * @param string $cache_key The unique name for this cache
3445 + * @param string $group The name of the cache group
3446 + * @param string $query If blank, don't run a db call
3447 + * @param string $type The wpdb function to use with this query
3763 3448 *
3764 - * @param string $url
3765 - * @param string $expected_extension
3766 - * @return bool
3449 + * @return mixed $results The cache or query results
3767 3450 */
3768 - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) {
3769 - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' );
3770 - if ( ! $file_is_in_expected_s3_bucket ) {
3771 - return false;
3772 - }
3773 -
3774 - $parsed = parse_url( $url );
3775 - if ( ! is_array( $parsed ) ) {
3776 - // URL is malformed.
3777 - return false;
3778 - }
3779 -
3780 - $path = $parsed['path'];
3781 - $ext = pathinfo( $path, PATHINFO_EXTENSION );
3782 - if ( $expected_extension !== $ext ) {
3783 - // The URL isn't to an XML file.
3784 - return false;
3785 - }
3786 -
3787 - return true;
3451 + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
3452 + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time );
3788 3453 }
3789 3454
3790 3455 /**
3791 - * @since 4.08
3792 - * @deprecated 4.09.01
3456 + * @deprecated 2.05.06
3457 + * @codeCoverageIgnore
3793 3458 */
3794 - public static function expiring_message() {
3795 - _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' );
3796 - if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) {
3797 - FrmProAddonsController::expiring_message();
3798 - }
3459 + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
3460 + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time );
3799 3461 }
3800 3462
3801 3463 /**
3802 - * Use the WP 4.7 wp_doing_ajax function
3803 - *
3804 - * @since 2.05.07
3805 - * @deprecated 4.04.04
3464 + * @deprecated 2.05.06
3465 + * @codeCoverageIgnore
3806 3466 */
3807 - public static function wp_doing_ajax() {
3808 - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' );
3809 - return wp_doing_ajax();
3467 + public static function add_key_to_group_cache( $key, $group ) {
3468 + FrmDeprecated::add_key_to_group_cache( $key, $group );
3810 3469 }
3811 3470
3812 3471 /**
3813 - * @deprecated 4.0
3472 + * @deprecated 2.05.06
3473 + * @codeCoverageIgnore
3814 3474 */
3815 - public static function insert_opt_html( $args ) {
3816 - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' );
3817 - FrmFormsHelper::insert_opt_html( $args );
3475 + public static function get_group_cached_keys( $group ) {
3476 + return FrmDeprecated::get_group_cached_keys( $group );
3818 3477 }
3819 3478
3820 3479 /**
3821 - * @deprecated 3.01
3480 + * @since 2.0
3481 + * @deprecated 2.05.06
3822 3482 * @codeCoverageIgnore
3483 + * @return mixed The cached value or false
3823 3484 */
3824 - public static function sanitize_array( &$values ) {
3825 - FrmDeprecated::sanitize_array( $values );
3485 + public static function check_cache_and_transient( $cache_key ) {
3486 + return FrmDeprecated::check_cache( $cache_key );
3826 3487 }
3827 3488
3828 3489 /**
3829 3490 * @since 2.0
3830 - * @deprecated 5.0.13
3491 + * @deprecated 2.05.06
3492 + * @codeCoverageIgnore
3831 3493 *
3832 - * @return string The base Google APIS url for the current version of jQuery UI
3494 + * @param string $cache_key
3833 3495 */
3834 - public static function jquery_ui_base_url() {
3835 - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3836 - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3496 + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
3497 + FrmDeprecated::delete_cache_and_transient( $cache_key, $group );
3837 3498 }
3838 3499
3839 3500 /**
3840 - * @since 4.07
3841 - * @deprecated 6.0
3501 + * @since 2.0
3502 + * @deprecated 2.05.06
3503 + * @codeCoverageIgnore
3504 + *
3505 + * @param string $group The name of the cache group
3842 3506 */
3843 - public static function renewal_message() {
3844 - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' );
3507 + public static function cache_delete_group( $group ) {
3508 + FrmDeprecated::cache_delete_group( $group );
3845 3509 }
3846 3510
3847 3511 /**
3848 - * Display a dismissable warning message and save its dismissal state.
3512 + * @since 1.07.10
3513 + * @deprecated 2.05.06
3514 + * @codeCoverageIgnore
3849 3515 *
3850 - * @since 6.3
3516 + * @param string $term The value to escape
3851 3517 *
3852 - * @param string $message The warning message to display.
3853 - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action.
3854 - * @return void
3518 + * @return string The escaped value
3855 3519 */
3856 - public static function add_dismissable_warning_message( $message = '', $option = '' ) {
3857 - if ( ! $message || ! $option ) {
3858 - return;
3859 - }
3520 + public static function esc_like( $term ) {
3521 + return FrmDeprecated::esc_like( $term );
3522 + }
3860 3523
3861 - $ajax_callback = function() use ( $option ) {
3862 - self::dismiss_warning_message( $option );
3863 - };
3524 + /**
3525 + * @param string $order_query
3526 + *
3527 + * @deprecated 2.05.06
3528 + * @codeCoverageIgnore
3529 + */
3530 + public static function esc_order( $order_query ) {
3531 + return FrmDeprecated::esc_order( $order_query );
3532 + }
3864 3533
3865 - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action.
3866 - // To prevent any issues, we add 'frm_' from the beginning of the action.
3867 - add_action( 'wp_ajax_frm_' . $option, $ajax_callback );
3534 + /**
3535 + * @deprecated 2.05.06
3536 + * @codeCoverageIgnore
3537 + */
3538 + public static function esc_order_by( &$order_by ) {
3539 + FrmDeprecated::esc_order_by( $order_by );
3540 + }
3868 3541
3869 - add_filter(
3870 - 'frm_message_list',
3871 - function( $show_messages ) use ( $message, $option ) {
3872 - if ( get_option( $option, false ) ) {
3873 - return $show_messages;
3874 - }
3542 + /**
3543 + * @param string $limit
3544 + *
3545 + * @deprecated 2.05.06
3546 + * @codeCoverageIgnore
3547 + */
3548 + public static function esc_limit( $limit ) {
3549 + return FrmDeprecated::esc_limit( $limit );
3550 + }
3875 3551
3876 - $dismiss_icon = self::icon_by_class(
3877 - 'frmfont frm_close_icon',
3878 - array(
3879 - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ),
3880 - 'echo' => false,
3881 - )
3882 - );
3552 + /**
3553 + * @since 2.0
3554 + * @deprecated 2.05.06
3555 + * @codeCoverageIgnore
3556 + */
3557 + public static function prepare_array_values( $array, $type = '%s' ) {
3558 + return FrmDeprecated::prepare_array_values( $array, $type );
3559 + }
3883 3560
3884 - $show_messages[] = $message;
3885 - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>';
3886 -
3887 - return $show_messages;
3888 - }
3889 - );
3561 + /**
3562 + * @deprecated 2.05.06
3563 + * @codeCoverageIgnore
3564 + */
3565 + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
3566 + return FrmDeprecated::prepend_and_or_where( $starts_with, $where );
3890 3567 }
3891 3568
3892 3569 /**
3893 - * Dismiss a warning message and update the dismissal state.
3570 + * @since 2.0
3571 + * @deprecated 5.0.13
3894 3572 *
3895 - * @since 6.3
3896 - *
3897 - * @param string $option The unique identifier for the dismissal state of the message.
3898 - * @return void
3573 + * @return string The base Google APIS url for the current version of jQuery UI
3899 3574 */
3900 - public static function dismiss_warning_message( $option = '' ) {
3901 - self::permission_check( 'frm_change_settings' );
3902 - check_ajax_referer( 'frm_ajax', 'nonce' );
3903 -
3904 - if ( $option ) {
3905 - update_option( $option, true, 'no' );
3906 - }
3907 -
3908 - wp_send_json_success();
3575 + public static function jquery_ui_base_url() {
3576 + _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' );
3577 + return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : '';
3909 3578 }
3910 3579 }