# user-access-manager/2.0.0/autoload.php

User Access Manager, version 2.0.0. 20 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/2.0.0/code/autoload.php
- Raw: https://pluginprobe.com/plugins/user-access-manager/2.0.0/raw/autoload.php
- Modified: 2017-04-23T10:38:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/user-access-manager/2.0.0/code/autoload.php#L10-L20`.

```php
<?php
spl_autoload_register(function ($className) {
    $className = ltrim($className, '\\');
    $lastNamespacePosition = strrpos($className, '\\');
    $fileName = dirname(__FILE__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR;

    if ($lastNamespacePosition !== false) {
        $sNamespace = substr($className, 0, $lastNamespacePosition);
        $className = substr($className, $lastNamespacePosition + 1);
        $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $sNamespace).DIRECTORY_SEPARATOR;
    }

    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';

    if (file_exists($fileName)) {
        /** @noinspection PhpIncludeInspection */
        require_once $fileName;
    }
});

```
