| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Booking Calendar | Appointment Booking | Bookit |
| 4 |
* Plugin URI: https://bookitwp.com/ |
| 5 |
* Description: Booking Appointments Calendar. You can easily realize Booking Appointments with this plugin. |
| 6 |
* Author: The Events Calendar |
| 7 |
* Author URI: https://theeventscalendar.com/ |
| 8 |
* License: GNU General Public License v2 or later |
| 9 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 10 |
* Text Domain: bookit |
| 11 |
* Version: 2.5.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.5.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 |
require_once BOOKIT_PATH . '/includes/autoload.php'; |
| 29 |
|
| 30 |
if ( ! function_exists( 'bookit_fs' ) ) { |
| 31 |
// Create a helper function for easy SDK access. |
| 32 |
function bookit_fs() { |
| 33 |
global $bookit_fs; |
| 34 |
|
| 35 |
if ( ! isset( $bookit_fs ) ) { |
| 36 |
// Include Freemius SDK. |
| 37 |
if ( file_exists( BOOKIT_PATH . '/freemius/start.php' ) ) { |
| 38 |
require_once BOOKIT_PATH . '/freemius/start.php'; |
| 39 |
} |
| 40 |
|
| 41 |
$bookit_fs = fs_dynamic_init( array( |
| 42 |
'id' => '8486', |
| 43 |
'slug' => 'bookit', |
| 44 |
'type' => 'plugin', |
| 45 |
'public_key' => 'pk_2cc14bc8c7ec47520d21f0b7d99e7', |
| 46 |
'is_premium' => false, |
| 47 |
'has_addons' => true, |
| 48 |
'has_paid_plans' => false, |
| 49 |
'menu' => array( |
| 50 |
'slug' => 'bookit', |
| 51 |
'first-path' => 'admin.php?page=bookit-settings', |
| 52 |
'account' => true, |
| 53 |
'contact' => true, |
| 54 |
'support' => false, |
| 55 |
'addons' => false, |
| 56 |
), |
| 57 |
) ); |
| 58 |
} |
| 59 |
|
| 60 |
return $bookit_fs; |
| 61 |
} |
| 62 |
|
| 63 |
// Init Freemius. |
| 64 |
bookit_fs(); |
| 65 |
// Signal that SDK was initiated. |
| 66 |
do_action( 'bookit_fs_loaded' ); |
| 67 |
|
| 68 |
call_user_func( array( 'Bookit\Classes\Base\Plugin', 'run' ) ); |
| 69 |
} |
| 70 |
|
| 71 |
function bookit_after_upgrade_addon_sync( $prev_version, $new_version ) { |
| 72 |
if ( '2.1.7' === $new_version ) { |
| 73 |
// The true purges the cache. |
| 74 |
bookit_fs()->get_addons( true ); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
$bookit_fs = bookit_fs(); |
| 79 |
$bookit_fs->add_action( 'plugin_version_update', 'bookit_after_upgrade_addon_sync' ); |
| 80 |
$bookit_fs->add_action( 'after_uninstall', array( \Bookit\Classes\Base\Plugin::class, 'uninstall' ) ); |
| 81 |
|
| 82 |
/** |
| 83 |
* remove duplicates 'contact us' |
| 84 |
* and 'account' for bookit lower than 2.0.0 |
| 85 |
*/ |
| 86 |
\Bookit\Classes\Admin\SettingsController::removeBookitProFreemiusSubMenuDuplicate(); |
| 87 |
\Bookit\Classes\Admin\SettingsController::removeBookitContactUsForFreeVersion(); |
| 88 |
|
| 89 |
add_action( 'plugins_loaded', 'bookit_load', 0 ); |