$original])) { self::$classAliasesInverse[$original] = array($alias); } else { self::$classAliasesInverse[$original][] = $alias; } return true; } return false; } /** * Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order. * * @param string $namespace A case sensitive Namespace to register. * @param string $path A case sensitive absolute file path to the library root where classes of the given namespace can be found. * @param boolean $reset True to reset the namespace with only the given lookup path. * @param boolean $prepend If true, push the path to the beginning of the namespace lookup paths array. * * @return void * * @throws RuntimeException * * @since 12.3 */ public static function registerNamespace($namespace, $path, $reset = false, $prepend = false) { // Verify the library path exists. if (!file_exists($path)) { $path = (str_replace(JPATH_ROOT, '', $path) == $path) ? basename($path) : str_replace(JPATH_ROOT, '', $path); throw new RuntimeException('Library path ' . $path . ' cannot be found.', 500); } // If the namespace is not yet registered or we have an explicit reset flag then set the path. if (!isset(self::$namespaces[$namespace]) || $reset) { self::$namespaces[$namespace] = array($path); } // Otherwise we want to simply add the path to the namespace. else { if ($prepend) { array_unshift(self::$namespaces[$namespace], $path); } else { self::$namespaces[$namespace][] = $path; } } } /** * Method to setup the autoloaders for the Joomla Platform. * Since the SPL autoloaders are called in a queue we will add our explicit * class-registration based loader first, then fall back on the autoloader based on conventions. * This will allow people to register a class in a specific location and override platform libraries * as was previously possible. * * @param boolean $enablePsr True to enable autoloading based on PSR-0. * @param boolean $enablePrefixes True to enable prefix based class loading (needed to auto load the Joomla core). * @param boolean $enableClasses True to enable class map based class loading (needed to auto load the Joomla core). * * @return void * * @since 12.3 */ public static function setup($enablePsr = true, $enablePrefixes = true, $enableClasses = true) { if ($enableClasses) { // Register the class map based autoloader. spl_autoload_register(array('JLoader', 'load')); } if ($enablePrefixes) { // Register the J prefix and base path for Joomla platform libraries. self::registerPrefix('J', JPATH_PLATFORM . '/joomla'); // Register the prefix autoloader. spl_autoload_register(array('JLoader', '_autoload')); } if ($enablePsr) { // Register the PSR-0 based autoloader. spl_autoload_register(array('JLoader', 'loadByPsr0')); spl_autoload_register(array('JLoader', 'loadByAlias')); } } /** * Method to autoload classes that are namespaced to the PSR-0 standard. * * @param string $class The fully qualified class name to autoload. * * @return boolean True on success, false otherwise. * * @since 13.1 */ public static function loadByPsr0($class) { // Remove the root backslash if present. if ($class[0] == '\\') { $class = substr($class, 1); } // Find the location of the last NS separator. $pos = strrpos($class, '\\'); // If one is found, we're dealing with a NS'd class. if ($pos !== false) { $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; $className = substr($class, $pos + 1); } // If not, no need to parse path. else { $classPath = null; $className = $class; } $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; // Loop through registered namespaces until we find a match. foreach (self::$namespaces as $ns => $paths) { if (strpos($class, $ns) === 0) { // Loop through paths registered to this namespace until we find a match. foreach ($paths as $path) { $classFilePath = $path . DIRECTORY_SEPARATOR . $classPath; // We check for class_exists to handle case-sensitive file systems if (file_exists($classFilePath) && !class_exists($class, false)) { return (bool) include_once $classFilePath; } } } } return false; } /** * Method to autoload classes that have been aliased using the registerAlias method. * * @param string $class The fully qualified class name to autoload. * * @return boolean True on success, false otherwise. * * @since 3.2 */ public static function loadByAlias($class) { // Remove the root backslash if present. if ($class[0] == '\\') { $class = substr($class, 1); } if (isset(self::$classAliases[$class])) { // Force auto-load of the regular class class_exists(self::$classAliases[$class], true); // Normally this shouldn't execute as the autoloader will execute applyAliasFor when the regular class is // auto-loaded above. if (!class_exists($class, false) && !interface_exists($class, false)) { class_alias(self::$classAliases[$class], $class); } } } /** * Applies a class alias for an already loaded class, if a class alias was created for it. * * @param string $class We'll look for and register aliases for this (real) class name * * @return void * * @since 3.4 */ public static function applyAliasFor($class) { // Remove the root backslash if present. if ($class[0] == '\\') { $class = substr($class, 1); } if (isset(self::$classAliasesInverse[$class])) { foreach (self::$classAliasesInverse[$class] as $alias) { class_alias($class, $alias); } } } /** * Autoload a class based on name. * * @param string $class The class to be loaded. * * @return boolean True if the class was loaded, false otherwise. * * @since 11.3 */ private static function _autoload($class) { foreach (self::$prefixes as $prefix => $lookup) { $chr = strlen($prefix) < strlen($class) ? $class[strlen($prefix)] : 0; if (strpos($class, $prefix) === 0 && ($chr === strtoupper($chr))) { return self::_load(substr($class, strlen($prefix)), $lookup); } } return false; } /** * Load a class based on name and lookup array. * * @param string $class The class to be loaded (wihtout prefix). * @param array $lookup The array of base paths to use for finding the class file. * * @return boolean True if the class was loaded, false otherwise. * * @since 12.1 */ private static function _load($class, $lookup) { // Split the class name into parts separated by camelCase. $parts = preg_split('/(?<=[a-z0-9])(?=[A-Z])/x', $class); // If there is only one part we want to duplicate that part for generating the path. $parts = (count($parts) === 1) ? array($parts[0], $parts[0]) : $parts; foreach ($lookup as $base) { // Generate the path based on the class name parts. $path = $base . '/' . implode('/', array_map('strtolower', $parts)) . '.php'; // Load the file if it exists. if (file_exists($path)) { return include $path; } } return false; } } /** * Global application exit. * * This function provides a single exit point for the platform. * * @param mixed $message Exit code or string. Defaults to zero. * * @return void * * @codeCoverageIgnore * @since 11.1 */ function jexit($message = 0) { exit($message); } /** * Intelligent file importer. * * @param string $path A dot syntax path. * * @return boolean True on success. * * @since 11.1 */ function jimport($path) { return JLoader::import($path); }
Fatal error: Uncaught exception 'RuntimeException' with message 'Joomla Platform not loaded.' in /home/ostadmot/public_html/floatglassandmirror.com/libraries/import.legacy.php:46 Stack trace: #0 /home/ostadmot/public_html/floatglassandmirror.com/includes/framework.php(27): require_once() #1 /home/ostadmot/public_html/floatglassandmirror.com/index.php(26): require_once('/home/ostadmot/...') #2 {main} thrown in /home/ostadmot/public_html/floatglassandmirror.com/libraries/import.legacy.php on line 46