✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server366.web-hosting.com ​🇻​♯➤ 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 67.223.118.204 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.243
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/motopress-hotel-booking/includes/entities//rate.php
<?php

namespace MPHB\Entities;

class Rate {

	/**
	 *
	 * @var int
	 */
	private $id;

	/**
	 *
	 * @var int
	 */
	private $originalId;

	/**
	 *
	 * @var string
	 */
	private $title;

	/**
	 *
	 * @var string
	 */
	private $description;

	/**
	 *
	 * @var int
	 */
	private $roomTypeId;

	/**
	 *
	 * @var SeasonPrice[]
	 */
	private $seasonPrices;

	/**
	 *
	 * @var bool
	 */
	private $active = false;

	/**
	 * Available dates (with base price as value).
	 *
	 * @var array
	 */
	private $dates = array();

	/**
	 *
	 * @param array         $atts Array of atts
	 * @param int           $atts['id'] Id of rate
	 * @param string        $atts['title'] Title of rate
	 * @param string        $atts['description'] Description of rate
	 * @param int           $atts['room_type_id'] Room Type ID
	 * @param SeasonPrice[] $atts['season_prices'] Array of Season Prices.
	 * @param bool          $atts['active'] Is rate available for user choosing.
	 */
	function __construct( $atts ) {
		$this->id           = $atts['id'];
		$this->originalId   = MPHB()->translation()->getOriginalId( $this->id, MPHB()->postTypes()->rate()->getPostType() );
		$this->title        = $atts['title'];
		$this->description  = $atts['description'];
		$this->roomTypeId   = $atts['room_type_id'];
		$this->seasonPrices = array_reverse( $atts['season_prices'] );
		$this->active       = $atts['active'];
		$this->dates        = $this->getDatePrices();
	}

	/**
	 *
	 * @return int Id of rate
	 */
	public function getId() {
		return $this->id;
	}

	/**
	 * @return int
	 */
	public function getOriginalId() {
		return $this->originalId;
	}

	/**
	 *
	 * @return string Title
	 */
	public function getTitle() {
		return $this->title;
	}

	/**
	 *
	 * @return string Description
	 */
	public function getDescription() {
		return $this->description;
	}

	/**
	 *
	 * @return SeasonPrice[] Array of season prices.
	 */
	public function getSeasonPrices() {
		return $this->seasonPrices;
	}

	/**
	 *
	 * @return int
	 */
	public function getRoomTypeId() {
		return $this->roomTypeId;
	}

	/**
	 *
	 * @param \DateTime $dateFrom
	 * @param \DateTime $dateTo
	 * @return bool
	 */
	public function isAvailableForDates( \DateTime $dateFrom, \DateTime $dateTo, $includeLastDate = false ) {

		$requestedPeriod = \MPHB\Utils\DateUtils::createDatePeriod( $dateFrom, $dateTo, $includeLastDate );

		$requestedDates   = array_map( array( '\MPHB\Utils\DateUtils', 'formatDateDB' ), iterator_to_array( $requestedPeriod ) );
		$availableDates   = array_keys( $this->dates );
		$unavailableDates = array_diff( $requestedDates, $availableDates );

		return empty( $unavailableDates );
	}

	/**
	 *
	 * @param \DateTime $fromDate
	 * @return bool
	 */
	public function isExistsFrom( $fromDate ) {
		$isExists = false;

		$fromDateFormatted = $fromDate->format( 'Y-m-d' );

		foreach ( array_keys( $this->dates ) as $date ) {
			if ( $date > $fromDateFormatted ) {
				$isExists = true;
				break;
			}
		}
		return $isExists;
	}

	/**
	 * @return array
	 *
	 * @since 3.5.0 removed optional parameter $occupancyParams.
	 */
	public function getDatePrices() {
		$datePrices = array();
		foreach ( $this->seasonPrices as $seasonPrice ) {
			$datePrices = array_merge( $datePrices, $seasonPrice->getDatePrices() );
		}
		return $datePrices;
	}

	/**
	 *
	 * @return bool
	 */
	public function isActive() {
		return $this->active;
	}

	/**
	 *
	 * @return Season[]
	 */
	public function getSeasons() {
		$seasons = array_map(
			function( SeasonPrice $seasonPrice ) {
				return $seasonPrice->getSeason();
			},
			$this->seasonPrices
		);
		return array_filter( $seasons );
	}

	/**
	 *
	 * @param \DateTime $fromDate
	 * @param \DateTime $toDate
	 * @return float
	 */
	public function getMinBasePrice( $fromDate = null, $toDate = null ) {
		$useFilter = false;

		if ( $fromDate && is_a( $fromDate, '\DateTime' ) ) {
			$useFilter = true;
			$fromDate  = $fromDate->format( 'Y-m-d' );
		}

		if ( $toDate && is_a( $toDate, '\DateTime' ) ) {
			$useFilter = true;
			$toDate    = $toDate->format( 'Y-m-d' );
		}

		if ( $useFilter ) {
			$datePrices = array();
			foreach ( $this->dates as $date => $price ) {
				if ( $fromDate && $date < $fromDate ) {
					continue;
				}
				if ( $toDate && $date > $toDate ) {
					continue;
				}
				$datePrices[ $date ] = $price;
			}
		} else {
			$datePrices = $this->dates;
		}

		return ! empty( $datePrices ) ? min( $datePrices ) : 0.0;
	}

	/**
	 * @param \DateTime $checkInDate
	 * @param \DateTime $checkOutDate
	 * @return float
	 *
	 * @since 3.5.0 removed optional parameter $occupancyParams.
	 */
	public function calcPrice( \DateTime $checkInDate, \DateTime $checkOutDate ) {
		return (float) array_sum( $this->getPriceBreakdown( $checkInDate, $checkOutDate ) );
	}

	/**
	 * @param string $checkInDate date in format 'Y-m-d'
	 * @param string $checkOutDate date in format 'Y-m-d'
	 * @return array Array where keys are dates and values are prices
	 *
	 * @since 3.5.0 removed optional parameter $occupancyParams.
	 */
	public function getPriceBreakdown( $checkInDate, $checkOutDate ) {

		$prices = array();

		$datePrices = $this->getDatePrices();

		foreach ( \MPHB\Utils\DateUtils::createDatePeriod( $checkInDate, $checkOutDate ) as $date ) {
			$dateDB = \MPHB\Utils\DateUtils::formatDateDB( $date );
			if ( array_key_exists( $dateDB, $datePrices ) ) {
				$prices[ $dateDB ] = $datePrices[ $dateDB ];
			}
		}

		return $prices;
	}

}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
28 Apr 2026 8.56 AM
builxejc / builxejc
0755
.htaccess
0.41 KB
28 Apr 2026 8.56 AM
builxejc / builxejc
0644
abstract-coupon.php
6.785 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
accommodation-attribute.php
2.27 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
booking.php
16.744 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
customer.php
4.048 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
fixed-accommodation-coupon.php
0.674 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
fixed-accommodation-per-day-coupon.php
0.659 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
payment.php
4.848 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
percent-coupon.php
0.96 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
rate.php
5.321 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
reserved-room.php
14.627 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
reserved-service.php
4.477 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
room-type.php
6.572 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
room.php
1.81 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
season-price.php
4.889 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
season.php
2.509 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
service.php
3.897 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644
wp-post-data.php
2.841 KB
18 Nov 2024 1.16 PM
builxejc / builxejc
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF