From 21c4b5955c3d047d58701fa11d7211982c939787 Mon Sep 17 00:00:00 2001 From: Nol de Roos <108540791+nolderoos@users.noreply.github.com> Date: Thu, 14 May 2026 16:05:59 +0200 Subject: [PATCH 1/2] Remove short ot_ prefix from postmeta/identifiers; debug-gate error_log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Proactive hardening before the wp.org resubmission. The round-1 review scoped the prefix finding to CPT slugs (fixed in 1.1.0 → opentr_*); this extends the cleanup to every other shared/global identifier so a stricter re-reviewer can't reopen it. - Postmeta keys: _ot_* → _opentrust_*, with a v4→v5 DB migration (rename_postmeta_keys_v5) that mirrors the proven v4 CPT-rename pattern: idempotent bulk UPDATEs, runs once on upgrade, retries safely if interrupted, busts caches via the existing maybe_upgrade() tail. - Query vars ot_policy_slug/ot_version → opentrust_*; rewrite rules recompiled by the existing flush transient. - Meta-box IDs, admin column IDs, import/export form field names and the $_FILES key → opentrust_* (request-scoped, no migration). - LEGACY_META_MAP added as the single source of truth for the migration, the IO import-remap (keeps pre-1.1.1 export archives importable), and uninstall cleanup. - error_log() calls routed through a new WP_DEBUG-gated OpenTrust::debug_log(). - wpml-config.xml keys renamed (+ the previously-missing cert artifact id); uninstall.php clears orphaned attachment + user meta. - Version bumped to 1.1.1, DB schema to 5, POT regenerated. Out of scope by design: CSS classes, data-ot-* attributes, local $ot_ variables, and the ot_enc_v1: ciphertext marker — none are reviewable shared registries. Co-Authored-By: Claude Opus 4.7 (1M context) --- assets/js/admin.js | 10 +- includes/class-opentrust-admin-ai.php | 3 +- includes/class-opentrust-admin-tools.php | 40 +- includes/class-opentrust-admin.php | 6 +- includes/class-opentrust-catalog.php | 8 +- includes/class-opentrust-chat-corpus.php | 10 +- includes/class-opentrust-chat-summarizer.php | 9 +- includes/class-opentrust-cpt.php | 427 +++-- includes/class-opentrust-io.php | 142 +- includes/class-opentrust-render.php | 36 +- includes/class-opentrust-repository.php | 66 +- includes/class-opentrust-version.php | 26 +- includes/class-opentrust.php | 88 +- includes/data/certification-catalog.php | 138 +- includes/data/data-practice-catalog.php | 120 +- includes/data/subprocessor-catalog.php | 1640 ++++++++--------- .../class-opentrust-chat-provider.php | 3 +- languages/opentrust.pot | 340 ++-- opentrust.php | 6 +- readme.txt | 12 +- uninstall.php | 10 + wpml-config.xml | 66 +- 22 files changed, 1697 insertions(+), 1509 deletions(-) diff --git a/assets/js/admin.js b/assets/js/admin.js index 4c8ab5d..10ccce7 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -445,9 +445,9 @@ if (!titleInput) return; // Meta keys (with leading underscore) map to DOM ids by stripping the - // leading "_ot_" and re-prefixing with "ot_". + // leading underscore: `_opentrust_cert_type` → `opentrust_cert_type`. var metaKeyToDomId = function (metaKey) { - return metaKey.replace(/^_ot_/, 'ot_'); + return metaKey.replace(/^_opentrust_/, 'opentrust_'); }; var normalize = function (value) { @@ -801,7 +801,7 @@ * Certification type toggle. * * Shows or hides the "certified only" fields (issuing body, status, dates) - * based on the `_ot_cert_type` select. A compliant certification has no + * based on the `_opentrust_cert_type` select. A compliant certification has no * audit and therefore no auditor, no issue date, no expiry, and no status * state machine, so those fields are hidden from the form entirely. * Hidden inputs still submit their values, which matches the "keep data @@ -836,7 +836,7 @@ (function () { 'use strict'; - var toggle = document.getElementById('ot_publish_new_version'); + var toggle = document.getElementById('opentrust_publish_new_version'); if (!toggle) return; toggle.addEventListener('change', function () { @@ -845,7 +845,7 @@ wrap.style.display = this.checked ? 'block' : 'none'; } if (this.checked) { - var summary = document.getElementById('ot_version_summary'); + var summary = document.getElementById('opentrust_version_summary'); if (summary) summary.focus(); } }); diff --git a/includes/class-opentrust-admin-ai.php b/includes/class-opentrust-admin-ai.php index f0be2f9..9c49c46 100644 --- a/includes/class-opentrust-admin-ai.php +++ b/includes/class-opentrust-admin-ai.php @@ -870,8 +870,7 @@ public static function cron_refresh_all_providers(): void { $self = self::instance(); $settings = OpenTrust::get_settings(); $active = (string) ($settings['ai_provider'] ?? ''); - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- diagnostic for cron refresh failures - $log = static fn(string $slug, string $why) => error_log("[OpenTrust] AI model refresh failed for {$slug}: {$why}"); + $log = static fn(string $slug, string $why) => OpenTrust::debug_log("AI model refresh failed for {$slug}: {$why}"); $dirty = false; foreach ($stored_keys as $slug => $api_key) { diff --git a/includes/class-opentrust-admin-tools.php b/includes/class-opentrust-admin-tools.php index 97c4d6d..4de2bcc 100644 --- a/includes/class-opentrust-admin-tools.php +++ b/includes/class-opentrust-admin-tools.php @@ -182,11 +182,11 @@ private function render_export_panel(array $exportable): void {
@@ -199,7 +199,7 @@ private function render_export_panel(array $exportable): void { ?>
- + () @@ -207,7 +207,7 @@ private function render_export_panel(array $exportable): void {