- Implement SyncCron class for scheduling iCal sync every 15 minutes. - Create main plugin file with initialization and activation hooks. - Add admin booking modal for managing reservations, including AJAX functionality for searching available rooms and creating bookings. - Include necessary CSS and JS for modal functionality and user interaction. - Ensure compatibility with MotoPress Hotel Booking plugin.
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: MPHB iCal Sync
|
|
* Description: Synchronizacja iCal dla MotoPress Hotel Booking — eksport do Booking.com i import blokad dat
|
|
* Version: 1.0.0
|
|
* Author: wrapartamenty.pl
|
|
* Requires at least: 5.0
|
|
* Requires PHP: 7.4
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
define( 'MPHB_ICAL_SYNC_DIR', plugin_dir_path( __FILE__ ) );
|
|
define( 'MPHB_ICAL_SYNC_VERSION', '1.0.0' );
|
|
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/Exporter.php';
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/Parser.php';
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/Importer.php';
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/FeedEndpoint.php';
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/SyncCron.php';
|
|
require_once MPHB_ICAL_SYNC_DIR . 'includes/AdminUI.php';
|
|
|
|
function mphb_ical_sync_init() {
|
|
if ( ! function_exists( 'MPHB' ) ) {
|
|
add_action( 'admin_notices', function () {
|
|
echo '<div class="notice notice-error"><p><strong>MPHB iCal Sync:</strong> Plugin MotoPress Hotel Booking nie jest aktywny.</p></div>';
|
|
} );
|
|
return;
|
|
}
|
|
|
|
new \MphbIcalSync\FeedEndpoint();
|
|
new \MphbIcalSync\SyncCron();
|
|
new \MphbIcalSync\AdminUI();
|
|
}
|
|
add_action( 'plugins_loaded', 'mphb_ical_sync_init' );
|
|
|
|
register_activation_hook( __FILE__, function () {
|
|
\MphbIcalSync\SyncCron::activate();
|
|
} );
|
|
|
|
register_deactivation_hook( __FILE__, function () {
|
|
\MphbIcalSync\SyncCron::deactivate();
|
|
} );
|