| Server IP : 104.26.3.156 / Your IP : 216.73.216.185 Web Server : nginx/1.27.1 System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 User : vinodai ( 3134) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v1396/bewellpeptide/public_html/wp-content/plugins/bewell-booking/ |
Upload File : |
<?php
/**
* Plugin Name: BeWell Booking
* Description: Simple appointment booking with a multi-step wizard and Razorpay payments. Manage services, availability and bookings from the admin.
* Version: 0.5.3
* Author: Imagistack
* License: GPL-2.0-or-later
* Text Domain: bewell-booking
* Requires PHP: 7.4
* Requires at least: 6.0
*
* @package BeWellBooking
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'BEWELL_VERSION', '0.5.3' );
define( 'BEWELL_FILE', __FILE__ );
define( 'BEWELL_DIR', plugin_dir_path( __FILE__ ) );
define( 'BEWELL_URL', plugin_dir_url( __FILE__ ) );
define( 'BEWELL_REST_NS', 'bewell/v1' );
require_once BEWELL_DIR . 'includes/class-bewell-db.php';
require_once BEWELL_DIR . 'includes/class-bewell-log.php';
require_once BEWELL_DIR . 'includes/class-bewell-staff.php';
require_once BEWELL_DIR . 'includes/class-bewell-availability.php';
require_once BEWELL_DIR . 'includes/class-bewell-razorpay.php';
require_once BEWELL_DIR . 'includes/class-bewell-tz.php';
require_once BEWELL_DIR . 'includes/class-bewell-booking.php';
require_once BEWELL_DIR . 'includes/class-bewell-ics.php';
require_once BEWELL_DIR . 'includes/class-bewell-invoice.php';
require_once BEWELL_DIR . 'includes/class-bewell-manage.php';
require_once BEWELL_DIR . 'includes/class-bewell-twilio.php';
require_once BEWELL_DIR . 'includes/class-bewell-notifications.php';
require_once BEWELL_DIR . 'includes/class-bewell-rest.php';
require_once BEWELL_DIR . 'includes/class-bewell-shortcode.php';
if ( is_admin() ) {
require_once BEWELL_DIR . 'admin/class-bewell-admin.php';
}
/**
* Activation: create tables + seed defaults.
*/
function bewell_activate() {
BeWell_DB::install();
BeWell_Availability::maybe_seed_defaults();
BeWell_DB::seed_default_staff(); // a fresh install needs one provider to book against
// install() stamps bewell_db_version = DB_VERSION, so maybe_upgrade() would
// later see no version gap and skip the v4 data migration. That matters
// because activation is how the upgrade happens when the new version is
// installed alongside the old folder rather than replacing it, and
// unmigrated rows keep staff_id = 0 -- which makes every existing booking
// look like a free slot. migrate_to_v4() is idempotent, so this is safe.
BeWell_DB::migrate_to_v4();
if ( false === get_option( 'bewell_settings' ) ) {
add_option(
'bewell_settings',
array(
'currency' => 'INR',
'mode' => 'test',
'key_id' => '',
'key_secret' => '',
'webhook_secret' => '',
'company_name' => get_bloginfo( 'name' ),
'timezone_label' => 'IST',
)
);
}
if ( false === get_option( 'bewell_notifications' ) ) {
add_option( 'bewell_notifications', BeWell_Notifications::defaults() );
}
if ( ! wp_next_scheduled( 'bewell_cleanup_holds' ) ) {
wp_schedule_event( time() + 300, 'bewell_five_min', 'bewell_cleanup_holds' );
}
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'bewell_activate' );
function bewell_deactivate() {
wp_clear_scheduled_hook( 'bewell_cleanup_holds' );
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'bewell_deactivate' );
/** Custom 5-minute cron interval. */
add_filter(
'cron_schedules',
function ( $schedules ) {
$schedules['bewell_five_min'] = array(
'interval' => 300,
'display' => 'Every 5 minutes (BeWell)',
);
return $schedules;
}
);
/** Cron handler: release abandoned pending holds across all future dates. */
add_action(
'bewell_cleanup_holds',
function () {
BeWell_Booking::release_expired_holds( null );
}
);
/**
* Boot.
*/
function bewell_init() {
BeWell_DB::maybe_upgrade();
BeWell_Notifications::seed_experimental_credentials(); // experimental: force-populate SMTP/Twilio once
if ( ! wp_next_scheduled( 'bewell_cleanup_holds' ) ) {
wp_schedule_event( time() + 300, 'bewell_five_min', 'bewell_cleanup_holds' );
}
( new BeWell_Shortcode() )->hooks();
( new BeWell_REST() )->hooks();
( new BeWell_Razorpay() )->hooks();
( new BeWell_Notifications() )->hooks();
( new BeWell_Manage() )->hooks();
if ( is_admin() ) {
( new BeWell_Admin() )->hooks();
}
}
add_action( 'plugins_loaded', 'bewell_init' );