PR Vision v0.1.1: rename from peptide-geo-monitor + P2 fixes
- Exhaustive rename: PGM_ -> PRV_, pgm_ -> prv_, text domain and slug peptide-geo-monitor -> pr-vision, admin menu GEO Monitor -> PR Vision, main file peptide-geo-monitor.php -> pr-vision.php, DB table pgm_ai_visibility -> prv_ai_visibility. - P2-A: replace ltrim($host,'www.') character-mask with str_starts_with/substr prefix strip in PRV_Citation_Detector. Adds test coverage for wikipedia.org, webmd.com survival. - P2-B: drop continue-on-error: true from PHPCS CI step; WordPress Coding Standards now gates the build. - P2-C: remove dead in-run cache from PRV_Probe_Runner::run(); each (peptide, intent, model) triplet is visited once per run, cache hit is structurally impossible. - Version bump 0.1.0 -> 0.1.1 + CHANGELOG [0.1.1] entry. Agent-Session: pr-vision rename v0.1.1
This commit is contained in:
69
includes/core/class-prv-autoloader.php
Normal file
69
includes/core/class-prv-autoloader.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class and interface autoloader for the PR Vision plugin.
|
||||
*
|
||||
* Converts PRV_* class/interface names to file paths under includes/.
|
||||
* Naming conventions:
|
||||
* PRV_Foo_Bar (class) → class-prv-foo-bar.php
|
||||
* PRV_Foo_Bar (interface) → interface-prv-foo-bar.php (tried second)
|
||||
*
|
||||
* Who triggers: Plugin boot (pr-vision.php) — called once before
|
||||
* any PRV_* class or interface is instantiated.
|
||||
* Dependencies: None (pure PHP).
|
||||
*
|
||||
* @package PrVision
|
||||
*/
|
||||
class PRV_Autoloader {
|
||||
|
||||
/**
|
||||
* Register the autoloader with the SPL stack.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register(): void {
|
||||
spl_autoload_register( array( static::class, 'load' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to load a PRV_* class or interface file.
|
||||
*
|
||||
* Walks the known include subdirectories in order, trying the class-
|
||||
* filename first and the interface-filename second.
|
||||
*
|
||||
* Side effects: require_once on a matching file.
|
||||
*
|
||||
* @param string $class_name Fully-qualified class or interface name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function load( string $class_name ): void {
|
||||
if ( 0 !== strpos( $class_name, 'PRV_' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$slug = strtolower( str_replace( '_', '-', $class_name ) );
|
||||
|
||||
$search_dirs = array(
|
||||
PRV_PLUGIN_DIR . 'includes/core/',
|
||||
PRV_PLUGIN_DIR . 'includes/providers/',
|
||||
PRV_PLUGIN_DIR . 'includes/collector/',
|
||||
PRV_PLUGIN_DIR . 'includes/panel/',
|
||||
PRV_PLUGIN_DIR . 'includes/',
|
||||
);
|
||||
|
||||
// Try class file first, then interface file.
|
||||
$candidates = array( 'class-' . $slug . '.php', 'interface-' . $slug . '.php' );
|
||||
|
||||
foreach ( $search_dirs as $dir ) {
|
||||
foreach ( $candidates as $file ) {
|
||||
$path = $dir . $file;
|
||||
if ( file_exists( $path ) ) {
|
||||
require_once $path;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user