initiated) { return; } $this->initiated = true; require_once ARRAYFUNNEL_PATH . 'dependency_check.php'; $failures = arrayfunnel_check_dependency(); if (!empty($failures)) { add_action('admin_notices', static function () use ($failures): void { echo '

'; echo esc_html__('ArrayFunnel could not start.', 'arrayfunnel'); echo '

'; }); return; } $this->loadAutoloader(); self::loadFunctions(); self::manageConfig(); // Deferred to init: scheduling an event reads the cron_schedules filter, whose display // label is translated, and translating before init trips WordPress's early-load notice. add_action('init', [Installer::class, 'maybeUpgrade'], 5); do_action('arrayfunnel_before_boot'); new Boot(); do_action('arrayfunnel_after_boot'); do_action('arrayfunnel_loaded'); } public static function manageConfig(): void { Config::add('plugin.path', trailingslashit(ARRAYFUNNEL_PATH)); Config::add('plugin.url', trailingslashit(ARRAYFUNNEL_URL)); Config::add('plugin.public_path', trailingslashit(ARRAYFUNNEL_PATH . 'public')); Config::add('plugin.public_url', trailingslashit(ARRAYFUNNEL_URL . 'public')); } public static function loadFunctions(): void { require_once ARRAYFUNNEL_PATH . 'src/functions/helpers.php'; } public function activatePlugin(): void { $this->loadAutoloader(); self::loadFunctions(); self::manageConfig(); Installer::activate(); } public function deactivatePlugin(): void { $this->loadAutoloader(); Installer::deactivate(); } /** * Declare which WooCommerce features this plugin supports. * * High-Performance Order Storage is supported: orders are only ever read and written * through wc_get_order() and the order CRUD APIs, never through post meta. * * Cart and checkout blocks are deliberately NOT declared. The checkout enhancements and * order bumps render through classic checkout hooks, which the block checkout does not * fire, so claiming support would be inaccurate. */ public function declareCompatibility(): void { if (!class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { return; } \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true); } /** * Register the plugin's custom cron schedules. * * @param array> $schedules Cron schedules. * @return array> */ public function registerCronSchedules(array $schedules): array { $schedules['arrayfunnel_every_15_minutes'] = [ 'interval' => 15 * MINUTE_IN_SECONDS, 'display' => __('Every 15 Minutes', 'arrayfunnel'), ]; return $schedules; } /** * Add ArrayFunnel links to the Plugins screen. * * @param string[] $links Existing plugin row links. * @param string $pluginFile Current plugin basename. * @return string[] */ public function addPluginRowMeta(array $links, string $pluginFile): array { if (ARRAYFUNNEL_BASENAME !== $pluginFile) { return $links; } $links[] = '' . esc_html__('Plugin Page', 'arrayfunnel') . ''; return $links; } private function loadAutoloader(): void { $autoload = ARRAYFUNNEL_PATH . 'vendor/autoload.php'; if (file_exists($autoload)) { require_once $autoload; } } } if (!function_exists('arrayfunnel')) { /** * Retrieve the main plugin instance. */ function arrayfunnel(): ArrayFunnel { return ArrayFunnel::instance(); } } arrayfunnel();