Commit 3907e862 authored by Tymoteusz Motylewski's avatar Tymoteusz Motylewski Committed by Wouter Wolters
Browse files

[TASK] Switch isset() and is_array() to null coalesce

Several hundred function calls and vast numbers
of indentations can be saved by using the null
coalesce operator instead of checking empty/array.

Change-Id: I38f2ce2de83a454aaa0d16c771014b6de84b3f7a
Releases: master
Resolves: #80812
Reviewed-on: https://review.typo3.org/52416

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent e3385140
......@@ -65,12 +65,10 @@ class AboutController extends ActionController
{
$warnings = [];
// Hook for additional warnings
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
$hookObj->displayWarningMessages_postProcess($warnings);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] ?? [] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
$hookObj->displayWarningMessages_postProcess($warnings);
}
}
......
......@@ -135,13 +135,10 @@ class Avatar
*/
protected function validateSortAndInitiateAvatarProviders()
{
if (
empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders'])
|| !is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders'])
) {
$providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders'] ?? [];
if (empty($providers)) {
return;
}
$providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders'];
foreach ($providers as $identifier => $configuration) {
if (empty($configuration) || !is_array($configuration)) {
throw new \RuntimeException(
......
......@@ -75,14 +75,12 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
}
// Hook for manipulating cacheActions
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
$hookObject = GeneralUtility::makeInstance($cacheAction);
if (!$hookObject instanceof ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException($cacheAction . ' must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
}
$hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] ?? [] as $cacheAction) {
$hookObject = GeneralUtility::makeInstance($cacheAction);
if (!$hookObject instanceof ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException($cacheAction . ' must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
}
$hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
}
}
......
......@@ -59,11 +59,7 @@ class ContextMenu
*/
protected function getAvailableProviders(string $table, string $identifier, string $context): array
{
$providers = $this->itemProviders;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'])) {
$providers = array_merge($this->itemProviders, $GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders']);
}
$providers = array_merge($this->itemProviders, $GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'] ?? []);
$availableProviders = [];
foreach ($providers as $providerClass) {
$provider = GeneralUtility::makeInstance($providerClass, $table, $identifier, $context);
......
......@@ -183,8 +183,7 @@ class BackendController
protected function initializeToolbarItems()
{
$toolbarItemInstances = [];
$classNameRegistry = $GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'];
foreach ($classNameRegistry as $className) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'] ?? [] as $className) {
$toolbarItemInstance = GeneralUtility::makeInstance($className);
if (!$toolbarItemInstance instanceof ToolbarItemInterface) {
throw new \RuntimeException(
......@@ -796,10 +795,8 @@ class BackendController
protected function executeHook($identifier, array $hookConfiguration = [])
{
$options = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php'];
if (isset($options[$identifier]) && is_array($options[$identifier])) {
foreach ($options[$identifier] as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookConfiguration, $this);
}
foreach ($options[$identifier] ?? [] as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookConfiguration, $this);
}
}
......
......@@ -211,15 +211,13 @@ class ElementInformationController
// render type by user func
$typeRendered = false;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $className) {
$typeRenderObj = GeneralUtility::makeInstance($className);
if (method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
if ($typeRenderObj->isValid($this->type, $this)) {
$content .= $typeRenderObj->render($this->type, $this);
$typeRendered = true;
break;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] ?? [] as $className) {
$typeRenderObj = GeneralUtility::makeInstance($className);
if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
if ($typeRenderObj->isValid($this->type, $this)) {
$content .= $typeRenderObj->render($this->type, $this);
$typeRendered = true;
break;
}
}
}
......
......@@ -231,17 +231,15 @@ class NewContentElementController
$wizardItems = $this->wizardArray();
// Wrapper for wizards
// Hook for manipulating wizardItems, wrapper, onClickEvent etc.
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof NewContentElementWizardHookInterface) {
throw new \UnexpectedValueException(
$className . ' must implement interface ' . NewContentElementWizardHookInterface::class,
1227834741
);
}
$hookObject->manipulateWizardItems($wizardItems, $this);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] ?? [] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof NewContentElementWizardHookInterface) {
throw new \UnexpectedValueException(
$className . ' must implement interface ' . NewContentElementWizardHookInterface::class,
1227834741
);
}
$hookObject->manipulateWizardItems($wizardItems, $this);
}
// Add document inline javascript
$this->moduleTemplate->addJavaScriptCode(
......
......@@ -167,18 +167,13 @@ class EditFileController
$this->getButtons();
// Hook: before compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
$preOutputProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
if (is_array($preOutputProcessingHook)) {
$hookParameters = [
'content' => &$this->content,
'target' => &$this->target,
'dataColumnDefinition' => &$dataColumnDefinition,
];
foreach ($preOutputProcessingHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'] ?? [] as $hookFunction) {
$hookParameters = [
'content' => &$this->content,
'target' => &$this->target,
'dataColumnDefinition' => &$dataColumnDefinition,
];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
$assigns = [];
......@@ -262,17 +257,12 @@ class EditFileController
$pageContent = $view->render();
// Hook: after compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
$postOutputProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
if (is_array($postOutputProcessingHook)) {
$hookParameters = [
'pageContent' => &$pageContent,
'target' => &$this->target
];
foreach ($postOutputProcessingHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'] ?? [] as $hookFunction) {
$hookParameters = [
'pageContent' => &$pageContent,
'target' => &$this->target
];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
$this->content .= $pageContent;
......
......@@ -446,14 +446,10 @@ class LoginController
*/
protected function validateAndSortLoginProviders()
{
if (
!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'])
|| !is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'])
|| empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'])
) {
$providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] ?? [];
if (empty($providers) || !is_array($providers)) {
throw new \RuntimeException('No login providers are registered in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'backend\'][\'loginProviders\'].', 1433417281);
}
$providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'];
foreach ($providers as $identifier => $configuration) {
if (empty($configuration) || !is_array($configuration)) {
throw new \RuntimeException('Missing configuration for login provider "' . $identifier . '".', 1433416043);
......
......@@ -764,15 +764,12 @@ class PageLayoutController
$this->makeButtons();
// @internal: This is an internal hook for compatibility7 only, this hook will be removed without further notice
if ($this->MOD_SETTINGS['function'] != 1 && $this->MOD_SETTINGS['function'] != 2) {
$renderActionHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['renderActionHook'];
if (is_array($renderActionHook)) {
foreach ($renderActionHook as $hook) {
$params = [
'deleteButton' => $this->deleteButton,
''
];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['renderActionHook'] ?? [] as $hook) {
$params = [
'deleteButton' => $this->deleteButton,
''
];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
}
// Create LanguageMenu
......@@ -905,12 +902,9 @@ class PageLayoutController
// Init the content
$content = '';
// Additional header content
$headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
if (is_array($headerContentHook)) {
foreach ($headerContentHook as $hook) {
$params = [];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'] ?? [] as $hook) {
$params = [];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
// Add the content for each table we have rendered (traversing $tableOutput variable)
foreach ($tableOutput as $table => $output) {
......@@ -928,12 +922,9 @@ class PageLayoutController
$this->searchContent = $dbList->getSearchBox();
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
foreach ($footerContentHook as $hook) {
$params = [];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'] ?? [] as $hook) {
$params = [];
$content .= GeneralUtility::callUserFunction($hook, $params, $this);
}
return $content;
}
......
......@@ -246,17 +246,15 @@ class NewContentElementWizardController
$wizardItems = $this->getWizardItems();
// Wrapper for wizards
// Hook for manipulating wizardItems, wrapper, onClickEvent etc.
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof NewContentElementWizardHookInterface) {
throw new \UnexpectedValueException(
$className . ' must implement interface ' . NewContentElementWizardHookInterface::class,
1496496724
);
}
$hookObject->manipulateWizardItems($wizardItems, $this);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] ?? [] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof NewContentElementWizardHookInterface) {
throw new \UnexpectedValueException(
$className . ' must implement interface ' . NewContentElementWizardHookInterface::class,
1496496724
);
}
$hookObject->manipulateWizardItems($wizardItems, $this);
}
// Traverse items for the wizard.
......
......@@ -631,17 +631,12 @@ class InlineRecordContainer extends AbstractContainer
protected function initHookObjects()
{
$this->hookObjects = [];
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['tceformsInlineHook'])) {
$tceformsInlineHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['tceformsInlineHook'];
if (is_array($tceformsInlineHook)) {
foreach ($tceformsInlineHook as $className) {
$processObject = GeneralUtility::makeInstance($className);
if (!$processObject instanceof InlineElementHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . InlineElementHookInterface::class, 1202072000);
}
$this->hookObjects[] = $processObject;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms_inline.php']['tceformsInlineHook'] ?? [] as $className) {
$processObject = GeneralUtility::makeInstance($className);
if (!$processObject instanceof InlineElementHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . InlineElementHookInterface::class, 1202072000);
}
$this->hookObjects[] = $processObject;
}
}
......
......@@ -224,15 +224,13 @@ class ImageManipulationElement extends AbstractFormElement
{
$previewUrl = '';
// Hook to generate a preview URL
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend/Form/Element/ImageManipulationElement']['previewUrl']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend/Form/Element/ImageManipulationElement']['previewUrl'])) {
$hookParameters = [
'databaseRow' => $databaseRow,
'file' => $file,
'previewUrl' => $previewUrl,
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend/Form/Element/ImageManipulationElement']['previewUrl'] as $listener) {
$previewUrl = GeneralUtility::callUserFunction($listener, $hookParameters, $this);
}
$hookParameters = [
'databaseRow' => $databaseRow,
'file' => $file,
'previewUrl' => $previewUrl,
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend/Form/Element/ImageManipulationElement']['previewUrl'] ?? [] as $listener) {
$previewUrl = GeneralUtility::callUserFunction($listener, $hookParameters, $this);
}
return $previewUrl;
}
......
......@@ -170,9 +170,7 @@ class DatabaseUserPermissionCheck implements FormDataProviderInterface
);
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'])
) {
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'] ?? null)) {
// A hook may modify the $userHasAccess decision. Previous state is saved to see if a hook changed
// a previous decision from TRUE to FALSE to throw a specific exception in this case
$userHasAccessBeforeHook = $userHasAccess;
......
......@@ -166,13 +166,11 @@ class ButtonBar
ksort($this->buttons[$position]);
}
// Hook for manipulating the docHeaderButtons
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend\Template\Components\ButtonBar']['getButtonsHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend\Template\Components\ButtonBar']['getButtonsHook'] as $funcRef) {
$params = [
'buttons' => $this->buttons
];
$this->buttons = GeneralUtility::callUserFunction($funcRef, $params, $this);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend\Template\Components\ButtonBar']['getButtonsHook'] ?? [] as $funcRef) {
$params = [
'buttons' => $this->buttons
];
$this->buttons = GeneralUtility::callUserFunction($funcRef, $params, $this);
}
return $this->buttons;
}
......
......@@ -455,16 +455,11 @@ function jumpToUrl(URL) {
public function startPage($title)
{
// hook pre start page
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
$preStartPageHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
if (is_array($preStartPageHook)) {
$hookParameters = [
'title' => &$title
];
foreach ($preStartPageHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'] ?? [] as $hookFunction) {
$hookParameters = [
'title' => &$title
];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
// alternative template for Header and Footer
if ($this->pageHeaderFooterTemplateFile) {
......@@ -508,16 +503,11 @@ function jumpToUrl(URL) {
$this->pageRenderer->addJsFile('EXT:core/Resources/Public/JavaScript/Contrib/bootstrap/bootstrap.js');
// hook for additional headerData
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
$preHeaderRenderHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'];
if (is_array($preHeaderRenderHook)) {
$hookParameters = [
'pageRenderer' => &$this->pageRenderer
];
foreach ($preHeaderRenderHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'] ?? [] as $hookFunction) {
$hookParameters = [
'pageRenderer' => &$this->pageRenderer
];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
// Construct page header.
$str = $this->pageRenderer->render(PageRenderer::PART_HEADER);
......@@ -796,7 +786,7 @@ function jumpToUrl(URL) {
}
}
// Hook for adding more markers/content to the page, like the version selector
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'] ?? [] as $funcRef) {
$params = [
'moduleTemplateFilename' => &$this->moduleTemplateFilename,
'moduleTemplate' => &$this->moduleTemplate,
......@@ -804,9 +794,7 @@ function jumpToUrl(URL) {
'markers' => &$markerArray,
'parentObject' => &$this
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'] as $funcRef) {
GeneralUtility::callUserFunction($funcRef, $params, $this);
}
GeneralUtility::callUserFunction($funcRef, $params, $this);
}
// Replacing all markers with the finished markers and return the HTML content
return $this->templateService->substituteMarkerArray($moduleBody, $markerArray, '###|###');
......@@ -859,15 +847,13 @@ function jumpToUrl(URL) {
$markers['BUTTONLIST_' . strtoupper($key)] = str_replace(LF, '', $buttonTemplate);
}
// Hook for manipulating docHeaderButtons
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] ?? [] as $funcRef) {
$params = [
'buttons' => $buttons,
'markers' => &$markers,
'pObj' => &$this
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] as $funcRef) {
GeneralUtility::callUserFunction($funcRef, $params, $this);
}
GeneralUtility::callUserFunction($funcRef, $params, $this);
}
return $markers;
}
......
......@@ -336,13 +336,13 @@ class Commands
}
// Call stats information hook
$stat = '';
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
$_params = ['pages', $record['uid']];
$fakeThis = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
$stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
}
$_params = ['pages', $record['uid']];
$fakeThis = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] ?? [] as $_funcRef) {
$stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
}
$prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');
$subNode->setEditableText($text);
$subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat);
......
......@@ -69,22 +69,17 @@ class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider
*/
public function __construct($nodeLimit = null)
{
if ($nodeLimit === null) {
$nodeLimit = $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit'];
}
$nodeLimit = $nodeLimit ?? $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit'];
$this->nodeLimit = abs((int)$nodeLimit);
$this->showRootlineAboveMounts = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPathAboveMounts');
$this->hiddenRecords = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages'));
$hookElements = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'];
if (is_array($hookElements)) {
foreach ($hookElements as $className) {
/** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */
$hookObject = GeneralUtility::makeInstance($className);
if ($hookObject instanceof \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface) {
$this->processCollectionHookObjects[] = $hookObject;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'] ?? [] as $className) {
/** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */
$hookObject = GeneralUtility::makeInstance($className);
if ($hookObject instanceof \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface) {
$this->processCollectionHookObjects[] = $hookObject;
}
}
}
......
......@@ -1877,13 +1877,11 @@ class BackendUtility
/*****************
*HOOK: pre-processing the human readable output from a record
****************/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'])) {
// Create NULL-reference
$null = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] as $_funcRef) {
GeneralUtility::callUserFunction($_funcRef, $theColConf, $null);
}
$null = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] ?? [] as $_funcRef) {
GeneralUtility::callUserFunction($_funcRef, $theColConf, $null);
}
$l = '';
$lang = static::getLanguageService();
switch ((string)$theColConf['type']) {
......@@ -2230,16 +2228,13 @@ class BackendUtility
/*****************
*HOOK: post-processing the human readable output from a record
****************/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'])) {
// Create NULL-reference
$null = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'] as $_funcRef) {
$params = [
'value' => $l,
'colConf' => $theColConf
];
$l = GeneralUtility::callUserFunction($_funcRef, $params, $null);
}
$null = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'] ?? [] as $_funcRef) {
$params = [
'value' => $l,
'colConf' => $theColConf
];
$l = GeneralUtility::callUserFunction($_funcRef, $params, $null);
}
if ($fixed_lgd_chars) {
return GeneralUtility::fixed_lgd_cs($l, $fixed_lgd_chars);
......@@ -2536,23 +2531,18 @@ class BackendUtility
$viewScript = $alternativeUrl;
}
if (
isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'])
&& is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'])
) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'] as $className) {