0 && '1' === (string) get_post_meta( $post_id, DraftMapping::AI_GENERATED, true ); } /** * Ob unter diesem Beitrag der sichtbare Hinweis steht. * * Im Modus „always" unter jedem Beitrag von Aivor. Im Standardmodus „auto" * nur bei Beitraegen, die ohne menschliche Freigabe online gegangen sind; * die legt dieses Plugin nicht an. Wer einen Entwurf geprueft und selbst * veroeffentlicht hat, traegt die redaktionelle Verantwortung. * * @param int $post_id Beitrag. * @return bool */ public static function shows_notice( int $post_id ): bool { if ( ! self::is_ai_generated( $post_id ) ) { return false; } $mode = Settings::ai_notice_mode(); if ( Settings::AI_NOTICE_NEVER === $mode ) { return false; } if ( Settings::AI_NOTICE_ALWAYS === $mode ) { return true; } return 'auto' === (string) get_post_meta( $post_id, DraftMapping::PUBLISH_MODE, true ); } /** * Haengt den Hinweis an den Inhalt. * * @param string $content Gerenderter Inhalt. * @return string */ public static function append_notice( $content ) { if ( ! is_string( $content ) || is_admin() || doing_filter( 'get_the_excerpt' ) || doing_filter( 'wp_trim_excerpt' ) ) { return $content; } $post_id = (int) get_the_ID(); if ( ! self::shows_notice( $post_id ) ) { return $content; } $text = Settings::ai_notice_text(); if ( '' === $text ) { $text = Settings::default_ai_notice_text(); } /** * Das Markup des sichtbaren KI-Hinweises. * * Das Ergebnis laeuft durch wp_kses_post(): erlaubt ist, was auch im * Beitragsinhalt stehen darf. * * @param string $html Vorgabe-Markup. * @param string $text Hinweistext. * @param int $post_id Beitrag. */ $notice = apply_filters( 'aivor_content_ai_notice_html', '

' . esc_html( $text ) . '

', $text, $post_id ); return $content . "\n" . wp_kses_post( (string) $notice ); } }