Commit 7a247163 authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] Deprecate GeneralUtility::getUserObj()

This function now does the same as makeInstance() except for an if()
clause, since the API should be unified this method should be considered
as dropped, allowing to use callUserFunction() and makeInstance() as the
only two proper ways to call custom classes / methods.

Resolves: #80993
Releases: master
Change-Id: I0c2042dbe6c83a86f211bab4eaf64d75e6424232
Reviewed-on: https://review.typo3.org/52518

Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent a23d22fb
......@@ -75,8 +75,8 @@ class ModulesController extends ActionController
$securityWarnings = '';
// 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 $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
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);
}
......
......@@ -77,7 +77,7 @@ 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::getUserObj($cacheAction);
$hookObject = GeneralUtility::makeInstance($cacheAction);
if (!$hookObject instanceof ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException($cacheAction . ' must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
}
......
......@@ -212,9 +212,9 @@ 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 $classRef) {
$typeRenderObj = GeneralUtility::getUserObj($classRef);
if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
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;
......
......@@ -225,11 +225,11 @@ class NewContentElementController extends AbstractModule
// 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 $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
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(
$classData . ' must implement interface ' . NewContentElementWizardHookInterface::class,
$className . ' must implement interface ' . NewContentElementWizardHookInterface::class,
1227834741
);
}
......
......@@ -594,10 +594,10 @@ class InlineRecordContainer extends AbstractContainer
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 $classData) {
$processObject = GeneralUtility::getUserObj($classData);
foreach ($tceformsInlineHook as $className) {
$processObject = GeneralUtility::makeInstance($className);
if (!$processObject instanceof InlineElementHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . InlineElementHookInterface::class, 1202072000);
throw new \UnexpectedValueException($className . ' must implement interface ' . InlineElementHookInterface::class, 1202072000);
}
$this->hookObjects[] = $processObject;
}
......
......@@ -131,7 +131,7 @@ class FrontendBackendUserAuthentication extends BackendUserAuthentication
}
$controllerClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController'][$controllerKey];
if ($controllerClass) {
$this->frontendEdit = GeneralUtility::getUserObj($controllerClass);
$this->frontendEdit = GeneralUtility::makeInstance($controllerClass);
}
break;
}
......
......@@ -80,9 +80,9 @@ class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider
$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 $classRef) {
foreach ($hookElements as $className) {
/** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */
$hookObject = GeneralUtility::getUserObj($classRef);
$hookObject = GeneralUtility::makeInstance($className);
if ($hookObject instanceof \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface) {
$this->processCollectionHookObjects[] = $hookObject;
}
......
......@@ -2517,8 +2517,8 @@ class BackendUtility
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 $funcRef) {
$hookObj = GeneralUtility::getUserObj($funcRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'preProcess')) {
$hookObj->preProcess(
$pageUid,
......@@ -3551,12 +3551,9 @@ class BackendUtility
// Now, try to create parser object:
$objRef = null;
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$spKey])) {
$objRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$spKey];
if ($objRef) {
$softRefParserObj = GeneralUtility::getUserObj($objRef);
if (is_object($softRefParserObj)) {
$GLOBALS['T3_VAR']['softRefParser'][$spKey] = $softRefParserObj;
}
$className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$spKey];
if ($className) {
$GLOBALS['T3_VAR']['softRefParser'][$spKey] = GeneralUtility::makeInstance($className);
}
}
}
......
......@@ -1459,10 +1459,10 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
// Call drawFooter hooks
$drawFooterHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'];
if (is_array($drawFooterHooks)) {
foreach ($drawFooterHooks as $hookClass) {
$hookObject = GeneralUtility::getUserObj($hookClass);
foreach ($drawFooterHooks as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
throw new \UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
}
$hookObject->preProcess($this, $info, $row);
}
......@@ -1668,10 +1668,10 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
// Hook: Render an own preview of a record
$drawItemHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
if (is_array($drawItemHooks)) {
foreach ($drawItemHooks as $hookClass) {
$hookObject = GeneralUtility::getUserObj($hookClass);
foreach ($drawItemHooks as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);
throw new \UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);
}
$hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
}
......
......@@ -1452,8 +1452,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication
);
// Hook for manipulation of the WHERE sql sentence which controls which BE-groups are included
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['fetchGroupQuery'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'fetchGroupQuery_processQuery')) {
$constraints = $hookObj->fetchGroupQuery_processQuery($this, $grList, $idList, (string)$constraints);
}
......
......@@ -78,10 +78,10 @@ class FileDumpController
// Hook: allow some other process to do some security/access checks. Hook should issue 403 if access is rejected
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'] as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof FileDumpEIDHookInterface) {
throw new \UnexpectedValueException($classRef . ' must implement interface ' . FileDumpEIDHookInterface::class, 1394442417);
throw new \UnexpectedValueException($className . ' must implement interface ' . FileDumpEIDHookInterface::class, 1394442417);
}
$hookObject->checkFileAccess($file);
}
......
......@@ -869,12 +869,12 @@ class Bootstrap
protected function runExtTablesPostProcessingHooks()
{
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'] as $classReference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'] as $className) {
/** @var $hookObject \TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface */
$hookObject = GeneralUtility::getUserObj($classReference);
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof \TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface) {
throw new \UnexpectedValueException(
'$hookObject "' . $classReference . '" must implement interface TYPO3\\CMS\\Core\\Database\\TableConfigurationPostProcessingHookInterface',
'$hookObject "' . $className . '" must implement interface TYPO3\\CMS\\Core\\Database\\TableConfigurationPostProcessingHookInterface',
1320585902
);
}
......
......@@ -906,10 +906,10 @@ class DataHandler
if (!isset($this->checkModifyAccessListHookObjects)) {
$this->checkModifyAccessListHookObjects = [];
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof DataHandlerCheckModifyAccessListHookInterface) {
throw new \UnexpectedValueException($classData . ' must implement interface ' . DataHandlerCheckModifyAccessListHookInterface::class, 1251892472);
throw new \UnexpectedValueException($className . ' must implement interface ' . DataHandlerCheckModifyAccessListHookInterface::class, 1251892472);
}
$this->checkModifyAccessListHookObjects[] = $hookObject;
}
......@@ -947,8 +947,8 @@ class DataHandler
// First prepare user defined objects (if any) for hooks which extend this function:
$hookObjectsArr = [];
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (method_exists($hookObject, 'processDatamap_beforeStart')) {
$hookObject->processDatamap_beforeStart($this);
}
......@@ -2160,10 +2160,10 @@ class DataHandler
GeneralUtility::upload_copy_move($theFile, $theDestFile);
// Hook for post-processing the upload action
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof DataHandlerProcessUploadHookInterface) {
throw new \UnexpectedValueException($classRef . ' must implement interface ' . DataHandlerProcessUploadHookInterface::class, 1279962349);
throw new \UnexpectedValueException($className . ' must implement interface ' . DataHandlerProcessUploadHookInterface::class, 1279962349);
}
$hookObject->processUpload_postProcessAction($theDestFile, $this);
}
......@@ -2351,8 +2351,8 @@ class DataHandler
$arrValue = GeneralUtility::xml2array($xmlValue);
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkFlexFormValue'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkFlexFormValue'] as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkFlexFormValue'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (method_exists($hookObject, 'checkFlexFormValue_beforeMerge')) {
$hookObject->checkFlexFormValue_beforeMerge($this, $currentValueArray, $arrValue);
}
......@@ -3140,8 +3140,8 @@ class DataHandler
// Hook initialization:
$hookObjectsArr = [];
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'processCmdmap_beforeStart')) {
$hookObj->processCmdmap_beforeStart($this);
}
......@@ -4289,8 +4289,8 @@ class DataHandler
$recordWasMoved = false;
// Move the record via a hook, used e.g. for versioning
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'moveRecord')) {
$hookObj->moveRecord($table, $uid, $destPid, $propArr, $moveRec, $resolvedPid, $recordWasMoved, $this);
}
......@@ -4328,8 +4328,8 @@ class DataHandler
// Prepare user defined objects (if any) for hooks which extend this function:
$hookObjectsArr = [];
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
$hookObjectsArr[] = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $className) {
$hookObjectsArr[] = GeneralUtility::makeInstance($className);
}
}
// Timestamp field:
......@@ -4729,8 +4729,8 @@ class DataHandler
$translateToMsg = @sprintf($TSConfig['translateToMessage'], $langRec['title']);
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processTranslateToClass'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'processTranslateTo_copyAction')) {
$hookObj->processTranslateTo_copyAction($row[$fN], $langRec, $this);
}
......@@ -4950,8 +4950,8 @@ class DataHandler
if (is_array($recordToDelete)) {
$recordWasDeleted = false;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $className) {
$hookObj = GeneralUtility::makeInstance($className);
if (method_exists($hookObj, 'processCmdmap_deleteAction')) {
$hookObj->processCmdmap_deleteAction($table, $id, $recordToDelete, $recordWasDeleted, $this);
}
......
......@@ -113,7 +113,7 @@ class ExtDirectApi
}
if (is_array($configuration)) {
$className = $configuration['callbackClass'];
$serverObject = GeneralUtility::getUserObj($className);
$serverObject = GeneralUtility::makeInstance($className);
$javascriptNamespaces[$javascriptNamespace]['actions'][$javascriptObjectName] = [];
foreach (get_class_methods($serverObject) as $methodName) {
$reflectionMethod = new \ReflectionMethod($serverObject, $methodName);
......
......@@ -136,7 +136,7 @@ class ExtDirectRouter
'access' => $configuration['accessLevel']
], true);
}
$endpointObject = GeneralUtility::getUserObj($callbackClass);
$endpointObject = GeneralUtility::makeInstance($callbackClass);
return call_user_func_array([$endpointObject, $singleRequest->method], is_array($singleRequest->data) ? $singleRequest->data : []);
}
}
......@@ -96,11 +96,9 @@ class FrontendEditingController
if ($GLOBALS['TSFE']->displayEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf, $checkEditAccessInternals) && $this->allowedToEditLanguage($table, $dataArray)) {
$editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
if ($editClass) {
$edit = GeneralUtility::getUserObj($editClass);
if (is_object($edit)) {
$allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
$content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
}
$edit = GeneralUtility::makeInstance($editClass);
$allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
$content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
}
}
return $content;
......@@ -138,10 +136,8 @@ class FrontendEditingController
if ($GLOBALS['TSFE']->displayFieldEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf) && $fieldList && $this->allowedToEditLanguage($table, $dataArray)) {
$editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
if ($editClass) {
$edit = GeneralUtility::getUserObj($editClass);
if (is_object($edit)) {
$content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addUrlParamStr, $table, $editUid, $fieldList);
}
$edit = GeneralUtility::makeInstance($editClass);
$content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addUrlParamStr, $table, $editUid, $fieldList);
}
}
return $content;
......
......@@ -206,8 +206,8 @@ class RteHtmlParser extends HtmlParser
foreach ($modes as $cmd) {
if ($direction === 'db') {
// Checking for user defined transformation:
if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = GeneralUtility::getUserObj($_classRef);
if ($className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = GeneralUtility::makeInstance($className);
$_procObj->pObj = $this;
$_procObj->transformationKey = $cmd;
$value = $_procObj->transform_db($value, $this);
......@@ -236,8 +236,8 @@ class RteHtmlParser extends HtmlParser
}
} elseif ($direction === 'rte') {
// Checking for user defined transformation:
if ($_classRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = GeneralUtility::getUserObj($_classRef);
if ($className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation'][$cmd]) {
$_procObj = GeneralUtility::makeInstance($className);
$_procObj->pObj = $this;
$value = $_procObj->transform_rte($value, $this);
} else {
......@@ -548,8 +548,8 @@ class RteHtmlParser extends HtmlParser
'url' => $linkInformation['href'],
'attributes' => $tagAttributes
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksDb_PostProc'] as $objRef) {
$processor = GeneralUtility::getUserObj($objRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksDb_PostProc'] as $className) {
$processor = GeneralUtility::makeInstance($className);
$blockSplit[$k] = $processor->modifyParamsLinksDb($parameters, $this);
}
} else {
......@@ -613,8 +613,8 @@ class RteHtmlParser extends HtmlParser
'external' => $linkInformation['type'] === LinkService::TYPE_URL,
'error' => $error
];
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksRte_PostProc'] as $objRef) {
$processor = GeneralUtility::getUserObj($objRef);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksRte_PostProc'] as $className) {
$processor = GeneralUtility::makeInstance($className);
$blockSplit[$k] = $processor->modifyParamsLinksRte($parameters, $this);
}
} else {
......
......@@ -328,8 +328,8 @@ class IconFactory
// Hook to define an alternative iconName
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['overrideIconOverlay'])) {
$hookObjects = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['overrideIconOverlay'];
foreach ($hookObjects as $classRef) {
$hookObject = GeneralUtility::getUserObj($classRef);
foreach ($hookObjects as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (method_exists($hookObject, 'postOverlayPriorityLookup')) {
$iconName = $hookObject->postOverlayPriorityLookup($table, $row, $status, $iconName);
}
......
......@@ -268,10 +268,10 @@ class ExtendedFileUtility extends BasicFileUtility
}
// Hook for post-processing the action
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);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_extfilefunc.php']['processData'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof ExtendedFileUtilityProcessDataHookInterface) {
throw new \UnexpectedValueException($classRef . ' must implement interface ' . ExtendedFileUtilityProcessDataHookInterface::class, 1279719168);
throw new \UnexpectedValueException($className . ' must implement interface ' . ExtendedFileUtilityProcessDataHookInterface::class, 1279719168);
}
$hookObject->processData_postProcessAction($action, $cmdArr, $result[$action], $this);
}
......
......@@ -3369,7 +3369,7 @@ class GeneralUtility
* @param string $_ Not used anymore since 6.0
* @param int $errorMode Error mode (when class/function could not be found): 0 - call debug(), 1 - do nothing, 2 - raise an exception (allows to call a user function that may return FALSE)
* @return mixed Content from method/function call or FALSE if the class/method/function was not found
* @see getUserObj()
* @see makeInstance()
*/
public static function callUserFunction($funcName, &$params, &$ref, $_ = '', $errorMode = 0)
{
......@@ -3432,9 +3432,11 @@ class GeneralUtility
* @param string $className Class name
* @return object The instance of the class asked for. Instance is created with GeneralUtility::makeInstance
* @see callUserFunction()
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10, use makeInstance instead.
*/
public static function getUserObj($className)
{
self::logDeprecatedFunction();
// Check if class exists:
if (class_exists($className)) {
return self::makeInstance($className);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment