PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | includes/_tour/wpbc_tour.php +30 -21 10.10 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package Tour
@@ -153,12 +153,11 @@
153 153 $in_footer = true;
154 154
155 155 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
156 156
157 - wp_enqueue_script( 'wpbc_tether', wpbc_plugin_url( '/assets/libs/tether/tether.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, $in_footer );
158 - wp_enqueue_script( 'wpbc_shepherd', wpbc_plugin_url( '/assets/libs/tether-shepherd/shepherd.js' ), array( 'wpbc_tether' ), WP_BK_VERSION_NUM, $in_footer );
157 + wp_enqueue_script( 'wpbc_tether', wpbc_plugin_url( '/vendors/tether/tether.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, $in_footer );
158 + wp_enqueue_script( 'wpbc_shepherd', wpbc_plugin_url( '/vendors/tether-shepherd/shepherd.js' ), array( 'wpbc_tether' ), WP_BK_VERSION_NUM, $in_footer );
159 159 wp_enqueue_script( 'wpbc_tour_01', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/wpbc_tour.js', array( 'wpbc_shepherd' ), WP_BK_VERSION_NUM, $in_footer );
160 - //wp_enqueue_script( 'wpbc_shepherd', wpbc_plugin_url( '/assets/libs/shepherd.js/dist/esm/shepherd.mjs' ) , array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
161 160
162 161 $tour_data = array(
163 162 'plugins_page' => array(
164 163 /* translators: 1: ... */
@@ -165,9 +164,9 @@
165 164 'title' => sprintf( __( 'Welcome to %s', 'booking' ), '<strong>WP Booking Calendar</strong>' ),
166 165 'text' => sprintf( __('We\'ll guide you through the steps to set up WP Booking Calendar on your site.','booking'), '<strong>WP Booking Calendar</strong>' ),
167 166 'button' => array(
168 167 'text' => __( 'Let\'s go', 'booking' ),
169 - 'url' => wpbc_get_setup_wizard_page_url() // URL to start new Guide: wpbc_get_settings_url() . '&wpbc_setup_wizard=reset&_wpnonce=' . wp_create_nonce( 'wpbc_settings_url_nonce' )
168 + 'url' => wpbc_get_setup_wizard_page_url(),
170 169 )
171 170 ),
172 171 'setup_page' => array(
173 172 'title' => 'Step 1 / 10',
@@ -184,14 +183,8 @@
184 183 public function enqueue_css_files( $where_to_load ) {
185 184
186 185 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
187 186
188 - //wp_enqueue_style( 'wpbc-tour_01', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/tour.css', array(), WP_BK_VERSION_NUM );
189 - // wp_enqueue_style( 'wpbc_tour_01', wpbc_plugin_url('assets/libs/shepherd.js/dist/css/shepherd.css'), array(), WP_BK_VERSION_NUM );
190 - // wp_enqueue_style( 'wpbc_shepherd', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/tether-shepherd/shepherd-theme-arrows-plain-buttons.css', array(), WP_BK_VERSION_NUM );
191 - //wp_enqueue_style( 'wpbc_shepherd', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/tether-shepherd/shepherd-theme-dark.css', array(), WP_BK_VERSION_NUM );
192 - //wp_enqueue_style( 'wpbc_shepherd', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/tether-shepherd/shepherd-theme-arrows.css', array(), WP_BK_VERSION_NUM );
193 -
194 187 wp_enqueue_style( 'wpbc_tour_01', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/wpbc-tour.css', array(), WP_BK_VERSION_NUM );
195 188
196 189 }
197 190 }
@@ -197,15 +190,31 @@
197 190 }
198 191 }
199 192
200 193
201 -/**
202 - * Just for loading CSS and JavaScript files and define Ajax hook
203 - */
204 -if (
205 - ( ! wpbc_is_this_demo() ) &&
206 - ( wpbc_setup_wizard_page__is_need_start() ) &&
207 - ( wpbc_is_user_can_access_wizard_page() )
208 -) {
209 - $js_css_loading = new WPBC_Tour_01;
210 - $js_css_loading->init_load_css_js();
211 -}
194 +/**
195 + * Initialize Setup Wizard tour assets after WordPress bootstrap is ready.
196 + *
197 + * The tour eligibility check reads Setup Wizard route state and, in MultiUser,
198 + * the current WordPress user. Running it while this file is included is too
199 + * early because pluggable current-user functions and just-in-time translation
200 + * loading are not guaranteed until `init`.
201 + *
202 + * @return void
203 + */
204 +function wpbc_tour_maybe_initialize_setup_wizard_tour() {
205 +
206 + if (
207 + ! is_admin()
208 + || wpbc_is_this_demo()
209 + || ! class_exists( 'WPBC_Setup_Wizard_First_Run_Launcher' )
210 + || ! class_exists( 'WPBC_Setup_Wizard_Access' )
211 + || ! WPBC_Setup_Wizard_First_Run_Launcher::is_prompt_pending()
212 + || ! WPBC_Setup_Wizard_Access::current_user_can_access()
213 + ) {
214 + return;
215 + }
216 +
217 + $wpbc_js_css_loading = new WPBC_Tour_01();
218 + $wpbc_js_css_loading->init_load_css_js();
219 +}
220 +add_action( 'init', 'wpbc_tour_maybe_initialize_setup_wizard_tour', 20 );