- All 49 PHP includes files: expand minimal file docblocks to include a short description (satisfies Generic.Commenting.DocComment.MissingShort) Format: <?php\n/**\n * Filename-derived description.\n *\n * @package ...\n */ - settings.php delegation stubs: add compact docblocks to all 8 render_* methods (Squiz.Commenting.FunctionComment.Missing, lines 93-231) - settings.php: compress mirrored @var constant docblocks to single-line; remove redundant intermediate class docblock → 273 lines (was 315) - rest-controller.php: compress 1 mirrored @var docblock → 298 lines - migration-0004: compress 4 property docblocks → 288 lines - verification-widget.php line 111: cast days_since to int + phpcs:ignore - verification-metabox.php line 80: phpcs:ignore on hardcoded badge_class - peptide-metaboxes.php line 86: phpcs:ignore EscapeOutput (esc_attr'd above) - peptide-metaboxes.php lines 147/148: Yoda null !== dose_min/dose_max - peptide-metaboxes.php line 248: phpcs:ignore InputNotSanitized (isset only) - peptide-metaboxes.php line 259: wrap pr_core_editorial_review_status in wp_unslash() - peptide-metaboxes.php line 262: Yoda 'published' !== old_status Agent-Session: claude-adopt-ci-20260616
102 lines
2.5 KiB
PHP
Executable File
102 lines
2.5 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Repo Daily Taxonomy.
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Defines the `repo_daily_category` taxonomy attached to repo_daily CPT
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
/**
|
|
* Registers the repo_daily_category taxonomy for Repo Daily articles.
|
|
*
|
|
* What: Defines the `repo_daily_category` taxonomy attached to repo_daily CPT.
|
|
* Seeds four content categories on activation: article, guide, comparison, news.
|
|
* Who calls it: PR_Core::init() on plugins_loaded; activation hook seeding.
|
|
* Dependencies: None.
|
|
*
|
|
* Non-hierarchical taxonomy with REST support. Used by editorial and publishing
|
|
* workflows to categorize Repo Daily content.
|
|
*
|
|
* @see ARCHITECTURE.md — Content type taxonomy specification.
|
|
* @see CONVENTIONS.md — Taxonomy ownership pattern.
|
|
*/
|
|
class PR_Core_Repo_Daily_Taxonomy {
|
|
|
|
/**
|
|
* Taxonomy: repo_daily_category.
|
|
*
|
|
* @var string Taxonomy: repo_daily_category.
|
|
*/
|
|
public const TAX_CATEGORY = 'repo_daily_category';
|
|
|
|
/**
|
|
* Register WordPress hooks for taxonomy and seeding.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register_hooks(): void {
|
|
add_action( 'init', array( __CLASS__, 'register_taxonomy' ) );
|
|
}
|
|
|
|
/**
|
|
* Register the `repo_daily_category` taxonomy.
|
|
*
|
|
* Side effects: registers taxonomy with WordPress.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function register_taxonomy(): void {
|
|
if ( taxonomy_exists( self::TAX_CATEGORY ) ) {
|
|
return;
|
|
}
|
|
|
|
register_taxonomy(
|
|
self::TAX_CATEGORY,
|
|
PR_Core_Repo_Daily_CPT::POST_TYPE,
|
|
array(
|
|
'labels' => array(
|
|
'name' => __( 'Category', 'peptide-repo-core' ),
|
|
'singular_name' => __( 'Category', 'peptide-repo-core' ),
|
|
),
|
|
'public' => true,
|
|
'publicly_queryable' => true,
|
|
'show_in_rest' => true,
|
|
'show_ui' => true,
|
|
'show_admin_column' => true,
|
|
'hierarchical' => false,
|
|
'rewrite' => array(
|
|
'slug' => 'daily/category',
|
|
'with_front' => false,
|
|
),
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Seed default category terms on activation.
|
|
*
|
|
* Idempotent: checks for existence of each term before inserting.
|
|
* Called by PR_Core_Activator during plugin activation.
|
|
*
|
|
* Side effects: may insert terms into wp_terms and wp_term_taxonomy.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function seed_terms(): void {
|
|
$terms = array( 'article', 'guide', 'comparison', 'news' );
|
|
|
|
foreach ( $terms as $term ) {
|
|
if ( ! term_exists( $term, self::TAX_CATEGORY ) ) {
|
|
wp_insert_term( $term, self::TAX_CATEGORY );
|
|
}
|
|
}
|
|
}
|
|
}
|