'array', 'sanitize_callback' => array( $this->options, 'sanitize' ), 'default' => LlmsOptions::defaults(), ) ); } /** * Loads the style and script on this page. * * @param string $hook Admin page hook. * @return void */ public function enqueue( string $hook ): void { if ( ! in_array( $hook, array( 'agentwelcome_page_' . self::SLUG, 'toplevel_page_' . self::SLUG ), true ) ) { return; } Assets::style(); wp_enqueue_script( 'agentwelcome-admin', AGENTWELCOME_URL . 'assets/js/admin.js', array(), Assets::version( 'assets/js/admin.js' ), true ); } /** * Prints the page. * * @return void */ public function render(): void { if ( ! current_user_can( Capabilities::files() ) ) { return; } $preview = $this->llms->build(); $custom = $this->options->custom(); $full = $this->options->full_custom(); $host = (string) wp_parse_url( home_url(), PHP_URL_HOST ); $cache = $this->coverage->summary(); View::render( 'llms', array( 'group' => self::GROUP, 'name' => LlmsOptions::KEY, 'notices' => $this->notices->data(), 'mode' => $this->options->mode(), 'custom' => $custom, 'full' => $this->options->full_enabled(), 'full_mode' => $this->options->full_mode(), 'full_custom' => $full, 'full_notes' => LlmsOptions::check( $full, $host ), 'robots_line' => $this->options->robots_line(), 'max_bytes' => LlmsOptions::MAX_BYTES, 'notes' => LlmsOptions::check( $custom, $host ), 'preview' => strlen( $preview ) > self::PREVIEW_CHARS ? substr( $preview, 0, self::PREVIEW_CHARS ) . "\n…" : $preview, 'pretty' => Urls::has_pretty_permalinks(), 'active' => $this->environment->is_active(), 'llms_url' => home_url( '/llms.txt' ), 'full_url' => home_url( '/llms-full.txt' ), 'stored' => $cache['fresh'] + $cache['stale'], 'missing' => $cache['missing'], 'robots_file' => file_exists( get_home_path() . 'robots.txt' ), 'verify_all_url' => current_user_can( 'manage_options' ) ? VerifyPage::url( array( 'tab' => 'all' ) ) : '', ) ); } }