fix: address QA P1 + P2 findings from 9aa5309 review

P1 fix: Add class_exists() guard in PRC_Preset_Provider before
instantiating PR Core repository classes. If PR Core constant is
defined but classes fail to autoload, fall back to defaults instead
of crashing.

P2 fixes:
- Remove unused nonce from wp_localize_script (all endpoints public)
- Add cross-reference comments pinning SYRINGE_UNITS_PER_ML across
  PRC_Math, calculator.js, and prcConfig.syringeUnits

QA verdict: qa-reviews/peptide-reconstitution-calculator/2026-04-17-9aa5309.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-17 14:49:59 +07:00
parent 9aa5309eb4
commit babc2ae72a
4 changed files with 16 additions and 3 deletions

4
includes/class-prc-math.php Normal file → Executable file
View File

@@ -25,6 +25,10 @@ class PRC_Math {
/**
* Standard insulin syringe size in units (100 IU = 1 mL).
*
* Mirrored in: assets/js/calculator.js (SYRINGE_UNITS_PER_ML)
* and prcConfig.syringeUnits (class-prc-shortcode.php).
* All three MUST stay in sync.
*/
private const SYRINGE_UNITS_PER_ML = 100;