🏨 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>
95 lines
2.1 KiB
PHP
95 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* REST API: WP_REST_Edit_Site_Export_Controller class
|
|
*
|
|
* @package WordPress
|
|
* @subpackage REST_API
|
|
*/
|
|
|
|
/**
|
|
* Controller which provides REST endpoint for exporting current templates
|
|
* and template parts.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @see WP_REST_Controller
|
|
*/
|
|
class WP_REST_Edit_Site_Export_Controller extends WP_REST_Controller {
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @since 5.9.0
|
|
*/
|
|
public function __construct() {
|
|
$this->namespace = 'wp-block-editor/v1';
|
|
$this->rest_base = 'export';
|
|
}
|
|
|
|
/**
|
|
* Registers the site export route.
|
|
*
|
|
* @since 5.9.0
|
|
*/
|
|
public function register_routes() {
|
|
register_rest_route(
|
|
$this->namespace,
|
|
'/' . $this->rest_base,
|
|
array(
|
|
array(
|
|
'methods' => WP_REST_Server::READABLE,
|
|
'callback' => array( $this, 'export' ),
|
|
'permission_callback' => array( $this, 'permissions_check' ),
|
|
),
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Checks whether a given request has permission to export.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @return true|WP_Error True if the request has access, or WP_Error object.
|
|
*/
|
|
public function permissions_check() {
|
|
if ( current_user_can( 'export' ) ) {
|
|
return true;
|
|
}
|
|
|
|
return new WP_Error(
|
|
'rest_cannot_export_templates',
|
|
__( 'Sorry, you are not allowed to export templates and template parts.' ),
|
|
array( 'status' => rest_authorization_required_code() )
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Output a ZIP file with an export of the current templates
|
|
* and template parts from the site editor, and close the connection.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @return void|WP_Error
|
|
*/
|
|
public function export() {
|
|
// Generate the export file.
|
|
$filename = wp_generate_block_templates_export_file();
|
|
|
|
if ( is_wp_error( $filename ) ) {
|
|
$filename->add_data( array( 'status' => 500 ) );
|
|
|
|
return $filename;
|
|
}
|
|
|
|
$theme_name = basename( get_stylesheet() );
|
|
header( 'Content-Type: application/zip' );
|
|
header( 'Content-Disposition: attachment; filename=' . $theme_name . '.zip' );
|
|
header( 'Content-Length: ' . filesize( $filename ) );
|
|
flush();
|
|
readfile( $filename );
|
|
unlink( $filename );
|
|
exit;
|
|
}
|
|
}
|