🏨 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>
130 lines
3.7 KiB
PHP
130 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* Redux Sanitize Class
|
|
*
|
|
* @class Redux_Sanitize
|
|
* @version 4.0.0
|
|
* @package Redux Framework
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
if ( ! class_exists( 'Redux_Sanitize', false ) ) {
|
|
|
|
/**
|
|
* Class Redux_Sanitize
|
|
*/
|
|
class Redux_Sanitize extends Redux_Class {
|
|
|
|
/**
|
|
* Sanitize values from options form (used in settings api validate function)
|
|
*
|
|
* @since 4.0.0
|
|
* @access public
|
|
*
|
|
* @param array $plugin_options Plugin Options.
|
|
* @param array $options Options.
|
|
* @param array $sections Sections array.
|
|
*
|
|
* @return array $plugin_options
|
|
*/
|
|
public function sanitize( array $plugin_options, array $options, array $sections ): array {
|
|
$core = $this->core();
|
|
|
|
foreach ( $sections as $k => $section ) {
|
|
if ( isset( $section['fields'] ) ) {
|
|
foreach ( $section['fields'] as $field ) {
|
|
|
|
if ( is_array( $field ) ) {
|
|
$field['section_id'] = $k;
|
|
}
|
|
|
|
if ( isset( $field['type'] ) && ( 'text' === $field['type'] || 'textarea' === $field['type'] || 'multi_text' === $field['type'] ) ) {
|
|
|
|
// Make sure 'sanitize' field is set.
|
|
if ( isset( $field['sanitize'] ) ) {
|
|
|
|
// Can we make this an array of validations?
|
|
$val_arr = array();
|
|
|
|
if ( is_array( $field['sanitize'] ) ) {
|
|
$val_arr = $field['sanitize'];
|
|
} else {
|
|
$val_arr[] = $field['sanitize'];
|
|
}
|
|
|
|
foreach ( $val_arr as $function ) {
|
|
|
|
// Check for empty id value.
|
|
if ( ! isset( $field['id'] ) || ! isset( $plugin_options[ $field['id'] ] ) || ( '' === $plugin_options[ $field['id'] ] ) ) {
|
|
continue;
|
|
}
|
|
|
|
if ( function_exists( $function ) ) {
|
|
if ( empty( $options[ $field['id'] ] ) ) {
|
|
$options[ $field['id'] ] = '';
|
|
}
|
|
|
|
if ( is_array( $plugin_options[ $field['id'] ] ) && ! empty( $plugin_options[ $field['id'] ] ) ) {
|
|
foreach ( $plugin_options[ $field['id'] ] as $key => $value ) {
|
|
$before = null;
|
|
$after = null;
|
|
|
|
if ( isset( $plugin_options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
|
|
if ( is_array( $plugin_options[ $field['id'] ][ $key ] ) ) {
|
|
$before = $plugin_options[ $field['id'] ][ $key ];
|
|
} else {
|
|
$before = trim( $plugin_options[ $field['id'] ][ $key ] );
|
|
}
|
|
}
|
|
|
|
if ( isset( $options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
|
|
$after = $options[ $field['id'] ][ $key ];
|
|
}
|
|
|
|
$value = call_user_func( $function, $before );
|
|
|
|
if ( false !== $value ) {
|
|
$plugin_options[ $field['id'] ][ $key ] = $value;
|
|
} else {
|
|
unset( $plugin_options[ $field['id'] ][ $key ] );
|
|
}
|
|
|
|
$field['current'] = $value;
|
|
|
|
$core->sanitize[] = $field;
|
|
}
|
|
} else {
|
|
if ( isset( $plugin_options[ $field['id'] ] ) ) {
|
|
if ( is_array( $plugin_options[ $field['id'] ] ) ) {
|
|
$pofi = $plugin_options[ $field['id'] ];
|
|
} else {
|
|
$pofi = trim( $plugin_options[ $field['id'] ] );
|
|
}
|
|
} else {
|
|
$pofi = null;
|
|
}
|
|
|
|
$value = call_user_func( $function, $pofi );
|
|
|
|
$plugin_options[ $field['id'] ] = $value;
|
|
|
|
$field['current'] = $value;
|
|
|
|
$core->sanitize[] = $field;
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return $plugin_options;
|
|
}
|
|
}
|
|
}
|