‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Utility\GeneralUtility Class Reference

Static Public Member Functions

static string fixed_lgd_cs (string $string, int $chars, string $appendString='...')
 
static bool cmpIP (string $baseIP, string $list)
 
static bool cmpIPv4 (string $baseIP, string $list)
 
static bool cmpIPv6 (string $baseIP, string $list)
 
static string normalizeIPv6 (string $address)
 
static bool validIP (string $ip)
 
static bool validIPv4 (string $ip)
 
static bool validIPv6 (string $ip)
 
static bool cmpFQDN (string $baseHost, string $list)
 
static bool isOnCurrentHost (string $url)
 
static bool inList ($list, $item)
 
static string expandList ($list)
 
static int md5int ($str)
 
static string hmac ($input, $additionalSecret='')
 
static array< int, splitCalc( $string, $operators){ $res=[];$sign='+';while( $string) { $valueLen=strcspn( $string, $operators);$value=substr( $string, 0, $valueLen);$res[]=[ $sign, trim( $value)];$sign=substr( $string, $valueLen, 1);$string=substr( $string, $valueLen+1);} reset( $res);return $res;} public static bool function validEmail(string $email):bool { if(trim( $email) !==$email) { return false;} if(!str_contains( $email, '@')) { return false;} $validators=[];foreach( $GLOBALS[ 'TYPO3_CONF_VARS'][ 'MAIL'][ 'validators'] ??[RFCValidation::class] as $className) { $validator=new $className();if( $validator instanceof EmailValidation) { $validators[]=$validator;} } $emailValidator=new EmailValidator();$isValid=$emailValidator-> isValid ($email, new MultipleValidationWithAnd($validators, MultipleValidationWithAnd::STOP_ON_ERROR))
 
static string underscoredToUpperCamelCase ($string)
 
static string underscoredToLowerCamelCase ($string)
 
static string camelCaseToLowerCaseUnderscored ($string)
 
static bool isValidUrl (string $url)
 
static list< int > intExplode (string $delimiter, string $string, bool $removeEmptyValues=false)
 
static list< string > revExplode (string $delimiter, string $string, int $limit=0)
 
static list< string > trimExplode (string $delim, string $string, bool $removeEmptyValues=false, int $limit=0)
 
static string implodeArrayForUrl (string $name, array $theArray, string $str='', bool $skipBlank=false, bool $rawurlencodeParamName=false)
 
static array string xml2array (string $string, string $NSprefix='', bool $reportDocTag=false)
 
static array string xml2arrayProcess (string $string, string $NSprefix='', bool $reportDocTag=false)
 
static string xmlRecompileFromStructValArray (array $vals)
 
static string false getUrl (string $url)
 
static bool writeFile (string $file, string $content, bool $changePermissions=false)
 
static bool fixPermissions (string $path, bool $recursive=false)
 
static string null writeFileToTypo3tempDir (string $filepath, string $content)
 
static bool mkdir (string $newFolder)
 
static mkdir_deep (string $directory)
 
static bool rmdir (string $path, bool $removeNonEmpty=false)
 
static string[] string null get_dirs (string $path)
 

Public Attributes

static if(empty($labels)) if(isset($defaultFormats[$labels])) else
 
if($base !==1000 && $base !==1024) $labelArr = explode('|', str_replace('"', '', $labels))
 
 $currentLocale = setlocale(LC_MONETARY, '0')
 
 $oldLocale = setlocale(LC_NUMERIC, '0')
 
 $localeInfo = localeconv()
 
 $sizeInBytes = max($sizeInBytes, 0)
 
 $multiplier = floor(($sizeInBytes ? log($sizeInBytes) : 0) / log($base))
 
 $sizeInUnits = $sizeInBytes / $base ** $multiplier
 
if($sizeInUnits >($base *.9)) $multiplier = min($multiplier, count($labelArr) - 1)
 
if($isValid) return $isValid
 
 $nl = $spaceInd >= 0 ? LF : ''
 
 $output = ''
 
foreach($array as $k=> $v) if(! $level) return $output
 

Static Public Attributes

static array< array-key, function explodeUrl2Array(string $string):array { $output=[];$p=explode('&', $string);foreach( $p as $v) { if( $v !=='') { $nameAndValue=explode('=', $v, 2);$output[rawurldecode( $nameAndValue[0])]=isset( $nameAndValue[1]) ? rawurldecode( $nameAndValue[1]) :'';} } return $output;} public static array function removeDotsFromTS(array $ts):array { $out=[];foreach( $ts as $key=> $value) { if(is_array( $value)) { $key=rtrim( $key, '.');$out[ $key]=self::removeDotsFromTS( $value);} else { $out[ $key]=$value;} } return $out;} public static array< string, function get_tag_attributes(string $tag, bool $decodeEntities=false):array { $components=self::split_tag_attributes( $tag);$name='';$valuemode=false;$attributes=[];foreach( $components as $key=> $val) { if( $val !=='=') { if( $valuemode) { if( $name) { $attributes[ $name]=$decodeEntities ? htmlspecialchars_decode( $val) :$val;$name='';} } else { if( $key=strtolower(preg_replace('/[^[:alnum:]_\\:\\-]/', '', $val) ?? '')) { $attributes[ $key]='';$name=$key;} } $valuemode=false;} else { $valuemode=true;} } return $attributes;} public static string[] function split_tag_attributes(string $tag):array { $tag_tmp=trim(preg_replace('/^<[^[:space:]] */', '', trim( $tag)) ?? '');$tag_tmp=trim(rtrim( $tag_tmp, '>'));$value=[];while( $tag_tmp !=='') { $firstChar=$tag_tmp[0];if( $firstChar==='"' || $firstChar === '\'') { $reg = explode($firstChar, $tag_tmp, 3); $value[] = $reg[1]; $tag_tmp = trim($reg[2] ?? ''); } elseif ($firstChar === '=') { $value[] = '='; $tag_tmp = trim(substr($tag_tmp, 1)); } else { $reg = preg_split('/[[:space:]=]/', $tag_tmp, 2); $value[] = trim($reg[0]); $tag_tmp = trim(substr($tag_tmp, strlen($reg[0]), 1) . ($reg[1] ?? '')); } } reset($value); return $value; } public static string function implodeAttributes(array $arr, bool $xhtmlSafe = false, bool $keepBlankAttributes = false): string { if ($xhtmlSafe) { $newArr = []; foreach ($arr as $attributeName => $attributeValue) { $attributeName = strtolower($attributeName); if (!isset($newArr[$attributeName])) { $newArr[$attributeName] = htmlspecialchars((string)$attributeValue); } } $arr = $newArr; } $list = []; foreach ($arr as $attributeName => $attributeValue) { if ((string)$attributeValue !== '' || $keepBlankAttributes) { $list[] = $attributeName . '="' . $attributeValue . '"'; } } return implode(' ', $list); } public static string function wrapJS(string $string, array $attributes = []): string { if (trim($string)) { $string = ltrim($string, LF); $match = []; if (preg_match('/^(\\t+)/', $string, $match)) { $string = str_replace($match[1], "\t", $string); } return '<script ' . GeneralUtility::implodeAttributes($attributes, true) . '>' . $string . '</script>'; } return ''; } public static array|string function xml2tree(string $string, int $depth = 999, array $parserOptions = []): array|string { $parser = xml_parser_create(); $vals = []; $index = []; xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); foreach ($parserOptions as $option => $value) { xml_parser_set_option($parser, $option, $value); } xml_parse_into_struct($parser, $string, $vals, $index); if (xml_get_error_code($parser)) { return 'Line ' . xml_get_current_line_number($parser) . ': ' . xml_error_string(xml_get_error_code($parser)); } xml_parser_free($parser); $stack = [[]]; $stacktop = 0; $startPoint = 0; $tagi = []; foreach ($vals as $key => $val) { $type = $val['type']; if ($type === 'open' || $type === 'complete') { $stack[$stacktop++] = $tagi; if ($depth == $stacktop) { $startPoint = $key; } $tagi = ['tag' => $val['tag']]; if (isset($val['attributes'])) { $tagi['attrs'] = $val['attributes']; } if (isset($val['value'])) { $tagi['values'][] = $val['value']; } } if ($type === 'complete' || $type === 'close') { $oldtagi = $tagi; $tagi = $stack[--$stacktop]; $oldtag = $oldtagi['tag']; unset($oldtagi['tag']); if ($depth == $stacktop + 1) { if ($key - $startPoint > 0) { $partArray = array_slice($vals, $startPoint + 1, $key - $startPoint - 1); $oldtagi['XMLvalue'] = self::xmlRecompileFromStructValArray($partArray); } else { $oldtagi['XMLvalue'] = $oldtagi['values'][0]; } } $tagi['ch'][$oldtag][] = $oldtagi; unset($oldtagi); } if ($type === 'cdata') { $tagi['values'][] = $val['value']; } } return $tagi['ch']; } public static string function array2xml(array $array, string $NSprefix = '', int $level = 0, string $docTag = 'phparray', int $spaceInd = 0, array $options = [], array $stackData = []): string { $binaryChars = "\0" . chr(1) . chr(2) . chr(3) . chr(4) . chr(5) . chr(6) . chr(7) . chr(8) . chr(11) . chr(12) . chr(14) . chr(15) . chr(16) . chr(17) . chr(18) . chr(19) . chr(20) . chr(21) . chr(22) . chr(23) . chr(24) . chr(25) . chr(26) . chr(27) . chr(28) . chr(29) . chr(30) . chr(31); $indentChar = $spaceInd ? ' ' : "\t"; $indentN = $spaceInd > $spaceInd: 1
 

Static Protected Member Functions

static string createDirectoryPath (string $fullDirectoryPath)
 

Static Protected Attributes

static ContainerInterface $container = null
 
static array $singletonInstances = []
 
static array $nonSingletonInstances = []
 
static array $finalClassNameCache = []
 
static array $indpEnvCache = []
 

Private Member Functions

 __construct ()
 

Detailed Description

The legendary "t3lib_div" class - Miscellaneous functions for general purpose. Most of the functions do not relate specifically to TYPO3 However a section of functions requires certain TYPO3 features available See comments in the source. You are encouraged to use this library in your own scripts!

USE: All methods in this class are meant to be called statically. So use \TYPO3\CMS\Core\Utility\GeneralUtility::[method-name] to refer to the functions, eg. '\TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds()'

Definition at line 51 of file GeneralUtility.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Utility\GeneralUtility::__construct ( )
finalprivate

Definition at line 82 of file GeneralUtility.php.

Member Function Documentation

◆ camelCaseToLowerCaseUnderscored()

◆ cmpFQDN()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::cmpFQDN ( string  $baseHost,
string  $list 
)
static

Match fully qualified domain name with list of strings with wildcard

Parameters
string$baseHost‪A hostname or an IPv4/IPv6-address (will by reverse-resolved; typically REMOTE_ADDR)
string$list‪A comma-list of domain names to match with. -wildcard allowed but cannot be part of a string, so it must match the full host name (eg. myhost..com => correct, myhost.*domain.com => wrong)
Returns
‪bool TRUE if a domain name mask from $list matches $baseIP

Definition at line 341 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnReturnsFalse(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnReturnsTrue().

◆ cmpIP()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP ( string  $baseIP,
string  $list 
)
static

Match IP number with list of numbers with wildcard Dispatcher method for switching into specialised IPv4 and IPv6 methods.

Parameters
string$baseIP‪Is the current remote IP address for instance, typ. REMOTE_ADDR
string$list‪Is a comma-list of IP-addresses to match with. CIDR-notation should be used. For IPv4 addresses only, the -wildcard is also allowed instead of number, plus leaving out parts in the IP number is accepted as wildcard (eg. 192.168..* equals 192.168). If list is "*" no check is done and the function returns TRUE immediately. An empty list always returns FALSE.
Returns
‪bool TRUE if an IP-mask from $list matches $baseIP

Definition at line 113 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\cmpIPv4(), and TYPO3\CMS\Core\Utility\GeneralUtility\cmpIPv6().

Referenced by TYPO3\CMS\Core\Http\NormalizedParams\determineHttps(), TYPO3\CMS\Core\Http\NormalizedParams\determineIsBehindReverseProxy(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\DefaultFunctionsProvider\getIpFunction(), TYPO3\CMS\Core\Core\Bootstrap\initializeErrorHandling(), TYPO3\CMS\Frontend\Middleware\BackendUserAuthenticator\isAuthenticated(), TYPO3\CMS\Core\RateLimiter\RateLimiterFactory\isIpExcluded(), TYPO3\CMS\Frontend\Controller\ErrorController\isPageUnavailableHandlerConfigured(), TYPO3\CMS\Frontend\Middleware\MaintenanceMode\process(), and TYPO3\CMS\Backend\Middleware\LockedBackendGuard\validateVisitorsIpAgainstIpMaskList().

◆ cmpIPv4()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::cmpIPv4 ( string  $baseIP,
string  $list 
)
static

Match IPv4 number with list of numbers with wildcard

Parameters
string$baseIP‪Is the current remote IP address for instance, typ. REMOTE_ADDR
string$list‪Is a comma-list of IP-addresses to match with. CIDR-notation, -wildcard allowed instead of number, plus leaving out parts in the IP number is accepted as wildcard (eg. 192.168.0.0/16 equals 192.168..* equals 192.168), could also contain IPv6 addresses
Returns
‪bool TRUE if an IP-mask from $list matches $baseIP

Definition at line 135 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\cmpIP(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4ReturnsFalseForNotMatchingAddress(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4ReturnsTrueForMatchingAddress().

◆ cmpIPv6()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::cmpIPv6 ( string  $baseIP,
string  $list 
)
static

Match IPv6 address with a list of IPv6 prefixes

Parameters
string$baseIP‪Is the current remote IP address for instance
string$list‪Is a comma-list of IPv6 prefixes, could also contain IPv4 addresses. IPv6 addresses must be specified in CIDR-notation, not with * wildcard, otherwise self::validIPv6() will fail.
Returns
‪bool TRUE If a baseIP matches any prefix

Definition at line 184 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\normalizeIPv6(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\cmpIP(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6ReturnsFalseForNotMatchingAddress(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6ReturnsTrueForMatchingAddress().

◆ createDirectoryPath()

static string TYPO3\CMS\Core\Utility\GeneralUtility::createDirectoryPath ( string  $fullDirectoryPath)
staticprotected

Creates directories for the specified paths if they do not exist. This functions sets proper permission mask but does not set proper user and group.

Returns
‪string Path to the first created directory in the hierarchy
See also
‪\TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep
Exceptions

Definition at line 1675 of file GeneralUtility.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\mkdir().

◆ expandList()

static string TYPO3\CMS\Core\Utility\GeneralUtility::expandList (   $list)
static

Expand a comma-separated list of integers with ranges (eg 1,3-5,7 becomes 1,3,4,5,7). Ranges are limited to 1000 values per range.

Parameters
string$list‪Comma-separated list of integers with ranges (string)
Returns
‪string New comma-separated list of items

Definition at line 434 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\expandListExpandsIntegerRanges(), and TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\stdWrap_expandList().

◆ fixed_lgd_cs()

static string TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs ( string  $string,
int  $chars,
string  $appendString = '...' 
)
static

Truncates a string with appended/prepended "..." and takes current character set into consideration.

Parameters
string$stringString to truncate
int$chars‪Must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.
string$appendString‪Appendix to the truncated string
Returns
‪string Cropped string

Definition at line 92 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Impexp\ImportExport\addSoftRefs(), TYPO3\CMS\Lowlevel\Command\ListSysLogCommand\arrayToLogString(), TYPO3\CMS\IndexedSearch\Controller\SearchController\compileSingleResultRow(), TYPO3\CMS\Backend\Clipboard\Clipboard\confirmMsgText(), TYPO3\CMS\Impexp\Export\exportAddRecord(), TYPO3\CMS\Adminpanel\Modules\TsDebug\TypoScriptWaterfall\fixCLen(), TYPO3\CMS\Backend\LinkHandler\PageLinkHandler\formatCurrentUrl(), TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray(), TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider\getAdditionalAttributes(), TYPO3\CMS\Backend\ContextMenu\ItemProviders\RecordProvider\getDeleteAdditionalAttributes(), TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem\getDeleteMessage(), TYPO3\CMS\Backend\Controller\PageTsConfig\PageTsConfigRecordsOverviewController\getList(), TYPO3\CMS\Backend\Clipboard\Clipboard\getLocalizations(), TYPO3\CMS\Backend\ContextMenu\ItemProviders\RecordProvider\getPasteAdditionalAttributes(), TYPO3\CMS\Backend\Template\Components\MetaInformation\getPath(), TYPO3\CMS\Backend\Template\Components\MetaInformation\getRecordInformationTitle(), TYPO3\CMS\Recycler\Controller\RecyclerAjaxController\getRecordPath(), TYPO3\CMS\Backend\Clipboard\Clipboard\getTabItems(), TYPO3\CMS\Backend\Tree\View\PageTreeView\getTitleStr(), TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTitleStr(), TYPO3\CMS\IndexedSearch\Controller\SearchController\makeDescription(), TYPO3\CMS\IndexedSearch\Controller\SearchController\markupSWpartsOfString(), TYPO3\CMS\Backend\Tree\View\PagePositionMap\positionTree(), TYPO3\CMS\Adminpanel\Modules\TsDebug\TypoScriptWaterfall\printTSlog(), TYPO3\CMS\Backend\Controller\EditDocumentController\processData(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\recordStatisticsAction(), TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\render(), TYPO3\CMS\Backend\Form\Container\FlexFormSectionContainer\render(), TYPO3\CMS\Backend\Form\Element\PasswordElement\render(), TYPO3\CMS\Backend\Form\Element\ColorElement\render(), TYPO3\CMS\Backend\Form\Element\EmailElement\render(), TYPO3\CMS\Backend\Form\Element\NumberElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\DatetimeElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Backend\Form\Element\LinkElement\render(), TYPO3\CMS\Backend\Form\Element\GroupElement\render(), TYPO3\CMS\Info\Controller\TranslationStatusController\renderL10nTable(), TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\renderStatic(), TYPO3\CMS\Backend\ElementBrowser\DatabaseBrowser\renderTableRecords(), TYPO3\CMS\Backend\LinkHandler\RecordLinkHandler\renderTableRecords(), and TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer\renderText().

◆ fixPermissions()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions ( string  $path,
bool  $recursive = false 
)
static

◆ get_dirs()

static string [] string null TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs ( string  $path)
static

Returns an array with the names of folders in a specific path Will return 'error' (string) if there were an error with reading directory content. Will return null if provided path is false.

Parameters
string$path‪Path to list directories from
Returns
‪string[]|string|null Returns an array with the directory entries as values. If no path is provided, the return value will be null.

Definition at line 1759 of file GeneralUtility.php.

References $dir.

◆ getUrl()

static string false TYPO3\CMS\Core\Utility\GeneralUtility::getUrl ( string  $url)
static

Reads the file or url $url and returns the content If you are having trouble with proxies when reading URLs you can configure your way out of that with settings within $GLOBALS['TYPO3_CONF_VARS']['HTTP'].

Parameters
string$url‪File/URL to read
Returns
‪string|false The content from the resource given as input. FALSE if an error has occurred.

Definition at line 1444 of file GeneralUtility.php.

References TYPO3\CMS\Webhooks\Message\$url.

Referenced by TYPO3\CMS\Install\Service\CoreUpdateService\downloadVersion(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOEmbedHelper\getOEmbedData(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\YouTubeHelper\getPreviewImage(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\VimeoHelper\getPreviewImage(), TYPO3\CMS\Dashboard\Widgets\RssWidget\getRssItems(), TYPO3\CMS\IndexedSearch\FileContentParser\readFileContent(), and TYPO3\CMS\Core\Resource\ResourceCompressor\retrieveExternalFile().

◆ hmac()

static string TYPO3\CMS\Core\Utility\GeneralUtility::hmac (   $input,
  $additionalSecret = '' 
)
static

Returns a proper HMAC on a given input string and secret TYPO3 encryption key.

Parameters
string$input‪Input string to create HMAC from
string$additionalSecret‪additionalSecret to prevent hmac being used in a different context
Returns
‪string resulting (hexadecimal) HMAC currently with a length of 40 (HMAC-SHA-1)
Deprecated:
‪since TYPO3 13.1, will be removed in TYPO3 V14

Definition at line 475 of file GeneralUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\hmacReturnsEqualHashesForEqualInput(), TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\hmacReturnsHashOfProperLength(), and TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\hmacReturnsNoEqualHashesForNonEqualInput().

◆ implodeArrayForUrl()

static string TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl ( string  $name,
array  $theArray,
string  $str = '',
bool  $skipBlank = false,
bool  $rawurlencodeParamName = false 
)
static

Implodes a multidim-array into GET-parameters (eg. &param[key][key2]=value2&param[key][key3]=value3)

Parameters
string$name‪Name prefix for entries. Set to blank if you wish none.
array$theArray‪The (multidimensional) array to implode
string$str‪(keep blank)
bool$skipBlank‪If set, parameters which were blank strings would be removed.
bool$rawurlencodeParamName‪If set, the param name itself (for example "param[key][key2]") would be rawurlencoded as well.
Returns
‪string Imploded result, fx. &param[key][key2]=value2&param[key][key3]=value3
See also
‪explodeUrl2Array()

Definition at line 860 of file GeneralUtility.php.

Referenced by TYPO3\CMS\IndexedSearch\Controller\SearchController\linkPage().

◆ inList()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::inList (   $list,
  $item 
)
static

Check for item in list Check if an item exists in a comma-separated list of items.

Parameters
string$list‪Comma-separated list of items (string)
string$item‪Item to check for
Returns
‪bool TRUE if $item is in $list

Definition at line 422 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowDefaultAsReadonly\addData(), TYPO3\CMS\Backend\Tree\View\AbstractTreeView\addField(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\addItemsFromFolder(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\addToList(), TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider\buildRepresentationForNode(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\check(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\checkAuthMode(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\checkIf(), TYPO3\CMS\Core\DataHandling\DataHandler\checkModifyAccessList(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValue(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\checkWorkspace(), TYPO3\CMS\Beuser\Service\UserInformationService\convert(), TYPO3\CMS\Install\Controller\EnvironmentController\convertImageFormatsToJpg(), TYPO3\CMS\Core\Resource\Processing\ImageCropScaleMaskTask\determineTargetFileExtension(), TYPO3\CMS\Core\Resource\Processing\ImagePreviewTask\determineTargetFileExtension(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\getProcessedValueExtra(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getQueryBuilder(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\getRootlineLevel(), TYPO3\CMS\Workspaces\Controller\Remote\RemoteServer\getRowDetails(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getTable(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getTablesToRender(), TYPO3\CMS\Backend\Controller\AbstractMfaController\initializeMfaConfiguration(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemContainedReturnsTrue(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemNotContainedReturnsFalse(), TYPO3\CMS\Core\Tree\TableConfiguration\AbstractTableConfigurationTreeDataProvider\isExpanded(), TYPO3\CMS\Core\Resource\AbstractFile\isImage(), TYPO3\CMS\Scheduler\CronCommand\CronCommand\isInCommandList(), TYPO3\CMS\Core\Resource\AbstractFile\isMediaFile(), TYPO3\CMS\Core\DataHandling\PageDoktypeRegistry\isRecordTypeAllowedForDoktype(), TYPO3\CMS\Core\Routing\Aspect\AspectTrait\isSlugUniqueInSite(), TYPO3\CMS\Core\Resource\AbstractFile\isTextFile(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\listURL(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeOptionList(), TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions\matchFieldCondition(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateEmailFlagToEmailType(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateEvalIntAndDouble2ToTypeNumber(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateNullFlag(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migratePasswordAndSaltedPasswordToPasswordType(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\parseFuncInternal(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\recordStatisticsAction(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\removeFromList(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\removeItemsByDoktypeUserRestriction(), TYPO3\CMS\Backend\Form\FieldWizard\OtherLanguageContent\render(), TYPO3\CMS\Backend\Form\Container\SingleFieldContainer\render(), TYPO3\CMS\Backend\Form\FieldWizard\DefaultLanguageDifferences\render(), TYPO3\CMS\Backend\Form\FieldWizard\OtherLanguageThumbnails\render(), TYPO3\CMS\Backend\Form\Element\BackendLayoutWizardElement\render(), TYPO3\CMS\Backend\Form\Element\InputSlugElement\render(), TYPO3\CMS\Fluid\ViewHelpers\MediaViewHelper\render(), TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper\render(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\renderListRow(), TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper\renderStatic(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\resultRowDisplay(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\resultRowTitles(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\stdWrap(), TYPO3\CMS\Core\Html\RteHtmlParser\TS_transform_rte(), and TYPO3\CMS\Core\Authentication\BackendUserAuthentication\workspaceCheckStageForCurrent().

◆ intExplode()

static list<int> TYPO3\CMS\Core\Utility\GeneralUtility::intExplode ( string  $delimiter,
string  $string,
bool  $removeEmptyValues = false 
)
static

Explodes a $string delimited by $delimiter and casts each item in the array to (int). Corresponds to \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(), but with conversion to integers for all values.

Parameters
string$delimiter‪Delimiter string to explode with
string$string‪The string to explode
bool$removeEmptyValues‪If set, all empty values (='') will NOT be set in output
Returns
‪list<int> Exploded values, all converted to integers

Definition at line 756 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver\__construct(), TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseLanguageRows\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectTreeItems\addData(), TYPO3\CMS\Tstemplate\Controller\AbstractTemplateModuleController\addPreviewButtonToDocHeader(), TYPO3\CMS\Frontend\Imaging\GifBuilder\adjust(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\cleanInputVal(), TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility\collectPages(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\collectRecordsFromCategories(), TYPO3\CMS\Frontend\Imaging\GifBuilder\copyGifOntoGif(), TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\countRecords(), TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\create(), TYPO3\CMS\Backend\View\Drawing\DrawingConfiguration\create(), TYPO3\CMS\Frontend\Imaging\GifBuilder\crop(), TYPO3\CMS\Extbase\Persistence\Generic\Backend\determineStoragePageIdForNewRecord(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery(), TYPO3\CMS\Scheduler\Controller\SchedulerModuleController\executeTasks(), TYPO3\CMS\Core\Authentication\GroupResolver\fetchGroupsRecursive(), TYPO3\CMS\Backend\Controller\Page\TreeController\fetchReadOnlyConfigurationAction(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\filterValidWebMounts(), TYPO3\CMS\Frontend\ContentObject\FilesContentObject\findAndSortFiles(), TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider\generateItems(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getAllAvailableIndexConfigurationsOptions(), TYPO3\CMS\Linkvalidator\QueryRestrictions\EditableRestriction\getAllowedLanguagesForCurrentUser(), TYPO3\CMS\Core\Site\Entity\NullSite\getAvailableLanguages(), TYPO3\CMS\Workspaces\Service\StagesService\getBackendUsers(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\getBannedUids(), TYPO3\CMS\Info\Controller\InfoModuleController\getButtons(), TYPO3\CMS\Backend\Controller\NewRecordController\getButtons(), TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider\getChildrenUidsFromChildrenRelation(), TYPO3\CMS\Backend\Tree\View\AbstractContentPagePositionMap\getColumnsConfiguration(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\getConfiguration(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getConfiguration(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getConstraint(), TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory\getDataProvider(), TYPO3\CMS\Backend\Controller\Page\TreeController\getDokTypes(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFileMountRecords(), TYPO3\CMS\Backend\Command\CreateBackendUserCommand\getGroups(), TYPO3\CMS\Frontend\ContentObject\ImageContentObject\getImageSourceCollection(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getMovedRecordsFromPages(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getNewVersionsForPages(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getNoViewWithDokTypes(), TYPO3\CMS\Core\Utility\VersionNumberUtility\getNumericTypo3Version(), TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider\getPages(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageShortcut(), TYPO3\CMS\Linkvalidator\Result\LinkAnalyzerResult\getResultForTask(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getSearchRootPageIdList(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\getSelectQuery(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getSlidePids(), TYPO3\CMS\Backend\Controller\Page\NewMultiplePagesController\getTypeSelectData(), TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder\handleIncludeBasedOnTemplates(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\imageLinkWrap(), TYPO3\CMS\Frontend\Imaging\GifBuilder\IMparams(), TYPO3\CMS\Backend\Controller\NewRecordController\init(), TYPO3\CMS\IndexedSearch\Controller\SearchController\initialize(), TYPO3\CMS\Backend\Controller\Page\TreeController\initializeConfiguration(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\initializeDbMountpointsInWorkspace(), TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\initializeMountPointMap(), TYPO3\CMS\Backend\Controller\Page\TreeController\initializePageTreeRepository(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\initializeWebmountsForElementBrowser(), TYPO3\CMS\Recycler\Domain\Model\DeletedRecords\loadData(), TYPO3\CMS\FrontendLogin\Controller\LoginController\loginAction(), TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\lostRecords(), TYPO3\CMS\Frontend\Imaging\GifBuilder\makeBox(), TYPO3\CMS\Frontend\Imaging\GifBuilder\makeEllipse(), TYPO3\CMS\Frontend\Imaging\GifBuilder\makeEmboss(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeOptionList(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeSelectorTable(), TYPO3\CMS\Frontend\Imaging\GifBuilder\makeShadow(), TYPO3\CMS\Backend\Controller\PageLayoutController\makeViewButton(), TYPO3\CMS\Frontend\Imaging\GifBuilder\objPosition(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaCategory\overrideConfigFromPageTSconfig(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideStoragePidIfStartingPointIsSet(), TYPO3\CMS\Core\Utility\RootlineUtility\parseMountPointParameter(), TYPO3\CMS\Core\TypoScript\AST\Visitor\AstConstantCommentVisitor\parseNodeComment(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\parseStartingPointsFromSiteConfiguration(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForBrowseMenu(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForDirectoryMenu(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForKeywordsMenu(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForLanguageMenu(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForListMenu(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForUpdatedMenu(), TYPO3\CMS\Frontend\DataProcessing\FilesProcessor\process(), TYPO3\CMS\Frontend\DataProcessing\SplitProcessor\process(), TYPO3\CMS\Workspaces\Hook\DataHandlerHook\processCmdmap(), TYPO3\CMS\Backend\Controller\EditDocumentController\processData(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processForeignTableClause(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\recoveryAction(), TYPO3\CMS\Backend\Controller\EditDocumentController\registerViewButtonToButtonBar(), TYPO3\CMS\Backend\LinkHandler\RecordLinkHandler\render(), TYPO3\CMS\Core\Authentication\GroupResolver\resolveGroupsForUser(), TYPO3\CMS\Core\Routing\PageRouter\resolveMountPointParameterIntoPageSlug(), TYPO3\CMS\Scheduler\Controller\SchedulerModuleController\scheduleCrons(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\searchAction(), TYPO3\CMS\IndexedSearch\Controller\SearchController\searchAction(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\sectionTableWhere(), TYPO3\CMS\Workspaces\Service\WorkspaceService\selectAllVersionsFromPages(), TYPO3\CMS\Recycler\Domain\Model\DeletedRecords\setData(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\setWebmounts(), TYPO3\CMS\Frontend\Imaging\GifBuilder\setWorkArea(), TYPO3\CMS\Frontend\Imaging\GifBuilder\splitString(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\start(), TYPO3\CMS\Frontend\Imaging\GifBuilder\start(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\start(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\substring(), TYPO3\CMS\Frontend\Imaging\GifBuilder\txtPosition(), TYPO3\CMS\Beuser\Controller\PermissionController\updateAction(), and TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\userConstraints().

◆ isOnCurrentHost()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::isOnCurrentHost ( string  $url)
static

Checks if a given URL matches the host that currently handles this HTTP request. Scheme, hostname and (optional) port of the given URL are compared.

Parameters
string$url‪URL to compare with the TYPO3 request host
Returns
‪bool Whether the URL matches the TYPO3 request host

Definition at line 409 of file GeneralUtility.php.

References TYPO3\CMS\Webhooks\Message\$url.

Referenced by TYPO3\CMS\Core\Html\DefaultSanitizerBuilder\__construct(), TYPO3\CMS\Core\Resource\ResourceCompressor\createMergedFile(), and TYPO3\CMS\Frontend\Typolink\LinkFactory\isInternalUrl().

◆ isValid()

static array<int, splitCalc($string, $operators) { $res = []; $sign = '+'; while ($string) { $valueLen = strcspn($string, $operators); $value = substr($string, 0, $valueLen); $res[] = [$sign, trim($value)]; $sign = substr($string, $valueLen, 1); $string = substr($string, $valueLen + 1); } reset($res); return $res; } public static bool function validEmail(string $email): bool { if (trim($email) !== $email) { return false; } if (!str_contains($email, '@')) { return false; } $validators = []; foreach ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['validators'] ?? [RFCValidation::class] as $className) { $validator = new $className(); if ($validator instanceof EmailValidation) { $validators[] = $validator; } } $emailValidator = new EmailValidator(); $isValid = $emailValidator-> TYPO3\CMS\Core\Utility\GeneralUtility::isValid (   $email,
new   MultipleValidationWithAnd $validators, MultipleValidationWithAnd::STOP_ON_ERROR 
)
static

This splits a string by the chars in $operators (typical /+-*) and returns an array with them in

Parameters
string$string‪Input string, eg "123 + 456 / 789 - 4 @param string $operators Operators to split by, typically "/+-*
Returns
‪array<int, array<int, string>> Array with operators and operands separated.
See also
‪\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::calc()
‪\TYPO3\CMS\Frontend\Imaging\GifBuilder::calcOffset()

◆ isValidUrl()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl ( string  $url)
static

Checks if a given string is a Uniform Resource Locator (URL).

On seriously malformed URLs, parse_url may return FALSE and emit an E_WARNING.

filter_var() requires a scheme to be present.

http://www.faqs.org/rfcs/rfc2396.html Scheme names consist of a sequence of characters beginning with a lower case letter and followed by any combination of lower case letters, digits, plus ("+"), period ("."), or hyphen ("-"). For resiliency, programs interpreting URI should treat upper case letters as equivalent to lower case in scheme names (e.g., allow "HTTP" as well as "http"). scheme = alpha *( alpha | digit | "+" | "-" | "." )

Convert the domain part to punicode if it does not look like a regular domain name. Only the domain part because RFC3986 specifies the the rest of the url may not contain special characters: https://tools.ietf.org/html/rfc3986#appendix-A

Parameters
string$url‪The URL to be validated
Returns
‪bool Whether the given URL is valid

Definition at line 713 of file GeneralUtility.php.

References TYPO3\CMS\Webhooks\Message\$url, and TYPO3\CMS\Core\Utility\HttpUtility\buildUrl().

Referenced by TYPO3\CMS\Core\Html\DefaultSanitizerBuilder\__construct(), TYPO3\CMS\Core\Resource\ResourceCompressor\createMergedFile(), TYPO3\CMS\Backend\Command\ResetPasswordCommand\execute(), TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters(), TYPO3\CMS\FrontendLogin\Validation\RedirectUrlValidator\isInLocalDomain(), and TYPO3\CMS\Extbase\Validation\Validator\UrlValidator\isValid().

◆ md5int()

static int TYPO3\CMS\Core\Utility\GeneralUtility::md5int (   $str)
static

Makes a positive integer hash out of the first 7 chars from the md5 hash of the input

Parameters
string$strString to md5-hash
Returns
‪int Returns 28bit integer-hash

Definition at line 462 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Filelist\Controller\FileListController\registerAdditionalDocHeaderButtons().

◆ mkdir()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::mkdir ( string  $newFolder)
static

Wrapper function for mkdir. Sets folder permissions according to $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] and group ownership according to $GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup']

Parameters
string$newFolder‪Absolute path to folder, see PHP mkdir() function. Removes trailing slash internally.
Returns
‪bool TRUE if operation was successful

Definition at line 1638 of file GeneralUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Locking\FileLockStrategy\__construct(), TYPO3\CMS\Core\Locking\SimpleLockStrategy\__construct(), TYPO3\CMS\Core\Locking\SemaphoreLockStrategy\__construct(), TYPO3\CMS\Core\Package\Initialization\ImportExtensionDataOnPackageInitialization\__invoke(), TYPO3\CMS\Impexp\Initialization\ImportSiteConfigurationsOnPackageInitialization\__invoke(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\addDirectory(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\afterDefaultUploadFolderWasResolvedEventChangedResult(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\afterDefaultUploadFolderWasResolvedEventIsDispatched(), TYPO3\CMS\Impexp\Import\checkOrCreateDir(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\copyExtensionFolderToTempFolder(), TYPO3\CMS\Core\Utility\GeneralUtility\createDirectoryPath(), TYPO3\CMS\Extensionmanager\Controller\ActionController\createZipFileFromExtension(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\fileContentIsExtractedAsExpected(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\fileContentIsExtractedAsExpectedAndSetsPermissions(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\filesCanNotGetExtractedOutsideTargetDirectory(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\flush(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\getDefaultUploadFolderForPageTest(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\getDefaultUploadFolderForUserTest(), TYPO3\CMS\Install\Report\InstallStatusReport\getFileSystemStatus(), TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importImagesWithStaticAndFallbackStorages(), TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importMultipleImagesWithMultipleStorages(), TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesAndNewStorage(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\nonExistentFileThrowsException(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\resolveAllExistingSitesReadsConfiguration(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\resolveWithUserAndPageConfigTest(), and TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\resolveWithUserConfigTest().

◆ mkdir_deep()

static TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep ( string  $directory)
static

Creates a directory - including parent directories if necessary and sets permissions on newly created directories.

Parameters
string$directory‪Target directory to create
Exceptions

Definition at line 1654 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\__construct(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\buildFileDeclarations(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\clearAssetsFolderClearsFolder(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\createDirectoriesForExtensionFiles(), TYPO3\CMS\Extensionmanager\Tests\Unit\Controller\ActionControllerTest\createFakeExtension(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\createFakeExtension(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\createFinalCacheDirectory(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\createMockPackageManagerWithMockPackage(), TYPO3\CMS\Core\Core\ClassLoadingInformation\ensureAutoloadInfoDirExists(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\ensureSessionSavePathExists(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\AbstractNodeTest\existsReturnsTrueIfIsLinkAndTargetIsDead(), TYPO3\CMS\Install\Controller\EnvironmentController\getImagesPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusCallsGetChildrenStatusForStatus(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\FileNodeTest\getStatusReturnsArray(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper\getTempFolderPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\AbstractFolderStructureTestCase\getTestDirectory(), TYPO3\CMS\Core\Tests\Unit\Http\StreamTest\getTestDirectory(), TYPO3\CMS\Core\Tests\Unit\Http\StreamFactoryTest\getTestDirectory(), TYPO3\CMS\Core\Tests\Unit\Configuration\ConfigurationManagerTest\getTestDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getTestDirectory(), TYPO3\CMS\Frontend\Imaging\GifBuilder\gifBuild(), TYPO3\CMS\Core\Resource\ResourceCompressor\initialize(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\DirectoryNodeTest\isDirectoryReturnsFalseIfNameIsALinkToADirectory(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\FileNodeTest\isFileReturnsFalseIfNameIsALinkFile(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\removeDirectoryDoesNotRemoveContentOfSymlinkedTargetDirectory(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceFactoryTest\retrieveFileOrFolderObjectReturnsFileFromPublicFolderWhenProjectRootIsNotPublic(), TYPO3\CMS\Install\Service\SetupDatabaseService\setDefaultConnectionSettings(), TYPO3\CMS\Install\Service\CoreUpdateService\setDownloadTargetPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\LinkNodeTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Package\PackageTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Log\Writer\FileWriterTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Log\Writer\RotatingFileWriterTest\setUp(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteWriterTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\setUp(), TYPO3\CMS\Frontend\Tests\Functional\Imaging\GifBuilderTest\setupFullTestEnvironment(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\systemCachesCanBeWarmedIfCacheIsBroken(), TYPO3\CMS\Install\Service\LanguagePackService\unzipTranslationFile(), TYPO3\CMS\Core\Configuration\SiteWriter\write(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteWriterTest\writeOnlyWritesModifiedKeys(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteWriterTest\writingOfNestedStructuresPreservesOrder(), and TYPO3\CMS\Core\Tests\Unit\Configuration\SiteWriterTest\writingPlaceholdersIsHandled().

◆ normalizeIPv6()

static string TYPO3\CMS\Core\Utility\GeneralUtility::normalizeIPv6 ( string  $address)
static

Normalize an IPv6 address to full length

Parameters
string$address‪Given IPv6 address
Returns
‪string Normalized address

Definition at line 239 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\cmpIPv6(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\normalizeIPv6CorrectlyNormalizesAddresses().

◆ revExplode()

static list<string> TYPO3\CMS\Core\Utility\GeneralUtility::revExplode ( string  $delimiter,
string  $string,
int  $limit = 0 
)
static

Reverse explode which explodes the string counting from behind.

Note: The delimiter has to given in the reverse order as it is occurring within the string.

GeneralUtility::revExplode('[]', '[my][words][here]', 2) ==> array('[my][words', 'here]')

Parameters
string$delimiter‪Delimiter string to explode with
string$string‪The string to explode
int$limit‪Number of array entries
Returns
‪list<string> Exploded values

Definition at line 787 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\encaps_lineSplit(), TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter\filter(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\freeIndexUidWhere(), TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\getLocalizedFileName(), TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\getRootPathFromScriptPath(), TYPO3\CMS\Backend\Controller\Wizard\EditController\processRequest(), and TYPO3\CMS\Backend\Form\Element\InputSlugElement\render().

◆ rmdir()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::rmdir ( string  $path,
bool  $removeNonEmpty = false 
)
static

Wrapper function for rmdir, allowing recursive deletion of folders and files

Parameters
string$path‪Absolute path to folder, see PHP rmdir() function. Removes trailing slash internally.
bool$removeNonEmpty‪Allow deletion of non-empty directories
Returns
‪bool TRUE if operation was successful

Definition at line 1702 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\cachesCanBeWarmed(), TYPO3\CMS\Install\Service\Typo3tempFileService\clearAssetsFolder(), TYPO3\CMS\Core\Tests\Unit\Locking\SimpleLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\diCachesDoesNotWarmSystemCaches(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\flush(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\purgeFileDeclarations(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeBackupFolder(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\removeDirectory(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\systemCachesCanBeWarmed(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceCompressorTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\StorageRepositoryTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\SysRedirectRootPageMoveMigrationTest\tearDown(), TYPO3\CMS\Form\Tests\Functional\Mvc\Validation\MimeTypeValidatorTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\UpgradeAnalysis\DocumentationFileTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration(), TYPO3\CMS\Core\Tests\Functional\Routing\Aspect\PersistedAliasMapperTest\writeSiteConfiguration(), and TYPO3\CMS\Core\Tests\Functional\Routing\Aspect\PersistedPatternMapperTest\writeSiteConfiguration().

◆ trimExplode()

static list<string> TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode ( string  $delim,
string  $string,
bool  $removeEmptyValues = false,
int  $limit = 0 
)
static

Explodes a string and removes whitespace-only values.

If $removeEmptyValues is set, then all values that contain only whitespace are removed.

Each item will have leading and trailing whitespace removed. However, if the tail items are returned as a single array item, their internal whitespace will not be modified.

Parameters
string$delim‪Delimiter string to explode with
string$string‪The string to explode
bool$removeEmptyValues‪If set, all empty values will be removed in output
int$limit‪If limit is set and positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string. If the limit parameter is negative, all components except the last -limit are returned.
Returns
‪list<string> Exploded values @phpstan-return ($removeEmptyValues is true ? list<non-empty-string> : list<string>) Exploded values

Definition at line 822 of file GeneralUtility.php.

Referenced by TYPO3\CMS\FrontendLogin\Configuration\RedirectConfiguration\__construct(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\__construct(), TYPO3\CMS\Scheduler\CronCommand\CronCommand\__construct(), TYPO3\CMS\Filelist\FileList\__construct(), TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodesProvider\activate(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessShowitem\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessPlaceholders\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessCommon\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessRecordTitle\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaGroup\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaFolder\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\addData(), TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser\addEntryPoint(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaTypesShowitem\addFieldsBySubtypeAddList(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addFieldsToAllPalettesOfField(), TYPO3\CMS\Core\Resource\Security\StoragePermissionsAspect\addFileMountsToStorage(), TYPO3\CMS\Frontend\Typolink\LinkFactory\addJavaScriptOpenWindowInformationAttributes(), TYPO3\CMS\Core\Configuration\CKEditor5Migrator\addLinkClassesToStyleSets(), TYPO3\CMS\Frontend\Typolink\LinkFactory\addSecurityRelValues(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addService(), TYPO3\CMS\Backend\Controller\EditDocumentController\addSlugFieldsToColumnsOnly(), TYPO3\CMS\Core\TypoScript\IncludeTree\TreeFromLineStreamBuilder\addStaticMagicFromGlobals(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\applyHttpHeadersToResponse(), TYPO3\CMS\Core\DataHandling\PagePermissionAssembler\assemblePermissions(), TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver\buildConstraintBlock(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\buildForeignTableQueryBuilder(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateMaximum(), TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider\canBeDownloaded(), TYPO3\CMS\Backend\Controller\RecordListController\canCreatePreviewLink(), TYPO3\CMS\Install\SystemEnvironment\Check\checkCurrentDirectoryIsInIncludePath(), TYPO3\CMS\Install\SystemEnvironment\Check\checkDisableFunctions(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValue_group_select_explodeSelectGroupValue(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForCategory(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForCheck(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForEmail(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForFile(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForGroupFolderSelect(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForInline(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForInput(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForSlug(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForText(), TYPO3\CMS\Extbase\Service\CacheService\clearPageCacheForGivenRecord(), TYPO3\CMS\Core\Utility\GeneralUtility\cmpFQDN(), TYPO3\CMS\Core\Utility\GeneralUtility\cmpIPv4(), TYPO3\CMS\Core\Utility\GeneralUtility\cmpIPv6(), TYPO3\CMS\Core\DependencyInjection\MessageHandlerPass\collectHandlers(), TYPO3\CMS\Core\DependencyInjection\ListenerProviderPass\collectListeners(), TYPO3\CMS\Core\DependencyInjection\MessengerMiddlewarePass\collectMiddlewares(), TYPO3\CMS\Beuser\Service\UserInformationService\convert(), TYPO3\CMS\Dashboard\DependencyInjection\DashboardWidgetPass\convertAttributes(), TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter\convertFrom(), TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter\convertToLowercaseArray(), TYPO3\CMS\Core\Utility\VersionNumberUtility\convertVersionsStringToVersionNumbers(), TYPO3\CMS\Core\DataHandling\DataHandler\copyRecord(), TYPO3\CMS\Core\DataHandling\DataHandler\copyRecord_processManyToMany(), TYPO3\CMS\Backend\View\BackendViewFactory\create(), TYPO3\CMS\Backend\Controller\OnlineMediaController\createAction(), TYPO3\CMS\Dashboard\DashboardInitializationService\createDefaultDashboards(), TYPO3\CMS\Backend\Form\Container\PaletteAndSingleContainer\createPaletteContentArray(), TYPO3\CMS\Core\Resource\Rendering\VimeoRenderer\createVimeoUrl(), TYPO3\CMS\Core\Http\NormalizedParams\determineHttpHost(), TYPO3\CMS\Core\Http\NormalizedParams\determineRemoteAddress(), TYPO3\CMS\Core\Http\NormalizedParams\determineRequestUri(), TYPO3\CMS\Core\DataHandling\DataHandler\discardCsvReferencesToRecord(), TYPO3\CMS\Core\Settings\Type\ColorType\doColorNormalization(), TYPO3\CMS\Core\Controller\FileDumpController\dumpAction(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\encaps_lineSplit(), TYPO3\CMS\Backend\Http\RouteDispatcher\enforceReferrer(), TYPO3\CMS\Core\TypoScript\AST\AbstractAstBuilder\evaluateValueModifier(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery(), TYPO3\CMS\Install\Command\LanguagePackCommand\execute(), TYPO3\CMS\Form\Domain\Finishers\ConfirmationFinisher\executeInternal(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\executePositionedStringInsertion(), TYPO3\CMS\Install\Updates\BackendGroupsExplicitAllowDenyMigration\executeUpdate(), TYPO3\CMS\Backend\Controller\FormFilesAjaxController\expandOrCollapseAction(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\expandOrCollapseAction(), TYPO3\CMS\Workspaces\DataHandler\CommandMap\explodeSetStage(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\explodeSingleFieldShowItemConfiguration(), TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory\explodeSoftRefParserList(), TYPO3\CMS\Install\Controller\UpgradeController\extensionScannerScanFileAction(), TYPO3\CMS\Backend\Form\Container\FilesControlContainer\extractFlexFormParts(), TYPO3\CMS\Backend\Form\Container\InlineControlContainer\extractFlexFormParts(), TYPO3\CMS\Backend\Controller\PageTsConfig\PageTsConfigRecordsOverviewController\extractLinesFromTSConfig(), TYPO3\CMS\Core\Resource\Search\QueryRestrictions\SearchTermRestriction\extractSearchableFieldsFromTable(), TYPO3\CMS\Backend\Search\LiveSearch\PageRecordProvider\extractSearchableFieldsFromTable(), TYPO3\CMS\Backend\Search\LiveSearch\DatabaseRecordProvider\extractSearchableFieldsFromTable(), TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile\extractTagsFromFile(), TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\fetchFilteredTree(), TYPO3\CMS\Info\Controller\PageInformationController\fillFieldConfiguration(), TYPO3\CMS\Core\Service\MarkerBasedTemplateService\fillInMarkerArray(), TYPO3\CMS\Frontend\ContentObject\FilesContentObject\findAndSortFiles(), TYPO3\CMS\Core\Resource\StorageRepository\findByCombinedIdentifier(), TYPO3\CMS\Core\DataHandling\DataHandler\fixCopyAfterDuplFields(), TYPO3\CMS\Core\DataHandling\DataHandler\fixUniqueInPid(), TYPO3\CMS\Core\DataHandling\DataHandler\fixUniqueInSite(), TYPO3\CMS\Backend\Controller\EditDocumentController\fixWSversioningInEditConf(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\freeIndexUidWhere(), TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope\from(), TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection\fromArray(), TYPO3\CMS\Core\DataHandling\SlugHelper\generate(), TYPO3\CMS\Core\Mail\TransportFactory\get(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getAllAvailableMediaTypesOptions(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\getAllowedTableForGroupField(), TYPO3\CMS\Core\DataHandling\DataHandler\getAllowedTablesToCopyWhenCopyingAPage(), TYPO3\CMS\Backend\Configuration\TCA\UserFunctions\getAllSystemLocales(), TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getCandidateSlugsFromRoutePath(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getCategoryMountPoints(), TYPO3\CMS\Linkvalidator\Controller\LinkValidatorController\getCheckOptions(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline\getChildChildTableName(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\getChildChildTableName(), TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator\getCurrentPageCacheConfiguration(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getData(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\getDataStructureIdentifierFromTcaArray(), TYPO3\CMS\Core\DataHandling\DataHandler\getExcludeListArray(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\getFieldList(), TYPO3\CMS\Setup\Controller\SetupModuleController\getFieldsFromShowItem(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getFieldsToSelect(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getFieldVal(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getFileDataKey(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFileMountRecords(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFilePermissions(), TYPO3\CMS\Backend\Controller\FormFilesAjaxController\getFileReferenceUids(), TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator\getFirstTimeValueForRecord(), TYPO3\CMS\Core\Resource\ResourceFactory\getFolderObjectFromCombinedIdentifier(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\getFromDottedNotation(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getGlobal(), TYPO3\CMS\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\getInlineRelatedRecordsUidArray(), TYPO3\CMS\Core\Html\RteHtmlParser\getKeepTags(), TYPO3\CMS\Core\Type\File\FileInfo\getMimeExtensions(), TYPO3\CMS\Backend\Module\ModuleProvider\getModuleForMenu(), TYPO3\CMS\Backend\Module\ModuleProvider\getModulesForModuleMenu(), TYPO3\CMS\Core\Resource\ResourceFactory\getObjectFromCombinedIdentifier(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getPathFromPageId(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\getPlaceholderValue(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders(), TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\getQueryArguments(), TYPO3\CMS\Workspaces\Controller\Remote\ActionHandler\getRecipientList(), TYPO3\CMS\Backend\Domain\Repository\Localization\LocalizationRepository\getRecordsToCopyDatabaseResult(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaRecordTitle\getRecordTitleByLabelProperties(), TYPO3\CMS\Core\Hooks\TcaItemsProcessorFunctions\getRegisteredFlexForms(), TYPO3\CMS\Core\TypoScript\IncludeTree\TsConfigTreeBuilder\getRootlinePageTsConfigTree(), TYPO3\CMS\Workspaces\Controller\Remote\RemoteServer\getRowDetails(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\getSearchField(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\getSelectQuery(), TYPO3\CMS\Backend\Controller\EditDocumentController\getShortcutTitle(), TYPO3\CMS\Core\Resource\ResourceFactory\getStorageObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Crypto\PasswordHashing\Pbkdf2PasswordHash\getStoredSalt(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages(), TYPO3\CMS\Workspaces\Controller\Remote\RemoteServer\getSuitableFields(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\getTablesToQueryFromFieldConfiguration(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getTablesToRender(), TYPO3\CMS\Workspaces\Hook\DataHandlerHook\getUniqueFields(), TYPO3\CMS\Backend\Form\AbstractNode\getValidationDataAsJsonString(), TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder\handleIncludeStaticFileArray(), TYPO3\CMS\Filelist\Controller\FileDownloadController\handleRequest(), TYPO3\CMS\Workspaces\Controller\PreviewController\handleRequest(), TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder\handleSetInclude(), TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder\handleSingleIncludeStaticFile(), TYPO3\CMS\Install\Updates\BackendModulePermissionMigration\hasRecordsToUpdate(), TYPO3\CMS\Backend\Controller\NewRecordController\init(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\init(), TYPO3\CMS\Core\Charset\CharsetConverter\initCharset(), TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\initDisabledItems(), TYPO3\CMS\Core\Localization\LanguageStore\initialize(), TYPO3\CMS\Backend\Form\InlineStackProcessor\initializeByParsingDomObjectIdString(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\initializeFileStorages(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\initializeFlatMatcherDefinitions(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\initializeLastArrayKeyNameArray(), TYPO3\CMS\Linkvalidator\Controller\LinkValidatorController\initializeLinkAnalyzer(), TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\initializeMountPointMap(), TYPO3\CMS\Filelist\LinkHandler\FileLinkHandler\initializeVariables(), TYPO3\CMS\IndexedSearch\FileContentParser\initParser(), TYPO3\CMS\Core\Charset\CharsetConverter\initUnicodeData(), TYPO3\CMS\Filelist\ElementBrowser\FileBrowser\initVariables(), TYPO3\CMS\Core\DataHandling\DataHandler\insertUpdateDB_preprocessBasedOnFieldType(), TYPO3\CMS\SysNote\Provider\ButtonBarProvider\isCreationAllowed(), TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem\isFunctionDisabled(), TYPO3\CMS\FrontendLogin\Redirect\RedirectHandler\isReferrerRedirectEnabled(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isServiceAvailable(), TYPO3\CMS\Backend\Controller\EditDocumentController\languageSwitch(), TYPO3\CMS\Filelist\Controller\File\CreateFileController\mainAction(), TYPO3\CMS\Backend\Controller\Wizard\AddController\mainAction(), TYPO3\CMS\Backend\Controller\OnlineMediaController\mainAction(), TYPO3\CMS\Backend\Controller\RecordListController\mainAction(), TYPO3\CMS\Backend\Controller\EditDocumentController\makeEditForm(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeOptionList(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\makeRef(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\makeRefFrom(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\makeSearchString(), TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions\matchFieldCondition(), TYPO3\CMS\Install\Service\SilentConfigurationUpgradeService\migrateCacheHashOptions(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateEmailFlagToEmailType(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateEvalIntAndDouble2ToTypeNumber(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateNullFlag(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migratePasswordAndSaltedPasswordToPasswordType(), TYPO3\CMS\Core\Configuration\CKEditor5Migrator\migrateRemoveButtonsFromToolbar(), TYPO3\CMS\Core\Configuration\Tca\TcaMigration\migrateRenderTypeInputDateTimeToTypeDatetime(), TYPO3\CMS\Core\Settings\Type\ColorType\normalizeRgb(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideConfigurationFromFlexForm(), TYPO3\CMS\Impexp\Command\ImportCommand\parseAssociativeArray(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\parseFunc(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseGroupBy(), TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile\parseIssueId(), TYPO3\CMS\Core\Utility\RootlineUtility\parseMountPointParameter(), TYPO3\CMS\Core\TypoScript\AST\Visitor\AstConstantCommentVisitor\parseNodeComment(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions\parseSingleConditionString(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\parseStartingPointsFromSiteConfiguration(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseTableList(), TYPO3\CMS\Core\DataHandling\DataHandler\prepareCacheFlush(), TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor\prepareConfiguration(), TYPO3\CMS\Core\Database\Connection\prepareConnection(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\prepareDependencyOrdering(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\prepareMenuItemsForKeywordsMenu(), TYPO3\CMS\Adminpanel\Modules\TsDebug\TypoScriptWaterfall\printTSlog(), TYPO3\CMS\Lowlevel\DependencyInjection\ConfigurationModuleProviderPass\process(), TYPO3\CMS\Extbase\DependencyInjection\TypeConverterPass\process(), TYPO3\CMS\Core\DependencyInjection\MfaProviderPass\process(), TYPO3\CMS\Frontend\DataProcessing\FilesProcessor\process(), TYPO3\CMS\Frontend\DataProcessing\SplitProcessor\process(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\processConfiguration(), TYPO3\CMS\Core\Html\RteHtmlParser\processContentWithinParagraph(), TYPO3\CMS\Backend\Controller\EditDocumentController\processData(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processDatabaseFieldValue(), TYPO3\CMS\Core\Hooks\BackendUserGroupIntegrityCheck\processDatamap_afterDatabaseOperations(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processForeignTableClause(), TYPO3\CMS\Core\TypoScript\IncludeTree\TreeFromLineStreamBuilder\processIncludeTyposcript(), TYPO3\CMS\Form\Mvc\Property\TypeConverter\UploadedFileReferenceConverter\provideUploadFolder(), TYPO3\CMS\Core\Database\RelationHandler\readList(), TYPO3\CMS\Core\DataHandling\DataHandler\recordInfoWithPermissionCheck(), TYPO3\CMS\FrontendLogin\Redirect\RedirectModeHandler\redirectModeReferrerDomains(), TYPO3\CMS\Core\DataHandling\DataHandler\remapListedDBRecords_procDBRefs(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexProcess\removeExcludeFieldsFromDataStructure(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaTypesShowitem\removeFields(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaTypesShowitem\removeFieldsBySubtypeExcludeList(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaTypesShowitem\removeFieldsFromPalettes(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\removeFromList(), TYPO3\CMS\IndexedSearch\Domain\Repository\AdministrationRepository\removeIndexedPhashRow(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\removeInvalidWizardItems(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\removeItemsByRemoveItemsPageTsConfig(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\removeWizardsByPageTs(), TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer\render(), TYPO3\CMS\Backend\Form\Container\FullRecordContainer\render(), TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser\render(), TYPO3\CMS\Backend\Form\FieldControl\ListModule\render(), TYPO3\CMS\Backend\Form\FieldWizard\TableList\render(), TYPO3\CMS\Backend\Form\FieldControl\AddRecord\render(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\render(), TYPO3\CMS\Backend\Form\Element\ColorElement\render(), TYPO3\CMS\Backend\Form\Element\EmailElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Backend\Form\Element\InputSlugElement\render(), TYPO3\CMS\Backend\Form\Element\TextTableElement\render(), TYPO3\CMS\Backend\ElementBrowser\DatabaseBrowser\render(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\render(), TYPO3\CMS\Filelist\FileList\renderControlManage(), TYPO3\CMS\Backend\Controller\NewRecordController\renderNewRecordControls(), TYPO3\CMS\Backend\Form\Container\InlineControlContainer\renderPossibleRecordsSelectorTypeGroupDB(), TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement\renderReadOnly(), TYPO3\CMS\Fluid\ViewHelpers\Format\BytesViewHelper\renderStatic(), TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper\renderStatic(), TYPO3\CMS\Backend\ElementBrowser\DatabaseBrowser\renderTableRecords(), TYPO3\CMS\Core\Html\RteHtmlParser\resolveAppliedTransformationModes(), TYPO3\CMS\Workspaces\Service\StagesService\resolveBackendUserIds(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline\resolveConnectedRecordUids(), TYPO3\CMS\Core\Resource\Security\FilePermissionAspect\resolveReferencedFiles(), TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\resolveSuggestedInlineRelations(), TYPO3\CMS\Backend\Module\ExtbaseModule\sanitizeControllerActions(), TYPO3\CMS\Core\Utility\RootlineUtility\sanitizeMountPointParameter(), TYPO3\CMS\Backend\Controller\SiteConfigurationController\saveAction(), TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandAdditionalFieldProvider\saveAdditionalFields(), TYPO3\CMS\IndexedSearch\FileContentParser\searchTypeMediaTitle(), TYPO3\CMS\Reports\Task\SystemStatusUpdateTask\sendNotificationEmail(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\setAbsRefPrefix(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\setAndCleanUpExternalLists(), TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew\setDefaultsFromNeighborRow(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\setFromDottedNotation(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessFieldLabels\setLabelFromShowitemAndPalettes(), TYPO3\CMS\Core\Localization\Locales\setLocale(), TYPO3\CMS\Core\DataHandling\DataHandler\setMirror(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\setPageCacheContent(), TYPO3\CMS\Core\Html\RteHtmlParser\setProcessingConfiguration(), TYPO3\CMS\Core\PageTitle\PageTitleProviderManager\setProviderOrder(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\setTableDisplayOrder(), TYPO3\CMS\Backend\Controller\RecordListController\showPageTranslations(), TYPO3\CMS\Core\Html\HtmlParser\splitIntoBlock(), TYPO3\CMS\Frontend\Typolink\LinkVarsCalculator\splitLinkVarsString(), TYPO3\CMS\Frontend\Page\CacheHashCalculator\splitQueryStringToArray(), TYPO3\CMS\Frontend\Imaging\GifBuilder\splitString(), TYPO3\CMS\Core\Database\RelationHandler\start(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\stdWrap_addPageCacheTags(), TYPO3\CMS\Core\Service\MarkerBasedTemplateService\substituteMarkerAndSubpartArrayRecursive(), TYPO3\CMS\Core\Service\MarkerBasedTemplateService\substituteMarkerArray(), TYPO3\CMS\Backend\Controller\FormSlugAjaxController\suggestAction(), TYPO3\CMS\Core\Resource\SynchronizeFolderRelations\synchronizeFilemountsAfterRename(), TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\synchronizeReferences(), TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider\translationInfo(), TYPO3\CMS\Core\Utility\StringUtility\uniqueList(), TYPO3\CMS\Install\Updates\IndexedSearchCTypeMigration\updateBackendUserGroups(), TYPO3\CMS\Install\Service\LocalConfigurationValueService\updateLocalConfigurationValues(), TYPO3\CMS\Install\Updates\BackendGroupsExplicitAllowDenyMigration\updateNecessary(), TYPO3\CMS\Install\Updates\BackendModulePermissionMigration\updateRecords(), TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandAdditionalFieldProvider\validateAdditionalFields(), TYPO3\CMS\Reports\Task\SystemStatusUpdateTaskNotificationEmailField\validateAdditionalFields(), TYPO3\CMS\Linkvalidator\Task\ValidatorTaskAdditionalFieldProvider\validateAdditionalFields(), TYPO3\CMS\Backend\Controller\SiteConfigurationController\validateAndProcessValue(), and TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateHashArgument().

◆ underscoredToLowerCamelCase()

static string TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase (   $string)
static

Returns a given string with underscores as lowerCamelCase. Example: Converts minimal_value to minimalValue

Parameters
string$stringString to be converted to camel case
Returns
‪string lowerCamelCasedWord

Definition at line 671 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory\buildDataMapInternal(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\columnMapIsInitializedWithFieldEvaluationsForDateTimeFields(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\columnMapIsInitializedWithManyToManyRelationOfTypeInlineAndIntermediateTable(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\columnMapIsInitializedWithManyToManyRelationOfTypeSelect(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\columnMapIsInitializedWithOppositeManyToManyRelationOfTypeSelect(), TYPO3\CMS\Backend\ViewHelpers\Toolbar\AttributesViewHelper\convertClassNameToIdAttribute(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\createWithFolderTypeDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\createWithGroupTypeDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\createWithInlineTypeDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\createWithSelectTypeDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\settingOneToManyRelationSetsRelationTableMatchFields(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\settingOneToOneRelationSetsRelationTableMatchFields(), and TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\setTypeDetectsTypeProperly().

◆ underscoredToUpperCamelCase()

static string TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase (   $string)
static

Returns a given string with underscores as UpperCamelCase. Example: Converts blog_example to BlogExample

Parameters
string$stringString to be converted to camel case
Returns
‪string UpperCamelCasedWord

Definition at line 659 of file GeneralUtility.php.

◆ validIP()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::validIP ( string  $ip)
static

Validate a given IP address.

Possible format are IPv4 and IPv6.

Parameters
string$ip‪IP address to be tested
Returns
‪bool TRUE if $ip is either of IPv4 or IPv6 format.

Definition at line 303 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Http\NormalizedParams\determineRemoteAddress(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validIpReturnsFalseForInvalidIp(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validIpReturnsTrueForValidIp().

◆ validIPv4()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::validIPv4 ( string  $ip)
static

Validate a given IP address to the IPv4 address format.

Example for possible format: 10.0.45.99

Parameters
string$ip‪IP address to be tested
Returns
‪bool TRUE if $ip is of IPv4 format.

Definition at line 316 of file GeneralUtility.php.

◆ validIPv6()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::validIPv6 ( string  $ip)
static

Validate a given IP address to the IPv6 address format.

Example for possible format: 43FB::BB3F:A0A0:0 | ::1

Parameters
string$ip‪IP address to be tested
Returns
‪bool TRUE if $ip is of IPv6 format.

Definition at line 329 of file GeneralUtility.php.

◆ writeFile()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::writeFile ( string  $file,
string  $content,
bool  $changePermissions = false 
)
static

Writes $content to the file $file

Parameters
string$file‪Filepath to write to
string$content‪Content to write
bool$changePermissions‪If TRUE, permissions are forced to be set
Returns
‪bool TRUE if the file was successfully opened and written to.

Definition at line 1469 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Resource\Processing\SvgImageProcessor\applyCropping(), TYPO3\CMS\Core\Log\Writer\FileWriter\createHtaccessFile(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Core\Resource\ResourceCompressor\createMergedFile(), TYPO3\CMS\Core\Core\ClassLoadingInformation\dumpClassLoadingInformation(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\ensureSessionSavePathExists(), TYPO3\CMS\Backend\Command\LockBackendCommand\execute(), TYPO3\CMS\Core\Resource\ResourceCompressor\initialize(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\resolveAllExistingSitesReadsConfiguration(), TYPO3\CMS\Core\Resource\ResourceCompressor\retrieveExternalFile(), TYPO3\CMS\Impexp\Export\saveToFile(), TYPO3\CMS\Core\Configuration\SiteWriter\write(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\writeEmConfToFile(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\writeExtensionFiles(), TYPO3\CMS\Core\Resource\ResourceCompressor\writeFileAndCompressed(), TYPO3\CMS\Impexp\Import\writeFileVerify(), TYPO3\CMS\Core\Configuration\SiteWriter\writeSettings(), and TYPO3\CMS\Impexp\Import\writeSysFileRecords().

◆ writeFileToTypo3tempDir()

static string null TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir ( string  $filepath,
string  $content 
)
static

◆ xml2array()

static array string TYPO3\CMS\Core\Utility\GeneralUtility::xml2array ( string  $string,
string  $NSprefix = '',
bool  $reportDocTag = false 
)
static

Converts an XML string to a PHP array. This is the reverse function of array2xml() This is a wrapper for xml2arrayProcess that adds a two-level cache

Parameters
string$string‪XML content to convert into an array
string$NSprefix‪The tag-prefix resolve, eg. a namespace like "T3:"
bool$reportDocTag‪If set, the document tag will be set in the key "_DOCUMENT_TAG" of the output array
Returns
‪array|string If the parsing had errors, a string with the error message is returned. Otherwise an array with the content.
See also
‪array2xml()
xml2arrayProcess()

Definition at line 1265 of file GeneralUtility.php.

References TYPO3\CMS\Webhooks\Message\$identifier, and TYPO3\CMS\Core\Utility\GeneralUtility\xml2arrayProcess().

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForFlex(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\cleanFlexFormXML(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\convertDataStructureToArray(), TYPO3\CMS\Core\Service\FlexFormService\convertFlexFormContentToArray(), TYPO3\CMS\Core\DataHandling\DataHandler\copyRecord_procBasedOnFieldType(), TYPO3\CMS\Backend\View\ValueFormatter\FlexFormValueFormatter\format(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelationsFromFlexData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexPrepare\initializeDataValues(), TYPO3\CMS\Form\EventListener\DataStructureIdentifierListener\modifyDataStructureIdentifier(), TYPO3\CMS\Form\Controller\FormFrontendController\overrideByFlexFormSettings(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\readFlexformIntoConf(), TYPO3\CMS\Core\DataHandling\DataHandler\remapListedDBRecords(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\resolveFileDirectives(), and TYPO3\CMS\Core\DataHandling\DataHandler\updateFlexFormData().

◆ xml2arrayProcess()

static array string TYPO3\CMS\Core\Utility\GeneralUtility::xml2arrayProcess ( string  $string,
string  $NSprefix = '',
bool  $reportDocTag = false 
)
static

Converts an XML string to a PHP array. This is the reverse function of array2xml()

Parameters
string$string‪XML content to convert into an array
string$NSprefix‪The tag-prefix resolve, eg. a namespace like "T3:"
bool$reportDocTag‪If set, the document tag will be set in the key "_DOCUMENT_TAG" of the output array
Returns
‪array|string If the parsing had errors, a string with the error message is returned. Otherwise an array with the content.
See also
‪array2xml()

Definition at line 1288 of file GeneralUtility.php.

References $parser, and TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\xml2array().

◆ xmlRecompileFromStructValArray()

static string TYPO3\CMS\Core\Utility\GeneralUtility::xmlRecompileFromStructValArray ( array  $vals)
static

This implodes an array of XML parts (made with xml_parse_into_struct()) into XML again.

Parameters
array<int,array<string,mixed>>‪$vals An array of XML parts, see xml2tree
Returns
‪string Re-compiled XML data.

Definition at line 1394 of file GeneralUtility.php.

Member Data Documentation

◆ $container

ContainerInterface TYPO3\CMS\Core\Utility\GeneralUtility::$container = null
staticprotected

Definition at line 53 of file GeneralUtility.php.

◆ $currentLocale

TYPO3\CMS\Core\Utility\GeneralUtility::$currentLocale = setlocale(LC_MONETARY, '0')

Definition at line 569 of file GeneralUtility.php.

◆ $finalClassNameCache

array TYPO3\CMS\Core\Utility\GeneralUtility::$finalClassNameCache = []
staticprotected

Definition at line 75 of file GeneralUtility.php.

◆ $indpEnvCache

array TYPO3\CMS\Core\Utility\GeneralUtility::$indpEnvCache = []
staticprotected

Definition at line 80 of file GeneralUtility.php.

◆ $isValid

if ( $isValid) return TYPO3\CMS\Core\Utility\GeneralUtility::$isValid

Definition at line 649 of file GeneralUtility.php.

◆ $labelArr

if ( $base !==1000 &&$base !==1024) TYPO3\CMS\Core\Utility\GeneralUtility::$labelArr = explode('|', str_replace('"', '', $labels))

Definition at line 564 of file GeneralUtility.php.

◆ $localeInfo

TYPO3\CMS\Core\Utility\GeneralUtility::$localeInfo = localeconv()

Definition at line 572 of file GeneralUtility.php.

◆ $multiplier [1/2]

TYPO3\CMS\Core\Utility\GeneralUtility::$multiplier = floor(($sizeInBytes ? log($sizeInBytes) : 0) / log($base))

Definition at line 576 of file GeneralUtility.php.

◆ $multiplier [2/2]

if ( $sizeInUnits >( $base *.9)) TYPO3\CMS\Core\Utility\GeneralUtility::$multiplier = min($multiplier, count($labelArr) - 1)

Definition at line 581 of file GeneralUtility.php.

◆ $nl

TYPO3\CMS\Core\Utility\GeneralUtility::$nl = $spaceInd >= 0 ? LF : ''

Definition at line 1157 of file GeneralUtility.php.

◆ $nonSingletonInstances

array TYPO3\CMS\Core\Utility\GeneralUtility::$nonSingletonInstances = []
staticprotected

Definition at line 67 of file GeneralUtility.php.

◆ $oldLocale

TYPO3\CMS\Core\Utility\GeneralUtility::$oldLocale = setlocale(LC_NUMERIC, '0')

Definition at line 570 of file GeneralUtility.php.

◆ $output [1/2]

TYPO3\CMS\Core\Utility\GeneralUtility::$output = ''

Definition at line 1159 of file GeneralUtility.php.

◆ $output [2/2]

foreach ( $array as $k=> $v) if (! $level) return TYPO3\CMS\Core\Utility\GeneralUtility::$output

Definition at line 1250 of file GeneralUtility.php.

◆ $singletonInstances

array TYPO3\CMS\Core\Utility\GeneralUtility::$singletonInstances = []
staticprotected

Definition at line 60 of file GeneralUtility.php.

◆ $sizeInBytes

TYPO3\CMS\Core\Utility\GeneralUtility::$sizeInBytes = max($sizeInBytes, 0)

Definition at line 575 of file GeneralUtility.php.

◆ $sizeInUnits

TYPO3\CMS\Core\Utility\GeneralUtility::$sizeInUnits = $sizeInBytes / $base ** $multiplier

Definition at line 577 of file GeneralUtility.php.

◆ $spaceInd

array<array-key, function explodeUrl2Array(string $string): array { $output = []; $p = explode('&', $string); foreach ($p as $v) { if ($v !== '') { $nameAndValue = explode('=', $v, 2); $output[rawurldecode($nameAndValue[0])] = isset($nameAndValue[1]) ? rawurldecode($nameAndValue[1]) : ''; } } return $output; } public static array function removeDotsFromTS(array $ts): array { $out = []; foreach ($ts as $key => $value) { if (is_array($value)) { $key = rtrim($key, '.'); $out[$key] = self::removeDotsFromTS($value); } else { $out[$key] = $value; } } return $out; } public static array<string, function get_tag_attributes(string $tag, bool $decodeEntities = false): array { $components = self::split_tag_attributes($tag); $name = ''; $valuemode = false; $attributes = []; foreach ($components as $key => $val) { if ($val !== '=') { if ($valuemode) { if ($name) { $attributes[$name] = $decodeEntities ? htmlspecialchars_decode($val) : $val; $name = ''; } } else { if ($key = strtolower(preg_replace('/[^[:alnum:]_\\:\\-]/', '', $val) ?? '')) { $attributes[$key] = ''; $name = $key; } } $valuemode = false; } else { $valuemode = true; } } return $attributes; } public static string[] function split_tag_attributes(string $tag): array { $tag_tmp = trim(preg_replace('/^<[^[:space:]]*/', '', trim($tag)) ?? ''); $tag_tmp = trim(rtrim($tag_tmp, '>')); $value = []; while ($tag_tmp !== '') { $firstChar = $tag_tmp[0]; if ($firstChar === '"' || $firstChar === '\'') { $reg = explode($firstChar, $tag_tmp, 3); $value[] = $reg[1]; $tag_tmp = trim($reg[2] ?? ''); } elseif ($firstChar === '=') { $value[] = '='; $tag_tmp = trim(substr($tag_tmp, 1)); } else { $reg = preg_split('/[[:space:]=]/', $tag_tmp, 2); $value[] = trim($reg[0]); $tag_tmp = trim(substr($tag_tmp, strlen($reg[0]), 1) . ($reg[1] ?? '')); } } reset($value); return $value; } public static string function implodeAttributes(array $arr, bool $xhtmlSafe = false, bool $keepBlankAttributes = false): string { if ($xhtmlSafe) { $newArr = []; foreach ($arr as $attributeName => $attributeValue) { $attributeName = strtolower($attributeName); if (!isset($newArr[$attributeName])) { $newArr[$attributeName] = htmlspecialchars((string)$attributeValue); } } $arr = $newArr; } $list = []; foreach ($arr as $attributeName => $attributeValue) { if ((string)$attributeValue !== '' || $keepBlankAttributes) { $list[] = $attributeName . '="' . $attributeValue . '"'; } } return implode(' ', $list); } public static string function wrapJS(string $string, array $attributes = []): string { if (trim($string)) { $string = ltrim($string, LF); $match = []; if (preg_match('/^(\\t+)/', $string, $match)) { $string = str_replace($match[1], "\t", $string); } return '<script ' . GeneralUtility::implodeAttributes($attributes, true) . '>' . $string . '</script>'; } return ''; } public static array|string function xml2tree(string $string, int $depth = 999, array $parserOptions = []): array|string { $parser = xml_parser_create(); $vals = []; $index = []; xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); foreach ($parserOptions as $option => $value) { xml_parser_set_option($parser, $option, $value); } xml_parse_into_struct($parser, $string, $vals, $index); if (xml_get_error_code($parser)) { return 'Line ' . xml_get_current_line_number($parser) . ': ' . xml_error_string(xml_get_error_code($parser)); } xml_parser_free($parser); $stack = [[]]; $stacktop = 0; $startPoint = 0; $tagi = []; foreach ($vals as $key => $val) { $type = $val['type']; if ($type === 'open' || $type === 'complete') { $stack[$stacktop++] = $tagi; if ($depth == $stacktop) { $startPoint = $key; } $tagi = ['tag' => $val['tag']]; if (isset($val['attributes'])) { $tagi['attrs'] = $val['attributes']; } if (isset($val['value'])) { $tagi['values'][] = $val['value']; } } if ($type === 'complete' || $type === 'close') { $oldtagi = $tagi; $tagi = $stack[--$stacktop]; $oldtag = $oldtagi['tag']; unset($oldtagi['tag']); if ($depth == $stacktop + 1) { if ($key - $startPoint > 0) { $partArray = array_slice($vals, $startPoint + 1, $key - $startPoint - 1); $oldtagi['XMLvalue'] = self::xmlRecompileFromStructValArray($partArray); } else { $oldtagi['XMLvalue'] = $oldtagi['values'][0]; } } $tagi['ch'][$oldtag][] = $oldtagi; unset($oldtagi); } if ($type === 'cdata') { $tagi['values'][] = $val['value']; } } return $tagi['ch']; } public static string function array2xml(array $array, string $NSprefix = '', int $level = 0, string $docTag = 'phparray', int $spaceInd = 0, array $options = [], array $stackData = []): string { $binaryChars = "\0" . chr(1) . chr(2) . chr(3) . chr(4) . chr(5) . chr(6) . chr(7) . chr(8) . chr(11) . chr(12) . chr(14) . chr(15) . chr(16) . chr(17) . chr(18) . chr(19) . chr(20) . chr(21) . chr(22) . chr(23) . chr(24) . chr(25) . chr(26) . chr(27) . chr(28) . chr(29) . chr(30) . chr(31); $indentChar = $spaceInd ? ' ' : "\t"; $indentN = $spaceInd > TYPO3\CMS\Core\Utility\GeneralUtility::$spaceInd
static

Explodes a string with GETvars (eg. "&id=1&type=2&ext[mykey]=3") into an array.

Note! If you want to use a multi-dimensional string, consider this plain simple PHP code instead:

$result = []; parse_str($queryParametersAsString, $result);

However, if you do magic with a flat structure (e.g. keeping "ext[mykey]" as flat key in a one-dimensional array) then this method is for you.

Parameters
string$string‪GETvars string
Returns
‪array<array-key, string> Array of values. All values AND keys are rawurldecoded() as they properly should be. But this means that any implosion of the array again must rawurlencode it!
See also
implodeArrayForUrl()

Definition at line 1156 of file GeneralUtility.php.

◆ else

if (empty( $labels)) if (isset( $defaultFormats[ $labels])) TYPO3\CMS\Core\Utility\GeneralUtility::else
Initial value:
{
$base = (int)$base

Definition at line 559 of file GeneralUtility.php.