includes/class-some-class.php * ------------------------------------------------------------------------- */ spl_autoload_register( function ( $class ) { if ( strpos( $class, 'Agencoen\\' ) !== 0 ) { return; } $relative = substr( $class, strlen( 'Agencoen\\' ) ); $relative = strtolower( str_replace( '_', '-', $relative ) ); $file = AGENCOEN_PLUGIN_DIR . 'includes/class-' . $relative . '.php'; if ( is_readable( $file ) ) { require $file; } } ); /* * ------------------------------------------------------------------------- * High-Performance Order Storage (HPOS) compatibility * (The hook only fires when WooCommerce is active; harmless otherwise.) * ------------------------------------------------------------------------- */ add_action( 'before_woocommerce_init', function () { if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', AGENCOEN_PLUGIN_FILE, true ); } } ); /* * ------------------------------------------------------------------------- * Requirement checks + boot * ------------------------------------------------------------------------- */ /** * Determine whether the plugin's requirements are met. * * PHP 8.0 is the only hard requirement since 4.0.0; WooCommerce gates the * commerce screens at runtime instead of blocking activation. * * @return string Empty string when OK, otherwise a human-readable reason. */ function agencoen_requirements_error() { if ( version_compare( PHP_VERSION, '8.0', '<' ) ) { return sprintf( /* translators: %s: current PHP version. */ __( 'Rezolve Ai requires PHP 8.0 or higher. You are running %s.', 'agentic-commerce-engine' ), PHP_VERSION ); } return ''; } /** * Boot the plugin once all plugins (including WooCommerce, if any) are loaded. */ function agencoen_boot() { $error = agencoen_requirements_error(); if ( '' !== $error ) { add_action( 'admin_notices', function () use ( $error ) { echo '
' . esc_html( $error ) . '