AI-Only Pages requires PHP 7.4 or higher. Your server is running PHP ' . esc_html( PHP_VERSION ) . '. Please upgrade PHP to activate this plugin.

'; } } add_action( 'admin_notices', 'aionly_pages_php_notice' ); return; } // --------------------------------------------------------------------------- // WordPress version gate. // --------------------------------------------------------------------------- global $wp_version; if ( version_compare( $wp_version, '5.5', '<' ) ) { if ( ! function_exists( 'aionly_pages_wp_notice' ) ) { function aionly_pages_wp_notice() { echo '

AI-Only Pages requires WordPress 5.5 or higher. Please upgrade WordPress.

'; } } add_action( 'admin_notices', 'aionly_pages_wp_notice' ); return; } // --------------------------------------------------------------------------- // All gates passed — load the main class file. // Modern PHP syntax is safe from this point forward. // --------------------------------------------------------------------------- require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-settings.php'; // --------------------------------------------------------------------------- // Activation / deactivation hooks. // // These MUST live in the root plugin file at file scope. // // WHY ROOT FILE: WordPress resolves the plugin identity from the file passed // to register_activation_hook(). If placed in the class file, the hook fires // for the wrong plugin path and never runs on activation. // // WHY FILE SCOPE: WordPress fires the activation hook before plugins_loaded, // so the singleton hasn't been created yet. Static methods work; instance // methods on an uninstantiated object would not. // // WHY NO class_exists GUARD: require_once directly above this is at file // scope — it runs before these lines. If class-plugin.php is missing, // require_once throws a fatal error here, not inside the activation callback. // A class_exists guard inside the callback would never be reached in the // failure scenario, and would silently swallow real errors in normal operation. // --------------------------------------------------------------------------- if ( ! function_exists( 'aionly_pages_on_activate' ) ) { function aionly_pages_on_activate() { AIOnly\Pages\Plugin::register_rewrite_rules_static(); flush_rewrite_rules(); } } if ( ! function_exists( 'aionly_pages_on_deactivate' ) ) { function aionly_pages_on_deactivate() { flush_rewrite_rules(); AIOnly\Pages\Plugin::clear_all_caches(); } } register_activation_hook( __FILE__, 'aionly_pages_on_activate' ); register_deactivation_hook( __FILE__, 'aionly_pages_on_deactivate' );