| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * @category JavaScript files and varibales |
| 5 | 5 | * @author wpdevelop |
| 6 | 6 | * |
| 7 | 7 | * @web-site https://wpbookingcalendar.com/ |
| 8 | - * @email info@wpbookingcalendar.com | |
| 8 | + * @email info@wpbookingcalendar.com | |
| 9 | 9 | * |
| 10 | 10 | * @modified 19.10.2015 |
| 11 | 11 | */ |
| 12 | 12 | |
| @@ -45,9 +45,9 @@ | ||
| 45 | 45 | |
| 46 | 46 | wpbc_js_load_libs( $where_to_load ); |
| 47 | 47 | wpbc_js_load_files( $where_to_load ); |
| 48 | 48 | |
| 49 | - if ( wpbc_is_new_booking_page() || wpbc_is_settings_form_page() || wpbc_is_setup_wizard_page() ) { | |
| 49 | + if ( wpbc_is_admin_page_with_frontend_booking_preview() ) { | |
| 50 | 50 | $where_to_load = 'both'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Load JavaScript files in all other versions |
| @@ -64,30 +64,22 @@ | ||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Remove `async` and `defer` ( check more here https://javascript.info/script-async-defer ) | |
| 69 | - * for scripts registered or enqueued, that required for correct working of plugin, like | |
| 70 | - * jquery and all Booking Calendar scripts | |
| 68 | + * Preserve the required execution order for Booking Calendar scripts. | |
| 71 | 69 | * |
| 70 | + * Removes asynchronous loading attributes and excludes the scripts from | |
| 71 | + * Cloudflare Rocket Loader. The filter runs at a very late priority so these | |
| 72 | + * protections remain present after other script-tag optimization filters. | |
| 73 | + * | |
| 72 | 74 | * @param string $tag The script tag. |
| 73 | - * @param string $handle The script handle. | |
| 75 | + * @param string $handle The registered script handle. | |
| 76 | + * @param string $src The script source URL. | |
| 74 | 77 | * |
| 75 | - * @return string Script HTML string. | |
| 76 | - * | |
| 78 | + * @return string Filtered script HTML string. | |
| 77 | 79 | */ |
| 78 | 80 | public function filter_script_loader_tag( $tag, $handle, $src ) { |
| 79 | - | |
| 80 | - $script_handles_prevent_defer = array( | |
| 81 | - 'jquery-core' // exact value | |
| 82 | - , 'jquery-migrate' | |
| 83 | - //, 'wpbc-' //starting from 'wpbc-' it's not the exact value | |
| 84 | - //, 'wpdevelop-' | |
| 85 | - ); | |
| 86 | - | |
| 87 | - | |
| 88 | - // Remove defer and async attribute from the src. | |
| 89 | - if ( | |
| 81 | + $is_required_script = ( | |
| 90 | 82 | ( 'jquery-core' === $handle ) |
| 91 | 83 | || ( 'jquery-migrate' === $handle ) |
| 92 | 84 | || ( false !== strpos( $handle, 'wpbc_' ) ) // Booking Calendar script wpbc_all.js // FixIn: 10.1.2.3. |
| 93 | 85 | || ( false !== strpos( $handle, 'wpbc-' ) ) // Booking Calendar scripts |
| @@ -92,28 +84,20 @@ | ||
| 92 | 84 | || ( false !== strpos( $handle, 'wpbc_' ) ) // Booking Calendar script wpbc_all.js // FixIn: 10.1.2.3. |
| 93 | 85 | || ( false !== strpos( $handle, 'wpbc-' ) ) // Booking Calendar scripts |
| 94 | 86 | || ( false !== strpos( $handle, 'wpdevelop-' ) ) |
| 95 | 87 | || ( false !== strpos( $handle, 'wpbm-' ) ) |
| 96 | - ) { | |
| 88 | + ); | |
| 97 | 89 | |
| 90 | + if ( $is_required_script ) { | |
| 98 | 91 | foreach ( array( 'async', 'defer' ) as $attr ) { |
| 92 | + // Match only a standalone attribute, not the "async" part of data-cfasync. | |
| 93 | + $pattern = '/\s+' . $attr . '(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|[^\s>]+))?/i'; | |
| 94 | + $tag = preg_replace( $pattern, '', $tag ); | |
| 95 | + } | |
| 99 | 96 | |
| 100 | - if ( preg_match( ":\s$attr(=|>|\s):", $tag ) ) { | |
| 101 | - $tag = str_replace($attr, '', $tag); | |
| 102 | - $tag = str_replace('=""', '', $tag); | |
| 103 | - $tag = str_replace("=''", '', $tag); | |
| 104 | - | |
| 105 | - /* | |
| 106 | - * Test here https://regex101.com/ | |
| 107 | - * | |
| 108 | - * Expression: \s+defer(\s*=\s*["']defer["'])?\s? | |
| 109 | - * Test string: <script type='text/javascript' defer = 'defer' defer="defer" src='http://beta/wp-content/plugins/booking-manager/js/wpbm_vars.js?ver=1.1' id='wpbm-global-vars-js'></script> | |
| 110 | - * | |
| 111 | - */ | |
| 112 | - $pattern = ":\s+{$attr}(\s*=\s*[\"']{$attr}[\"'])?\s?:mi"; | |
| 113 | - $replacement = ' '; | |
| 114 | - $tag = preg_replace($pattern, $replacement, $tag); | |
| 115 | - } | |
| 97 | + // Rocket Loader can otherwise execute dependent scripts before wpbc_all.js defines _wpbc. | |
| 98 | + if ( false === strpos( $tag, 'data-cfasync=' ) ) { | |
| 99 | + $tag = preg_replace( '/<script\b/i', '<script data-cfasync="false"', $tag, 1 ); | |
| 116 | 100 | } |
| 117 | 101 | } |
| 118 | 102 | |
| 119 | 103 | return $tag; |
| @@ -121,13 +105,13 @@ | ||
| 121 | 105 | |
| 122 | 106 | |
| 123 | 107 | /** |
| 124 | 108 | * Deregister some conflict scripts from other plugins. |
| 125 | - * | |
| 109 | + * | |
| 126 | 110 | * @param type $where_to_load |
| 127 | 111 | */ |
| 128 | 112 | public function remove_conflicts( $where_to_load ) { |
| 129 | - | |
| 113 | + | |
| 130 | 114 | if ( wpbc_is_bookings_page() ) { |
| 131 | 115 | if (function_exists('wp_dequeue_script')) { |
| 132 | 116 | //wp_dequeue_script( 'jquery.cookie' ); |
| 133 | 117 | //wp_dequeue_script( 'jquery-interdependencies' ); |
| @@ -142,10 +126,10 @@ | ||
| 142 | 126 | |
| 143 | 127 | |
| 144 | 128 | /** Define JavaScript Varibales */ |
| 145 | 129 | function wpbc_js_load_vars( $where_to_load ) { |
| 146 | - | |
| 147 | 130 | |
| 131 | + | |
| 148 | 132 | } |
| 149 | 133 | |
| 150 | 134 | |
| 151 | 135 | /** Default JavaScripts Libraries */ |
| @@ -157,9 +141,9 @@ | ||
| 157 | 141 | // $deps = ''; |
| 158 | 142 | // $ver = false; |
| 159 | 143 | // wp_enqueue_script( 'jquery', $src, $deps, $ver, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); |
| 160 | 144 | |
| 161 | - // Default Admin Libs | |
| 145 | + // Default Admin Libs | |
| 162 | 146 | if ( 'admin' == $where_to_load ) { |
| 163 | 147 | if ( wpbc_is_settings_page() ) { |
| 164 | 148 | wp_enqueue_style( 'thickbox' ); // CSS Thickbox |
| 165 | 149 | wp_enqueue_script( 'thickbox' ); // JS Thickbox |
| @@ -165,9 +149,9 @@ | ||
| 165 | 149 | wp_enqueue_script( 'thickbox' ); // JS Thickbox |
| 166 | 150 | wp_enqueue_media(); |
| 167 | 151 | } |
| 168 | 152 | wp_enqueue_style( 'wp-color-picker' ); // Color Picker |
| 169 | - wp_enqueue_script( 'wp-color-picker' ); | |
| 153 | + wp_enqueue_script( 'wp-color-picker' ); | |
| 170 | 154 | wp_enqueue_script( 'jquery-ui-sortable' ); // UI Sortable |
| 171 | 155 | } |
| 172 | 156 | |
| 173 | 157 | // WP Util, that support wp.template, based on underscore _.template system |
| @@ -185,18 +169,18 @@ | ||
| 185 | 169 | * Popover based on Tippy.js ( https://atomiks.github.io/tippyjs/v6/all-props/#allowhtml ), which is based on popper.js ( https://popper.js.org/docs/v2/tutorial/ ) |
| 186 | 170 | * Install Alt + F12 run |
| 187 | 171 | * npm i @popperjs/core |
| 188 | 172 | * npm i tippy.js |
| 189 | - * Copy ..\node_modules\@popperjs\core\dist\umd to ..\wp-content/plugins/booking/assets/libs/popper | |
| 190 | - * Copy ..\node_modules\tippy.js\{dist && themes} to ..\wp-content/plugins/booking/assets/libs/tippy.js | |
| 173 | + * Copy ..\node_modules\@popperjs\core\dist\umd to ..\wp-content/plugins/booking/vendors/_custom/popper | |
| 174 | + * Copy ..\node_modules\tippy.js\{dist && themes} to ..\wp-content/plugins/booking/vendors/_custom/tippy.js | |
| 191 | 175 | * In popper.js edit global.Popper to global.wpbc_Popper |
| 192 | 176 | * In tippy-bundle.umd.js edit global.Popper to global.wpbc_Popper and global.tippy to global.wpbc_tippy |
| 193 | 177 | */ |
| 194 | - wp_enqueue_script( 'wpbc-popper', wpbc_plugin_url( '/assets/libs/popper/popper.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.0.1.1. | |
| 195 | - wp_enqueue_script( 'wpbc-tipcy', wpbc_plugin_url( '/assets/libs/tippy.js/dist/tippy-bundle.umd.js' ), array( 'wpbc-popper' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 | |
| 178 | + wp_enqueue_script( 'wpbc-popper', wpbc_plugin_url( '/vendors/_custom/popper/popper.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.0.1.1. | |
| 179 | + wp_enqueue_script( 'wpbc-tipcy', wpbc_plugin_url( '/vendors/_custom/tippy.js/dist/tippy-bundle.umd.js' ), array( 'wpbc-popper' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 | |
| 196 | 180 | |
| 197 | 181 | if ( $where_to_load != 'client' ) { |
| 198 | - wp_enqueue_script( 'wpbc-modal', wpbc_plugin_url( '/assets/libs/ui/_out/dropdown_modal.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 | |
| 182 | + wp_enqueue_script( 'wpbc-modal', wpbc_plugin_url( '/vendors/_custom/dropdown_modal/_out/dropdown_modal.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 | |
| 199 | 183 | } |
| 200 | 184 | |
| 201 | 185 | wp_enqueue_script( 'wpbc-datepick', wpbc_plugin_url( '/js/datepick/jquery.datepick.wpbc.9.0.js'), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 |
| 202 | 186 | $calendar_localization_url = wpbc_get_calendar_localization_url(); // Localization |
| @@ -203,27 +187,39 @@ | ||
| 203 | 187 | if ( ! empty( $calendar_localization_url ) ) { |
| 204 | 188 | wp_enqueue_script( 'wpbc-datepick-localize', $calendar_localization_url, array( 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 |
| 205 | 189 | } |
| 206 | 190 | |
| 207 | - if ( ( $where_to_load == 'client' ) || ( wpbc_is_new_booking_page() ) || ( wpbc_is_settings_form_page() || wpbc_is_setup_wizard_page() ) ) { | |
| 191 | + if ( ( $where_to_load == 'client' ) || wpbc_is_admin_page_with_frontend_booking_preview() ) { | |
| 208 | 192 | |
| 209 | 193 | wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Client |
| 210 | 194 | wp_enqueue_script( 'wpbc_capacity', wpbc_plugin_url( '/includes/_capacity/_out/create_booking.js' ), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Add new bookings // FixIn: 9.8.0.3. |
| 211 | 195 | wp_enqueue_script( 'wpbc-times', wpbc_plugin_url( '/js/wpbc_times.js' ), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: TimeFree 2 //UnComment it for Booking Calendar Free version |
| 212 | - if ( ( 'On' === get_bk_option( 'booking_timeslot_picker' ) ) || ( wpbc_is_setup_wizard_page() ) ) { | |
| 196 | + // if ( ( 'On' === get_bk_option( 'booking_timeslot_picker' ) ) || ( wpbc_is_setup_wizard_page() ) ) { | |
| 213 | 197 | wp_enqueue_script( 'wpbc-time-selector', wpbc_plugin_url( '/js/wpbc_time-selector.js'), array( 'wpbc-times' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 8.7.11.10. |
| 214 | - } | |
| 198 | + // } | |
| 199 | + wp_enqueue_script( 'wpbc-imask', wpbc_plugin_url( '/vendors/imask/dist/imask.js'), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 10.12.4.10. | |
| 200 | + $booking_is_use_phone_validation = get_bk_option( 'booking_is_use_phone_validation' ); | |
| 201 | + if ( 'On' === $booking_is_use_phone_validation ) { | |
| 202 | + wp_enqueue_script( 'wpbc-iphone-validator', wpbc_plugin_url( '/js/wpbc_phone_validator.js' ), array( 'wpbc-imask' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 10.12.4.10. | |
| 203 | + } | |
| 215 | 204 | } |
| 216 | 205 | |
| 217 | - if ( $where_to_load == 'admin' ) { | |
| 218 | - wp_enqueue_script( 'wpbc-js-print', wpbc_plugin_url( '/assets/libs/wpbc_js_print/wpbc_js_print.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 //FixIn: 9.2.1.6 // FixIn: 9.1.2.13. | |
| 219 | - wp_enqueue_script( 'wpbc-admin-main', wpbc_plugin_url( '/js/admin.js'), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Admin | |
| 220 | - if ( wpbc_can_i_load_on_this_page__shortcode_config() ) { | |
| 221 | - wp_enqueue_script( 'wpbc_shortcode_popup', wpbc_plugin_url( '/includes/ui_modal__shortcodes/_out/wpbc_shortcode_popup.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.8.6.1. | |
| 222 | - } | |
| 223 | - wp_enqueue_script( 'wpbc-admin-support', wpbc_plugin_url( '/core/any/js/admin-support.js'), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); | |
| 224 | - wp_enqueue_script( 'wpbc-chosen', wpbc_plugin_url( '/assets/libs/chosen/chosen.jquery.min.js'), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Chosen Library | |
| 225 | - } | |
| 206 | + if ( 'admin' === $where_to_load ) { | |
| 207 | + wp_enqueue_script( 'wpbc-js-print', wpbc_plugin_url( '/vendors/_custom/wpbc_js_print/wpbc_js_print.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.8.1 //FixIn: 9.2.1.6 // FixIn: 9.1.2.13. | |
| 208 | + wp_enqueue_script( 'wpbc-admin-main', wpbc_plugin_url( '/js/admin.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Admin. | |
| 209 | + if ( wpbc_can_i_load_on_this_page__shortcode_config() ) { | |
| 210 | + wp_enqueue_script( 'wpbc_shortcode_popup', wpbc_plugin_url( '/includes/ui_modal__shortcodes/_out/wpbc_shortcode_popup.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.8.6.1. | |
| 211 | + } | |
| 212 | + wp_enqueue_script( 'wpbc-admin-support', wpbc_plugin_url( '/core/any/js/admin-support.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); | |
| 213 | + wp_enqueue_script( 'wpbc-chosen', wpbc_plugin_url( '/vendors/chosen/chosen.jquery.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Chosen Library. | |
| 214 | + | |
| 215 | + // FixIn: 10.12.2.3. // docs: https://www.npmjs.com/package/simplebar#5-caveats . | |
| 216 | + wp_enqueue_script( 'wpbc-simplebar', wpbc_plugin_url( '/vendors/simplebar/dist/simplebar.min.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // Chosen Library. | |
| 217 | + wp_enqueue_style( 'wpbc-simplebar', wpbc_plugin_url( '/vendors/simplebar/dist/simplebar.min.css' ), array(), WP_BK_VERSION_NUM ); | |
| 218 | + } | |
| 219 | + if ( in_array( $where_to_load, array( 'admin', 'both' ), true ) ) { | |
| 220 | + wp_enqueue_script( 'wpbc_all_admin', wpbc_plugin_url( '/_dist/all/_out/wpbc_all_admin.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); | |
| 221 | + } | |
| 226 | 222 | } |
| 227 | 223 | |
| 228 | 224 | |
| 229 | 225 | /** |
| @@ -324,27 +320,49 @@ | ||
| 324 | 320 | * Load JS and CSS files for loading modals correctly |
| 325 | 321 | * |
| 326 | 322 | * @return void |
| 327 | 323 | */ |
| 328 | -function wpbc_load_js__required_for_modals(){ | |
| 324 | +function wpbc_load_js__required_for_modals() { | |
| 329 | 325 | |
| 330 | - // JS for opening Modals | |
| 331 | - wp_enqueue_script( 'wpbc-modal', wpbc_plugin_url( '/assets/libs/ui/_out/dropdown_modal.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); //FixIn: 9.8.1 | |
| 326 | + // JS for opening Modals. | |
| 327 | + wp_enqueue_script( 'wpbc-modal', wpbc_plugin_url( '/vendors/_custom/dropdown_modal/_out/dropdown_modal.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.8.1. | |
| 332 | 328 | |
| 333 | - // CSS | |
| 334 | - wp_enqueue_style( 'wpdevelop-bts', wpbc_plugin_url( '/assets/libs/bootstrap-css/css/bootstrap.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.8.1 | |
| 335 | - wp_enqueue_style( 'wpdevelop-bts-theme', wpbc_plugin_url( '/assets/libs/bootstrap-css/css/bootstrap-theme.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.8.1 | |
| 329 | + // CSS. | |
| 330 | + wp_enqueue_style( 'wpdevelop-bts', wpbc_plugin_url( '/vendors/_custom/bootstrap-css/css/bootstrap.css' ), array(), WP_BK_VERSION_NUM ); // FixIn: 9.8.1. | |
| 331 | + wp_enqueue_style( 'wpdevelop-bts-theme', wpbc_plugin_url( '/vendors/_custom/bootstrap-css/css/bootstrap-theme.css' ), array(), WP_BK_VERSION_NUM ); // FixIn: 9.8.1. | |
| 336 | 332 | |
| 337 | - wp_enqueue_style( 'wpbc-admin-support', wpbc_plugin_url( '/core/any/css/admin-support.css' ), array(), WP_BK_VERSION_NUM ); | |
| 338 | - wp_enqueue_style( 'wpbc-admin-menu', wpbc_plugin_url( '/core/any/css/admin-menu.css' ), array(), WP_BK_VERSION_NUM ); | |
| 339 | - //wp_enqueue_style( 'wpbc-admin-toolbar', wpbc_plugin_url( '/core/any/css/admin-toolbar.css' ), array(), WP_BK_VERSION_NUM ); | |
| 340 | - wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_src/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM ); | |
| 341 | - wp_enqueue_style( 'wpbc-admin-modal-popups', wpbc_plugin_url( '/css/modal.css' ), array(), WP_BK_VERSION_NUM ); | |
| 342 | - wp_enqueue_style( 'wpbc-admin-pages', wpbc_plugin_url( '/css/admin.css' ), array(), WP_BK_VERSION_NUM ); | |
| 343 | - wp_enqueue_style( 'wpbc-admin-skin', wpbc_plugin_url( '/css/admin-skin.css' ), array( 'wpbc-admin-pages' ), WP_BK_VERSION_NUM ); // FixIn: 8.0.2.4. | |
| 344 | - //if ( 'legacy' != get_bk_option( 'booking_admin_panel_skin' ) ) { // FixIn: 9.5.5.7. | |
| 345 | - wp_enqueue_style( 'wpbc-admin-skin-modern_1', wpbc_plugin_url( '/css/admin-skin-modern_1.css' ), array( 'wpbc-admin-skin' ), WP_BK_VERSION_NUM ); // FixIn: 9.5.5.1. | |
| 346 | - //} | |
| 333 | + wp_enqueue_style( 'wpbc-admin-support', wpbc_plugin_url( '/core/any/css/admin-support.css' ), array(), WP_BK_VERSION_NUM ); | |
| 334 | + wp_enqueue_style( 'wpbc-admin-menu', wpbc_plugin_url( '/core/any/css/admin-menu.css' ), array(), WP_BK_VERSION_NUM ); | |
| 335 | + // wp_enqueue_style( 'wpbc-admin-toolbar', wpbc_plugin_url( '/core/any/css/admin-toolbar.css' ), array(), WP_BK_VERSION_NUM ); // . | |
| 336 | + wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM ); | |
| 337 | + wp_enqueue_style( 'wpbc-admin-modal-popups', wpbc_plugin_url( '/css/modal.css' ), array(), WP_BK_VERSION_NUM ); | |
| 338 | + wp_enqueue_style( 'wpbc-admin-pages', wpbc_plugin_url( '/css/admin.css' ), array(), WP_BK_VERSION_NUM ); | |
| 339 | + wp_enqueue_style( 'wpbc-admin-skin', wpbc_plugin_url( '/css/admin-skin.css' ), array( 'wpbc-admin-pages' ), WP_BK_VERSION_NUM ); // FixIn: 8.0.2.4. | |
| 340 | +} | |
| 341 | + | |
| 342 | +/** | |
| 343 | + * Load only the modal assets required by front-end popup shortcodes. | |
| 344 | + * | |
| 345 | + * This intentionally avoids the broader admin helper above, because front-end | |
| 346 | + * pages should not receive admin page/menu styles when only a modal booking | |
| 347 | + * form is needed. | |
| 348 | + * | |
| 349 | + * @return void | |
| 350 | + */ | |
| 351 | +function wpbc_load_js__required_for_front_end_modals() { | |
| 352 | + | |
| 353 | + // JS for opening modals. | |
| 354 | + wp_enqueue_script( 'wpbc-modal', wpbc_plugin_url( '/vendors/_custom/dropdown_modal/_out/dropdown_modal.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); // FixIn: 9.8.1. | |
| 355 | + | |
| 356 | + // Base Bootstrap CSS is already loaded by Booking Calendar in normal front-end rendering. | |
| 357 | + if ( ! wp_style_is( 'wpdevelop-bts', 'enqueued' ) && ! wp_style_is( 'wpdevelop-bts', 'done' ) ) { | |
| 358 | + wp_enqueue_style( 'wpdevelop-bts', wpbc_plugin_url( '/vendors/_custom/bootstrap-css/css/bootstrap.css' ), array(), WP_BK_VERSION_NUM ); // FixIn: 9.8.1. | |
| 359 | + } | |
| 360 | + if ( ! wp_style_is( 'wpdevelop-bts-theme', 'enqueued' ) && ! wp_style_is( 'wpdevelop-bts-theme', 'done' ) ) { | |
| 361 | + wp_enqueue_style( 'wpdevelop-bts-theme', wpbc_plugin_url( '/vendors/_custom/bootstrap-css/css/bootstrap-theme.css' ), array(), WP_BK_VERSION_NUM ); // FixIn: 9.8.1. | |
| 362 | + } | |
| 363 | + | |
| 364 | + wp_enqueue_style( 'wpbc-admin-modal-popups', wpbc_plugin_url( '/css/modal.css' ), array(), WP_BK_VERSION_NUM ); | |
| 347 | 365 | } |
| 348 | 366 | |
| 349 | 367 | |
| 350 | 368 | /** |