68 if (static::$cacheManager === NULL) {
71 return static::$cacheManager;
104 static public function isLoaded($key, $exitOnError = FALSE) {
105 $isLoaded = static::$packageManager->isPackageActive($key);
106 if ($exitOnError && !$isLoaded) {
107 throw new \BadFunctionCallException(
'TYPO3 Fatal Error: Extension "' . $key .
'" is not loaded!', 1270853910);
120 static public function extPath($key, $script =
'') {
121 if (!static::$packageManager->isPackageActive($key)) {
122 throw new \BadFunctionCallException(
'TYPO3 Fatal Error: Extension key "' . $key .
'" is NOT loaded!', 1365429656);
124 return static::$packageManager->getPackage($key)->getPackagePath() . $script;
138 if (!static::$packageManager->isPackageActive($key)) {
139 throw new \BadFunctionCallException(
'TYPO3 Fatal Error: Extension key "' . $key .
'" is NOT loaded!', 1365429673);
141 $relativePathToSiteRoot = self::siteRelPath($key);
142 if (substr($relativePathToSiteRoot, 0, $typo3MainDirLength = strlen(TYPO3_mainDir)) === TYPO3_mainDir) {
143 $relativePathToSiteRoot = substr($relativePathToSiteRoot, $typo3MainDirLength);
145 $relativePathToSiteRoot =
'../' . $relativePathToSiteRoot;
147 return $relativePathToSiteRoot;
159 return \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(self::extPath($key));
169 static public function getCN($key) {
170 return strpos($key,
'user_') === 0 ?
'user_' . str_replace(
'_',
'', substr($key, 5)) :
'tx_' . str_replace(
'_',
'', $key);
182 if (!isset(self::$extensionKeyMap)) {
183 self::$extensionKeyMap = array();
184 foreach (static::$packageManager->getActivePackages() as $package) {
185 $shortKey = str_replace(
'_',
'', $package->getPackageKey());
186 self::$extensionKeyMap[$shortKey] = $package->getPackageKey();
190 $parts = explode(
'_', $prefix);
191 if (isset(self::$extensionKeyMap[$parts[1]])) {
192 $result = self::$extensionKeyMap[$parts[1]];
203 self::$extensionKeyMap = NULL;
217 if (!is_string($key) || empty($key)) {
218 throw new \InvalidArgumentException(
'Extension key must be a non-empty string.', 1294586096);
220 if (!static::isLoaded($key)) {
223 $version = static::$packageManager->getPackage($key)->getPackageMetaData()->getVersion();
224 if (empty($version)) {
225 throw new \TYPO3\CMS\Core\Package\Exception(
'Version number in composer manifest of package "' . $key .
'" is missing or invalid', 1395614959);
248 static public function addTCAcolumns($table, $columnArray, $addTofeInterface = FALSE) {
249 if (is_array($columnArray) && is_array(
$GLOBALS[
'TCA'][$table]) && is_array(
$GLOBALS[
'TCA'][$table][
'columns'])) {
251 $GLOBALS[
'TCA'][$table][
'columns'] = array_merge(
$GLOBALS[
'TCA'][$table][
'columns'], $columnArray);
252 if ($addTofeInterface) {
254 'Usage of feInterface is no longer part of the TYPO3 CMS Core. Please check EXT:' .
$GLOBALS[
'_EXTKEY'] .
'.' 274 static public function addToAllTCAtypes($table, $newFieldsString, $typeList =
'', $position =
'') {
275 $newFieldsString = trim($newFieldsString);
276 if ($newFieldsString ===
'' || !is_array(
$GLOBALS[
'TCA'][$table][
'types'])) {
280 $palettesChanged = array();
282 foreach (
$GLOBALS[
'TCA'][$table][
'types'] as $type => &$typeDetails) {
288 if (!isset($typeDetails[
'showitem'])) {
293 if (in_array($newFieldsString, $fieldArray, TRUE)) {
297 $fieldExists = FALSE;
299 if (is_array(
$GLOBALS[
'TCA'][$table][
'palettes'])) {
301 $paletteCount = preg_match_all(
'/(?:^|,) # Line start or a comma 303 \\s*\\-\\-palette\\-\\-;[^;]*;([^,$]*)| # --palette--;label;paletteName 304 \\s*\\b[^;,]+\\b(?:;[^;]*;([^;,]+);?[^;,]*;?)?[^,]* # field;label;paletteName[;options[;colors]] 305 )/x', $typeDetails[
'showitem'], $paletteMatches);
306 if ($paletteCount > 0) {
307 $paletteNames = array_filter(array_merge($paletteMatches[1], $paletteMatches[2]));
308 if (!empty($paletteNames)) {
309 foreach ($paletteNames as $paletteName) {
310 $palette =
$GLOBALS[
'TCA'][$table][
'palettes'][$paletteName];
311 switch ($positionIdentifier) {
314 if (preg_match(
'/\\b' . $entityName .
'\\b/', $palette[
'showitem']) > 0) {
315 $newPosition = $positionIdentifier .
':--palette--;;' . $paletteName;
320 if (isset($palettesChanged[$paletteName])) {
324 if (preg_match(
'/\\b' . $entityName .
'\\b/', $palette[
'showitem']) > 0) {
325 self::addFieldsToPalette($table, $paletteName, $newFieldsString, $position);
327 $palettesChanged[$paletteName] = TRUE;
339 if ($fieldExists === FALSE) {
340 $typeDetails[
'showitem'] = self::executePositionedStringInsertion(
341 $typeDetails[
'showitem'],
343 $newPosition !==
'' ? $newPosition : $position
362 $generatedPalette =
'';
363 $processedPalettes = array();
364 if (isset(
$GLOBALS[
'TCA'][$table][
'columns'][$field])) {
365 $types = &
$GLOBALS[
'TCA'][$table][
'types'];
366 if (is_array($types)) {
368 foreach ($types as $type => $_) {
369 $items = self::explodeItemList($types[$type][
'showitem']);
370 if (isset($items[$field])) {
372 if ($items[$field][
'details'][
'palette']) {
373 $palette = $items[$field][
'details'][
'palette'];
374 if (!isset($processedPalettes[$palette])) {
375 self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
376 $processedPalettes[$palette] = TRUE;
379 if ($generatedPalette) {
380 $palette = $generatedPalette;
382 $palette = ($generatedPalette =
'generatedFor-' . $field);
383 self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
385 $items[$field][
'details'][
'palette'] = $palette;
386 $types[$type][
'showitem'] = self::generateItemList($items);
405 if (isset(
$GLOBALS[
'TCA'][$table])) {
406 $paletteData = &
$GLOBALS[
'TCA'][$table][
'palettes'][$palette];
408 if (is_array($paletteData)) {
409 $paletteData[
'showitem'] = self::executePositionedStringInsertion($paletteData[
'showitem'], $addFields, $insertionPosition);
411 $paletteData[
'showitem'] = self::removeDuplicatesForInsertion($addFields);
444 static public function addTcaSelectItem($table, $field, array $item, $relativeToField =
'', $relativePosition =
'') {
445 if (!is_string($table)) {
446 throw new \InvalidArgumentException(
'Given table is of type "' . gettype($table) .
'" but a string is expected.', 1303236963);
448 if (!is_string($field)) {
449 throw new \InvalidArgumentException(
'Given field is of type "' . gettype($field) .
'" but a string is expected.', 1303236964);
451 if (!is_string($relativeToField)) {
452 throw new \InvalidArgumentException(
'Given relative field is of type "' . gettype($relativeToField) .
'" but a string is expected.', 1303236965);
454 if (!is_string($relativePosition)) {
455 throw new \InvalidArgumentException(
'Given relative position is of type "' . gettype($relativePosition) .
'" but a string is expected.', 1303236966);
457 if ($relativePosition !==
'' && $relativePosition !==
'before' && $relativePosition !==
'after' && $relativePosition !==
'replace') {
458 throw new \InvalidArgumentException(
'Relative position must be either empty or one of "before", "after", "replace".', 1303236967);
460 if (!is_array(
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'])) {
461 throw new \RuntimeException(
'Given select field item list was not found.', 1303237468);
464 $GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'] = array_values(
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items']);
465 if (strlen($relativePosition) > 0) {
468 if (count($matchedPosition) > 0) {
469 $relativeItemKey = key($matchedPosition);
470 if ($relativePosition ===
'replace') {
471 $GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'][$relativeItemKey] = $item;
473 if ($relativePosition ===
'before') {
474 $offset = $relativeItemKey;
476 $offset = $relativeItemKey + 1;
478 array_splice(
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'], $offset, 0, array(0 => $item));
482 $GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'][] = $item;
486 $GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'][] = $item;
500 static public function getFileFieldTCAConfig($fieldName, array $customSettingOverride = array(), $allowedFileExtensions =
'', $disallowedFileExtensions =
'') {
501 $fileFieldTCAConfig = array(
503 'foreign_table' =>
'sys_file_reference',
504 'foreign_field' =>
'uid_foreign',
505 'foreign_sortby' =>
'sorting_foreign',
506 'foreign_table_field' =>
'tablenames',
507 'foreign_match_fields' => array(
508 'fieldname' => $fieldName
510 'foreign_label' =>
'uid_local',
511 'foreign_selector' =>
'uid_local',
512 'foreign_selector_fieldTcaOverride' => array(
514 'appearance' => array(
515 'elementBrowserType' =>
'file',
516 'elementBrowserAllowed' => $allowedFileExtensions
522 'userFunc' =>
'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
523 'parameters' => array(
524 'allowedFileExtensions' => $allowedFileExtensions,
525 'disallowedFileExtensions' => $disallowedFileExtensions
529 'appearance' => array(
530 'useSortable' => TRUE,
531 'headerThumbnail' => array(
532 'field' =>
'uid_local',
536 'showPossibleLocalizationRecords' => FALSE,
537 'showRemovedLocalizationRecords' => FALSE,
538 'showSynchronizationLink' => FALSE,
539 'showAllLocalizationLink' => FALSE,
541 'enabledControls' => array(
551 'behaviour' => array(
552 'localizationMode' =>
'select',
553 'localizeChildrenAtParentLocalization' => TRUE,
557 return $fileFieldTCAConfig;
570 $GLOBALS[
'TYPO3_USER_SETTINGS'][
'showitem'] = self::executePositionedStringInsertion(
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'showitem'], $addFields, $insertionPosition);
591 $list = $newList = trim($list,
", \t\n\r\0\x0B");
595 if ($location !==
'replace') {
596 $insertionList = self::removeDuplicatesForInsertion($insertionList, $list);
599 if ($insertionList ===
'') {
603 return $insertionList;
605 if ($insertionPosition ===
'') {
606 return $list .
', ' . $insertionList;
612 if (strpos($positionName,
';;') !== FALSE) {
613 $positionName = str_replace(
';;',
';[^;]*;', $positionName);
616 $pattern = (
'/(^|,\\s*)(' . $positionName .
')(;[^,$]+)?(,|$)/');
619 $newList = preg_replace($pattern,
'$1$2$3, ' . $insertionList .
'$4', $list);
622 $newList = preg_replace($pattern,
'$1' . $insertionList .
', $2$3$4', $list);
625 $newList = preg_replace($pattern,
'$1' . $insertionList .
'$4', $list);
631 if ($list === $newList) {
632 return $list .
', ' . $insertionList;
653 $insertionListParts = preg_split(
'/\\s*,\\s*/', $insertionList);
654 $listMatches = array();
656 preg_match_all(
'/(?:^|,)\\s*\\b([^;,]+)\\b[^,]*/', $list, $listMatches);
657 $listMatches = $listMatches[1];
660 $cleanInsertionListParts = array();
661 foreach ($insertionListParts as $fieldName) {
662 $fieldNameParts = explode(
';', $fieldName, 2);
663 $cleanFieldName = $fieldNameParts[0];
665 $cleanFieldName ===
'--linebreak--' 667 !in_array($cleanFieldName, $cleanInsertionListParts, TRUE)
668 && !in_array($cleanFieldName, $listMatches, TRUE)
671 $cleanInsertionListParts[] = $fieldName;
674 return implode(
', ', $cleanInsertionListParts);
687 if (strpos($item,
'--') !== FALSE) {
689 $item = str_replace(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
'', $item);
692 'before' => array($item,
'before:' . $item),
693 'after' => array(
'after:' . $item),
694 'replace' => array(
'replace:' . $item)
696 if ($itemDetails[
'palette']) {
697 $palette = $item .
';;' . $itemDetails[
'palette'];
698 $needles[
'before'][] = $palette;
699 $needles[
'before'][] =
'before:' . $palette;
700 $needles[
'after'][] =
'after:' . $palette;
701 $needles[
'replace'][] =
'replace:' . $palette;
715 foreach ($itemParts as $itemPart) {
717 $key = $itemDetails[0];
718 if (strpos($key,
'--') !== FALSE) {
720 $key .= count($items);
722 if (!isset($items[$key])) {
723 $items[$key] = array(
724 'rawData' => $itemPart,
726 'field' => $itemDetails[0],
727 'label' => $itemDetails[1],
728 'palette' => $itemDetails[2],
729 'special' => $itemDetails[3],
730 'styles' => $itemDetails[4]
747 $itemParts = array();
748 foreach ($items as $item => $itemDetails) {
749 if (strpos($item,
'--') !== FALSE) {
751 $item = str_replace(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
'', $item);
754 $itemParts[] = $itemDetails[
'rawData'];
756 $itemParts[] = count($itemDetails[
'details']) > 1 ? implode(
';', $itemDetails[
'details']) : $item;
759 return implode(
', ', $itemParts);
771 $GLOBALS[
'PAGES_TYPES'][
'default'][
'allowedTables'] .=
',' . $table;
786 static public function addExtJSModule($extensionName, $mainModuleName, $subModuleName =
'', $position =
'', array $moduleConfiguration = array()) {
787 if (empty($extensionName)) {
788 throw new \InvalidArgumentException(
'The extension name must not be empty', 1325938973);
791 $extensionName = str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $extensionName)));
792 $defaultModuleConfiguration = array(
794 'icon' =>
'gfx/typo3.png',
796 'extRelPath' => self::extRelPath($extensionKey) .
'Classes/' 799 if ($mainModuleName ===
'web') {
800 $defaultModuleConfiguration[
'navigationComponentId'] =
'typo3-pagetree';
803 $moduleConfiguration = $defaultModuleConfiguration;
804 if (strlen($subModuleName) > 0) {
805 $moduleSignature = $mainModuleName .
'_' . $subModuleName;
807 $moduleSignature = $mainModuleName;
809 $moduleConfiguration[
'name'] = $moduleSignature;
810 $moduleConfiguration[
'script'] =
'extjspaneldummy.html';
811 $moduleConfiguration[
'extensionName'] = $extensionName;
812 $moduleConfiguration[
'configureModuleFunction'] = array(
'TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility',
'configureModule');
813 $GLOBALS[
'TBE_MODULES'][
'_configuration'][$moduleSignature] = $moduleConfiguration;
814 self::addModule($mainModuleName, $subModuleName, $position);
830 $moduleConfiguration =
$GLOBALS[
'TBE_MODULES'][
'_configuration'][$moduleSignature];
831 $iconPathAndFilename = $moduleConfiguration[
'icon'];
832 if (substr($iconPathAndFilename, 0, 4) ===
'EXT:') {
833 list($extensionKey, $relativePath) = explode(
'/', substr($iconPathAndFilename, 4), 2);
834 $iconPathAndFilename = self::extPath($extensionKey) . $relativePath;
837 $moduleLabels = array(
838 'tabs_images' => array(
839 'tab' => $iconPathAndFilename
842 'tablabel' =>
$GLOBALS[
'LANG']->sL($moduleConfiguration[
'labels'] .
':mlang_labels_tablabel'),
843 'tabdescr' =>
$GLOBALS[
'LANG']->sL($moduleConfiguration[
'labels'] .
':mlang_labels_tabdescr')
846 'tab' =>
$GLOBALS[
'LANG']->sL($moduleConfiguration[
'labels'] .
':mlang_tabs_tab')
849 $GLOBALS[
'LANG']->addModuleLabels($moduleLabels, $moduleSignature .
'_');
850 return $moduleConfiguration;
864 static public function addModule($main, $sub =
'', $position =
'', $path =
'', $moduleConfiguration = array()) {
867 if (isset(
$GLOBALS[
'TBE_MODULES'][$main]) && $sub) {
869 $modules =
',' .
$GLOBALS[
'TBE_MODULES'][$main] .
',';
873 $modRef =
',' . $modRef .
',';
875 switch (strtolower($place)) {
877 $modules = str_replace($modRef, $modRef . $sub .
',', $modules);
880 $modules = str_replace($modRef,
',' . $sub . $modRef, $modules);
883 $modules = $sub . $modules;
887 $modules = $modules . $sub;
891 $GLOBALS[
'TBE_MODULES'][$main] = trim($modules,
',');
894 $GLOBALS[
'TBE_MODULES'][$main] = $sub;
896 $fullModuleSignature = $main . ($sub ?
'_' . $sub :
'');
899 if (substr($path, 0, 4) ===
'EXT:') {
900 list($extensionKey, $relativePath) = explode(
'/', substr($path, 4), 2);
901 $path = self::extPath($extensionKey) . $relativePath;
904 $GLOBALS[
'TBE_MODULES'][
'_PATHS'][$fullModuleSignature] = $path;
908 if (is_array($moduleConfiguration) && count($moduleConfiguration) > 0) {
909 $GLOBALS[
'TBE_MODULES'][
'_configuration'][$fullModuleSignature] = $moduleConfiguration;
923 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ExtDirect'][$endpointName] = array(
924 'callbackClass' => $callbackClass,
926 'accessLevel' => $accessLevel
938 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'AJAX'][$ajaxId] = array(
939 'callbackMethod' => $callbackMethod,
956 if (substr($path, 0, 4) ===
'EXT:') {
957 list($extensionKey, $relativePath) = explode(
'/', substr($path, 4), 2);
960 $GLOBALS[
'TBE_MODULES'][
'_PATHS'][$name] = $path;
978 static public function insertModuleFunction($modname, $className, $classPath, $title, $MM_key =
'function', $WS =
'') {
979 if (!empty($classPath)) {
981 sprintf(
'insertModuleFunction(%s, %s, ...): Use auto-loading for the class and pass NULL as $classPath since 6.2.',
987 $GLOBALS[
'TBE_MODULES_EXT'][$modname][
'MOD_MENU'][$MM_key][$className] = array(
988 'name' => $className,
989 'path' => $classPath,
1008 $GLOBALS[
'TYPO3_CONF_VARS_extensionAdded'][$group][$key] .= $content;
1009 $GLOBALS[
'TYPO3_CONF_VARS'][$group][$key] .= $content;
1021 self::appendToTypoConfVars(
'BE',
'defaultPageTSconfig',
' 1035 self::appendToTypoConfVars(
'BE',
'defaultUserTSconfig',
' 1050 if ($tca_descr_key) {
1051 if (!is_array(
$GLOBALS[
'TCA_DESCR'][$tca_descr_key])) {
1052 $GLOBALS[
'TCA_DESCR'][$tca_descr_key] = array();
1054 if (!is_array(
$GLOBALS[
'TCA_DESCR'][$tca_descr_key][
'refs'])) {
1055 $GLOBALS[
'TCA_DESCR'][$tca_descr_key][
'refs'] = array();
1057 $GLOBALS[
'TCA_DESCR'][$tca_descr_key][
'refs'][] = $file_ref;
1071 $extensionKey = $extensionKey ?:
$GLOBALS[
'_EXTKEY'];
1072 if (!isset($extensionKey)) {
1073 throw new \RuntimeException(
'No extensionKey set in addNavigationComponent(). Provide it as third Parameter', 1404068039);
1076 'componentId' => $componentId,
1077 'extKey' => $extensionKey,
1078 'isCoreComponent' => FALSE
1090 self::addNavigationComponent(
$module, $componentId);
1091 $GLOBALS[
'TBE_MODULES'][
'_navigationComponents'][
$module][
'isCoreComponent'] = TRUE;
1108 static public function addService($extKey, $serviceType, $serviceKey, $info) {
1109 if ($serviceType && is_array($info)) {
1110 $info[
'priority'] = max(0, min(100, $info[
'priority']));
1111 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey] = $info;
1112 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'extKey'] = $extKey;
1113 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'serviceKey'] = $serviceKey;
1114 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'serviceType'] = $serviceType;
1118 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'T3_SERVICES'][$serviceType][$serviceKey])) {
1121 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey] = array_merge(
$GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey],
$GLOBALS[
'TYPO3_CONF_VARS'][
'T3_SERVICES'][$serviceType][$serviceKey]);
1125 if (
$GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'available'] &&
$GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'os'] !=
'') {
1127 $os_type = stripos(PHP_OS,
'win') !== FALSE && !stripos(PHP_OS,
'darwin') !== FALSE ?
'WIN' :
'UNIX';
1129 if (!in_array($os_type, $os)) {
1130 self::deactivateService($serviceType, $serviceKey);
1134 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'serviceSubTypes'] = array();
1136 foreach ($serviceSubTypes as $subtype) {
1137 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'serviceSubTypes'][$subtype] = $subtype;
1150 static public function findService($serviceType, $serviceSubType =
'', $excludeServiceKeys = array()) {
1151 $serviceKey = FALSE;
1152 $serviceInfo = FALSE;
1155 if (!is_array($excludeServiceKeys)) {
1158 if (is_array(
$GLOBALS[
'T3_SERVICES'][$serviceType])) {
1159 foreach (
$GLOBALS[
'T3_SERVICES'][$serviceType] as $key => $info) {
1160 if (in_array($key, $excludeServiceKeys)) {
1165 if ($serviceSubType ==
'*') {
1166 $serviceSubType = key($info[
'serviceSubTypes']);
1169 if ($info[
'available'] && ($info[
'subtype'] == $serviceSubType || $info[
'serviceSubTypes'][$serviceSubType]) && $info[
'priority'] >= $priority) {
1171 if ($info[
'priority'] == $priority && $info[
'quality'] < $quality) {
1175 $info[
'available'] = self::isServiceAvailable($serviceType, $key, $info);
1177 if ($info[
'available']) {
1179 $priority = $info[
'priority'];
1180 $quality = $info[
'quality'];
1186 $serviceInfo =
$GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey];
1188 return $serviceInfo;
1200 if (is_array(
$GLOBALS[
'T3_SERVICES'])) {
1203 foreach (
$GLOBALS[
'T3_SERVICES'] as $serviceType => $servicesPerType) {
1204 if (isset($servicesPerType[$serviceKey])) {
1205 $serviceDetails = $servicesPerType[$serviceKey];
1207 if (self::isServiceAvailable($serviceType, $serviceKey, $serviceDetails)) {
1209 return $serviceDetails;
1214 throw new \TYPO3\CMS\Core\Exception(
'Service not found for key: ' . $serviceKey, 1319217244);
1227 if (trim($serviceDetails[
'exec'])) {
1229 foreach ($executables as $executable) {
1232 self::deactivateService($serviceType, $serviceKey);
1250 $GLOBALS[
'T3_SERVICES'][$serviceType][$serviceKey][
'available'] = FALSE;
1272 static public function addPlugin($itemArray, $type =
'list_type', $extensionKey = NULL) {
1273 $extensionKey = $extensionKey ?:
$GLOBALS[
'_EXTKEY'];
1274 if (!isset($extensionKey)) {
1275 throw new \RuntimeException(
1276 'No extension key could be determined when calling addPlugin()!' 1278 .
'This method is meant to be called from an ext_tables.php or Configuration/TCA/Overrides file. ' 1279 .
'If you call it from Configuration/TCA/Overrides, the extension key needs to be specified as third parameter. ' 1280 .
'Calling it from any other place e.g. ext_localconf.php does not work and is not supported.',
1284 if ($extensionKey && !$itemArray[2] && isset(
$GLOBALS[
'TYPO3_LOADED_EXT'][$extensionKey][
'ext_icon'])) {
1285 $itemArray[2] = self::extRelPath($extensionKey) .
$GLOBALS[
'TYPO3_LOADED_EXT'][$extensionKey][
'ext_icon'];
1287 if (is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns']) && is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][$type][
'config'][
'items'])) {
1288 foreach (
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][$type][
'config'][
'items'] as $k => $v) {
1289 if ((
string)$v[1] === (
string)$itemArray[1]) {
1290 $GLOBALS[
'TCA'][
'tt_content'][
'columns'][$type][
'config'][
'items'][$k] = $itemArray;
1294 $GLOBALS[
'TCA'][
'tt_content'][
'columns'][$type][
'config'][
'items'][] = $itemArray;
1309 if (is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns']) && is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][
'pi_flexform'][
'config'][
'ds'])) {
1310 $GLOBALS[
'TCA'][
'tt_content'][
'columns'][
'pi_flexform'][
'config'][
'ds'][$piKeyToMatch .
',' . $CTypeToMatch] = $value;
1324 static public function addToInsertRecords($table, $content_table =
'tt_content', $content_field =
'records') {
1325 if (is_array(
$GLOBALS[
'TCA'][$content_table][
'columns']) && isset(
$GLOBALS[
'TCA'][$content_table][
'columns'][$content_field][
'config'][
'allowed'])) {
1326 $GLOBALS[
'TCA'][$content_table][
'columns'][$content_field][
'config'][
'allowed'] .=
',' . $table;
1358 static public function addPItoST43($key, $classFile =
'', $prefix =
'', $type =
'list_type', $cached = 0) {
1359 $classFile = $classFile ? $classFile :
'pi/class.tx_' . str_replace(
'_',
'', $key) . $prefix .
'.php';
1360 $cN = self::getCN($key);
1363 plugin.' . $cN . $prefix .
' = USER' . ($cached ?
'' :
'_INT') .
' 1364 plugin.' . $cN . $prefix .
' { 1365 includeLibs = ' .
$GLOBALS[
'TYPO3_LOADED_EXT'][$key][
'siteRelPath'] . $classFile .
' 1366 userFunc = ' . $cN . $prefix .
'->main 1368 self::addTypoScript($key,
'setup',
' 1369 # Setting ' . $key .
' plugin TypoScript 1374 $addLine =
'tt_content.list.20.' . $key . $prefix .
' = < plugin.' . $cN . $prefix;
1377 $addLine =
'tt_content.menu.20.' . $key . $prefix .
' = < plugin.' . $cN . $prefix;
1381 tt_content.' . $key . $prefix .
' = COA 1382 tt_content.' . $key . $prefix .
' { 1383 10 = < lib.stdheader 1384 20 = < plugin.' . $cN . $prefix .
' 1388 case 'header_layout':
1389 $addLine =
'lib.stdheader.10.' . $key . $prefix .
' = < plugin.' . $cN . $prefix;
1392 $addLine =
'page.1000 = < plugin.' . $cN . $prefix;
1398 self::addTypoScript($key,
'setup',
' 1399 # Setting ' . $key .
' plugin TypoScript 1401 ',
'defaultContentRendering');
1416 if ($extKey && $path && is_array(
$GLOBALS[
'TCA'][
'sys_template'][
'columns'])) {
1417 $value = str_replace(
',',
'',
'EXT:' . $extKey .
'/' . $path);
1418 $itemArray = array(trim($title .
' (' . $extKey .
')'), $value);
1419 $GLOBALS[
'TCA'][
'sys_template'][
'columns'][
'include_static_file'][
'config'][
'items'][] = $itemArray;
1432 self::appendToTypoConfVars(
'FE',
'defaultTypoScript_setup',
' 1446 self::appendToTypoConfVars(
'FE',
'defaultTypoScript_constants',
' 1469 static public function addTypoScript($key, $type, $content, $afterStaticUid = 0) {
1470 if ($type ===
'setup' || $type ===
'constants') {
1474 ############################################# 1475 ## TypoScript added by extension "' . $key .
'" 1476 ############################################# 1479 if ($afterStaticUid) {
1482 if ($afterStaticUid ===
'defaultContentRendering' || $afterStaticUid == 43) {
1483 $GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'defaultTypoScript_' . $type .
'.'][
'defaultContentRendering'] .= $content;
1485 $GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'defaultTypoScript_' . $type .
'.'][$afterStaticUid] .= $content;
1488 $GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'defaultTypoScript_' . $type] .= $content;
1508 $iconFileTypesToCheckFor = array(
'png',
'gif');
1509 foreach ($iconFileTypesToCheckFor as $fileType) {
1510 if (file_exists($extensionPath .
'ext_icon.' . $fileType)) {
1511 $icon =
'ext_icon.' . $fileType;
1515 return $returnFullPath ? $extensionPath . $icon : $icon;
1530 static public function loadExtLocalconf($allowCaching = TRUE) {
1531 if ($allowCaching) {
1532 $cacheIdentifier = self::getExtLocalconfCacheIdentifier();
1534 $codeCache = self::getCacheManager()->getCache(
'cache_core');
1535 if ($codeCache->has($cacheIdentifier)) {
1536 $codeCache->requireOnce($cacheIdentifier);
1538 self::loadSingleExtLocalconfFiles();
1539 self::createExtLocalconfCacheEntry();
1542 self::loadSingleExtLocalconfFiles();
1557 foreach (
$GLOBALS[
'TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
1558 if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && isset($extensionInformation[
'ext_localconf.php'])) {
1561 $_EXTCONF = isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'extConf'][$_EXTKEY]) ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'extConf'][$_EXTKEY] : NULL;
1562 require $extensionInformation[
'ext_localconf.php'];
1573 $extensionInformation =
$GLOBALS[
'TYPO3_LOADED_EXT'];
1574 $phpCodeToCache = array();
1576 $phpCodeToCache[] =
'';
1579 $phpCodeToCache[] =
'';
1580 $phpCodeToCache[] =
'global $TYPO3_CONF_VARS, $T3_SERVICES, $T3_VAR;';
1581 $phpCodeToCache[] =
'';
1583 foreach ($extensionInformation as $extensionKey => $extensionDetails) {
1584 if (isset($extensionDetails[
'ext_localconf.php']) && $extensionDetails[
'ext_localconf.php']) {
1586 $phpCodeToCache[] =
'';
1590 $phpCodeToCache[] =
'';
1592 $phpCodeToCache[] =
'$_EXTKEY = \'' . $extensionKey .
'\';
'; 1593 $phpCodeToCache[] = '$_EXTCONF =
$GLOBALS[\
'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
1594 $phpCodeToCache[] =
'';
1597 $phpCodeToCache[] =
'';
1598 $phpCodeToCache[] =
'';
1601 $phpCodeToCache = implode(LF, $phpCodeToCache);
1603 $phpCodeToCache = preg_replace(
'/<\\?php|\\?>/is',
'', $phpCodeToCache);
1604 self::getCacheManager()->getCache(
'cache_core')->set(self::getExtLocalconfCacheIdentifier(), $phpCodeToCache);
1613 return 'ext_localconf_' . sha1(TYPO3_version . PATH_site .
'extLocalconf' . serialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'runtimeActivatedPackages']));
1630 static public function loadBaseTca($allowCaching = TRUE) {
1631 if ($allowCaching) {
1632 $cacheIdentifier = static::getBaseTcaCacheIdentifier();
1634 $codeCache = static::getCacheManager()->getCache(
'cache_core');
1635 if ($codeCache->has($cacheIdentifier)) {
1637 $cacheData = unserialize(substr($codeCache->get($cacheIdentifier), 6, -2));
1638 $GLOBALS[
'TCA'] = $cacheData[
'tca'];
1641 static::buildBaseTcaFromSingleFiles();
1642 static::createBaseTcaCacheFile();
1645 static::buildBaseTcaFromSingleFiles();
1660 $activePackages = static::$packageManager->getActivePackages();
1663 foreach ($activePackages as $package) {
1664 $tcaConfigurationDirectory = $package->getPackagePath() .
'Configuration/TCA';
1665 if (is_dir($tcaConfigurationDirectory)) {
1666 $files = scandir($tcaConfigurationDirectory);
1667 foreach ($files as $file) {
1669 is_file($tcaConfigurationDirectory .
'/' . $file)
1672 && (substr($file, -4, 4) ===
'.php')
1674 $tcaOfTable = require($tcaConfigurationDirectory .
'/' . $file);
1675 if (is_array($tcaOfTable)) {
1677 $tcaTableName = substr($file, 0, -4);
1678 $GLOBALS[
'TCA'][$tcaTableName] = $tcaOfTable;
1689 foreach ($activePackages as $package) {
1690 $tcaOverridesPathForPackage = $package->getPackagePath() .
'Configuration/TCA/Overrides';
1691 if (is_dir($tcaOverridesPathForPackage)) {
1692 $files = scandir($tcaOverridesPathForPackage);
1693 foreach ($files as $file) {
1695 is_file($tcaOverridesPathForPackage .
'/' . $file)
1698 && (substr($file, -4, 4) ===
'.php')
1700 require($tcaOverridesPathForPackage .
'/' . $file);
1706 static::emitTcaIsBeingBuiltSignal(
$GLOBALS[
'TCA']);
1720 list($tca) = static::getSignalSlotDispatcher()->dispatch(__CLASS__,
'tcaIsBeingBuilt', array($tca));
1730 static protected function createBaseTcaCacheFile() {
1732 $codeCache = self::getCacheManager()->getCache(
'cache_core');
1733 $codeCache->set(static::getBaseTcaCacheIdentifier(), serialize(array(
'tca' =>
$GLOBALS[
'TCA'],
'categoryRegistry' => \
TYPO3\CMS\Core\Category\CategoryRegistry::getInstance())));
1742 return 'tca_base_' . sha1(TYPO3_version . PATH_site .
'tca_with_category_registry' . serialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'runtimeActivatedPackages']));
1757 static public function loadExtTables($allowCaching = TRUE) {
1758 if ($allowCaching && !self::$extTablesWasReadFromCacheOnce) {
1759 self::$extTablesWasReadFromCacheOnce = TRUE;
1760 $cacheIdentifier = self::getExtTablesCacheIdentifier();
1762 $codeCache = self::getCacheManager()->getCache(
'cache_core');
1763 if ($codeCache->has($cacheIdentifier)) {
1764 $codeCache->requireOnce($cacheIdentifier);
1766 self::loadSingleExtTablesFiles();
1767 self::createExtTablesCacheEntry();
1770 self::loadSingleExtTablesFiles();
1783 global $TBE_MODULES, $TBE_MODULES_EXT,
$TCA;
1784 global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;
1787 foreach (
$GLOBALS[
'TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
1788 if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && $extensionInformation[
'ext_tables.php']) {
1792 require $extensionInformation[
'ext_tables.php'];
1793 static::loadNewTcaColumnsConfigFiles();
1804 $extensionInformation =
$GLOBALS[
'TYPO3_LOADED_EXT'];
1805 $phpCodeToCache = array();
1807 $phpCodeToCache[] =
'';
1810 $phpCodeToCache[] =
'';
1811 $phpCodeToCache[] =
'global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;';
1812 $phpCodeToCache[] =
'global $TBE_MODULES, $TBE_MODULES_EXT, $TCA;';
1813 $phpCodeToCache[] =
'global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;';
1814 $phpCodeToCache[] =
'global $_EXTKEY;';
1815 $phpCodeToCache[] =
'';
1817 foreach ($extensionInformation as $extensionKey => $extensionDetails) {
1818 if (isset($extensionDetails[
'ext_tables.php']) && $extensionDetails[
'ext_tables.php']) {
1820 $phpCodeToCache[] =
'';
1824 $phpCodeToCache[] =
'';
1826 $phpCodeToCache[] =
'$_EXTKEY = \'' . $extensionKey .
'\';
'; 1827 $phpCodeToCache[] = '$_EXTCONF =
$GLOBALS[\
'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
1828 $phpCodeToCache[] =
'';
1831 $phpCodeToCache[] =
'';
1832 $phpCodeToCache[] =
'\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadNewTcaColumnsConfigFiles();';
1833 $phpCodeToCache[] =
'';
1836 $phpCodeToCache = implode(LF, $phpCodeToCache);
1838 $phpCodeToCache = preg_replace(
'/<\\?php|\\?>/is',
'', $phpCodeToCache);
1839 self::getCacheManager()->getCache(
'cache_core')->set(self::getExtTablesCacheIdentifier(), $phpCodeToCache);
1865 foreach ($TCA as $tableName => $_) {
1866 if (!isset($TCA[$tableName][
'columns'])) {
1867 $columnsConfigFile = $TCA[$tableName][
'ctrl'][
'dynamicConfigFile'];
1868 if ($columnsConfigFile) {
1870 include($columnsConfigFile);
1872 throw new \RuntimeException(
1873 'Columns configuration file not found',
1888 return 'ext_tables_' . sha1(TYPO3_version . PATH_site .
'extTables' . serialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'runtimeActivatedPackages']));
1901 ->canWriteConfiguration();
1920 self::getCacheManager()->flushCachesInGroup(
'system');
1929 return array_keys(static::$packageManager->getActivePackages());
1954 if (static::$packageManager->isPackageActive($extensionKey)) {
1955 throw new \RuntimeException(
'Extension already loaded', 1342345486);
1957 static::$packageManager->activatePackage($extensionKey);
1971 if (!static::$packageManager->isPackageActive($extensionKey)) {
1972 throw new \RuntimeException(
'Extension not loaded', 1342345487);
1974 static::$packageManager->deactivatePackage($extensionKey);
2002 static public function makeCategorizable($extensionKey, $tableName, $fieldName =
'categories', array $options = array()) {
2006 $message =
'\TYPO3\CMS\Core\Category\CategoryRegistry: no category registered for table "%s". Key was already registered.';
2010 sprintf($message, $tableName)
static addFieldsToAllPalettesOfField($table, $field, $addFields, $insertionPosition='')
static explodeItemList($itemList)
static registerAjaxHandler($ajaxId, $callbackMethod, $csrfTokenCheck=TRUE)
static addFieldsToUserSettings($addFields, $insertionPosition='')
static checkCommand($cmd, $handler='')
static addTypoScriptSetup($content)
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
static getExtensionIcon($extensionPath, $returnFullPath=FALSE)
static addStaticFile($extKey, $path, $title)
static addPItoST43($key, $classFile='', $prefix='', $type='list_type', $cached=0)
$TYPO3_CONF_VARS['SYS']['contentTable']
static setSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance)
static removeDuplicatesForInsertion($insertionList, $list='')
static getFileFieldTCAConfig($fieldName, array $customSettingOverride=array(), $allowedFileExtensions='', $disallowedFileExtensions='')
static getSignalSlotDispatcher()
static removeCacheFiles()
static getLoadedExtensionListArray()
static getExtTablesCacheIdentifier()
static addService($extKey, $serviceType, $serviceKey, $info)
static addCoreNavigationComponent($module, $componentId)
static addToInsertRecords($table, $content_table='tt_content', $content_field='records')
static extPath($key, $script='')
if(!defined('TYPO3_MODE')) $pluginContent
static clearExtensionKeyMap()
$TCA['tx_irretutorial_1ncsv_hotel']
static setPackageManager(\TYPO3\CMS\Core\Package\PackageManager $packageManager)
static addTypoScript($key, $type, $content, $afterStaticUid=0)
static writeNewExtensionList(array $newExtensionList)
static getBaseTcaCacheIdentifier()
static getExtLocalconfCacheIdentifier()
static createExtLocalconfCacheEntry()
static allowTableOnStandardPages($table)
static addTCAcolumns($table, $columnArray, $addTofeInterface=FALSE)
static logDeprecatedFunction()
static camelCaseToLowerCaseUnderscored($string)
static loadNewTcaColumnsConfigFiles()
static addPlugin($itemArray, $type='list_type', $extensionKey=NULL)
static makeInstance($className)
static findServiceByKey($serviceKey)
static addUserTSConfig($content)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static addPageTSConfig($content)
static addPiFlexFormValue($piKeyToMatch, $value, $CTypeToMatch='list')
static $signalSlotDispatcher
static addModulePath($name, $path)
static insertModuleFunction($modname, $className, $classPath, $title, $MM_key='function', $WS='')
static deprecationLog($msg)
static addNavigationComponent($module, $componentId, $extensionKey=NULL)
static appendToTypoConfVars($group, $key, $content)
static registerExtDirectComponent($endpointName, $callbackClass, $moduleName=NULL, $accessLevel=NULL)
static addToAllTCAtypes($table, $newFieldsString, $typeList='', $position='')
static filterByValueRecursive($needle='', array $haystack=array())
static configureModule($moduleSignature, $modulePath)
static getInsertionNeedles($item, array $itemDetails)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static getExtensionVersion($key)
static addExtJSModule($extensionName, $mainModuleName, $subModuleName='', $position='', array $moduleConfiguration=array())
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
static isServiceAvailable($serviceType, $serviceKey, $serviceDetails)
if(!defined('TYPO3_MODE')) $_EXTCONF
static isLoaded($key, $exitOnError=FALSE)
static generateItemList(array $items, $useRawData=FALSE)
static deactivateService($serviceType, $serviceKey)
static addLLrefForTCAdescr($tca_descr_key, $file_ref)
static addTcaSelectItem($table, $field, array $item, $relativeToField='', $relativePosition='')
static addModule($main, $sub='', $position='', $path='', $moduleConfiguration=array())
static loadSingleExtLocalconfFiles()
static isLocalconfWritable()
static emitTcaIsBeingBuiltSignal(array $tca)
static createExtTablesCacheEntry()
static unloadExtension($extensionKey)
static executePositionedStringInsertion($list, $insertionList, $insertionPosition='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static loadSingleExtTablesFiles()
static inList($list, $item)
static getExtensionKeyByPrefix($prefix)
static getRequiredExtensionListArray()
static findService($serviceType, $serviceSubType='', $excludeServiceKeys=array())
static loadExtension($extensionKey)
static buildBaseTcaFromSingleFiles()
static addFieldsToPalette($table, $palette, $addFields, $insertionPosition='')
static $extTablesWasReadFromCacheOnce
static addTypoScriptConstants($content)