function __construct()
 {
     add_action('init', array($this, '_reg_post_type'));
     if (!st_check_service_available($this->post_type)) {
         return;
     }
     //add colum for rooms
     add_filter('manage_st_rental_posts_columns', array($this, 'add_col_header'), 10);
     add_action('manage_st_rental_posts_custom_column', array($this, 'add_col_content'), 10, 2);
     self::$booking_page = admin_url('edit.php?post_type=st_rental&page=st_rental_booking');
     //rental Hook
     /*
      * todo Re-cal rental min price
      * */
     add_action('save_post', array($this, 'meta_update_sale_price'), 10, 4);
     add_action('admin_menu', array($this, 'new_menu_page'));
     //Check booking edit and redirect
     if (self::is_booking_page()) {
         add_action('admin_enqueue_scripts', array(__CLASS__, 'add_edit_scripts'));
         $section = isset($_GET['section']) ? $_GET['section'] : false;
         switch ($section) {
             case "edit_order_item":
                 $this->is_able_edit();
                 break;
             case "add_booking":
                 if (isset($_POST['submit']) and $_POST['submit']) {
                     $this->_add_booking();
                 }
                 break;
             case 'resend_email':
                 add_action('init', array($this, '_resend_mail'));
                 //$this->_resend_mail();
                 break;
         }
     }
     if (isset($_GET['send_mail']) and $_GET['send_mail'] == 'success') {
         self::set_message(__('Email sent', ST_TEXTDOMAIN), 'updated');
     }
     add_action('wp_ajax_st_room_select_ajax', array(__CLASS__, 'st_room_select_ajax'));
     add_action('init', array($this, '_add_metabox'));
     add_action('st_search_fields_name', array($this, 'get_search_fields_name'), 10, 2);
     parent::__construct();
 }
Ejemplo n.º 2
0
 function __construct()
 {
     add_action('init', array($this, '_reg_post_type'));
     if (!st_check_service_available($this->post_type)) {
         return;
     }
     //add colum for rooms
     add_filter('manage_st_rental_posts_columns', array($this, 'add_col_header'), 10);
     add_action('manage_st_rental_posts_custom_column', array($this, 'add_col_content'), 10, 2);
     self::$booking_page = admin_url('edit.php?post_type=st_rental&page=st_rental_booking');
     //rental Hook
     /*
      * todo Re-cal rental min price
      * */
     add_action('save_post', array($this, 'meta_update_sale_price'), 10, 4);
     add_action('admin_menu', array($this, 'new_menu_page'));
     //Check booking edit and redirect
     if (self::is_booking_page()) {
         add_action('admin_enqueue_scripts', array(__CLASS__, 'add_edit_scripts'));
         add_action('admin_init', array($this, '_do_save_booking'));
     }
     if (isset($_GET['send_mail']) and $_GET['send_mail'] == 'success') {
         self::set_message(__('Email sent', ST_TEXTDOMAIN), 'updated');
     }
     add_action('wp_ajax_st_room_select_ajax', array(__CLASS__, 'st_room_select_ajax'));
     add_action('init', array($this, '_add_metabox'));
     add_action('st_search_fields_name', array($this, 'get_search_fields_name'), 10, 2);
     /**
      *@since 1.1.6
      **/
     add_action('save_post', array($this, '_update_list_location'), 50, 2);
     add_action('save_post', array($this, '_update_duplicate_data'), 50, 2);
     add_action('before_delete_post', array($this, '_delete_data'), 50);
     parent::__construct();
     add_action('wp_ajax_st_getRentalInfo', array(__CLASS__, 'getRentalInfo'), 9999);
 }