<?php namespace YahnisElsts\AdminMenuEditor; /** * A basic PSR-4 autoloader. */ class AmeAutoloader { protected $prefixes; /** * @param array<string,string> $namespacePrefixes */ public function __construct($namespacePrefixes) { //Ensure that each prefix ends with a backslash and each path ends //with a forward slash. $this->prefixes = array(); foreach ($namespacePrefixes as $prefix => $path) { $prefix = trim($prefix, '\\') . '\\'; $path = rtrim($path, '/\\') . '/'; $this->prefixes[$prefix] = $path; } } public function register() { spl_autoload_register([$this, 'loadClass']); } public function loadClass($class) { foreach ($this->prefixes as $prefix => $baseDirectory) { //Does the full class name start with this namespace prefix? $len = strlen($prefix); if ( strncmp($prefix, $class, $len) !== 0 ) { continue; } $relativeClassName = substr($class, $len); //Replace the prefix with the base directory, replace namespace separators //with directory separators, and append the ".php" extension. $fileName = $baseDirectory . str_replace('\\', '/', $relativeClassName) . '.php'; if ( file_exists($fileName) ) { require $fileName; } } } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
PHP-CSS-Parser | Folder | 0755 |
|
|
capabilities | Folder | 0755 |
|
|
.htaccess | File | 188 B | 0644 |
|
AmeAutoloader.php | File | 1.2 KB | 0644 |
|
access-test-runner.php | File | 8.16 KB | 0644 |
|
admin-menu-editor-mu.php | File | 2.11 KB | 0644 |
|
ame-option.php | File | 6.15 KB | 0644 |
|
ame-utils.php | File | 21.7 KB | 0644 |
|
auto-versioning.php | File | 5.09 KB | 0644 |
|
basic-dependencies.php | File | 1.86 KB | 0644 |
|
bbpress-role-override.php | File | 1.81 KB | 0644 |
|
cap-suggestion-box.php | File | 416 B | 0644 |
|
consistency-check.php | File | 3.6 KB | 0644 |
|
editor-page.php | File | 30.44 KB | 0644 |
|
generate-menu-dashicons.php | File | 3.79 KB | 0644 |
|
menu-editor-core.php | File | 193.51 KB | 0644 |
|
menu-item.php | File | 29.27 KB | 0644 |
|
menu.php | File | 19.63 KB | 0644 |
|
module.php | File | 4.4 KB | 0644 |
|
persistent-module.php | File | 1.74 KB | 0644 |
|
reflection-callable.php | File | 2.04 KB | 0644 |
|
role-utils.php | File | 10.63 KB | 0644 |
|
settings-page.php | File | 17.83 KB | 0644 |
|
shadow_plugin_framework.php | File | 12.61 KB | 0644 |
|
shortcodes.php | File | 3.38 KB | 0644 |
|
test-access-screen.php | File | 2.17 KB | 0644 |
|
version-conflict-check.php | File | 819 B | 0644 |
|