set_basename( false, __FILE__ ); return; } /** * DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` * CALL ABOVE TO PROPERLY WORK. */ if ( !function_exists( 'flowwp_fs' ) ) { /** * Freemius SDK accessor. * * @return Freemius */ function flowwp_fs() { global $flowwp_fs; if ( !isset( $flowwp_fs ) ) { // Include Freemius SDK. require_once __DIR__ . '/vendor/freemius/start.php'; $flowwp_fs = fs_dynamic_init( array( 'id' => '38274', 'slug' => 'flowwp-workflow-automation', 'premium_slug' => 'flowwp-premium', 'type' => 'plugin', 'public_key' => 'pk_b41a9795b897366568cc4764a6c30', 'is_premium' => false, 'has_addons' => false, 'has_paid_plans' => true, 'is_org_compliant' => true, 'trial' => array( 'days' => 4, 'is_require_payment' => false, ), 'menu' => array( 'slug' => 'flowwp', 'support' => false, ), 'is_live' => true, ) ); } return $flowwp_fs; } // Init Freemius. flowwp_fs(); // Signal that SDK was initiated. do_action( 'flowwp_fs_loaded' ); } define( 'FLOWWP_VERSION', '1.2.2' ); define( 'FLOWWP_FILE', __FILE__ ); define( 'FLOWWP_PATH', plugin_dir_path( __FILE__ ) ); define( 'FLOWWP_URL', plugin_dir_url( __FILE__ ) ); define( 'FLOWWP_BASENAME', plugin_basename( __FILE__ ) ); /** * Minimum environment gate. * * Runs before the autoloader so an unsupported host gets an admin notice rather * than a fatal error from typed properties or enums in app/. * * @return bool */ function flowwp_environment_is_supported() : bool { return version_compare( PHP_VERSION, '8.1', '>=' ) && version_compare( get_bloginfo( 'version' ), '6.5', '>=' ) && file_exists( FLOWWP_PATH . 'vendor/autoload.php' ); } if ( !flowwp_environment_is_supported() ) { add_action( 'admin_notices', static function () : void { if ( !current_user_can( 'activate_plugins' ) ) { return; } $message = ( !file_exists( FLOWWP_PATH . 'vendor/autoload.php' ) ? __( 'FlowWP is missing its Composer dependencies. Run "composer install" in the plugin directory.', 'flowwp-workflow-automation' ) : sprintf( /* translators: 1: required PHP version, 2: required WordPress version */ __( 'FlowWP requires PHP %1$s or newer and WordPress %2$s or newer. The plugin has not been loaded.', 'flowwp-workflow-automation' ), '8.1', '6.5' ) ); printf( '

%s

', esc_html( $message ) ); } ); return; } require_once FLOWWP_PATH . 'vendor/autoload.php'; /* * The licensing helpers — flowwp_can(), flowwp_limit(), flowwp_features(). * * Required here rather than listed under Composer's `files`, because the file * refuses to run outside WordPress and the `files` list runs the moment any * autoloader is required — including PHPUnit's and PHPStan's, where ABSPATH is * not defined and never could be. Listed there, the guard WordPress.org asks * for would stop the test suite before it started. * * Here it is loaded in the one place that is certainly WordPress, immediately * after the autoloader, which is where `files` would have run it anyway. */ require_once FLOWWP_PATH . 'app/Licensing/functions.php'; /* * Action Scheduler is a library, not an autoloaded class: it has to be included * so it can register its own hooks, and it must happen before `plugins_loaded` * or it will not initialise. It deduplicates itself across plugins, so a site * also running WooCommerce ends up with whichever copy is newest — including it * here is safe regardless of what else is installed. */ if ( file_exists( FLOWWP_PATH . 'vendor/woocommerce/action-scheduler/action-scheduler.php' ) ) { require_once FLOWWP_PATH . 'vendor/woocommerce/action-scheduler/action-scheduler.php'; } register_activation_hook( __FILE__, array(FlowWP\Core\Activator::class, 'activate') ); register_deactivation_hook( __FILE__, array(FlowWP\Core\Deactivator::class, 'deactivate') ); /* * Uninstall runs through Freemius, not through an uninstall.php or * register_uninstall_hook(). WordPress honours only one uninstall handler per * plugin, and the SDK needs that slot to report the uninstall and deliver the * deactivation feedback the user typed. Freemius fires this action once it has * done so. */ flowwp_fs()->add_action( 'after_uninstall', array(FlowWP\Core\Uninstaller::class, 'uninstall') ); /** * Boot the plugin. * * Priority 5 so first-party services are registered before integration modules * (which hook the default priority 10) try to talk to the registries. */ add_action( 'plugins_loaded', static function () : void { FlowWP\Core\Plugin::instance()->boot(); }, 5 );