Project

General

Profile

Feature #19503 » 0009633_v8_autoloader.patch

Administrator Admin, 2009-05-01 17:37

View differences:

t3lib/core_autoload.php (Revision 0)
<?php
// DO NOT CHANGE THIS FILE! It is automatically generated by extdeveval::buildAutoloadRegistry.
// This file was generated on 2009-04-25 20:15
return array(
'gzip_encode' => PATH_t3lib . 'class.gzip_encode.php',
't3lib_admin' => PATH_t3lib . 'class.t3lib_admin.php',
't3lib_ajax' => PATH_t3lib . 'class.t3lib_ajax.php',
't3lib_arraybrowser' => PATH_t3lib . 'class.t3lib_arraybrowser.php',
't3lib_autoloader' => PATH_t3lib . 'class.t3lib_autoloader.php',
't3lib_basicfilefunctions' => PATH_t3lib . 'class.t3lib_basicfilefunc.php',
't3lib_bedisplaylog' => PATH_t3lib . 'class.t3lib_bedisplaylog.php',
't3lib_befunc' => PATH_t3lib . 'class.t3lib_befunc.php',
't3lib_beuserauth' => PATH_t3lib . 'class.t3lib_beuserauth.php',
't3lib_browsetree' => PATH_t3lib . 'class.t3lib_browsetree.php',
't3lib_cache' => PATH_t3lib . 'class.t3lib_cache.php',
't3lib_cli' => PATH_t3lib . 'class.t3lib_cli.php',
't3lib_clipboard' => PATH_t3lib . 'class.t3lib_clipboard.php',
't3lib_cs' => PATH_t3lib . 'class.t3lib_cs.php',
't3lib_db' => PATH_t3lib . 'class.t3lib_db.php',
't3lib_diff' => PATH_t3lib . 'class.t3lib_diff.php',
't3lib_div' => PATH_t3lib . 'class.t3lib_div.php',
't3lib_exec' => PATH_t3lib . 'class.t3lib_exec.php',
't3lib_extfilefunctions' => PATH_t3lib . 'class.t3lib_extfilefunc.php',
't3lib_extmgm' => PATH_t3lib . 'class.t3lib_extmgm.php',
't3lib_extobjbase' => PATH_t3lib . 'class.t3lib_extobjbase.php',
't3lib_flexformtools' => PATH_t3lib . 'class.t3lib_flexformtools.php',
't3lib_foldertree' => PATH_t3lib . 'class.t3lib_foldertree.php',
't3lib_formmail' => PATH_t3lib . 'class.t3lib_formmail.php',
't3lib_frontendedit' => PATH_t3lib . 'class.t3lib_frontendedit.php',
't3lib_fullsearch' => PATH_t3lib . 'class.t3lib_fullsearch.php',
't3lib_htmlmail' => PATH_t3lib . 'class.t3lib_htmlmail.php',
't3lib_iconworks' => PATH_t3lib . 'class.t3lib_iconworks.php',
't3lib_install' => PATH_t3lib . 'class.t3lib_install.php',
't3lib_loaddbgroup' => PATH_t3lib . 'class.t3lib_loaddbgroup.php',
't3lib_loadmodules' => PATH_t3lib . 'class.t3lib_loadmodules.php',
't3lib_lock' => PATH_t3lib . 'class.t3lib_lock.php',
't3lib_matchcondition' => PATH_t3lib . 'class.t3lib_matchcondition.php',
't3lib_modsettings' => PATH_t3lib . 'class.t3lib_modsettings.php',
't3lib_pageselect' => PATH_t3lib . 'class.t3lib_page.php',
't3lib_pagetree' => PATH_t3lib . 'class.t3lib_pagetree.php',
't3lib_parsehtml' => PATH_t3lib . 'class.t3lib_parsehtml.php',
't3lib_parsehtml_proc' => PATH_t3lib . 'class.t3lib_parsehtml_proc.php',
't3lib_positionmap' => PATH_t3lib . 'class.t3lib_positionmap.php',
't3lib_querygenerator' => PATH_t3lib . 'class.t3lib_querygenerator.php',
't3lib_readmail' => PATH_t3lib . 'class.t3lib_readmail.php',
't3lib_recordlist' => PATH_t3lib . 'class.t3lib_recordlist.php',
't3lib_refindex' => PATH_t3lib . 'class.t3lib_refindex.php',
't3lib_rteapi' => PATH_t3lib . 'class.t3lib_rteapi.php',
't3lib_scbase' => PATH_t3lib . 'class.t3lib_scbase.php',
't3lib_softrefproc' => PATH_t3lib . 'class.t3lib_softrefproc.php',
't3lib_sqlengine' => PATH_t3lib . 'class.t3lib_sqlengine.php',
't3lib_sqlengine_resultobj' => PATH_t3lib . 'class.t3lib_sqlengine.php',
't3lib_sqlparser' => PATH_t3lib . 'class.t3lib_sqlparser.php',
't3lib_stdgraphic' => PATH_t3lib . 'class.t3lib_stdgraphic.php',
't3lib_superadmin' => PATH_t3lib . 'class.t3lib_superadmin.php',
't3lib_syntaxhl' => PATH_t3lib . 'class.t3lib_syntaxhl.php',
't3lib_tceforms' => PATH_t3lib . 'class.t3lib_tceforms.php',
't3lib_tceforms_fe' => PATH_t3lib . 'class.t3lib_tceforms_fe.php',
't3lib_tceforms_inline' => PATH_t3lib . 'class.t3lib_tceforms_inline.php',
't3lib_tcemain' => PATH_t3lib . 'class.t3lib_tcemain.php',
't3lib_timetrack' => PATH_t3lib . 'class.t3lib_timetrack.php',
't3lib_transferdata' => PATH_t3lib . 'class.t3lib_transferdata.php',
't3lib_transl8tools' => PATH_t3lib . 'class.t3lib_transl8tools.php',
't3lib_treeview' => PATH_t3lib . 'class.t3lib_treeview.php',
't3lib_tsfebeuserauth' => PATH_t3lib . 'class.t3lib_tsfebeuserauth.php',
't3lib_tsparser' => PATH_t3lib . 'class.t3lib_tsparser.php',
't3lib_tsparser_ext' => PATH_t3lib . 'class.t3lib_tsparser_ext.php',
't3lib_tsstyleconfig' => PATH_t3lib . 'class.t3lib_tsstyleconfig.php',
't3lib_tstemplate' => PATH_t3lib . 'class.t3lib_tstemplate.php',
't3lib_userauth' => PATH_t3lib . 'class.t3lib_userauth.php',
't3lib_userauthgroup' => PATH_t3lib . 'class.t3lib_userauthgroup.php',
't3lib_xml' => PATH_t3lib . 'class.t3lib_xml.php',
'sc_t3lib_thumbs' => PATH_t3lib . 'thumbs.php',
't3lib_cache_exception' => PATH_t3lib . 'cache/class.t3lib_cache_exception.php',
't3lib_cache_factory' => PATH_t3lib . 'cache/class.t3lib_cache_factory.php',
't3lib_cache_manager' => PATH_t3lib . 'cache/class.t3lib_cache_manager.php',
't3lib_cache_backend_apcbackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_apcbackend.php',
't3lib_cache_backend_dbbackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_dbbackend.php',
't3lib_cache_backend_filebackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_filebackend.php',
't3lib_cache_backend_globalsbackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_globalsbackend.php',
't3lib_cache_backend_memcachedbackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_memcachedbackend.php',
't3lib_cache_backend_nullbackend' => PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_nullbackend.php',
't3lib_cache_backend_backend' => PATH_t3lib . 'cache/backend/interfaces/interface.t3lib_cache_backend_backend.php',
't3lib_cache_exception_classalreadyloaded' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php',
't3lib_cache_exception_duplicateidentifier' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php',
't3lib_cache_exception_invalidbackend' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidbackend.php',
't3lib_cache_exception_invalidcache' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidcache.php',
't3lib_cache_exception_invaliddata' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invaliddata.php',
't3lib_cache_exception_nosuchcache' => PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php',
't3lib_cache_frontend_stringfrontend' => PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_stringfrontend.php',
't3lib_cache_frontend_variablefrontend' => PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_variablefrontend.php',
't3lib_cache_frontend_frontend' => PATH_t3lib . 'cache/frontend/interfaces/interface.t3lib_cache_frontend_frontend.php',
't3lib_browselinkshook' => PATH_t3lib . 'interfaces/interface.t3lib_browselinkshook.php',
't3lib_localrecordlistgettablehook' => PATH_t3lib . 'interfaces/interface.t3lib_localrecordlistgettablehook.php',
't3lib_singleton' => PATH_t3lib . 'interfaces/interface.t3lib_singleton.php',
't3lib_tceformsinlinehook' => PATH_t3lib . 'interfaces/interface.t3lib_tceformsinlinehook.php',
'tslib_cobj' => PATH_tslib . 'class.tslib_content.php',
'tslib_frameset' => PATH_tslib . 'class.tslib_content.php',
'tslib_tableoffset' => PATH_tslib . 'class.tslib_content.php',
'tslib_controltable' => PATH_tslib . 'class.tslib_content.php',
'tslib_eidtools' => PATH_tslib . 'class.tslib_eidtools.php',
'tslib_fe' => PATH_tslib . 'class.tslib_fe.php',
'tslib_fecompression' => PATH_tslib . 'class.tslib_fecompression.php',
'tslib_fetce' => PATH_tslib . 'class.tslib_fetce.php',
'tslib_feuserauth' => PATH_tslib . 'class.tslib_feuserauth.php',
'tslib_gifbuilder' => PATH_tslib . 'class.tslib_gifbuilder.php',
'tslib_menu' => PATH_tslib . 'class.tslib_menu.php',
'tslib_tmenu' => PATH_tslib . 'class.tslib_menu.php',
'tslib_gmenu' => PATH_tslib . 'class.tslib_menu.php',
'tslib_imgmenu' => PATH_tslib . 'class.tslib_menu.php',
'tslib_jsmenu' => PATH_tslib . 'class.tslib_menu.php',
'tspagegen' => PATH_tslib . 'class.tslib_pagegen.php',
'fe_loaddbgroup' => PATH_tslib . 'class.tslib_pagegen.php',
'tslib_pibase' => PATH_tslib . 'class.tslib_pibase.php',
'tslib_search' => PATH_tslib . 'class.tslib_search.php',
'sc_tslib_showpic' => PATH_tslib . 'showpic.php',
'tx_cms_treelistcacheupdate' => PATH_tslib . 'hooks/class.tx_cms_treelistcacheupdate.php',
'tslib_content_cobjgetsinglehook' => PATH_tslib . 'interfaces/interface.tslib_content_cobjgetsinglehook.php',
'tslib_content_getdatahook' => PATH_tslib . 'interfaces/interface.tslib_content_getdatahook.php',
'tslib_content_stdwraphook' => PATH_tslib . 'interfaces/interface.tslib_content_stdwraphook.php',
'user_various' => PATH_tslib . 'media/scripts/example_callfunction.php',
'tslib_gmenu_foldout' => PATH_tslib . 'media/scripts/gmenu_foldout.php',
'tslib_gmenu_layers' => PATH_tslib . 'media/scripts/gmenu_layers.php',
'tslib_tmenu_layers' => PATH_tslib . 'media/scripts/tmenu_layers.php',
'language' => t3lib_extMgm::extPath('lang') . 'lang.php',
);
?>
t3lib/class.t3lib_autoloader.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2008-2009 Dmitry Dulepov <dmitry@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contains TYPO3 autoloader
*
* $Id: $
*
* @author Dmitry Dulepov <dmitry@typo3.org>
* @author Martin Kutschker <masi@typo3.org>
* @author Oliver Hader <oliver@typo3.org>
* @author Sebastian Kurfuerst <sebastian@typo3.org>
*/
/**
* This class contains TYPO3 autoloader for classes.
* It handles:
* - the core of TYPO3
* - all (old) extensions with an ext_autoload.php file
* - all (new) extensions with the naming conventions based on FLOW3
*/
class t3lib_autoloader {
/**
* Class name to file mapping. Key: class name. Value: fully qualified file name.
*
* @var array
*/
protected static $classNameToFileMapping = array();
/**
* Associative array which sets for each extension which was attempted to load if it has an autoload configuration
*
* Key: extension key
* Value: TRUE, if extension has an ext_autoload.php and this is already part of $classNameToFileMapping
* FALSE, if extension has no ext_autoload.php
*
* @var array
*/
protected static $extensionHasAutoloadConfiguration = array();
/**
* The autoloader is static, thus we do not allow instances of this class.
*/
private function __construct() {
}
/**
* Installs TYPO3 autoloader, and loads the autoload registry for the core.
*
* @return boolean true in case of success
*/
static public function registerAutoloader() {
self::loadCoreRegistry();
self::$extensionHasAutoloadConfiguration = array();
return spl_autoload_register('t3lib_autoloader::autoload');
}
/**
* Uninstalls TYPO3 autoloader. This function is for the sake of completeness.
* It is never called by the TYPO3 core.
*
* @return boolean true in case of success
*/
static public function unregisterAutoloader() {
return spl_autoload_unregister('t3lib_autoloader::autoload');
}
/**
* Autoload function for TYPO3.
*
* This method takes the following decisions:
* - If class name starts with Tx_, the new naming conventions are used
* - else, we look it up in the registry (which contains extensions and core files)
* @param string $className Class name
* @return void
*/
static public function autoload($className) {
$classFile = false;
if (strpos($className, 'Tx_') === 0) {
// new conventions as introduced by extbase.
$classPath = self::getClassPathByDirectoryStructure($className);
} else {
// use core and extension registry
$classPath = self::getClassPathByRegistryLookup($className);
}
if (file_exists($classPath)) {
require $classPath;
} else {
spl_autoload($className);
}
if (!class_exists($className, false)) {
self::logLoadingFailure($className);
}
}
/**
* Load the core registry into $classNameToFileMapping, effectively overriding
* the whole contents of $classNameToFileMapping.
*
* @return void
*/
static protected function loadCoreRegistry() {
self::$classNameToFileMapping = require(PATH_t3lib . 'core_autoload.php');
}
/**
* Get the full path to a class if it is named by the FLOW3-style conventions.
*
* @param string $className Class name
* @return string full name of the file where $className should be declared
*/
static protected function getClassPathByDirectoryStructure($className) {
$classNameParts = explode('_', $className);
$classPath = t3lib_extMgm::extPath(t3lib_div::camelCaseToLowerCaseUnderscored($classNameParts[1])) . 'Classes/';
$classPath .= implode(array_slice($classNameParts, 2, -1), '/') . '/';
$classPath .= array_pop($classNameParts) . '.php';
return $classPath;
}
/**
* Get the full path to a class by looking it up in the registry. If not found, returns NULL.
*
* @param string $className Class name
* @return string full name of the file where $className is declared, or NULL if no entry found in registry.
*/
static protected function getClassPathByRegistryLookup($className) {
$className = strtolower($className);
if (!array_key_exists($className, self::$classNameToFileMapping)) {
self::attemptToLoadRegistryForGivenClassName($className);
}
if (array_key_exists($className, self::$classNameToFileMapping)) {
return self::$classNameToFileMapping[$className];
} else {
return NULL;
}
}
/**
* Try to load the entries for a given class name into the registry.
*
* First, figures out the extension the class belongs to.
* Then, tries to load the ext_autoload.php file inside the extension directory, and adds its contents to the $classNameToFileMapping.
*
* @param string $className Class Name
*/
static protected function attemptToLoadRegistryForGivenClassName($className) {
$classNameParts = explode('_', $className);
$extensionPrefix = array_shift($classNameParts) . '_' . array_shift($classNameParts);
$extensionKey = t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix);
if (array_key_exists($extensionKey, self::$extensionHasAutoloadConfiguration)) {
// we already tried to load the extension's autoload configuration
return;
}
$possibleAutoloadConfigurationFileName = t3lib_extMgm::extPath($extensionKey) . 'ext_autoload.php';
if (file_exists($possibleAutoloadConfigurationFileName)) {
self::$extensionHasAutoloadConfiguration[$extensionKey] = TRUE;
$extensionClassNameToFileMapping = require($possibleAutoloadConfigurationFileName);
self::$classNameToFileMapping = array_merge($extensionClassNameToFileMapping, self::$classNameToFileMapping);
} else {
self::$extensionHasAutoloadConfiguration[$extensionKey] = FALSE;
}
}
/**
* Logs error message about failed autoloading
*
* @param string $className Class name
* @param string $filePath File name
* @return void
*/
static protected function logLoadingFailure($className) {
$message = sprintf('Unable to autoload class "%s"', $className);
t3lib_div::sysLog($message, 'Core', 4);
if (TYPO3_DLOG) {
t3lib_div::devLog($message, 'Core', 3);
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_autoload.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_autoload.php']);
}
?>
(12-12/14)