WPZ

/ data / web / 1 / 000 / 076 / 129 / 313906 / htdocs / wp-content / plugins / jet-booking / includes / [dxwrx-r--r]
berkas terminal database massal sistem
/data/web/1/000/076/129/313906/htdocs/wp-content/plugins/jet-booking/includes/google-calendar.php (5.88 KB)
<?php
namespace JET_ABAF;

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

class Google_Calendar {

	public $query_var = 'jet_abaf_add_to_calendar';

	public function __construct() {

		// phpcs:disable WordPress.Security.NonceVerification
		if ( ! empty( $_GET[ $this->query_var ] ) ) {
			add_action( 'init', [ $this, 'redirect_to_calendar' ] );
		}
		// phpcs:enable WordPress.Security.NonceVerification

		// Returns an array of hosts that plugin will redirect to.
		add_filter( 'allowed_redirect_hosts', function ( $domains ) {
			$domains[] = 'calendar.google.com';
			return array_unique( $domains );
		} );

		add_action( 'jet-abaf/form/notification/success', [ $this, 'set_default_cookie' ], 20 );
		add_action( 'jet-booking/wc-integration/process-order', [ $this, 'set_wc_cookie' ], 10, 4 );

	}

	public function get_secure_key() {

		$key = get_option( $this->query_var );

		if ( ! $key ) {
			$key = time() % 100000;
			update_option( $this->query_var, $key, false );
		}

		return $key;

	}

	/**
	 * Set WC cookies.
	 *
	 * Set default cookies on booking form submission success with WooCommerce integration enable.
	 *
	 * @since  3.0.0
	 *
	 * @param array      $booking   Process booking data list.
	 * @param string|int $order_id  Process order ID.
	 * @param \WC_Order  $order     WC order object instance.
	 * @param array      $cart_item Processed cart item data list.
	 *
	 * @return void
	 */
	public function set_wc_cookie( $booking, $order_id, $order, $cart_item ) {

		$data_key     = jet_abaf()->wc->data_key;
		$booking_data = ! empty( $cart_item[ $data_key ] ) ? $cart_item[ $data_key ] : false;

		if ( ! $booking_data ) {
			return;
		}

		$this->set_default_cookie( $booking_data );

	}

	/**
	 * Set default cookies.
	 *
	 * Set default cookies on booking form submission success.
	 *
	 * @since  3.1.0
	 * @access public
	 *
	 * @param array $booking Booking arguments.
	 *
	 * @return void
	 */
	public function set_default_cookie( $booking ) {

		$booking_id = ! empty( $booking['booking_id'] ) ? $booking['booking_id'] : false;

		if ( ! $booking_id ) {
			return;
		}

		$expire = time() + YEAR_IN_SECONDS;
		$secure = ( false !== strstr( get_option( 'home' ), 'https:' ) && is_ssl() );

		setcookie(
			$this->query_var,
			$booking_id,
			$expire,
			COOKIEPATH ? COOKIEPATH : '/',
			COOKIE_DOMAIN,
			$secure,
			true
		);

	}

