| @@ -1,77 +1,179 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Plugin Name: Booktics | |
| 5 | - * Plugin URI: https://arraytics.com/booktics/ | |
| 6 | - * Description: Schedule, Appointment and Seat Booking plugin. | |
| 7 | - * Version: 1.0.1 | |
| 8 | - * Requires at least: 7.4 | |
| 9 | - * Requires PHP: 7.4 | |
| 10 | - * Author: Arraytics | |
| 11 | - * Author URI: https://arraytics.com/ | |
| 12 | - * License: GPL v2 or later | |
| 13 | - * License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| 14 | - * Text Domain: booktics | |
| 15 | - * Domain Path: /languages | |
| 16 | - | |
| 17 | - * Booktics is free software: you can redistribute it and/or modify | |
| 18 | - * it under the terms of the GNU General Public License as published by | |
| 19 | - * the Free Software Foundation, either version 2 of the License, or | |
| 20 | - * any later version. | |
| 21 | - | |
| 22 | - * Booktics Essential is distributed in the hope that it will be useful, | |
| 23 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 24 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 25 | - * GNU General Public License for more details. | |
| 26 | - | |
| 27 | - * You should have received a copy of the GNU General Public License | |
| 28 | - * along with Booktics. If not, see <http://www.gnu.org/licenses/>. | |
| 29 | - * | |
| 30 | - * @package Booktics | |
| 31 | - * @category Core | |
| 32 | - * @author Arraytics | |
| 33 | - * @version 1.0.1 | |
| 34 | - */ | |
| 35 | - | |
| 36 | -use Booktics\Booktics; | |
| 37 | -use Booktics\Providers\Global_Service_Provider; | |
| 38 | - | |
| 39 | -// Exit if accessed directly. | |
| 40 | -defined( 'ABSPATH' ) || exit; | |
| 41 | - | |
| 42 | - | |
| 43 | -require_once __DIR__ . '/vendor/autoload.php'; | |
| 44 | - | |
| 45 | - | |
| 46 | -// Define constant for the Plugin file. | |
| 47 | -defined( 'BOOKTICS_FILE' ) || define( 'BOOKTICS_FILE', __FILE__ ); | |
| 48 | -defined( 'BOOKTICS_DIR' ) || define( 'BOOKTICS_DIR', __DIR__ ); | |
| 49 | - | |
| 50 | -global $booktics_container; | |
| 51 | - | |
| 52 | -$booktics_container = new \Booktics\Container\Container(); | |
| 53 | - | |
| 54 | -$booktics_container->addServiceProvider( 'global', Global_Service_Provider::class ); | |
| 55 | - | |
| 56 | -/** | |
| 57 | - * Booktics container | |
| 58 | - * | |
| 59 | - * @return \Booktics\Container\Container | |
| 60 | - */ | |
| 61 | -function booktics_container() { | |
| 62 | - global $booktics_container; | |
| 63 | - | |
| 64 | - return $booktics_container; | |
| 65 | -} | |
| 66 | - | |
| 67 | -/** | |
| 68 | - * Load Booktics Plugin when all plugins loaded. | |
| 69 | - * | |
| 70 | - * @return Booktics The singleton instance of Booktics. | |
| 71 | - */ | |
| 72 | -function booktics() { | |
| 73 | - return Booktics::instance(); | |
| 74 | -} | |
| 75 | - | |
| 76 | -// Let's go. | |
| 77 | -booktics(); | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Plugin Name: Booktics - Booking Calendar for Appointments and Service Businesses | |
| 5 | + * Plugin URI: https://arraytics.com/booktics/ | |
| 6 | + * Description: Schedule, Appointment and Seat Booking plugin. | |
| 7 | + * Version: 1.0.29 | |
| 8 | + * Requires at least: 6.2 | |
| 9 | + * Requires PHP: 7.4 | |
| 10 | + * Author: Arraytics | |
| 11 | + * Author URI: https://arraytics.com/ | |
| 12 | + * License: GPL v2 or later | |
| 13 | + * License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| 14 | + * Text Domain: booktics | |
| 15 | + * Domain Path: /languages | |
| 16 | + | |
| 17 | + * Booktics is free software: you can redistribute it and/or modify | |
| 18 | + * it under the terms of the GNU General Public License as published by | |
| 19 | + * the Free Software Foundation, either version 2 of the License, or | |
| 20 | + * any later version. | |
| 21 | + | |
| 22 | + * Booktics Essential is distributed in the hope that it will be useful, | |
| 23 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 24 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 25 | + * GNU General Public License for more details. | |
| 26 | + | |
| 27 | + * You should have received a copy of the GNU General Public License | |
| 28 | + * along with Booktics. If not, see <http://www.gnu.org/licenses/>. | |
| 29 | + * | |
| 30 | + * @package Booktics | |
| 31 | + * @category Core | |
| 32 | + * @author Arraytics | |
| 33 | + * @version 1.0.27 | |
| 34 | + */ | |
| 35 | + | |
| 36 | +use Booktics\Booktics; | |
| 37 | +use Booktics\Providers\Global_Service_Provider; | |
| 38 | + | |
| 39 | +// Exit if accessed directly. | |
| 40 | +defined( 'ABSPATH' ) || exit; | |
| 41 | + | |
| 42 | + | |
| 43 | +require_once __DIR__ . '/vendor/autoload.php'; | |
| 44 | + | |
| 45 | + | |
| 46 | +// Define constant for the Plugin file. | |
| 47 | +define( 'BOOKTICS_PLUGIN_NAME', "Booktics"); | |
| 48 | +defined( 'BOOKTICS_FILE' ) || define( 'BOOKTICS_FILE', __FILE__ ); | |
| 49 | +defined( 'BOOKTICS_DIR' ) || define( 'BOOKTICS_DIR', __DIR__ ); | |
| 50 | +defined( 'BOOKTICS_VERSION' ) || define( 'BOOKTICS_VERSION', '1.0.29' ); | |
| 51 | + | |
| 52 | +global $booktics_container; | |
| 53 | + | |
| 54 | +$booktics_container = new \Booktics\Container\Container(); | |
| 55 | + | |
| 56 | +$booktics_container->addServiceProvider( 'global', Global_Service_Provider::class ); | |
| 57 | + | |
| 58 | +/** | |
| 59 | + * Booktics container | |
| 60 | + * | |
| 61 | + * @return \Booktics\Container\Container | |
| 62 | + */ | |
| 63 | +function booktics_container() { | |
| 64 | + global $booktics_container; | |
| 65 | + | |
| 66 | + return $booktics_container; | |
| 67 | +} | |
| 68 | + | |
| 69 | +/** | |
| 70 | + * Registers the uninstaller form backend. | |
| 71 | + * | |
| 72 | + * @return void | |
| 73 | + */ | |
| 74 | +function booktics_register_uninstaller_form() { | |
| 75 | + try { | |
| 76 | + if ( class_exists( 'UninstallerForm\UninstallerForm' ) && is_callable( [ '\UninstallerForm\UninstallerForm', 'init' ] ) ) { | |
| 77 | + $reflection = new ReflectionMethod( '\UninstallerForm\UninstallerForm', 'init' ); | |
| 78 | + $totalParams = $reflection->getNumberOfParameters(); // Maximum number of parameters allowed | |
| 79 | + | |
| 80 | + if( 6 === $totalParams ) { | |
| 81 | + $uninstaller_form = new \UninstallerForm\UninstallerForm(); | |
| 82 | + $uninstaller_form->init( | |
| 83 | + 'Booktics', // Plugin name | |
| 84 | + 'booktics', // Plugin Slug | |
| 85 | + __FILE__, | |
| 86 | + 'booktics', // Text Domain Name | |
| 87 | + 'booktics-feedback-modal', // plugins-admin-script-handler | |
| 88 | + 'https://arraytics.com/?fluentcrm=1&route=contact&hash=09343e4f-30f7-4bda-b8b6-d4b6f90754ad' // web hook for booktics | |
| 89 | + ); | |
| 90 | + } else { | |
| 91 | + // For compatibility with older versions of uninstaller form | |
| 92 | + $uninstaller_form = new \UninstallerForm\UninstallerForm(); | |
| 93 | + $uninstaller_form->init( | |
| 94 | + 'Booktics', // Plugin name | |
| 95 | + 'booktics', // Plugin Slug | |
| 96 | + __FILE__, | |
| 97 | + 'booktics', // Text Domain Name | |
| 98 | + 'booktics-feedback-modal' | |
| 99 | + ); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } catch ( \Throwable $e ) { | |
| 103 | + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 104 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 105 | + error_log( | |
| 106 | + sprintf( | |
| 107 | + 'Booktics: Error in initiating uninstaller form – %s (Line %d, File %s)', | |
| 108 | + $e->getMessage(), | |
| 109 | + $e->getLine(), | |
| 110 | + $e->getFile() | |
| 111 | + ) | |
| 112 | + ); | |
| 113 | + } | |
| 114 | + } | |
| 115 | +} | |
| 116 | + | |
| 117 | +/** | |
| 118 | + * Add a "Go Pro" action link on the Plugins page. | |
| 119 | + * Hidden when the pro plugin is active. | |
| 120 | + */ | |
| 121 | +if ( ! function_exists( 'booktics_add_go_pro_action_link' ) ) { | |
| 122 | + function booktics_add_go_pro_action_link( $links ) { | |
| 123 | + if ( function_exists( 'booktics_pro' ) ) { | |
| 124 | + return $links; | |
| 125 | + } | |
| 126 | + | |
| 127 | + $go_pro = sprintf( | |
| 128 | + '<a href="%1$s" target="_blank" rel="noopener noreferrer" style="color:#e8364c;font-weight:600;">%2$s</a>', | |
| 129 | + esc_url( 'https://arraytics.com/booktics/pricing/' ), | |
| 130 | + esc_html__( 'Go Pro', 'booktics' ) | |
| 131 | + ); | |
| 132 | + | |
| 133 | + $links[] = $go_pro; | |
| 134 | + return $links; | |
| 135 | + } | |
| 136 | +} | |
| 137 | +add_filter( 'plugin_action_links_' . plugin_basename( BOOKTICS_FILE ), 'booktics_add_go_pro_action_link' ); | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | +/** | |
| 142 | + * Declare WooCommerce feature compatibility. | |
| 143 | + * | |
| 144 | + * Must run on before_woocommerce_init, which fires while WooCommerce boots — | |
| 145 | + * earlier than the `init` hook the service providers are wired to, so this | |
| 146 | + * cannot live inside the WooCommerce module. | |
| 147 | + * | |
| 148 | + * @return void | |
| 149 | + */ | |
| 150 | +add_action( | |
| 151 | + 'before_woocommerce_init', function () { | |
| 152 | + if ( ! class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { | |
| 153 | + return; | |
| 154 | + } | |
| 155 | + | |
| 156 | + // High-Performance Order Storage: the module only ever touches orders | |
| 157 | + // through the CRUD API, never through post meta. | |
| 158 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', BOOKTICS_FILE, true ); | |
| 159 | + | |
| 160 | + // Cart & Checkout blocks: booking checkout runs on whatever checkout the | |
| 161 | + // store already uses, block or classic. | |
| 162 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', BOOKTICS_FILE, true ); | |
| 163 | + } | |
| 164 | +); | |
| 165 | + | |
| 166 | +/** | |
| 167 | + * Load Booktics Plugin when all plugins loaded. | |
| 168 | + * | |
| 169 | + * @return Booktics The singleton instance of Booktics. | |
| 170 | + */ | |
| 171 | +function booktics() { | |
| 172 | + add_action( 'admin_init', 'booktics_handle_conflicting_plugins' ); | |
| 173 | + add_action( 'admin_notices', 'booktics_show_conflict_deactivation_notice' ); | |
| 174 | + booktics_register_uninstaller_form(); | |
| 175 | + return Booktics::instance(); | |
| 176 | +} | |
| 177 | + | |
| 178 | +// Let's go. | |
| 179 | +booktics(); | |