public static function _class_init()
 {
     parent::_class_init();
     $file = array('travel-helper', 'class/class.cart', 'admin/class.stadmin', 'st.customvc', 'helpers/st-languages', 'class/class.travelobject', 'class/class.hotel', 'class/class.room', 'class/class.review', 'class/class.order', 'st.customvc', 'class/class.hotel', 'helpers/class.validate');
     $file2 = array('class/class.payment_gateways', 'class/class.user', 'class/class.location', 'class/class.cars', 'class/class.tour', 'class/class.holiday', 'class/class.rental', 'class/class.cruise', 'class/class.cabin', 'class/class.activity', 'class/class.coupon', 'class/class.featured', 'class/class.woocommerce', 'helpers/class.date', 'helpers/class.social.login', 'helpers/class.analytics', 'helpers/class.cool-captcha', 'plugins/custom-option-tree/custom-option-tree', 'plugins/custom-option-tree/st-list-item-post-type', 'plugins/custom-option-tree/st-timepicker-field', 'plugins/custom-select-post/custom-select-post', 'helpers/class.iconpicker', 'helpers/st-car-helpers', 'plugins/ot-custom/ot-custom', 'helpers/database.helper', 'helpers/availability.helper', 'helpers/hotel.helper', 'helpers/rental.helper', 'helpers/tour.helper', 'helpers/holiday.helper', 'helpers/activity.helper', 'helpers/car.helper', 'helpers/validate.woo.checkout', 'helpers/validate.normal.checkout', 'helpers/price.helper', 'helpers/partner.booking.helper');
     self::load_libs($file);
     self::load_paypal_libraries();
     self::load_libs($file2);
     self::_load_abstract();
     self::_load_modules();
     self::$booking_type = apply_filters('st_booking_post_type', array('st_hotel', 'st_activity', 'st_tours', 'st_holidays', 'st_cars', 'st_rental'));
     if (function_exists('st_reg_post_type') and function_exists('st_reg_taxonomy')) {
         add_action('init', array(__CLASS__, 'st_attribute_to_taxonomy'));
         add_action('init', array(__CLASS__, 'st_location_init'));
         add_action('init', array(__CLASS__, 'st_order_init'));
     }
     if (function_exists('st_reg_shortcode')) {
         /**
          * Load widget, shortcodes and vc elements. No need use it from plugins
          *
          *
          * @since 1.0.7
          * */
         self::loadWidgets();
         add_action('init', array(__CLASS__, 'loadShortCodes'), 30);
         if (class_exists('Vc_Manager')) {
             add_action('init', array(__CLASS__, 'loadVcElements'), 30);
         }
     }
 }
 function __construct()
 {
     if (self::$_is_inited) {
         return;
     }
     self::$_is_inited = true;
     $this->plugin_name = 'traveler-code';
     parent::__construct();
     $file = array('travel-helper', 'admin/class.stadmin', 'st.customvc', 'helpers/st-languages', 'class/class.travelobject', 'class/class.hotel', 'class/class.room', 'class/class.review', 'class/class.order', 'st.customvc', 'class/class.hotel', 'helpers/class.validate', 'class/class.payment_gateways', 'class/class.cart', 'class/class.paypal', 'class/class.user', 'class/class.location', 'class/class.cars', 'class/class.tour', 'class/class.rental', 'class/class.cruise', 'class/class.cabin', 'class/class.activity', 'class/class.coupon', 'class/class.featured', 'class/class.woocommerce', 'helpers/class.date', 'helpers/class.social.login', 'helpers/class.analytics', 'helpers/class.cool-captcha', 'plugins/custom-option-tree/custom-option-tree', 'plugins/custom-select-post/custom-select-post', 'helpers/class.iconpicker', 'helpers/st-car-helpers');
     $this->load_libs($file);
     $this->_load_abstract();
     $this->_load_modules();
     self::$booking_type = apply_filters('st_booking_post_type', array('st_hotel', 'st_activity', 'st_tours', 'st_cars', 'st_rental'));
     if (function_exists('st_reg_post_type') and function_exists('st_reg_taxonomy')) {
         add_action('init', array($this, 'st_attribute_to_taxonomy'));
         add_action('init', array($this, 'st_location_init'));
         add_action('init', array($this, 'st_order_init'));
     }
     if (function_exists('st_reg_shortcode')) {
         /**
          * Load widget, shortcodes and vc elements. No need use it from plugins
          *
          *
          * @since 1.0.7
          * */
         $this->loadWidgets();
         $this->loadShortCodes();
         if (class_exists('Vc_Manager')) {
             add_action('init', array($this, 'loadVcElements'), 20);
         }
     }
 }
