Add support to known class paths for conditional loading.
This commit is contained in:
parent
05930e4275
commit
c41293e1ef
|
@ -20,6 +20,10 @@ class WC_Autoloader {
|
|||
*/
|
||||
private $include_path = '';
|
||||
|
||||
private static array $known_classes_paths = array(
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* The Constructor.
|
||||
*/
|
||||
|
@ -65,6 +69,11 @@ class WC_Autoloader {
|
|||
public function autoload( $class ) {
|
||||
$class = strtolower( $class );
|
||||
|
||||
if ( isset( self::$known_classes_paths[ $class ] ) ) {
|
||||
$this->load_file( self::$known_classes_paths[ $class ] );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 0 !== strpos( $class, 'wc_' ) ) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue