HEX
Server: Apache
System: Linux p3plzcpnl503456.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: vrposilw0xwl (9558758)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/vrposilw0xwl/public_html/wp-content/plugins/essential-blocks/autoload.php
<?php

spl_autoload_register(function ($class) {
    // project-specific namespace prefix
    $prefix = 'EssentialBlocks\\';

    // base directory for the namespace prefix
    $base_dir = __DIR__ . '/includes/';

    // does the class use the namespace prefix?
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        // no, move to the next registered autoloader
        return;
    }

    /**
     * This is for blocks autoloading.
     */
    // $class_array = explode('\\', $class);
    // if( ! empty( $class_array[1] ) && $class_array[1] === 'blocks' ) {
    //     $base_dir = __DIR__ . '/';
    // }

    // get the relative class name
    $relative_class = substr($class, $len);

    // replace the namespace prefix with the base directory, replace namespace
    // separators with directory separators in the relative class name, append
    // with .php
    $file = $base_dir . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';

    // if the file exists, require it
    if (file_exists($file)) {
        require $file;
    }
});