Interactive reconstitution calculator with peptide-specific presets. Core features: - [prc_calculator] shortcode with instant client-side math - Concentration (mg/mL), mcg/unit, injection volume, syringe units, doses/vial - Live presets from PR Core dosing data (graceful fallback to 8 defaults) - REST API (prc/v1): presets list/detail + server-side calculate - Transient-cached presets with event-driven invalidation - Dark mode + responsive design (320px+) - Full teardown in uninstall.php 12 PHP files (max 241 lines), 1 JS file, 1 CSS file. CI: PHP lint 8.1-8.3, PHPCS WordPress, 300-line check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
2.1 KiB
PHP
46 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: Peptide Reconstitution Calculator
|
|
* Plugin URI: https://peptiderepo.com/tools/reconstitution-calculator
|
|
* Description: Interactive reconstitution calculator with peptide-specific presets from Peptide Repo Core. Computes concentration, injection volume, syringe units, and doses per vial.
|
|
* Version: 1.0.0
|
|
* Author: peptiderepo
|
|
* Author URI: https://peptiderepo.com
|
|
* License: GPL-2.0-or-later
|
|
* Text Domain: peptide-reconstitution-calculator
|
|
* Requires PHP: 8.1
|
|
*
|
|
* @see ARCHITECTURE.md — Full data flow and file tree.
|
|
* @see CONVENTIONS.md — Naming patterns and extension guides.
|
|
*
|
|
* Depends on: Peptide Repo Core (optional — provides peptide-specific presets).
|
|
* Without PR Core, the calculator still works with manual entry and built-in defaults.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/* ── Constants ────────────────────────────────────────────────────────── */
|
|
|
|
define( 'PRC_VERSION', '1.0.0' );
|
|
define( 'PRC_PLUGIN_FILE', __FILE__ );
|
|
define( 'PRC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
define( 'PRC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
|
|
/* ── Autoloader ───────────────────────────────────────────────────────── */
|
|
|
|
require_once PRC_PLUGIN_DIR . 'includes/class-prc-autoloader.php';
|
|
PRC_Autoloader::register();
|
|
|
|
/* ── Activation / Deactivation ────────────────────────────────────────── */
|
|
|
|
register_activation_hook( __FILE__, [ 'PRC_Activator', 'activate' ] );
|
|
register_deactivation_hook( __FILE__, [ 'PRC_Deactivator', 'deactivate' ] );
|
|
|
|
/* ── Boot ─────────────────────────────────────────────────────────────── */
|
|
|
|
add_action( 'plugins_loaded', [ 'PRC_Calculator', 'boot' ] );
|