Project

General

Profile

Feature #19503 » typo3v4-autoload.patch

Administrator Admin, 2009-04-26 15:59

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 Kurfürst <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
*/
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']);
}
?>\ No newline at end of file
index.php (working copy)
// Set error reporting
// *******************************
error_reporting (E_ALL ^ E_NOTICE);
error_reporting (E_ALL ^ E_NOTICE ^ E_DEPRECATED);
// ******************
......
require (PATH_tslib.'index_ts.php');
?>
?>
typo3/sysext/cms/tslib/class.tslib_eidtools.php (working copy)
public static function initLanguage($language = 'default') {
if (!is_object($GLOBALS['LANG'])) {
require_once(PATH_t3lib . 'class.t3lib_cs.php');
require_once(t3lib_extMgm::extPath('lang', 'lang.php'));
$GLOBALS['LANG'] = t3lib_div::makeInstance('language');
$GLOBALS['LANG']->init($language);
}
typo3/sysext/cms/tslib/media/scripts/fe_adminLib.inc (working copy)
function sendHTMLMail($content,$recipient,$dummy,$fromEmail,$fromName,$replyTo='') {
if (trim($recipient) && trim($content)) {
$cls=t3lib_div::makeInstanceClassName('t3lib_htmlmail');
if (class_exists($cls)) { // If htmlmail lib is included, then generate a nice HTML-email
// Avoid autoloading of t3lib_htmlmail, since it's only a strategy check here:
if (class_exists($cls, false)) { // If htmlmail lib is included, then generate a nice HTML-email
$parts = spliti('<title>|</title>',$content,3);
$subject = trim($parts[1]) ? trim($parts[1]) : 'TYPO3 FE Admin message';
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
$parts = explode('->',$funcName);
if (count($parts)==2) { // Class
$cls = t3lib_div::makeInstanceClassName($parts[0]);
// Check whether class is available and try to reload includeLibs if possible:
if ($this->isClassAvailable($cls, $conf)) {
// Check whether class is available:
if (class_exists($cls)) {
$classObj = new $cls;
if (method_exists($classObj, $parts[1])) {
$classObj->cObj = &$this;
......
return $librariesIncluded;
}
/**
* Checks whether a PHP class is available. If the check fails, the method tries to
* determine the correct includeLibs to make the class available automatically.
*
* TypoScript example that can cause this:
* | plugin.tx_myext_pi1 = USER
* | plugin.tx_myext_pi1 {
* | includeLibs = EXT:myext/pi1/class.tx_myext_pi1.php
* | userFunc = tx_myext_pi1->main
* | }
* | 10 = USER
* | 10.userFunc = tx_myext_pi1->renderHeader
*
* @param string $className: The name of the PHP class to be checked
* @param array $config: TypoScript configuration (naturally of a USER or COA cObject)
* @return boolean Whether the class is available
* @link http://bugs.typo3.org/view.php?id=9654
* @TODO This method was introduced in TYPO3 4.3 and can be removed if the autoload was integrated
*/
protected function isClassAvailable($className, array $config = NULL) {
if (class_exists($className)) {
return true;
} elseif ($config) {
$pluginConfiguration =& $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.'];
if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) {
$config['includeLibs'] = $pluginConfiguration['includeLibs'];
return $this->includeLibs($config);
}
}
return false;
}
typo3/sysext/cms/tslib/index_ts.php (working copy)
define('PATH_tslib', t3lib_extMgm::extPath('cms').'tslib/');
}
require_once(PATH_t3lib.'class.t3lib_db.php');
// *********************
// Autoloader
// *********************
$TT->push('Register Autoloader', '');
require_once(PATH_t3lib . 'class.t3lib_autoloader.php');
t3lib_autoloader::registerAutoloader();
$TT->pull();
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
......
if ($TSFE->beUserLogin) {
$BE_USER->initializeFrontendEdit();
if ($BE_USER->frontendEdit instanceof t3lib_frontendedit) {
require_once(t3lib_extMgm::extPath('lang').'lang.php');
$LANG = t3lib_div::makeInstance('language');
$LANG->init($BE_USER->uc['lang']);
typo3/sysext/indexed_search/class.crawler.php (working copy)
# To make sure the backend charset is available:
require_once(PATH_typo3.'sysext/lang/lang.php');
if (!is_object($GLOBALS['LANG'])) {
$GLOBALS['LANG'] = t3lib_div::makeInstance('language');
$GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
typo3/sysext/lang/class.language.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
* 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 the TYPO3 Backend Language class
*
* $Id: lang.php 4433 2008-11-07 04:13:12Z flyguide $
* Revised for TYPO3 3.6.0
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
*/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
*
*
* 88: class language
* 138: function init($lang,$altPath='')
* 183: function addModuleLabels($arr,$prefix)
* 209: function hscAndCharConv($lStr,$hsc)
* 224: function makeEntities($str)
* 241: function JScharCode($str)
* 260: function getLL($index,$hsc=0)
* 278: function getLLL($index,$LOCAL_LANG,$hsc=0)
* 299: function sL($input,$hsc=0)
* 344: function loadSingleTableDescription($table)
* 396: function includeLLFile($fileRef,$setGlobal=1,$mergeLocalOntoDefault=0)
* 441: function readLLfile($fileRef)
* 451: function localizedFileRef($fileRef)
*
* TOTAL FUNCTIONS: 12
* (This index is automatically created/updated by the extension "extdeveval")
*
*/
/**
* Contains the TYPO3 Backend Language class
*
* For detailed information about how localization is handled,
* please refer to the 'Inside TYPO3' document which descibes this.
*
* This class is normally instantiated as the global variable $LANG in typo3/template.php
* It's only available in the backend and under certain circumstances in the frontend
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
* @package TYPO3
* @subpackage core
* @see typo3/template.php, template
*/
class language {
var $lang='default'; // This is set to the language that is currently running for the user
var $langSplit='default'; // Values like the labels in the tables.php-document are split by '|'. This values defines which language is represented by which position in the resulting array after splitting a value. (NOTICE: Obsolete concept!)
// Default charset in backend
var $charSet = 'iso-8859-1';
// Array with alternative charsets for other languages. (Moved to t3lib_cs, Set from csConvObj!)
var $charSetArray = array();
// This is the url to the TYPO3 manual
var $typo3_help_url= 'http://www.typo3.com/man_uk/';
// Array with alternative URLs based on language.
var $helpUrlArray = array(
'dk' => 'http://www.typo3.com/man_dk/',
);
var $debugKey = FALSE; // If true, will show the key/location of labels in the backend.
var $moduleLabels = Array(); // Can contain labels and image references from the backend modules. Relies on t3lib_loadmodules to initialize modules after a global instance of $LANG has been created.
// Internal
var $langSplitIndex=0; // Points to the position of the current language key as found in constant TYPO3_languages
var $LL_files_cache=array(); // Internal cache for read LL-files
var $LL_labels_cache=array(); // Internal cache for ll-labels (filled as labels are requested)
/**
* instance of the "t3lib_cs" class. May be used by any application.
*
* @var t3lib_cs
*/
var $csConvObj;
/**
* Initializes the backend language.
* This is for example done in typo3/template.php with lines like these:
*
* require (PATH_typo3.'sysext/lang/class.language.php');
* $LANG = t3lib_div::makeInstance('language');
* $LANG->init($BE_USER->uc['lang']);
*
* @param string The language key (two character string from backend users profile)
* @param string IGNORE. Not used.
* @return void
*/
function init($lang,$altPath='') {
// Initialize the conversion object:
$this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
$this->charSetArray = $this->csConvObj->charSetArray;
// Internally setting the list of TYPO3 backend languages.
$this->langSplit=TYPO3_languages;
// Finding the requested language in this list based on the $lang key being inputted to this function.
$ls = explode('|',$this->langSplit);
while(list($i,$v)=each($ls)) {
if ($v==$lang) { // Language is found. Configure it:
$this->langSplitIndex=$i; // The index of the language as found in the TYPO3_languages list
$this->lang = $lang; // The current language key
if ($this->helpUrlArray[$this->lang]) $this->typo3_help_url=$this->helpUrlArray[$this->lang]; // The help URL if different from the default.
if ($this->charSetArray[$this->lang]) $this->charSet=$this->charSetArray[$this->lang]; // The charset if different from the default.
}
}
// If a forced charset is used and different from the charset otherwise used:
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']!=$this->charSet) {
// Set the forced charset:
$this->charSet = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
if ($this->charSet!='utf-8' && !$this->csConvObj->initCharset($this->charSet)) {
t3lib_BEfunc::typo3PrintError ('The forced character set "'.$this->charSet.'" was not found in t3lib/csconvtbl/','Forced charset not found');
exit;
}
}
}
/**
* Adds labels and image references from the backend modules to the internal moduleLabels array
*
* @param array Array with references to module labels, keys: ['labels']['tablabel'], ['labels']['tabdescr'], ['tabs']['tab']
* @param string Module name prefix
* @return void
* @see t3lib_loadModules
*/
function addModuleLabels($arr,$prefix) {
if (is_array($arr)) {
reset($arr);
while(list($k,$larr)=each($arr)) {
if (!isset($this->moduleLabels[$k])) {
$this->moduleLabels[$k]=array();
}
if (is_array($larr)) {
reset($larr);
while(list($l,$v)=each($larr)) {
$this->moduleLabels[$k][$prefix.$l]=$v;
}
}
}
}
}
/**
* Will htmlspecialchar() the input string and before that any charset conversion will also have taken place if needed (see init())
* Used to pipe language labels through just before they are returned.
*
* @param string The string to process
* @param boolean If set, then the string is htmlspecialchars()'ed
* @return string The processed string
* @see init()
*/
function hscAndCharConv($lStr,$hsc) {
$lStr = $hsc ? htmlspecialchars($lStr) : $lStr;
// labels returned from a locallang file used to be in the language of the charset. Since TYPO3 4.1 they are always in the charset of the BE.
return $lStr;
}
/**
* Will convert the input strings special chars (all above 127) to entities. The string is expected to be encoded in the charset, $this->charSet
* This function is used to create strings that can be used in the Click Menu (Context Sensitive Menus). The reason is that the values that are dynamically written into the <div> layer is decoded as iso-8859-1 no matter what charset is used in the document otherwise (only MSIE, Mozilla is OK). So by converting we by-pass this problem.
*
* @param string Input string
* @return string Output string
*/
function makeEntities($str) {
// Convert string to UTF-8:
if ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet);
// Convert string back again, but using the full entity conversion:
$str = $this->csConvObj->utf8_to_entities($str);
return $str;
}
/**
* Converts the input string to a JavaScript function returning the same string, but charset-safe.
* Used for confirm and alert boxes where we must make sure that any string content does not break the script AND want to make sure the charset is preserved.
* Originally I used the JS function unescape() in combination with PHP function rawurlencode() in order to pass strings in a safe way. This could still be done for iso-8859-1 charsets but now I have applied the same method here for all charsets.
*
* @param string Input string, encoded with $this->charSet
* @return string Output string, a JavaScript function: "String.fromCharCode(......)"
*/
function JScharCode($str) {
// Convert string to UTF-8:
if ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet);
// Convert the UTF-8 string into a array of char numbers:
$nArr = $this->csConvObj->utf8_to_numberarray($str);
return 'String.fromCharCode('.implode(',',$nArr).')';
}
/**
* Returns the label with key $index form the globally loaded $LOCAL_LANG array.
* Mostly used from modules with only one LOCAL_LANG file loaded into the global space.
*
* @param string Label key
* @param boolean If set, the return value is htmlspecialchar'ed
* @return string
*/
function getLL($index,$hsc=0) {
// Get Local Language
if (strcmp($GLOBALS['LOCAL_LANG'][$this->lang][$index],'')) {
$output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG'][$this->lang][$index], $hsc); // Returns local label if not blank.
} else {
$output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG']['default'][$index], $hsc); // Returns default label
}
return $output.($this->debugKey ? ' ['.$index.']':'');
}
/**
* Works like ->getLL() but takes the $LOCAL_LANG array used as the second argument instead of using the global array.
*
* @param string Label key
* @param array $LOCAL_LANG array to get label key from
* @param boolean If set, the return value is htmlspecialchar'ed
* @return string
*/
function getLLL($index,$LOCAL_LANG,$hsc=0) {
// Get Local Language
if (strcmp($LOCAL_LANG[$this->lang][$index],'')) {
$output = $this->hscAndCharConv($LOCAL_LANG[$this->lang][$index], $hsc); // Returns local label if not blank.
} else {
$output = $this->hscAndCharConv($LOCAL_LANG['default'][$index], $hsc); // Returns default label
}
return $output.($this->debugKey ? ' ['.$index.']':'');
}
/**
* splitLabel function
* Historically labels were exploded by '|' and each part would correspond to the translation of the language found at the same 'index' in the TYPO3_languages constant.
* Today all translations are based on $LOCAL_LANG variables. 'language-splitted' labels can therefore refer to a local-lang file + index instead!
* It's highly recommended to use the 'local_lang' method (and thereby it's highly deprecated to use 'language-splitted' label strings)
* Refer to 'Inside TYPO3' for more details
*
* @param string Label key/reference
* @param boolean If set, the return value is htmlspecialchar'ed
* @return string
*/
function sL($input,$hsc=0) {
if (strcmp(substr($input,0,4),'LLL:')) { // Using obsolete 'language-splitted' labels:
$t = explode('|',$input);
$out = $t[$this->langSplitIndex] ? $t[$this->langSplitIndex] : $t[0];
return $this->hscAndCharConv($out, $hsc);
} else { // LOCAL_LANG:
if (!isset($this->LL_labels_cache[$this->lang][$input])) { // If cached label
$restStr = trim(substr($input,4));
$extPrfx='';
if (!strcmp(substr($restStr,0,4),'EXT:')) { // ll-file refered to is found in an extension.
$restStr = trim(substr($restStr,4));
$extPrfx='EXT:';
}
$parts = explode(':',$restStr);
$parts[0]=$extPrfx.$parts[0];
if (!isset($this->LL_files_cache[$parts[0]])) { // Getting data if not cached
$this->LL_files_cache[$parts[0]] = $this->readLLfile($parts[0]);
// If the current language is found in another file, load that as well:
$lFileRef = $this->localizedFileRef($parts[0]);
if ($lFileRef && is_string($this->LL_files_cache[$parts[0]][$this->lang]) && $this->LL_files_cache[$parts[0]][$this->lang]=='EXT') {
$tempLL = $this->readLLfile($lFileRef);
$this->LL_files_cache[$parts[0]][$this->lang] = $tempLL[$this->lang];
}
// Overriding file?
if (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]])) {
$ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]]);
$this->LL_files_cache[$parts[0]] = t3lib_div::array_merge_recursive_overrule($this->LL_files_cache[$parts[0]],$ORarray);
}
}
$this->LL_labels_cache[$this->lang][$input] = $this->getLLL($parts[1],$this->LL_files_cache[$parts[0]]);
}
$output = $hsc ? t3lib_div::deHSCentities(htmlspecialchars($this->LL_labels_cache[$this->lang][$input])) : $this->LL_labels_cache[$this->lang][$input]; // For the cached output charset conversion has already happend! So perform HSC right here.
return $output.($this->debugKey ? ' ['.$input.']':'');
}
}
/**
* Loading $TCA_DESCR[$table]['columns'] with content from locallang files as defined in $TCA_DESCR[$table]['refs']
* $TCA_DESCR is a global var
*
* @param string Table name found as key in global array $TCA_DESCR
* @return void
*/
function loadSingleTableDescription($table) {
global $TCA_DESCR;
if (is_array($TCA_DESCR[$table])
&& !isset($TCA_DESCR[$table]['columns'])
&& is_array($TCA_DESCR[$table]['refs'])) { // First the 'table' cannot already be loaded in [columns] and secondly there must be a references to locallang files available in [refs]
// Init $TCA_DESCR for $table-key
$TCA_DESCR[$table]['columns']=array();
// Get local-lang for each file in $TCA_DESCR[$table]['refs'] as they are ordered.
foreach ($TCA_DESCR[$table]['refs'] as $llfile) {
$LOCAL_LANG = $this->includeLLFile($llfile,0,1);
// Traverse all keys
if (is_array($LOCAL_LANG['default'])) {
foreach($LOCAL_LANG['default'] as $lkey => $lVal) {
// exploding by '.':
// 0 => fieldname,
// 1 => type from (alttitle,description,details,syntax,image_descr,image,seeAlso),
// 2 => special instruction, see switch construct
$kParts = explode('.',$lkey);
// Detecting 'hidden' labels, converting to normal fieldname
if ($kParts[0]=='_') $kParts[0]='';
if (substr($kParts[0],0,1)=='_') { $kParts[0] = substr($kParts[0],1); }
// Add label:
switch((string)$kParts[2]) {
case '+': // adding
$TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]].= chr(10).$lVal;
break;
default: // Substituting:
$TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]] = $lVal;
break;
}
}
}
}
}
}
/**
* Includes locallang file (and possibly additional localized version if configured for)
* Read language labels will be merged with $LOCAL_LANG (if $setGlobal=1).
*
* @param string $fileRef is a file-reference (see t3lib_div::getFileAbsFileName)
* @param boolean Setting in global variable $LOCAL_LANG (or returning the variable)
* @param boolean If $mergeLocalOntoDefault is set the local part of the $LOCAL_LANG array is merged onto the default part (if the local part exists) and the local part is unset.
* @return mixed If $setGlobal is true the LL-files will set the $LOCAL_LANG in the global scope. Otherwise the $LOCAL_LANG array is returned from function
*/
function includeLLFile($fileRef,$setGlobal=1,$mergeLocalOntoDefault=0) {
// Configure for global flag:
if ($setGlobal) {
global $LOCAL_LANG;
}
// Get default file:
$llang = $this->readLLfile($fileRef);
if (count($llang)) {
$LOCAL_LANG = t3lib_div::array_merge_recursive_overrule((array)$LOCAL_LANG,$llang);
// Localized addition?
$lFileRef = $this->localizedFileRef($fileRef);
if ($lFileRef && (string)$LOCAL_LANG[$this->lang]=='EXT') {
$llang = $this->readLLfile($lFileRef);
$LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG,$llang);
}
// Overriding file?
if (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef])) {
$ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef]);
$LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG,$ORarray);
}
// Merge local onto default:
if ($mergeLocalOntoDefault && strcmp($this->lang,'default') && is_array($LOCAL_LANG[$this->lang]) && is_array($LOCAL_LANG['default'])) {
$LOCAL_LANG['default'] = array_merge($LOCAL_LANG['default'],$LOCAL_LANG[$this->lang]); // array_merge can be used so far the keys are not numeric - which we assume they are not...
unset($LOCAL_LANG[$this->lang]);
}
}
// Return value if not global is set.
if (!$setGlobal) {
return $LOCAL_LANG;
}
}
/**
* Includes a locallang file and returns the $LOCAL_LANG array found inside.
*
* @param string Input is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array.
* @return array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array
*/
function readLLfile($fileRef) {
return t3lib_div::readLLfile($fileRef, $this->lang, $this->charSet);
}
/**
* Returns localized fileRef (.[langkey].php)
*
* @param string Filename/path of a 'locallang.php' file
* @return string Input filename with a '.[lang-key].php' ending added if $this->lang is not 'default'
*/
function localizedFileRef($fileRef) {
if ($this->lang!='default' && substr($fileRef,-4)=='.php') {
return substr($fileRef,0,-4).'.'.$this->lang.'.php';
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/class.language.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/class.language.php']);
}
?>\ No newline at end of file
typo3/init.php (working copy)
// *******************************
// Set error reporting
// *******************************
error_reporting (E_ALL ^ E_NOTICE);
error_reporting (E_ALL ^ E_NOTICE ^ E_DEPRECATED);
// *******************************
// Prevent any unwanted output that may corrupt AJAX/compression. Note: this does
......
$temp_path_t3lib = @is_dir(PATH_site.'t3lib/') ? PATH_site.'t3lib/' : PATH_typo3.'t3lib/';
define('PATH_t3lib', $temp_path_t3lib); // Abs. path to t3lib/ (general TYPO3 library) within the TYPO3 admin dir
define('PATH_typo3conf', PATH_site.'typo3conf/'); // Abs. TYPO3 configuration path (local, not part of source)
if (!defined('PATH_tslib')) {
if (@is_dir(PATH_site.TYPO3_mainDir.'sysext/cms/tslib/')) {
define('PATH_tslib', PATH_site.TYPO3_mainDir.'sysext/cms/tslib/');
} elseif (@is_dir(PATH_site.'tslib/')) {
define('PATH_tslib', PATH_site.'tslib/');
}
}
}
......
require(PATH_t3lib.'config_default.php');
if (!defined ('TYPO3_db')) die ('The configuration file was not included.');
require_once(PATH_t3lib.'class.t3lib_db.php'); // The database library
// *********************
// Autoloader
// *********************
require_once(PATH_t3lib . 'class.t3lib_autoloader.php');
t3lib_autoloader::registerAutoloader();
/** @var TYPO3_DB t3lib_db */
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
typo3/mod/tools/em/class.em_terconnection.php (working copy)
$filesData = array();
foreach ($uArr['FILES'] as $filename => $infoArr) {
$content = (!defined('SOAP_1_2') && class_exists('soapclient')) ? base64_encode($infoArr['content']) : $infoArr['content']; // bug in NuSOAP - no automatic encoding
// Avoid autoloading "soapclient", since it's only a strategy check here:
$content = (!defined('SOAP_1_2') && class_exists('soapclient', false)) ? base64_encode($infoArr['content']) : $infoArr['content']; // bug in NuSOAP - no automatic encoding
$filesData['fileData'][] = array (
'name' => utf8_encode($infoArr['name']),
'size' => intval($infoArr['size']),
typo3/mod/tools/em/class.em_soap.php (working copy)
}
if (!$options['implementation'] || $options['implementation'] == 'detect') {
// Avoid autoloading, since it's only a strategy check here:
if (defined('SOAP_1_2')) {
$options['implementation'] = 'phpsoap';
} elseif (class_exists('soapclient')) {
} elseif (class_exists('soapclient', false)) {
$options['implementation'] = 'nusoap';
} elseif (class_exists('SOAP_Client')) {
} elseif (class_exists('SOAP_Client', false)) {
$options['implementation'] = 'pearsoap';
}
}
(10-10/14)