HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: //home/madepabj/gharana.pk/price/wp-content/plugins/rehub-framework/class-autoload.php
<?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;