| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version 1.0 |
| 4 |
* @package Booking Calendar |
| 5 |
* @subpackage Publish Booking Calendar shortcodes into the Pages |
| 6 |
* @category Functions |
| 7 |
* |
| 8 |
* @author wpdevelop |
| 9 |
* @link https://wpbookingcalendar.com/ |
| 10 |
* @email info@wpbookingcalendar.com |
| 11 |
* |
| 12 |
* @modified 2023-12-27 |
| 13 |
* @file: ../includes/publish/wpbc-publish-shortcode.php |
| 14 |
*/ |
| 15 |
|
| 16 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.15.5. |
| 17 |
|
| 18 |
|
| 19 |
/** |
| 20 |
* Get prepared (for WP Blocks) shortcode of booking form for inserting into the post or page |
| 21 |
* |
| 22 |
* @param int $resource_id |
| 23 |
* |
| 24 |
* @return string |
| 25 |
*/ |
| 26 |
function wpbc_get_prepared_shortcode( $resource_id = 1 ) { |
| 27 |
|
| 28 |
$resource_id = intval( $resource_id ); |
| 29 |
|
| 30 |
$shortcode = ''; |
| 31 |
if ( ! empty( $resource_id ) ) { |
| 32 |
|
| 33 |
// $shortcode .= '<!-- wp:booking/booking {"wpbc_shortcode":"[booking resource_id=' . $resource_id . ' nummonths=1]"} -->'; |
| 34 |
// $shortcode .= '<div class="wp-block-booking-booking">[booking resource_id=' . $resource_id . ' nummonths=1]</div>'; |
| 35 |
// $shortcode .= '<!-- /wp:booking/booking -->'; |
| 36 |
|
| 37 |
$shortcode .= '<!-- wp:shortcode -->'; |
| 38 |
$shortcode .= '[booking resource_id=' . $resource_id . ' nummonths=1]'; |
| 39 |
$shortcode .= '<!-- /wp:shortcode -->'; |
| 40 |
} |
| 41 |
|
| 42 |
return $shortcode; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
/** |
| 47 |
* Submit | Update checking |
| 48 |
* |
| 49 |
* @param $page_name |
| 50 |
* |
| 51 |
* @return false|void |
| 52 |
*/ |
| 53 |
function wpbc_check_for_submit__page_resource_publish( $page_name ) { |
| 54 |
|
| 55 |
if ( |
| 56 |
( 'resources' !== $page_name ) |
| 57 |
// && ( 'wpbc-ajx_booking_setup_wizard' !== $page_name ) |
| 58 |
){ |
| 59 |
return false; |
| 60 |
} |
| 61 |
|
| 62 |
// Check $_POST |
| 63 |
|
| 64 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 65 |
if ( ( isset( $_POST['action'] ) ) && ( 'wpbc_page_resource_publish' === $_POST['action'] ) ) { |
| 66 |
|
| 67 |
if ( wpbc_is_booking_form_publishing_restricted() ) { |
| 68 |
wpbc_show_notice__for_page_resource_publish( 'This operation is restricted in the demo version.', 'warning' ); |
| 69 |
return; |
| 70 |
} |
| 71 |
|
| 72 |
$nonce_gen_time = check_admin_referer( 'set_resource_publish_check' ); // It stops show anything on submitting, if it not refers to the original page |
| 73 |
|
| 74 |
$add_shortcode_result_arr = false; |
| 75 |
|
| 76 |
// CREATE NEW PAGE |
| 77 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 78 |
if ( ( 'create' === $_POST['wpbc_page_resource_publish_what'] ) |
| 79 |
&& ( ! empty($_POST['create_page_for_resource_publish'] ) ) |
| 80 |
&& ( ! empty($_POST['wpbc_page_resource_publish_resource_id'] ) ) |
| 81 |
){ |
| 82 |
$shortcode_resource_id = intval( $_POST['wpbc_page_resource_publish_resource_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 83 |
$page_name = sanitize_text_field( wp_unslash( $_POST['create_page_for_resource_publish'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ |
| 84 |
|
| 85 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 86 |
if ( ! empty( $_POST['wpbc_page_resource_publish_resource_shortcode'] ) ) { |
| 87 |
//$insert_shortcode = WPBC_Settings_API::validate_textarea_post_static( 'wpbc_page_resource_publish_resource_shortcode' ); |
| 88 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 89 |
$insert_shortcode = wp_kses( trim( stripslashes( $_POST[ 'wpbc_page_resource_publish_resource_shortcode' ] ) ), |
| 90 |
array_merge( array( // 'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true ) |
| 91 |
// , 'script' => array( 'type' => true ) // Allow JS |
| 92 |
), |
| 93 |
wp_kses_allowed_html( 'post' ) |
| 94 |
) |
| 95 |
); |
| 96 |
$insert_shortcode = '<!-- wp:shortcode -->' . $insert_shortcode .'<!-- /wp:shortcode -->'; |
| 97 |
} else { |
| 98 |
// auto_generated_shortcode |
| 99 |
$insert_shortcode = wpbc_get_prepared_shortcode( $shortcode_resource_id ); |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
// Add shortcode to specific Page with POST ID |
| 104 |
$add_shortcode_result_arr = wpbc_add_shortcode_into_page( array( |
| 105 |
'shortcode' => $insert_shortcode, |
| 106 |
'check_exist_shortcode' => '[WPBC_' . microtime() . '_WPBC]', // Just add Fake shortcode, so we always add new shortcode to the page |
| 107 |
|
| 108 |
'page_post_name' => sanitize_title( $page_name ), |
| 109 |
'post_title' => esc_html( $page_name ), |
| 110 |
'resource_id' => $shortcode_resource_id |
| 111 |
) ); |
| 112 |
} |
| 113 |
|
| 114 |
// ADD TO EXIST PAGE |
| 115 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated |
| 116 |
if ( ( 'edit' === $_POST['wpbc_page_resource_publish_what'] ) |
| 117 |
&& ( ! empty($_POST['select_page_for_resource_publish'] ) ) |
| 118 |
&& ( ! empty($_POST['wpbc_page_resource_publish_resource_id'] ) ) |
| 119 |
){ |
| 120 |
$shortcode_resource_id = intval( $_POST['wpbc_page_resource_publish_resource_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 121 |
$page_id = intval( $_POST['select_page_for_resource_publish'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 122 |
|
| 123 |
// Add shortcode to specific Page with POST ID |
| 124 |
$check_exist_shortcode_arr = array( |
| 125 |
'[booking resource_id=' . $shortcode_resource_id . ' ', |
| 126 |
'[booking resource_id=' . $shortcode_resource_id . ']', |
| 127 |
'[booking type=' . $shortcode_resource_id . ' ', |
| 128 |
'[booking type=' . $shortcode_resource_id . ']' |
| 129 |
); |
| 130 |
if ( 1 === $shortcode_resource_id ) { |
| 131 |
$check_exist_shortcode_arr[] = '[booking]'; |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 136 |
if ( ! empty( $_POST['wpbc_page_resource_publish_resource_shortcode'] ) ) { |
| 137 |
//$insert_shortcode = WPBC_Settings_API::validate_textarea_post_static( 'wpbc_page_resource_publish_resource_shortcode' ); |
| 138 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 139 |
$insert_shortcode = wp_kses( trim( stripslashes( $_POST[ 'wpbc_page_resource_publish_resource_shortcode' ] ) ), |
| 140 |
array_merge( array( // 'iframe' => array( 'src' => true, 'style' => true, 'id' => true, 'class' => true ) |
| 141 |
// , 'script' => array( 'type' => true ) // Allow JS |
| 142 |
), |
| 143 |
wp_kses_allowed_html( 'post' ) |
| 144 |
) |
| 145 |
); |
| 146 |
$insert_shortcode = '<!-- wp:shortcode -->' . $insert_shortcode .'<!-- /wp:shortcode -->'; |
| 147 |
} else { |
| 148 |
// auto_generated_shortcode |
| 149 |
$insert_shortcode = wpbc_get_prepared_shortcode( $shortcode_resource_id ); |
| 150 |
} |
| 151 |
|
| 152 |
$add_shortcode_result_arr = wpbc_add_shortcode_into_page( array( |
| 153 |
'shortcode' => $insert_shortcode, |
| 154 |
'page_id' => $page_id, |
| 155 |
'check_exist_shortcode' => $check_exist_shortcode_arr, //'[WPBC_' . microtime() . '_WPBC]' // Just add Fake shortcode, so we always add new shortcode to the page |
| 156 |
'resource_id' => $shortcode_resource_id |
| 157 |
) ); |
| 158 |
} |
| 159 |
|
| 160 |
// Show Result Message |
| 161 |
if ( |
| 162 |
( ! empty( $add_shortcode_result_arr ) ) |
| 163 |
&& ( $add_shortcode_result_arr['result'] ) |
| 164 |
&& ( ! empty( $add_shortcode_result_arr['relative_url'] ) ) |
| 165 |
){ |
| 166 |
$relative_post_url = $add_shortcode_result_arr['relative_url']; |
| 167 |
$post_title = trim( $relative_post_url, '/' ); |
| 168 |
$post_obj = get_page_by_path( $relative_post_url ); |
| 169 |
if ( ! empty( $post_obj ) ) { |
| 170 |
$post_title = $post_obj->post_title; |
| 171 |
} |
| 172 |
wpbc_show_notice__for_page_resource_publish( $add_shortcode_result_arr['message'] |
| 173 |
// . ' ' . '<a href="' . esc_url( wpbc_make_link_absolute( $relative_post_url ) ) . '">' . $post_title . '</a>' |
| 174 |
); |
| 175 |
|
| 176 |
} elseif ( false === $add_shortcode_result_arr ) { |
| 177 |
wpbc_show_notice__for_page_resource_publish( 'Error: You may not have chosen the correct page name.', 'error' ); |
| 178 |
wpbc_show_notice__for_page_resource_publish( |
| 179 |
/* translators: 1: ... */ |
| 180 |
sprintf( __( 'Find more information at the %1$sFAQ page%2$s', 'booking' ), |
| 181 |
'<a href="https://wpbookingcalendar.com/faq/#shortcodes">', '</a>' |
| 182 |
), 'info'); |
| 183 |
}else { |
| 184 |
wpbc_show_notice__for_page_resource_publish( $add_shortcode_result_arr['message'], 'error' ); |
| 185 |
wpbc_show_notice__for_page_resource_publish( |
| 186 |
/* translators: 1: ... */ |
| 187 |
sprintf( __( 'Find more information at the %1$sFAQ page%2$s', 'booking' ), |
| 188 |
'<a href="https://wpbookingcalendar.com/faq/#shortcodes">', '</a>' |
| 189 |
), 'info'); |
| 190 |
} |
| 191 |
|
| 192 |
} |
| 193 |
} |
| 194 |
add_action( 'wpbc_hook_settings_page_before_content_table', 'wpbc_check_for_submit__page_resource_publish' ,10, 1); |
| 195 |
|
| 196 |
/** |
| 197 |
* Render feedback from the Booking Resource publishing workflow. |
| 198 |
* |
| 199 |
* The shared publisher is also used outside the Resources catalog, so catalog |
| 200 |
* spacing is applied only while the new catalog renderer owns the request. |
| 201 |
* |
| 202 |
* @param string $message Escaped or deliberately prepared notice markup. |
| 203 |
* @param string $message_type Notice type used by the Booking Calendar notice styles. |
| 204 |
* |
| 205 |
* @return void |
| 206 |
*/ |
| 207 |
function wpbc_show_notice__for_page_resource_publish( $message, $message_type = 'success' ) { |
| 208 |
$notice_style = 'text-align:left;font-size:1rem;margin-top:20px;'; |
| 209 |
|
| 210 |
if ( function_exists( 'wpbc_catalog_booking_resources_is_page' ) && wpbc_catalog_booking_resources_is_page() ) { |
| 211 |
$notice_style = 'text-align:left;font-size:1rem;margin:0 0 40px;'; |
| 212 |
} |
| 213 |
?> |
| 214 |
<div class="wpbc-settings-notice notice-<?php echo esc_attr( $message_type ); ?>" style="<?php echo esc_attr( $notice_style ); ?>"> |
| 215 |
<strong><?php |
| 216 |
if ( ( 'error' == $message_type ) ) { |
| 217 |
echo esc_html__( 'Error', 'booking' ) . '! '; |
| 218 |
} ?></strong> <?php |
| 219 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 220 |
echo $message; |
| 221 |
?> |
| 222 |
</div> |
| 223 |
<?php |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
/** Publish Layout - Modal Window structure */ |
| 228 |
function wpbc_write_content_for_modal__page_resource_publish( $page_name ) { |
| 229 |
|
| 230 |
if ( |
| 231 |
( 'resources' !== $page_name ) && |
| 232 |
( 'wpbc-ajx_booking_setup_wizard' !== $page_name ) && |
| 233 |
( ! wpbc_is_builder_booking_form_page() ) |
| 234 |
// && ( 'wpbc-ajx_booking' !== $page_name ) // FixIn: 10.6.6.2. |
| 235 |
){ |
| 236 |
return false; |
| 237 |
} |
| 238 |
|
| 239 |
?><span class="wpdevelop"><?php |
| 240 |
|
| 241 |
?><div id="wpbc_modal__resource_publish" class="modal wpbc_popup_modal" tabindex="-1" role="dialog"> |
| 242 |
<style type="text/css"> |
| 243 |
#wpbc_modal__resource_publish .modal-header .modal-title { |
| 244 |
font-weight: 600; |
| 245 |
} |
| 246 |
.wpbc_popup_modal .form-table input[type="radio"]{ |
| 247 |
margin: -4px 4px 0 0; |
| 248 |
} |
| 249 |
.wpbc_publish_wizard_steps { |
| 250 |
display: none; |
| 251 |
} |
| 252 |
.wpbc_publish_wizard_step_1 { |
| 253 |
display: block; |
| 254 |
} |
| 255 |
.wpbc_publish_wizard_steps .wpbc_publish_wizard_inner_header { |
| 256 |
line-height: 1.75em; |
| 257 |
text-align: center; |
| 258 |
font-size: 16px; |
| 259 |
font-weight: 400; |
| 260 |
max-width: 30em; |
| 261 |
margin: 0 auto; |
| 262 |
margin-bottom: 15px; |
| 263 |
} |
| 264 |
.wpbc_publish_wizard_steps__buttons, |
| 265 |
.wpbc_publish_wizard_steps__inputs { |
| 266 |
display: flex; |
| 267 |
flex-flow: row wrap; |
| 268 |
justify-content: center; |
| 269 |
align-items: center; |
| 270 |
margin:10px 0; |
| 271 |
} |
| 272 |
#wpbc_modal__resource_publish .wpbc_publish_wizard_steps__buttons a{ |
| 273 |
margin: 0 10px; |
| 274 |
} |
| 275 |
#wpbc_modal__resource_publish .modal-footer { |
| 276 |
display: none; |
| 277 |
text-align: center; |
| 278 |
} |
| 279 |
.wp-core-ui .wpbc_page .wpbc_publish_wizard_steps__inputs input[type='text'], |
| 280 |
.wpbc_publish_wizard_steps__inputs input[type='text'], |
| 281 |
.wpbc_publish_wizard_steps__inputs select { |
| 282 |
width: Min(100%,25em); |
| 283 |
max-width: Min(100%,25em); |
| 284 |
margin: 5px 10px 10px; |
| 285 |
min-height: 30px; |
| 286 |
} |
| 287 |
.wpbc_publish_wizard_steps__inputs input[type='submit'] { |
| 288 |
margin: 5px 10px 10px; |
| 289 |
} |
| 290 |
</style> |
| 291 |
<div class="modal-dialog modal-lg0"> |
| 292 |
<div class="modal-content"> |
| 293 |
<div class="modal-header"> |
| 294 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 295 |
<h4 class="modal-title"><?php esc_html_e( 'Insert into page', 'booking' ); ?></h4> |
| 296 |
</div> |
| 297 |
<div class="modal-body"> |
| 298 |
<div id="wpbc_content_for_js_resource_publish"> |
| 299 |
<?php |
| 300 |
if ( wpbc_is_booking_form_publishing_restricted() ) { |
| 301 |
wpbc_show_notice__for_page_resource_publish( 'In the demo versions such operation is not allowed.', 'warning' ); |
| 302 |
} else { |
| 303 |
?> |
| 304 |
<form method="post" action=""> |
| 305 |
<input type="hidden" name="action" value="wpbc_page_resource_publish" /> |
| 306 |
<input type="hidden" id="wpbc_page_resource_publish_resource_id" name="wpbc_page_resource_publish_resource_id" value="" /> |
| 307 |
<input type="hidden" id="wpbc_page_resource_publish_resource_shortcode" name="wpbc_page_resource_publish_resource_shortcode" value="" /> |
| 308 |
<input type="hidden" id="wpbc_page_resource_publish_what" name="wpbc_page_resource_publish_what" value="" /> |
| 309 |
<?php |
| 310 |
wp_nonce_field( 'set_resource_publish_check' ); |
| 311 |
?> |
| 312 |
<div class="wpbc_publish_wizard_steps wpbc_publish_wizard_step_1"> |
| 313 |
<div class="wpbc_publish_wizard_inner_header"><?php esc_html_e('Choose whether to embed your booking form in an existing page or create a new one.', 'booking'); ?></div> |
| 314 |
<div class="wpbc_publish_wizard_steps__buttons"> |
| 315 |
<a href="javascript:void(0)" class="button button-secondary" |
| 316 |
onclick="javascript:jQuery( '.wpbc_publish_wizard_steps').hide(); |
| 317 |
jQuery( '.wpbc_publish_wizard_step_2').show(); |
| 318 |
jQuery( '#wpbc_modal__resource_publish .modal-footer').show(); |
| 319 |
jQuery( '#wpbc_page_resource_publish_resource_shortcode' ).val( jQuery( '#booking_resource_shortcode_' + jQuery( '#wpbc_page_resource_publish_resource_id' ).val() ).val() ); |
| 320 |
jQuery( '#wpbc_page_resource_publish_what' ).val( 'edit' );" |
| 321 |
><?php esc_html_e('Embed in Existing Page', 'booking' ); ?></a> |
| 322 |
<a href="javascript:void(0)" class="button button-secondary" |
| 323 |
onclick="javascript:jQuery( '.wpbc_publish_wizard_steps').hide(); |
| 324 |
jQuery( '.wpbc_publish_wizard_step_3').show(); |
| 325 |
jQuery( '#wpbc_modal__resource_publish .modal-footer').show(); |
| 326 |
jQuery( '#wpbc_page_resource_publish_resource_shortcode' ).val( jQuery( '#booking_resource_shortcode_' + jQuery( '#wpbc_page_resource_publish_resource_id' ).val() ).val() ); |
| 327 |
jQuery( '#wpbc_page_resource_publish_what' ).val( 'create' );" |
| 328 |
><?php esc_html_e('Create New Page','booking'); ?></a> |
| 329 |
</div> |
| 330 |
</div> |
| 331 |
<div class="wpbc_publish_wizard_steps wpbc_publish_wizard_step_2"> |
| 332 |
<div class="wpbc_publish_wizard_inner_header"><?php esc_html_e('Select the page where you want to embed your booking form.', 'booking'); ?></div> |
| 333 |
<div class="wpbc_publish_wizard_steps__inputs"> |
| 334 |
<?php |
| 335 |
wp_dropdown_pages( |
| 336 |
array( |
| 337 |
'name' => 'select_page_for_resource_publish', |
| 338 |
'show_option_none' => '— ' . esc_html__( 'Select', 'booking' ) . ' —', |
| 339 |
'option_none_value' => '0', |
| 340 |
'selected' => 0,//$privacy_policy_page_id, |
| 341 |
'post_status' => array( 'draft', 'publish' ), |
| 342 |
) |
| 343 |
); |
| 344 |
submit_button( __( 'Use This Page', 'booking' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) ); |
| 345 |
?> |
| 346 |
</div> |
| 347 |
</div> |
| 348 |
<div class="wpbc_publish_wizard_steps wpbc_publish_wizard_step_3"> |
| 349 |
<div class="wpbc_publish_wizard_inner_header"><?php esc_html_e('Provide a name for your new page.', 'booking'); ?></div> |
| 350 |
<div class="wpbc_publish_wizard_steps__inputs"> |
| 351 |
<input id="create_page_for_resource_publish" name="create_page_for_resource_publish" type="text" value="" |
| 352 |
placeholder="<?php echo esc_attr( __( 'Enter Page Name', 'booking' ) ); ?>"/> |
| 353 |
<?php |
| 354 |
submit_button( __( 'Create Page', 'booking' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) ); |
| 355 |
?> |
| 356 |
</div> |
| 357 |
</div> |
| 358 |
</form> |
| 359 |
<?php } ?> |
| 360 |
</div> |
| 361 |
</div> |
| 362 |
<div class="modal-footer"> |
| 363 |
<!--a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"><?php esc_html_e('Close' ,'booking'); ?></a--> |
| 364 |
<a id="wpbc_modal__go_back_button" class="button button-secondary" |
| 365 |
href="javascript:void(0);" |
| 366 |
onclick="javascript:jQuery( '.wpbc_publish_wizard_steps').hide(); |
| 367 |
jQuery( '.wpbc_publish_wizard_step_1').show(); |
| 368 |
jQuery( '#wpbc_modal__resource_publish .modal-footer').hide();" |
| 369 |
><i class="menu_icon icon-1x wpbc_icn_keyboard_arrow_left"></i> <?php esc_html_e('Go Back' ,'booking'); ?></a> |
| 370 |
</div> |
| 371 |
</div><!-- /.modal-content --> |
| 372 |
</div><!-- /.modal-dialog --> |
| 373 |
</div><!-- /.modal --> |
| 374 |
<?php |
| 375 |
|
| 376 |
?></span><?php |
| 377 |
|
| 378 |
|
| 379 |
?><script type="text/javascript"> |
| 380 |
function wpbc_modal_dialog__show__resource_publish( booking_id ){ |
| 381 |
|
| 382 |
if ( 'function' === typeof (jQuery( '#wpbc_modal__resource_publish' ).wpbc_my_modal) ){ |
| 383 |
jQuery( '#wpbc_modal__resource_publish' ).wpbc_my_modal( 'show' ); |
| 384 |
jQuery( '#wpbc_page_resource_publish_resource_id' ).val( booking_id ); |
| 385 |
jQuery( '.wpbc_publish_wizard_steps').hide(); |
| 386 |
jQuery( '.wpbc_publish_wizard_step_1').show(); |
| 387 |
jQuery( '#wpbc_modal__resource_publish .modal-footer').hide(); |
| 388 |
} else { |
| 389 |
alert( 'Warning! Modal module( wpbc_my_modal ) had not define.' ) |
| 390 |
} |
| 391 |
} |
| 392 |
</script><?php |
| 393 |
} |
| 394 |
add_action( 'wpbc_hook_settings_page_footer', 'wpbc_write_content_for_modal__page_resource_publish' ,10, 1); |
| 395 |
|