| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Bookit — Booking & Appointment Calendar |
| 4 |
* Plugin URI: https://bookitwp.com/ |
| 5 |
* Description: Appointment booking and event calendar for WordPress. Services, staff, availability, shortcodes, and email notifications. Prevents double-booking. |
| 6 |
* Author: The Events Calendar |
| 7 |
* Author URI: https://theeventscalendar.com/ |
| 8 |
* License: GNU General Public License v2 or later |
| 9 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 10 |
* Text Domain: bookit |
| 11 |
* Version: 2.6.0.1 |
| 12 |
* Requires at least: 6.3 |
| 13 |
* Requires PHP: 7.4 |
| 14 |
*/ |
| 15 |
|
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
define( 'BOOKIT_VERSION', '2.6.0.1' ); |
| 21 |
define( 'BOOKIT_DB_VERSION', '2.2.5' ); |
| 22 |
define( 'BOOKIT_FILE', __FILE__ ); |
| 23 |
define( 'BOOKIT_PATH', dirname( BOOKIT_FILE ) ); |
| 24 |
define( 'BOOKIT_INCLUDES_PATH', BOOKIT_PATH . '/includes/' ); |
| 25 |
define( 'BOOKIT_CLASSES_PATH', BOOKIT_INCLUDES_PATH . 'classes/' ); |
| 26 |
define( 'BOOKIT_URL', plugin_dir_url( BOOKIT_FILE ) ); |
| 27 |
|
| 28 |
$composer_autoload = BOOKIT_PATH . '/vendor/autoload.php'; |
| 29 |
if ( file_exists( $composer_autoload ) ) { |
| 30 |
require_once $composer_autoload; |
| 31 |
} |
| 32 |
|
| 33 |
require_once BOOKIT_PATH . '/includes/autoload.php'; |
| 34 |
|
| 35 |
if ( ! function_exists( 'bookit_fs' ) ) { |
| 36 |
// Create a helper function for easy SDK access. |
| 37 |
function bookit_fs() { |
| 38 |
global $bookit_fs; |
| 39 |
|
| 40 |
if ( ! isset( $bookit_fs ) ) { |
| 41 |
// Load Freemius SDK when installed via Composer. |
| 42 |
if ( ! function_exists( 'fs_dynamic_init' ) ) { |
| 43 |
$freemius_start = null; |
| 44 |
if ( class_exists( \Composer\InstalledVersions::class ) && \Composer\InstalledVersions::isInstalled( 'freemius/wordpress-sdk' ) ) { |
| 45 |
$freemius_start = \Composer\InstalledVersions::getInstallPath( 'freemius/wordpress-sdk' ) . '/start.php'; |
| 46 |
} else { |
| 47 |
$freemius_start = BOOKIT_PATH . '/vendor/freemius/wordpress-sdk/start.php'; |
| 48 |
} |
| 49 |
if ( $freemius_start && file_exists( $freemius_start ) ) { |
| 50 |
require_once $freemius_start; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
if ( function_exists( 'fs_dynamic_init' ) ) { |
| 55 |
$bookit_fs = fs_dynamic_init( array( |
| 56 |
'id' => '8486', |
| 57 |
'slug' => 'bookit', |
| 58 |
'type' => 'plugin', |
| 59 |
'public_key' => 'pk_2cc14bc8c7ec47520d21f0b7d99e7', |
| 60 |
'is_premium' => false, |
| 61 |
'has_addons' => true, |
| 62 |
'has_paid_plans' => false, |
| 63 |
'menu' => array( |
| 64 |
'slug' => 'bookit', |
| 65 |
'first-path' => 'admin.php?page=bookit-settings', |
| 66 |
'account' => true, |
| 67 |
'contact' => true, |
| 68 |
'support' => false, |
| 69 |
'addons' => false, |
| 70 |
), |
| 71 |
) ); |
| 72 |
} else { |
| 73 |
$bookit_fs = null; |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
return $bookit_fs; |
| 78 |
} |
| 79 |
|
| 80 |
// Init Freemius. |
| 81 |
bookit_fs(); |
| 82 |
// Signal that SDK was initiated. |
| 83 |
do_action( 'bookit_fs_loaded' ); |
| 84 |
|
| 85 |
call_user_func( array( 'Bookit\Classes\Base\Plugin', 'run' ) ); |
| 86 |
} |
| 87 |
|
| 88 |
function bookit_after_upgrade_addon_sync( $prev_version, $new_version ) { |
| 89 |
if ( '2.1.7' === $new_version && function_exists( 'bookit_fs' ) ) { |
| 90 |
$bookit_fs = bookit_fs(); |
| 91 |
if ( $bookit_fs ) { |
| 92 |
// The true purges the cache. |
| 93 |
$bookit_fs->get_addons( true ); |
| 94 |
} |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
$bookit_fs = bookit_fs(); |
| 99 |
if ( $bookit_fs ) { |
| 100 |
$bookit_fs->add_action( 'plugin_version_update', 'bookit_after_upgrade_addon_sync' ); |
| 101 |
$bookit_fs->add_action( 'after_uninstall', array( \Bookit\Classes\Base\Plugin::class, 'uninstall' ) ); |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* remove duplicates 'contact us' |
| 106 |
* and 'account' for bookit lower than 2.0.0 |
| 107 |
*/ |
| 108 |
\Bookit\Classes\Admin\SettingsController::removeBookitProFreemiusSubMenuDuplicate(); |
| 109 |
\Bookit\Classes\Admin\SettingsController::removeBookitContactUsForFreeVersion(); |
| 110 |
|
| 111 |
add_action( 'plugins_loaded', 'bookit_load', 0 ); |
| 112 |
|