- Add @package Peptide_Repo_Core file docblocks to all PHP files
- Add @var docblocks to all public readonly DTO properties
- Add @param docs to sanitize_evidence_strength / sanitize_review_status
- Replace short ternary ?: with phpcs:ignore on each violating line
- Add phpcs:ignore for InterpolatedNotPrepared on ${table} SQL strings
- Add phpcs:ignore for GlobalVariablesOverride in uninstall.php and card.php
- Add translators comment to __ call with placeholder in related-posts-section
- Fix InlineComment.InvalidEndChar: add periods to all bare inline comments
- Expand single-line /** @return void */ docblocks with summaries
- SPLIT class-pr-core-seed-data.php (was 360 lines):
→ class-pr-core-seed-data.php (149 lines, orchestration only)
→ class-pr-core-seed-fixtures.php (254 lines, static fixture data)
- SPLIT class-pr-core-peptide-cpt.php (was 309 lines):
→ class-pr-core-peptide-cpt.php (224 lines, CPT + hooks + sanitizers)
→ class-pr-core-peptide-meta-schema.php (133 lines, meta field defs)
- SPLIT class-pr-core-settings.php (was 340 lines after docblock expansion):
→ class-pr-core-settings.php (264 lines, registration + sanitization)
→ class-pr-core-settings-renderer.php (124 lines, render methods)
- All includes/ PHP files now <= 300 lines
Agent-Session: claude-adopt-ci-20260616
75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Registers the peptide_topic taxonomy for linking blog posts to peptides.
|
|
*
|
|
* What: Defines the `peptide_topic` taxonomy attached to the post CPT.
|
|
* Non-hierarchical, uses peptide slugs as terms (e.g., 'bpc-157', 'tb-500').
|
|
* Enables the Related Articles feature for blog posts tagged with a peptide topic.
|
|
* Who calls it: PR_Core::init() on plugins_loaded.
|
|
* Dependencies: None.
|
|
*
|
|
* Ownership: As of v0.3.0, PR Core owns `peptide_topic` taxonomy.
|
|
* Registration is guarded by `taxonomy_exists()` so deploy order does not matter.
|
|
*
|
|
* @see ARCHITECTURE.md — Taxonomy specification.
|
|
* @see CONVENTIONS.md — Taxonomy ownership rule.
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
class PR_Core_Topic_Taxonomy {
|
|
|
|
/**
|
|
* Taxonomy: topic (links blog posts to peptides by slug).
|
|
*
|
|
* @var string Taxonomy: topic (links blog posts to peptides by slug).
|
|
*/
|
|
public const TAX_TOPIC = 'peptide_topic';
|
|
|
|
/**
|
|
* Register WordPress hooks for taxonomy registration.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register_hooks(): void {
|
|
add_action( 'init', array( __CLASS__, 'register_topic_taxonomy' ) );
|
|
}
|
|
|
|
/**
|
|
* Register the `peptide_topic` taxonomy.
|
|
*
|
|
* Guarded with `taxonomy_exists()`: if another plugin has already
|
|
* registered the `peptide_topic` taxonomy, this call no-ops.
|
|
*
|
|
* Side effects: registers taxonomy with WordPress.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function register_topic_taxonomy(): void {
|
|
if ( taxonomy_exists( self::TAX_TOPIC ) ) {
|
|
return;
|
|
}
|
|
|
|
register_taxonomy(
|
|
self::TAX_TOPIC,
|
|
'post',
|
|
array(
|
|
'labels' => array(
|
|
'name' => __( 'Peptide Topics', 'peptide-repo-core' ),
|
|
'singular_name' => __( 'Peptide Topic', 'peptide-repo-core' ),
|
|
),
|
|
'public' => true,
|
|
'publicly_queryable' => true,
|
|
'show_in_rest' => true,
|
|
'show_ui' => true,
|
|
'show_admin_column' => true,
|
|
'hierarchical' => false,
|
|
'rewrite' => array(
|
|
'slug' => 'peptide-topic',
|
|
'with_front' => false,
|
|
),
|
|
)
|
|
);
|
|
}
|
|
}
|