Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4b4e06a98f | |||
31c51c1a5b |
@ -96,14 +96,27 @@ class Autoloader {
|
|||||||
foreach ( self::$namespaces[ $namespace ] as $key => $folder ) {
|
foreach ( self::$namespaces[ $namespace ] as $key => $folder ) {
|
||||||
if ( file_exists( $folder . $file ) ) {
|
if ( file_exists( $folder . $file ) ) {
|
||||||
$possible_locations[] = $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 ) ) {
|
if ( !empty( $possible_locations ) ) {
|
||||||
require_once $possible_locations[0];
|
require_once $possible_locations[0];
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +43,16 @@ class Route {
|
|||||||
* @return string - The string representation of the server's transfer protocol
|
* @return string - The string representation of the server's transfer protocol
|
||||||
*/
|
*/
|
||||||
public static function getProtocol() {
|
public static function getProtocol() {
|
||||||
if ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) {
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||||
return 'https';
|
return 'https';
|
||||||
}
|
}
|
||||||
if ( $_SERVER['SERVER_PORT'] == 443 ) {
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||||
|
return 'https';
|
||||||
|
}
|
||||||
|
if (!empty($_SERVER['HTTP_X_FORWARDED_PORT']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443) {
|
||||||
|
return 'https';
|
||||||
|
}
|
||||||
|
if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
|
||||||
return 'https';
|
return 'https';
|
||||||
}
|
}
|
||||||
return 'http';
|
return 'http';
|
||||||
|
Reference in New Issue
Block a user