| Server IP : 5.129.245.98 / Your IP : 216.73.216.246 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/wp-content/plugins/rehub-framework/ |
Upload File : |
<?php
namespace Rehub;
defined('ABSPATH') OR exit;
final class Autoload {
private static $inited = false;
public function __construct(){
try {
spl_autoload_register(array( __CLASS__, 'autoload' ));
} catch(\Exception $e) {
}
}
public static function autoload($className){
if(false === strpos($className, __NAMESPACE__.'\\')) {
return;
}
$className = str_replace(__NAMESPACE__.'\\', '', $className);
$filePath = explode('\\', strtolower($className));
$fileName = '';
if(isset($filePath[count($filePath)-1])) {
$fileName = strtolower(
$filePath[count($filePath)-1]
);
$fileName = str_replace(array( '_', '--' ), array( '-', '-' ), $fileName);
$fileNameParts = explode('-', $fileName);
if(false !== strpos($fileName, 'trait')) {
$index = array_search('trait', $fileNameParts);
unset($fileNameParts[$index]);
$fileName = implode('-', $fileNameParts);
$fileName = "trait-{$fileName}.php";
} else if(false !== strpos($fileName, 'interface')) {
$index = array_search('interface', $fileNameParts);
unset($fileNameParts[$index]);
$fileName = implode('-', $fileNameParts);
$fileName = "interface-{$fileName}.php";
} else {
$fileName = "class-{$fileName}.php";
}
}
$fullPath = trailingslashit(__DIR__);
for($i = 0; $i < count($filePath)-1; $i++) {
$fullPath .= trailingslashit($filePath[$i]);
}
$fullPath .= $fileName;
if(stream_resolve_include_path($fullPath)) {
require_once $fullPath;
}
}
}
new Autoload;