Exemple #3
0
 /**
  * Init Session and register ajax action
  * @update 1.1.1
  * */
 static function init()
 {
     if (!session_id()) {
         session_start();
     }
     //Checkout Fields
     STTraveler::load_libs(array('helpers/st_checkout_fields'));
     add_action('wp_ajax_booking_form_submit', array(__CLASS__, 'ajax_submit_form'));
     add_action('wp_ajax_nopriv_booking_form_submit', array(__CLASS__, 'ajax_submit_form'));
     //add_action('st_email_after_booking',array(__CLASS__,'send_mail_after_booking'),100,2);
     //add_action('st_booking_submit_form_success',array(__CLASS__,'send_email_confirm'));
     add_action('init', array(__CLASS__, '_confirm_order'));
     add_action('init', array(__CLASS__, '_apply_coupon'));
     add_action('init', array(__CLASS__, '_remove_coupon'));
     if (STInput::post()) {
         add_action('init', array(__CLASS__, '_handle_form_submit'), 99999);
     }
 }
    function ot_type_product_select_ajax($args = array())
    {
        $booking_types = STTraveler::booking_type();
        $default = array('field_placeholder' => __('Search for a Product', ST_TEXTDOMAIN));
        $args = wp_parse_args($args, $default);
        extract($args);
        $post_type = $field_post_type;
        /* verify a description */
        $has_desc = $field_desc ? true : false;
        /* format setting outer wrapper */
        echo '<div class="format-setting type-post_select_ajax ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
        /* description */
        echo balanceTags($has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '');
        /* format setting inner wrapper */
        echo '<div class="format-setting-inner">';
        /* allow fields to be filtered */
        $post_select_ajax = apply_filters('ot_recognized_post_select_ajax_fields', $field_value, $field_id);
        $pl_name = '';
        $pl_desc = '';
        if ($field_value) {
            $user = get_userdata($field_value);
            if ($user) {
                $pl_name = $user->user_login . ' (#' . $user->ID . ' - ' . $user->user_email . ')';
                $pl_desc = "";
                //"ID: ".get_the_ID($field_value);
            }
        }
        $ids = explode(',', $field_value);
        $ids_str = array();
        if (!empty($ids)) {
            foreach ($ids as $key) {
                $ids_str[] = array('id' => $key, 'name' => get_post_type($key) . ' - ' . get_the_title($key), 'description' => get_post_meta($key, 'address', true));
            }
        }
        echo '<div class="option-tree-ui-user_select_ajax-input-wrap">';
        ?>
        <label ><?php 
        _e('Type:', ST_TEXTDOMAIN);
        ?>
</label>
        <br>
            <select class="" name="type">
                <?php 
        if (!empty($booking_types)) {
            ?>
                <?php 
            foreach ($booking_types as $key => $value) {
                if (post_type_exists($value)) {
                    $post_type_obj = get_post_type_object($value);
                    echo "<option value='{$value}' >{$post_type_obj->labels->singular_name}</option>";
                }
            }
        }
        ?>
            </select>
        <br>
        <label><?php 
        _e('Product: ', ST_TEXTDOMAIN);
        ?>
</label>
        <?php 
        echo "<input data-old='" . esc_attr(json_encode($ids_str)) . "' data-placeholder='{$field_placeholder}' value='{$field_value}' data-post-type='{$post_type}' type=hidden class='st_product_select_ajax' id='" . esc_attr($field_id) . "' name='" . esc_attr($field_name) . "'/>";
        echo '</div>';
        echo '</div>';
        echo '</div>';
    }
 static function _load_default_gateways()
 {
     $path = STTraveler::dir('gateways');
     $results = scandir($path);
     foreach ($results as $result) {
         if ($result === '.' or $result === '..') {
             continue;
         }
         if (is_dir($path . '/' . $result)) {
             $file = $path . '/' . $result . '/' . $result . '.php';
             if (file_exists($file)) {
                 include_once $file;
             }
         }
     }
 }
 static function _get_metabox_booking_types()
 {
     $booking_types = STTraveler::booking_type();
     $r = array();
     if (!empty($booking_types)) {
         foreach ($booking_types as $key => $value) {
             if (post_type_exists($value)) {
                 $post_type_obj = get_post_type_object($value);
                 $r[] = array('label' => $post_type_obj->labels->singular_name, 'value' => $value);
             }
         }
     }
     return $r;
 }
 function init()
 {
     $files = array('admin/class.user', 'admin/class.admin.menus', 'admin/class.attributes', 'admin/class.admin.hotel', 'admin/class.admin.room', 'admin/class.admin.rental', 'admin/class.admin.cars', 'admin/class.admin.tours', 'admin/class.admin.holidays', 'admin/class.admin.activity', 'admin/class.admin.location', 'admin/class.admin.order', 'admin/class.admin.permalink', 'admin/class.admin.uploadfonticon', 'admin/class.admin.update.content', 'admin/class.admin.woo.checkout', 'admin/class.admin.normal.checkout', 'admin/class.admin.rental.room', 'admin/class.admin.duplicate.data', 'admin/class.admin.neworder.data', 'admin/class.admin.availability', 'admin/class.admin.landing.page');
     STTraveler::load_libs($files);
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('save_post', array($this, 'update_location_info'));
     add_action('deleted_post', array($this, 'update_location_info'));
     add_action('admin_menu', array($this, 'st_create_custom_price'));
     add_action('save_post', array($this, 'st_save_custom_price'), 10, 2);
     add_action('init', array($this, 'st_register_location_tax'));
 }