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 @@
* @see https://forge.typo3.org/issues/64504
*/
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
call_user_func(function() {
$classLoader = require __DIR__ . '/typo3/../vendor/autoload.php';
(new \TYPO3\CMS\Frontend\Http\Application($classLoader))->run();
call_user_func(function () {
$classLoader = require __DIR__ . '/typo3/../vendor/autoload.php';
(new \TYPO3\CMS\Frontend\Http\Application($classLoader))->run();
});
......@@ -21,206 +21,206 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Controller;
call_user_func(function() {
$classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(function() {
$originalRequestedFilenameParts = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
$originalRequestedFilename = basename($originalRequestedFilenameParts['path']);
switch ($originalRequestedFilename) {
case 'ajax.php':
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.'
);
break;
case 'alt_clickmenu.php':
GeneralUtility::deprecationLog(
'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->main();
$clickMenuController->printContent();
break;
case 'alt_db_navframe.php':
GeneralUtility::deprecationLog(
'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
$pageTreeNavigationController = GeneralUtility::makeInstance(Controller\PageTreeNavigationController::class);
$pageTreeNavigationController->initPage();
$pageTreeNavigationController->main();
$pageTreeNavigationController->printContent();
break;
case 'alt_doc.php':
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.'
);
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
/* @var $editDocumentController Controller\EditDocumentController */
$editDocumentController = GeneralUtility::makeInstance(Controller\EditDocumentController::class);
// Preprocessing, storing data if submitted to
$editDocumentController->preInit();
// Checks, if a save button has been clicked (or the doSave variable is sent)
if ($editDocumentController->doProcessData()) {
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'editRecord')) {
$editDocumentController->processData();
}
}
$editDocumentController->init();
$editDocumentController->main();
$editDocumentController->printContent();
break;
case 'alt_file_navframe.php':
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.'
);
$fileSystemNavigationFrameController = GeneralUtility::makeInstance(Controller\FileSystemNavigationFrameController::class);
$fileSystemNavigationFrameController->initPage();
$fileSystemNavigationFrameController->main();
$fileSystemNavigationFrameController->printContent();
break;
case 'browser.php':
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.'
);
$elementBrowserFramesetController = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class);
$elementBrowserFramesetController->main();
$elementBrowserFramesetController->printContent();
break;
case 'db_new.php':
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.'
);
$newRecordController = GeneralUtility::makeInstance(Controller\NewRecordController::class);
$newRecordController->main();
$newRecordController->printContent();
break;
case 'dummy.php':
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.'
);
$dummyController = GeneralUtility::makeInstance(Controller\DummyController::class);
$dummyController->main();
$dummyController->printContent();
break;
case 'init.php':
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'
);
break;
case 'login_frameset.php':
GeneralUtility::deprecationLog(
'Login frameset is moved to an own module. Please use BackendUtility::getModuleUrl(\'login_frameset\') to link to login_frameset.php.'
);
// Make instance:
$loginFramesetController = GeneralUtility::makeInstance(Controller\LoginFramesetController::class);
$loginFramesetController->main();
$loginFramesetController->printContent();
break;
case 'logout.php':
GeneralUtility::deprecationLog(
'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->logout();
// do the redirect
$redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
$redirectUrl = $redirect ?: 'index.php';
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
break;
case 'mod.php':
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.'
);
break;
case 'move_el.php':
GeneralUtility::deprecationLog(
'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->main();
$moveElementController->printContent();
break;
case 'show_item.php':
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.'
);
$elementInformationController = GeneralUtility::makeInstance(Controller\ContentElement\ElementInformationController::class);
$elementInformationController->main();
$elementInformationController->printContent();
break;
case 'tce_db.php':
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.'
);
$simpleDataHandlerController = GeneralUtility::makeInstance(Controller\SimpleDataHandlerController::class);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$simpleDataHandlerController->initClipboard();
$simpleDataHandlerController->main();
}
$simpleDataHandlerController->finish();
break;
case 'tce_file.php':
GeneralUtility::deprecationLog(
'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);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$fileController->main();
}
$fileController->finish();
break;
case 'thumbs.php':
GeneralUtility::deprecationLog(
'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']->init();
$GLOBALS['SOBE']->main();
break;
default:
throw new \RuntimeException('You cannot call this script directly.');
}
});
call_user_func(function () {
$classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(function () {
$originalRequestedFilenameParts = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
$originalRequestedFilename = basename($originalRequestedFilenameParts['path']);
switch ($originalRequestedFilename) {
case 'ajax.php':
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.'
);
break;
case 'alt_clickmenu.php':
GeneralUtility::deprecationLog(
'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->main();
$clickMenuController->printContent();
break;
case 'alt_db_navframe.php':
GeneralUtility::deprecationLog(
'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
$pageTreeNavigationController = GeneralUtility::makeInstance(Controller\PageTreeNavigationController::class);
$pageTreeNavigationController->initPage();
$pageTreeNavigationController->main();
$pageTreeNavigationController->printContent();
break;
case 'alt_doc.php':
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.'
);
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
/* @var $editDocumentController Controller\EditDocumentController */
$editDocumentController = GeneralUtility::makeInstance(Controller\EditDocumentController::class);
// Preprocessing, storing data if submitted to
$editDocumentController->preInit();
// Checks, if a save button has been clicked (or the doSave variable is sent)
if ($editDocumentController->doProcessData()) {
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'editRecord')) {
$editDocumentController->processData();
}
}
$editDocumentController->init();
$editDocumentController->main();
$editDocumentController->printContent();
break;
case 'alt_file_navframe.php':
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.'
);
$fileSystemNavigationFrameController = GeneralUtility::makeInstance(Controller\FileSystemNavigationFrameController::class);
$fileSystemNavigationFrameController->initPage();
$fileSystemNavigationFrameController->main();
$fileSystemNavigationFrameController->printContent();
break;
case 'browser.php':
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.'
);
$elementBrowserFramesetController = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class);
$elementBrowserFramesetController->main();
$elementBrowserFramesetController->printContent();
break;
case 'db_new.php':
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.'
);
$newRecordController = GeneralUtility::makeInstance(Controller\NewRecordController::class);
$newRecordController->main();
$newRecordController->printContent();
break;
case 'dummy.php':
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.'
);
$dummyController = GeneralUtility::makeInstance(Controller\DummyController::class);
$dummyController->main();
$dummyController->printContent();
break;
case 'init.php':
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'
);
break;
case 'login_frameset.php':
GeneralUtility::deprecationLog(
'Login frameset is moved to an own module. Please use BackendUtility::getModuleUrl(\'login_frameset\') to link to login_frameset.php.'
);
// Make instance:
$loginFramesetController = GeneralUtility::makeInstance(Controller\LoginFramesetController::class);
$loginFramesetController->main();
$loginFramesetController->printContent();
break;
case 'logout.php':
GeneralUtility::deprecationLog(
'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->logout();
// do the redirect
$redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
$redirectUrl = $redirect ?: 'index.php';
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
break;
case 'mod.php':
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.'
);
break;
case 'move_el.php':
GeneralUtility::deprecationLog(
'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->main();
$moveElementController->printContent();
break;
case 'show_item.php':
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.'
);
$elementInformationController = GeneralUtility::makeInstance(Controller\ContentElement\ElementInformationController::class);
$elementInformationController->main();
$elementInformationController->printContent();
break;
case 'tce_db.php':
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.'
);
$simpleDataHandlerController = GeneralUtility::makeInstance(Controller\SimpleDataHandlerController::class);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$simpleDataHandlerController->initClipboard();
$simpleDataHandlerController->main();
}
$simpleDataHandlerController->finish();
break;
case 'tce_file.php':
GeneralUtility::deprecationLog(
'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);
$formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formProtection->validateToken(GeneralUtility::_GP('formToken'), 'tceAction')) {
$fileController->main();
}
$fileController->finish();
break;
case 'thumbs.php':
GeneralUtility::deprecationLog(
'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']->init();
$GLOBALS['SOBE']->main();
break;
default:
throw new \RuntimeException('You cannot call this script directly.');
}
});
});
......@@ -15,7 +15,7 @@
/**
* Main entry point for all backend-related scripts.
*/
call_user_func(function() {
$classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
call_user_func(function () {
$classLoader = require __DIR__ . '/../vendor/autoload.php';
(new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
});
......@@ -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.
*/
class AboutController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
class AboutController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* @var
*/
protected $defaultViewObjectName = BackendTemplateView::class;
/**
* @var
*/
protected $defaultViewObjectName = BackendTemplateView::class;
/**
* @var \TYPO3\CMS\About\Domain\Repository\ExtensionRepository
*/
protected $extensionRepository;
/**
* @var \TYPO3\CMS\About\Domain\Repository\ExtensionRepository
*/
protected $extensionRepository;
/**
* @param \TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository
*/
public function injectExtensionRepository(\TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $extensionRepository;
}
/**
* @param \TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository
*/
public function injectExtensionRepository(\TYPO3\CMS\About\Domain\Repository\ExtensionRepository $extensionRepository) {
$this->extensionRepository = $extensionRepository;
}
/**
* Set up the doc header properly here
*
* @param ViewInterface $view
*/
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);
}
/**
* Set up the doc header properly here
*
* @param ViewInterface $view
*/
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);
}
}
......@@ -19,82 +19,89 @@ namespace TYPO3\CMS\About\Domain\Model;
*
* @entity
*/
class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
*/
protected $author = '';
/**
* @var string
*/
protected $author = '';
/**
* @var string
*/
protected $authorEmail = '';
/**
* @var string
*/
protected $authorEmail = '';
/**
* @var string
*/
protected $key = '';
/**
* @var string
*/
protected $key = '';
/**
* @var string
*/
protected $title = '';
/**
* @var string
*/
protected $title = '';
/**
* @param string $author
*/
public function setAuthor($author)
{
$this->author = $author;
}
/**
* @param string $author
*/
public function setAuthor($author) {
$this->author = $author;
}
/**
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* @return string
*/
public function getAuthor() {
return $this->author;
}
/**
* @param string $authorEmail