| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @since 2.0 |
| 18 | 18 | */ |
| 19 | - public static $plug_version = '6.3'; | |
| 19 | + public static $plug_version = '5.4'; | |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @since 1.07.02 |
| 23 | 23 | * |
| @@ -252,15 +252,15 @@ | ||
| 252 | 252 | global $pagenow; |
| 253 | 253 | $get_page = self::simple_get( 'page', 'sanitize_title' ); |
| 254 | 254 | if ( $pagenow ) { |
| 255 | 255 | // 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; | |
| 256 | + $is_page = ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page; | |
| 257 | 257 | if ( $is_page ) { |
| 258 | 258 | return true; |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - return is_admin() && $get_page === $page; | |
| 262 | + return is_admin() && $get_page == $page; | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * If the current page is for editing or creating a view. |
| @@ -332,18 +332,14 @@ | ||
| 332 | 332 | * Check if on an admin page |
| 333 | 333 | * |
| 334 | 334 | * @since 2.0 |
| 335 | 335 | * |
| 336 | + * @param None | |
| 337 | + * | |
| 336 | 338 | * @return boolean |
| 337 | 339 | */ |
| 338 | 340 | 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 ); | |
| 341 | + return is_admin() && ! wp_doing_ajax(); | |
| 346 | 342 | } |
| 347 | 343 | |
| 348 | 344 | /** |
| 349 | 345 | * Check if value contains blank value or empty array |
| @@ -376,17 +372,26 @@ | ||
| 376 | 372 | return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
| 377 | 373 | } |
| 378 | 374 | |
| 379 | 375 | /** |
| 380 | - * Check for the IP address in several places (when custom headers are enabled). | |
| 381 | - * Used by [ip] shortcode. | |
| 376 | + * Check for the IP address in several places | |
| 377 | + * Used by [ip] shortcode | |
| 382 | 378 | * |
| 383 | 379 | * @return string The IP address of the current user |
| 384 | 380 | */ |
| 385 | 381 | 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 | - | |
| 382 | + $ip_options = array( | |
| 383 | + 'HTTP_CLIENT_IP', | |
| 384 | + 'HTTP_CF_CONNECTING_IP', | |
| 385 | + 'HTTP_X_FORWARDED_FOR', | |
| 386 | + 'HTTP_X_FORWARDED', | |
| 387 | + 'HTTP_X_CLUSTER_CLIENT_IP', | |
| 388 | + 'HTTP_X_REAL_IP', | |
| 389 | + 'HTTP_FORWARDED_FOR', | |
| 390 | + 'HTTP_FORWARDED', | |
| 391 | + 'REMOTE_ADDR', | |
| 392 | + ); | |
| 393 | + $ip = ''; | |
| 389 | 394 | foreach ( $ip_options as $key ) { |
| 390 | 395 | if ( ! isset( $_SERVER[ $key ] ) ) { |
| 391 | 396 | continue; |
| 392 | 397 | } |
| @@ -392,9 +397,9 @@ | ||
| 392 | 397 | } |
| 393 | 398 | |
| 394 | 399 | $key = self::get_server_value( $key ); |
| 395 | 400 | foreach ( explode( ',', $key ) as $ip ) { |
| 396 | - $ip = trim( $ip ); // Just to be safe. | |
| 401 | + $ip = trim( $ip ); // just to be safe. | |
| 397 | 402 | |
| 398 | 403 | if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) { |
| 399 | 404 | return sanitize_text_field( $ip ); |
| 400 | 405 | } |
| @@ -403,52 +408,8 @@ | ||
| 403 | 408 | |
| 404 | 409 | return sanitize_text_field( $ip ); |
| 405 | 410 | } |
| 406 | 411 | |
| 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 | 412 | public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) { |
| 452 | 413 | if ( strpos( $param, '[' ) ) { |
| 453 | 414 | $params = explode( '[', $param ); |
| 454 | 415 | $param = $params[0]; |
| @@ -965,18 +926,8 @@ | ||
| 965 | 926 | |
| 966 | 927 | $html_atts = self::array_to_html_params( $atts ); |
| 967 | 928 | |
| 968 | 929 | $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 | 930 | if ( $icon === $class ) { |
| 980 | 931 | $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>'; |
| 981 | 932 | } else { |
| 982 | 933 | $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon; |
| @@ -1033,9 +984,9 @@ | ||
| 1033 | 984 | * @param array $allowed_attr |
| 1034 | 985 | * @return array |
| 1035 | 986 | */ |
| 1036 | 987 | public static function allow_vars_in_styles( $allowed_attr ) { |
| 1037 | - $allowed_attr[] = '--primary-700'; | |
| 988 | + $allowed_attr[] = '--primary-hover'; | |
| 1038 | 989 | return $allowed_attr; |
| 1039 | 990 | } |
| 1040 | 991 | |
| 1041 | 992 | /** |
| @@ -1044,9 +995,9 @@ | ||
| 1044 | 995 | * @param bool $allow_css |
| 1045 | 996 | * @param string $css_string |
| 1046 | 997 | */ |
| 1047 | 998 | public static function allow_style( $allow_css, $css_string ) { |
| 1048 | - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) { | |
| 999 | + if ( ! $allow_css && 0 === strpos( $css_string, '--primary-hover:' ) ) { | |
| 1049 | 1000 | $split = explode( ':', $css_string, 2 ); |
| 1050 | 1001 | $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] ); |
| 1051 | 1002 | } |
| 1052 | 1003 | return $allow_css; |
| @@ -1113,11 +1064,9 @@ | ||
| 1113 | 1064 | if ( ! $echo ) { |
| 1114 | 1065 | ob_start(); |
| 1115 | 1066 | } |
| 1116 | 1067 | |
| 1117 | - if ( is_callable( $echo_function ) ) { | |
| 1118 | - $echo_function(); | |
| 1119 | - } | |
| 1068 | + $echo_function(); | |
| 1120 | 1069 | |
| 1121 | 1070 | if ( ! $echo ) { |
| 1122 | 1071 | $return = ob_get_contents(); |
| 1123 | 1072 | ob_end_clean(); |
| @@ -1140,58 +1089,8 @@ | ||
| 1140 | 1089 | include( self::plugin_path() . '/classes/views/shared/admin-header.php' ); |
| 1141 | 1090 | } |
| 1142 | 1091 | |
| 1143 | 1092 | /** |
| 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 | 1093 | * Render a button for a new item (Form, Application, etc). |
| 1195 | 1094 | * |
| 1196 | 1095 | * @since 3.0 |
| 1197 | 1096 | * @param array $atts { |
| @@ -1213,9 +1112,9 @@ | ||
| 1213 | 1112 | return; |
| 1214 | 1113 | } |
| 1215 | 1114 | |
| 1216 | 1115 | $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#'; |
| 1217 | - $class = 'button button-primary frm-button-primary'; | |
| 1116 | + $class = 'button button-primary frm-button-primary frm-with-plus'; | |
| 1218 | 1117 | |
| 1219 | 1118 | if ( ! empty( $atts['trigger_new_form_modal'] ) ) { |
| 1220 | 1119 | $class .= ' frm-trigger-new-form-modal'; |
| 1221 | 1120 | } |
| @@ -1466,8 +1365,9 @@ | ||
| 1466 | 1365 | public static function post_edit_link( $post_id ) { |
| 1467 | 1366 | $post = get_post( $post_id ); |
| 1468 | 1367 | if ( $post ) { |
| 1469 | 1368 | $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' ); |
| 1369 | + $post_url = self::maybe_full_screen_link( $post_url ); | |
| 1470 | 1370 | |
| 1471 | 1371 | return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>'; |
| 1472 | 1372 | } |
| 1473 | 1373 | |
| @@ -1482,59 +1382,22 @@ | ||
| 1482 | 1382 | * @return bool |
| 1483 | 1383 | */ |
| 1484 | 1384 | public static function is_full_screen() { |
| 1485 | 1385 | return self::is_form_builder_page() || |
| 1486 | - self::is_style_editor_page() || | |
| 1487 | - self::is_full_screen_view_builder_page(); | |
| 1386 | + self::is_admin_page( 'formidable-styles' ) || | |
| 1387 | + self::is_admin_page( 'formidable-styles2' ) || | |
| 1388 | + self::simple_get( 'frm-full', 'absint' ) || | |
| 1389 | + self::is_view_builder_page(); | |
| 1488 | 1390 | } |
| 1489 | 1391 | |
| 1490 | 1392 | /** |
| 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; | |
| 1520 | - } | |
| 1521 | - | |
| 1522 | - /** | |
| 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 | 1393 | * @since 4.0 |
| 1533 | - * @deprecated 5.5.3 | |
| 1534 | 1394 | */ |
| 1535 | 1395 | public static function maybe_full_screen_link( $link ) { |
| 1536 | - _deprecated_function( __METHOD__, '5.5.3' ); | |
| 1396 | + $is_full = self::simple_get( 'frm-full', 'absint' ); | |
| 1397 | + if ( $is_full && ! empty( $link ) && $link !== '#' ) { | |
| 1398 | + $link .= '&frm-full=1'; | |
| 1399 | + } | |
| 1537 | 1400 | return $link; |
| 1538 | 1401 | } |
| 1539 | 1402 | |
| 1540 | 1403 | /** |
| @@ -2394,9 +2257,9 @@ | ||
| 2394 | 2257 | * |
| 2395 | 2258 | * @return string $time_ago |
| 2396 | 2259 | */ |
| 2397 | 2260 | public static function human_time_diff( $from, $to = '', $levels = 1 ) { |
| 2398 | - if ( empty( $to ) && 0 !== $to ) { | |
| 2261 | + if ( empty( $to ) ) { | |
| 2399 | 2262 | $now = new DateTime(); |
| 2400 | 2263 | } else { |
| 2401 | 2264 | $now = new DateTime( '@' . $to ); |
| 2402 | 2265 | } |
| @@ -2675,12 +2538,8 @@ | ||
| 2675 | 2538 | return; |
| 2676 | 2539 | } |
| 2677 | 2540 | |
| 2678 | 2541 | $frm_action = self::simple_get( 'frm_action', 'sanitize_title' ); |
| 2679 | - if ( 'lite-reports' === $frm_action ) { | |
| 2680 | - $frm_action = 'reports'; | |
| 2681 | - } | |
| 2682 | - | |
| 2683 | 2542 | if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) { |
| 2684 | 2543 | echo ' class="current_page"'; |
| 2685 | 2544 | } |
| 2686 | 2545 | } |
| @@ -2737,15 +2596,12 @@ | ||
| 2737 | 2596 | } |
| 2738 | 2597 | } |
| 2739 | 2598 | |
| 2740 | 2599 | /** |
| 2741 | - * Check for either json or serialized data. This is temporary while transitioning | |
| 2600 | + * Check for either json or serilized data. This is temporary while transitioning | |
| 2742 | 2601 | * all data to json. |
| 2743 | 2602 | * |
| 2744 | 2603 | * @since 4.02.03 |
| 2745 | - * | |
| 2746 | - * @param array|string $value | |
| 2747 | - * @return void | |
| 2748 | 2604 | */ |
| 2749 | 2605 | public static function unserialize_or_decode( &$value ) { |
| 2750 | 2606 | if ( is_array( $value ) ) { |
| 2751 | 2607 | return; |
| @@ -2751,9 +2607,9 @@ | ||
| 2751 | 2607 | return; |
| 2752 | 2608 | } |
| 2753 | 2609 | |
| 2754 | 2610 | if ( is_serialized( $value ) ) { |
| 2755 | - $value = self::maybe_unserialize_array( $value ); | |
| 2611 | + $value = maybe_unserialize( $value ); | |
| 2756 | 2612 | } else { |
| 2757 | 2613 | $value = self::maybe_json_decode( $value, false ); |
| 2758 | 2614 | } |
| 2759 | 2615 | } |
| @@ -2758,35 +2614,8 @@ | ||
| 2758 | 2614 | } |
| 2759 | 2615 | } |
| 2760 | 2616 | |
| 2761 | 2617 | /** |
| 2762 | - * Safely unserialize an array if necessary. | |
| 2763 | - * This function doesn't actually use unserialize. The string is parsed instead. | |
| 2764 | - * | |
| 2765 | - * @since 6.2 | |
| 2766 | - * | |
| 2767 | - * @param mixed $value | |
| 2768 | - * @return mixed | |
| 2769 | - */ | |
| 2770 | - public static function maybe_unserialize_array( $value ) { | |
| 2771 | - if ( ! is_string( $value ) ) { | |
| 2772 | - return $value; | |
| 2773 | - } | |
| 2774 | - | |
| 2775 | - // Since we only expect an array, skip anything that doesn't start with a:. | |
| 2776 | - if ( ! is_serialized( $value ) || 'a:' !== substr( $value, 0, 2 ) ) { | |
| 2777 | - return $value; | |
| 2778 | - } | |
| 2779 | - | |
| 2780 | - $parsed = FrmSerializedStringParserHelper::get()->parse( $value ); | |
| 2781 | - if ( is_array( $parsed ) ) { | |
| 2782 | - $value = $parsed; | |
| 2783 | - } | |
| 2784 | - | |
| 2785 | - return $value; | |
| 2786 | - } | |
| 2787 | - | |
| 2788 | - /** | |
| 2789 | 2618 | * Decode a JSON string. |
| 2790 | 2619 | * Do not switch shortcodes like [24] to array unless intentional ie XML values. |
| 2791 | 2620 | * |
| 2792 | 2621 | * @param mixed $string |
| @@ -2813,36 +2642,8 @@ | ||
| 2813 | 2642 | return $string; |
| 2814 | 2643 | } |
| 2815 | 2644 | |
| 2816 | 2645 | /** |
| 2817 | - * @since 6.2.3 | |
| 2818 | - * | |
| 2819 | - * @param string $value | |
| 2820 | - * @return string | |
| 2821 | - */ | |
| 2822 | - public static function maybe_utf8_encode( $value ) { | |
| 2823 | - $from_format = 'ISO-8859-1'; | |
| 2824 | - $to_format = 'UTF-8'; | |
| 2825 | - | |
| 2826 | - if ( function_exists( 'mb_check_encoding' ) && function_exists( 'mb_convert_encoding' ) ) { | |
| 2827 | - if ( mb_check_encoding( $value, $from_format ) ) { | |
| 2828 | - return mb_convert_encoding( $value, $to_format, $from_format ); | |
| 2829 | - } | |
| 2830 | - return $value; | |
| 2831 | - } | |
| 2832 | - | |
| 2833 | - if ( function_exists( 'iconv' ) ) { | |
| 2834 | - $converted = iconv( $from_format, $to_format, $value ); | |
| 2835 | - // Value is false if $value is not ISO-8859-1. | |
| 2836 | - if ( false !== $converted ) { | |
| 2837 | - return $converted; | |
| 2838 | - } | |
| 2839 | - } | |
| 2840 | - | |
| 2841 | - return $value; | |
| 2842 | - } | |
| 2843 | - | |
| 2844 | - /** | |
| 2845 | 2646 | * Reformat the json serialized array in name => value array. |
| 2846 | 2647 | * |
| 2847 | 2648 | * @since 4.02.03 |
| 2848 | 2649 | */ |
| @@ -2916,9 +2717,8 @@ | ||
| 2916 | 2717 | 'applicationsUrl' => admin_url( 'admin.php?page=formidable-applications' ), |
| 2917 | 2718 | 'canAccessApplicationDashboard' => current_user_can( is_callable( 'FrmProApplicationsHelper::get_required_templates_capability' ) ? FrmProApplicationsHelper::get_required_templates_capability() : 'frm_edit_forms' ), |
| 2918 | 2719 | 'loading' => __( 'Loading…', 'formidable' ), |
| 2919 | 2720 | 'nonce' => wp_create_nonce( 'frm_ajax' ), |
| 2920 | - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ), | |
| 2921 | 2721 | ); |
| 2922 | 2722 | wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings ); |
| 2923 | 2723 | |
| 2924 | 2724 | if ( $load ) { |
| @@ -2968,10 +2768,10 @@ | ||
| 2968 | 2768 | $admin_script_strings = array( |
| 2969 | 2769 | 'desc' => __( '(Click to add description)', 'formidable' ), |
| 2970 | 2770 | 'blank' => __( '(Blank)', 'formidable' ), |
| 2971 | 2771 | 'no_label' => __( '(no label)', 'formidable' ), |
| 2972 | - 'saving' => '', // Deprecated in 6.0. | |
| 2973 | - 'saved' => '', // Deprecated in 6.0. | |
| 2772 | + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ), | |
| 2773 | + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ), | |
| 2974 | 2774 | 'ok' => __( 'OK', 'formidable' ), |
| 2975 | 2775 | 'cancel' => __( 'Cancel', 'formidable' ), |
| 2976 | 2776 | 'default_label' => __( 'Default', 'formidable' ), |
| 2977 | 2777 | 'clear_default' => __( 'Clear default value when typing', 'formidable' ), |
| @@ -2977,8 +2777,9 @@ | ||
| 2977 | 2777 | 'clear_default' => __( 'Clear default value when typing', 'formidable' ), |
| 2978 | 2778 | 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ), |
| 2979 | 2779 | 'valid_default' => __( 'Default value will pass form validation', 'formidable' ), |
| 2980 | 2780 | 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ), |
| 2781 | + 'caution' => __( 'Heads up', 'formidable' ), | |
| 2981 | 2782 | 'confirm' => __( 'Are you sure?', 'formidable' ), |
| 2982 | 2783 | 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ), |
| 2983 | 2784 | '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' ), |
| 2984 | 2785 | 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ), |
| @@ -3013,9 +2814,8 @@ | ||
| 3013 | 2814 | 'install' => __( 'Install', 'formidable' ), |
| 3014 | 2815 | 'active' => __( 'Active', 'formidable' ), |
| 3015 | 2816 | 'select_a_field' => __( 'Select a Field', 'formidable' ), |
| 3016 | 2817 | 'no_items_found' => __( 'No items found.', 'formidable' ), |
| 3017 | - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ), | |
| 3018 | 2818 | ); |
| 3019 | 2819 | $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings ); |
| 3020 | 2820 | |
| 3021 | 2821 | $data = $wp_scripts->get_data( 'formidable_admin', 'data' ); |
| @@ -3071,10 +2871,8 @@ | ||
| 3071 | 2871 | /** |
| 3072 | 2872 | * If Pro is far outdated, show a message. |
| 3073 | 2873 | * |
| 3074 | 2874 | * @since 4.0.01 |
| 3075 | - * | |
| 3076 | - * @return void | |
| 3077 | 2875 | */ |
| 3078 | 2876 | public static function min_pro_version_notice( $min_version ) { |
| 3079 | 2877 | if ( ! self::is_formidable_admin() ) { |
| 3080 | 2878 | // Don't show admin-wide. |
| @@ -3090,9 +2888,9 @@ | ||
| 3090 | 2888 | |
| 3091 | 2889 | $pro_version = FrmProDb::$plug_version; |
| 3092 | 2890 | $expired = FrmAddonsController::is_license_expired(); |
| 3093 | 2891 | ?> |
| 3094 | - <div class="frm-banner-alert frm_error_style frm_previous_install"> | |
| 2892 | + <div class="error frm_previous_install"> | |
| 3095 | 2893 | <?php |
| 3096 | 2894 | esc_html_e( 'You are running a version of Formidable Forms that may not be compatible with your version of Formidable Forms Pro.', 'formidable' ); |
| 3097 | 2895 | if ( empty( $expired ) ) { |
| 3098 | 2896 | echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.'; |
| @@ -3131,9 +2929,9 @@ | ||
| 3131 | 2929 | } |
| 3132 | 2930 | |
| 3133 | 2931 | foreach ( $message as $m ) { |
| 3134 | 2932 | ?> |
| 3135 | - <div class="frm-banner-alert frm_error_style frm_previous_install"> | |
| 2933 | + <div class="error frm_previous_install"> | |
| 3136 | 2934 | <?php echo esc_html( $m ); ?> |
| 3137 | 2935 | </div> |
| 3138 | 2936 | <?php |
| 3139 | 2937 | } |
| @@ -3138,25 +2936,17 @@ | ||
| 3138 | 2936 | <?php |
| 3139 | 2937 | } |
| 3140 | 2938 | } |
| 3141 | 2939 | |
| 3142 | - /** | |
| 3143 | - * @param string $type | |
| 3144 | - * @return array<string,string> | |
| 3145 | - */ | |
| 3146 | 2940 | public static function locales( $type = 'date' ) { |
| 3147 | 2941 | $locales = array( |
| 3148 | 2942 | 'en' => __( 'English', 'formidable' ), |
| 3149 | 2943 | 'af' => __( 'Afrikaans', 'formidable' ), |
| 3150 | 2944 | 'sq' => __( 'Albanian', 'formidable' ), |
| 3151 | - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ), | |
| 3152 | - 'am' => __( 'Amharic', 'formidable' ), | |
| 3153 | 2945 | 'ar' => __( 'Arabic', 'formidable' ), |
| 3154 | 2946 | 'hy' => __( 'Armenian', 'formidable' ), |
| 3155 | 2947 | 'az' => __( 'Azerbaijani', 'formidable' ), |
| 3156 | 2948 | 'eu' => __( 'Basque', 'formidable' ), |
| 3157 | - 'be' => __( 'Belarusian', 'formidable' ), | |
| 3158 | - 'bn' => __( 'Bengali', 'formidable' ), | |
| 3159 | 2949 | 'bs' => __( 'Bosnian', 'formidable' ), |
| 3160 | 2950 | 'bg' => __( 'Bulgarian', 'formidable' ), |
| 3161 | 2951 | 'ca' => __( 'Catalan', 'formidable' ), |
| 3162 | 2952 | 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ), |
| @@ -3175,15 +2965,12 @@ | ||
| 3175 | 2965 | 'fi' => __( 'Finnish', 'formidable' ), |
| 3176 | 2966 | 'fr' => __( 'French', 'formidable' ), |
| 3177 | 2967 | 'fr-CA' => __( 'French/Canadian', 'formidable' ), |
| 3178 | 2968 | 'fr-CH' => __( 'French/Swiss', 'formidable' ), |
| 3179 | - 'gl' => __( 'Galician', 'formidable' ), | |
| 3180 | - 'ka' => __( 'Georgian', 'formidable' ), | |
| 3181 | 2969 | 'de' => __( 'German', 'formidable' ), |
| 3182 | 2970 | 'de-AT' => __( 'German/Austria', 'formidable' ), |
| 3183 | 2971 | 'de-CH' => __( 'German/Switzerland', 'formidable' ), |
| 3184 | 2972 | 'el' => __( 'Greek', 'formidable' ), |
| 3185 | - 'gu' => __( 'Gujarati', 'formidable' ), | |
| 3186 | 2973 | 'he' => __( 'Hebrew', 'formidable' ), |
| 3187 | 2974 | 'iw' => __( 'Hebrew', 'formidable' ), |
| 3188 | 2975 | 'hi' => __( 'Hindi', 'formidable' ), |
| 3189 | 2976 | 'hu' => __( 'Hungarian', 'formidable' ), |
| @@ -3190,74 +2977,44 @@ | ||
| 3190 | 2977 | 'is' => __( 'Icelandic', 'formidable' ), |
| 3191 | 2978 | 'id' => __( 'Indonesian', 'formidable' ), |
| 3192 | 2979 | 'it' => __( 'Italian', 'formidable' ), |
| 3193 | 2980 | 'ja' => __( 'Japanese', 'formidable' ), |
| 3194 | - 'kn' => __( 'Kannada', 'formidable' ), | |
| 3195 | - 'kk' => __( 'Kazakh', 'formidable' ), | |
| 3196 | - 'km' => __( 'Khmer', 'formidable' ), | |
| 3197 | 2981 | 'ko' => __( 'Korean', 'formidable' ), |
| 3198 | - 'ky' => __( 'Kyrgyz', 'formidable' ), | |
| 3199 | - 'lo' => __( 'Laothian', 'formidable' ), | |
| 3200 | 2982 | 'lv' => __( 'Latvian', 'formidable' ), |
| 3201 | 2983 | 'lt' => __( 'Lithuanian', 'formidable' ), |
| 3202 | - 'lb' => __( 'Luxembourgish', 'formidable' ), | |
| 3203 | - 'mk' => __( 'Macedonian', 'formidable' ), | |
| 3204 | - 'ml' => __( 'Malayalam', 'formidable' ), | |
| 3205 | 2984 | 'ms' => __( 'Malaysian', 'formidable' ), |
| 3206 | - 'mr' => __( 'Marathi', 'formidable' ), | |
| 3207 | 2985 | 'no' => __( 'Norwegian', 'formidable' ), |
| 3208 | - 'nb' => __( 'Norwegian Bokmål', 'formidable' ), | |
| 3209 | - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ), | |
| 3210 | 2986 | 'pl' => __( 'Polish', 'formidable' ), |
| 3211 | 2987 | 'pt' => __( 'Portuguese', 'formidable' ), |
| 3212 | 2988 | 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ), |
| 3213 | 2989 | 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), |
| 3214 | - 'rm' => __( 'Romansh', 'formidable' ), | |
| 3215 | 2990 | 'ro' => __( 'Romanian', 'formidable' ), |
| 3216 | 2991 | 'ru' => __( 'Russian', 'formidable' ), |
| 3217 | 2992 | 'sr' => __( 'Serbian', 'formidable' ), |
| 3218 | 2993 | 'sr-SR' => __( 'Serbian', 'formidable' ), |
| 3219 | - 'si' => __( 'Sinhalese', 'formidable' ), | |
| 3220 | 2994 | 'sk' => __( 'Slovak', 'formidable' ), |
| 3221 | 2995 | 'sl' => __( 'Slovenian', 'formidable' ), |
| 3222 | 2996 | 'es' => __( 'Spanish', 'formidable' ), |
| 3223 | 2997 | 'es-419' => __( 'Spanish/Latin America', 'formidable' ), |
| 3224 | - 'sw' => __( 'Swahili', 'formidable' ), | |
| 3225 | 2998 | 'sv' => __( 'Swedish', 'formidable' ), |
| 3226 | 2999 | 'ta' => __( 'Tamil', 'formidable' ), |
| 3227 | - 'te' => __( 'Telugu', 'formidable' ), | |
| 3228 | 3000 | 'th' => __( 'Thai', 'formidable' ), |
| 3229 | - 'tj' => __( 'Tajiki', 'formidable' ), | |
| 3230 | 3001 | 'tr' => __( 'Turkish', 'formidable' ), |
| 3231 | 3002 | 'uk' => __( 'Ukrainian', 'formidable' ), |
| 3232 | - 'ur' => __( 'Urdu', 'formidable' ), | |
| 3233 | 3003 | 'vi' => __( 'Vietnamese', 'formidable' ), |
| 3234 | - 'cy-GB' => __( 'Welsh', 'formidable' ), | |
| 3235 | - 'zu' => __( 'Zulu', 'formidable' ), | |
| 3236 | 3004 | ); |
| 3237 | 3005 | |
| 3238 | 3006 | if ( $type === 'captcha' ) { |
| 3239 | 3007 | // remove the languages unavailable for the captcha |
| 3240 | - $unset = array( 'sq', 'bs', 'eo', 'fo', 'fr-CH', 'sr-SR', 'ar-DZ', 'be', 'cy-GB', 'kk', 'km', 'ky', 'lb', 'mk', 'nb', 'nn', 'rm', 'tj' ); | |
| 3008 | + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' ); | |
| 3241 | 3009 | } else { |
| 3242 | 3010 | // remove the languages unavailable for the datepicker |
| 3243 | - $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' ); | |
| 3011 | + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' ); | |
| 3244 | 3012 | } |
| 3245 | 3013 | |
| 3246 | 3014 | $locales = array_diff_key( $locales, array_flip( $unset ) ); |
| 3015 | + $locales = apply_filters( 'frm_locales', $locales ); | |
| 3247 | 3016 | |
| 3248 | - /** | |
| 3249 | - * Filter available locale options. | |
| 3250 | - * | |
| 3251 | - * @since 5.4.5 Added $args parameter with type. | |
| 3252 | - * | |
| 3253 | - * @param array<string,string> $locales | |
| 3254 | - * @param array $args { | |
| 3255 | - * @type string $type | |
| 3256 | - * } | |
| 3257 | - */ | |
| 3258 | - $locales = apply_filters( 'frm_locales', $locales, compact( 'type' ) ); | |
| 3259 | - | |
| 3260 | 3017 | return $locales; |
| 3261 | 3018 | } |
| 3262 | 3019 | |
| 3263 | 3020 | /** |
| @@ -3563,12 +3320,11 @@ | ||
| 3563 | 3320 | * @return array |
| 3564 | 3321 | */ |
| 3565 | 3322 | public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) { |
| 3566 | 3323 | $params = array( |
| 3567 | - 'medium' => $medium, | |
| 3568 | - 'upgrade' => __( 'Form Landing Pages', 'formidable' ), | |
| 3569 | - 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ), | |
| 3570 | - 'screenshot' => 'landing.png', | |
| 3324 | + 'medium' => $medium, | |
| 3325 | + 'upgrade' => __( 'Form Landing Pages', 'formidable' ), | |
| 3326 | + 'message' => __( 'Easily manage a landing page for your form. Upgrade to get form landing pages.', 'formidable' ), | |
| 3571 | 3327 | ); |
| 3572 | 3328 | return self::get_upgrade_data_params( 'landing', $params ); |
| 3573 | 3329 | } |
| 3574 | 3330 | |
| @@ -3650,8 +3406,36 @@ | ||
| 3650 | 3406 | set_current_screen(); |
| 3651 | 3407 | } |
| 3652 | 3408 | |
| 3653 | 3409 | /** |
| 3410 | + * @since 4.07 | |
| 3411 | + * @deprecated 4.09.01 | |
| 3412 | + */ | |
| 3413 | + public static function renewal_message() { | |
| 3414 | + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) { | |
| 3415 | + FrmProAddonsController::renewal_message(); | |
| 3416 | + return; | |
| 3417 | + } | |
| 3418 | + | |
| 3419 | + if ( ! FrmAddonsController::is_license_expired() ) { | |
| 3420 | + return; | |
| 3421 | + } | |
| 3422 | + | |
| 3423 | + ?> | |
| 3424 | + <div class="frm_error_style" style="text-align:left"> | |
| 3425 | + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?> | |
| 3426 | + | |
| 3427 | + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?> | |
| 3428 | + <div style="float:right"> | |
| 3429 | + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>"> | |
| 3430 | + <?php esc_html_e( 'Renew Now', 'formidable' ); ?> | |
| 3431 | + </a> | |
| 3432 | + </div> | |
| 3433 | + </div> | |
| 3434 | + <?php | |
| 3435 | + } | |
| 3436 | + | |
| 3437 | + /** | |
| 3654 | 3438 | * Shows pill text. |
| 3655 | 3439 | * |
| 3656 | 3440 | * @since 5.2.02 |
| 3657 | 3441 | * |
| @@ -3740,54 +3524,8 @@ | ||
| 3740 | 3524 | return array( 'list', 'trash', 'untrash', 'destroy' ); |
| 3741 | 3525 | } |
| 3742 | 3526 | |
| 3743 | 3527 | /** |
| 3744 | - * Safely call get_plugins, importing the required files if they are not yet loaded. | |
| 3745 | - * | |
| 3746 | - * @since 5.5 | |
| 3747 | - * | |
| 3748 | - * @return array | |
| 3749 | - */ | |
| 3750 | - public static function get_plugins() { | |
| 3751 | - if ( ! function_exists( 'get_plugins' ) ) { | |
| 3752 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 3753 | - } | |
| 3754 | - return get_plugins(); | |
| 3755 | - } | |
| 3756 | - | |
| 3757 | - /** | |
| 3758 | - * 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. | |
| 3759 | - * This is to make sure that the URL can't be exploited for a SSRF attack. | |
| 3760 | - * | |
| 3761 | - * @since 5.5.5 | |
| 3762 | - * | |
| 3763 | - * @param string $url | |
| 3764 | - * @param string $expected_extension | |
| 3765 | - * @return bool | |
| 3766 | - */ | |
| 3767 | - public static function validate_url_is_in_s3_bucket( $url, $expected_extension ) { | |
| 3768 | - $file_is_in_expected_s3_bucket = 0 === strpos( $url, 'https://s3.amazonaws.com/fp.strategy11.com' ); | |
| 3769 | - if ( ! $file_is_in_expected_s3_bucket ) { | |
| 3770 | - return false; | |
| 3771 | - } | |
| 3772 | - | |
| 3773 | - $parsed = parse_url( $url ); | |
| 3774 | - if ( ! is_array( $parsed ) ) { | |
| 3775 | - // URL is malformed. | |
| 3776 | - return false; | |
| 3777 | - } | |
| 3778 | - | |
| 3779 | - $path = $parsed['path']; | |
| 3780 | - $ext = pathinfo( $path, PATHINFO_EXTENSION ); | |
| 3781 | - if ( $expected_extension !== $ext ) { | |
| 3782 | - // The URL isn't to an XML file. | |
| 3783 | - return false; | |
| 3784 | - } | |
| 3785 | - | |
| 3786 | - return true; | |
| 3787 | - } | |
| 3788 | - | |
| 3789 | - /** | |
| 3790 | 3528 | * @since 4.08 |
| 3791 | 3529 | * @deprecated 4.09.01 |
| 3792 | 3530 | */ |
| 3793 | 3531 | public static function expiring_message() { |
| @@ -3816,8 +3554,18 @@ | ||
| 3816 | 3554 | FrmFormsHelper::insert_opt_html( $args ); |
| 3817 | 3555 | } |
| 3818 | 3556 | |
| 3819 | 3557 | /** |
| 3558 | + * Used to filter shortcode in text widgets | |
| 3559 | + * | |
| 3560 | + * @deprecated 2.5.4 | |
| 3561 | + * @codeCoverageIgnore | |
| 3562 | + */ | |
| 3563 | + public static function widget_text_filter_callback( $matches ) { | |
| 3564 | + return FrmDeprecated::widget_text_filter_callback( $matches ); | |
| 3565 | + } | |
| 3566 | + | |
| 3567 | + /** | |
| 3820 | 3568 | * @deprecated 3.01 |
| 3821 | 3569 | * @codeCoverageIgnore |
| 3822 | 3570 | */ |
| 3823 | 3571 | public static function sanitize_array( &$values ) { |
| @@ -3824,86 +3572,165 @@ | ||
| 3824 | 3572 | FrmDeprecated::sanitize_array( $values ); |
| 3825 | 3573 | } |
| 3826 | 3574 | |
| 3827 | 3575 | /** |
| 3828 | - * @since 2.0 | |
| 3829 | - * @deprecated 5.0.13 | |
| 3576 | + * @param array $settings | |
| 3577 | + * @param string $group | |
| 3830 | 3578 | * |
| 3831 | - * @return string The base Google APIS url for the current version of jQuery UI | |
| 3579 | + * @since 2.0.6 | |
| 3580 | + * @deprecated 2.05.06 | |
| 3581 | + * @codeCoverageIgnore | |
| 3832 | 3582 | */ |
| 3833 | - public static function jquery_ui_base_url() { | |
| 3834 | - _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' ); | |
| 3835 | - return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : ''; | |
| 3583 | + public static function save_settings( $settings, $group ) { | |
| 3584 | + return FrmDeprecated::save_settings( $settings, $group ); | |
| 3836 | 3585 | } |
| 3837 | 3586 | |
| 3838 | 3587 | /** |
| 3839 | - * @since 4.07 | |
| 3840 | - * @deprecated 6.0 | |
| 3588 | + * @since 2.0.4 | |
| 3589 | + * @deprecated 2.05.06 | |
| 3590 | + * @codeCoverageIgnore | |
| 3841 | 3591 | */ |
| 3842 | - public static function renewal_message() { | |
| 3843 | - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' ); | |
| 3592 | + public static function save_json_post( $settings ) { | |
| 3593 | + return FrmDeprecated::save_json_post( $settings ); | |
| 3844 | 3594 | } |
| 3845 | 3595 | |
| 3846 | 3596 | /** |
| 3847 | - * Display a dismissable warning message and save its dismissal state. | |
| 3597 | + * @since 2.0 | |
| 3598 | + * @deprecated 2.05.06 | |
| 3599 | + * @codeCoverageIgnore | |
| 3848 | 3600 | * |
| 3849 | - * @since 6.3 | |
| 3601 | + * @param string $cache_key The unique name for this cache | |
| 3602 | + * @param string $group The name of the cache group | |
| 3603 | + * @param string $query If blank, don't run a db call | |
| 3604 | + * @param string $type The wpdb function to use with this query | |
| 3850 | 3605 | * |
| 3851 | - * @param string $message The warning message to display. | |
| 3852 | - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action. | |
| 3853 | - * @return void | |
| 3606 | + * @return mixed $results The cache or query results | |
| 3854 | 3607 | */ |
| 3855 | - public static function add_dismissable_warning_message( $message = '', $option = '' ) { | |
| 3856 | - if ( ! $message || ! $option ) { | |
| 3857 | - return; | |
| 3858 | - } | |
| 3608 | + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) { | |
| 3609 | + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time ); | |
| 3610 | + } | |
| 3859 | 3611 | |
| 3860 | - $ajax_callback = function() use ( $option ) { | |
| 3861 | - self::dismiss_warning_message( $option ); | |
| 3862 | - }; | |
| 3612 | + /** | |
| 3613 | + * @deprecated 2.05.06 | |
| 3614 | + * @codeCoverageIgnore | |
| 3615 | + */ | |
| 3616 | + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) { | |
| 3617 | + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time ); | |
| 3618 | + } | |
| 3863 | 3619 | |
| 3864 | - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action. | |
| 3865 | - // To prevent any issues, we add 'frm_' from the beginning of the action. | |
| 3866 | - add_action( 'wp_ajax_frm_' . $option, $ajax_callback ); | |
| 3620 | + /** | |
| 3621 | + * @deprecated 2.05.06 | |
| 3622 | + * @codeCoverageIgnore | |
| 3623 | + */ | |
| 3624 | + public static function add_key_to_group_cache( $key, $group ) { | |
| 3625 | + FrmDeprecated::add_key_to_group_cache( $key, $group ); | |
| 3626 | + } | |
| 3867 | 3627 | |
| 3868 | - add_filter( | |
| 3869 | - 'frm_message_list', | |
| 3870 | - function( $show_messages ) use ( $message, $option ) { | |
| 3871 | - if ( get_option( $option, false ) ) { | |
| 3872 | - return $show_messages; | |
| 3873 | - } | |
| 3628 | + /** | |
| 3629 | + * @deprecated 2.05.06 | |
| 3630 | + * @codeCoverageIgnore | |
| 3631 | + */ | |
| 3632 | + public static function get_group_cached_keys( $group ) { | |
| 3633 | + return FrmDeprecated::get_group_cached_keys( $group ); | |
| 3634 | + } | |
| 3874 | 3635 | |
| 3875 | - $dismiss_icon = self::icon_by_class( | |
| 3876 | - 'frmfont frm_close_icon', | |
| 3877 | - array( | |
| 3878 | - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ), | |
| 3879 | - 'echo' => false, | |
| 3880 | - ) | |
| 3881 | - ); | |
| 3636 | + /** | |
| 3637 | + * @since 2.0 | |
| 3638 | + * @deprecated 2.05.06 | |
| 3639 | + * @codeCoverageIgnore | |
| 3640 | + * @return mixed The cached value or false | |
| 3641 | + */ | |
| 3642 | + public static function check_cache_and_transient( $cache_key ) { | |
| 3643 | + return FrmDeprecated::check_cache( $cache_key ); | |
| 3644 | + } | |
| 3882 | 3645 | |
| 3883 | - $show_messages[] = $message; | |
| 3884 | - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>'; | |
| 3646 | + /** | |
| 3647 | + * @since 2.0 | |
| 3648 | + * @deprecated 2.05.06 | |
| 3649 | + * @codeCoverageIgnore | |
| 3650 | + * | |
| 3651 | + * @param string $cache_key | |
| 3652 | + */ | |
| 3653 | + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) { | |
| 3654 | + FrmDeprecated::delete_cache_and_transient( $cache_key, $group ); | |
| 3655 | + } | |
| 3885 | 3656 | |
| 3886 | - return $show_messages; | |
| 3887 | - } | |
| 3888 | - ); | |
| 3657 | + /** | |
| 3658 | + * @since 2.0 | |
| 3659 | + * @deprecated 2.05.06 | |
| 3660 | + * @codeCoverageIgnore | |
| 3661 | + * | |
| 3662 | + * @param string $group The name of the cache group | |
| 3663 | + */ | |
| 3664 | + public static function cache_delete_group( $group ) { | |
| 3665 | + FrmDeprecated::cache_delete_group( $group ); | |
| 3889 | 3666 | } |
| 3890 | 3667 | |
| 3891 | 3668 | /** |
| 3892 | - * Dismiss a warning message and update the dismissal state. | |
| 3669 | + * @since 1.07.10 | |
| 3670 | + * @deprecated 2.05.06 | |
| 3671 | + * @codeCoverageIgnore | |
| 3893 | 3672 | * |
| 3894 | - * @since 6.3 | |
| 3673 | + * @param string $term The value to escape | |
| 3895 | 3674 | * |
| 3896 | - * @param string $option The unique identifier for the dismissal state of the message. | |
| 3897 | - * @return void | |
| 3675 | + * @return string The escaped value | |
| 3898 | 3676 | */ |
| 3899 | - public static function dismiss_warning_message( $option = '' ) { | |
| 3900 | - self::permission_check( 'frm_change_settings' ); | |
| 3901 | - check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 3677 | + public static function esc_like( $term ) { | |
| 3678 | + return FrmDeprecated::esc_like( $term ); | |
| 3679 | + } | |
| 3902 | 3680 | |
| 3903 | - if ( $option ) { | |
| 3904 | - update_option( $option, true, 'no' ); | |
| 3905 | - } | |
| 3681 | + /** | |
| 3682 | + * @param string $order_query | |
| 3683 | + * | |
| 3684 | + * @deprecated 2.05.06 | |
| 3685 | + * @codeCoverageIgnore | |
| 3686 | + */ | |
| 3687 | + public static function esc_order( $order_query ) { | |
| 3688 | + return FrmDeprecated::esc_order( $order_query ); | |
| 3689 | + } | |
| 3906 | 3690 | |
| 3907 | - wp_send_json_success(); | |
| 3691 | + /** | |
| 3692 | + * @deprecated 2.05.06 | |
| 3693 | + * @codeCoverageIgnore | |
| 3694 | + */ | |
| 3695 | + public static function esc_order_by( &$order_by ) { | |
| 3696 | + FrmDeprecated::esc_order_by( $order_by ); | |
| 3697 | + } | |
| 3698 | + | |
| 3699 | + /** | |
| 3700 | + * @param string $limit | |
| 3701 | + * | |
| 3702 | + * @deprecated 2.05.06 | |
| 3703 | + * @codeCoverageIgnore | |
| 3704 | + */ | |
| 3705 | + public static function esc_limit( $limit ) { | |
| 3706 | + return FrmDeprecated::esc_limit( $limit ); | |
| 3707 | + } | |
| 3708 | + | |
| 3709 | + /** | |
| 3710 | + * @since 2.0 | |
| 3711 | + * @deprecated 2.05.06 | |
| 3712 | + * @codeCoverageIgnore | |
| 3713 | + */ | |
| 3714 | + public static function prepare_array_values( $array, $type = '%s' ) { | |
| 3715 | + return FrmDeprecated::prepare_array_values( $array, $type ); | |
| 3716 | + } | |
| 3717 | + | |
| 3718 | + /** | |
| 3719 | + * @deprecated 2.05.06 | |
| 3720 | + * @codeCoverageIgnore | |
| 3721 | + */ | |
| 3722 | + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) { | |
| 3723 | + return FrmDeprecated::prepend_and_or_where( $starts_with, $where ); | |
| 3724 | + } | |
| 3725 | + | |
| 3726 | + /** | |
| 3727 | + * @since 2.0 | |
| 3728 | + * @deprecated 5.0.13 | |
| 3729 | + * | |
| 3730 | + * @return string The base Google APIS url for the current version of jQuery UI | |
| 3731 | + */ | |
| 3732 | + public static function jquery_ui_base_url() { | |
| 3733 | + _deprecated_function( __FUNCTION__, '5.0.13', 'FrmProAppHelper::jquery_ui_base_url' ); | |
| 3734 | + return is_callable( 'FrmProAppHelper::jquery_ui_base_url' ) ? FrmProAppHelper::jquery_ui_base_url() : ''; | |
| 3908 | 3735 | } |
| 3909 | 3736 | } |