| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Plugin Name: Booktics | |
| 4 | + * Plugin Name: Booktics - Booking Calendar for Appointments and Service Businesses | |
| 5 | 5 | * Plugin URI: https://arraytics.com/booktics/ |
| 6 | 6 | * Description: Schedule, Appointment and Seat Booking plugin. |
| 7 | - * Version: 1.0.2 | |
| 8 | - * Requires at least: 5.2 | |
| 7 | + * Version: 1.0.27 | |
| 8 | + * Requires at least: 6.2 | |
| 9 | 9 | * Requires PHP: 7.4 |
| 10 | 10 | * Author: Arraytics |
| 11 | 11 | * Author URI: https://arraytics.com/ |
| 12 | 12 | * License: GPL v2 or later |
| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | * |
| 30 | 30 | * @package Booktics |
| 31 | 31 | * @category Core |
| 32 | 32 | * @author Arraytics |
| 33 | - * @version 1.0.1 | |
| 33 | + * @version 1.0.27 | |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | 36 | use Booktics\Booktics; |
| 37 | 37 | use Booktics\Providers\Global_Service_Provider; |
| @@ -43,10 +43,12 @@ | ||
| 43 | 43 | require_once __DIR__ . '/vendor/autoload.php'; |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // Define constant for the Plugin file. |
| 47 | +define( 'BOOKTICS_PLUGIN_NAME', "Booktics"); | |
| 47 | 48 | defined( 'BOOKTICS_FILE' ) || define( 'BOOKTICS_FILE', __FILE__ ); |
| 48 | 49 | defined( 'BOOKTICS_DIR' ) || define( 'BOOKTICS_DIR', __DIR__ ); |
| 50 | +defined( 'BOOKTICS_VERSION' ) || define( 'BOOKTICS_VERSION', '1.0.27' ); | |
| 49 | 51 | |
| 50 | 52 | global $booktics_container; |
| 51 | 53 | |
| 52 | 54 | $booktics_container = new \Booktics\Container\Container(); |
| @@ -64,13 +66,113 @@ | ||
| 64 | 66 | return $booktics_container; |
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 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 | +/** | |
| 68 | 167 | * Load Booktics Plugin when all plugins loaded. |
| 69 | 168 | * |
| 70 | 169 | * @return Booktics The singleton instance of Booktics. |
| 71 | 170 | */ |
| 72 | 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(); | |
| 73 | 175 | return Booktics::instance(); |
| 74 | 176 | } |
| 75 | 177 | |
| 76 | 178 | // Let's go. |