bugfix for camelCase filenames

This commit is contained in:
Joey Kimsey
2024-08-20 06:26:47 -04:00
parent 171183c0ab
commit 31c51c1a5b

View File

@ -96,14 +96,27 @@ class Autoloader {
foreach ( self::$namespaces[ $namespace ] as $key => $folder ) {
if ( file_exists( $folder . $file ) ) {
$possible_locations[] = $folder . $file;
break;
} elseif ( file_exists( $folder . ucfirst( $file ) ) ) {
$possible_locations[] = $folder . ucfirst( $file );
break;
}
$newFile = '';
$exploded = explode( '_', $file );
foreach ( $exploded as &$value ) {
$newFile .= ucfirst( $value );
}
if ( file_exists( $folder . $newFile ) ) {
$possible_locations[] = $folder . $newFile;
break;
} elseif ( file_exists( $folder . ucfirst( $newFile ) ) ) {
$possible_locations[] = $folder . ucfirst( $newFile );
break;
}
}
// foreach ( $possible_locations as $location ) {
// // report the locations
// }
if ( !empty( $possible_locations ) ) {
require_once $possible_locations[0];
return;
}
}