403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.229
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/poseidon-gagra.ru/wp-content/plugins/awebooking/inc/Core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/poseidon-gagra.ru/wp-content/plugins/awebooking/inc/Core//hotels.php
<?php

use AweBooking\Constants;
use AweBooking\Model\Hotel;

/**
 * Retrieves the hotel object.
 *
 * @param  mixed $hotel The hotel ID.
 * @return \AweBooking\Model\Hotel|false|null
 */
function abrs_get_hotel( $hotel = 0 ) {
	if ( is_int( $hotel ) && 0 === (int) $hotel ) {
		return abrs_get_primary_hotel();
	}

	return abrs_rescue( function() use ( $hotel ) {
		$hotel = new Hotel( $hotel );

		return $hotel->exists() ? $hotel : null;
	}, false );
}

/**
 * Returns the default hotel.
 *
 * @return \AweBooking\Model\Hotel
 */
function abrs_get_primary_hotel() {
	if ( abrs_multiple_hotels() ) {
		return new Hotel( abrs_get_page_id( 'primary_hotel' ) );
	}

	return new Hotel( 'default' );
}

/**
 * Gets all hotels.
 *
 * @param array $args         Optional, the WP_Query args.
 * @return \AweBooking\Support\Collection
 */
function abrs_list_hotels( $args = [] ) {
	$args = wp_parse_args( $args, apply_filters( 'abrs_query_hotels_args', [
		'post_type'      => Constants::HOTEL_LOCATION,
		'post_status'    => 'publish',
		'posts_per_page' => 500, // Limit max 500.
		'order'          => 'ASC',
		'orderby'        => 'menu_order',
	] ) );

	$wp_query = new WP_Query( $args );

	return abrs_collect( $wp_query->posts )
		->map_into( Hotel::class );
}

/**
 * Returns un-mapped room types ids (used in settings).
 *
 * @param  int $limit Max number of room types. Defaults to -1 (no limit).
 * @return array
 */
function abrs_get_orphan_room_types( $limit = -1 ) {
	return get_posts( [
		'post_type'      => Constants::ROOM_TYPE,
		'post_status'    => 'any',
		'fields'         => 'ids',
		'posts_per_page' => $limit,
		'nopaging'       => $limit <= 0,
		'meta_query' => [
			[
				'key'     => '_hotel_id',
				'value'   => wp_list_pluck( get_pages( [ 'post_type' => Constants::HOTEL_LOCATION ] ), 'ID' ),
				'compare' => 'NOT IN',
			],
		],
	] );
}

/**
 * Reuturns WP_Query of room types by hotel.
 *
 * @param int $hotel_id The hotel ID.
 *
 * @return \WP_Query
 */
function abrs_get_room_types_by_hotel( $hotel_id ) {
	return new WP_Query( [
		'post_type'      => Constants::ROOM_TYPE,
		'post_status'    => 'publish',
		'posts_per_page' => - 1,
		'meta_query'     => [
			[
				'key'     => '_hotel_id',
				'value'   => $hotel_id,
				'compare' => '=',
			],
		],
	] );
}

Youez - 2016 - github.com/yon3zu
LinuXploit