| @@ -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 = 97; //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.3.2'; | |
| 14 | + public static $plug_version = '4.11.02'; | |
| 20 | 15 | |
| 21 | 16 | /** |
| 22 | 17 | * @since 1.07.02 |
| 23 | 18 | * |
| @@ -173,9 +168,9 @@ | ||
| 173 | 168 | /** |
| 174 | 169 | * @since 4.0 |
| 175 | 170 | */ |
| 176 | 171 | public static function show_logo( $atts = array() ) { |
| 177 | - echo self::kses( self::svg_logo( $atts ), 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 172 | + echo self::kses( self::svg_logo( $atts ), 'all' ); // WPCS: XSS ok. | |
| 178 | 173 | } |
| 179 | 174 | |
| 180 | 175 | /** |
| 181 | 176 | * @since 4.03.02 |
| @@ -196,9 +191,9 @@ | ||
| 196 | 191 | // Show nothing if it isn't an SVG. |
| 197 | 192 | $icon = '<div style="height:39px"></div>'; |
| 198 | 193 | } |
| 199 | 194 | } |
| 200 | - echo self::kses( $icon, 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 195 | + echo self::kses( $icon, 'all' ); // WPCS: XSS ok. | |
| 201 | 196 | } |
| 202 | 197 | |
| 203 | 198 | /** |
| 204 | 199 | * @since 2.02.04 |
| @@ -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]; |
| @@ -453,11 +409,12 @@ | ||
| 453 | 409 | $params = explode( '[', $param ); |
| 454 | 410 | $param = $params[0]; |
| 455 | 411 | } |
| 456 | 412 | |
| 457 | - if ( $src === 'get' ) { | |
| 458 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 459 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 413 | + if ( $src == 'get' ) { | |
| 414 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 415 | + $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); | |
| 416 | + if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { | |
| 460 | 417 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 461 | 418 | $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
| 462 | 419 | } |
| 463 | 420 | self::sanitize_value( $sanitize, $value ); |
| @@ -539,14 +496,14 @@ | ||
| 539 | 496 | |
| 540 | 497 | $value = $args['default']; |
| 541 | 498 | if ( $args['type'] == 'get' ) { |
| 542 | 499 | if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
| 543 | - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing | |
| 500 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 544 | 501 | $value = wp_unslash( $_GET[ $args['param'] ] ); |
| 545 | 502 | } |
| 546 | 503 | } elseif ( $args['type'] == 'post' ) { |
| 547 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 548 | - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing | |
| 504 | + if ( isset( $_POST[ $args['param'] ] ) ) { | |
| 505 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 549 | 506 | $value = wp_unslash( $_POST[ $args['param'] ] ); |
| 550 | 507 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 551 | 508 | self::unserialize_or_decode( $value ); |
| 552 | 509 | } |
| @@ -551,9 +508,9 @@ | ||
| 551 | 508 | self::unserialize_or_decode( $value ); |
| 552 | 509 | } |
| 553 | 510 | } |
| 554 | 511 | } else { |
| 555 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 512 | + if ( isset( $_REQUEST[ $args['param'] ] ) ) { | |
| 556 | 513 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 557 | 514 | $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
| 558 | 515 | } |
| 559 | 516 | } |
| @@ -688,80 +645,14 @@ | ||
| 688 | 645 | return wp_kses( $value, $allowed_html ); |
| 689 | 646 | } |
| 690 | 647 | |
| 691 | 648 | /** |
| 692 | - * The regular kses function strips [button_action] from submit button HTML. | |
| 693 | - * | |
| 694 | - * @since 5.0.13 | |
| 695 | - * | |
| 696 | - * @param string $html | |
| 697 | - * @return string | |
| 698 | - */ | |
| 699 | - public static function kses_submit_button( $html ) { | |
| 700 | - $included_button_action = false !== strpos( $html, '[button_action]' ); | |
| 701 | - $included_back_hook = false !== strpos( $html, '[back_hook]' ); | |
| 702 | - $included_draft_hook = false !== strpos( $html, '[draft_hook]' ); | |
| 703 | - add_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' ); | |
| 704 | - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' ); | |
| 705 | - $html = self::kses( $html, 'all' ); | |
| 706 | - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_visibility_style' ); | |
| 707 | - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_submit_button_tags' ); | |
| 708 | - if ( $included_button_action ) { | |
| 709 | - if ( false !== strpos( $html, '<input type="submit"' ) ) { | |
| 710 | - $pattern = '/(<input type="submit")([^>]*)(\/>)/'; | |
| 711 | - $html = preg_replace( $pattern, '$1$2[button_action] $3', $html, 1 ); | |
| 712 | - } else { | |
| 713 | - $pattern = '/(<button)(.*)(class=")(.*)(frm_button_submit)(.*)(")(.*)([^>]+)(>)/'; | |
| 714 | - $html = preg_replace( $pattern, '$1$2$3$4$5$6$7 [button_action]$8$9$10', $html, 1 ); | |
| 715 | - } | |
| 716 | - } | |
| 717 | - if ( $included_back_hook ) { | |
| 718 | - $html = str_replace( 'class="frm_prev_page"', 'class="frm_prev_page" [back_hook]', $html ); | |
| 719 | - } | |
| 720 | - if ( $included_draft_hook ) { | |
| 721 | - $html = str_replace( 'class="frm_save_draft"', 'class="frm_save_draft" [draft_hook]', $html ); | |
| 722 | - } | |
| 723 | - return $html; | |
| 724 | - } | |
| 725 | - | |
| 726 | - /** | |
| 727 | - * @since 5.0.13 | |
| 728 | - * | |
| 729 | - * @param array $allowed_attr | |
| 730 | - * @return array | |
| 731 | - */ | |
| 732 | - public static function allow_visibility_style( $allowed_attr ) { | |
| 733 | - $allowed_attr[] = 'visibility'; | |
| 734 | - return $allowed_attr; | |
| 735 | - } | |
| 736 | - | |
| 737 | - /** | |
| 738 | - * @since 5.0.13 | |
| 739 | - * | |
| 740 | - * @param array $allowed_html | |
| 741 | - * @return array | |
| 742 | - */ | |
| 743 | - public static function add_allowed_submit_button_tags( $allowed_html ) { | |
| 744 | - $allowed_html['input'] = array( | |
| 745 | - 'type' => true, | |
| 746 | - 'value' => true, | |
| 747 | - 'formnovalidate' => true, | |
| 748 | - 'name' => true, | |
| 749 | - 'class' => true, | |
| 750 | - ); | |
| 751 | - $allowed_html['button']['formnovalidate'] = true; | |
| 752 | - $allowed_html['button']['name'] = true; | |
| 753 | - $allowed_html['img']['style'] = true; | |
| 754 | - return $allowed_html; | |
| 755 | - } | |
| 756 | - | |
| 757 | - /** | |
| 758 | 649 | * @since 2.05.03 |
| 759 | 650 | */ |
| 760 | 651 | private static function allowed_html( $allowed ) { |
| 761 | 652 | $html = self::safe_html(); |
| 762 | 653 | $allowed_html = array(); |
| 763 | - if ( $allowed === 'all' ) { | |
| 654 | + if ( $allowed == 'all' ) { | |
| 764 | 655 | $allowed_html = $html; |
| 765 | 656 | } elseif ( ! empty( $allowed ) ) { |
| 766 | 657 | foreach ( (array) $allowed as $a ) { |
| 767 | 658 | $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
| @@ -780,16 +671,15 @@ | ||
| 780 | 671 | 'id' => true, |
| 781 | 672 | ); |
| 782 | 673 | |
| 783 | 674 | return array( |
| 784 | - 'a' => array( | |
| 785 | - 'class' => true, | |
| 786 | - 'href' => true, | |
| 787 | - 'id' => true, | |
| 788 | - 'rel' => true, | |
| 789 | - 'target' => true, | |
| 790 | - 'title' => true, | |
| 791 | - 'tabindex' => true, | |
| 675 | + 'a' => array( | |
| 676 | + 'class' => true, | |
| 677 | + 'href' => true, | |
| 678 | + 'id' => true, | |
| 679 | + 'rel' => true, | |
| 680 | + 'target' => true, | |
| 681 | + 'title' => true, | |
| 792 | 682 | ), |
| 793 | 683 | 'abbr' => array( |
| 794 | 684 | 'title' => true, |
| 795 | 685 | ), |
| @@ -813,9 +703,8 @@ | ||
| 813 | 703 | 'class' => true, |
| 814 | 704 | 'id' => true, |
| 815 | 705 | 'title' => true, |
| 816 | 706 | 'style' => true, |
| 817 | - 'role' => true, | |
| 818 | 707 | ), |
| 819 | 708 | 'dl' => array(), |
| 820 | 709 | 'dt' => array(), |
| 821 | 710 | 'em' => array(), |
| @@ -864,13 +753,12 @@ | ||
| 864 | 753 | 'stroke-width' => true, |
| 865 | 754 | ), |
| 866 | 755 | 'section' => $allow_class, |
| 867 | 756 | 'span' => array( |
| 868 | - 'class' => true, | |
| 869 | - 'id' => true, | |
| 870 | - 'title' => true, | |
| 871 | - 'style' => true, | |
| 872 | - 'aria-hidden' => true, | |
| 757 | + 'class' => true, | |
| 758 | + 'id' => true, | |
| 759 | + 'title' => true, | |
| 760 | + 'style' => true, | |
| 873 | 761 | ), |
| 874 | 762 | 'strike' => array(), |
| 875 | 763 | 'strong' => array(), |
| 876 | 764 | 'symbol' => array( |
| @@ -878,36 +766,22 @@ | ||
| 878 | 766 | 'id' => true, |
| 879 | 767 | 'viewbox' => true, |
| 880 | 768 | ), |
| 881 | 769 | 'svg' => array( |
| 882 | - 'class' => true, | |
| 883 | - 'id' => true, | |
| 884 | - 'xmlns' => true, | |
| 885 | - 'viewbox' => true, | |
| 886 | - 'width' => true, | |
| 887 | - 'height' => true, | |
| 888 | - 'style' => true, | |
| 889 | - 'fill' => true, | |
| 890 | - 'aria-label' => true, | |
| 891 | - 'aria-hidden' => true, | |
| 770 | + 'class' => true, | |
| 771 | + 'id' => true, | |
| 772 | + 'xmlns' => true, | |
| 773 | + 'viewbox' => true, | |
| 774 | + 'width' => true, | |
| 775 | + 'height' => true, | |
| 776 | + 'style' => true, | |
| 777 | + 'fill' => true, | |
| 892 | 778 | ), |
| 893 | 779 | 'use' => array( |
| 894 | - 'href' => true, | |
| 780 | + 'href' => true, | |
| 895 | 781 | 'xlink:href' => true, |
| 896 | 782 | ), |
| 897 | 783 | 'ul' => $allow_class, |
| 898 | - 'label' => array( | |
| 899 | - 'for' => true, | |
| 900 | - 'class' => true, | |
| 901 | - 'id' => true, | |
| 902 | - ), | |
| 903 | - 'button' => array( | |
| 904 | - 'class' => true, | |
| 905 | - 'type' => true, | |
| 906 | - ), | |
| 907 | - 'legend' => array( | |
| 908 | - 'class' => true, | |
| 909 | - ), | |
| 910 | 784 | ); |
| 911 | 785 | } |
| 912 | 786 | |
| 913 | 787 | /** |
| @@ -965,18 +839,8 @@ | ||
| 965 | 839 | |
| 966 | 840 | $html_atts = self::array_to_html_params( $atts ); |
| 967 | 841 | |
| 968 | 842 | $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 | 843 | if ( $icon === $class ) { |
| 980 | 844 | $icon = '<i class="' . esc_attr( $class ) . '"' . $html_atts . '></i>'; |
| 981 | 845 | } else { |
| 982 | 846 | $class = strpos( $icon, ' ' ) === false ? '' : ' ' . $icon; |
| @@ -983,15 +847,15 @@ | ||
| 983 | 847 | if ( strpos( $icon, ' ' ) ) { |
| 984 | 848 | $icon = explode( ' ', $icon ); |
| 985 | 849 | $icon = reset( $icon ); |
| 986 | 850 | } |
| 987 | - $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '> | |
| 851 | + $icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '> | |
| 988 | 852 | <use xlink:href="#' . esc_attr( $icon ) . '" /> |
| 989 | 853 | </svg>'; |
| 990 | 854 | } |
| 991 | 855 | |
| 992 | 856 | if ( $echo ) { |
| 993 | - echo self::kses_icon( $icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 857 | + echo $icon; // WPCS: XSS ok. | |
| 994 | 858 | } else { |
| 995 | 859 | return $icon; |
| 996 | 860 | } |
| 997 | 861 | } |
| @@ -996,88 +860,14 @@ | ||
| 996 | 860 | } |
| 997 | 861 | } |
| 998 | 862 | |
| 999 | 863 | /** |
| 1000 | - * Run kses for icons. It needs to add a few filters first in order to preserve some custom style values. | |
| 1001 | - * | |
| 1002 | - * @since 5.0.13 | |
| 1003 | - * | |
| 1004 | - * @param string $icon | |
| 1005 | - * @return string | |
| 1006 | - */ | |
| 1007 | - public static function kses_icon( $icon ) { | |
| 1008 | - add_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' ); | |
| 1009 | - add_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style', 10, 2 ); | |
| 1010 | - add_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' ); | |
| 1011 | - $icon = self::kses( $icon, 'all' ); | |
| 1012 | - remove_filter( 'safe_style_css', 'FrmAppHelper::allow_vars_in_styles' ); | |
| 1013 | - remove_filter( 'safecss_filter_attr_allow_css', 'FrmAppHelper::allow_style' ); | |
| 1014 | - remove_filter( 'frm_striphtml_allowed_tags', 'FrmAppHelper::add_allowed_icon_tags' ); | |
| 1015 | - return $icon; | |
| 1016 | - } | |
| 1017 | - | |
| 1018 | - /** | |
| 1019 | - * @since 5.0.13.1 | |
| 1020 | - * | |
| 1021 | - * @param array $allowed_html | |
| 1022 | - * @return array | |
| 1023 | - */ | |
| 1024 | - public static function add_allowed_icon_tags( $allowed_html ) { | |
| 1025 | - $allowed_html['svg']['data-open'] = true; | |
| 1026 | - $allowed_html['svg']['title'] = true; | |
| 1027 | - return $allowed_html; | |
| 1028 | - } | |
| 1029 | - | |
| 1030 | - /** | |
| 1031 | - * @since 5.0.13 | |
| 1032 | - * | |
| 1033 | - * @param array $allowed_attr | |
| 1034 | - * @return array | |
| 1035 | - */ | |
| 1036 | - public static function allow_vars_in_styles( $allowed_attr ) { | |
| 1037 | - $allowed_attr[] = '--primary-700'; | |
| 1038 | - return $allowed_attr; | |
| 1039 | - } | |
| 1040 | - | |
| 1041 | - /** | |
| 1042 | - * @since 5.0.13 | |
| 1043 | - * | |
| 1044 | - * @param bool $allow_css | |
| 1045 | - * @param string $css_string | |
| 1046 | - */ | |
| 1047 | - public static function allow_style( $allow_css, $css_string ) { | |
| 1048 | - if ( ! $allow_css && 0 === strpos( $css_string, '--primary-700:' ) ) { | |
| 1049 | - $split = explode( ':', $css_string, 2 ); | |
| 1050 | - $allow_css = 2 === count( $split ) && self::is_a_valid_color( $split[1] ); | |
| 1051 | - } | |
| 1052 | - return $allow_css; | |
| 1053 | - } | |
| 1054 | - | |
| 1055 | - /** | |
| 1056 | - * @since 5.0.13 | |
| 1057 | - * | |
| 1058 | - * @param string $value | |
| 1059 | - * @return bool | |
| 1060 | - */ | |
| 1061 | - private static function is_a_valid_color( $value ) { | |
| 1062 | - $match = 0; | |
| 1063 | - if ( 0 === strpos( $value, 'rgba(' ) ) { | |
| 1064 | - $match = preg_match( '/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/', $value ); | |
| 1065 | - } elseif ( 0 === strpos( $value, 'rgb(' ) ) { | |
| 1066 | - $match = preg_match( '/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/', $value ); | |
| 1067 | - } elseif ( 0 === strpos( $value, '#' ) ) { | |
| 1068 | - $match = preg_match( '/^#([a-f0-9]{6}|[a-f0-9]{3})\b$/', $value ); | |
| 1069 | - } | |
| 1070 | - return (bool) $match; | |
| 1071 | - } | |
| 1072 | - | |
| 1073 | - /** | |
| 1074 | 864 | * Include svg images. |
| 1075 | 865 | * |
| 1076 | 866 | * @since 4.0.02 |
| 1077 | 867 | */ |
| 1078 | 868 | public static function include_svg() { |
| 1079 | - include_once self::plugin_path() . '/images/icons.svg'; | |
| 869 | + include_once( self::plugin_path() . '/images/icons.svg' ); | |
| 1080 | 870 | } |
| 1081 | 871 | |
| 1082 | 872 | /** |
| 1083 | 873 | * Convert an associative array to HTML values. |
| @@ -1082,48 +872,19 @@ | ||
| 1082 | 872 | /** |
| 1083 | 873 | * Convert an associative array to HTML values. |
| 1084 | 874 | * |
| 1085 | 875 | * @since 4.0.02 |
| 1086 | - * @since 5.0.13 added $echo parameter. | |
| 1087 | - * | |
| 1088 | 876 | * @param array $atts |
| 1089 | - * @param bool $echo | |
| 1090 | - * @return string|void | |
| 877 | + * @return string | |
| 1091 | 878 | */ |
| 1092 | - public static function array_to_html_params( $atts, $echo = false ) { | |
| 1093 | - $callback = function() use ( $atts ) { | |
| 1094 | - if ( $atts ) { | |
| 1095 | - foreach ( $atts as $key => $value ) { | |
| 1096 | - echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; | |
| 1097 | - } | |
| 879 | + public static function array_to_html_params( $atts ) { | |
| 880 | + $html = ''; | |
| 881 | + if ( ! empty( $atts ) ) { | |
| 882 | + foreach ( $atts as $key => $value ) { | |
| 883 | + $html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; | |
| 1098 | 884 | } |
| 1099 | - }; | |
| 1100 | - return self::clip( $callback, $echo ); | |
| 1101 | - } | |
| 1102 | - | |
| 1103 | - /** | |
| 1104 | - * Call an echo function and either echo it or return the result as a string. | |
| 1105 | - * | |
| 1106 | - * @since 5.0.13 | |
| 1107 | - * | |
| 1108 | - * @param Closure $echo_function | |
| 1109 | - * @param bool $echo | |
| 1110 | - * @return string|void | |
| 1111 | - */ | |
| 1112 | - public static function clip( $echo_function, $echo = false ) { | |
| 1113 | - if ( ! $echo ) { | |
| 1114 | - ob_start(); | |
| 1115 | 885 | } |
| 1116 | - | |
| 1117 | - if ( is_callable( $echo_function ) ) { | |
| 1118 | - $echo_function(); | |
| 1119 | - } | |
| 1120 | - | |
| 1121 | - if ( ! $echo ) { | |
| 1122 | - $return = ob_get_contents(); | |
| 1123 | - ob_end_clean(); | |
| 1124 | - return $return; | |
| 1125 | - } | |
| 886 | + return $html; | |
| 1126 | 887 | } |
| 1127 | 888 | |
| 1128 | 889 | /** |
| 1129 | 890 | * @since 3.0 |
| @@ -1140,94 +901,31 @@ | ||
| 1140 | 901 | include( self::plugin_path() . '/classes/views/shared/admin-header.php' ); |
| 1141 | 902 | } |
| 1142 | 903 | |
| 1143 | 904 | /** |
| 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 | 905 | * @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 | |
| 906 | + * @param array $atts | |
| 1204 | 907 | */ |
| 1205 | 908 | public static function add_new_item_link( $atts ) { |
| 1206 | - if ( isset( $atts['link_hook'] ) ) { | |
| 909 | + if ( ! empty( $atts['new_link'] ) ) { | |
| 910 | + ?> | |
| 911 | + <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus"> | |
| 912 | + <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?> | |
| 913 | + <?php esc_html_e( 'Add New', 'formidable' ); ?> | |
| 914 | + </a> | |
| 915 | + <?php | |
| 916 | + } elseif ( ! empty( $atts['trigger_new_form_modal'] ) ) { | |
| 917 | + ?> | |
| 918 | + <a href="#" class="button button-primary frm-button-primary frm-with-plus frm-trigger-new-form-modal"> | |
| 919 | + <?php | |
| 920 | + self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); | |
| 921 | + esc_html_e( 'Add New', 'formidable' ); | |
| 922 | + ?> | |
| 923 | + </a> | |
| 924 | + <?php | |
| 925 | + } elseif ( isset( $atts['link_hook'] ) ) { | |
| 1207 | 926 | do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] ); |
| 1208 | - return; | |
| 1209 | 927 | } |
| 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 | 928 | } |
| 1231 | 929 | |
| 1232 | 930 | /** |
| 1233 | 931 | * @since 3.06 |
| @@ -1300,8 +998,9 @@ | ||
| 1300 | 998 | ); |
| 1301 | 999 | $new_file = new FrmCreateFile( $file_atts ); |
| 1302 | 1000 | |
| 1303 | 1001 | $files = array( |
| 1002 | + self::plugin_path() . '/js/jquery/jquery.placeholder.min.js', | |
| 1304 | 1003 | self::plugin_path() . '/js/formidable.min.js', |
| 1305 | 1004 | ); |
| 1306 | 1005 | $files = apply_filters( 'frm_combined_js_files', $files ); |
| 1307 | 1006 | $new_file->combine_files( $files ); |
| @@ -1322,9 +1021,8 @@ | ||
| 1322 | 1021 | } |
| 1323 | 1022 | |
| 1324 | 1023 | /** |
| 1325 | 1024 | * Gets all post from a specific post type. |
| 1326 | - * This gets the entire WP_Post object so it can require a lot of memory. When only id and title are needed, consider using FrmAppHelper::get_post_ids_and_titles instead. | |
| 1327 | 1025 | * |
| 1328 | 1026 | * @since 4.10.01 Add `$post_type` argument. |
| 1329 | 1027 | * |
| 1330 | 1028 | * @param string $post_type Post type to query. Default is `page`. |
| @@ -1342,30 +1040,8 @@ | ||
| 1342 | 1040 | return get_posts( $query ); |
| 1343 | 1041 | } |
| 1344 | 1042 | |
| 1345 | 1043 | /** |
| 1346 | - * Gets post ids and titles for a specific post type. | |
| 1347 | - * | |
| 1348 | - * @since 5.0.09 | |
| 1349 | - * | |
| 1350 | - * @param string $post_type Post type to query. Default is `page`. | |
| 1351 | - * @return array | |
| 1352 | - */ | |
| 1353 | - public static function get_post_ids_and_titles( $post_type = 'page' ) { | |
| 1354 | - return FrmDb::get_results( | |
| 1355 | - 'posts', | |
| 1356 | - array( | |
| 1357 | - 'post_type' => $post_type, | |
| 1358 | - 'post_status' => array( 'publish', 'private' ), | |
| 1359 | - ), | |
| 1360 | - 'ID, post_title', | |
| 1361 | - array( | |
| 1362 | - 'order_by' => 'post_title ASC', | |
| 1363 | - ) | |
| 1364 | - ); | |
| 1365 | - } | |
| 1366 | - | |
| 1367 | - /** | |
| 1368 | 1044 | * Renders an autocomplete page selection or a regular dropdown depending on |
| 1369 | 1045 | * the total page count |
| 1370 | 1046 | * |
| 1371 | 1047 | * @since 4.03.06 |
| @@ -1410,9 +1086,9 @@ | ||
| 1410 | 1086 | */ |
| 1411 | 1087 | public static function wp_pages_dropdown( $args = array(), $page_id = '', $truncate = false ) { |
| 1412 | 1088 | self::prep_page_dropdown_params( $page_id, $truncate, $args ); |
| 1413 | 1089 | |
| 1414 | - $pages = self::get_post_ids_and_titles( $args['post_type'] ); | |
| 1090 | + $pages = self::get_pages( $args['post_type'] ); | |
| 1415 | 1091 | $selected = self::get_post_param( $args['field_name'], $args['page_id'], 'absint' ); |
| 1416 | 1092 | |
| 1417 | 1093 | ?> |
| 1418 | 1094 | <select name="<?php echo esc_attr( $args['field_name'] ); ?>" id="<?php echo esc_attr( $args['field_name'] ); ?>" class="frm-pages-dropdown"> |
| @@ -1466,8 +1142,9 @@ | ||
| 1466 | 1142 | public static function post_edit_link( $post_id ) { |
| 1467 | 1143 | $post = get_post( $post_id ); |
| 1468 | 1144 | if ( $post ) { |
| 1469 | 1145 | $post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' ); |
| 1146 | + $post_url = self::maybe_full_screen_link( $post_url ); | |
| 1470 | 1147 | |
| 1471 | 1148 | return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>'; |
| 1472 | 1149 | } |
| 1473 | 1150 | |
| @@ -1477,64 +1154,25 @@ | ||
| 1477 | 1154 | /** |
| 1478 | 1155 | * Hide the WordPress menus on some pages. |
| 1479 | 1156 | * |
| 1480 | 1157 | * @since 4.0 |
| 1481 | - * | |
| 1482 | - * @return bool | |
| 1483 | 1158 | */ |
| 1484 | 1159 | 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 | - } | |
| 1160 | + $full_builder = self::is_form_builder_page(); | |
| 1161 | + $styler = self::is_admin_page( 'formidable-styles' ) || self::is_admin_page( 'formidable-styles2' ); | |
| 1162 | + $full_entries = self::simple_get( 'frm-full', 'absint' ); | |
| 1489 | 1163 | |
| 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; | |
| 1164 | + return $full_builder || $full_entries || $styler || self::is_view_builder_page(); | |
| 1520 | 1165 | } |
| 1521 | 1166 | |
| 1522 | 1167 | /** |
| 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 | 1168 | * @since 4.0 |
| 1533 | - * @deprecated 5.5.3 | |
| 1534 | 1169 | */ |
| 1535 | 1170 | public static function maybe_full_screen_link( $link ) { |
| 1536 | - _deprecated_function( __METHOD__, '5.5.3' ); | |
| 1171 | + $is_full = self::simple_get( 'frm-full', 'absint' ); | |
| 1172 | + if ( $is_full && ! empty( $link ) && $link !== '#' ) { | |
| 1173 | + $link .= '&frm-full=1'; | |
| 1174 | + } | |
| 1537 | 1175 | return $link; |
| 1538 | 1176 | } |
| 1539 | 1177 | |
| 1540 | 1178 | /** |
| @@ -1585,50 +1223,10 @@ | ||
| 1585 | 1223 | unset( $role, $details ); |
| 1586 | 1224 | } |
| 1587 | 1225 | } |
| 1588 | 1226 | |
| 1589 | - /** | |
| 1590 | - * Gets the list of capabilities. | |
| 1591 | - * | |
| 1592 | - * @since 5.0 Parameter `$type` supports `pro_only` value. | |
| 1593 | - * | |
| 1594 | - * @param string $type Supports `auto`, `pro`, or `pro_only`. | |
| 1595 | - * @return array | |
| 1596 | - */ | |
| 1597 | 1227 | 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(); | |
| 1600 | - } | |
| 1601 | - | |
| 1602 | - $pro_cap = array( | |
| 1603 | - 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ), | |
| 1604 | - 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ), | |
| 1605 | - 'frm_view_reports' => __( 'View Reports', 'formidable' ), | |
| 1606 | - 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ), | |
| 1607 | - ); | |
| 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 | - | |
| 1615 | - if ( 'pro_only' === $type ) { | |
| 1616 | - return $pro_cap; | |
| 1617 | - } | |
| 1618 | - | |
| 1619 | - return self::get_lite_capabilities() + $pro_cap; | |
| 1620 | - } | |
| 1621 | - | |
| 1622 | - /** | |
| 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( | |
| 1228 | + $cap = array( | |
| 1631 | 1229 | 'frm_view_forms' => __( 'View Forms', 'formidable' ), |
| 1632 | 1230 | 'frm_edit_forms' => __( 'Add and Edit Forms', 'formidable' ), |
| 1633 | 1231 | 'frm_delete_forms' => __( 'Delete Forms', 'formidable' ), |
| 1634 | 1232 | 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ), |
| @@ -1634,8 +1232,19 @@ | ||
| 1634 | 1232 | 'frm_change_settings' => __( 'Access this Settings Page', 'formidable' ), |
| 1635 | 1233 | 'frm_view_entries' => __( 'View Entries from Admin Area', 'formidable' ), |
| 1636 | 1234 | 'frm_delete_entries' => __( 'Delete Entries from Admin Area', 'formidable' ), |
| 1637 | 1235 | ); |
| 1236 | + | |
| 1237 | + if ( ! self::pro_is_installed() && 'pro' != $type ) { | |
| 1238 | + return $cap; | |
| 1239 | + } | |
| 1240 | + | |
| 1241 | + $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' ); | |
| 1242 | + $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' ); | |
| 1243 | + $cap['frm_view_reports'] = __( 'View Reports', 'formidable' ); | |
| 1244 | + $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' ); | |
| 1245 | + | |
| 1246 | + return $cap; | |
| 1638 | 1247 | } |
| 1639 | 1248 | |
| 1640 | 1249 | /** |
| 1641 | 1250 | * Call the WordPress current_user_can but also validate empty strings as true for any logged in user |
| @@ -1883,8 +1492,19 @@ | ||
| 1883 | 1492 | return $val; |
| 1884 | 1493 | } |
| 1885 | 1494 | |
| 1886 | 1495 | /** |
| 1496 | + * @since 2.0 | |
| 1497 | + * @return string The base Google APIS url for the current version of jQuery UI | |
| 1498 | + */ | |
| 1499 | + public static function jquery_ui_base_url() { | |
| 1500 | + $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' ); | |
| 1501 | + $url = apply_filters( 'frm_jquery_ui_base_url', $url ); | |
| 1502 | + | |
| 1503 | + return $url; | |
| 1504 | + } | |
| 1505 | + | |
| 1506 | + /** | |
| 1887 | 1507 | * @param string $handle |
| 1888 | 1508 | */ |
| 1889 | 1509 | public static function script_version( $handle, $default = 0 ) { |
| 1890 | 1510 | global $wp_scripts; |
| @@ -1904,24 +1524,14 @@ | ||
| 1904 | 1524 | |
| 1905 | 1525 | return $ver; |
| 1906 | 1526 | } |
| 1907 | 1527 | |
| 1908 | - /** | |
| 1909 | - * @since 5.0.13 added $echo param. | |
| 1910 | - * | |
| 1911 | - * @param string $url | |
| 1912 | - * @param bool $echo | |
| 1913 | - * @return string|void | |
| 1914 | - */ | |
| 1915 | - public static function js_redirect( $url, $echo = false ) { | |
| 1916 | - $callback = function() use ( $url ) { | |
| 1917 | - echo '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>'; | |
| 1918 | - }; | |
| 1919 | - return self::clip( $callback, $echo ); | |
| 1528 | + public static function js_redirect( $url ) { | |
| 1529 | + return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>'; | |
| 1920 | 1530 | } |
| 1921 | 1531 | |
| 1922 | 1532 | public static function get_user_id_param( $user_id ) { |
| 1923 | - if ( ! $user_id || is_numeric( $user_id ) ) { | |
| 1533 | + if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) { | |
| 1924 | 1534 | return $user_id; |
| 1925 | 1535 | } |
| 1926 | 1536 | |
| 1927 | 1537 | $user_id = sanitize_text_field( $user_id ); |
| @@ -1960,10 +1570,10 @@ | ||
| 1960 | 1570 | /** |
| 1961 | 1571 | * @param string $name |
| 1962 | 1572 | * @param string $table_name |
| 1963 | 1573 | * @param string $column |
| 1964 | - * @param int $id | |
| 1965 | - * @param int $num_chars | |
| 1574 | + * @param int $id | |
| 1575 | + * @param int $num_chars | |
| 1966 | 1576 | */ |
| 1967 | 1577 | public static function get_unique_key( $name, $table_name, $column, $id = 0, $num_chars = 5 ) { |
| 1968 | 1578 | $key = ''; |
| 1969 | 1579 | if ( $name ) { |
| @@ -1976,38 +1586,20 @@ | ||
| 1976 | 1586 | } |
| 1977 | 1587 | |
| 1978 | 1588 | $key = self::prevent_numeric_and_reserved_keys( $key ); |
| 1979 | 1589 | |
| 1980 | - $similar_keys = FrmDb::get_col( | |
| 1590 | + $key_check = FrmDb::get_var( | |
| 1981 | 1591 | $table_name, |
| 1982 | 1592 | array( |
| 1983 | - $column . ' like%' => $key, | |
| 1984 | - 'ID !' => $id, | |
| 1593 | + $column => $key, | |
| 1594 | + 'ID !' => $id, | |
| 1985 | 1595 | ), |
| 1986 | 1596 | $column |
| 1987 | 1597 | ); |
| 1988 | 1598 | |
| 1989 | - // Create a unique field id if it has already been used. | |
| 1990 | - if ( in_array( $key, $similar_keys, true ) ) { | |
| 1991 | - $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; | |
| 1599 | + if ( $key_check || is_numeric( $key_check ) ) { | |
| 1600 | + // Create a unique field id if it has already been used. | |
| 1601 | + $key = $key . substr( md5( microtime() . rand() ), 0, 10 ); | |
| 2010 | 1602 | } |
| 2011 | 1603 | |
| 2012 | 1604 | return $key; |
| 2013 | 1605 | } |
| @@ -2012,29 +1604,8 @@ | ||
| 2012 | 1604 | return $key; |
| 2013 | 1605 | } |
| 2014 | 1606 | |
| 2015 | 1607 | /** |
| 2016 | - * Avoid trying to append to a really long key, | |
| 2017 | - * The database limit is 100 for form and field keys so we want to avoid getting too close. | |
| 2018 | - * | |
| 2019 | - * @param string $column | |
| 2020 | - * @param string $key | |
| 2021 | - * @return string | |
| 2022 | - */ | |
| 2023 | - private static function maybe_truncate_key_before_appending( $column, $key ) { | |
| 2024 | - if ( in_array( $column, array( 'form_key', 'field_key' ), true ) ) { | |
| 2025 | - $max_key_length_before_truncating = 60; | |
| 2026 | - if ( strlen( $key ) > $max_key_length_before_truncating ) { | |
| 2027 | - $key = substr( $key, 0, $max_key_length_before_truncating ); | |
| 2028 | - if ( is_numeric( $key ) ) { | |
| 2029 | - $key .= 'a'; | |
| 2030 | - } | |
| 2031 | - } | |
| 2032 | - } | |
| 2033 | - return $key; | |
| 2034 | - } | |
| 2035 | - | |
| 2036 | - /** | |
| 2037 | 1608 | * Possibly reset a key to avoid conflicts with column size limits. |
| 2038 | 1609 | * |
| 2039 | 1610 | * @param string $key |
| 2040 | 1611 | * @param string $column |
| @@ -2093,9 +1664,9 @@ | ||
| 2093 | 1664 | return false; |
| 2094 | 1665 | } |
| 2095 | 1666 | |
| 2096 | 1667 | if ( empty( $post_values ) ) { |
| 2097 | - $post_values = wp_unslash( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 1668 | + $post_values = wp_unslash( $_POST ); | |
| 2098 | 1669 | } |
| 2099 | 1670 | |
| 2100 | 1671 | $values = array( |
| 2101 | 1672 | 'id' => $record->id, |
| @@ -2113,11 +1684,11 @@ | ||
| 2113 | 1684 | self::fill_form_opts( $record, $table, $post_values, $values ); |
| 2114 | 1685 | |
| 2115 | 1686 | self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) ); |
| 2116 | 1687 | |
| 2117 | - if ( $table === 'entries' ) { | |
| 1688 | + if ( $table == 'entries' ) { | |
| 2118 | 1689 | $values = FrmEntriesHelper::setup_edit_vars( $values, $record ); |
| 2119 | - } elseif ( $table === 'forms' ) { | |
| 1690 | + } elseif ( $table == 'forms' ) { | |
| 2120 | 1691 | $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values ); |
| 2121 | 1692 | } |
| 2122 | 1693 | |
| 2123 | 1694 | return $values; |
| @@ -2394,9 +1965,9 @@ | ||
| 2394 | 1965 | * |
| 2395 | 1966 | * @return string $time_ago |
| 2396 | 1967 | */ |
| 2397 | 1968 | public static function human_time_diff( $from, $to = '', $levels = 1 ) { |
| 2398 | - if ( empty( $to ) && 0 !== $to ) { | |
| 1969 | + if ( empty( $to ) ) { | |
| 2399 | 1970 | $now = new DateTime(); |
| 2400 | 1971 | } else { |
| 2401 | 1972 | $now = new DateTime( '@' . $to ); |
| 2402 | 1973 | } |
| @@ -2647,9 +2218,8 @@ | ||
| 2647 | 2218 | '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 | 2219 | 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ), |
| 2649 | 2220 | /* translators: %1$s: Form name, %2$s: Date */ |
| 2650 | 2221 | '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 | 2222 | ); |
| 2653 | 2223 | |
| 2654 | 2224 | if ( ! isset( $tooltips[ $name ] ) ) { |
| 2655 | 2225 | return; |
| @@ -2676,12 +2246,8 @@ | ||
| 2676 | 2246 | return; |
| 2677 | 2247 | } |
| 2678 | 2248 | |
| 2679 | 2249 | $frm_action = self::simple_get( 'frm_action', 'sanitize_title' ); |
| 2680 | - if ( 'lite-reports' === $frm_action ) { | |
| 2681 | - $frm_action = 'reports'; | |
| 2682 | - } | |
| 2683 | - | |
| 2684 | 2250 | if ( empty( $action ) || ( ! empty( $frm_action ) && in_array( $frm_action, $action ) ) ) { |
| 2685 | 2251 | echo ' class="current_page"'; |
| 2686 | 2252 | } |
| 2687 | 2253 | } |
| @@ -2719,9 +2285,9 @@ | ||
| 2719 | 2285 | return $post_content; |
| 2720 | 2286 | } |
| 2721 | 2287 | |
| 2722 | 2288 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 2723 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { | |
| 2289 | + if ( ! isset( $post_content[ $key ] ) ) { | |
| 2724 | 2290 | return; |
| 2725 | 2291 | } |
| 2726 | 2292 | |
| 2727 | 2293 | if ( is_array( $val ) ) { |
| @@ -2738,15 +2304,12 @@ | ||
| 2738 | 2304 | } |
| 2739 | 2305 | } |
| 2740 | 2306 | |
| 2741 | 2307 | /** |
| 2742 | - * Check for either json or serialized data. This is temporary while transitioning | |
| 2308 | + * Check for either json or serilized data. This is temporary while transitioning | |
| 2743 | 2309 | * all data to json. |
| 2744 | 2310 | * |
| 2745 | 2311 | * @since 4.02.03 |
| 2746 | - * | |
| 2747 | - * @param array|string $value | |
| 2748 | - * @return void | |
| 2749 | 2312 | */ |
| 2750 | 2313 | public static function unserialize_or_decode( &$value ) { |
| 2751 | 2314 | if ( is_array( $value ) ) { |
| 2752 | 2315 | return; |
| @@ -2752,9 +2315,9 @@ | ||
| 2752 | 2315 | return; |
| 2753 | 2316 | } |
| 2754 | 2317 | |
| 2755 | 2318 | if ( is_serialized( $value ) ) { |
| 2756 | - $value = self::maybe_unserialize_array( $value ); | |
| 2319 | + $value = maybe_unserialize( $value ); | |
| 2757 | 2320 | } else { |
| 2758 | 2321 | $value = self::maybe_json_decode( $value, false ); |
| 2759 | 2322 | } |
| 2760 | 2323 | } |
| @@ -2759,44 +2322,13 @@ | ||
| 2759 | 2322 | } |
| 2760 | 2323 | } |
| 2761 | 2324 | |
| 2762 | 2325 | /** |
| 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 | 2326 | * Decode a JSON string. |
| 2791 | 2327 | * Do not switch shortcodes like [24] to array unless intentional ie XML values. |
| 2792 | - * | |
| 2793 | - * @param mixed $string | |
| 2794 | - * @param bool $single_to_array | |
| 2795 | - * @return mixed | |
| 2796 | 2328 | */ |
| 2797 | 2329 | public static function maybe_json_decode( $string, $single_to_array = true ) { |
| 2798 | - if ( is_array( $string ) || is_null( $string ) ) { | |
| 2330 | + if ( is_array( $string ) ) { | |
| 2799 | 2331 | return $string; |
| 2800 | 2332 | } |
| 2801 | 2333 | |
| 2802 | 2334 | $new_string = json_decode( $string, true ); |
| @@ -2814,36 +2346,8 @@ | ||
| 2814 | 2346 | return $string; |
| 2815 | 2347 | } |
| 2816 | 2348 | |
| 2817 | 2349 | /** |
| 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 | 2350 | * Reformat the json serialized array in name => value array. |
| 2847 | 2351 | * |
| 2848 | 2352 | * @since 4.02.03 |
| 2849 | 2353 | */ |
| @@ -2909,17 +2413,14 @@ | ||
| 2909 | 2413 | $version = self::plugin_version(); |
| 2910 | 2414 | wp_register_script( 'formidable_admin_global', self::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version ); |
| 2911 | 2415 | |
| 2912 | 2416 | $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…', 'formidable' ), | |
| 2920 | - 'nonce' => wp_create_nonce( 'frm_ajax' ), | |
| 2921 | - 'proIncludesSliderJs' => is_callable( 'FrmProFormsHelper::prepare_custom_currency' ), | |
| 2417 | + 'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ), | |
| 2418 | + 'deauthorize' => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ), | |
| 2419 | + 'url' => self::plugin_url(), | |
| 2420 | + 'app_url' => 'https://formidableforms.com/', | |
| 2421 | + 'loading' => __( 'Loading…', 'formidable' ), | |
| 2422 | + 'nonce' => wp_create_nonce( 'frm_ajax' ), | |
| 2922 | 2423 | ); |
| 2923 | 2424 | wp_localize_script( 'formidable_admin_global', 'frmGlobal', $global_strings ); |
| 2924 | 2425 | |
| 2925 | 2426 | if ( $load ) { |
| @@ -2943,21 +2444,19 @@ | ||
| 2943 | 2444 | $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ); |
| 2944 | 2445 | $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url ); |
| 2945 | 2446 | |
| 2946 | 2447 | $script_strings = array( |
| 2947 | - 'ajax_url' => $ajax_url, | |
| 2948 | - 'images_url' => self::plugin_url() . '/images', | |
| 2949 | - 'loading' => __( 'Loading…', '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(), | |
| 2448 | + 'ajax_url' => $ajax_url, | |
| 2449 | + 'images_url' => self::plugin_url() . '/images', | |
| 2450 | + 'loading' => __( 'Loading…', 'formidable' ), | |
| 2451 | + 'remove' => __( 'Remove', 'formidable' ), | |
| 2452 | + 'offset' => apply_filters( 'frm_scroll_offset', 4 ), | |
| 2453 | + 'nonce' => wp_create_nonce( 'frm_ajax' ), | |
| 2454 | + 'id' => __( 'ID', 'formidable' ), | |
| 2455 | + 'no_results' => __( 'No results match', 'formidable' ), | |
| 2456 | + 'file_spam' => __( 'That file looks like Spam.', 'formidable' ), | |
| 2457 | + 'calc_error' => __( 'There is an error in the calculation in the field with key', 'formidable' ), | |
| 2458 | + 'empty_fields' => __( 'Please complete the preceding required fields before uploading a file.', 'formidable' ), | |
| 2960 | 2459 | ); |
| 2961 | 2460 | |
| 2962 | 2461 | $data = $wp_scripts->get_data( 'formidable', 'data' ); |
| 2963 | 2462 | if ( empty( $data ) ) { |
| @@ -2969,10 +2468,10 @@ | ||
| 2969 | 2468 | $admin_script_strings = array( |
| 2970 | 2469 | 'desc' => __( '(Click to add description)', 'formidable' ), |
| 2971 | 2470 | 'blank' => __( '(Blank)', 'formidable' ), |
| 2972 | 2471 | 'no_label' => __( '(no label)', 'formidable' ), |
| 2973 | - 'saving' => '', // Deprecated in 6.0. | |
| 2974 | - 'saved' => '', // Deprecated in 6.0. | |
| 2472 | + 'saving' => esc_attr( __( 'Saving', 'formidable' ) ), | |
| 2473 | + 'saved' => esc_attr( __( 'Saved', 'formidable' ) ), | |
| 2975 | 2474 | 'ok' => __( 'OK', 'formidable' ), |
| 2976 | 2475 | 'cancel' => __( 'Cancel', 'formidable' ), |
| 2977 | 2476 | 'default_label' => __( 'Default', 'formidable' ), |
| 2978 | 2477 | 'clear_default' => __( 'Clear default value when typing', 'formidable' ), |
| @@ -2978,8 +2477,9 @@ | ||
| 2978 | 2477 | 'clear_default' => __( 'Clear default value when typing', 'formidable' ), |
| 2979 | 2478 | 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ), |
| 2980 | 2479 | 'valid_default' => __( 'Default value will pass form validation', 'formidable' ), |
| 2981 | 2480 | 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ), |
| 2481 | + 'caution' => __( 'Heads up', 'formidable' ), | |
| 2982 | 2482 | 'confirm' => __( 'Are you sure?', 'formidable' ), |
| 2983 | 2483 | 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ), |
| 2984 | 2484 | '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 | 2485 | 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ), |
| @@ -2995,9 +2495,9 @@ | ||
| 2995 | 2495 | 'import_complete' => __( 'Import Complete', 'formidable' ), |
| 2996 | 2496 | 'updating' => __( 'Please wait while your site updates.', 'formidable' ), |
| 2997 | 2497 | 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ), |
| 2998 | 2498 | 'private_label' => __( 'Private', 'formidable' ), |
| 2999 | - 'jquery_ui_url' => '', | |
| 2499 | + 'jquery_ui_url' => self::jquery_ui_base_url(), | |
| 3000 | 2500 | 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '', |
| 3001 | 2501 | 'no_licenses' => __( 'No new licenses were found', 'formidable' ), |
| 3002 | 2502 | 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ), |
| 3003 | 2503 | 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ), |
| @@ -3014,9 +2514,8 @@ | ||
| 3014 | 2514 | 'install' => __( 'Install', 'formidable' ), |
| 3015 | 2515 | 'active' => __( 'Active', 'formidable' ), |
| 3016 | 2516 | 'select_a_field' => __( 'Select a Field', 'formidable' ), |
| 3017 | 2517 | 'no_items_found' => __( 'No items found.', 'formidable' ), |
| 3018 | - 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ), | |
| 3019 | 2518 | ); |
| 3020 | 2519 | $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings ); |
| 3021 | 2520 | |
| 3022 | 2521 | $data = $wp_scripts->get_data( 'formidable_admin', 'data' ); |
| @@ -3026,30 +2525,8 @@ | ||
| 3026 | 2525 | } |
| 3027 | 2526 | } |
| 3028 | 2527 | |
| 3029 | 2528 | /** |
| 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 | 2529 | * Echo the message on the plugins listing page |
| 3053 | 2530 | * |
| 3054 | 2531 | * @since 1.07.10 |
| 3055 | 2532 | * |
| @@ -3072,10 +2549,8 @@ | ||
| 3072 | 2549 | /** |
| 3073 | 2550 | * If Pro is far outdated, show a message. |
| 3074 | 2551 | * |
| 3075 | 2552 | * @since 4.0.01 |
| 3076 | - * | |
| 3077 | - * @return void | |
| 3078 | 2553 | */ |
| 3079 | 2554 | public static function min_pro_version_notice( $min_version ) { |
| 3080 | 2555 | if ( ! self::is_formidable_admin() ) { |
| 3081 | 2556 | // Don't show admin-wide. |
| @@ -3091,9 +2566,9 @@ | ||
| 3091 | 2566 | |
| 3092 | 2567 | $pro_version = FrmProDb::$plug_version; |
| 3093 | 2568 | $expired = FrmAddonsController::is_license_expired(); |
| 3094 | 2569 | ?> |
| 3095 | - <div class="frm-banner-alert frm_error_style frm_previous_install"> | |
| 2570 | + <div class="error frm_previous_install"> | |
| 3096 | 2571 | <?php |
| 3097 | 2572 | 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 | 2573 | if ( empty( $expired ) ) { |
| 3099 | 2574 | echo ' Please <a href="' . esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ) . '">update now</a>.'; |
| @@ -3132,9 +2607,9 @@ | ||
| 3132 | 2607 | } |
| 3133 | 2608 | |
| 3134 | 2609 | foreach ( $message as $m ) { |
| 3135 | 2610 | ?> |
| 3136 | - <div class="frm-banner-alert frm_error_style frm_previous_install"> | |
| 2611 | + <div class="error frm_previous_install"> | |
| 3137 | 2612 | <?php echo esc_html( $m ); ?> |
| 3138 | 2613 | </div> |
| 3139 | 2614 | <?php |
| 3140 | 2615 | } |
| @@ -3139,25 +2614,17 @@ | ||
| 3139 | 2614 | <?php |
| 3140 | 2615 | } |
| 3141 | 2616 | } |
| 3142 | 2617 | |
| 3143 | - /** | |
| 3144 | - * @param string $type | |
| 3145 | - * @return array<string,string> | |
| 3146 | - */ | |
| 3147 | 2618 | public static function locales( $type = 'date' ) { |
| 3148 | 2619 | $locales = array( |
| 3149 | 2620 | 'en' => __( 'English', 'formidable' ), |
| 3150 | 2621 | 'af' => __( 'Afrikaans', 'formidable' ), |
| 3151 | 2622 | 'sq' => __( 'Albanian', 'formidable' ), |
| 3152 | - 'ar-DZ' => __( 'Algerian Arabic', 'formidable' ), | |
| 3153 | - 'am' => __( 'Amharic', 'formidable' ), | |
| 3154 | 2623 | 'ar' => __( 'Arabic', 'formidable' ), |
| 3155 | 2624 | 'hy' => __( 'Armenian', 'formidable' ), |
| 3156 | 2625 | 'az' => __( 'Azerbaijani', 'formidable' ), |
| 3157 | 2626 | 'eu' => __( 'Basque', 'formidable' ), |
| 3158 | - 'be' => __( 'Belarusian', 'formidable' ), | |
| 3159 | - 'bn' => __( 'Bengali', 'formidable' ), | |
| 3160 | 2627 | 'bs' => __( 'Bosnian', 'formidable' ), |
| 3161 | 2628 | 'bg' => __( 'Bulgarian', 'formidable' ), |
| 3162 | 2629 | 'ca' => __( 'Catalan', 'formidable' ), |
| 3163 | 2630 | 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ), |
| @@ -3176,15 +2643,12 @@ | ||
| 3176 | 2643 | 'fi' => __( 'Finnish', 'formidable' ), |
| 3177 | 2644 | 'fr' => __( 'French', 'formidable' ), |
| 3178 | 2645 | 'fr-CA' => __( 'French/Canadian', 'formidable' ), |
| 3179 | 2646 | 'fr-CH' => __( 'French/Swiss', 'formidable' ), |
| 3180 | - 'gl' => __( 'Galician', 'formidable' ), | |
| 3181 | - 'ka' => __( 'Georgian', 'formidable' ), | |
| 3182 | 2647 | 'de' => __( 'German', 'formidable' ), |
| 3183 | 2648 | 'de-AT' => __( 'German/Austria', 'formidable' ), |
| 3184 | 2649 | 'de-CH' => __( 'German/Switzerland', 'formidable' ), |
| 3185 | 2650 | 'el' => __( 'Greek', 'formidable' ), |
| 3186 | - 'gu' => __( 'Gujarati', 'formidable' ), | |
| 3187 | 2651 | 'he' => __( 'Hebrew', 'formidable' ), |
| 3188 | 2652 | 'iw' => __( 'Hebrew', 'formidable' ), |
| 3189 | 2653 | 'hi' => __( 'Hindi', 'formidable' ), |
| 3190 | 2654 | 'hu' => __( 'Hungarian', 'formidable' ), |
| @@ -3191,720 +2655,277 @@ | ||
| 3191 | 2655 | 'is' => __( 'Icelandic', 'formidable' ), |
| 3192 | 2656 | 'id' => __( 'Indonesian', 'formidable' ), |
| 3193 | 2657 | 'it' => __( 'Italian', 'formidable' ), |
| 3194 | 2658 | 'ja' => __( 'Japanese', 'formidable' ), |
| 3195 | - 'kn' => __( 'Kannada', 'formidable' ), | |
| 3196 | - 'kk' => __( 'Kazakh', 'formidable' ), | |
| 3197 | - 'km' => __( 'Khmer', 'formidable' ), | |
| 3198 | 2659 | 'ko' => __( 'Korean', 'formidable' ), |
| 3199 | - 'ky' => __( 'Kyrgyz', 'formidable' ), | |
| 3200 | - 'lo' => __( 'Laothian', 'formidable' ), | |
| 3201 | 2660 | 'lv' => __( 'Latvian', 'formidable' ), |
| 3202 | 2661 | 'lt' => __( 'Lithuanian', 'formidable' ), |
| 3203 | - 'lb' => __( 'Luxembourgish', 'formidable' ), | |
| 3204 | - 'mk' => __( 'Macedonian', 'formidable' ), | |
| 3205 | - 'ml' => __( 'Malayalam', 'formidable' ), | |
| 3206 | 2662 | 'ms' => __( 'Malaysian', 'formidable' ), |
| 3207 | - 'mr' => __( 'Marathi', 'formidable' ), | |
| 3208 | 2663 | 'no' => __( 'Norwegian', 'formidable' ), |
| 3209 | - 'nb' => __( 'Norwegian Bokmål', 'formidable' ), | |
| 3210 | - 'nn' => __( 'Norwegian Nynorsk', 'formidable' ), | |
| 3211 | 2664 | 'pl' => __( 'Polish', 'formidable' ), |
| 3212 | 2665 | 'pt' => __( 'Portuguese', 'formidable' ), |
| 3213 | 2666 | 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ), |
| 3214 | 2667 | 'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), |
| 3215 | - 'rm' => __( 'Romansh', 'formidable' ), | |
| 3216 | 2668 | 'ro' => __( 'Romanian', 'formidable' ), |
| 3217 | 2669 | 'ru' => __( 'Russian', 'formidable' ), |
| 3218 | 2670 | 'sr' => __( 'Serbian', 'formidable' ), |
| 3219 | 2671 | 'sr-SR' => __( 'Serbian', 'formidable' ), |
| 3220 | - 'si' => __( 'Sinhalese', 'formidable' ), | |
| 3221 | 2672 | 'sk' => __( 'Slovak', 'formidable' ), |
| 3222 | 2673 | 'sl' => __( 'Slovenian', 'formidable' ), |
| 3223 | 2674 | 'es' => __( 'Spanish', 'formidable' ), |
| 3224 | 2675 | 'es-419' => __( 'Spanish/Latin America', 'formidable' ), |
| 3225 | - 'sw' => __( 'Swahili', 'formidable' ), | |
| 3226 | 2676 | 'sv' => __( 'Swedish', 'formidable' ), |
| 3227 | 2677 | 'ta' => __( 'Tamil', 'formidable' ), |
| 3228 | - 'te' => __( 'Telugu', 'formidable' ), | |
| 3229 | 2678 | 'th' => __( 'Thai', 'formidable' ), |
| 3230 | - 'tj' => __( 'Tajiki', 'formidable' ), | |
| 3231 | 2679 | 'tr' => __( 'Turkish', 'formidable' ), |
| 3232 | - 'uk' => __( 'Ukrainian', 'formidable' ), | |
| 3233 | - 'ur' => __( 'Urdu', 'formidable' ), | |
| 2680 | + 'uk' => __( 'Ukranian', 'formidable' ), | |
| 3234 | 2681 | 'vi' => __( 'Vietnamese', 'formidable' ), |
| 3235 | - 'cy-GB' => __( 'Welsh', 'formidable' ), | |
| 3236 | - 'zu' => __( 'Zulu', 'formidable' ), | |
| 3237 | 2682 | ); |
| 3238 | 2683 | |
| 3239 | 2684 | if ( $type === 'captcha' ) { |
| 3240 | 2685 | // 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' ); | |
| 2686 | + $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' ); | |
| 3242 | 2687 | } else { |
| 3243 | 2688 | // 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' ); | |
| 2689 | + $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' ); | |
| 3245 | 2690 | } |
| 3246 | 2691 | |
| 3247 | 2692 | $locales = array_diff_key( $locales, array_flip( $unset ) ); |
| 2693 | + $locales = apply_filters( 'frm_locales', $locales ); | |
| 3248 | 2694 | |
| 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 | 2695 | return $locales; |
| 3262 | 2696 | } |
| 3263 | 2697 | |
| 3264 | 2698 | /** |
| 3265 | 2699 | * Output HTML containing reference text for accessibility |
| 3266 | - * | |
| 3267 | - * @deprecated 5.1 | |
| 3268 | 2700 | */ |
| 3269 | 2701 | public static function multiselect_accessibility() { |
| 3270 | - _deprecated_function( __METHOD__, '5.1' ); | |
| 2702 | + include_once self::plugin_path() . '/classes/views/frm-forms/multiselect-accessibility.php'; | |
| 3271 | 2703 | } |
| 3272 | 2704 | |
| 3273 | - public static function get_menu_icon_class() { | |
| 3274 | - if ( is_callable( 'FrmProAppHelper::get_settings' ) ) { | |
| 3275 | - $settings = FrmProAppHelper::get_settings(); | |
| 3276 | - if ( is_object( $settings ) && ! empty( $settings->menu_icon ) ) { | |
| 3277 | - return $settings->menu_icon; | |
| 3278 | - } | |
| 3279 | - } | |
| 3280 | - return 'frmfont frm_logo_icon'; | |
| 3281 | - } | |
| 3282 | - | |
| 3283 | 2705 | /** |
| 3284 | - * Shows the images dropdown. | |
| 3285 | - * | |
| 3286 | - * @since 5.0.04 | |
| 3287 | - * | |
| 3288 | - * @param array $args { | |
| 3289 | - * Arguments. | |
| 3290 | - * | |
| 3291 | - * @type string $selected Selected value. | |
| 3292 | - * @type array[] $options Array of options with keys are option values and values are array. | |
| 3293 | - * The option array contains `text`, `svg` and `custom_atts`. | |
| 3294 | - * @type string $classes Custom CSS classes for the wrapper element. | |
| 3295 | - * @type array $input_attrs Attributes of value input. | |
| 3296 | - * } | |
| 2706 | + * @since 4.07 | |
| 2707 | + * @deprecated 4.09.01 | |
| 3297 | 2708 | */ |
| 3298 | - public static function images_dropdown( $args ) { | |
| 3299 | - $args = self::fill_default_images_dropdown_args( $args ); | |
| 3300 | - | |
| 3301 | - $input_attrs_str = self::get_images_dropdown_input_attrs( $args ); | |
| 3302 | - ob_start(); | |
| 3303 | - include self::plugin_path() . '/classes/views/shared/images-dropdown.php'; | |
| 3304 | - $output = ob_get_clean(); | |
| 3305 | - | |
| 3306 | - /** | |
| 3307 | - * Allows modifying the output of FrmAppHelper::images_dropdown() method. | |
| 3308 | - * | |
| 3309 | - * @since 5.0.04 | |
| 3310 | - * | |
| 3311 | - * @param string $output The output. | |
| 3312 | - * @param array $args Passed arguments. | |
| 3313 | - */ | |
| 3314 | - echo apply_filters( 'frm_images_dropdown_output', $output, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 3315 | - } | |
| 3316 | - | |
| 3317 | - /** | |
| 3318 | - * Fills the default images_dropdown() arguments. | |
| 3319 | - * | |
| 3320 | - * @since 5.0.04 | |
| 3321 | - * | |
| 3322 | - * @param array $args The arguments. | |
| 3323 | - * @return array | |
| 3324 | - */ | |
| 3325 | - private static function fill_default_images_dropdown_args( $args ) { | |
| 3326 | - $defaults = array( | |
| 3327 | - 'selected' => '', | |
| 3328 | - 'options' => array(), | |
| 3329 | - 'classes' => '', | |
| 3330 | - 'input_attrs' => array(), | |
| 3331 | - ); | |
| 3332 | - $new_args = wp_parse_args( $args, $defaults ); | |
| 3333 | - | |
| 3334 | - $new_args['options'] = (array) $new_args['options']; | |
| 3335 | - $new_args['input_attrs'] = (array) $new_args['input_attrs']; | |
| 3336 | - | |
| 3337 | - // Set the number of columns. | |
| 3338 | - $new_args['col_class'] = ceil( 12 / count( $new_args['options'] ) ); | |
| 3339 | - if ( $new_args['col_class'] > 6 ) { | |
| 3340 | - $new_args['col_class'] = ceil( $new_args['col_class'] / 2 ); | |
| 2709 | + public static function renewal_message() { | |
| 2710 | + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) { | |
| 2711 | + FrmProAddonsController::renewal_message(); | |
| 2712 | + return; | |
| 3341 | 2713 | } |
| 3342 | 2714 | |
| 3343 | - /** | |
| 3344 | - * Allows modifying the arguments of images_dropdown() method. | |
| 3345 | - * | |
| 3346 | - * @since 5.0.04 | |
| 3347 | - * | |
| 3348 | - * @param array $new_args Arguments after filling the defaults. | |
| 3349 | - * @param array $args Arguments passed to the method, before filling the defaults. | |
| 3350 | - */ | |
| 3351 | - return apply_filters( 'frm_images_dropdown_args', $new_args, $args ); | |
| 3352 | - } | |
| 3353 | - | |
| 3354 | - /** | |
| 3355 | - * Gets HTML attributes of the input in images_dropdown() method. | |
| 3356 | - * | |
| 3357 | - * @since 5.0.04 | |
| 3358 | - * | |
| 3359 | - * @param array $args The arguments. | |
| 3360 | - * @return string | |
| 3361 | - */ | |
| 3362 | - private static function get_images_dropdown_input_attrs( $args ) { | |
| 3363 | - $input_attrs = $args['input_attrs']; | |
| 3364 | - $input_attrs['type'] = 'radio'; | |
| 3365 | - $input_attrs['name'] = $args['name']; | |
| 3366 | - | |
| 3367 | - $input_attrs_str = ''; | |
| 3368 | - foreach ( $input_attrs as $key => $input_attr ) { | |
| 3369 | - $input_attrs_str .= ' ' . sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $input_attr ) ); | |
| 2715 | + if ( ! FrmAddonsController::is_license_expired() ) { | |
| 2716 | + return; | |
| 3370 | 2717 | } |
| 3371 | 2718 | |
| 3372 | - /** | |
| 3373 | - * Allows modifying the HTML attributes of the input in images_dropdown() method. | |
| 3374 | - * | |
| 3375 | - * @since 5.0.04 | |
| 3376 | - * | |
| 3377 | - * @param string $input_attrs_str HTML attributes string. | |
| 3378 | - * @param array $args The arguments of images_dropdown() method. | |
| 3379 | - */ | |
| 3380 | - return apply_filters( 'frm_images_dropdown_input_attrs', $input_attrs_str, $args ); | |
| 2719 | + ?> | |
| 2720 | + <div class="frm_error_style" style="text-align:left"> | |
| 2721 | + <?php self::icon_by_class( 'frmfont frm_alert_icon' ); ?> | |
| 2722 | + | |
| 2723 | + <?php esc_html_e( 'Your account has expired', 'formidable' ); ?> | |
| 2724 | + <div style="float:right"> | |
| 2725 | + <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>"> | |
| 2726 | + <?php esc_html_e( 'Renew Now', 'formidable' ); ?> | |
| 2727 | + </a> | |
| 2728 | + </div> | |
| 2729 | + </div> | |
| 2730 | + <?php | |
| 3381 | 2731 | } |
| 3382 | 2732 | |
| 3383 | 2733 | /** |
| 3384 | - * Gets the image of each option in images_dropdown() method. | |
| 3385 | - * | |
| 3386 | - * @since 5.0.04 | |
| 3387 | - * | |
| 3388 | - * @param array $option Option data. | |
| 3389 | - * @param array $args The arguments of images_dropdown() method. | |
| 3390 | - * @return string | |
| 2734 | + * @since 4.08 | |
| 2735 | + * @deprecated 4.09.01 | |
| 3391 | 2736 | */ |
| 3392 | - private static function get_images_dropdown_option_image( $option, $args ) { | |
| 3393 | - $image = self::icon_by_class( | |
| 3394 | - 'frmfont ' . $option['svg'], | |
| 3395 | - array( | |
| 3396 | - 'echo' => false, | |
| 3397 | - ) | |
| 3398 | - ); | |
| 3399 | - | |
| 3400 | - $args['option'] = $option; | |
| 3401 | - | |
| 3402 | - /** | |
| 3403 | - * Allows modifying the image of each option in images_dropdown() method. | |
| 3404 | - * | |
| 3405 | - * @since 5.0.04 | |
| 3406 | - * | |
| 3407 | - * @param string $image The image HTML. | |
| 3408 | - * @param array $args The arguments of images_dropdown() method, with `option` array is added. | |
| 3409 | - */ | |
| 3410 | - return apply_filters( 'frm_images_dropdown_option_image', $image, $args ); | |
| 3411 | - } | |
| 3412 | - | |
| 3413 | - /** | |
| 3414 | - * Gets the HTML classes of each option in images_dropdown() method. | |
| 3415 | - * | |
| 3416 | - * @since 5.0.04 | |
| 3417 | - * | |
| 3418 | - * @param array $option Option data. | |
| 3419 | - * @param array $args The arguments of images_dropdown() method. | |
| 3420 | - * @return string | |
| 3421 | - */ | |
| 3422 | - private static function get_images_dropdown_option_classes( $option, $args ) { | |
| 3423 | - $classes = ''; | |
| 3424 | - | |
| 3425 | - if ( ! empty( $option['custom_attrs']['class'] ) ) { | |
| 3426 | - $classes .= ' ' . $option['custom_attrs']['class']; | |
| 2737 | + public static function expiring_message() { | |
| 2738 | + _deprecated_function( __METHOD__, '4.09.01', 'FrmProAddonsController::expiring_message' ); | |
| 2739 | + if ( is_callable( 'FrmProAddonsController::expiring_message' ) ) { | |
| 2740 | + FrmProAddonsController::expiring_message(); | |
| 3427 | 2741 | } |
| 3428 | - | |
| 3429 | - $args['option'] = $option; | |
| 3430 | - | |
| 3431 | - /** | |
| 3432 | - * Allows modifying the CSS classes of each option in images_dropdown() method. | |
| 3433 | - * | |
| 3434 | - * @since 5.0.04 | |
| 3435 | - * | |
| 3436 | - * @param string $classes CSS classes. | |
| 3437 | - * @param array $args The arguments of images_dropdown() method, with `option` array is added. | |
| 3438 | - */ | |
| 3439 | - return apply_filters( 'frm_images_dropdown_option_classes', $classes, $args ); | |
| 3440 | 2742 | } |
| 3441 | 2743 | |
| 3442 | 2744 | /** |
| 3443 | - * Gets the custom HTML attributes of each option in images_dropdown() method. | |
| 2745 | + * Use the WP 4.7 wp_doing_ajax function | |
| 3444 | 2746 | * |
| 3445 | - * @since 5.0.04 | |
| 3446 | - * | |
| 3447 | - * @param array $option Option data. | |
| 3448 | - * @param array $args The arguments of images_dropdown() method. | |
| 3449 | - * @return string | |
| 2747 | + * @since 2.05.07 | |
| 2748 | + * @deprecated 4.04.04 | |
| 3450 | 2749 | */ |
| 3451 | - private static function get_images_dropdown_option_html_attrs( $option, $args ) { | |
| 3452 | - $html_attrs = ''; | |
| 3453 | - if ( ! empty( $option['custom_attrs'] ) && is_array( $option['custom_attrs'] ) ) { | |
| 3454 | - $html_attrs_arr = array(); | |
| 3455 | - | |
| 3456 | - foreach ( $option['custom_attrs'] as $key => $value ) { | |
| 3457 | - if ( in_array( $key, array( 'type', 'class', 'data-value' ) ) ) { | |
| 3458 | - continue; | |
| 3459 | - } | |
| 3460 | - | |
| 3461 | - $html_attrs_arr[] = sprintf( '%s="%s"', esc_attr( $key ), esc_attr( $value ) ); | |
| 3462 | - } | |
| 3463 | - | |
| 3464 | - $html_attrs = implode( ' ', $html_attrs_arr ); | |
| 3465 | - } | |
| 3466 | - | |
| 3467 | - $args['option'] = $option; | |
| 3468 | - | |
| 3469 | - /** | |
| 3470 | - * Allows modifying the custom HTML attributes of each option in images_dropdown() method. | |
| 3471 | - * | |
| 3472 | - * @since 5.0.04 | |
| 3473 | - * | |
| 3474 | - * @param string $html_attrs The HTML attributes string. | |
| 3475 | - * @param array $args The arguments of images_dropdown() method, with `option` array is added. | |
| 3476 | - */ | |
| 3477 | - return apply_filters( 'frm_images_dropdown_option_html_attrs', $html_attrs, $args ); | |
| 2750 | + public static function wp_doing_ajax() { | |
| 2751 | + _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' ); | |
| 2752 | + return wp_doing_ajax(); | |
| 3478 | 2753 | } |
| 3479 | 2754 | |
| 3480 | 2755 | /** |
| 3481 | - * @since 5.0.07 | |
| 3482 | - * | |
| 3483 | - * @return bool true if the current user is allowed to save unfiltered HTML. | |
| 2756 | + * @deprecated 4.0 | |
| 3484 | 2757 | */ |
| 3485 | - public static function allow_unfiltered_html() { | |
| 3486 | - if ( self::should_never_allow_unfiltered_html() ) { | |
| 3487 | - return false; | |
| 3488 | - } | |
| 3489 | - return current_user_can( 'unfiltered_html' ); | |
| 2758 | + public static function insert_opt_html( $args ) { | |
| 2759 | + _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' ); | |
| 2760 | + FrmFormsHelper::insert_opt_html( $args ); | |
| 3490 | 2761 | } |
| 3491 | 2762 | |
| 3492 | 2763 | /** |
| 3493 | - * @since 5.0.13 | |
| 2764 | + * Used to filter shortcode in text widgets | |
| 3494 | 2765 | * |
| 3495 | - * @return bool | |
| 2766 | + * @deprecated 2.5.4 | |
| 2767 | + * @codeCoverageIgnore | |
| 3496 | 2768 | */ |
| 3497 | - public static function should_never_allow_unfiltered_html() { | |
| 3498 | - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) { | |
| 3499 | - return true; | |
| 3500 | - } | |
| 3501 | - | |
| 3502 | - /** | |
| 3503 | - * Formidable will check DISALLOW_UNFILTERED_HTML to determine if some form HTML should be filtered or not. | |
| 3504 | - * In many cases, scripts are added intentionally to forms and will not be stripped if DISALLOW_UNFILTERED_HTML is not set. | |
| 3505 | - * It is also possible to filter Formidable without defining DISALLOW_UNFILTERED_HTML, with add_filter( 'frm_disallow_unfiltered_html', '__return_true' ); | |
| 3506 | - * | |
| 3507 | - * @since 5.0.13 | |
| 3508 | - */ | |
| 3509 | - return apply_filters( 'frm_disallow_unfiltered_html', false ); | |
| 2769 | + public static function widget_text_filter_callback( $matches ) { | |
| 2770 | + return FrmDeprecated::widget_text_filter_callback( $matches ); | |
| 3510 | 2771 | } |
| 3511 | 2772 | |
| 3512 | 2773 | /** |
| 3513 | - * @since 5.0.07 | |
| 3514 | - * | |
| 3515 | - * @param array $values | |
| 3516 | - * @param array $keys | |
| 3517 | - * @return array | |
| 2774 | + * @deprecated 3.01 | |
| 2775 | + * @codeCoverageIgnore | |
| 3518 | 2776 | */ |
| 3519 | - public static function maybe_filter_array( $values, $keys ) { | |
| 3520 | - $allow_unfiltered_html = self::allow_unfiltered_html(); | |
| 3521 | - | |
| 3522 | - if ( $allow_unfiltered_html ) { | |
| 3523 | - return $values; | |
| 3524 | - } | |
| 3525 | - | |
| 3526 | - foreach ( $keys as $key ) { | |
| 3527 | - if ( isset( $values[ $key ] ) ) { | |
| 3528 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); | |
| 3529 | - } | |
| 3530 | - } | |
| 3531 | - | |
| 3532 | - return $values; | |
| 2777 | + public static function sanitize_array( &$values ) { | |
| 2778 | + FrmDeprecated::sanitize_array( $values ); | |
| 3533 | 2779 | } |
| 3534 | 2780 | |
| 3535 | 2781 | /** |
| 3536 | - * Some back end fields allow privleged users to add scripts. | |
| 3537 | - * A site that uses the DISALLOW_UNFILTERED_HTML always remove scripts on echo. | |
| 2782 | + * @param array $settings | |
| 2783 | + * @param string $group | |
| 3538 | 2784 | * |
| 3539 | - * @since 5.0.13 | |
| 3540 | - * | |
| 3541 | - * @param string $value | |
| 3542 | - * @param array|string $allowed 'all' for everything included as defaults | |
| 3543 | - * @return string | |
| 2785 | + * @since 2.0.6 | |
| 2786 | + * @deprecated 2.05.06 | |
| 2787 | + * @codeCoverageIgnore | |
| 3544 | 2788 | */ |
| 3545 | - public static function maybe_kses( $value, $allowed = 'all' ) { | |
| 3546 | - if ( self::should_never_allow_unfiltered_html() ) { | |
| 3547 | - $value = self::kses( $value, $allowed ); | |
| 3548 | - } | |
| 3549 | - return $value; | |
| 2789 | + public static function save_settings( $settings, $group ) { | |
| 2790 | + return FrmDeprecated::save_settings( $settings, $group ); | |
| 3550 | 2791 | } |
| 3551 | 2792 | |
| 3552 | 2793 | /** |
| 3553 | - * @since 5.0.16 | |
| 3554 | - * | |
| 3555 | - * @return bool | |
| 2794 | + * @since 2.0.4 | |
| 2795 | + * @deprecated 2.05.06 | |
| 2796 | + * @codeCoverageIgnore | |
| 3556 | 2797 | */ |
| 3557 | - public static function show_landing_pages() { | |
| 3558 | - return self::show_new_feature( 'landing' ); | |
| 2798 | + public static function save_json_post( $settings ) { | |
| 2799 | + return FrmDeprecated::save_json_post( $settings ); | |
| 3559 | 2800 | } |
| 3560 | 2801 | |
| 3561 | 2802 | /** |
| 3562 | - * @since 5.0.16 | |
| 2803 | + * @since 2.0 | |
| 2804 | + * @deprecated 2.05.06 | |
| 2805 | + * @codeCoverageIgnore | |
| 3563 | 2806 | * |
| 3564 | - * @return array | |
| 3565 | - */ | |
| 3566 | - public static function get_landing_page_upgrade_data_params( $medium = 'landing' ) { | |
| 3567 | - $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', | |
| 3572 | - ); | |
| 3573 | - return self::get_upgrade_data_params( 'landing', $params ); | |
| 3574 | - } | |
| 3575 | - | |
| 3576 | - /** | |
| 3577 | - * @since 5.0.17 | |
| 2807 | + * @param string $cache_key The unique name for this cache | |
| 2808 | + * @param string $group The name of the cache group | |
| 2809 | + * @param string $query If blank, don't run a db call | |
| 2810 | + * @param string $type The wpdb function to use with this query | |
| 3578 | 2811 | * |
| 3579 | - * @param string $plugin | |
| 3580 | - * @return string|false | |
| 2812 | + * @return mixed $results The cache or query results | |
| 3581 | 2813 | */ |
| 3582 | - private static function get_plan_required( $plugin ) { | |
| 3583 | - $link = FrmAddonsController::install_link( $plugin ); | |
| 3584 | - return FrmFormsHelper::get_plan_required( $link ); | |
| 2814 | + public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) { | |
| 2815 | + return FrmDeprecated::check_cache( $cache_key, $group, $query, $type, $time ); | |
| 3585 | 2816 | } |
| 3586 | 2817 | |
| 3587 | 2818 | /** |
| 3588 | - * @since 5.0.17 | |
| 3589 | - * | |
| 3590 | - * @param string | |
| 3591 | - * @return bool | |
| 2819 | + * @deprecated 2.05.06 | |
| 2820 | + * @codeCoverageIgnore | |
| 3592 | 2821 | */ |
| 3593 | - public static function show_new_feature( $feature ) { | |
| 3594 | - $link = FrmAddonsController::install_link( $feature ); | |
| 3595 | - return array_key_exists( 'status', $link ) || array_key_exists( 'class', $link ); | |
| 2822 | + public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) { | |
| 2823 | + return FrmDeprecated::set_cache( $cache_key, $results, $group, $time ); | |
| 3596 | 2824 | } |
| 3597 | 2825 | |
| 3598 | 2826 | /** |
| 3599 | - * @since 5.0.17 | |
| 3600 | - * | |
| 3601 | - * @param string $plugin | |
| 3602 | - * @param array $params | |
| 3603 | - * @return array | |
| 2827 | + * @deprecated 2.05.06 | |
| 2828 | + * @codeCoverageIgnore | |
| 3604 | 2829 | */ |
| 3605 | - public static function get_upgrade_data_params( $plugin, $params ) { | |
| 3606 | - $link = FrmAddonsController::install_link( $plugin ); | |
| 3607 | - if ( ! $link ) { | |
| 3608 | - return $params; | |
| 3609 | - } | |
| 3610 | - | |
| 3611 | - if ( ! empty( $link['url'] ) && self::pro_is_installed() ) { | |
| 3612 | - $params['oneclick'] = json_encode( $link ); | |
| 3613 | - unset( $params['message'] ); | |
| 3614 | - if ( ! isset( $params['medium'] ) ) { | |
| 3615 | - $params['medium'] = $plugin; | |
| 3616 | - } | |
| 3617 | - } else { | |
| 3618 | - $params['requires'] = FrmFormsHelper::get_plan_required( $link ); | |
| 3619 | - } | |
| 3620 | - | |
| 3621 | - return $params; | |
| 2830 | + public static function add_key_to_group_cache( $key, $group ) { | |
| 2831 | + FrmDeprecated::add_key_to_group_cache( $key, $group ); | |
| 3622 | 2832 | } |
| 3623 | 2833 | |
| 3624 | 2834 | /** |
| 3625 | - * Returns true if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f], false otherwise. | |
| 3626 | - * Not every server installs the ctype extension, so use a fallback if the function does not exist. | |
| 3627 | - * | |
| 3628 | - * @since 5.0.17 | |
| 3629 | - * | |
| 3630 | - * @param string $text | |
| 3631 | - * @return bool | |
| 2835 | + * @deprecated 2.05.06 | |
| 2836 | + * @codeCoverageIgnore | |
| 3632 | 2837 | */ |
| 3633 | - public static function ctype_xdigit( $text ) { | |
| 3634 | - if ( function_exists( 'ctype_xdigit' ) ) { | |
| 3635 | - return ctype_xdigit( $text ); | |
| 3636 | - } | |
| 3637 | - return is_string( $text ) && '' !== $text && ! preg_match( '/[^A-Fa-f0-9]/', $text ); | |
| 2838 | + public static function get_group_cached_keys( $group ) { | |
| 2839 | + return FrmDeprecated::get_group_cached_keys( $group ); | |
| 3638 | 2840 | } |
| 3639 | 2841 | |
| 3640 | 2842 | /** |
| 3641 | - * Set the current screen to avoid undefined notices. | |
| 3642 | - * | |
| 3643 | - * @since 5.2.01 | |
| 2843 | + * @since 2.0 | |
| 2844 | + * @deprecated 2.05.06 | |
| 2845 | + * @codeCoverageIgnore | |
| 2846 | + * @return mixed The cached value or false | |
| 3644 | 2847 | */ |
| 3645 | - public static function set_current_screen_and_hook_suffix() { | |
| 3646 | - global $hook_suffix; | |
| 3647 | - if ( is_null( $hook_suffix ) ) { | |
| 3648 | - // $hook_suffix gets used in substr so make sure it's not null. PHP 8.1 deprecates null in substr. | |
| 3649 | - $hook_suffix = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited | |
| 3650 | - } | |
| 3651 | - set_current_screen(); | |
| 2848 | + public static function check_cache_and_transient( $cache_key ) { | |
| 2849 | + return FrmDeprecated::check_cache( $cache_key ); | |
| 3652 | 2850 | } |
| 3653 | 2851 | |
| 3654 | 2852 | /** |
| 3655 | - * Shows pill text. | |
| 2853 | + * @since 2.0 | |
| 2854 | + * @deprecated 2.05.06 | |
| 2855 | + * @codeCoverageIgnore | |
| 3656 | 2856 | * |
| 3657 | - * @since 5.2.02 | |
| 3658 | - * | |
| 3659 | - * @param string $text Text in the pill. Default is NEW. | |
| 2857 | + * @param string $cache_key | |
| 3660 | 2858 | */ |
| 3661 | - public static function show_pill_text( $text = null ) { | |
| 3662 | - if ( null === $text ) { | |
| 3663 | - $text = __( 'NEW', 'formidable' ); | |
| 3664 | - } | |
| 3665 | - echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>'; | |
| 2859 | + public static function delete_cache_and_transient( $cache_key, $group = 'default' ) { | |
| 2860 | + FrmDeprecated::delete_cache_and_transient( $cache_key, $group ); | |
| 3666 | 2861 | } |
| 3667 | 2862 | |
| 3668 | 2863 | /** |
| 3669 | - * Count the number of decimals digits. | |
| 2864 | + * @since 2.0 | |
| 2865 | + * @deprecated 2.05.06 | |
| 2866 | + * @codeCoverageIgnore | |
| 3670 | 2867 | * |
| 3671 | - * @since 5.2.07 | |
| 3672 | - * | |
| 3673 | - * @param mixed $num Number. | |
| 3674 | - * @return int|false Returns `false` if the passed parameter is not number. | |
| 2868 | + * @param string $group The name of the cache group | |
| 3675 | 2869 | */ |
| 3676 | - public static function count_decimals( $num ) { | |
| 3677 | - if ( ! is_numeric( $num ) ) { | |
| 3678 | - return false; | |
| 3679 | - } | |
| 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 ] ); | |
| 2870 | + public static function cache_delete_group( $group ) { | |
| 2871 | + FrmDeprecated::cache_delete_group( $group ); | |
| 3688 | 2872 | } |
| 3689 | 2873 | |
| 3690 | 2874 | /** |
| 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. | |
| 2875 | + * @since 1.07.10 | |
| 2876 | + * @deprecated 2.05.06 | |
| 2877 | + * @codeCoverageIgnore | |
| 3694 | 2878 | * |
| 3695 | - * @since 5.3.1 | |
| 2879 | + * @param string $term The value to escape | |
| 3696 | 2880 | * |
| 3697 | - * @return void | |
| 2881 | + * @return string The escaped value | |
| 3698 | 2882 | */ |
| 3699 | - public static function filter_gmt_offset() { | |
| 3700 | - if ( self::$added_gmt_offset_filter ) { | |
| 3701 | - // Avoid adding twice. | |
| 3702 | - return; | |
| 3703 | - } | |
| 3704 | - | |
| 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; | |
| 2883 | + public static function esc_like( $term ) { | |
| 2884 | + return FrmDeprecated::esc_like( $term ); | |
| 3717 | 2885 | } |
| 3718 | 2886 | |
| 3719 | 2887 | /** |
| 3720 | - * @since 5.3.1 | |
| 2888 | + * @param string $order_query | |
| 3721 | 2889 | * |
| 3722 | - * @return bool | |
| 2890 | + * @deprecated 2.05.06 | |
| 2891 | + * @codeCoverageIgnore | |
| 3723 | 2892 | */ |
| 3724 | - public static function on_form_listing_page() { | |
| 3725 | - if ( ! self::is_admin_page( 'formidable' ) ) { | |
| 3726 | - return false; | |
| 3727 | - } | |
| 3728 | - | |
| 3729 | - $action = self::simple_get( 'frm_action', 'sanitize_title' ); | |
| 3730 | - return ! $action || in_array( $action, self::get_form_listing_page_actions(), true ); | |
| 2893 | + public static function esc_order( $order_query ) { | |
| 2894 | + return FrmDeprecated::esc_order( $order_query ); | |
| 3731 | 2895 | } |
| 3732 | 2896 | |
| 3733 | 2897 | /** |
| 3734 | - * Get all actions that also display the forms list. | |
| 3735 | - * | |
| 3736 | - * @since 5.3.1 | |
| 3737 | - * | |
| 3738 | - * @return array<string> | |
| 2898 | + * @deprecated 2.05.06 | |
| 2899 | + * @codeCoverageIgnore | |
| 3739 | 2900 | */ |
| 3740 | - private static function get_form_listing_page_actions() { | |
| 3741 | - return array( 'list', 'trash', 'untrash', 'destroy' ); | |
| 2901 | + public static function esc_order_by( &$order_by ) { | |
| 2902 | + FrmDeprecated::esc_order_by( $order_by ); | |
| 3742 | 2903 | } |
| 3743 | 2904 | |
| 3744 | 2905 | /** |
| 3745 | - * Safely call get_plugins, importing the required files if they are not yet loaded. | |
| 2906 | + * @param string $limit | |
| 3746 | 2907 | * |
| 3747 | - * @since 5.5 | |
| 3748 | - * | |
| 3749 | - * @return array | |
| 3750 | - */ | |
| 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(); | |
| 3756 | - } | |
| 3757 | - | |
| 3758 | - /** | |
| 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. | |
| 3761 | - * | |
| 3762 | - * @since 5.5.5 | |
| 3763 | - * | |
| 3764 | - * @param string $url | |
| 3765 | - * @param string $expected_extension | |
| 3766 | - * @return bool | |
| 3767 | - */ | |
| 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; | |
| 3788 | - } | |
| 3789 | - | |
| 3790 | - /** | |
| 3791 | - * @since 4.08 | |
| 3792 | - * @deprecated 4.09.01 | |
| 3793 | - */ | |
| 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 | - } | |
| 3799 | - } | |
| 3800 | - | |
| 3801 | - /** | |
| 3802 | - * Use the WP 4.7 wp_doing_ajax function | |
| 3803 | - * | |
| 3804 | - * @since 2.05.07 | |
| 3805 | - * @deprecated 4.04.04 | |
| 3806 | - */ | |
| 3807 | - public static function wp_doing_ajax() { | |
| 3808 | - _deprecated_function( __METHOD__, '4.04.04', 'wp_doing_ajax' ); | |
| 3809 | - return wp_doing_ajax(); | |
| 3810 | - } | |
| 3811 | - | |
| 3812 | - /** | |
| 3813 | - * @deprecated 4.0 | |
| 3814 | - */ | |
| 3815 | - public static function insert_opt_html( $args ) { | |
| 3816 | - _deprecated_function( __METHOD__, '4.0', 'FrmFormsHelper::insert_opt_html' ); | |
| 3817 | - FrmFormsHelper::insert_opt_html( $args ); | |
| 3818 | - } | |
| 3819 | - | |
| 3820 | - /** | |
| 3821 | - * @deprecated 3.01 | |
| 2908 | + * @deprecated 2.05.06 | |
| 3822 | 2909 | * @codeCoverageIgnore |
| 3823 | 2910 | */ |
| 3824 | - public static function sanitize_array( &$values ) { | |
| 3825 | - FrmDeprecated::sanitize_array( $values ); | |
| 2911 | + public static function esc_limit( $limit ) { | |
| 2912 | + return FrmDeprecated::esc_limit( $limit ); | |
| 3826 | 2913 | } |
| 3827 | 2914 | |
| 3828 | 2915 | /** |
| 3829 | 2916 | * @since 2.0 |
| 3830 | - * @deprecated 5.0.13 | |
| 3831 | - * | |
| 3832 | - * @return string The base Google APIS url for the current version of jQuery UI | |
| 2917 | + * @deprecated 2.05.06 | |
| 2918 | + * @codeCoverageIgnore | |
| 3833 | 2919 | */ |
| 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() : ''; | |
| 2920 | + public static function prepare_array_values( $array, $type = '%s' ) { | |
| 2921 | + return FrmDeprecated::prepare_array_values( $array, $type ); | |
| 3837 | 2922 | } |
| 3838 | 2923 | |
| 3839 | 2924 | /** |
| 3840 | - * @since 4.07 | |
| 3841 | - * @deprecated 6.0 | |
| 2925 | + * @deprecated 2.05.06 | |
| 2926 | + * @codeCoverageIgnore | |
| 3842 | 2927 | */ |
| 3843 | - public static function renewal_message() { | |
| 3844 | - _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' ); | |
| 3845 | - } | |
| 3846 | - | |
| 3847 | - /** | |
| 3848 | - * Display a dismissable warning message and save its dismissal state. | |
| 3849 | - * | |
| 3850 | - * @since 6.3 | |
| 3851 | - * | |
| 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 | |
| 3855 | - */ | |
| 3856 | - public static function add_dismissable_warning_message( $message = '', $option = '' ) { | |
| 3857 | - if ( ! $message || ! $option ) { | |
| 3858 | - return; | |
| 3859 | - } | |
| 3860 | - | |
| 3861 | - $ajax_callback = function() use ( $option ) { | |
| 3862 | - self::dismiss_warning_message( $option ); | |
| 3863 | - }; | |
| 3864 | - | |
| 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 ); | |
| 3868 | - | |
| 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 | - } | |
| 3875 | - | |
| 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 | - ); | |
| 3883 | - | |
| 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 | - ); | |
| 3890 | - } | |
| 3891 | - | |
| 3892 | - /** | |
| 3893 | - * Dismiss a warning message and update the dismissal state. | |
| 3894 | - * | |
| 3895 | - * @since 6.3 | |
| 3896 | - * | |
| 3897 | - * @param string $option The unique identifier for the dismissal state of the message. | |
| 3898 | - * @return void | |
| 3899 | - */ | |
| 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(); | |
| 2928 | + public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) { | |
| 2929 | + return FrmDeprecated::prepend_and_or_where( $starts_with, $where ); | |
| 3909 | 2930 | } |
| 3910 | 2931 | } |