Hotel Raxa - Advanced Booking System Implementation

🏨 Hotel Booking Enhancements:
- Implemented Eagle Booking Advanced Pricing add-on
- Added Booking.com-style rate management system
- Created professional calendar interface for pricing
- Integrated deals and discounts functionality

💰 Advanced Pricing Features:
- Dynamic pricing models (per room, per person, per adult)
- Base rates, adult rates, and child rates management
- Length of stay discounts and early bird deals
- Mobile rates and secret deals implementation
- Seasonal promotions and flash sales

📅 Availability Management:
- Real-time availability tracking
- Stop sell and restriction controls
- Closed to arrival/departure functionality
- Minimum/maximum stay requirements
- Automatic sold-out management

💳 Payment Integration:
- Maintained Redsys payment gateway integration
- Seamless integration with existing Eagle Booking
- No modifications to core Eagle Booking plugin

🛠️ Technical Implementation:
- Custom database tables for advanced pricing
- WordPress hooks and filters integration
- AJAX-powered admin interface
- Data migration from existing Eagle Booking
- Professional calendar view for revenue management

📊 Admin Interface:
- Booking.com-style management dashboard
- Visual rate and availability calendar
- Bulk operations for date ranges
- Statistics and analytics dashboard
- Modal dialogs for quick editing

🔧 Code Quality:
- WordPress coding standards compliance
- Secure database operations with prepared statements
- Proper input validation and sanitization
- Error handling and logging
- Responsive admin interface

🤖 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hotel Raxa Dev
2025-07-11 07:43:22 +02:00
commit 5b1e2453c7
9816 changed files with 2784509 additions and 0 deletions

View File

