fix: proper standalone file docblocks + Yoda/unslash/escaping + 300-line compliance
- Insert standalone file docblocks (separate from class docblocks) in all PHP files to satisfy Squiz.Commenting.FileComment.Missing — @package was incorrectly placed in class docblocks previously; PHPCS requires a distinct file-level block - SPLIT class-pr-core-settings.php (was 340 lines after docblock expansion): class-pr-core-settings.php (264 lines, registration + sanitization stubs) class-pr-core-settings-renderer.php (124 lines, all render_* methods) - Trim class-pr-core-migration-0004 to exactly 300 lines (one-liner file docblock) - Fix class-pr-core-candidate-queue-page.php: Yoda conditions: null !== c->dose_min / null !== c->dose_max Unescaped study output: phpcs:ignore EscapeOutput _GET action and candidate_id: wrap with wp_unslash() - Existing split classes: seed-fixtures, peptide-meta-schema (from prior session) Agent-Session: claude-adopt-ci-20260616
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Adds evidence strength, editorial status, and dosing count columns
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom admin list-table columns for the peptide CPT.
|
||||
*
|
||||
@@ -9,7 +15,6 @@ declare(strict_types=1);
|
||||
* Dependencies: PR_Core_Dosing_Repository for row counts.
|
||||
*
|
||||
* @see admin/class-pr-core-admin.php — Registers column hooks.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Admin_Columns {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Registers admin menu pages, meta boxes, and custom columns for peptides
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Admin initialization and hook registration.
|
||||
*
|
||||
@@ -13,7 +19,6 @@ declare(strict_types=1);
|
||||
* @see admin/class-pr-core-verification-metabox.php — Verification sidebar meta box.
|
||||
* @see admin/class-pr-core-candidate-queue-page.php — Candidate review screen.
|
||||
* @see admin/class-pr-core-admin-columns.php — Custom list-table columns.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Admin {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Handles mark-verified and scan-now admin-ajax actions
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* AJAX handlers for verification scanner actions.
|
||||
*
|
||||
@@ -10,7 +16,6 @@ declare(strict_types=1);
|
||||
*
|
||||
* @see admin/class-pr-core-peptide-metaboxes.php — "Mark verified today" button in sidebar.
|
||||
* @see admin/class-pr-core-verification-widget.php — "Scan now" button in dashboard widget.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Ajax_Handlers {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Renders a review screen for AI-extracted dosing candidates
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Admin page for the AI Candidate Queue.
|
||||
*
|
||||
@@ -12,7 +18,6 @@ declare(strict_types=1);
|
||||
*
|
||||
* @see admin/class-pr-core-admin.php — Menu registration.
|
||||
* @see repositories/class-pr-core-candidate-queue-repository.php — Data layer.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Candidate_Queue_Page {
|
||||
|
||||
@@ -59,8 +64,8 @@ class PR_Core_Candidate_Queue_Page {
|
||||
$peptide = $pep_repo->find_by_id( $c->peptide_id );
|
||||
$name = $peptide ? $peptide->title : '#' . $c->peptide_id;
|
||||
|
||||
$dose = $c->dose_min !== null ? number_format( $c->dose_min, 2 ) : '?';
|
||||
if ( $c->dose_max !== null && $c->dose_max !== $c->dose_min ) {
|
||||
$dose = null !== $c->dose_min ? number_format( $c->dose_min, 2 ) : '?';
|
||||
if ( null !== $c->dose_max && $c->dose_max !== $c->dose_min ) {
|
||||
$dose .= ' – ' . number_format( $c->dose_max, 2 );
|
||||
}
|
||||
$dose .= ' ' . esc_html( $c->dose_unit );
|
||||
@@ -95,7 +100,7 @@ class PR_Core_Candidate_Queue_Page {
|
||||
printf( '<td>%s</td>', esc_html( $c->route ) );
|
||||
printf( '<td>%s</td>', esc_html( $dose ) );
|
||||
printf( '<td>%s</td>', esc_html( $c->population ) );
|
||||
printf( '<td>%s</td>', $study ); // Contains escaped HTML + link.
|
||||
printf( '<td>%s</td>', $study ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $study is pre-escaped HTML.
|
||||
printf( '<td>%s</td>', esc_html( $confidence_pct ) );
|
||||
printf(
|
||||
'<td><a href="%s" class="button button-primary button-small">%s</a> <a href="%s" class="button button-small">%s</a></td>',
|
||||
@@ -118,7 +123,7 @@ class PR_Core_Candidate_Queue_Page {
|
||||
* @return void
|
||||
*/
|
||||
private function handle_actions(): void {
|
||||
$action = sanitize_text_field( $_GET['action'] ?? '' );
|
||||
$action = sanitize_text_field( wp_unslash( $_GET['action'] ?? '' ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
|
||||
|
||||
if ( ! in_array( $action, array( 'pr_core_approve', 'pr_core_reject' ), true ) ) {
|
||||
return;
|
||||
@@ -128,7 +133,7 @@ class PR_Core_Candidate_Queue_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
$candidate_id = absint( $_GET['candidate_id'] ?? 0 );
|
||||
$candidate_id = absint( wp_unslash( $_GET['candidate_id'] ?? 0 ) );
|
||||
if ( 0 === $candidate_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Renders and saves three meta boxes on the peptide edit screen
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Meta boxes for the peptide edit screen: scientific identifiers, dosing, and legal.
|
||||
*
|
||||
@@ -10,7 +16,6 @@ declare(strict_types=1);
|
||||
*
|
||||
* @see admin/class-pr-core-admin.php — Registers these hooks.
|
||||
* @see cpt/class-pr-core-peptide-cpt.php — Meta field definitions.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Peptide_Metaboxes {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Renders and saves two meta fields on the repo_daily edit screen
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Meta boxes for Repo Daily edit screen: author and clinical review flag.
|
||||
*
|
||||
@@ -14,7 +20,6 @@ declare(strict_types=1);
|
||||
*
|
||||
* @see admin/class-pr-core-admin.php — Registers these hooks.
|
||||
* @see cpt/class-pr-core-repo-daily-cpt.php — CPT definition.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Repo_Daily_Metaboxes {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Static methods that output HTML for each settings field on the PR Core settings page
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Render methods for the PR Core settings admin page.
|
||||
*
|
||||
@@ -9,7 +15,6 @@ declare(strict_types=1);
|
||||
* Dependencies: PR_Core_Settings (for option key constants).
|
||||
*
|
||||
* @see admin/class-pr-core-settings.php — Settings registration and sanitization.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Settings_Renderer {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Static admin settings class
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Settings page for PR Core plugin configuration.
|
||||
*
|
||||
@@ -10,7 +16,6 @@ declare(strict_types=1);
|
||||
* Dependencies: PR_Core_Peptide_CPT (for CAPABILITY constant).
|
||||
*
|
||||
* @see class-pr-core.php — Registers admin_menu + admin_init hooks pointing here.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Settings {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Renders and saves verification status sidebar meta box
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Verification status meta box for peptide edit screen.
|
||||
*
|
||||
@@ -9,7 +15,6 @@ declare(strict_types=1);
|
||||
* Dependencies: None.
|
||||
*
|
||||
* @see admin/class-pr-core-peptide-metaboxes.php — Other edit-screen meta boxes.
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Verification_Metabox {
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* WordPress dashboard widget showing peptides needing review (due/overdue)
|
||||
*
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dashboard widget for verification status overview.
|
||||
*
|
||||
@@ -9,7 +15,6 @@ declare(strict_types=1);
|
||||
* Dependencies: PR_Core_Peptide_Repository.
|
||||
*
|
||||
* @see scanner/class-pr-core-verification-scanner.php — Computes status via run_scan().
|
||||
* @package Peptide_Repo_Core
|
||||
*/
|
||||
class PR_Core_Verification_Widget {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user