本文整理汇总了PHP中GUMP::get_key_and_value_errors方法的典型用法代码示例。如果您正苦于以下问题:PHP GUMP::get_key_and_value_errors方法的具体用法?PHP GUMP::get_key_and_value_errors怎么用?PHP GUMP::get_key_and_value_errors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GUMP
的用法示例。
在下文中一共展示了GUMP::get_key_and_value_errors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_rooms_and_guest_info
public function save_rooms_and_guest_info()
{
if (defined('DOING_AJAX') && DOING_AJAX && $_POST) {
$data = $_POST;
if (is_rooms_exists_on_booking($data['room_ID'], $data['booking_ID'], $data['booking_room_ID'])) {
wp_send_json_error(array('message' => 'Room already exists'));
} else {
require_class('gump.class.php');
$gump = new GUMP();
$data['room_type_ID'] = get_room_type($data['room_ID'])->ID;
$data = $gump->sanitize($data);
$gump->validation_rules(array('guest' => 'required|min_len,1|max_len,100', 'room_ID' => 'required|numeric', 'room_type_ID' => 'required|numeric', 'no_of_adult' => 'required|numeric', 'no_of_child' => 'numeric', 'date_in' => 'required|date', 'date_out' => 'required|date'));
if ($gump->run($data) !== false) {
if (in_array(get_booking_status($data['booking_ID']), array('NEW'))) {
wp_send_json_error(array('message' => 'You can\'t add room while booking is not confirmed.'));
} else {
if (is_room_available($data['room_ID'], $data['date_in'], $data['booking_room_ID']) == 0) {
$error['date_in'] = 'Selected room is not available on that date. Please check calendar to see availability.';
javacript_notices($error, '#roomsAndGuestInfoForm');
wp_send_json_error(array('js' => print_javascript_notices(false)));
} else {
if (do_save_rooms_and_guest_info($data) !== false) {
wp_send_json_success(array('message' => 'Successfully saved.'));
} else {
wp_send_json_error(array('message' => 'Error while saving.'));
}
}
}
} else {
javacript_notices($gump->get_key_and_value_errors(true), '#roomsAndGuestInfoForm');
wp_send_json_error(array('js' => print_javascript_notices(false)));
}
}
exit;
}
}