Пример #1
0
                foreach ($holidays as $holiday) {
                    $type_holiday = get_post_meta($holiday, 'type_holiday', true);
                    $data_holiday = AvailabilityHelper::_getdataHolidayEachDate($holiday, strtotime($check_in), strtotime($check_in));
                    $booking_period = intval(get_post_meta($holiday, 'holidays_booking_period', true));
                    if (is_array($data_holiday) && count($data_holiday)) {
                        $full = 0;
                        foreach ($data_holiday as $key => $val) {
                            $period = TravelHelper::dateDiff($today, date('Y-m-d', $val->check_in));
                            if ($val->status != 'available' || $period < $booking_period) {
                                $full += 1;
                            }
                        }
                        if ($full == count($data_holiday)) {
                            $results[] = $holiday;
                        }
                    } else {
                        if ($type_holiday != 'daily_holiday') {
                            $results[] = $holiday;
                        }
                    }
                }
            }
            if (count($results)) {
                $cant_book = array_unique(array_merge($cant_book, $results));
            }
            return $cant_book;
        }
    }
    $holidayhelper = new HolidayHelper();
    $holidayhelper->init();
}