Files
peptide-repo-core/peptide-repo-core.php
peptiderepo bb3967a071 fix(repo): drop stale TAX_FAMILY references (v0.2.1 P1 hotfix) (#2)
v0.2.0 removed TAX_FAMILY from PR_Core_Peptide_CPT but left two stale
references in PR_Core_Peptide_Repository:
  - find_all() family filter branch (class-pr-core-peptide-repository.php:95-102)
  - post_to_dto() families taxonomy lookup (class-pr-core-peptide-repository.php:138)

JSON-LD emission on single-peptide templates called find_by_id() ->
post_to_dto() which hit the undefined constant and killed every peptide
detail page render mid-wp_head().

Fix:
  - family filter is silently ignored until a future minor bump
    removes it from the REST schema.
  - post_to_dto() hardcodes $families = [] so the DTO still carries
    the field (REST response shape unchanged for existing clients).

Out-of-scope follow-ups:
  - Post-mortem on why the v0.2.0 QA gate missed this (unit tests
    exercised the CPT class in isolation, not the repository's
    consumption of its constants).
  - Add an integration-style test for JSON-LD emission on a single
    peptide so any future CPT-class refactor catches repository drift.

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-04-22 16:56:42 +07:00

52 lines
2.3 KiB
PHP

<?php
/**
* Plugin Name: Peptide Repo Core
* Plugin URI: https://peptiderepo.com
* Description: Canonical peptide schema — shared data layer for the peptiderepo.com ecosystem. Provides the peptide CPT, dosing rows, legal status cells, AI candidate queue, disclaimer component, and JSON-LD output.
* Version: 0.2.1
* Author: peptiderepo
* Author URI: https://peptiderepo.com
* License: GPL-2.0-or-later
* Text Domain: peptide-repo-core
* Requires PHP: 8.1
*
* @see ARCHITECTURE.md — Full data flow and file tree.
* @see CONVENTIONS.md — Naming patterns and extension guides.
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/* ── Constants ────────────────────────────────────────────────────────── */
define( 'PR_CORE_VERSION', '0.2.1' );
define( 'PR_CORE_PLUGIN_FILE', __FILE__ );
define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'PR_CORE_TARGET_SCHEMA_VERSION', 3 );
/* ── Autoloader ───────────────────────────────────────────────────────── */
require_once PR_CORE_PLUGIN_DIR . 'includes/class-pr-core-autoloader.php';
PR_Core_Autoloader::register();
// The main orchestrator class is loaded explicitly because its name (PR_Core)
// equals the autoloader prefix exactly — stripping "PR_Core_" yields an empty
// suffix, producing "class-pr-core-.php" instead of "class-pr-core.php".
require_once PR_CORE_PLUGIN_DIR . 'includes/class-pr-core.php';
/* ── Activation / Deactivation ────────────────────────────────────────── */
register_activation_hook( __FILE__, [ 'PR_Core_Activator', 'activate' ] );
register_deactivation_hook( __FILE__, [ 'PR_Core_Deactivator', 'deactivate' ] );
/* ── Boot ──────────────────────────────────────────────────────────────── */
add_action( 'plugins_loaded', static function (): void {
$plugin = new PR_Core();
$plugin->init();
} );