Exemple #1
0
 function add_scripts()
 {
     if (TravelHelper::is_https()) {
         wp_register_script('gmap-api', 'https://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
     } else {
         wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
     }
     wp_register_script('gmapv3', $this->_url . 'js/gmap3.min.js', array('jquery', 'gmap-api'), false, true);
     wp_register_script('bt-gmapv3-init', $this->_url . 'js/init.js', array('gmapv3'), false, true);
     wp_register_style('bt-gmapv3', $this->_url . 'css/bt-gmap.css');
 }
 function st_add_scripts()
 {
     if (is_singular()) {
         wp_enqueue_script('comment');
         wp_enqueue_script('comment-reply');
         wp_enqueue_script('st-reviews-form', get_template_directory_uri() . '/js/init/review_form.js', array('jquery'), null, true);
     }
     wp_enqueue_script('bootstrap-traveler', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), null, true);
     wp_enqueue_script('slimmenu', get_template_directory_uri() . '/js/slimmenu.js', array('jquery'), null, true);
     wp_enqueue_script('bootstrap-datepicker.js', get_template_directory_uri() . '/js/bootstrap-datepicker.js', array('jquery'), null, true);
     wp_enqueue_script('bootstrap-timepicker.js', get_template_directory_uri() . '/js/bootstrap-timepicker.js', array('jquery'), null, true);
     wp_enqueue_script('jquery.form', get_template_directory_uri() . '/js/jquery.form.js', array('jquery'), null, true);
     wp_enqueue_script('ionrangeslider.js', get_template_directory_uri() . '/js/ionrangeslider.js', array('jquery'), null, true);
     wp_enqueue_script('icheck.js', get_template_directory_uri() . '/js/icheck.js', array('jquery'), null, true);
     wp_enqueue_script('fotorama.js', get_template_directory_uri() . '/js/fotorama.js', array('jquery'), null, true);
     wp_register_script('handlebars-v2.0.0.js', get_template_directory_uri() . '/js/handlebars-v2.0.0.js', array(), null, true);
     wp_enqueue_script('typeahead.js', get_template_directory_uri() . '/js/typeahead.js', array('jquery', 'handlebars-v2.0.0.js'), null, true);
     wp_enqueue_script('magnific.js', get_template_directory_uri() . '/js/magnific.js', array('jquery'), null, true);
     wp_enqueue_script('owl-carousel.js', get_template_directory_uri() . '/js/owl-carousel.js', array('jquery'), null, true);
     if (is_page_template('template-commingsoon.php')) {
         wp_enqueue_script('countdown.js', get_template_directory_uri() . '/js/countdown.js', array('jquery'), null, true);
     }
     if (is_page_template('template-user.php')) {
         if (TravelHelper::is_https()) {
             wp_enqueue_script('gmap-api', 'https://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
         } else {
             wp_enqueue_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
         }
         wp_enqueue_script('gmapv3', get_template_directory_uri() . '/inc/plugins/ot-custom/fields/gmap/js/gmap3.min.js', array('jquery', 'gmap-api'), false, true);
         wp_enqueue_script('bt-gmapv3-init', get_template_directory_uri() . '/inc/plugins/ot-custom/fields/gmap/js/init.js', array('gmapv3'), false, true);
         wp_enqueue_style('bt-gmapv3', get_template_directory_uri() . '/inc/plugins/ot-custom/fields/gmap/css/bt-gmap.css');
     }
     $locale = get_locale();
     if ($locale and $locale != 'en') {
         $date_picker_file = get_template_directory_uri() . '/js/locales/bootstrap-datepicker.' . $locale . '.js';
         $date_picker_file_path = get_template_directory() . '/js/locales/bootstrap-datepicker.' . $locale . '.js';
         if (!file_exists($date_picker_file_path)) {
             $locale_array = explode('_', $locale);
             if (!empty($locale_array) and $locale_array[0]) {
                 $locale = $locale_array[0];
             }
         }
         $date_picker_file = get_template_directory_uri() . '/js/locales/bootstrap-datepicker.' . $locale . '.js';
         $date_picker_file_path = get_template_directory() . '/js/locales/bootstrap-datepicker.' . $locale . '.js';
         if (file_exists($date_picker_file_path)) {
             // Datetime l10n
             wp_enqueue_script('bootstrap-datepicker-' . $locale . '.js', $date_picker_file, array('jquery'), null, true);
         }
     }
     wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js', array('jquery'), null, true);
     wp_register_script('gridrotator.js', get_template_directory_uri() . '/js/gridrotator.js', array('jquery'), null, true);
     if (TravelHelper::is_https()) {
         wp_enqueue_script('gmap-apiv3', 'https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places&sensor=false', array(), null, true);
     } else {
         wp_enqueue_script('gmap-apiv3', 'http://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places&sensor=false', array(), null, true);
     }
     wp_enqueue_script('markerclusterer.js', get_template_directory_uri() . '/js/markerclusterer.js', array('jquery'), null, true);
     wp_register_script('gmaplib', get_template_directory_uri() . '/js/gmap3.js', array('gmap-apiv3'), null, true);
     wp_register_script('gmap-init', get_template_directory_uri() . '/js/init/gmap-init.js', array('gmaplib'), null, true);
     wp_enqueue_script('gmap-init-list-map', get_template_directory_uri() . '/js/init/init-list-map.js', array('jquery'), null, true);
     wp_enqueue_script('gmap-info-box', get_template_directory_uri() . '/js/infobox.js', array('jquery'), null, true);
     wp_register_script('jquery.noty', get_template_directory_uri() . '/js/noty/packaged/jquery.noty.packaged.min.js', array('jquery'), null, true);
     wp_register_script('st.noty', get_template_directory_uri() . '/js/init/class.notice.js', array('jquery', 'jquery.noty'), null, true);
     if (is_singular()) {
         wp_enqueue_script('gmap-init');
     }
     wp_enqueue_script('hotel-ajax', get_template_directory_uri() . '/js/init/hotel-ajax.js', array('jquery'), null, true);
     wp_enqueue_script('booking_modal', get_template_directory_uri() . '/js/init/booking_modal.js', array('jquery'), null, true);
     wp_enqueue_script('chosen.jquery', get_template_directory_uri() . '/js/chosen/chosen.jquery.min.js', array('jquery'), null, true);
     wp_enqueue_script('st.noty');
     /**
      * @since 1.1.0
      **/
     if (get_post_type(get_the_ID()) == 'st_rental') {
         wp_enqueue_script('rental-js', get_template_directory_uri() . '/js/init/rental-date-ajax.js', array('jquery'), '1.1.0', true);
     }
     /**
      *@since 1.1.7
      **/
     if (is_singular('hotel_room') || is_singular('st_rental') || is_singular('st_tours') || is_singular('st_holidays')) {
         wp_enqueue_script('moment.js', get_template_directory_uri() . '/js/fullcalendar-2.4.0/lib/moment.min.js', array('jquery'), NULL, TRUE);
         wp_enqueue_script('fullcalendar', get_template_directory_uri() . '/js/fullcalendar-2.4.0/fullcalendar.min.js', array('jquery'), NULL, TRUE);
         wp_enqueue_script('fullcalendar-lang', get_template_directory_uri() . '/js/fullcalendar-2.4.0/lang-all.js', array('jquery'), NULL, TRUE);
         wp_enqueue_style('fullcalendar', get_template_directory_uri() . '/js/fullcalendar-2.4.0/fullcalendar.min.css');
         wp_enqueue_style('availability', get_template_directory_uri() . '/css/availability.css');
     }
     if (is_singular('st_rental')) {
         wp_enqueue_script('single-rental-js', get_template_directory_uri() . '/js/init/single-rental.js', array('jquery', 'moment.js', 'fullcalendar', 'date.js', 'fullcalendar-lang'), '1.1.0', true);
     }
     if (is_singular('hotel_room')) {
         wp_enqueue_script('single-hotel-room-js', get_template_directory_uri() . '/js/init/single-hotel-room.js', array('jquery', 'moment.js', 'fullcalendar', 'date.js', 'fullcalendar-lang'), '1.1.0', true);
     }
     if (is_singular('st_hotel')) {
         wp_enqueue_script('single-hotel-js', get_template_directory_uri() . '/js/init/single-hotel.js', array('jquery'), '1.1.0', true);
     }
     if (is_singular('st_tours')) {
         wp_enqueue_script('st-qtip', get_template_directory_uri() . '/js/jquery.qtip.js', array('jquery'), null, true);
         wp_enqueue_script('single-tour-js', get_template_directory_uri() . '/js/init/single-tour.js', array('jquery'), '1.1.0', true);
     }
     if (is_singular('st_holidays')) {
         wp_enqueue_script('st-qtip', get_template_directory_uri() . '/js/jquery.qtip.js', array('jquery'), null, true);
         wp_enqueue_script('single-holiday-js', get_template_directory_uri() . '/js/init/single-holiday.js', array('jquery'), '1.1.0', true);
     }
     if (is_singular('st_activity')) {
         wp_enqueue_script('single-activity-js', get_template_directory_uri() . '/js/init/single-activity.js', array('jquery'), '1.1.0', true);
     }
     /**
      *@since 1.1.3
      **/
     wp_enqueue_script('date.js', get_template_directory_uri() . '/js/date.js', array('jquery'), null, true);
     wp_enqueue_script('mousewheel.js', get_template_directory_uri() . '/js/jquery.mousewheel-3.0.6.pack.js', array('jquery'), null, true);
     wp_enqueue_script('fancybox.js', get_template_directory_uri() . '/js/jquery.fancybox.js', array('jquery'), null, true);
     wp_enqueue_script('fancybox-buttons.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-buttons.js', array('jquery'), null, true);
     wp_enqueue_script('fancybox-media.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-media.js', array('jquery'), null, true);
     wp_enqueue_script('fancybox-thumbs.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-thumbs.js', array('jquery'), null, true);
     wp_enqueue_script('custom.js', get_template_directory_uri() . '/js/custom.js', array('jquery'), null, true);
     wp_enqueue_script('custom2.js', get_template_directory_uri() . '/js/custom2.js', array('jquery'), null, true);
     wp_enqueue_script('user.js', get_template_directory_uri() . '/js/user.js', array('jquery'), null, true);
     wp_enqueue_script('social-login.js', get_template_directory_uri() . '/js/init/social-login.js', array('jquery'), null, true);
     wp_enqueue_script('sst-select.js', get_template_directory_uri() . '/js/init/st-select.js', array('jquery'), null, true);
     wp_enqueue_script('jquery-sticky', get_template_directory_uri() . '/js/sticky.js', array('jquery'), null, true);
     if (is_page_template('template-checkout.php')) {
         wp_enqueue_script('checkout-js', get_template_directory_uri() . '/js/init/template-checkout.js', array('jquery'), null, true);
     }
     wp_localize_script('jquery', 'st_checkout_text', array('without_pp' => __('Submit Request', ST_TEXTDOMAIN), 'with_pp' => __('Booking Now', ST_TEXTDOMAIN), 'validate_form' => __('Please fill all required fields', ST_TEXTDOMAIN), 'error_accept_term' => __('Please accept our terms and conditions', ST_TEXTDOMAIN), 'adult_price' => __('Adult price', ST_TEXTDOMAIN), 'child_price' => __("Child price", ST_TEXTDOMAIN), 'infant_price' => __("Infant price", ST_TEXTDOMAIN), 'adult' => __("Adult", ST_TEXTDOMAIN), 'child' => __("Child", ST_TEXTDOMAIN), 'infant' => __("Infant", ST_TEXTDOMAIN), 'price' => __("Price", ST_TEXTDOMAIN), 'origin_price' => __("Origin Price", ST_TEXTDOMAIN)));
     wp_localize_script('jquery', 'st_params', array('theme_url' => get_template_directory_uri(), 'site_url' => site_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'loading_url' => admin_url('/images/wpspin_light.gif'), 'st_search_nonce' => wp_create_nonce("st_search_security"), 'facebook_enable' => st()->get_option('social_fb_login', 'on'), 'facbook_app_id' => st()->get_option('social_fb_app_id'), 'booking_currency_precision' => TravelHelper::get_current_currency('booking_currency_precision'), 'thousand_separator' => TravelHelper::get_current_currency('thousand_separator'), 'decimal_separator' => TravelHelper::get_current_currency('decimal_separator'), 'currency_symbol' => TravelHelper::get_current_currency('symbol'), 'currency_position' => TravelHelper::get_current_currency('booking_currency_pos'), 'currency_rtl_support' => TravelHelper::get_current_currency('currency_rtl_support'), 'free_text' => __('Free', ST_TEXTDOMAIN), 'date_format' => TravelHelper::getDateFormatJs(), 'time_format' => st()->get_option('time_format', '12h'), 'text_loading' => __("Loading...", ST_TEXTDOMAIN), 'mk_my_location' => get_template_directory_uri() . '/img/my_location.png', 'locale' => $locale, 'header_bgr' => st()->get_option('header_background', ''), 'text_refresh' => __("Refresh", ST_TEXTDOMAIN)));
     wp_localize_script('jquery', 'st_list_map_params', array('mk_my_location' => get_template_directory_uri() . '/img/my_location.png', 'text_my_location' => __("3000 m radius", ST_TEXTDOMAIN), 'text_no_result' => __("No Result", ST_TEXTDOMAIN)));
     wp_localize_script('jquery', 'st_config_partner', array('text_er_image_format' => false));
     if (st()->get_option('social_fb_login', 'on')) {
         //wp_enqueue_script('st-facebook',get_template_directory_uri().'/js/init/facebook.js',null,true);
     }
     //Allow turn on nicescroll
     if (st()->get_option('gen_enable_smscroll', 'off') == 'on') {
         wp_enqueue_script('nicescroll.js', get_template_directory_uri() . '/js/nicescroll.js', array('jquery'), null, true);
     }
     wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css');
     wp_enqueue_style('animate.css', get_template_directory_uri() . '/css/animate.css');
     wp_enqueue_style('fontawesome', get_template_directory_uri() . '/css/font-awesome.css');
     if (st_is_https()) {
         wp_enqueue_style('roboto-font', 'https://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
     } else {
         wp_enqueue_style('roboto-font', 'http://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
     }
     if (is_page_template('template-user.php')) {
         wp_enqueue_style('jquery.jqplot.min.css', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.min.css');
         wp_enqueue_style('shCoreDefault.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shCoreDefault.min.css');
         wp_enqueue_style('shThemejqPlot.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shThemejqPlot.min.css');
         wp_enqueue_script('jquery.jqplot.min.js', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.js', array('jquery'), null, true);
         wp_enqueue_script('shCore.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shCore.min.js', array('jquery'), null, true);
         wp_enqueue_script('shBrushJScript.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushJScript.min.js', array('jquery'), null, true);
         wp_enqueue_script('shBrushXml.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushXml.min.js', array('jquery'), null, true);
         wp_enqueue_script('jqplot.barRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.barRenderer.min.js', array('jquery'), null, true);
         wp_enqueue_script('jqplot.categoryAxisRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.categoryAxisRenderer.js', array('jquery'), null, true);
         wp_enqueue_script('jqplot.pointLabels.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.pointLabels.min.js', array('jquery'), null, true);
         wp_enqueue_script('jqplot.cursor.min', get_template_directory_uri() . '/js/jqplot/js/jqplot.cursor.min.js', array('jquery'), null, true);
         wp_enqueue_script('Chart.min.js', get_template_directory_uri() . '/inc/plugins/chart-master/Chart.js', array('jquery'), null, true);
     }
     wp_enqueue_script('jquery.scrollTo.min.js', get_template_directory_uri() . '/js/jquery.scrollTo.min.js', array('jquery'), null, true);
     wp_enqueue_style('icomoon.css', get_template_directory_uri() . '/css/icomoon.css');
     wp_enqueue_style('weather-icons.css', get_template_directory_uri() . '/css/weather-icons.min.css');
     wp_enqueue_style('styles.css', get_template_directory_uri() . '/css/styles.css');
     wp_enqueue_style('mystyles.css', get_template_directory_uri() . '/css/mystyles.css');
     wp_enqueue_style('tooltip-classic.css', get_template_directory_uri() . '/css/tooltip-classic.css');
     wp_enqueue_style('chosen-css', get_template_directory_uri() . '/js/chosen/chosen.min.css');
     wp_enqueue_style('default-style', get_stylesheet_uri());
     wp_enqueue_style('fancybox.css', get_template_directory_uri() . '/css/jquery.fancybox.css');
     wp_enqueue_style('fancybox-buttons.css', get_template_directory_uri() . '/js/helpers/jquery.fancybox-buttons.css');
     wp_enqueue_style('fancybox-thumbs.css', get_template_directory_uri() . '/js/helpers/jquery.fancybox-thumbs.css');
     wp_enqueue_style('custom.css', get_template_directory_uri() . '/css/custom.css');
     wp_enqueue_style('custom2css', get_template_directory_uri() . '/css/custom2.css');
     wp_enqueue_style('user.css', get_template_directory_uri() . '/css/user.css');
     wp_enqueue_style('custom-responsive', get_template_directory_uri() . '/css/custom-responsive.css');
     wp_enqueue_style('st-select.css', get_template_directory_uri() . '/css/st-select.css');
     // from 1.1.9 2nd menu
     wp_enqueue_style('menu_style2.css', get_template_directory_uri() . '/css/menu_style2.css');
     wp_enqueue_script('testimonial', get_template_directory_uri() . '/js/testimonial.js', array('jquery'), null, true);
     wp_enqueue_script('hover_effect_fix', get_template_directory_uri() . '/js/hover_effect.js', array('jquery'), null, true);
     wp_enqueue_style('hover_effect_demo', get_template_directory_uri() . '/css/hover_effect/demo.css');
     wp_enqueue_style('hover_effect_normal', get_template_directory_uri() . '/css/hover_effect/normalize.css');
     wp_enqueue_style('hover_effect_set1', get_template_directory_uri() . '/css/hover_effect/set1.css');
     wp_enqueue_style('hover_effect_set2', get_template_directory_uri() . '/css/hover_effect/set2.css');
     if (st()->get_option('right_to_left') == 'on') {
         wp_enqueue_style('rtl.css', get_template_directory_uri() . '/rtl.css');
     }
     $list_icon = get_option('st_list_fonticon_', array());
     if (is_array($list_icon) && count($list_icon)) {
         foreach ($list_icon as $item => $val) {
             wp_enqueue_style($item, $val['link_file_css']);
         }
     }
 }