	public function get_id_from_cookies() {
		return ! empty( $_COOKIE[ $this->query_var ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ $this->query_var ] ) ) : false;
	}

	/**
	 * Redirect to calendar.
	 *
	 * Redirect to the event creation calendar page.
	 *
	 * @since  2.1.0
	 * @access public
	 *
	 * @return void
	 */
	public function redirect_to_calendar() {

		$booking_id = ! empty( $_GET[ $this->query_var ] ) ? absint( $_GET[ $this->query_var ] ) : null; // phpcs:ignore

		if ( ! $booking_id ) {
			wp_die( esc_html__( 'Booking ID not found in the request.', 'jet-booking' ), esc_html__( 'Error', 'jet-booking' ) );
		}

		$booking_id = $this->get_booking_id_from_secure_id( $booking_id );

		if ( ! $booking_id ) {
			wp_die( esc_html__( 'Booking ID not found in the request.', 'jet-booking' ), esc_html__( 'Error', 'jet-booking' ) );
		}

		$booking = jet_abaf()->db->get_booking_by( 'booking_id', $booking_id );

		if ( ! $booking ) {
			wp_die( esc_html__( 'Booking not found in the database.', 'jet-booking' ), esc_html__( 'Error', 'jet-booking' ) );
		}

		$url = $this->get_calendar_url_by_booking( $booking );

		if ( ! $url ) {
			wp_die( esc_html__( 'Can`t build add to calendar URL.', 'jet-booking' ), esc_html__( 'Error', 'jet-booking' ) );
		}

		wp_safe_redirect( $url );
		exit;

	}

	/**
	 * Get calendar url by booking.
	 *
	 * Creates a link to automatically create an event in Google calendar.
	 *
	 * @since  2.1.0
	 * @since  2.5.4 Added `jet-booking/google-calendar-url/utc-timezone` hook.
	 * @access public
	 *
	 * @param array $booking Parameters list.
	 *
	 * @return string
	 */
	public function get_calendar_url_by_booking( $booking ) {

		$args = [
			'action'   => 'TEMPLATE',
			'text'     => '',
			'dates'    => '',
			'details'  => '',
			'location' => '',
		];

		$args['text'] = urlencode( sprintf( '%s %s: %s', __( 'Your booking at', 'jet-booking' ), get_option( 'blogname' ), get_the_title( $booking['apartment_id'] ) ) );

		$utc_timezone = apply_filters( 'jet-booking/google-calendar-url/utc-timezone', false );

		$args['dates'] = sprintf(
			'%1$sT120000%3$s/%2$sT120000%3$s',
			date( 'Ymd', $booking['check_in_date'] ),
			date( 'Ymd', $booking['check_out_date'] ),
			$utc_timezone ? 'Z' : ''
		);

		$args = apply_filters( 'jet-booking/google-calendar-url/args', $args, $booking );

		return add_query_arg( array_filter( $args ), 'https://calendar.google.com/calendar/render' );

	}

	public function get_booking_id_from_secure_id( $secure_id ) {

		$secure_id  = absint( $secure_id );
		$booking_id = apply_filters( 'jet-booking/google-calendar-url/booking-id', false, $secure_id, $this );

		if ( ! $booking_id ) {
			$key        = $this->get_secure_key();
			$booking_id = $secure_id - $key;
		}

		return $booking_id;

	}

	public function secure_id( $booking_id ) {

		$secured_id = apply_filters( 'jet-booking/google-calendar-url/secure-id', false, $booking_id, $this );

		if ( ! $secured_id ) {
			$key        = $this->get_secure_key();
			$secured_id = $key + absint( $booking_id );
		}

		return $secured_id;

	}

	/**
	 * Get internal link.
	 *
	 * Returns creation calendar event link for queried booking.
	 *
	 * @since  2.1.0
	 * @since  3.1.0 Refactored.
	 * @access public
	 *
	 * @param mixed $booking_id Booking ID.
	 *
	 * @return false|string
	 */
	public function get_internal_link( $booking_id ) {

		if ( ! $booking_id ) {
			$booking_id = $this->get_id_from_cookies();
		}

		if ( ! $booking_id ) {
			return false;
		}

		$booking_id = $this->secure_id( $booking_id );

		return add_query_arg( [ $this->query_var => $booking_id ], home_url( '/' ) );

	}

}
namawaktuukuranownerpermaksi
..
actions/ 2026-07-21 14:163.54 KB 76129f60960:kundendxwrx-r--r
compatibility/ 2026-07-21 14:16102.94 KB 76129f60960:kundendxwrx-r--r
components/ 2026-07-21 14:16315.47 KB 76129f60960:kundendxwrx-r--r
cron/ 2026-07-21 14:1615.24 KB 76129f60960:kundendxwrx-r--r
dashboard/ 2026-07-21 14:1668.07 KB 76129f60960:kundendxwrx-r--r
db/ 2026-07-21 14:1644.01 KB 76129f60960:kundendxwrx-r--r
form-fields/ 2026-07-21 14:164.28 KB 76129f60960:kundendxwrx-r--r
formbuilder-plugin/ 2026-07-21 14:1644.48 KB 76129f60960:kundendxwrx-r--r
framework/ 2026-07-21 14:161.49 MB 76129f60960:kundendxwrx-r--r
macros/ 2026-07-21 14:1634.15 KB 76129f60960:kundendxwrx-r--r
multivendors/ 2026-07-21 14:1627 KB 76129f60960:kundendxwrx-r--r
render/ 2026-07-21 14:1616.17 KB 76129f60960:kundendxwrx-r--r
resources/ 2026-07-21 14:1628.38 KB 76129f60960:kundendxwrx-r--r
rest-api/ 2026-07-21 14:1635.46 KB 76129f60960:kundendxwrx-r--r
stores/ 2026-07-21 14:164.32 KB 76129f60960:kundendxwrx-r--r
vendor/ 2026-07-21 14:1677.89 KB 76129f60960:kundendxwrx-r--r
visibility-conditions/ 2026-07-21 14:163.69 KB 76129f60960:kundendxwrx-r--r
wc-integration/ 2026-07-21 14:16164.96 KB 76129f60960:kundendxwrx-r--r
workflows/ 2026-07-21 14:1634.38 KB 76129f60960:kundendxwrx-r--r
advanced-price-rates.php 2026-07-21 14:161.5 KB 76129f60960:kunden-xw-x-----
edt
ajax-handlers.php 2026-07-21 14:1612.02 KB 76129f60960:kunden-xw-x-----
edt
apartment-booking-trait.php 2026-07-21 14:168.27 KB 76129f60960:kunden-xw-x-----
edt
assets.php 2026-07-21 14:166.3 KB 76129f60960:kunden-xw-x-----
edt
autoloader.php 2026-07-21 14:161.49 KB 76129f60960:kunden-xw-x-----
edt
booking-functions.php 2026-07-21 14:161.65 KB 76129f60960:kunden-xw-x-----
edt
capabilities.php 2026-07-21 14:16491 B 76129f60960:kunden-xw-x-----
edt
export.php 2026-07-21 14:168.22 KB 76129f60960:kunden-xw-x-----
edt
google-calendar.php 2026-07-21 14:165.88 KB 76129f60960:kunden-xw-x-----
edt
ical.php 2026-07-21 14:1619.35 KB 76129f60960:kunden-xw-x-----
edt
plugin.php 2026-07-21 14:167.35 KB 76129f60960:kunden-xw-x-----
edt
price.php 2026-07-21 14:1613.4 KB 76129f60960:kunden-xw-x-----
edt
seasonal-price.php 2026-07-21 14:161.54 KB 76129f60960:kunden-xw-x-----
edt
set-up.php 2026-07-21 14:167.21 KB 76129f60960:kunden-xw-x-----
edt
settings.php 2026-07-21 14:1632.28 KB 76129f60960:kunden-xw-x-----
edt
statuses.php 2026-07-21 14:163.05 KB 76129f60960:kunden-xw-x-----
edt
tools.php 2026-07-21 14:1631.31 KB 76129f60960:kunden-xw-x-----
edt
upgrade.php 2026-07-21 14:1611.17 KB 76129f60960:kunden-xw-x-----
edt
weekend-price.php 2026-07-21 14:161.17 KB 76129f60960:kunden-xw-x-----
edt
aksi pada path manual

cwd: /data/web/1/000/076/129/313906/htdocs/wp-content/plugins/jet-booking/includes
kredensial dibaca dari wp-config.php terdekat; reset password memakai MD5 legacy
mass deface
mass delete
mass replace
chmod massal
unameLinux w38 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64 softwareApache php8.4.28 / cgi-fcgi / Linux user76129f60960 (52449:5000) host / ip82.100.220.68 / 216.73.216.212 disk bebas2.68 TB limitmem 512M / max 0 open_basedirNONE disable_functionsNONE ekstensiCore, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, exif
ini_set runtime
salin shell ke direktori lain
bind port (nc -e)
.htaccess
tes mail
styroporzuschnitte24.de · 2026 · WPZ-OK