array( 'title' => __( 'Date Selection', 'booking' ), 'icon' => 'wpbc-bi-calendar3-week' ), 'form_validation' => array( 'title' => __( 'Form Validation', 'booking' ), 'icon' => 'wpbc-bi-ui-checks' ), 'time_validation' => array( 'title' => __( 'Time Validation', 'booking' ), 'icon' => 'wpbc-bi-clock' ), 'submission' => array( 'title' => __( 'Booking Submission', 'booking' ), 'icon' => 'wpbc-bi-send' ), 'booking_summaries' => array( 'title' => __( 'Booking Summaries', 'booking' ), 'icon' => 'wpbc-bi-card-text' ), 'captcha' => array( 'title' => __( 'CAPTCHA', 'booking' ), 'icon' => 'wpbc-bi-shield-check' ), ); } /** * Enqueue page assets. * * @param string $where_to_load Asset context. * @return void */ function wpbc_settings_messages_enqueue_css_files( $where_to_load ) { if ( ! in_array( $where_to_load, array( 'admin', 'both' ), true ) || ! wpbc_settings_messages__is_page() ) { return; } wp_enqueue_style( 'wpbc-settings-messages-page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_messages_page.css', array( 'wpbc-all-admin' ), WP_BK_VERSION_NUM ); } add_action( 'wpbc_enqueue_css_files', 'wpbc_settings_messages_enqueue_css_files', 68 ); /** * Enqueue page JavaScript. * * @param string $where_to_load Asset context. * @return void */ function wpbc_settings_messages_enqueue_js_files( $where_to_load ) { if ( ! in_array( $where_to_load, array( 'admin', 'both' ), true ) || ! wpbc_settings_messages__is_page() ) { return; } wp_enqueue_script( 'wpbc-settings-messages-page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_messages_page.js', array( 'jquery', 'wpbc_all_admin' ), WP_BK_VERSION_NUM, array( 'in_footer' => true ) ); wp_localize_script( 'wpbc-settings-messages-page', 'wpbc_settings_messages_page', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wpbc_settings_messages_ajax_nonce' ), 'action' => 'WPBC_AJX_SETTINGS_MESSAGES_SAVE', 'i18n' => array( 'saving' => __( 'Saving', 'booking' ), 'saved' => __( 'Form messages updated.', 'booking' ), 'save_failed' => __( 'Unable to save form messages.', 'booking' ), 'reset_confirm' => __( 'Restore every form message to its plugin default?', 'booking' ), ), ) ); } add_action( 'wpbc_enqueue_js_files', 'wpbc_settings_messages_enqueue_js_files', 68 ); /** * Compose and validate posted form-message settings. * * @param array $post_data Raw request data. * @return array|WP_Error */ function wpbc_settings_messages__validate_data( $post_data ) { $registry = wpbc_frontend_messages__get_registry(); $current_settings = wpbc_frontend_messages__get_settings(); $messages = ! empty( $current_settings['messages'] ) && is_array( $current_settings['messages'] ) ? $current_settings['messages'] : array(); $enabled = ! empty( $current_settings['enabled'] ) && is_array( $current_settings['enabled'] ) ? $current_settings['enabled'] : array(); $defaults = isset( $post_data['message_default'] ) && is_array( $post_data['message_default'] ) ? $post_data['message_default'] : array(); $translations = isset( $post_data['message_translations'] ) && is_array( $post_data['message_translations'] ) ? $post_data['message_translations'] : array(); $raw_messages = isset( $post_data['message_raw'] ) && is_array( $post_data['message_raw'] ) ? $post_data['message_raw'] : array(); $raw_modes = isset( $post_data['message_raw_mode'] ) && is_array( $post_data['message_raw_mode'] ) ? $post_data['message_raw_mode'] : array(); $enabled_post = isset( $post_data['message_enabled'] ) && is_array( $post_data['message_enabled'] ) ? $post_data['message_enabled'] : array(); foreach ( $registry as $message_key => $config ) { $is_message_posted = array_key_exists( $message_key, $defaults ) || array_key_exists( $message_key, $translations ) || array_key_exists( $message_key, $raw_messages ) || array_key_exists( $message_key, $raw_modes ); if ( ! $is_message_posted ) { continue; } if ( isset( $raw_modes[ $message_key ] ) && is_scalar( $raw_modes[ $message_key ] ) && '1' === (string) wp_unslash( $raw_modes[ $message_key ] ) ) { $raw_value = isset( $raw_messages[ $message_key ] ) ? $raw_messages[ $message_key ] : ''; } else { $default_text = isset( $defaults[ $message_key ] ) && is_scalar( $defaults[ $message_key ] ) ? trim( (string) $defaults[ $message_key ] ) : ''; $message_translations = isset( $translations[ $message_key ] ) && is_array( $translations[ $message_key ] ) ? $translations[ $message_key ] : array(); $translation_sections = array(); foreach ( $message_translations as $locale => $translation ) { $locale = sanitize_text_field( wp_unslash( (string) $locale ) ); if ( ! preg_match( '/^[A-Za-z0-9_@.\-]+$/', $locale ) || ! is_scalar( $translation ) ) { return new WP_Error( 'invalid_locale', __( 'A message contains an invalid locale.', 'booking' ) ); } $translation = trim( (string) $translation ); if ( '' !== $translation ) { $translation_sections[ $locale ] = $translation; } } $raw_value = $default_text; foreach ( $translation_sections as $locale => $translation ) { $raw_value .= "\n[lang=" . $locale . "]\n" . $translation; } } $validated = wpbc_frontend_messages__validate_value( $message_key, $raw_value ); if ( is_wp_error( $validated ) ) { return new WP_Error( $validated->get_error_code(), sprintf( '%1$s: %2$s', $config['title'], $validated->get_error_message() ) ); } if ( '' !== $validated && $validated !== $config['default'] ) { $messages[ $message_key ] = $validated; } else { unset( $messages[ $message_key ] ); } if ( ! empty( $config['optional'] ) ) { $enabled[ $message_key ] = isset( $enabled_post[ $message_key ] ) ? 'On' : 'Off'; } } return array( 'version' => 1, 'messages' => $messages, 'enabled' => $enabled ); } /** * Show the standard Save button in the settings top toolbar. * * @param string $page_tag Current page tag. * @param string $active_page_tab Current tab. * @param string $active_page_subtab Current subtab. * @return void */ function wpbc_settings_messages__top_toolbar_save_button( $page_tag, $active_page_tab, $active_page_subtab ) { if ( 'wpbc-settings' !== $page_tag || 'form_messages' !== $active_page_tab ) { return; } if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) || ! current_user_can( wpbc_settings_messages__get_manage_cap() ) ) { return; } ?>
  
array( 'is_show_top_path' => true, 'right_vertical_sidebar__is_show' => true, 'right_vertical_sidebar__default_view_mode' => '', 'right_vertical_sidebar_compact__is_show' => true, 'left_navigation__default_view_mode' => 'compact', 'top_path_title' => __( 'Form Messages', 'booking' ), 'title' => __( 'Form Messages', 'booking' ), 'hint' => __( 'Customize visitor-facing booking form notices and validation messages.', 'booking' ), 'page_title' => __( 'Form Messages', 'booking' ), 'link' => function_exists( 'wpbc_get_settings_messages_url' ) ? wpbc_get_settings_messages_url() : admin_url( 'admin.php?page=wpbc-settings&tab=form_messages' ), 'position' => '', 'css_classes' => 'wpbc_top_tab__form_messages', 'icon' => '', 'font_icon' => 'wpbc-bi-chat-square-text', 'font_icon_right' => '', 'default' => false, 'disabled' => false, 'hided' => false, 'subtabs' => array(), 'folder_style' => 'order:22;', ), ); } /** @return void */ public function right_sidebar_compact_content() { WPBC_UI_Sidebar_Panels::render_rightbar_tabs( array( array( 'id' => 'wpbc_tab_messages_options', 'panel_id' => 'wpbc_messages__inspector_options', 'title' => __( 'Sections', 'booking' ), 'icon' => 'wpbc-bi-list-ul', 'selected' => true ), array( 'id' => 'wpbc_tab_messages_help', 'panel_id' => 'wpbc_messages__inspector_help', 'title' => __( 'Help', 'booking' ), 'icon' => 'wpbc-bi-info-circle' ), ), array( 'aria_label' => __( 'Form Message Panels', 'booking' ), 'context' => 'settings_messages', 'class' => 'wpbc_messages_rightbar_tabs' ) ); } /** @return void */ public function right_sidebar_content() { ?>
'wpbc_messages__inspector_options', 'labelledby' => 'wpbc_tab_messages_options', 'class' => 'wpbc_messages__inspector_options' ), array( $this, 'right_panel_options_content' ) ); WPBC_UI_Sidebar_Panels::render_panel( array( 'id' => 'wpbc_messages__inspector_help', 'labelledby' => 'wpbc_tab_messages_help', 'class' => 'wpbc_messages__inspector_help', 'hidden' => true ), array( $this, 'right_panel_help_content' ) ); ?>

Default message
[lang=fr_FR]
Message en français
[lang=de_DE]
Nachricht auf Deutsch

$group ) : ?>

$config ) : ?>