Commit e981c9b2 authored by Frank Nägler's avatar Frank Nägler Committed by Markus Klein
Browse files

[CLEANUP] Remove unnecessary fully qualified names

Remove unnecessary fully qualified names from Utility classes.

Resolves: #62505
Releases: master
Change-Id: I3d4af98670911b3b49bd8043136c92422925cd2a
Reviewed-on: http://review.typo3.org/33588


Reviewed-by: Stefan Froemken's avatarStefan Froemken <froemken@gmail.com>
Tested-by: Stefan Froemken's avatarStefan Froemken <froemken@gmail.com>
Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
parent bce1b68e
......@@ -62,7 +62,7 @@ class ArrayUtility {
if ($value === $needle) {
($resultArray[$key] = $value);
} elseif (is_array($value)) {
($subArrayMatches = \TYPO3\CMS\Core\Utility\ArrayUtility::filterByValueRecursive($needle, $value));
($subArrayMatches = static::filterByValueRecursive($needle, $value));
if (count($subArrayMatches) > 0) {
($resultArray[$key] = $subArrayMatches);
}
......
......@@ -39,7 +39,7 @@ class ClientUtility {
// need reference for third parameter in \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction,
// so create a reference to NULL
$null = NULL;
$hookResult = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $null);
$hookResult = GeneralUtility::callUserFunction($hookFunction, $hookParameters, $null);
if ($returnResult && is_array($hookResult) && count($hookResult)) {
return $hookResult;
}
......
......@@ -101,7 +101,7 @@ class CommandUtility {
if (!$path) {
$path = $gfxConf['im_path'];
}
$path = \TYPO3\CMS\Core\Utility\GeneralUtility::fixWindowsFilePath($path);
$path = GeneralUtility::fixWindowsFilePath($path);
$im_version = strtolower($gfxConf['im_version_5']);
// This is only used internally, has no effect outside
if ($command === 'combine') {
......@@ -132,7 +132,7 @@ class CommandUtility {
// Because of some weird incompatibilities between ImageMagick 4 and 6 (plus GraphicsMagick),
// it is needed to change the parameters order under some preconditions
if ($command == 'composite' && $switchCompositeParameters) {
$paramsArr = \TYPO3\CMS\Core\Utility\GeneralUtility::unQuoteFilenames($parameters);
$paramsArr = GeneralUtility::unQuoteFilenames($parameters);
// The mask image has been specified => swap the parameters
if (count($paramsArr) > 5) {
$tmp = $paramsArr[count($paramsArr) - 3];
......
......@@ -89,7 +89,7 @@ class DebugUtility {
});
})();
';
echo \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($script);
echo GeneralUtility::wrapJS($script);
} else {
echo $debug;
}
......@@ -161,7 +161,7 @@ class DebugUtility {
}
})();
';
echo \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($script);
echo GeneralUtility::wrapJS($script);
}
/**
......@@ -178,7 +178,7 @@ class DebugUtility {
$pathFragment = $dat['class'] . $dat['type'] . $dat['function'];
// add the path of the included file
if (in_array($dat['function'], array('require', 'include', 'require_once', 'include_once'))) {
$pathFragment .= '(' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($dat['args'][0]) . '),' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($dat['file']);
$pathFragment .= '(' . PathUtility::stripPathSitePrefix($dat['args'][0]) . '),' . PathUtility::stripPathSitePrefix($dat['file']);
}
$path[] = $pathFragment . '#' . $dat['line'];
}
......
......@@ -130,15 +130,15 @@ class DiffUtility {
*/
public function getDiff($str1, $str2) {
// Create file 1 and write string
$file1 = \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('diff1_');
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($file1, $str1);
$file1 = GeneralUtility::tempnam('diff1_');
GeneralUtility::writeFile($file1, $str1);
// Create file 2 and write string
$file2 = \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('diff2_');
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($file2, $str2);
$file2 = GeneralUtility::tempnam('diff2_');
GeneralUtility::writeFile($file2, $str2);
// Perform diff.
$cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' ' . $this->diffOptions . ' ' . $file1 . ' ' . $file2;
$res = array();
\TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd, $res);
CommandUtility::exec($cmd, $res);
unlink($file1);
unlink($file2);
return $res;
......@@ -154,7 +154,7 @@ class DiffUtility {
*/
public function addClearBuffer($clearBuffer, $last = 0) {
if (strlen($clearBuffer) > 200) {
$clearBuffer = ($this->clearBufferIdx ? \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($clearBuffer, 70) : '') . '[' . strlen($clearBuffer) . ']' . (!$last ? \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($clearBuffer, -70) : '');
$clearBuffer = ($this->clearBufferIdx ? GeneralUtility::fixed_lgd_cs($clearBuffer, 70) : '') . '[' . strlen($clearBuffer) . ']' . (!$last ? GeneralUtility::fixed_lgd_cs($clearBuffer, -70) : '');
}
$this->clearBufferIdx++;
return $clearBuffer;
......@@ -169,10 +169,10 @@ class DiffUtility {
* @access private
*/
public function explodeStringIntoWords($str) {
$strArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $str);
$strArr = GeneralUtility::trimExplode(LF, $str);
$outArray = array();
foreach ($strArr as $lineOfWords) {
$allWords = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $lineOfWords, TRUE);
$allWords = GeneralUtility::trimExplode(' ', $lineOfWords, TRUE);
$outArray[] = $allWords;
$outArray[] = array('');
$outArray[] = array('');
......
......@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Core\Utility;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Category\CategoryRegistry;
use TYPO3\CMS\Core\Package\PackageManager;
/**
* Extension Management functions
......@@ -50,7 +52,7 @@ class ExtensionManagementUtility {
* @param \TYPO3\CMS\Core\Package\PackageManager $packageManager
* @internal
*/
static public function setPackageManager(\TYPO3\CMS\Core\Package\PackageManager $packageManager) {
static public function setPackageManager(PackageManager $packageManager) {
static::$packageManager = $packageManager;
}
......@@ -156,7 +158,7 @@ class ExtensionManagementUtility {
* @return string
*/
static public function siteRelPath($key) {
return \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(self::extPath($key));
return PathUtility::stripPathSitePrefix(self::extPath($key));
}
/**
......@@ -460,7 +462,7 @@ class ExtensionManagementUtility {
$GLOBALS['TCA'][$table]['columns'][$field]['config']['items'] = array_values($GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
if (strlen($relativePosition) > 0) {
// Insert at specified position
$matchedPosition = \TYPO3\CMS\Core\Utility\ArrayUtility::filterByValueRecursive($relativeToField, $GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
$matchedPosition = ArrayUtility::filterByValueRecursive($relativeToField, $GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
if (count($matchedPosition) > 0) {
$relativeItemKey = key($matchedPosition);
if ($relativePosition === 'replace') {
......@@ -549,7 +551,7 @@ class ExtensionManagementUtility {
'localizeChildrenAtParentLocalization' => TRUE,
),
);
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($fileFieldTCAConfig, $customSettingOverride);
ArrayUtility::mergeRecursiveWithOverrule($fileFieldTCAConfig, $customSettingOverride);
return $fileFieldTCAConfig;
}
......@@ -783,7 +785,7 @@ class ExtensionManagementUtility {
if ($mainModuleName === 'web') {
$defaultModuleConfiguration['navigationComponentId'] = 'typo3-pagetree';
}
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
$moduleConfiguration = $defaultModuleConfiguration;
if (strlen($subModuleName) > 0) {
$moduleSignature = $mainModuleName . '_' . $subModuleName;
......@@ -1203,7 +1205,7 @@ class ExtensionManagementUtility {
$executables = GeneralUtility::trimExplode(',', $serviceDetails['exec'], TRUE);
foreach ($executables as $executable) {
// If at least one executable file is not available, exit early returning FALSE
if (!\TYPO3\CMS\Core\Utility\CommandUtility::checkCommand($executable)) {
if (!CommandUtility::checkCommand($executable)) {
self::deactivateService($serviceType, $serviceKey);
return FALSE;
}
......@@ -1648,7 +1650,7 @@ tt_content.' . $key . $prefix . ' {
}
// Apply category stuff
\TYPO3\CMS\Core\Category\CategoryRegistry::getInstance()->applyTcaForPreRegisteredTables();
CategoryRegistry::getInstance()->applyTcaForPreRegisteredTables();
// Execute override files from Configuration/TCA/Overrides
foreach ($activePackages as $package) {
......@@ -1953,7 +1955,7 @@ tt_content.' . $key . $prefix . ' {
*/
static public function makeCategorizable($extensionKey, $tableName, $fieldName = 'categories', array $options = array()) {
// Update the category registry
$result = \TYPO3\CMS\Core\Category\CategoryRegistry::getInstance()->add($extensionKey, $tableName, $fieldName, $options);
$result = CategoryRegistry::getInstance()->add($extensionKey, $tableName, $fieldName, $options);
if ($result === FALSE) {
$message = '\TYPO3\CMS\Core\Category\CategoryRegistry: no category registered for table "%s". Key was already registered.';
/** @var $logger \TYPO3\CMS\Core\Log\Logger */
......
......@@ -15,8 +15,15 @@ namespace TYPO3\CMS\Core\Utility\File;
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
/**
* Contains functions for performing file operations like copying, pasting, uploading, moving,
......@@ -46,7 +53,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility {
class ExtendedFileUtility extends BasicFileUtility {
// External static variables:
// Notice; some of these are overridden in the start() method with values from $GLOBALS['TYPO3_CONF_VARS']['BE']
......@@ -142,7 +149,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
}
$this->unzipPath = $unzipPath;
// Initialize Object Factory
$this->fileFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
$this->fileFactory = ResourceFactory::getInstance();
// Initializing file processing commands:
$this->fileCmdMap = $fileCmds;
}
......@@ -255,7 +262,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_extfilefunc.php']['processData'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_extfilefunc.php']['processData'] as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
if (!$hookObject instanceof \TYPO3\CMS\Core\Utility\File\ExtendedFileUtilityProcessDataHookInterface) {
if (!$hookObject instanceof ExtendedFileUtilityProcessDataHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtilityProcessDataHookInterface', 1279719168);
}
$hookObject->processData_postProcessAction($action, $cmdArr, $result[$action], $this);
......@@ -291,7 +298,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$msg,
'',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FlashMessage::ERROR,
TRUE
);
$this->addFlashMessage($flashMessage);
......@@ -319,7 +326,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
public function findRecycler($theFile) {
GeneralUtility::logDeprecatedFunction();
if (GeneralUtility::validPathStr($theFile)) {
$theFile = \TYPO3\CMS\Core\Utility\PathUtility::getCanonicalPath($theFile);
$theFile = PathUtility::getCanonicalPath($theFile);
$fI = GeneralUtility::split_fileref($theFile);
$c = 0;
// !!! Method has been put in the storage, can be saftely removed
......@@ -329,7 +336,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
return $rDir;
}
$theFile = $fI['path'];
$theFile = \TYPO3\CMS\Core\Utility\PathUtility::getCanonicalPath($theFile);
$theFile = PathUtility::getCanonicalPath($theFile);
$fI = GeneralUtility::split_fileref($theFile);
$c++;
}
......@@ -396,7 +403,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
$row = $this->transformFileReferenceToRecordReference($fileReferenceRow);
}
$shortcutRecord = BackendUtility::getRecord($row['tablename'], $row['recuid']);
$icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($row['tablename'], $shortcutRecord);
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $shortcutRecord);
$onClick = 'Clickmenu.show("' . $row['tablename'] . '", "' . $row['recuid'] . '", "1", "+info,history,edit", "|", "");return false;';
$shortcutContent[] = '<a href="#" oncontextmenu="this.click();return false;" onclick="' . htmlspecialchars($onClick) . '">' . $icon . '</a>' . htmlspecialchars((BackendUtility::getRecordTitle($row['tablename'], $shortcutRecord) . ' [' . BackendUtility::getRecordPath($shortcutRecord['pid'], '', 80) . ']'));
}
......@@ -406,7 +413,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
'\\TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.description.fileNotDeletedHasReferences'), $fileObject->getName()) . '<br />' . implode('<br />', $shortcutContent),
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.header.fileNotDeletedHasReferences'),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
FlashMessage::WARNING,
TRUE
);
$this->addFlashMessage($flashMessage);
......@@ -419,7 +426,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
'\\TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.description.fileDeleted'), $fileObject->getName()),
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.header.fileDeleted'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FlashMessage::OK,
TRUE
);
$this->addFlashMessage($flashMessage);
......@@ -442,7 +449,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
'\\TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.description.folderNotDeletedHasFiles'), $fileObject->getName()),
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.header.folderNotDeletedHasFiles'),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
FlashMessage::WARNING,
TRUE
);
$this->addFlashMessage($flashMessage);
......@@ -454,7 +461,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
'\\TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.description.folderDeleted'), $fileObject->getName()),
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:message.header.folderDeleted'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FlashMessage::OK,
TRUE
);
$this->addFlashMessage($flashMessage);
......@@ -535,7 +542,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
/** @var $targetFolderObject \TYPO3\CMS\Core\Resource\Folder */
$targetFolderObject = $this->getFileObject($cmds['target']);
// Basic check
if (!$targetFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
if (!$targetFolderObject instanceof Folder) {
$this->writelog(2, 2, 100, 'Destination "%s" was not a directory', array($cmds['target']));
return FALSE;
}
......@@ -611,7 +618,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
$sourceFileObject = $this->getFileObject($cmds['data']);
$targetFolderObject = $this->getFileObject($cmds['target']);
// Basic check
if (!$targetFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
if (!$targetFolderObject instanceof Folder) {
$this->writelog(3, 2, 100, 'Destination "%s" was not a directory', array($cmds['target']));
return FALSE;
}
......@@ -740,7 +747,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
return FALSE;
}
$targetFolderObject = $this->getFileObject($cmds['target']);
if (!$targetFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
if (!$targetFolderObject instanceof Folder) {
$this->writelog(6, 2, 104, 'Destination "%s" was not a directory', array($cmds['target']));
return FALSE;
}
......@@ -775,7 +782,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
return FALSE;
}
$targetFolderObject = $this->getFileObject($cmds['target']);
if (!$targetFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
if (!$targetFolderObject instanceof Folder) {
$this->writelog(8, 2, 104, 'Destination "%s" was not a directory', array($cmds['target']));
return FALSE;
}
......@@ -910,7 +917,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
}
/** @var $fileObject File */
$fileObject = $targetFolderObject->addUploadedFile($fileInfo, $conflictMode);
$fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObjectByStorageAndIdentifier($targetFolderObject->getStorage()->getUid(), $fileObject->getIdentifier());
$fileObject = ResourceFactory::getInstance()->getFileObjectByStorageAndIdentifier($targetFolderObject->getStorage()->getUid(), $fileObject->getIdentifier());
if ($conflictMode === 'replace') {
$this->getIndexer($fileObject->getStorage())->updateIndexEntry($fileObject);
}
......@@ -980,7 +987,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
if ($this->checkPathAgainstMounts($theFile) && $this->checkPathAgainstMounts($theDest . '/')) {
// No way to do this under windows.
$cmd = $this->unzipPath . 'unzip -qq ' . escapeshellarg($theFile) . ' -d ' . escapeshellarg($theDest);
\TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
CommandUtility::exec($cmd);
$this->writelog(7, 0, 1, 'Unzipping file "%s" in "%s"', array($theFile, $theDest));
return TRUE;
} else {
......@@ -995,7 +1002,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
* @param \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage
* @return void
*/
protected function addFlashMessage(\TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage) {
protected function addFlashMessage(FlashMessage $flashMessage) {
/** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
$flashMessageService = GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'
......@@ -1011,7 +1018,7 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
* @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
* @return \TYPO3\CMS\Core\Resource\Index\Indexer
*/
protected function getIndexer(\TYPO3\CMS\Core\Resource\ResourceStorage $storage) {
protected function getIndexer(ResourceStorage $storage) {
return GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\Indexer', $storage);
}
......
......@@ -28,6 +28,6 @@ interface ExtendedFileUtilityProcessDataHookInterface {
* @param \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility $parentObject Parent object
* @return void
*/
public function processData_postProcessAction($action, array $cmdArr, array $result, \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility $parentObject);
public function processData_postProcessAction($action, array $cmdArr, array $result, ExtendedFileUtility $parentObject);
}
......@@ -13,6 +13,10 @@ namespace TYPO3\CMS\Core\Utility;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Core\ApplicationContext;
use TYPO3\CMS\Core\Core\ClassLoader;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
* The legendary "t3lib_div" class - Miscellaneous functions for general purpose.
......@@ -285,7 +289,7 @@ class GeneralUtility {
// Rename could fail, if a simultaneous thread is currently working on the same thing
if (@rename($theFile, $temporaryName)) {
$cmd = self::imageMagickCommand('convert', '"' . $temporaryName . '" "' . $theFile . '"', $gfxConf['im_path_lzw']);
\TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
CommandUtility::exec($cmd);
unlink($temporaryName);
}
$returnCode = 'IM';
......@@ -318,7 +322,7 @@ class GeneralUtility {
// IM
$newFile = substr($theFile, 0, -4) . '.gif';
$cmd = self::imageMagickCommand('convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']);
\TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
CommandUtility::exec($cmd);
$theFile = $newFile;
if (@is_file($newFile)) {
self::fixPermissions($newFile);
......@@ -343,7 +347,7 @@ class GeneralUtility {
} else {
$newFile = PATH_site . 'typo3temp/readPG_' . md5(($theFile . '|' . filemtime($theFile))) . ($output_png ? '.png' : '.gif');
$cmd = self::imageMagickCommand('convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']);
\TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
CommandUtility::exec($cmd);
if (@is_file($newFile)) {
self::fixPermissions($newFile);
return $newFile;
......@@ -776,7 +780,7 @@ class GeneralUtility {
*/
static public function compat_version($verNumberStr) {
$currVersionStr = $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] : TYPO3_branch;
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($currVersionStr) < \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($verNumberStr)) {
if (VersionNumberUtility::convertVersionNumberToInteger($currVersionStr) < VersionNumberUtility::convertVersionNumberToInteger($verNumberStr)) {
return FALSE;
} else {
return TRUE;
......@@ -913,9 +917,9 @@ class GeneralUtility {
*/
static public function modifyHTMLColor($color, $R, $G, $B) {
// This takes a hex-color (# included!) and adds $R, $G and $B to the HTML-color (format: #xxxxxx) and returns the new color
$nR = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(hexdec(substr($color, 1, 2)) + $R, 0, 255);
$nG = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(hexdec(substr($color, 3, 2)) + $G, 0, 255);
$nB = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(hexdec(substr($color, 5, 2)) + $B, 0, 255);
$nR = MathUtility::forceIntegerInRange(hexdec(substr($color, 1, 2)) + $R, 0, 255);
$nG = MathUtility::forceIntegerInRange(hexdec(substr($color, 3, 2)) + $G, 0, 255);
$nB = MathUtility::forceIntegerInRange(hexdec(substr($color, 5, 2)) + $B, 0, 255);
return '#' . substr(('0' . dechex($nR)), -2) . substr(('0' . dechex($nG)), -2) . substr(('0' . dechex($nB)), -2);
}
......@@ -2111,7 +2115,7 @@ class GeneralUtility {
if (isset($options['grandParentTagMap'][$stackData['grandParentTagName'] . '/' . $stackData['parentTagName']])) {
$attr .= ' index="' . htmlspecialchars($tagName) . '"';
$tagName = (string) $options['grandParentTagMap'][($stackData['grandParentTagName'] . '/' . $stackData['parentTagName'])];
} elseif (isset($options['parentTagMap'][$stackData['parentTagName'] . ':_IS_NUM']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($tagName)) {
} elseif (isset($options['parentTagMap'][$stackData['parentTagName'] . ':_IS_NUM']) && MathUtility::canBeInterpretedAsInteger($tagName)) {
// Use tag based on parent tag name + if current tag is numeric
$attr .= ' index="' . htmlspecialchars($tagName) . '"';
$tagName = (string) $options['parentTagMap'][($stackData['parentTagName'] . ':_IS_NUM')];
......@@ -2214,10 +2218,10 @@ class GeneralUtility {
$array = $firstLevelCache[$identifier];
} else {
// Look up in second level cache
$array = \TYPO3\CMS\Frontend\Page\PageRepository::getHash($identifier, 0);
$array = PageRepository::getHash($identifier, 0);
if (!is_array($array)) {
$array = self::xml2arrayProcess($string, $NSprefix, $reportDocTag);
\TYPO3\CMS\Frontend\Page\PageRepository::storeHash($identifier, $array, 'ident_xml2array');
PageRepository::storeHash($identifier, $array, 'ident_xml2array');
}
// Store content in first level cache
$firstLevelCache[$identifier] = $array;
......@@ -3467,7 +3471,7 @@ Connection: close
break;
case 'TYPO3_SITE_URL':
if (defined('PATH_thisScript') && defined('PATH_site')) {
$lPath = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(dirname(PATH_thisScript)) . '/';
$lPath = PathUtility::stripPathSitePrefix(dirname(PATH_thisScript)) . '/';
$url = self::getIndpEnv('TYPO3_REQUEST_DIR');
$siteUrl = substr($url, 0, -strlen($lPath));
if (substr($siteUrl, -1) != '/') {
......@@ -3724,8 +3728,8 @@ Connection: close
if (strpos($filename, 'EXT:') === 0) {
list($extKey, $local) = explode('/', substr($filename, 4), 2);
$filename = '';
if ((string)$extKey !== '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
$filename = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey) . $local;
if ((string)$extKey !== '' && ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
$filename = ExtensionManagementUtility::extPath($extKey) . $local;
}
} elseif (!self::isAbsPath($filename)) {
// relative. Prepended with $relPathPrefix
......@@ -4319,7 +4323,7 @@ Connection: close
// Create new instance and call constructor with parameters
$instance = static::instantiateClass($finalClassName, func_get_args());
// Register new singleton instance
if ($instance instanceof \TYPO3\CMS\Core\SingletonInterface) {
if ($instance instanceof SingletonInterface) {
self::$singletonInstances[$finalClassName] = $instance;
}
return $instance;
......@@ -4386,7 +4390,7 @@ Connection: close
$className = static::getImplementationForClass($className);
}
}
return \TYPO3\CMS\Core\Core\ClassLoader::getClassNameForAlias($className);
return ClassLoader::getClassNameForAlias($className);
}
/**
......@@ -4434,7 +4438,7 @@ Connection: close
* @return void
* @internal
*/
static public function setSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance) {
static public function setSingletonInstance($className, SingletonInterface $instance) {
self::checkInstanceClassName($className, $instance);
self::$singletonInstances[$className] = $instance;
}
......@@ -4455,7 +4459,7 @@ Connection: close
* @return void
* @internal
*/
static public function removeSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance) {
static public function removeSingletonInstance($className, SingletonInterface $instance) {
self::checkInstanceClassName($className, $instance);
if (!isset(self::$singletonInstances[$className])) {
throw new \InvalidArgumentException('No Instance registered for ' . $className . '.', 1394099179);
......@@ -4520,7 +4524,7 @@ Connection: close
*/
static public function addInstance($className, $instance) {
self::checkInstanceClassName($className, $instance);
if ($instance instanceof \TYPO3\CMS\Core\SingletonInterface) {
if ($instance instanceof SingletonInterface) {
throw new \InvalidArgumentException('$instance must not be an instance of TYPO3\\CMS\\Core\\SingletonInterface. ' . 'For setting singletons, please use setSingletonInstance.', 1288969325);
}
if (!isset(self::$nonSingletonInstances[$className])) {
......@@ -4582,7 +4586,7 @@ Connection: close
'requestedServiceSubType' => $serviceSubType,
'requestedExcludeServiceKeys' => $excludeServiceKeys
);
while ($info = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
while ($info = ExtensionManagementUtility::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
// provide information about requested service to service object
$info = array_merge($info, $requestInfo);
// Check persistent object and if found, call directly and exit.
......@@ -4597,7 +4601,7 @@ Connection: close
if (is_object($obj)) {
if (!@is_callable(array($obj, 'init'))) {
// use silent logging??? I don't think so.
die('Broken service:' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($info));
die('Broken service:' . DebugUtility::viewArray($info));
}
$obj->info = $info;
// service available?
......@@ -4611,7 +4615,7 @@ Connection: close
}
}
// deactivate the service
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']);
ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']);
}
return $error;
}
......@@ -4865,7 +4869,7 @@ Connection: close
openlog($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'], LOG_ODELAY, $facility);
}
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'], 0, 4);
$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] = MathUtility::forceIntegerInRange($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'], 0, 4);
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit'] = TRUE;
}
......@@ -4881,7 +4885,7 @@ Connection: close
* @return void
*/
static public function sysLog($msg, $extKey, $severity = 0) {
$severity = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($severity, 0, 4);
$severity = MathUtility::forceIntegerInRange($severity, 0, 4);
// Is message worth logging?
if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] > $severity) {
return;
......@@ -4923,7 +4927,7 @@ Connection: close
} elseif ($type == 'mail') {
list($to, $from) = explode('/', $destination);
if (!self::validEmail($from)) {
$from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
$from = MailUtility::getSystemFrom();
}
/** @var $mail \TYPO3\CMS\Core\Mail\MailMessage */
$mail = self::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
......@@ -5000,7 +5004,7 @@ Connection: close
}
// Do not use console in login screen
if (in_array('console', $log) !== FALSE && isset($GLOBALS['BE_USER']->user['uid'])) {
\TYPO3\CMS\Core\Utility\DebugUtility::debug($msg, $date, 'Deprecation Log');
DebugUtility::debug($msg, $date, 'Deprecation Log');
}
}
......@@ -5042,8 +5046,8 @@ Connection: close
}