<?php /** * Prompt building. * * @package RAKUGAKI */ if ( ! defined( 'ABSPATH' ) ) { exit; } final class Rakugaki_Msgs { /** * @return string */ public static function base_system() { $base = __( 'You are an expert Japanese web content writer for WordPress. Always respond in natural Japanese unless the user explicitly asks otherwise. Prefer clear structure, short paragraphs, and helpful lists where appropriate. Balance SEO keywords with readability and E-E-A-T; never keyword-stuff. Output must be valid, semantic HTML only (h2, h3, p, ul, li, strong, em). Do not include html/body tags or markdown code fences.', 'rakugaki' ); return apply_filters( 'rakugaki_base_system_prompt', $base ); } /** * @param array<string, mixed> $target Target fields. * @return string */ public static function target_context( array $target ) { $lines = array(); $ages = isset( $target['ages'] ) && is_array( $target['ages'] ) ? $target['ages'] : array(); if ( ! empty( $ages ) ) { $map = array( '10s' => '10N', '20s' => '20N', '30s' => '30N', '40s' => '40N', '50s' => '50N', '60s_plus' => '60NN N', ); $labels = array(); foreach ( $ages as $a ) { if ( isset( $map[ $a ] ) ) { $labels[] = $map[ $a ]; } } if ( $labels ) { $lines[] = '`[n0t^N: ' . implode( '0', $labels ); } } $gender = $target['gender'] ?? 'any'; $gmap = array( 'male' => '7u'`', 'female' => 'sY'`', 'any' => ''`%R NOU', ); $lines[] = '`[n0'`%R: ' . ( $gmap[ $gender ] ?? ' NOU' ); $fields = array( 'region' => '0WW', 'interests' => 'sT0_', 'occupation' => 'wmi0^\'`', 'income' => 'SeQ0Rn00000', 'lifestyle' => '0000000', 'psychology' => '_tyr'`000n0S ', 'media' => '0O0扌000000', ); foreach ( $fields as $key => $label ) { $val = isset( $target[ $key ] ) ? trim( (string) $target[ $key ] ) : ''; if ( $val !== '' ) { $lines[] = $label . ': ' . $val; } } return implode( "\n", $lines ); } /** * @param string $keywords From settings. * @return string */ public static function seo_line( $keywords ) { $keywords = trim( (string) $keywords ); if ( $keywords === '' ) { return ''; } return '6qk0v00_0D0 SEO 00000p00Y0N0j0D0 : ' . str_replace( array( "\r\n", "\n" ), '0', $keywords ); } /** * @param string $title Title. * @param string $summary Summary. * @param array<string, mixed> $settings Settings. * @return string */ public static function outline_user_message( $title, $summary, array $settings ) { $target = $settings['target'] ?? array(); $parts = array( '!kn00000h0ik0We0M00Nn0ibHh`0Q00QRW0f0O0`0U0D00', 'ibHho0 0H2QW0Hh 0h0]0n0 Nn0 0H3L0B00p0{agfM0 0 z^n00000g00D0g0Y00,geo0~0`0fK0j0D0g0O0`0U0D00', '0000: ' . $title, 'i000: ' . $summary, self::seo_line( $settings['seo_keywords'] ?? '' ), self::target_context( is_array( $target ) ? $target : array() ), '`[eW[pev[_] zn0S : } ' . (int) ( $settings['approx_length'] ?? 2500 ) . ' eW[', 'H2 o0g'Y ' . (int) ( $settings['max_headings'] ?? 8 ) . ' P z^0v[k00', ); $msg = implode( "\n\n", array_filter( $parts ) ); return apply_filters( 'rakugaki_outline_user_message', $msg, $title, $summary, $settings ); } /** * @param string $title Title. * @param string $summary Summary. * @param string $outline Outline text. * @param array<string, mixed> $settings Settings. * @return string */ public static function article_user_message( $title, $summary, $outline, array $settings ) { $target = $settings['target'] ?? array(); $parts = array( '!kn0 0bn0ibHh 0k0lc0f00WordPress k00NQ0Sj0 HTML ,ge`0Q00QRW0f0O0`0U0D00', 'N: h2/h30k=0_j00{agfM00MRnM00_fM0n0feo0 N0HTML NYo0QRW0j0D00', '0000: ' . $title, 'i000: ' . $summary, "--- bn0ibHh ---\n" . $outline, self::seo_line( $settings['seo_keywords'] ?? '' ), self::target_context( is_array( $target ) ? $target : array() ), 'vj: J0J00]0 ' . (int) ( $settings['approx_length'] ?? 2500 ) . ' eW[MR_N No000Y0U0*QHQ 0', ); $msg = implode( "\n\n", array_filter( $parts ) ); return apply_filters( 'rakugaki_article_user_message', $msg, $title, $summary, $outline, $settings ); } /** * @param array<string, mixed> $settings Settings. * @return string */ public static function full_system( array $settings ) { $extra = trim( (string) ( $settings['extra_system_prompt'] ?? '' ) ); $sys = self::base_system(); if ( $extra !== '' ) { $sys .= "\n\n" . $extra; } return apply_filters( 'rakugaki_system_prompt', $sys, $settings ); } }
Warning: Cannot modify header information - headers already sent by (output started at /home/hachibit/hachibit.co.jp/public_html/info/wp-content/plugins/rakugaki/includes/class-rakugaki-msgs.php:1) in /home/hachibit/hachibit.co.jp/public_html/info/wp-includes/pluggable.php on line 1531

Warning: Cannot modify header information - headers already sent by (output started at /home/hachibit/hachibit.co.jp/public_html/info/wp-content/plugins/rakugaki/includes/class-rakugaki-msgs.php:1) in /home/hachibit/hachibit.co.jp/public_html/info/wp-includes/pluggable.php on line 1534