Project

General

Profile

Feature #25337 ยป 25337_draft.diff

Draft idea - Xavier Perseguers, 2011-06-29 16:12

View differences:

t3lib/class.t3lib_autoloader.php
* @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);
$extensionKey = '';
$useNamespace = strpos($className, '\\') !== FALSE;
if ($useNamespace) {
$classNameParts = explode('\\', $className);
if ($classNameParts[0] === 't3') {
// Get rid of "t3"
array_shift($classNameParts);
$extensionPrefix = 'tx_' . array_shift($classNameParts);
$extensionKey = t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix);
}
} else {
$classNameParts = explode('_', $className);
$extensionPrefix = array_shift($classNameParts) . '_' . array_shift($classNameParts);
$extensionKey = t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix);
}
if (!$extensionKey || array_key_exists($extensionKey, self::$extensionHasAutoloadConfiguration)) {
// extension key could not be determined or we already tried to load the extension's autoload configuration
t3lib/class.t3lib_div.php
* @return string Final class name to instantiate with "new [classname]"
*/
protected function getClassName($className) {
// Update class name if a relative namespaced class name is provided
if (strpos($className, '\\') === FALSE && strpos($className, '_') === FALSE) {
$traces = debug_backtrace();
// Find the call to makeInstance
$pos = 0;
foreach ($traces as $index => $trace) {
if ($trace['function'] === 'makeInstance' && $trace['class'] === 't3lib_div') {
$pos = $index + 1;
break;
}
}
if ($pos) {
$callingClassParts = explode('\\', strtolower($traces[$pos]['class']));
array_pop($callingClassParts);
$className = implode('\\', $callingClassParts) . '\\' . $className;
}
}
if (class_exists($className)) {
// TODO: Update logic to support XCLASSing, if wanted at all
while (class_exists('ux_' . $className, FALSE)) {
$className = 'ux_' . $className;
}
    (1-1/1)