public function __construct() { $list = ClassAliasList::getInstance(); foreach ($list->getRegisteredAliases() as $alias => $class) { if (!class_exists($class)) { echo "Error: {$class} doesn't exist.\n"; continue; } $this->registerClass($alias, $class); } }
/** * Aliases concrete5 classes to shorter class name aliases * * IDEs will not recognize these classes by default. A symbols file can be generated to * assist IDEs by running SymbolGenerator::render() via PHP or executing the command-line * 'concrete/bin/concrete5 c5:ide-symbols */ protected function setupAliasAutoloader() { $loader = $this; spl_autoload_register(function ($class) use($loader) { $list = ClassAliasList::getInstance(); if (array_key_exists($class, $aliases = $list->getRegisteredAliases())) { // we have an alias for it, but we don't have it yet loaded // (because after all, we're in the auto loader.) $fullClass = $aliases[$class]; if (!class_exists($fullClass, false)) { spl_autoload_call($fullClass); } // finally, we set up a class alias for this list. We do this now because // we don't know earlier what namespace it'll be in class_alias($fullClass, $class); } }); }
*/ if (!$config->has('app.timezone')) { // There is no timezone set. $config->set('app.timezone', @date_default_timezone_get()); } if (!$config->has('app.server_timezone')) { // There is no server timezone set. $config->set('app.server_timezone', @date_default_timezone_get()); } @date_default_timezone_set($config->get('app.timezone')); /** * ---------------------------------------------------------------------------- * Setup core classes aliases. * ---------------------------------------------------------------------------- */ $list = ClassAliasList::getInstance(); $list->registerMultiple($config->get('app.aliases')); $list->registerMultiple($config->get('app.facades')); /** * ---------------------------------------------------------------------------- * Setup the core service groups. * ---------------------------------------------------------------------------- */ $list = new ProviderList($cms); // Register events first so that they can be used by other providers. $list->registerProvider($config->get('app.providers.core_events')); // Register all other providers $list->registerProviders($config->get('app.providers')); /** * ---------------------------------------------------------------------------- * Set trusted proxies and headers for the request
/** * @param Repository $config * * @return ClassAliasList */ private function initializeClassAliases(Repository $config) { $list = ClassAliasList::getInstance(); $list->registerMultiple($config->get('app.aliases')); $list->registerMultiple($config->get('app.facades')); // Autoload some aliases to prevent typehinting errors class_exists('\\Request'); return $list; }
/** * Aliases concrete5 classes to shorter class name aliases. * * IDEs will not recognize these classes by default. A symbols file can be generated to * assist IDEs by running SymbolGenerator::render() via PHP or executing the command-line * 'concrete/bin/concrete5 c5:ide-symbols */ protected function enableAliasClassAutoloading() { $list = ClassAliasList::getInstance(); $loader = new AliasClassLoader($list); $loader->register(); // We can't add this to the loaders array because there's no way to unregister these once they're registered }