Exemplo n.º 1
0
                $st_province = get_user_meta($user_id, 'st_province', true);
                $st_zip_code = get_user_meta($user_id, 'st_zip_code', true);
                $st_country = get_user_meta($user_id, 'st_country', true);
            }
            $terms_link = '<a target="_blank" href="' . get_the_permalink(st()->get_option('page_terms_conditions')) . '">' . st_get_language('terms_and_conditions') . '</a>';
            $checkout_form_fields = array('st_first_name' => array('label' => st_get_language('first_name'), 'icon' => 'fa-user', 'value' => STInput::post('st_first_name', $first_name), 'validate' => 'required|trim|strip_tags'), 'st_last_name' => array('label' => st_get_language('last_name'), 'placeholder' => st_get_language('last_name'), 'validate' => 'required|trim|strip_tags', 'icon' => 'fa-user', 'value' => STInput::post('st_last_name', $last_name)), 'st_email' => array('label' => st_get_language('Email'), 'placeholder' => st_get_language('email_domain'), 'type' => 'text', 'validate' => 'required|trim|strip_tags|valid_email', 'value' => STInput::post('st_email', $user_email), 'icon' => 'fa-envelope'), 'st_phone' => array('label' => st_get_language('Phone'), 'placeholder' => st_get_language('Your_Phone'), 'validate' => 'required|trim|strip_tags', 'icon' => 'fa-phone', 'value' => STInput::post('st_phone', $st_phone)), 'st_address' => array('label' => st_get_language('address_line_1'), 'placeholder' => st_get_language('your_address_line_1'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_address', $st_address)), 'st_address2' => array('label' => st_get_language('address_line_2'), 'placeholder' => st_get_language('your_address_line_2'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_address2', $st_address2)), 'st_city' => array('label' => st_get_language('city'), 'placeholder' => st_get_language('your_city'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_city', $st_city)), 'st_province' => array('label' => st_get_language('state_province_region'), 'placeholder' => st_get_language('state_province_region'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_province', $st_province)), 'st_zip_code' => array('label' => st_get_language('zip_postal_code'), 'placeholder' => st_get_language('zip_postal_code'), 'icon' => 'fa-map-marker', 'value' => STInput::post('st_zip_code', $st_zip_code)), 'st_country' => array('label' => st_get_language('country'), 'icon' => 'fa-globe', 'value' => STInput::post('st_country', $st_country)), 'st_note' => array('label' => st_get_language('special_requirements'), 'icon' => false, 'type' => 'textarea', 'size' => 12, 'value' => STInput::post('st_note'), 'attrs' => array('rows' => 6)));
            $checkout_form_fields = apply_filters('st_booking_form_fields', $checkout_form_fields);
            return $checkout_form_fields;
        }
        /**
         * return the current booking id, if hotel is booked return the room_id
         *
         * @todo get the current booking id, if hotel is booked return the room_id
         */
        static function get_booking_id()
        {
            $cart = self::get_carts();
            if (!empty($cart)) {
                foreach ($cart as $key => $value) {
                    $item_id = $key;
                    $data = isset($value['data']) ? $value['data'] : array();
                    if ($data['st_booking_post_type'] == 'st_hotel' and isset($data['room_id'])) {
                        $item_id = $data['room_id'];
                    }
                    return apply_filters('st_cart_booking_' . $data['st_booking_post_type'] . '_id', $item_id, $value, $key);
                }
            }
        }
    }
    STCart::init();
}