✓ ' . esc_html__( 'llms.txt Einstellungen gespeichert.', 'ai-json-extractor-auto-embed-lite' ) . '
'; } // ── Werte laden (immer aus der DB nach dem Speichern) ───────────────────── $enabled = get_option( 'aije_llms_enabled', 1 ); $block_bots = get_option( 'aije_llms_block_bots', 0 ); $custom = get_option( 'aije_llms_custom', '' ); $max_posts = (int) get_option( 'aije_llms_max_posts', 10 ); $excerpt_len = (int) get_option( 'aije_llms_excerpt_len', 0 ); $show_cats = (int) get_option( 'aije_llms_show_cats', 1 ); $link_sitemap= (int) get_option( 'aije_llms_sitemap', 1 ); $key_pages = (array) get_option( 'aije_llms_key_pages', array() ); $llms_url = home_url( '/llms.txt' ); // Vorschau generieren (mit aktuellen Werten) $preview = $this->generate_llms_content(); $char_count = mb_strlen( $preview ); $pct = min( 100, round( $char_count / 3000 * 100 ) ); $bar_color = $char_count <= 2800 ? '#16a34a' : ( $char_count <= 3000 ? '#d97706' : '#dc2626' ); $bar_label = $char_count <= 2800 ? '✓ ' . __( 'Optimal', 'ai-json-extractor-auto-embed-lite' ) : ( $char_count <= 3000 ? '⚠ ' . __( 'Knapp am Limit', 'ai-json-extractor-auto-embed-lite' ) : '✕ ' . __( 'Zu lang', 'ai-json-extractor-auto-embed-lite' ) ); $all_pages = get_posts( array( 'post_type' => array( 'page', 'post' ), 'post_status' => 'publish', 'posts_per_page' => 50, 'orderby' => array( 'post_type' => 'ASC', 'title' => 'ASC' ), 'no_found_rows' => true ) ); // ── Abrufe der llms.txt durch KI-Bots (aus dem KI-Besuche-Protokoll) ────── global $wpdb; $v_table = AIJE_Lite_100::ai_visits_table(); $v_labels = AIJE_Lite_100::ai_purpose_labels(); $v_ready = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $v_table ) ) === $v_table; $v_logging = (int) get_option( 'aije_ai_visits_enabled', 1 ); $v_days = isset( $_GET['llms_days'] ) ? (int) $_GET['llms_days'] : 30; // phpcs:ignore WordPress.Security.NonceVerification -- nur lesend $v_days = in_array( $v_days, array( 7, 30, 90, 365 ), true ) ? $v_days : 30; $v_kpi = null; $v_by_bot = array(); $v_daily = array(); $v_recent = array(); if ( $v_ready ) { $v_since = gmdate( 'Y-m-d H:i:s', current_time( 'timestamp' ) - $v_days * DAY_IN_SECONDS ); $v_where = "url IN ('/llms.txt','/llms.txt/') AND purpose <> 'referral' AND visited_at >= %s"; // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $v_table/$v_where sind intern gebaut, Werte laufen über prepare(). $v_kpi = $wpdb->get_row( $wpdb->prepare( "SELECT COUNT(*) AS total, COUNT(DISTINCT bot) AS bots, MAX(visited_at) AS last_visit FROM {$v_table} WHERE {$v_where}", $v_since ) ); $v_by_bot = $wpdb->get_results( $wpdb->prepare( "SELECT bot, vendor, purpose, COUNT(*) AS hits, MIN(visited_at) AS first_visit, MAX(visited_at) AS last_visit FROM {$v_table} WHERE {$v_where} GROUP BY bot, vendor, purpose ORDER BY hits DESC", $v_since ) ); $v_daily = $wpdb->get_results( $wpdb->prepare( "SELECT DATE(visited_at) AS d, COUNT(*) AS hits FROM {$v_table} WHERE {$v_where} GROUP BY DATE(visited_at)", $v_since ), OBJECT_K ); $v_recent = $wpdb->get_results( $wpdb->prepare( "SELECT visited_at, bot, vendor, purpose FROM {$v_table} WHERE {$v_where} ORDER BY id DESC LIMIT 10", $v_since ) ); // phpcs:enable } $v_fmt_date = function ( $mysql ) { return $mysql ? mysql2date( get_option( 'date_format' ) . ' H:i', $mysql ) : '–'; }; $v_th = 'text-align:left;padding:7px 8px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;border-bottom:1px solid #e5e7eb;'; $v_td = 'padding:7px 8px;font-size:13px;border-bottom:1px solid #f3f4f6;'; ?>| bot ); ?> vendor ); ?> | purpose ] ) ? $v_labels[ $b->purpose ] : $b->purpose ); ?> | hits ) ); ?> | first_visit ) ); ?> | last_visit ) ); ?> |