Пример #1
0
	/**
	 * Registers Akeeba's class autoloader with Joomla!
	 */
	public static function register_autoloader()
	{
		// Try to register AEAutoloader with SPL, or fall back to making use of JLoader
		// Obviously, performance is better with SPL, but not all systems support it.
		if( function_exists('spl_autoload_register') )
		{
			// Joomla! is using its own autoloader function which has to be registered first...
			if(function_exists('__autoload')) spl_autoload_register('__autoload');
			// ...and then register ourselves.
			spl_autoload_register('AEAutoloader');
		}
		else
		{
			// We can't redefine __autoload, since Joomla! is already using that. So, we'll just push
			// our classes to JLoader's stack using JLoader::register($class, $file). In order to do
			// that, we'll have to scan Akeeba Engine's directories for available class files.

			// -- Run 0: Register the configuration class
			$path_prefix =  JPATH_ADMINISTRATOR.DS.'components'.DS.'com_akeeba'.DS.'akeeba';
			JLoader::register('AEConfiguration', $path_prefix.DS.'configuration.php' );

			// -- Run 1: Import plugins first (as this is a FIFO list and plugins must override core classes)
			$path_prefix =  JPATH_ADMINISTRATOR.DS.'components'.DS.'com_akeeba'.DS.'akeeba'.DS.'plugins';
			AEPlatform::register_akeeba_engine_classes($path_prefix);

			// -- Run 2: Core Akeeba Engine classes
			$path_prefix =  JPATH_ADMINISTRATOR.DS.'components'.DS.'com_akeeba'.DS.'akeeba';
			AEPlatform::register_akeeba_engine_classes($path_prefix);

		}
	}