| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @since 2.0 |
| 18 | 18 | */ |
| 19 | - public static $plug_version = '6.5.1'; | |
| 19 | + public static $plug_version = '6.2.3'; | |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @since 1.07.02 |
| 23 | 23 | * |
| @@ -148,28 +148,12 @@ | ||
| 148 | 148 | |
| 149 | 149 | public static function get_menu_name() { |
| 150 | 150 | $frm_settings = self::get_settings(); |
| 151 | 151 | |
| 152 | - return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu; | |
| 152 | + return $frm_settings->menu; | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * Determine if the current branding is set to 'formidable'. | |
| 157 | - * | |
| 158 | - * Checks the menu title, retrieved through get_menu_name, | |
| 159 | - * and verifies if it matches the 'formidable' branding. | |
| 160 | - * | |
| 161 | - * @since 6.4.2 | |
| 162 | - * | |
| 163 | - * @return bool True if the menu title is 'formidable', false otherwise. | |
| 164 | - */ | |
| 165 | - public static function is_formidable_branding() { | |
| 166 | - $menu_title = self::get_menu_name(); | |
| 167 | - | |
| 168 | - return 'formidable' === strtolower( trim( $menu_title ) ); | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | 156 | * @since 3.05 |
| 173 | 157 | */ |
| 174 | 158 | public static function svg_logo( $atts = array() ) { |
| 175 | 159 | $defaults = array( |
| @@ -392,28 +376,8 @@ | ||
| 392 | 376 | return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
| 393 | 377 | } |
| 394 | 378 | |
| 395 | 379 | /** |
| 396 | - * Get the server OS | |
| 397 | - * | |
| 398 | - * @since 6.4.2 | |
| 399 | - * | |
| 400 | - * @return string | |
| 401 | - */ | |
| 402 | - public static function get_server_os() { | |
| 403 | - if ( function_exists( 'php_uname' ) ) { | |
| 404 | - return php_uname( 's' ); | |
| 405 | - } | |
| 406 | - | |
| 407 | - if ( ! defined( 'PHP_OS' ) ) { | |
| 408 | - return ''; | |
| 409 | - } | |
| 410 | - | |
| 411 | - // match the same response for Windows server as php_uname('s') | |
| 412 | - return in_array( PHP_OS, array( 'WIN32', 'WINNT', 'Windows_NT' ), true ) ? 'Windows NT' : PHP_OS; | |
| 413 | - } | |
| 414 | - | |
| 415 | - /** | |
| 416 | 380 | * Check for the IP address in several places (when custom headers are enabled). |
| 417 | 381 | * Used by [ip] shortcode. |
| 418 | 382 | * |
| 419 | 383 | * @return string The IP address of the current user |
| @@ -573,14 +537,14 @@ | ||
| 573 | 537 | ); |
| 574 | 538 | $args = wp_parse_args( $args, $defaults ); |
| 575 | 539 | |
| 576 | 540 | $value = $args['default']; |
| 577 | - if ( $args['type'] === 'get' ) { | |
| 541 | + if ( $args['type'] == 'get' ) { | |
| 578 | 542 | if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
| 579 | 543 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 580 | 544 | $value = wp_unslash( $_GET[ $args['param'] ] ); |
| 581 | 545 | } |
| 582 | - } elseif ( $args['type'] === 'post' ) { | |
| 546 | + } elseif ( $args['type'] == 'post' ) { | |
| 583 | 547 | if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 584 | 548 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 585 | 549 | $value = wp_unslash( $_POST[ $args['param'] ] ); |
| 586 | 550 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| @@ -1321,14 +1285,11 @@ | ||
| 1321 | 1285 | } |
| 1322 | 1286 | } |
| 1323 | 1287 | |
| 1324 | 1288 | /** |
| 1325 | - * Save all front-end js scripts into a single file. | |
| 1326 | - * And save an additional single file of all front-end Stripe JS scripts. | |
| 1289 | + * Save all front-end js scripts into a single file | |
| 1327 | 1290 | * |
| 1328 | 1291 | * @since 3.0 |
| 1329 | - * | |
| 1330 | - * @return void | |
| 1331 | 1292 | */ |
| 1332 | 1293 | public static function save_combined_js() { |
| 1333 | 1294 | $file_atts = apply_filters( |
| 1334 | 1295 | 'frm_js_location', |
| @@ -1341,34 +1302,10 @@ | ||
| 1341 | 1302 | |
| 1342 | 1303 | $files = array( |
| 1343 | 1304 | self::plugin_path() . '/js/formidable.min.js', |
| 1344 | 1305 | ); |
| 1345 | - /** | |
| 1346 | - * @param array $files | |
| 1347 | - */ | |
| 1348 | 1306 | $files = apply_filters( 'frm_combined_js_files', $files ); |
| 1349 | 1307 | $new_file->combine_files( $files ); |
| 1350 | - | |
| 1351 | - // Create the minified Stripe Script. | |
| 1352 | - $file_atts = apply_filters( | |
| 1353 | - 'frm_stripe_js_location', | |
| 1354 | - array( | |
| 1355 | - 'file_name' => 'frmstrp.min.js', | |
| 1356 | - 'new_file_path' => self::plugin_path() . '/js', | |
| 1357 | - ) | |
| 1358 | - ); | |
| 1359 | - $new_file = new FrmCreateFile( $file_atts ); | |
| 1360 | - $files = array( | |
| 1361 | - FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js', | |
| 1362 | - ); | |
| 1363 | - | |
| 1364 | - /** | |
| 1365 | - * @since 6.5 | |
| 1366 | - * | |
| 1367 | - * @param array $files | |
| 1368 | - */ | |
| 1369 | - $files = apply_filters( 'frm_stripe_combined_js_files', $files ); | |
| 1370 | - $new_file->combine_files( $files ); | |
| 1371 | 1308 | } |
| 1372 | 1309 | |
| 1373 | 1310 | /** |
| 1374 | 1311 | * Check a value from a shortcode to see if true or false. |
| @@ -1901,9 +1838,9 @@ | ||
| 1901 | 1838 | foreach ( $array as $key => $value ) { |
| 1902 | 1839 | if ( is_array( $value ) ) { |
| 1903 | 1840 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 1904 | 1841 | } else { |
| 1905 | - if ( $keys === 'keep' ) { | |
| 1842 | + if ( $keys == 'keep' ) { | |
| 1906 | 1843 | $return[ $key ] = $value; |
| 1907 | 1844 | } else { |
| 1908 | 1845 | $return[] = $value; |
| 1909 | 1846 | } |
| @@ -1987,9 +1924,9 @@ | ||
| 1987 | 1924 | return $user_id; |
| 1988 | 1925 | } |
| 1989 | 1926 | |
| 1990 | 1927 | $user_id = sanitize_text_field( $user_id ); |
| 1991 | - if ( $user_id === 'current' ) { | |
| 1928 | + if ( $user_id == 'current' ) { | |
| 1992 | 1929 | $user_id = get_current_user_id(); |
| 1993 | 1930 | } else { |
| 1994 | 1931 | if ( is_email( $user_id ) ) { |
| 1995 | 1932 | $user = get_user_by( 'email', $user_id ); |
| @@ -2710,9 +2647,8 @@ | ||
| 2710 | 2647 | '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' ), |
| 2711 | 2648 | 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <john@example.com> or john@example.com.', 'formidable' ), |
| 2712 | 2649 | /* translators: %1$s: Form name, %2$s: Date */ |
| 2713 | 2650 | '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() ) ), |
| 2714 | - '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' ), | |
| 2715 | 2651 | ); |
| 2716 | 2652 | |
| 2717 | 2653 | if ( ! isset( $tooltips[ $name ] ) ) { |
| 2718 | 2654 | return; |
| @@ -3002,10 +2938,13 @@ | ||
| 3002 | 2938 | */ |
| 3003 | 2939 | public static function localize_script( $location ) { |
| 3004 | 2940 | global $wp_scripts; |
| 3005 | 2941 | |
| 2942 | + $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ); | |
| 2943 | + $ajax_url = apply_filters( 'frm_ajax_url', $ajax_url ); | |
| 2944 | + | |
| 3006 | 2945 | $script_strings = array( |
| 3007 | - 'ajax_url' => esc_url_raw( self::get_ajax_url() ), | |
| 2946 | + 'ajax_url' => $ajax_url, | |
| 3008 | 2947 | 'images_url' => self::plugin_url() . '/images', |
| 3009 | 2948 | 'loading' => __( 'Loading…', 'formidable' ), |
| 3010 | 2949 | 'remove' => __( 'Remove', 'formidable' ), |
| 3011 | 2950 | 'offset' => apply_filters( 'frm_scroll_offset', 4 ), |
| @@ -3019,72 +2958,69 @@ | ||
| 3019 | 2958 | 'include_alert_role' => self::should_include_alert_role_on_field_errors(), |
| 3020 | 2959 | ); |
| 3021 | 2960 | |
| 3022 | 2961 | $data = $wp_scripts->get_data( 'formidable', 'data' ); |
| 3023 | - if ( ! $data ) { | |
| 2962 | + if ( empty( $data ) ) { | |
| 3024 | 2963 | wp_localize_script( 'formidable', 'frm_js', $script_strings ); |
| 3025 | 2964 | } |
| 3026 | 2965 | |
| 3027 | - if ( $location === 'admin' ) { | |
| 2966 | + if ( $location == 'admin' ) { | |
| 3028 | 2967 | $frm_settings = self::get_settings(); |
| 3029 | 2968 | $admin_script_strings = array( |
| 3030 | - 'desc' => __( '(Click to add description)', 'formidable' ), | |
| 3031 | - 'blank' => __( '(Blank)', 'formidable' ), | |
| 3032 | - 'no_label' => __( '(no label)', 'formidable' ), | |
| 3033 | - 'ok' => __( 'OK', 'formidable' ), | |
| 3034 | - 'cancel' => __( 'Cancel', 'formidable' ), | |
| 3035 | - 'default_label' => __( 'Default', 'formidable' ), | |
| 3036 | - 'clear_default' => __( 'Clear default value when typing', 'formidable' ), | |
| 3037 | - 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ), | |
| 3038 | - 'valid_default' => __( 'Default value will pass form validation', 'formidable' ), | |
| 3039 | - 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ), | |
| 3040 | - 'confirm' => __( 'Are you sure?', 'formidable' ), | |
| 3041 | - 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ), | |
| 3042 | - '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' ), | |
| 3043 | - 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ), | |
| 3044 | - 'default_unique' => $frm_settings->unique_msg, | |
| 3045 | - 'default_conf' => __( 'The entered values do not match', 'formidable' ), | |
| 3046 | - 'enter_email' => __( 'Enter Email', 'formidable' ), | |
| 3047 | - 'confirm_email' => __( 'Confirm Email', 'formidable' ), | |
| 3048 | - 'conditional_text' => __( 'Conditional content here', 'formidable' ), | |
| 3049 | - 'new_option' => __( 'New Option', 'formidable' ), | |
| 3050 | - 'css_invalid_size' => __( 'In certain browsers (e.g. Firefox) text will not display correctly if the field height is too small relative to the field padding and text size. Please increase your field height or decrease your field padding.', 'formidable' ), | |
| 3051 | - 'enter_password' => __( 'Enter Password', 'formidable' ), | |
| 3052 | - 'confirm_password' => __( 'Confirm Password', 'formidable' ), | |
| 3053 | - 'import_complete' => __( 'Import Complete', 'formidable' ), | |
| 3054 | - 'updating' => __( 'Please wait while your site updates.', 'formidable' ), | |
| 3055 | - 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ), | |
| 3056 | - 'private_label' => __( 'Private', 'formidable' ), | |
| 3057 | - 'jquery_ui_url' => '', | |
| 3058 | - 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '', | |
| 3059 | - 'no_licenses' => __( 'No new licenses were found', 'formidable' ), | |
| 3060 | - 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ), | |
| 3061 | - 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ), | |
| 3062 | - 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ), | |
| 3063 | - 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ), | |
| 3064 | - 'unsafe_params' => FrmFormsHelper::reserved_words(), | |
| 2969 | + 'desc' => __( '(Click to add description)', 'formidable' ), | |
| 2970 | + 'blank' => __( '(Blank)', 'formidable' ), | |
| 2971 | + 'no_label' => __( '(no label)', 'formidable' ), | |
| 2972 | + 'saving' => '', // Deprecated in 6.0. | |
| 2973 | + 'saved' => '', // Deprecated in 6.0. | |
| 2974 | + 'ok' => __( 'OK', 'formidable' ), | |
| 2975 | + 'cancel' => __( 'Cancel', 'formidable' ), | |
| 2976 | + 'default_label' => __( 'Default', 'formidable' ), | |
| 2977 | + 'clear_default' => __( 'Clear default value when typing', 'formidable' ), | |
| 2978 | + 'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ), | |
| 2979 | + 'valid_default' => __( 'Default value will pass form validation', 'formidable' ), | |
| 2980 | + 'no_valid_default' => __( 'Default value will NOT pass form validation', 'formidable' ), | |
| 2981 | + 'confirm' => __( 'Are you sure?', 'formidable' ), | |
| 2982 | + 'conf_delete' => __( 'Are you sure you want to delete this field and all data associated with it?', 'formidable' ), | |
| 2983 | + 'conf_delete_sec' => __( 'All fields inside this Section will be deleted along with their data. Are you sure you want to delete this group of fields?', 'formidable' ), | |
| 2984 | + 'conf_no_repeat' => __( 'Warning: If you have entries with multiple rows, all but the first row will be lost.', 'formidable' ), | |
| 2985 | + 'default_unique' => $frm_settings->unique_msg, | |
| 2986 | + 'default_conf' => __( 'The entered values do not match', 'formidable' ), | |
| 2987 | + 'enter_email' => __( 'Enter Email', 'formidable' ), | |
| 2988 | + 'confirm_email' => __( 'Confirm Email', 'formidable' ), | |
| 2989 | + 'conditional_text' => __( 'Conditional content here', 'formidable' ), | |
| 2990 | + 'new_option' => __( 'New Option', 'formidable' ), | |
| 2991 | + 'css_invalid_size' => __( 'In certain browsers (e.g. Firefox) text will not display correctly if the field height is too small relative to the field padding and text size. Please increase your field height or decrease your field padding.', 'formidable' ), | |
| 2992 | + 'enter_password' => __( 'Enter Password', 'formidable' ), | |
| 2993 | + 'confirm_password' => __( 'Confirm Password', 'formidable' ), | |
| 2994 | + 'import_complete' => __( 'Import Complete', 'formidable' ), | |
| 2995 | + 'updating' => __( 'Please wait while your site updates.', 'formidable' ), | |
| 2996 | + 'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ), | |
| 2997 | + 'private_label' => __( 'Private', 'formidable' ), | |
| 2998 | + 'jquery_ui_url' => '', | |
| 2999 | + 'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '', | |
| 3000 | + 'no_licenses' => __( 'No new licenses were found', 'formidable' ), | |
| 3001 | + 'unmatched_parens' => __( 'This calculation has at least one unmatched ( ) { } [ ].', 'formidable' ), | |
| 3002 | + 'view_shortcodes' => __( 'This calculation may have shortcodes that work in Views but not forms.', 'formidable' ), | |
| 3003 | + 'text_shortcodes' => __( 'This calculation may have shortcodes that work in text calculations but not numeric calculations.', 'formidable' ), | |
| 3004 | + 'only_one_action' => __( 'This form action is limited to one per form. Please edit the existing form action.', 'formidable' ), | |
| 3005 | + 'unsafe_params' => FrmFormsHelper::reserved_words(), | |
| 3065 | 3006 | /* Translators: %s is the name of a Detail Page Slug that is a reserved word.*/ |
| 3066 | - 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ), | |
| 3007 | + 'slug_is_reserved' => sprintf( __( 'The Detail Page Slug "%s" is reserved by WordPress. This may cause problems. Is this intentional?', 'formidable' ), '****' ), | |
| 3067 | 3008 | /* Translators: %s is the name of a parameter that is a reserved word. More than one word could be listed here, though that would not be common. */ |
| 3068 | - 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ), | |
| 3069 | - 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ), | |
| 3070 | - 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ), | |
| 3071 | - 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ), | |
| 3072 | - 'install' => __( 'Install', 'formidable' ), | |
| 3073 | - 'active' => __( 'Active', 'formidable' ), | |
| 3074 | - 'select_a_field' => __( 'Select a Field', 'formidable' ), | |
| 3075 | - 'no_items_found' => __( 'No items found.', 'formidable' ), | |
| 3009 | + 'param_is_reserved' => sprintf( __( 'The parameter "%s" is reserved by WordPress. This may cause problems when included in the URL. Is this intentional? ', 'formidable' ), '****' ), | |
| 3010 | + 'reserved_words' => __( 'See the list of reserved words in WordPress.', 'formidable' ), | |
| 3011 | + 'repeat_limit_min' => __( 'Please enter a Repeat Limit that is greater than 1.', 'formidable' ), | |
| 3012 | + 'checkbox_limit' => __( 'Please select a limit between 0 and 200.', 'formidable' ), | |
| 3013 | + 'install' => __( 'Install', 'formidable' ), | |
| 3014 | + 'active' => __( 'Active', 'formidable' ), | |
| 3015 | + 'select_a_field' => __( 'Select a Field', 'formidable' ), | |
| 3016 | + 'no_items_found' => __( 'No items found.', 'formidable' ), | |
| 3076 | 3017 | 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ), |
| 3077 | - 'saving' => '', // Deprecated in 6.0. | |
| 3078 | - 'saved' => '', // Deprecated in 6.0. | |
| 3079 | 3018 | ); |
| 3080 | - /** | |
| 3081 | - * @param array $admin_script_strings | |
| 3082 | - */ | |
| 3083 | 3019 | $admin_script_strings = apply_filters( 'frm_admin_script_strings', $admin_script_strings ); |
| 3084 | 3020 | |
| 3085 | 3021 | $data = $wp_scripts->get_data( 'formidable_admin', 'data' ); |
| 3086 | - if ( ! $data ) { | |
| 3022 | + if ( empty( $data ) ) { | |
| 3087 | 3023 | wp_localize_script( 'formidable_admin', 'frm_admin_js', $admin_script_strings ); |
| 3088 | 3024 | } |
| 3089 | 3025 | } |
| 3090 | 3026 | } |
| @@ -3089,24 +3025,8 @@ | ||
| 3089 | 3025 | } |
| 3090 | 3026 | } |
| 3091 | 3027 | |
| 3092 | 3028 | /** |
| 3093 | - * @since 6.5 | |
| 3094 | - * | |
| 3095 | - * @return string | |
| 3096 | - */ | |
| 3097 | - public static function get_ajax_url() { | |
| 3098 | - $ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ); | |
| 3099 | - | |
| 3100 | - /** | |
| 3101 | - * @since 2.0.13 | |
| 3102 | - * | |
| 3103 | - * @param string $ajax_url | |
| 3104 | - */ | |
| 3105 | - return apply_filters( 'frm_ajax_url', $ajax_url ); | |
| 3106 | - } | |
| 3107 | - | |
| 3108 | - /** | |
| 3109 | 3029 | * Returns whether or not the first errored input should be auto-focused (default true). |
| 3110 | 3030 | * |
| 3111 | 3031 | * @since 5.2.05 |
| 3112 | 3032 | * |
| @@ -3920,70 +3840,6 @@ | ||
| 3920 | 3840 | * @deprecated 6.0 |
| 3921 | 3841 | */ |
| 3922 | 3842 | public static function renewal_message() { |
| 3923 | 3843 | _deprecated_function( __METHOD__, '6.0', 'FrmProAddonsController::renewal_message' ); |
| 3924 | - } | |
| 3925 | - | |
| 3926 | - /** | |
| 3927 | - * Display a dismissable warning message and save its dismissal state. | |
| 3928 | - * | |
| 3929 | - * @since 6.3 | |
| 3930 | - * | |
| 3931 | - * @param string $message The warning message to display. | |
| 3932 | - * @param string $option The unique identifier for the dismissal state of the message and the WP Ajax action. | |
| 3933 | - * @return void | |
| 3934 | - */ | |
| 3935 | - public static function add_dismissable_warning_message( $message = '', $option = '' ) { | |
| 3936 | - if ( ! $message || ! $option ) { | |
| 3937 | - return; | |
| 3938 | - } | |
| 3939 | - | |
| 3940 | - $ajax_callback = function() use ( $option ) { | |
| 3941 | - self::dismiss_warning_message( $option ); | |
| 3942 | - }; | |
| 3943 | - | |
| 3944 | - // We're handling JS codes with `doJsonPost` and it adds 'frm_' to the beginning of the action. | |
| 3945 | - // To prevent any issues, we add 'frm_' from the beginning of the action. | |
| 3946 | - add_action( 'wp_ajax_frm_' . $option, $ajax_callback ); | |
| 3947 | - | |
| 3948 | - add_filter( | |
| 3949 | - 'frm_message_list', | |
| 3950 | - function( $show_messages ) use ( $message, $option ) { | |
| 3951 | - if ( get_option( $option, false ) ) { | |
| 3952 | - return $show_messages; | |
| 3953 | - } | |
| 3954 | - | |
| 3955 | - $dismiss_icon = self::icon_by_class( | |
| 3956 | - 'frmfont frm_close_icon', | |
| 3957 | - array( | |
| 3958 | - 'aria-label' => _x( 'Dismiss', 'warning message: close icon label', 'formidable' ), | |
| 3959 | - 'echo' => false, | |
| 3960 | - ) | |
| 3961 | - ); | |
| 3962 | - | |
| 3963 | - $show_messages[] = $message; | |
| 3964 | - $show_messages[] = '<span class="frm-warning-dismiss frmsvg" data-action="' . esc_attr( $option ) . '">' . $dismiss_icon . '</span>'; | |
| 3965 | - | |
| 3966 | - return $show_messages; | |
| 3967 | - } | |
| 3968 | - ); | |
| 3969 | - } | |
| 3970 | - | |
| 3971 | - /** | |
| 3972 | - * Dismiss a warning message and update the dismissal state. | |
| 3973 | - * | |
| 3974 | - * @since 6.3 | |
| 3975 | - * | |
| 3976 | - * @param string $option The unique identifier for the dismissal state of the message. | |
| 3977 | - * @return void | |
| 3978 | - */ | |
| 3979 | - public static function dismiss_warning_message( $option = '' ) { | |
| 3980 | - self::permission_check( 'frm_change_settings' ); | |
| 3981 | - check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 3982 | - | |
| 3983 | - if ( $option ) { | |
| 3984 | - update_option( $option, true, 'no' ); | |
| 3985 | - } | |
| 3986 | - | |
| 3987 | - wp_send_json_success(); | |
| 3988 | 3844 | } |
| 3989 | 3845 | } |