Skip to content
Snippets Groups Projects
Commit 459cd1e4 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Smaller cleanups

parent 7a8d385f
No related branches found
No related tags found
1 merge request!14Cleanups
......@@ -99,7 +99,7 @@ class PlaintextService {
* @param string $content
* @return array
*/
protected function addLineBreaks($content) {
protected function addLineBreaks($content): array {
$tags2LineBreaks = [
'</p>',
'</tr>',
......
......@@ -130,9 +130,9 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
$pathAsArray = GeneralUtility::trimExplode('/', $pathToRegistrationFile);
$filename = $pathAsArray[\count($pathAsArray) - 1];
$filenameWithoutHash = GeneralUtility::trimExplode('_', $filename, FALSE, 2)[1];
$hash = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $filenameWithoutHash);
$hash = \md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $filenameWithoutHash);
// if the filename doesn't start with the hash value, ignore it
if (strpos($filename, $hash) !== 0) {
if (\strpos($filename, $hash) !== 0) {
continue;
}
......@@ -240,7 +240,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
$registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation);
GeneralUtility::mkdir_deep($registerFolder);
$hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php');
$hashPrefix = \md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php');
$registerFile = GeneralUtility::getFileAbsFileName(
$registerFolder . '/' . $hashPrefix . '_' . $templateKey . '.php'
);
......@@ -268,7 +268,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
];
}
file_put_contents($registerFile, '<?php return ' . var_export($newRegisterArray, TRUE) . ';');
\file_put_contents($registerFile, '<?php return ' . \var_export($newRegisterArray, TRUE) . ';');
return $registerFile;
}
......@@ -283,11 +283,11 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
$registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation);
GeneralUtility::mkdir_deep($registerFolder);
$hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php');
$hashPrefix = \md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php');
$registerFile = GeneralUtility::getFileAbsFileName(
$registerFolder . '/' . $hashPrefix . '_' . $templateKey . '.php'
);
if (file_exists($registerFile)) {
if (\file_exists($registerFile)) {
\unlink($registerFile);
}
}
......@@ -340,13 +340,13 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
GeneralUtility::mkdir_deep($registerFolder);
if ($filePath === '') {
$hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateName . '.php');
$hashPrefix = \md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateName . '.php');
$filePath = GeneralUtility::getFileAbsFileName(
$registerFolder . '/' . $hashPrefix . '_' . $templateName . '.php'
);
}
if (file_exists($filePath)) {
if (\file_exists($filePath)) {
$success = \unlink($filePath);
} else {
return FALSE;
......@@ -383,7 +383,7 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
$registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation);
GeneralUtility::mkdir_deep($registerFolder);
$hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateName . '.php');
$hashPrefix = \md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateName . '.php');
$filePath = GeneralUtility::getFileAbsFileName(
$registerFolder . '/' . $hashPrefix . '_' . $templateName . '.php'
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment