| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @version 1.0 |
| 4 | 4 | * @package Booking Calendar |
| @@ -51,12 +51,11 @@ | ||
| 51 | 51 | * @return false|void |
| 52 | 52 | */ |
| 53 | 53 | function wpbc_check_for_submit__page_resource_publish( $page_name ) { |
| 54 | 54 | |
| 55 | - if ( | |
| 56 | - ( 'resources' !== $page_name ) | |
| 57 | - // && ( 'wpbc-ajx_booking_setup_wizard' !== $page_name ) | |
| 58 | - ){ | |
| 55 | + if ( | |
| 56 | + ( 'resources' !== $page_name ) | |
| 57 | + ){ | |
| 59 | 58 | return false; |
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | // Check $_POST |
| @@ -63,9 +62,9 @@ | ||
| 63 | 62 | |
| 64 | 63 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 65 | 64 | if ( ( isset( $_POST['action'] ) ) && ( 'wpbc_page_resource_publish' === $_POST['action'] ) ) { |
| 66 | 65 | |
| 67 | - if ( wpbc_is_this_demo() ) { | |
| 66 | + if ( wpbc_is_booking_form_publishing_restricted() ) { | |
| 68 | 67 | wpbc_show_notice__for_page_resource_publish( 'This operation is restricted in the demo version.', 'warning' ); |
| 69 | 68 | return; |
| 70 | 69 | } |
| 71 | 70 | |
| @@ -190,14 +189,29 @@ | ||
| 190 | 189 | } |
| 191 | 190 | |
| 192 | 191 | } |
| 193 | 192 | } |
| 194 | -add_action( 'wpbc_hook_settings_page_before_content_table', 'wpbc_check_for_submit__page_resource_publish' ,10, 1); | |
| 195 | - | |
| 196 | - | |
| 197 | -function wpbc_show_notice__for_page_resource_publish( $message, $message_type = 'success' ) { | |
| 198 | - ?> | |
| 199 | - <div class="wpbc-settings-notice notice-<?php echo esc_attr( $message_type ); ?>" style="text-align:left;font-size: 1rem;margin-top:20px;"> | |
| 193 | +add_action( 'wpbc_hook_settings_page_before_content_table', 'wpbc_check_for_submit__page_resource_publish' ,10, 1); | |
| 194 | + | |
| 195 | +/** | |
| 196 | + * Render feedback from the Booking Resource publishing workflow. | |
| 197 | + * | |
| 198 | + * The shared publisher is also used outside the Resources catalog, so catalog | |
| 199 | + * spacing is applied only while the new catalog renderer owns the request. | |
| 200 | + * | |
| 201 | + * @param string $message Escaped or deliberately prepared notice markup. | |
| 202 | + * @param string $message_type Notice type used by the Booking Calendar notice styles. | |
| 203 | + * | |
| 204 | + * @return void | |
| 205 | + */ | |
| 206 | +function wpbc_show_notice__for_page_resource_publish( $message, $message_type = 'success' ) { | |
| 207 | + $notice_style = 'text-align:left;font-size:1rem;margin-top:20px;'; | |
| 208 | + | |
| 209 | + if ( function_exists( 'wpbc_catalog_booking_resources_is_page' ) && wpbc_catalog_booking_resources_is_page() ) { | |
| 210 | + $notice_style = 'text-align:left;font-size:1rem;margin:0 0 40px;'; | |
| 211 | + } | |
| 212 | + ?> | |
| 213 | + <div class="wpbc-settings-notice notice-<?php echo esc_attr( $message_type ); ?>" style="<?php echo esc_attr( $notice_style ); ?>"> | |
| 200 | 214 | <strong><?php |
| 201 | 215 | if ( ( 'error' == $message_type ) ) { |
| 202 | 216 | echo esc_html__( 'Error', 'booking' ) . '! '; |
| 203 | 217 | } ?></strong> <?php |
| @@ -211,14 +225,13 @@ | ||
| 211 | 225 | |
| 212 | 226 | /** Publish Layout - Modal Window structure */ |
| 213 | 227 | function wpbc_write_content_for_modal__page_resource_publish( $page_name ) { |
| 214 | 228 | |
| 215 | - if ( | |
| 216 | - ( 'resources' !== $page_name ) && | |
| 217 | - ( 'wpbc-ajx_booking_setup_wizard' !== $page_name ) && | |
| 218 | - ( ! wpbc_is_builder_booking_form_page() ) | |
| 229 | + if ( | |
| 230 | + ( 'resources' !== $page_name ) && | |
| 231 | + ( ! wpbc_is_builder_booking_form_page() ) | |
| 219 | 232 | // && ( 'wpbc-ajx_booking' !== $page_name ) // FixIn: 10.6.6.2. |
| 220 | - ){ | |
| 233 | + ){ | |
| 221 | 234 | return false; |
| 222 | 235 | } |
| 223 | 236 | |
| 224 | 237 | ?><span class="wpdevelop"><?php |
| @@ -281,9 +294,9 @@ | ||
| 281 | 294 | </div> |
| 282 | 295 | <div class="modal-body"> |
| 283 | 296 | <div id="wpbc_content_for_js_resource_publish"> |
| 284 | 297 | <?php |
| 285 | - if ( wpbc_is_this_demo() ) { | |
| 298 | + if ( wpbc_is_booking_form_publishing_restricted() ) { | |
| 286 | 299 | wpbc_show_notice__for_page_resource_publish( 'In the demo versions such operation is not allowed.', 'warning' ); |
| 287 | 300 | } else { |
| 288 | 301 | ?> |
| 289 | 302 | <form method="post" action=""> |