diff --git a/includes/admin/class-pr-core-admin-columns.php b/includes/admin/class-pr-core-admin-columns.php index fe33d10..dd8bee7 100644 --- a/includes/admin/class-pr-core-admin-columns.php +++ b/includes/admin/class-pr-core-admin-columns.php @@ -9,6 +9,7 @@ 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 { @@ -44,13 +45,13 @@ class PR_Core_Admin_Columns { public function render_column( string $column, int $post_id ): void { switch ( $column ) { case 'pr_evidence': - $strength = get_post_meta( $post_id, 'evidence_strength', true ) ?: 'preclinical'; + $strength = get_post_meta( $post_id, 'evidence_strength', true ) ?: 'preclinical'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $label = apply_filters( 'pr_core_evidence_strength_label', $strength, $strength ); echo esc_html( $label ); break; case 'pr_editorial': - $status = get_post_meta( $post_id, 'editorial_review_status', true ) ?: 'draft'; + $status = get_post_meta( $post_id, 'editorial_review_status', true ) ?: 'draft'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found echo esc_html( ucfirst( str_replace( '-', ' ', $status ) ) ); break; diff --git a/includes/admin/class-pr-core-admin.php b/includes/admin/class-pr-core-admin.php index a266689..2690e0f 100644 --- a/includes/admin/class-pr-core-admin.php +++ b/includes/admin/class-pr-core-admin.php @@ -13,6 +13,7 @@ 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 { diff --git a/includes/admin/class-pr-core-ajax-handlers.php b/includes/admin/class-pr-core-ajax-handlers.php index c5bbac2..ca48a5f 100644 --- a/includes/admin/class-pr-core-ajax-handlers.php +++ b/includes/admin/class-pr-core-ajax-handlers.php @@ -10,6 +10,7 @@ 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 { diff --git a/includes/admin/class-pr-core-candidate-queue-page.php b/includes/admin/class-pr-core-candidate-queue-page.php index 4433e38..17cea5d 100644 --- a/includes/admin/class-pr-core-candidate-queue-page.php +++ b/includes/admin/class-pr-core-candidate-queue-page.php @@ -12,6 +12,7 @@ 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 { diff --git a/includes/admin/class-pr-core-peptide-metaboxes.php b/includes/admin/class-pr-core-peptide-metaboxes.php index 6fe001e..8f92264 100644 --- a/includes/admin/class-pr-core-peptide-metaboxes.php +++ b/includes/admin/class-pr-core-peptide-metaboxes.php @@ -10,6 +10,7 @@ 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 { @@ -78,7 +79,7 @@ class PR_Core_Peptide_Metaboxes { } // Evidence strength dropdown. - $current_strength = get_post_meta( $post->ID, 'evidence_strength', true ) ?: 'preclinical'; + $current_strength = get_post_meta( $post->ID, 'evidence_strength', true ) ?: 'preclinical'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found echo ''; // Editorial review status. - $current_review = get_post_meta( $post->ID, 'editorial_review_status', true ) ?: 'draft'; + $current_review = get_post_meta( $post->ID, 'editorial_review_status', true ) ?: 'draft'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found echo '', + esc_attr( self::RELATED_LIMIT ), + absint( get_option( self::RELATED_LIMIT, 3 ) ) + ); + echo '

' . esc_html__( 'Number of articles to display (1-6). Default: 3.', 'peptide-repo-core' ) . '

'; + } + + /** + * Render output. + * + * @return void + */ + public static function render_verification_section(): void { + echo '

' . esc_html__( 'Configure automatic staleness scanning and digest notifications.', 'peptide-repo-core' ) . '

'; + } + + /** + * Render output. + * + * @return void + */ + public static function render_cadence_field(): void { + $current = get_option( self::SCAN_CADENCE, 'weekly' ); + echo ''; + } + + /** + * Render output. + * + * @return void + */ + public static function render_threshold_field(): void { + printf( '', esc_attr( self::DEFAULT_THRESHOLD ), absint( get_option( self::DEFAULT_THRESHOLD, 180 ) ) ); + } + + /** + * Render output. + * + * @return void + */ + public static function render_high_velocity_field(): void { + printf( '', esc_attr( self::HIGH_VELOCITY_THRESHOLD ), absint( get_option( self::HIGH_VELOCITY_THRESHOLD, 60 ) ) ); + } + + /** + * Render output. + * + * @return void + */ + public static function render_email_field(): void { + printf( + '', + esc_attr( self::VERIFICATION_EMAIL ), + esc_attr( (string) get_option( self::VERIFICATION_EMAIL, '' ) ) + ); + echo '

' . esc_html__( 'Comma-separated. Leave blank to disable email digests.', 'peptide-repo-core' ) . '

'; + } + +} diff --git a/includes/admin/class-pr-core-settings.php b/includes/admin/class-pr-core-settings.php index 18d8d47..178e961 100644 --- a/includes/admin/class-pr-core-settings.php +++ b/includes/admin/class-pr-core-settings.php @@ -10,28 +10,57 @@ 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 { - /** @var string Option group shared by all PR Core settings. */ + /** + * Option group shared by all PR Core settings. + * + * @var string Option group shared by all PR Core settings. + */ public const OPTION_GROUP = 'pr_core_settings'; - /** @var string Option key: enable/disable related articles. */ + /** + * Option key: enable/disable related articles. + * + * @var string Option key: enable/disable related articles. + */ private const RELATED_ENABLED = 'pr_core_related_posts_enabled'; - /** @var string Option key: related articles limit (1-6). */ + /** + * Option key: related articles limit (1-6). + * + * @var string Option key: related articles limit (1-6). + */ private const RELATED_LIMIT = 'pr_core_related_posts_limit'; - /** @var string Option key: WP-cron scan cadence. */ + /** + * Option key: WP-cron scan cadence. + * + * @var string Option key: WP-cron scan cadence. + */ private const SCAN_CADENCE = 'pr_core_scan_cadence'; - /** @var string Option key: default staleness threshold in days. */ + /** + * Option key: default staleness threshold in days. + * + * @var string Option key: default staleness threshold in days. + */ private const DEFAULT_THRESHOLD = 'pr_core_default_threshold'; - /** @var string Option key: high-velocity staleness threshold in days. */ + /** + * Option key: high-velocity staleness threshold in days. + * + * @var string Option key: high-velocity staleness threshold in days. + */ private const HIGH_VELOCITY_THRESHOLD = 'pr_core_high_velocity_threshold'; - /** @var string Option key: comma-separated notification email list. */ + /** + * Option key: comma-separated notification email list. + * + * @var string Option key: comma-separated notification email list. + */ private const VERIFICATION_EMAIL = 'pr_core_verification_email'; /** @@ -52,24 +81,8 @@ class PR_Core_Settings { ); } - /** - * Render the settings page form. - * - * @return void - */ public static function render_page(): void { - ?> -
-

-
- -
-
- %s', - esc_attr( self::RELATED_ENABLED ), - checked( $enabled, true, false ), - esc_html__( 'Show related monographs on single peptide pages', 'peptide-repo-core' ) - ); + PR_Core_Settings_Renderer::render_enabled_field(); } - /** @return void */ public static function render_limit_field(): void { - printf( - '', - esc_attr( self::RELATED_LIMIT ), - absint( get_option( self::RELATED_LIMIT, 3 ) ) - ); - echo '

' . esc_html__( 'Number of articles to display (1-6). Default: 3.', 'peptide-repo-core' ) . '

'; + PR_Core_Settings_Renderer::render_limit_field(); } /** @@ -149,7 +149,7 @@ class PR_Core_Settings { return min( 6, max( 1, (int) $value ) ); } - // ── Verification ───────────────────────────────────────────────────── + // ── Verification ─────────────────────────────────────────────────────. /** * Register Verification settings. @@ -201,43 +201,24 @@ class PR_Core_Settings { add_settings_field( self::VERIFICATION_EMAIL, __( 'Notification email(s)', 'peptide-repo-core' ), array( __CLASS__, 'render_email_field' ), self::OPTION_GROUP, 'pr_core_verification' ); } - /** @return void */ public static function render_verification_section(): void { - echo '

' . esc_html__( 'Configure automatic staleness scanning and digest notifications.', 'peptide-repo-core' ) . '

'; + PR_Core_Settings_Renderer::render_verification_section(); } - /** @return void */ public static function render_cadence_field(): void { - $current = get_option( self::SCAN_CADENCE, 'weekly' ); - echo ''; + PR_Core_Settings_Renderer::render_cadence_field(); } - /** @return void */ public static function render_threshold_field(): void { - printf( '', esc_attr( self::DEFAULT_THRESHOLD ), absint( get_option( self::DEFAULT_THRESHOLD, 180 ) ) ); + PR_Core_Settings_Renderer::render_threshold_field(); } - /** @return void */ public static function render_high_velocity_field(): void { - printf( '', esc_attr( self::HIGH_VELOCITY_THRESHOLD ), absint( get_option( self::HIGH_VELOCITY_THRESHOLD, 60 ) ) ); + PR_Core_Settings_Renderer::render_high_velocity_field(); } - /** @return void */ public static function render_email_field(): void { - printf( - '', - esc_attr( self::VERIFICATION_EMAIL ), - esc_attr( (string) get_option( self::VERIFICATION_EMAIL, '' ) ) - ); - echo '

' . esc_html__( 'Comma-separated. Leave blank to disable email digests.', 'peptide-repo-core' ) . '

'; + PR_Core_Settings_Renderer::render_email_field(); } /** diff --git a/includes/admin/class-pr-core-verification-metabox.php b/includes/admin/class-pr-core-verification-metabox.php index f80f9ce..abe058c 100644 --- a/includes/admin/class-pr-core-verification-metabox.php +++ b/includes/admin/class-pr-core-verification-metabox.php @@ -9,6 +9,7 @@ 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 { @@ -38,12 +39,12 @@ class PR_Core_Verification_Metabox { wp_nonce_field( 'pr_core_verification_nonce', 'pr_core_verification_nonce' ); $last_verified = get_post_meta( $post->ID, '_pr_last_source_verified', true ); - $velocity = get_post_meta( $post->ID, '_pr_verification_velocity', true ) ?: 'medium'; - $status = get_post_meta( $post->ID, '_pr_verification_status', true ) ?: 'current'; - $notes = get_post_meta( $post->ID, '_pr_verification_notes', true ) ?: ''; + $velocity = get_post_meta( $post->ID, '_pr_verification_velocity', true ) ?: 'medium'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + $status = get_post_meta( $post->ID, '_pr_verification_status', true ) ?: 'current'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + $notes = get_post_meta( $post->ID, '_pr_verification_notes', true ) ?: ''; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found echo '

' . esc_html__( 'Last Verified', 'peptide-repo-core' ) . ':
'; - echo '' . esc_html( $last_verified ?: '—' ) . '

'; + echo '' . esc_html( $last_verified ?: '—' ) . '

'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found echo '

' . esc_html__( 'Verification Velocity', 'peptide-repo-core' ) . ':
'; echo '