diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 16740f9..1483c4c 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -49,6 +49,9 @@ warning + + warning + diff --git a/includes/class-peptide-news-content-filter.php b/includes/class-peptide-news-content-filter.php index e6c9357..5cb2910 100644 --- a/includes/class-peptide-news-content-filter.php +++ b/includes/class-peptide-news-content-filter.php @@ -398,8 +398,7 @@ class Peptide_News_Content_Filter { // Use XML-style delimiters to isolate untrusted article data from the prompt. // This mitigates prompt injection by clearly separating instructions from data. - return - "You are a content classifier. Your ONLY task is to classify the article below.\n" . + $prompt = "You are a content classifier. Your ONLY task is to classify the article below.\n" . "Respond with EXACTLY one word: EDITORIAL or PROMOTIONAL.\n" . "EDITORIAL = genuine news, research, or journalism.\n" . "PROMOTIONAL = press releases, ads, sponsored content, product launches, " . @@ -412,6 +411,7 @@ class Peptide_News_Content_Filter { sprintf( "%s\n", $content_trimmed ) . "\n\n" . "Classification (one word only):"; + return $prompt; } /** diff --git a/includes/class-peptide-news-rest-api.php b/includes/class-peptide-news-rest-api.php index 804a378..8dc07b9 100644 --- a/includes/class-peptide-news-rest-api.php +++ b/includes/class-peptide-news-rest-api.php @@ -114,6 +114,7 @@ class Peptide_News_Rest_API { if ( ! preg_match( '/^\\d{4}-\\d{2}-\\d{2}$/', $value ) ) { return new WP_Error( 'rest_invalid_date', + /* translators: %s: parameter name */ sprintf( __( 'Invalid date format for %s. Expected Y-m-d.', 'peptide-news' ), $param ), array( 'status' => 400 ) ); @@ -184,7 +185,6 @@ class Peptide_News_Rest_API { } } } - } $data = array(