🏨 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>
121 lines
2.8 KiB
PHP
121 lines
2.8 KiB
PHP
<?php
|
|
/**
|
|
* Redux Framework Instance Container Class
|
|
* Automatically captures and stores all instances
|
|
* of ReduxFramework at instantiation.
|
|
*
|
|
* @package Redux_Framework/Classes
|
|
* @subpackage Core
|
|
* @noinspection PhpIgnoredClassAliasDeclaration
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
if ( ! class_exists( 'Redux_Instances', false ) ) {
|
|
|
|
/**
|
|
* Class Redux_Instances
|
|
*/
|
|
class Redux_Instances {
|
|
|
|
/**
|
|
* ReduxFramework instances
|
|
*
|
|
* @var ReduxFramework[]
|
|
*/
|
|
private static $instances;
|
|
|
|
/**
|
|
* Get Instance
|
|
* Get Redux_Instances instance
|
|
* OR an instance of ReduxFramework by [opt_name]
|
|
*
|
|
* @param string|false $opt_name the defined opt_name.
|
|
*
|
|
* @return ReduxFramework|Redux_Instances class instance
|
|
*/
|
|
public static function get_instance( $opt_name = false ) {
|
|
|
|
if ( $opt_name && ! empty( self::$instances[ $opt_name ] ) ) {
|
|
return self::$instances[ $opt_name ];
|
|
}
|
|
|
|
return new self();
|
|
}
|
|
|
|
/**
|
|
* Shim for old get_redux_instance method.
|
|
*
|
|
* @param string|false $opt_name the defined opt_name.
|
|
*
|
|
* @return ReduxFramework class instance
|
|
*/
|
|
public static function get_redux_instance( $opt_name = '' ) {
|
|
return self::get_instance( $opt_name );
|
|
}
|
|
|
|
/**
|
|
* Get all instantiated ReduxFramework instances (so far)
|
|
*
|
|
* @return array|null [type] [description]
|
|
*/
|
|
public static function get_all_instances(): ?array {
|
|
return self::$instances;
|
|
}
|
|
|
|
/**
|
|
* Redux_Instances constructor.
|
|
*
|
|
* @param mixed $redux_framework Is object.
|
|
*/
|
|
public function __construct( $redux_framework = false ) {
|
|
if ( false !== $redux_framework ) {
|
|
$this->store( $redux_framework );
|
|
} else {
|
|
add_action( 'redux/construct', array( $this, 'store' ), 5, 1 );
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Action hook callback.
|
|
*
|
|
* @param object $redux_framework Pointer.
|
|
*/
|
|
public function store( $redux_framework ) {
|
|
if ( $redux_framework instanceof ReduxFramework ) {
|
|
$key = $redux_framework->args['opt_name'];
|
|
self::$instances[ $key ] = $redux_framework;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( ! class_exists( 'ReduxFrameworkInstances' ) ) {
|
|
class_alias( 'Redux_Instances', 'ReduxFrameworkInstances' );
|
|
}
|
|
|
|
if ( ! function_exists( 'get_redux_instance' ) ) {
|
|
/**
|
|
* Shim function that some theme oddly used.
|
|
*
|
|
* @param string|false $opt_name the defined opt_name.
|
|
*
|
|
* @return ReduxFramework class instance
|
|
*/
|
|
function get_redux_instance( $opt_name ) {
|
|
return Redux_Instances::get_instance( $opt_name );
|
|
}
|
|
}
|
|
|
|
if ( ! function_exists( 'get_all_redux_instances' ) ) {
|
|
/**
|
|
* Fetch all instances of ReduxFramework
|
|
* as an associative array.
|
|
*
|
|
* @return array format ['opt_name' => $ReduxFramework]
|
|
*/
|
|
function get_all_redux_instances(): ?array {
|
|
return Redux_Instances::get_all_instances();
|
|
}
|
|
}
|