Commit b362e366 authored by TYPO3 Release Team's avatar TYPO3 Release Team
Browse files

[TASK] Make TYPO3 Core PSR-2 standard compliant

In our efforts to achieve a better interoperability
with other PHP projects, the PHP code base of the
TYPO3 Core switches to the PHP coding guideline
standard PSR-2.

See http://www.php-fig.org/psr/psr-2/ for more
information.

Resolves: #70515
Releases: master
Change-Id: I734c0d838af157003decfeb5fc0a11dddcb87bf5
Reviewed-on: http://review.typo3.org/43918


Reviewed-by: default avatarTYPO3 Release Team <typo3cms@typo3.org>
Tested-by: default avatarTYPO3 Release Team <typo3cms@typo3.org>
parent 886626f3
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
* @see https://forge.typo3.org/issues/64504 * @see https://forge.typo3.org/issues/64504
*/ */
if (version_compare(PHP_VERSION, '5.5.0', '<')) { if (version_compare(PHP_VERSION, '5.5.0', '<')) {
die('TYPO3 CMS requires PHP 5.5 or above'); die('TYPO3 CMS requires PHP 5.5 or above');
} }
// Set up the application for the Frontend // Set up the application for the Frontend
call_user_func(function() { call_user_func(function () {
$classLoader = require __DIR__ . '/typo3/../vendor/autoload.php'; $classLoader = require __DIR__ . '/typo3/../vendor/autoload.php';
(new \TYPO3\CMS\Frontend\Http\Application($classLoader))->run(); (new \TYPO3\CMS\Frontend\Http\Application($classLoader))->run();
}); });
...@@ -21,206 +21,206 @@ ...@@ -21,206 +21,206 @@
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Controller; use TYPO3\CMS\Backend\Controller;
call_user_func(function() { call_user_func(function () {
$classLoader = require __DIR__ . '/../vendor/autoload.php'; $classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(function() { (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(function () {
$originalRequestedFilenameParts = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $originalRequestedFilenameParts = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
$originalRequestedFilename = basename($originalRequestedFilenameParts['path']); $originalRequestedFilename = basename($originalRequestedFilenameParts['path']);
switch ($originalRequestedFilename) { switch ($originalRequestedFilename) {
case 'ajax.php': case 'ajax.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to ajax.php was moved to index.php with ajaxID given. Please use BackendUtility::getAjaxUrl(\'myAjaxKey\') to link to the AJAX Call.' 'The entry point to ajax.php was moved to index.php with ajaxID given. Please use BackendUtility::getAjaxUrl(\'myAjaxKey\') to link to the AJAX Call.'
); );
break; break;
case 'alt_clickmenu.php': case 'alt_clickmenu.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'alt_clickmenu.php is deprecated, and will not work anymore, please use the AJAX functionality as used in the TYPO3 Core.' 'alt_clickmenu.php is deprecated, and will not work anymore, please use the AJAX functionality as used in the TYPO3 Core.'
); );
$clickMenuController = GeneralUtility::makeInstance(Controller\ClickMenuController::class); $clickMenuController = GeneralUtility::makeInstance(Controller\ClickMenuController::class);
$clickMenuController->main(); $clickMenuController->main();
$clickMenuController->printContent(); $clickMenuController->printContent();
break; break;
case 'alt_db_navframe.php': case 'alt_db_navframe.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'Usage of alt_db_navframe.php is deprecated since TYPO3 CMS 7, and will be removed in TYPO3 CMS 8' 'Usage of alt_db_navframe.php is deprecated since TYPO3 CMS 7, and will be removed in TYPO3 CMS 8'
); );
// Make instance if it is not an AJAX call // Make instance if it is not an AJAX call
$pageTreeNavigationController = GeneralUtility::makeInstance(Controller\PageTreeNavigationController::class); $pageTreeNavigationController = GeneralUtility::makeInstance(Controller\PageTreeNavigationController::class);
$pageTreeNavigationController->initPage(); $pageTreeNavigationController->initPage();
$pageTreeNavigationController->main(); $pageTreeNavigationController->main();
$pageTreeNavigationController->printContent(); $pageTreeNavigationController->printContent();
break; break;
case 'alt_doc.php': case 'alt_doc.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to FormEngine was moved to an own module. Please use BackendUtility::getModuleUrl(\'record_edit\') to link to alt_doc.php.' 'The entry point to FormEngine was moved to an own module. Please use BackendUtility::getModuleUrl(\'record_edit\') to link to alt_doc.php.'
); );
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords(); \TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
/* @var $editDocumentController Controller\EditDocumentController */ /* @var $editDocumentController Controller\EditDocumentController */
$editDocumentController = GeneralUtility::makeInstance(Controller\EditDocumentController::class); $editDocumentController = GeneralUtility::makeInstance(Controller\EditDocumentController::class);
// Preprocessing, storing data if submitted to // Preprocessing, storing data if submitted to
$editDocumentController->preInit(); $editDocumentController->preInit();
// Checks, if a save button has been clicked (or the doSave variable is sent) // Checks, if a save button has been clicked (or the doSave variable is sent)
if ($editDocumentController->doProcessData()) { if ($editDocumentController->doProcessData()) {
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(); $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'editRecord')) { if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'editRecord')) {
$editDocumentController->processData(); $editDocumentController->processData();
} }
} }
$editDocumentController->init(); $editDocumentController->init();
$editDocumentController->main(); $editDocumentController->main();
$editDocumentController->printContent(); $editDocumentController->printContent();
break; break;
case 'alt_file_navframe.php': case 'alt_file_navframe.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to the folder tree was moved to an own module. Please use BackendUtility::getModuleUrl(\'file_navframe\') to link to alt_file_navframe.php.' 'The entry point to the folder tree was moved to an own module. Please use BackendUtility::getModuleUrl(\'file_navframe\') to link to alt_file_navframe.php.'
); );
$fileSystemNavigationFrameController = GeneralUtility::makeInstance(Controller\FileSystemNavigationFrameController::class); $fileSystemNavigationFrameController = GeneralUtility::makeInstance(Controller\FileSystemNavigationFrameController::class);
$fileSystemNavigationFrameController->initPage(); $fileSystemNavigationFrameController->initPage();
$fileSystemNavigationFrameController->main(); $fileSystemNavigationFrameController->main();
$fileSystemNavigationFrameController->printContent(); $fileSystemNavigationFrameController->printContent();
break; break;
case 'browser.php': case 'browser.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to the file/record browser window was moved to an own module. Please use BackendUtility::getModuleUrl(\'browser\') to link to browser.php.' 'The entry point to the file/record browser window was moved to an own module. Please use BackendUtility::getModuleUrl(\'browser\') to link to browser.php.'
); );
$elementBrowserFramesetController = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class); $elementBrowserFramesetController = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class);
$elementBrowserFramesetController->main(); $elementBrowserFramesetController->main();
$elementBrowserFramesetController->printContent(); $elementBrowserFramesetController->printContent();
break; break;
case 'db_new.php': case 'db_new.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to create a new database entry was moved to an own module. Please use BackendUtility::getModuleUrl(\'db_new\') to link to db_new.php.' 'The entry point to create a new database entry was moved to an own module. Please use BackendUtility::getModuleUrl(\'db_new\') to link to db_new.php.'
); );
$newRecordController = GeneralUtility::makeInstance(Controller\NewRecordController::class); $newRecordController = GeneralUtility::makeInstance(Controller\NewRecordController::class);
$newRecordController->main(); $newRecordController->main();
$newRecordController->printContent(); $newRecordController->printContent();
break; break;
case 'dummy.php': case 'dummy.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to the dummy window was moved to an own module. Please use BackendUtility::getModuleUrl(\'dummy\') to link to dummy.php.' 'The entry point to the dummy window was moved to an own module. Please use BackendUtility::getModuleUrl(\'dummy\') to link to dummy.php.'
); );
$dummyController = GeneralUtility::makeInstance(Controller\DummyController::class); $dummyController = GeneralUtility::makeInstance(Controller\DummyController::class);
$dummyController->main(); $dummyController->main();
$dummyController->printContent(); $dummyController->printContent();
break; break;
case 'init.php': case 'init.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'Usage of typo3/init.php is deprecated. Use index.php with Routing or the Backend Application class directly. See index.php for usage' 'Usage of typo3/init.php is deprecated. Use index.php with Routing or the Backend Application class directly. See index.php for usage'
); );
break; break;
case 'login_frameset.php': case 'login_frameset.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'Login frameset is moved to an own module. Please use BackendUtility::getModuleUrl(\'login_frameset\') to link to login_frameset.php.' 'Login frameset is moved to an own module. Please use BackendUtility::getModuleUrl(\'login_frameset\') to link to login_frameset.php.'
); );
// Make instance: // Make instance:
$loginFramesetController = GeneralUtility::makeInstance(Controller\LoginFramesetController::class); $loginFramesetController = GeneralUtility::makeInstance(Controller\LoginFramesetController::class);
$loginFramesetController->main(); $loginFramesetController->main();
$loginFramesetController->printContent(); $loginFramesetController->printContent();
break; break;
case 'logout.php': case 'logout.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to logout was moved to an own module. Please use BackendUtility::getModuleUrl(\'logout\') to link to logout.php.' 'The entry point to logout was moved to an own module. Please use BackendUtility::getModuleUrl(\'logout\') to link to logout.php.'
); );
$logoutController = GeneralUtility::makeInstance(Controller\LogoutController::class); $logoutController = GeneralUtility::makeInstance(Controller\LogoutController::class);
$logoutController->logout(); $logoutController->logout();
// do the redirect // do the redirect
$redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect')); $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
$redirectUrl = $redirect ?: 'index.php'; $redirectUrl = $redirect ?: 'index.php';
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl); \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
break; break;
case 'mod.php': case 'mod.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to mod.php was moved to index.php with "M" given. Please use BackendUtility::getModuleUrl(\'myModuleKey\') to link to a module.' 'The entry point to mod.php was moved to index.php with "M" given. Please use BackendUtility::getModuleUrl(\'myModuleKey\') to link to a module.'
); );
break; break;
case 'move_el.php': case 'move_el.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'Moving an element is moved to an own module. Please use BackendUtility::getModuleUrl(\'move_element\') to link to move_el.php.' 'Moving an element is moved to an own module. Please use BackendUtility::getModuleUrl(\'move_element\') to link to move_el.php.'
); );
$moveElementController = GeneralUtility::makeInstance(Controller\ContentElement\MoveElementController::class); $moveElementController = GeneralUtility::makeInstance(Controller\ContentElement\MoveElementController::class);
$moveElementController->main(); $moveElementController->main();
$moveElementController->printContent(); $moveElementController->printContent();
break; break;
case 'show_item.php': case 'show_item.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to show_item was moved to an own module. Please use BackendUtility::getModuleUrl(\'show_item\') to link to show_item.php.' 'The entry point to show_item was moved to an own module. Please use BackendUtility::getModuleUrl(\'show_item\') to link to show_item.php.'
); );
$elementInformationController = GeneralUtility::makeInstance(Controller\ContentElement\ElementInformationController::class); $elementInformationController = GeneralUtility::makeInstance(Controller\ContentElement\ElementInformationController::class);
$elementInformationController->main(); $elementInformationController->main();
$elementInformationController->printContent(); $elementInformationController->printContent();
break; break;
case 'tce_db.php': case 'tce_db.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'The entry point to data handling via DataHandler was moved to an own module. Please use BackendUtility::getModuleUrl(\'tce_db\') to link to tce_db.php / DataHandler.' 'The entry point to data handling via DataHandler was moved to an own module. Please use BackendUtility::getModuleUrl(\'tce_db\') to link to tce_db.php / DataHandler.'
); );
$simpleDataHandlerController = GeneralUtility::makeInstance(Controller\SimpleDataHandlerController::class); $simpleDataHandlerController = GeneralUtility::makeInstance(Controller\SimpleDataHandlerController::class);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(); $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) { if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$simpleDataHandlerController->initClipboard(); $simpleDataHandlerController->initClipboard();
$simpleDataHandlerController->main(); $simpleDataHandlerController->main();
} }
$simpleDataHandlerController->finish(); $simpleDataHandlerController->finish();
break; break;
case 'tce_file.php': case 'tce_file.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'File handling entry point was moved an own module. Please use BackendUtility::getModuleUrl(\'tce_file\') to link to tce_file.php.' 'File handling entry point was moved an own module. Please use BackendUtility::getModuleUrl(\'tce_file\') to link to tce_file.php.'
); );
$fileController = GeneralUtility::makeInstance(Controller\File\FileController::class); $fileController = GeneralUtility::makeInstance(Controller\File\FileController::class);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(); $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) { if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$fileController->main(); $fileController->main();
} }
$fileController->finish(); $fileController->finish();
break; break;
case 'thumbs.php': case 'thumbs.php':
GeneralUtility::deprecationLog( GeneralUtility::deprecationLog(
'thumbs.php is no longer in use, please use the corresponding Resource objects to generate a preview functionality for thumbnails.' 'thumbs.php is no longer in use, please use the corresponding Resource objects to generate a preview functionality for thumbnails.'
); );
$GLOBALS['SOBE'] = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\ThumbnailView::class); $GLOBALS['SOBE'] = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\ThumbnailView::class);
$GLOBALS['SOBE']->init(); $GLOBALS['SOBE']->init();
$GLOBALS['SOBE']->main(); $GLOBALS['SOBE']->main();
break; break;
default: default:
throw new \RuntimeException('You cannot call this script directly.'); throw new \RuntimeException('You cannot call this script directly.');
} }
}); });
}); });
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/** /**
* Main entry point for all backend-related scripts. * Main entry point for all backend-related scripts.
*/ */
call_user_func(function() { call_user_func(function () {
$classLoader = require __DIR__ . '/../vendor/autoload.php'; $classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(); (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
}); });
...@@ -20,49 +20,51 @@ use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; ...@@ -20,49 +20,51 @@ use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
/** /**
* Module 'about' shows some standard information for TYPO3 CMS: About-text, version number and so on. * Module 'about' shows some standard information for TYPO3 CMS: About-text, version number and so on.
*/ */
class AboutController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { class AboutController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* @var
*/
protected $defaultViewObjectName = BackendTemplateView::class;
/** /**
* @var * @var \TYPO3\CMS\About\Domain\Repository\ExtensionRepository
*/ */
protected $defaultViewObjectName = BackendTemplateView::class; protected $extensionRepository;
/** /**
* @var \TYPO3\CMS\About\Domain\Repository\ExtensionRepository * @param \TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository
*/ */
protected $extensionRepository; public function injectExtensionRepository(\TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $extensionRepository;
}
/** /**
* @param \TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository * Set up the doc header properly here
*/ *
public function injectExtensionRepository(\TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository) { * @param ViewInterface $view
$this->extensionRepository = $extensionRepository; */
} protected function initializeView(ViewInterface $view)
{
/** /** @var BackendTemplateView $view */
* Set up the doc header properly here parent::initializeView($view);
* // Disable Path
* @param ViewInterface $view $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]);
*/ }
protected function initializeView(ViewInterface $view) {
/** @var BackendTemplateView $view */
parent::initializeView($view);
// Disable Path
$view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]);
}
/**
* Main action: Show standard information
*
* @return void
*/
public function indexAction() {
$extensions = $this->extensionRepository->findAllLoaded();
$this->view
->assign('TYPO3Version', TYPO3_version)
->assign('TYPO3CopyrightYear', TYPO3_copyright_year)
->assign('TYPO3UrlDonate', TYPO3_URL_DONATE)
->assign('loadedExtensions', $extensions);
}
/**
* Main action: Show standard information
*
* @return void
*/
public function indexAction()
{
$extensions = $this->extensionRepository->findAllLoaded();
$this->view
->assign('TYPO3Version', TYPO3_version)
->assign('TYPO3CopyrightYear', TYPO3_copyright_year)
->assign('TYPO3UrlDonate', TYPO3_URL_DONATE)
->assign('loadedExtensions', $extensions);
}
} }
...@@ -19,82 +19,89 @@ namespace TYPO3\CMS\About\Domain\Model; ...@@ -19,82 +19,89 @@ namespace TYPO3\CMS\About\Domain\Model;
* *
* @entity * @entity
*/ */
class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
*/
protected $author = '';
/** /**
* @var string * @var string
*/ */
protected $author = ''; protected $authorEmail = '';
/** /**
* @var string * @var string
*/ */
protected $authorEmail = ''; protected $key = '';
/** /**
* @var string * @var string
*/ */
protected $key = ''; protected $title = '';
/** /**
* @var string * @param string $author
*/ */
protected $title = ''; public function setAuthor($author)
{
$this->author = $author;
}
/** /**
* @param string $author * @return string
*/ */
public function setAuthor($author) { public function getAuthor()
$this->author = $author; {
} return $this->author;
}
/** /**
* @return string * @param string $authorEmail
*/ */
public function getAuthor() { public function setAuthorEmail($authorEmail)
return $this->author; {
} $this->authorEmail = $authorEmail;
}
/** /**
* @param string $authorEmail * @return string
*/ */
public function setAuthorEmail($authorEmail) { public function getAuthorEmail()
$this->authorEmail = $authorEmail; {
} return $this->authorEmail;
}
/** /**
* @return string * @param string $key
*/