/** * Define HOOKs for loading CSS and JavaScript files */ public function init_load_css_js_tpl() { // Load only at specific Page if ( wpbc_is_setup_wizard_page() ) { add_action( 'wpbc_enqueue_js_files', array( $this, 'js_load_files' ), 50 ); add_action( 'wpbc_enqueue_css_files', array( $this, 'enqueue_css_files' ), 50 ); add_action( 'wpbc_hook_settings_page_footer', array( $this, 'hook__load_templates_at_footer' ) ); } } /** JS */ public function js_load_files( $where_to_load ) { $in_footer = true; if ( wpbc_is_setup_wizard_page() ){ wp_enqueue_script( 'wpbc_all', wpbc_plugin_url( '/_dist/all/_out/wpbc_all.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); 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 ) ); 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 ) ); wp_enqueue_script( 'wpbc-settings_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_obj.js', array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer ); wp_enqueue_script( 'wpbc-setup_wizard_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_obj.js', array( 'wpbc-settings_obj' ), WP_BK_VERSION_NUM, $in_footer ); wp_enqueue_script( 'wpbc-setup_wizard_show', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_show.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer ); wp_enqueue_script( 'wpbc-setup_wizard_ajax', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_ajax.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer ); wp_enqueue_script( 'wpbc-availability-timeslots-page', wpbc_plugin_url( '/includes/page-availability-timeslots/_out/availability_timeslots_page.js' ), array( 'jquery', 'wpbc_all', 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); wp_localize_script( 'wpbc-availability-timeslots-page', 'wpbc_availability_timeslots_page', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wpbc_availability_timeslots_ajax_nonce' ), 'i18n' => array( 'select_slots_first' => __( 'Select one or more time ranges first.', 'booking' ), 'block_success' => __( 'Selected time ranges have been blocked.', 'booking' ), 'unblock_success' => __( 'Selected time ranges have been unblocked.', 'booking' ), 'save_error' => __( 'Unable to save time-slot availability.', 'booking' ), 'loading' => __( 'Loading', 'booking' ), 'open_booking' => __( 'Open booking in Booking Listing', 'booking' ), 'open_availability_rule' => __( 'Open availability settings', 'booking' ), 'select_one_slot_for_booking' => __( 'Select one time range on one date first.', 'booking' ), 'add_booking_modal_missing' => __( 'Add Booking popup is not available on this page.', 'booking' ), 'saving' => __( 'Saving', 'booking' ), ), ) ); } } /** CSS */ public function enqueue_css_files( $where_to_load ) { if ( wpbc_is_setup_wizard_page() ){ wp_enqueue_style( 'wpbc-setup_wizard_page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_page.css', array(), WP_BK_VERSION_NUM ); wp_enqueue_style( 'wpbc-availability-general-page', wpbc_plugin_url( '/includes/page-availability-general/_out/availability_general_page.css' ), array( 'wpbc-calendar', 'wpbc-all-admin' ), WP_BK_VERSION_NUM ); wp_enqueue_style( 'wpbc-availability-timeslots-page', wpbc_plugin_url( '/includes/page-availability-timeslots/_out/availability_timeslots_page.css' ), array( 'wpbc-calendar', 'wpbc-all-admin' ), WP_BK_VERSION_NUM ); } } // // /** * Load Templates at footer of page * * @param $page string */ public function hook__load_templates_at_footer( $page ){ // Hook from ../includes/page-setup/setup__page.php if ( 'wpbc-ajx_booking_setup_wizard' === $page ) { $this->wpbc_template__stp_wiz__main_content(); wpbc_stp_wiz__template__welcome(); wpbc_stp_wiz__template__general_info(); wpbc_stp_wiz__template__date_time_formats(); wpbc_stp_wiz__template__bookings_types(); $this->wpbc_template__stp_wiz__left_navigation(); $this->wpbc_template__stp_wiz__left_navigation_item(); $this->wpbc_template__timeline_steps(); $this->wpbc_template__timeline_steps_icons(); $this->wpbc_template__stp_wiz__footer_buttons(); } } // ============================================================================================================= // == Templates == // ============================================================================================================= /** * Template - Page Container * * Help Tips: * * * * var template__var = wp.template( 'template_name_a' ); * * jQuery( '.content' ).html( template__var( { 'test_key' => 'Data' } ) ); * * @return void */ private function wpbc_template__stp_wiz__main_content() { ?>'; ?> {{{ template__main_section( data ) }}} <# if ( false !== data.steps[ data.current_step ][ 'show_section_right' ] ) { #>
test_right_widget(); ?>
<# } #> <# var wpbc_template__stp_wiz__footer_buttons = wp.template( 'wpbc_template__stp_wiz__footer_buttons' ); #> * Escaped: {{data.test_key}} * HTML: {{{data.test_key}}} * JS: <# if (true) { alert( 1 ); } #> * * * var template__var = wp.template( 'template_name_a' ); * * jQuery( '.content' ).html( template__var( { 'test_key' => 'Data' } ) ); * * @return void */ private function wpbc_template__stp_wiz__left_navigation() { ?> * Escaped: {{data.test_key}} * HTML: {{{data.test_key}}} * JS: <# if (true) { alert( 1 ); } #> * * * var template__var = wp.template( 'template_name_a' ); * * jQuery( '.content' ).html( template__var( { 'test_key' => 'Data' } ) ); * * @return void */ private function wpbc_template__stp_wiz__left_navigation_item() { ?>
Calendar Skin
} /** * Just for loading CSS and JavaScript files */ if ( true ) { $wpbc_setup_wizard_page_loading = new WPBC_AJX__Setup_Wizard__Templates; $wpbc_setup_wizard_page_loading->init_load_css_js_tpl(); }