*/ public static function builders(): array { return array( 'elementor' => array( 'label' => 'Elementor', 'detect' => static fn(): bool => defined( 'ELEMENTOR_VERSION' ), 'note' => __( 'Content is rendered from _elementor_data; the analyser reads the rendered output, not the raw post.', 'ai-rank-suite' ), ), 'divi' => array( 'label' => 'Divi', 'detect' => static fn(): bool => defined( 'ET_BUILDER_VERSION' ) || function_exists( 'et_setup_theme' ), 'note' => __( 'Divi shortcodes are expanded before analysis so module text counts.', 'ai-rank-suite' ), ), 'beaver' => array( 'label' => 'Beaver Builder', 'detect' => static fn(): bool => class_exists( 'FLBuilder' ), 'note' => __( 'Layout data is rendered before the word count and keyword checks run.', 'ai-rank-suite' ), ), 'bricks' => array( 'label' => 'Bricks', 'detect' => static fn(): bool => defined( 'BRICKS_VERSION' ), 'note' => __( 'Bricks stores content in post meta; it is read for analysis and schema.', 'ai-rank-suite' ), ), 'oxygen' => array( 'label' => 'Oxygen', 'detect' => static fn(): bool => defined( 'CT_VERSION' ), 'note' => __( 'Oxygen replaces the theme template entirely; head output is still ours.', 'ai-rank-suite' ), ), 'wpbakery' => array( 'label' => 'WPBakery', 'detect' => static fn(): bool => defined( 'WPB_VC_VERSION' ), 'note' => __( 'VC shortcodes are expanded before analysis.', 'ai-rank-suite' ), ), 'breakdance' => array( 'label' => 'Breakdance', 'detect' => static fn(): bool => defined( 'BREAKDANCE_VERSION' ) || class_exists( '\Breakdance\Plugin' ), 'note' => __( 'Breakdance trees are rendered before analysis.', 'ai-rank-suite' ), ), 'gutenberg' => array( 'label' => 'Block editor', 'detect' => static fn(): bool => true, 'note' => __( 'Blocks are parsed natively, including reusable blocks and patterns.', 'ai-rank-suite' ), ), ); } /** * Third-party services a customer may already be paying for, and whether * the connection is live. Nothing here is required — it exists so the * Settings screen can say "connected" instead of leaving the buyer to guess. * * @return array> */ public static function services(): array { $out = array(); /* * Ask the module that owns the connection, not an option name. * * Three of the four rows here read options nothing ever writes — * `airanksuite_search_console_settings`, `airanksuite_bing_settings`, * `airanksuite_indexing_settings`. Search Console stores its tokens in * `airanksuite_gsc_tokens`, Bing its key in `airanksuite_bing_key`, IndexNow in * `airanksuite_indexnow_key`. So this list said "not connected" for a site * that had just connected, on the settings screen, next to a Search * Console screen showing live Google data. */ $out[] = array( 'key' => 'gsc', 'label' => 'Google Search Console', 'provides' => __( 'Real impressions, clicks and positions per page and query', 'ai-rank-suite' ), 'connected' => ! empty( get_option( 'airanksuite_gsc_tokens' ) ) || '' !== (string) get_option( 'airanksuite_gsc_property', '' ), 'route' => 'search-console', 'free' => true, ); $out[] = array( 'key' => 'bing', 'label' => 'Bing Webmaster Tools', 'provides' => __( 'Bing and Copilot data, plus IndexNow submission', 'ai-rank-suite' ), 'connected' => '' !== trim( (string) get_option( 'airanksuite_bing_key', '' ) ), 'route' => 'search-console', 'free' => true, ); $ai = get_option( 'airanksuite_ai_keys', array() ); $out[] = array( 'key' => 'ai', 'label' => __( 'AI provider', 'ai-rank-suite' ), 'provides' => __( 'Meta descriptions, FAQ generation, rewriting suggestions', 'ai-rank-suite' ), 'connected' => is_array( $ai ) && ! empty( $ai ), 'route' => 'ai', 'free' => false, ); $out[] = array( 'key' => 'indexnow', 'label' => 'IndexNow', 'provides' => __( 'Push new and changed URLs to Bing, Yandex and Seznam within minutes', 'ai-rank-suite' ), 'connected' => '' !== trim( (string) get_option( 'airanksuite_indexnow_key', '' ) ), 'route' => 'indexing', 'free' => true, ); return $out; } /** * Server and WordPress facts that change what the plugin can do, each with * a verdict rather than a raw number — "256M" means nothing to most buyers, * "enough for a 50,000-page sitemap" means everything. * * @return array> */ public static function health(): array { $checks = array(); $php = PHP_VERSION; $php_ok = version_compare( $php, '8.1', '>=' ); $checks[] = array( 'id' => 'php', 'label' => 'PHP', 'value' => $php, 'status' => $php_ok ? 'good' : ( version_compare( $php, '8.0', '>=' ) ? 'warn' : 'bad' ), 'note' => $php_ok ? __( 'Supported.', 'ai-rank-suite' ) : __( 'This plugin needs PHP 8.1 or newer. Ask your host to upgrade — it is usually a one-click change.', 'ai-rank-suite' ), ); $wp = get_bloginfo( 'version' ); $checks[] = array( 'id' => 'wp', 'label' => 'WordPress', 'value' => $wp, 'status' => version_compare( $wp, '6.4', '>=' ) ? 'good' : 'warn', 'note' => version_compare( $wp, '6.4', '>=' ) ? __( 'Supported.', 'ai-rank-suite' ) : __( 'Older than 6.4. Everything still runs, but the block-editor sidebar is only tested from 6.4 up.', 'ai-rank-suite' ), ); $limit = self::bytes( (string) ini_get( 'memory_limit' ) ); $checks[] = array( 'id' => 'memory', 'label' => __( 'PHP memory limit', 'ai-rank-suite' ), // "-1" is PHP for "no limit"; printing it raw reads as an error. 'value' => $limit <= 0 ? __( 'unlimited', 'ai-rank-suite' ) : (string) ini_get( 'memory_limit' ), 'status' => $limit <= 0 || $limit >= 256 * MB_IN_BYTES ? 'good' : ( $limit >= 128 * MB_IN_BYTES ? 'warn' : 'bad' ), 'note' => $limit <= 0 || $limit >= 256 * MB_IN_BYTES ? __( 'Comfortable for bulk runs on large sites.', 'ai-rank-suite' ) : ( $limit < 64 * MB_IN_BYTES ? sprintf( /* translators: %d: batch size percentage. */ __( 'Low. Every long job automatically runs at %d%% of its normal batch size here and pauses before the limit rather than failing, so nothing breaks — but scans take several times longer. Ask your host to raise it to 256M (WP_MEMORY_LIMIT in wp-config.php often is not enough; the PHP limit is what counts).', 'ai-rank-suite' ), (int) round( 100 * \AiRankSuite\Support\Job::batch_size( 100 ) / 100 ) ) : __( 'Bulk analysis works in slices, so this is survivable — but 256M makes large runs noticeably faster.', 'ai-rank-suite' ) ), ); $max = (int) ini_get( 'max_execution_time' ); $checks[] = array( 'id' => 'exec', 'label' => __( 'Max execution time', 'ai-rank-suite' ), 'value' => 0 === $max ? __( 'unlimited', 'ai-rank-suite' ) : $max . 's', 'status' => 0 === $max || $max >= 60 ? 'good' : 'warn', 'note' => __( 'Every long job runs in resumable slices, so a short limit slows work down but never loses it.', 'ai-rank-suite' ), ); // Prefer Sodium and fall back to authenticated AES-256-GCM via OpenSSL. $sodium = function_exists( 'sodium_crypto_secretbox' ); $openssl = function_exists( 'openssl_encrypt' ); $checks[] = array( 'id' => 'sodium', 'label' => __( 'Secret encryption', 'ai-rank-suite' ), 'value' => $sodium ? 'libsodium' : ( $openssl ? 'OpenSSL AES-256-GCM' : __( 'unavailable', 'ai-rank-suite' ) ), 'status' => $sodium || $openssl ? 'good' : 'bad', 'note' => $sodium ? __( 'Stored API keys are encrypted at rest with a key derived from your WordPress salts.', 'ai-rank-suite' ) : ( $openssl ? __( 'Stored API keys are encrypted at rest with authenticated AES-256-GCM encryption.', 'ai-rank-suite' ) : __( 'This PHP build cannot store API keys securely. Enable the Sodium or OpenSSL extension before saving keys.', 'ai-rank-suite' ) ), ); $permalinks = (string) get_option( 'permalink_structure' ); $checks[] = array( 'id' => 'permalinks', 'label' => __( 'Permalinks', 'ai-rank-suite' ), 'value' => '' === $permalinks ? __( 'plain', 'ai-rank-suite' ) : $permalinks, 'status' => '' === $permalinks ? 'bad' : 'good', 'note' => '' === $permalinks ? __( 'Plain permalinks break /llms.txt and the XML sitemap. Settings → Permalinks, choose anything but Plain.', 'ai-rank-suite' ) : __( 'Pretty permalinks are on, so /llms.txt and the sitemap resolve.', 'ai-rank-suite' ), ); $https = is_ssl() || 0 === strpos( (string) get_option( 'home' ), 'https://' ); $checks[] = array( 'id' => 'https', 'label' => 'HTTPS', 'value' => $https ? __( 'on', 'ai-rank-suite' ) : __( 'off', 'ai-rank-suite' ), 'status' => $https ? 'good' : 'bad', 'note' => $https ? __( 'Canonicals and schema URLs are emitted over HTTPS.', 'ai-rank-suite' ) : __( 'Search engines treat an HTTP site as lower quality, and some AI crawlers skip it entirely.', 'ai-rank-suite' ), ); $public = (int) get_option( 'blog_public' ); $checks[] = array( 'id' => 'indexing', 'label' => __( 'Search engine visibility', 'ai-rank-suite' ), 'value' => $public ? __( 'public', 'ai-rank-suite' ) : __( 'discouraged', 'ai-rank-suite' ), 'status' => $public ? 'good' : 'bad', 'note' => $public ? __( 'The site asks to be indexed.', 'ai-rank-suite' ) : __( 'Settings → Reading is telling every engine to stay away. Nothing this plugin emits can override that.', 'ai-rank-suite' ), ); $cron = ! ( defined( 'DISABLE_WP_CRON' ) && constant( 'DISABLE_WP_CRON' ) ); $checks[] = array( 'id' => 'cron', 'label' => 'WP-Cron', 'value' => $cron ? __( 'enabled', 'ai-rank-suite' ) : __( 'disabled', 'ai-rank-suite' ), 'status' => $cron ? 'good' : 'warn', 'note' => $cron ? __( 'Scheduled audits, alerts and sitemap pings run on time.', 'ai-rank-suite' ) : __( 'DISABLE_WP_CRON is set. That is fine if a real cron calls wp-cron.php — otherwise scheduled audits never fire.', 'ai-rank-suite' ), ); $object_cache = wp_using_ext_object_cache(); $checks[] = array( 'id' => 'object_cache', 'label' => __( 'Persistent object cache', 'ai-rank-suite' ), 'value' => $object_cache ? __( 'active', 'ai-rank-suite' ) : __( 'none', 'ai-rank-suite' ), 'status' => $object_cache ? 'good' : 'warn', 'note' => $object_cache ? __( 'Redis or Memcached is in use — large sites will feel it.', 'ai-rank-suite' ) : __( 'Optional. On a site past roughly 10,000 posts it is the single cheapest speed-up available.', 'ai-rank-suite' ), ); $checks[] = array( 'id' => 'timezone', 'label' => __( 'Timezone', 'ai-rank-suite' ), 'value' => wp_timezone_string(), 'status' => 'good', 'note' => __( 'Used by opening hours, scheduled audits and the freshness signals in llms.txt.', 'ai-rank-suite' ), ); return $checks; } private static function bytes( string $value ): int { $value = trim( $value ); if ( '' === $value ) { return 0; } $unit = strtolower( substr( $value, -1 ) ); $number = (int) $value; return match ( $unit ) { 'g' => $number * GB_IN_BYTES, 'm' => $number * MB_IN_BYTES, 'k' => $number * KB_IN_BYTES, default => $number, }; } /** * The whole picture, in one payload. * * @return array */ public static function payload(): array { $seo = array(); if ( class_exists( Detector::class ) ) { foreach ( Detector::active() as $key => $plugin ) { $seo[] = array( 'key' => $key, 'label' => (string) $plugin['label'], 'version' => (string) ( $plugin['version'] ?? '' ), 'surfaces' => (array) ( $plugin['surfaces'] ?? array() ), ); } } $builders = array(); foreach ( self::builders() as $key => $meta ) { $active = false; try { $active = 'gutenberg' === $key ? true : (bool) call_user_func( $meta['detect'] ); } catch ( \Throwable $e ) { $active = false; } $builders[] = array( 'key' => $key, 'label' => $meta['label'], 'active' => $active, 'note' => $meta['note'], ); } $integrations = array(); if ( class_exists( IntegrationsModule::class ) ) { foreach ( IntegrationsModule::catalog() as $key => $meta ) { $active = false; try { $active = (bool) call_user_func( $meta['detect'] ); } catch ( \Throwable $e ) { $active = false; } $integrations[] = array( 'key' => $key, 'label' => (string) $meta['label'], 'provides' => (string) $meta['provides'], 'active' => $active, ); } } // What is sitting in the database waiting to be brought across. A buyer // who already has 900 hand-written Yoast descriptions wants to know // they are not retyping them before they want anything else. $importable = array(); try { // The adapter registry, same as the import screen and the wizard — // it knows five sources the old importer does not, and a buyer // asking "will my data come across" should get one answer. foreach ( \AiRankSuite\Modules\ImportExport\Services\ImportRegistry::detect() as $row ) { if ( ! empty( $row['has_data'] ) ) { $importable[] = $row; } } } catch ( \Throwable $e ) { $importable = array(); } return array( 'seo_plugins' => $seo, 'importable' => $importable, 'ownership' => class_exists( CoexistenceModule::class ) ? CoexistenceModule::ownership() : array(), 'multilingual' => Multilingual::state(), 'builders' => $builders, 'integrations' => $integrations, 'services' => self::services(), 'health' => self::health(), ); } }