@@ -0,0 +1,347 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Assets Data.
*
* @since 3.3.0
*/
abstract class Base {
const ASSETS_DATA_KEY = '_elementor_assets_data';
/**
* @var array
*/
protected $assets_data;
/**
* @var string
*/
protected $content_type;
/**
* @var string
*/
protected $assets_category;
/**
* @var array
*/
private $assets_config;
/**
* @var array
*/
private $files_data;
/**
* Get Asset Content.
*
* Responsible for extracting the asset data from a certain file.
* Will be triggered automatically when the asset data does not exist, or when the asset version was changed.
*
* @since 3.3.0
* @access public
*
* @return string
*/
abstract protected function get_asset_content();
/**
* Get Asset Key.
*
* The asset data will be saved in the DB under this key.
*
* @since 3.3.0
* @access protected
*
* @return string
*/
protected function get_key() {
return $this->assets_config['key'];
}
/**
* Get Relative Version.
*
* The asset data will be re-evaluated according the version number.
*
* @since 3.3.0
* @access protected
*
* @return string
*/
protected function get_version() {
return $this->assets_config['version'];
}
/**
* Get Asset Path.
*
* The asset data will be extracted from the file path.
*
* @since 3.3.0
* @access protected
*
* @return string
*/
protected function get_file_path() {
return $this->assets_config['file_path'];
}
/**
* Get Config Data.
*
* Holds a unique data relevant for the specific assets category type.
*
* @since 3.3.0
* @access protected
*
* @return string|array
*/
protected function get_config_data( $key = '' ) {
if ( isset( $this->assets_config['data'] ) ) {
if ( $key ) {
if ( isset( $this->assets_config['data'][ $key ] ) ) {
return $this->assets_config['data'][ $key ];
}
return '';
}
return $this->assets_config['data'];
}
return [];
}
/**
* Set Asset Data.
*
* Responsible for setting the current asset data.
*
* @since 3.3.0
* @access protected
*
* @return void
*/
protected function set_asset_data( $asset_key ) {
if ( ! isset( $this->assets_data[ $asset_key ] ) ) {
$this->assets_data[ $asset_key ] = [];
}
$this->assets_data[ $asset_key ]['content'] = $this->get_asset_content();
$this->assets_data[ $asset_key ]['version'] = $this->get_version();
$this->save_asset_data( $asset_key );
}
/**
* Save Asset Data.
*
* Responsible for saving the asset data in the DB.
*
* @since 3.3.0
* @access protected
*
* @param string $asset_key
*
* @return void
*/
protected function save_asset_data( $asset_key ) {
$assets_data = $this->get_saved_assets_data();
$content_type = $this->content_type;
$assets_category = $this->assets_category;
$assets_data[ $content_type ][ $assets_category ][ $asset_key ] = $this->assets_data[ $asset_key ];
update_option( self::ASSETS_DATA_KEY, $assets_data );
}
/**
* Is Asset Version Changed.
*
* Responsible for comparing the saved asset data version to the current relative version.
*
* @since 3.3.0
* @access protected
*
* @param string $asset_key
*
* @return boolean
*/
protected function is_asset_version_changed( $version ) {
return $this->get_version() !== $version;
}
/**
* Get File Data.
*
* Getting a file content or size.
*
* @since 3.3.0
* @access protected
*
* @param string $data_type (exists|content|size)
* @param string $file_key - In case that the same file data is needed for multiple assets (like a JSON file), the file data key should be the same for all shared assets to make sure that the file is being read only once.
*
* @return string|number
*/
protected function get_file_data( $data_type, $file_key = '' ) {
$asset_key = $file_key ? $file_key : $this->get_key();
if ( isset( $this->files_data[ $asset_key ][ $data_type ] ) ) {
return $this->files_data[ $asset_key ][ $data_type ];
}
if ( ! isset( $this->files_data[ $asset_key ] ) ) {
$this->files_data[ $asset_key ] = [];
}
$asset_path = $this->get_file_path();
if ( 'exists' === $data_type ) {
$data = file_exists( $asset_path );
} elseif ( 'content' === $data_type ) {
$data = Utils::file_get_contents( $asset_path );
if ( ! $data ) {
$data = '';
}
} elseif ( 'size' === $data_type ) {
$data = file_exists( $asset_path ) ? filesize( $asset_path ) : 0;
}
$this->files_data[ $asset_key ][ $data_type ] = $data;
return $data;
}
/**
* Get Saved Assets Data.
*
* Getting the assets data from the DB.
*
* @since 3.3.0
* @access protected
*
* @return array
*/
protected function get_saved_assets_data() {
$assets_data = get_option( self::ASSETS_DATA_KEY, [] );
$content_type = $this->content_type;
$assets_category = $this->assets_category;
if ( ! isset( $assets_data[ $content_type ] ) ) {
$assets_data[ $content_type ] = [];
}
if ( ! isset( $assets_data[ $content_type ][ $assets_category ] ) ) {
$assets_data[ $content_type ][ $assets_category ] = [];
}
return $assets_data;
}
/**
* Get Config.
*
* Getting the assets data config.
*
* @since 3.5.0
* @access protected
*
* @return array
*/
protected function get_config( $data ) {
return [];
}
/**
* Init Asset Data.
*
* Initialize the asset data and handles the asset content updates when needed.
*
* @since 3.3.0
* @access public
*
* @param array $config {
* @type string 'key'
* @type string 'version'
* @type string 'file_path'
* @type array 'data'
* }
*
* @return void
*/
public function init_asset_data( $config ) {
$this->assets_config = $config;
$asset_key = $config['key'];
$asset_data = isset( $this->assets_data[ $asset_key ] ) ? $this->assets_data[ $asset_key ] : [];
if ( ! $asset_data || $this->is_asset_version_changed( $asset_data['version'] ) ) {
$this->set_asset_data( $asset_key );
}
}
/**
* Get Asset Data From Config.
*
* Getting the asset data content from config.
*
* @since 3.3.0
* @access public
*
* @param array $config {
* @type string 'key'
* @type string 'version'
* @type string 'file_path'
* @type array 'data'
* }
*
* @return mixed
*/
public function get_asset_data_from_config( array $config ) {
$this->init_asset_data( $config );
$asset_key = $config['key'];
return $this->assets_data[ $asset_key ]['content'];
}
/**
* Get Asset Data.
*
* Getting the asset data content.
*
* @since 3.5.0
* @access public
*
* @param array $data
*
* @return mixed
*/
public function get_asset_data( array $data ) {
$config = $this->get_config( $data );
return $this->get_asset_data_from_config( $config );
}
public function __construct() {
$assets_data = $this->get_saved_assets_data();
$content_type = $this->content_type;
$assets_category = $this->assets_category;
$this->assets_data = $assets_data[ $content_type ][ $assets_category ];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg;
use Elementor\Core\Page_Assets\Data_Managers\Base as Data_Managers_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Font Icon Svg Base.
*
* @since 3.4.0
*/
class Base extends Data_Managers_Base {
protected $content_type = 'svg';
protected $assets_category = 'font-icon';
protected function get_asset_content() {}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* E-Icons Svg.
*
* @since 3.5.0
*/
class E_Icons extends Base {
const LIBRARY_CURRENT_VERSION = '5.13.0';
protected function get_config( $icon ) {
return [
'key' => $icon['value'],
'version' => self::LIBRARY_CURRENT_VERSION,
'file_path' => ELEMENTOR_ASSETS_PATH . 'lib/eicons/eicons.json',
'data' => [
'icon_data' => [
'name' => $icon['value'],
'library' => $icon['library'],
],
],
];
}
protected function get_asset_content() {
$icon_data = $this->get_config_data( 'icon_data' );
$file_data = json_decode( $this->get_file_data( 'content', $icon_data['library'] ), true );
$icon_name = str_replace( 'eicon-', '', $icon_data['name'] );
$svg_data = $file_data[ $icon_name ];
return [
'width' => $svg_data['width'],
'height' => $svg_data['height'],
'path' => $svg_data['path'],
'key' => $this->get_key(),
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Font Awesome Icon Svg.
*
* @since 3.4.0
*/
class Font_Awesome extends Base {
const LIBRARY_CURRENT_VERSION = '5.15.3';
protected function get_config( $icon ) {
preg_match( '/fa(.*) fa-/', $icon['value'], $icon_name_matches );
$icon_name = str_replace( $icon_name_matches[0], '', $icon['value'] );
$icon_key = str_replace( ' fa-', '-', $icon['value'] );
$icon_file_name = str_replace( 'fa-', '', $icon['library'] );
return [
'key' => $icon_key,
'version' => self::LIBRARY_CURRENT_VERSION,
'file_path' => ELEMENTOR_ASSETS_PATH . 'lib/font-awesome/json/' . $icon_file_name . '.json',
'data' => [
'icon_data' => [
'name' => $icon_name,
'library' => $icon['library'],
],
],
];
}
protected function get_asset_content() {
$icon_data = $this->get_config_data( 'icon_data' );
$file_data = json_decode( $this->get_file_data( 'content', $icon_data['library'] ), true );
$icon_name = $icon_data['name'];
$svg_data = $file_data['icons'][ $icon_name ];
return [
'width' => $svg_data[0],
'height' => $svg_data[1],
'path' => $svg_data[4],
'key' => $this->get_key(),
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg;
use Elementor\Core\Base\Base_Object;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Font Icon Svg Manager.
*
* @since 3.4.0
*/
class Manager extends Base_Object {
private static $data = [];
private static function get_data() {
if ( ! self::$data ) {
self::$data = [
'font-awesome' => [
'regex' => '/^fa-/',
'manager' => new Font_Awesome(),
],
'eicons' => [
'regex' => '/^eicons$/',
'manager' => new E_Icons(),
],
];
}
return self::$data;
}
public static function get_font_icon_svg_data( $icon ) {
$data = self::get_data();
$font_family = $icon['font_family'];
$font_family_manager = $data[ $font_family ]['manager'];
return $font_family_manager->get_asset_data( $icon );
}
public static function get_font_family( $icon_library ) {
foreach ( self::get_data() as $family => $data ) {
if ( preg_match( $data['regex'], $icon_library ) ) {
return $family;
}
}
return '';
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Responsive Widgets Data.
*
* @since 3.5.0
*/
class Responsive_Widgets extends Base {
const RESPONSIVE_WIDGETS_DATABASE_KEY = 'responsive-widgets';
const RESPONSIVE_WIDGETS_FILE_PATH = 'data/responsive-widgets.json';
protected $content_type = 'json';
protected $assets_category = 'widgets';
protected function get_asset_content() {
$data = $this->get_file_data( 'content' );
if ( $data ) {
$data = json_decode( $data, true );
}
return $data;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Elementor\Core\Page_Assets\Data_Managers;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Assets Data.
*
* @since 3.3.0
*/
class Widgets_Css extends Base {
protected $content_type = 'css';
protected $assets_category = 'widgets';
protected function get_asset_content() {
$asset_css_file_exists = $this->get_file_data( 'exists' );
$widget_css = '';
if ( $asset_css_file_exists ) {
$asset_url = $this->get_config_data( 'file_url' );
$widget_css = sprintf( '<link rel="stylesheet" href="%s">', $asset_url );
}
return $widget_css;
}
}

View File

@@ -0,0 +1,209 @@
<?php
namespace Elementor\Core\Page_Assets;
use Elementor\Core\Base\Module;
use Elementor\Plugin;
use Elementor\Control_Animation;
use Elementor\Control_Exit_Animation;
use Elementor\Control_Hover_Animation;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Elementor assets loader.
*
* A class that is responsible for conditionally enqueuing styles and script assets that were pre-enabled.
*
* @since 3.3.0
*/
class Loader extends Module {
private array $assets = [];
public function get_name(): string {
return 'assets-loader';
}
private function init_assets(): void {
$assets = [
'styles' => $this->init_styles(),
'scripts' => [],
];
$this->assets = $assets;
}
private function init_styles(): array {
$styles = [
// TODO: Remove the 'e-animations' registration in v3.26.0 [ED-15471].
'e-animations' => [
'src' => $this->get_css_assets_url( 'animations', 'assets/lib/animations/', true ),
'version' => ELEMENTOR_VERSION,
'dependencies' => [],
],
'e-shapes' => [
'src' => $this->get_css_assets_url( 'shapes', 'assets/css/conditionals/' ),
'version' => ELEMENTOR_VERSION,
'dependencies' => [],
],
'e-swiper' => [
'src' => $this->get_css_assets_url( 'e-swiper', 'assets/css/conditionals/' ),
'version' => ELEMENTOR_VERSION,
'dependencies' => [ 'swiper' ],
],
'swiper' => [
'src' => $this->get_css_assets_url( 'swiper', $this->getSwiperPath() ),
'version' => $this->getSwiperVersion(),
'dependencies' => [],
],
];
return array_merge( $styles, $this->get_animation_styles() );
}
private function getSwiperPath(): string {
return Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'assets/lib/swiper/v8/css/' : 'assets/lib/swiper/css/';
}
private function getSwiperVersion(): string {
return Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? '8.4.5' : '5.3.6';
}
private function get_animations(): array {
$grouped_animations = Control_Animation::get_default_animations();
$grouped_animations['hover'] = Control_Hover_Animation::get_default_animations();
$exit_animations = Control_Exit_Animation::get_default_animations();
$grouped_animations = array_merge( $grouped_animations, $exit_animations );
$animations = [];
foreach ( $grouped_animations as $group_label => $group ) {
foreach ( $group as $animation_key => $animation_label ) {
$animations[ $animation_key ] = $group_label;
}
}
return $animations;
}
private function get_animation_styles(): array {
$animations = $this->get_animations();
$styles = [];
foreach ( $animations as $animation => $group_label ) {
$style_prefix = 'hover' === $group_label ? 'e-animation-' : '';
$styles[ 'e-animation-' . $animation ] = [
'src' => $this->get_css_assets_url( $style_prefix . $animation, 'assets/lib/animations/styles/' ),
'version' => ELEMENTOR_VERSION,
'dependencies' => [],
];
}
return $styles;
}
public function get_assets(): array {
if ( ! $this->assets ) {
$this->init_assets();
}
return $this->assets;
}
/**
* @param array $assets {
* @type array 'styles'
* @type array 'scripts'
* }
*/
public function enable_assets( array $assets_data ): void {
if ( ! $this->assets ) {
$this->init_assets();
}
foreach ( $assets_data as $assets_type => $assets_list ) {
foreach ( $assets_list as $asset_name ) {
$this->assets[ $assets_type ][ $asset_name ]['enabled'] = true;
if ( 'scripts' === $assets_type ) {
wp_enqueue_script( $asset_name );
} else {
wp_enqueue_style( $asset_name );
}
}
}
}
/**
* @param array $assets {
* @type array 'styles'
* @type array 'scripts'
* }
*/
public function add_assets( array $assets ): void {
if ( ! $this->assets ) {
$this->init_assets();
}
$this->assets = array_replace_recursive( $this->assets, $assets );
}
/**
* @deprecated 3.22.0
*/
public function enqueue_assets(): void {
$assets = $this->get_assets();
$is_preview_mode = Plugin::$instance->preview->is_preview_mode();
foreach ( $assets as $assets_type => $assets_type_data ) {
foreach ( $assets_type_data as $asset_name => $asset_data ) {
if ( empty( $asset_data['src'] ) ) {
continue;
}
if ( ! empty( $asset_data['enabled'] ) || $is_preview_mode ) {
if ( 'scripts' === $assets_type ) {
wp_enqueue_script( $asset_name, $asset_data['src'], $asset_data['dependencies'], $asset_data['version'], true );
} else {
// TODO: Remove the 'e-animations' registration in v3.26.0 [ED-15471].
if ( $this->skip_animations_style( $asset_name ) ) {
continue;
}
wp_enqueue_style( $asset_name, $asset_data['src'], $asset_data['dependencies'], $asset_data['version'] );
}
}
}
}
}
// TODO: Remove the 'e-animations' registration in v3.26.0 [ED-15471].
private function skip_animations_style( $asset_name ): bool {
$is_preview = Plugin::$instance->preview->is_preview_mode();
return $is_preview && 'e-animations' === $asset_name;
}
private function register_assets(): void {
$assets = $this->get_assets();
foreach ( $assets as $assets_type => $assets_type_data ) {
foreach ( $assets_type_data as $asset_name => $asset_data ) {
if ( 'scripts' === $assets_type ) {
wp_register_script( $asset_name, $asset_data['src'], $asset_data['dependencies'], $asset_data['version'], true );
} else {
wp_register_style( $asset_name, $asset_data['src'], $asset_data['dependencies'], $asset_data['version'] );
}
}
}
}
public function __construct() {
parent::__construct();
$this->register_assets();
}
}