‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Utility\GeneralUtility Class Reference
Inheritance diagram for TYPO3\CMS\Core\Utility\GeneralUtility:
TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture

Static Public Member Functions

static mixed _GP ($var)
 
static array _GPmerged ($parameter)
 
static mixed _GET ($var=null)
 
static mixed _POST ($var=null)
 
static string fixed_lgd_cs (string $string, int $chars, string $appendString='...')
 
static bool cmpIP ($baseIP, $list)
 
static bool cmpIPv4 ($baseIP, $list)
 
static bool cmpIPv6 ($baseIP, $list)
 
static string normalizeIPv6 ($address)
 
static bool validIP ($ip)
 
static bool validIPv4 ($ip)
 
static bool validIPv6 ($ip)
 
static bool cmpFQDN ($baseHost, $list)
 
static bool isOnCurrentHost ($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( $email) { if(!is_string( $email)) { return false;} 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;} } return(new 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 ($url)
 
static int[] intExplode ($delimiter, $string, $removeEmptyValues=false, $limit=0)
 
static list< string > revExplode ($delimiter, $string, $limit=0)
 
static list< string > trimExplode ($delim, $string, $removeEmptyValues=false, $limit=0)
 
static string implodeArrayForUrl ($name, array $theArray, $str='', $skipBlank=false, $rawurlencodeParamName=false)
 
static mixed xml2array ($string, $NSprefix='', $reportDocTag=false)
 
static mixed xml2arrayProcess ($string, $NSprefix='', $reportDocTag=false)
 
static string xmlRecompileFromStructValArray (array $vals)
 
static string false getUrl ($url)
 
static bool writeFile ($file, $content, $changePermissions=false)
 
static mixed fixPermissions ($path, $recursive=false)
 
static string null writeFileToTypo3tempDir ($filepath, $content)
 
static bool mkdir ($newFolder)
 
static mkdir_deep ($directory)
 
static bool rmdir ($path, $removeNonEmpty=false)
 
static string[] string null get_dirs ($path)
 

Public Attributes

static if(empty($labels)) if(isset($defaultFormats[$labels])) else
 
if($base !==1000 && $base !==1024) $labelArr = explode('|', str_replace('"', '', $labels))
 
 $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)
 
 $nl = $spaceInd >= 0 ? LF : ''
 
 $output = ''
 
foreach($array as $k=> $v) if(! $level) return $output
 

Static Public Attributes

static array< string, function explodeUrl2Array( $string) { $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( $tag, bool $decodeEntities=false) { $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( $tag) { $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, $xhtmlSafe = false, $keepBlankAttributes = false) { 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 = []) { 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 mixed function xml2tree($string, $depth = 999, $parserOptions = []) { $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, $NSprefix = '', $level = 0, $docTag = 'phparray', $spaceInd = 0, array $options = [], array $stackData = []) { $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 ($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 50 of file GeneralUtility.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 81 of file GeneralUtility.php.

Member Function Documentation

◆ _GET()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::_GET (   $var = null)
static

Returns the global $_GET array (or value from) normalized to contain un-escaped values. This function was previously used to normalize between magic quotes logic, which was removed from PHP 5.5

Parameters
string$var‪Optional pointer to value in GET array (basically name of GET var)
Returns
‪mixed If $var is set it returns the value of $_GET[$var]. If $var is NULL (default), returns $_GET itself.

Definition at line 155 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\canRetrieveGlobalInputsThroughGet(), TYPO3\CMS\Core\Http\ServerRequestFactory\fromGlobals(), and TYPO3\CMS\Install\ViewHelpers\Uri\ActionViewHelper\renderStatic().

◆ _GP()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::_GP (   $var)
static

Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST, which is equivalent to 'GP' order In case you already know by which method your data is arriving consider using GeneralUtility::_GET or GeneralUtility::_POST.

Parameters
string$var‪GET/POST var to return
Returns
‪mixed POST var named $var, if not set, the GET var of the same name and if also not set, NULL.
Deprecated:
‪since TYPO3 v12.3. will be removed in TYPO3 v13.0.

Definition at line 107 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\canRetrieveValueWithGP(), and TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher\determinePageId().

◆ _GPmerged()

static array TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged (   $parameter)
static

Returns the global arrays $_GET and $_POST merged with $_POST taking precedence.

Parameters
string$parameter‪Key (variable name) from GET or POST vars
Returns
‪array Returns the GET vars merged recursively onto the POST vars.
Deprecated:
‪since TYPO3 v12.2. will be removed in TYPO3 v13.0.

Definition at line 134 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\gpMergedWillMergeArraysFromGetAndPost().

◆ _POST()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::_POST (   $var = null)
static

Returns the global $_POST array (or value from) normalized to contain un-escaped values.

Parameters
string$var‪Optional pointer to value in POST array (basically name of POST var)
Returns
‪mixed If $var is set it returns the value of $_POST[$var]. If $var is NULL (default), returns $_POST itself.
Deprecated:
‪since TYPO3 v12.2. will be removed in TYPO3 v13.0.

Definition at line 174 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\canRetrieveGlobalInputsThroughPost().

◆ camelCaseToLowerCaseUnderscored()

◆ cmpFQDN()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::cmpFQDN (   $baseHost,
  $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 451 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 (   $baseIP,
  $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 223 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 (   $baseIP,
  $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 245 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 (   $baseIP,
  $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 294 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 (   $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.

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

Definition at line 1779 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 544 of file GeneralUtility.php.

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

◆ 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 202 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\Core\TimeTracker\TimeTracker\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\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\Core\TimeTracker\TimeTracker\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\EmailElement\render(), TYPO3\CMS\Backend\Form\Element\ColorElement\render(), TYPO3\CMS\Backend\Form\Element\NumberElement\render(), TYPO3\CMS\Backend\Form\Element\DatetimeElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\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 mixed TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions (   $path,
  $recursive = false 
)
static

Sets the file system mode and group ownership of a file or a folder.

Parameters
string$path‪Path of file or folder, must not be escaped. Path can be absolute or relative
bool$recursive‪If set, also fixes permissions of files and folders in the folder (if $path is a folder)
Returns
‪mixed TRUE on success, FALSE on error, always TRUE on Windows OS

Definition at line 1594 of file GeneralUtility.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\PathUtility\isAbsolutePath(), and TYPO3\CMS\Core\Core\Environment\isWindows().

Referenced by TYPO3\CMS\Core\Locking\FileLockStrategy\acquire(), TYPO3\CMS\Core\Locking\SimpleLockStrategy\acquire(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\addFile(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\combineExec(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\copyFileWithinStorage(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\copyFolderWithinStorage(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\createFile(), TYPO3\CMS\Install\Service\EnableFileService\createInstallToolEnableFile(), TYPO3\CMS\Core\Mail\MboxTransport\doSend(), TYPO3\CMS\Core\Service\Archive\ZipService\extract(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsCorrectlySetsPermissionsRecursive(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsDoesNotSetPermissionsToNotAllowedPath(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsDefaultPermissionsToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsDefaultPermissionsToFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsGroup(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToHiddenDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToHiddenFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsWithRelativeFileReference(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\YouTubeHelper\getPreviewImage(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\VimeoHelper\getPreviewImage(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\gifCompress(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\imageMagickExec(), TYPO3\CMS\Install\Controller\EnvironmentController\imageProcessingTrueTypeAction(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\ImageWrite(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\readPngGif(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\replaceFile(), TYPO3\CMS\Core\Cache\Backend\FileBackend\set(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\set(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\unzipExtensionFromFile(), TYPO3\CMS\Install\Service\LanguagePackService\unzipTranslationFile(), and TYPO3\CMS\Install\Service\Session\FileSessionHandler\write().

◆ get_dirs()

static string [] string null TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs (   $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 1863 of file GeneralUtility.php.

References $dir.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsArrayOfDirectoriesFromGivenDirectory(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsStringErrorOnPathFailure().

◆ getUrl()

static string false TYPO3\CMS\Core\Utility\GeneralUtility::getUrl (   $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 1542 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\Indexer\indexExternalUrl(), 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)

Definition at line 584 of file GeneralUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataToFormElementPropertyConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataToPropertyCollectionElementConverter\__invoke(), TYPO3\CMS\Core\Authentication\Mfa\Provider\TotpProvider\activate(), TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodesProvider\activate(), TYPO3\CMS\Core\Tests\Functional\Authentication\Mfa\Provider\RecoveryCodesProviderTest\activateTest(), TYPO3\CMS\Core\Tests\Functional\Authentication\Mfa\Provider\TotpProviderTest\activateTest(), TYPO3\CMS\Backend\Controller\LinkBrowserController\areFieldChangeFunctionsValid(), TYPO3\CMS\Install\Controller\BackendModuleController\backendUserConfirmationAction(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\changePasswordAction(), TYPO3\CMS\Form\Domain\Configuration\FormDefinitionValidationService\checkHmacDataIntegrity(), TYPO3\CMS\Backend\Controller\FormSlugAjaxController\checkRequest(), TYPO3\CMS\Core\Page\ImportMap\computeImportMaps(), TYPO3\CMS\Form\Tests\Unit\Mvc\Property\TypeConverter\FormDefinitionArrayConverterTest\convertFromThrowsExceptionIfIdentifierWasChanged(), TYPO3\CMS\Form\Tests\Unit\Mvc\Property\TypeConverter\FormDefinitionArrayConverterTest\convertFromThrowsExceptionIfPrototypeNameWasChanged(), TYPO3\CMS\Form\Tests\Unit\Mvc\Property\TypeConverter\FormDefinitionArrayConverterTest\convertsJsonStringToFormDefinitionArray(), TYPO3\CMS\Fluid\ViewHelpers\Link\FileViewHelper\createFileDumpUrl(), TYPO3\CMS\Backend\Controller\File\ThumbnailController\extractParameters(), TYPO3\CMS\Backend\Controller\SiteInlineAjaxController\extractSignedParentConfigFromRequest(), TYPO3\CMS\Backend\Controller\FormFilesAjaxController\extractSignedParentConfigFromRequest(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\extractSignedParentConfigFromRequest(), TYPO3\CMS\Backend\Authentication\PasswordReset\findValidUserForToken(), TYPO3\CMS\Core\Middleware\AbstractContentSecurityPolicyReporter\generateReportSummary(), TYPO3\CMS\Backend\Authentication\PasswordReset\generateResetLinkForUser(), TYPO3\CMS\Backend\Security\ContentSecurityPolicy\CspAjaxController\generateResolutionSummary(), TYPO3\CMS\Backend\Tests\Unit\Controller\File\ThumbnailControllerTest\generateThumbnailIsInvoked(), TYPO3\CMS\Core\FormProtection\AbstractFormProtection\generateToken(), TYPO3\CMS\Install\Controller\BackendModuleController\getBackendUserConfirmationRedirect(), TYPO3\CMS\Form\Slot\FilePersistenceSlot\getContentSignature(), TYPO3\CMS\Backend\Tests\Functional\Controller\FormInlineAjaxControllerTest\getContextForSysLanguageUid(), TYPO3\CMS\Core\Log\Writer\FileWriter\getDefaultLogFileName(), TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getModuleData(), TYPO3\CMS\Core\Resource\ResourceStorage\getPublicUrl(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\getSessionSavePath(), TYPO3\CMS\Form\Slot\ResourcePublicationSlot\getStreamUrl(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\getWizardPayload(), TYPO3\CMS\Core\Authentication\Mfa\Provider\RecoveryCodesProvider\handleRequest(), TYPO3\CMS\Backend\Tests\Functional\Controller\MfaSetupControllerTest\handleRequestActivatesRequestedProvider(), TYPO3\CMS\Backend\Tests\Functional\Controller\MfaConfigurationControllerTest\handleRequestForwardsToCorrectActionTest(), TYPO3\CMS\Backend\Tests\Functional\Controller\MfaSetupControllerTest\handleRequestRedirectsWithErrorOnActivationFailure(), TYPO3\CMS\Install\Controller\ServerResponseCheckController\hmac(), TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationSuggestion\hmac(), TYPO3\CMS\RteCKEditor\Controller\ResourceController\hmac(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsEqualHashesForEqualInput(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsHashOfProperLength(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsNoEqualHashesForNonEqualInput(), TYPO3\CMS\Form\Mvc\Property\TypeConverter\UploadedFileReferenceConverter\importUploadedResource(), TYPO3\CMS\Install\Controller\LayoutController\initAction(), TYPO3\CMS\Install\Controller\InstallerController\initAction(), TYPO3\CMS\Frontend\Controller\ShowImageController\initialize(), TYPO3\CMS\Form\Domain\Configuration\FormDefinitionValidationService\isPropertyValueEqualToHistoricalValue(), TYPO3\CMS\Backend\Controller\Wizard\ImageManipulationController\isSignatureValid(), TYPO3\CMS\Core\Controller\FileDumpController\isTokenValid(), TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationSuggestion\jsonSerialize(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\notifyPasswordChange(), TYPO3\CMS\Core\Authentication\Mfa\Provider\TotpProvider\prepareSetupView(), TYPO3\CMS\Core\Hooks\BackendUserPasswordCheck\processDatamap_preProcessFieldArray(), TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\pushModuleData(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\recoveryAction(), TYPO3\CMS\Backend\Form\FieldControl\LinkPopup\render(), TYPO3\CMS\Backend\Form\FieldControl\EditPopup\render(), TYPO3\CMS\Backend\Form\Container\SiteLanguageContainer\render(), TYPO3\CMS\Backend\Form\Element\InputSlugElement\render(), TYPO3\CMS\Backend\Form\Container\InlineControlContainer\render(), TYPO3\CMS\Backend\Form\Container\FilesControlContainer\render(), TYPO3\CMS\Core\Tests\Unit\FormProtection\InstallToolFormProtectionTest\tokenFromSessionDataIsAvailableForValidateToken(), TYPO3\CMS\Core\Tests\Unit\FormProtection\BackendFormProtectionTest\tokenFromSessionDataIsAvailableForValidateToken(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllFormElementPropertyValuesByHmacThrowsExceptionIfHmacIsInvalid(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllFormElementPropertyValuesByHmacThrowsNoExceptionIfHmacIsValid(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllPropertyCollectionElementValuesByHmacThrowsExceptionIfHmacDoesNotExists(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllPropertyCollectionElementValuesByHmacThrowsExceptionIfHmacIsInvalid(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllPropertyCollectionElementValuesByHmacThrowsNoExceptionIfHmacIsValid(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllPropertyValuesFromCreatableFormElementDataProvider(), TYPO3\CMS\Form\Tests\Unit\Domain\Configuration\FormDefinitionValidationServiceTest\validateAllPropertyValuesFromCreatablePropertyCollectionElementDataProvider(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateIfHashHasExpired(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateNewPassword(), and TYPO3\CMS\Core\FormProtection\AbstractFormProtection\validateToken().

◆ implodeArrayForUrl()

static string TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl (   $name,
array  $theArray,
  $str = '',
  $skipBlank = false,
  $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 954 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlBuildsValidParameterString(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlCanSkipEmptyParameters(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlCanUrlEncodeKeyNames().

◆ 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 532 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\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\Belog\Domain\Repository\LogEntryRepository\deleteByMessageDetails(), TYPO3\CMS\Impexp\Export\exportAddFile(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\getProcessedValueExtra(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\getQueryBuilder(), TYPO3\CMS\Core\TypoScript\TemplateService\getRootlineLevel(), 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\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider\getUsergroupFunction(), 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\IndexedSearch\Utility\IndexedSearchUtility\isTableUsed(), 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\Migrations\TcaMigration\migrateEmailFlagToEmailType(), TYPO3\CMS\Core\Migrations\TcaMigration\migrateEvalIntAndDouble2ToTypeNumber(), TYPO3\CMS\Core\Migrations\TcaMigration\migrateNullFlag(), TYPO3\CMS\Core\Migrations\TcaMigration\migratePasswordAndSaltedPasswordToPasswordType(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\modAccess(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_exec_query(), TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate(), 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\FieldWizard\DefaultLanguageDifferences\render(), TYPO3\CMS\Backend\Form\FieldWizard\OtherLanguageThumbnails\render(), TYPO3\CMS\Backend\Form\Container\SingleFieldContainer\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\Core\Html\RteHtmlParser\TS_transform_rte(), and TYPO3\CMS\Core\Authentication\BackendUserAuthentication\workspaceCheckStageForCurrent().

◆ intExplode()

static int [] TYPO3\CMS\Core\Utility\GeneralUtility::intExplode (   $delimiter,
  $string,
  $removeEmptyValues = false,
  $limit = 0 
)
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
int$limit
Deprecated:
‪will be removed in TYPO3 v13.0 without replacement. If positive, the result will contain a maximum of $limit elements.
Returns
‪int[] Exploded values, all converted to integers

Definition at line 842 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\Core\Imaging\GraphicalFunctions\adjust(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\calcTextCordsForMap(), TYPO3\CMS\Core\DataHandling\DataHandler\canDeletePage(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\cleanInputVal(), TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility\collectPages(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\collectRecordsFromCategories(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\copyGifOntoGif(), TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\countRecords(), TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory\create(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\crop(), TYPO3\CMS\Core\DataHandling\DataHandler\deletePages(), 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\Backend\Controller\PageLayoutController\getActiveColumnsArray(), 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\Core\Domain\Repository\PageRepository\getDescendantPageIdsRecursive(), 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\FrontendLogin\Controller\AbstractLoginFormController\getStorageFolders(), TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateTreeBuilder\handleIncludeBasedOnTemplates(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\IMparams(), TYPO3\CMS\Backend\Tree\View\BrowseTreeView\init(), 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\Core\Tests\Unit\Utility\GeneralUtilityTest\intExplodeReturnsExplodedArray(), TYPO3\CMS\Recycler\Domain\Model\DeletedRecords\loadData(), TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\lostRecords(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeBox(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeEllipse(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeEmboss(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeOptionList(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\makeSelectorTable(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeShadow(), TYPO3\CMS\Backend\Controller\PageLayoutController\makeViewButton(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\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\Plugin\AbstractPlugin\pi_exec_query(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_getCategoryTableContents(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_getPidList(), 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\Core\TypoScript\TemplateService\processTemplate(), 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\Core\Imaging\GraphicalFunctions\setWorkArea(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\splitString(), TYPO3\CMS\Frontend\Imaging\GifBuilder\start(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\start(), TYPO3\CMS\Backend\RecordList\DatabaseRecordList\start(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\txtPosition(), TYPO3\CMS\Beuser\Controller\PermissionController\updateAction(), and TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\userConstraints().

◆ isOnCurrentHost()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::isOnCurrentHost (   $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 519 of file GeneralUtility.php.

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

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

◆ 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($email) { if (!is_string($email)) { return false; } 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; } } return (new 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 (   $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 797 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\Install\Command\SetupCommand\getSiteSetup(), TYPO3\CMS\FrontendLogin\Validation\RedirectUrlValidator\isInLocalDomain(), TYPO3\CMS\Extbase\Validation\Validator\UrlValidator\isValid(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsFalseForInvalidResource(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsTrueForValidResource().

◆ md5int()

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

◆ mkdir()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::mkdir (   $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 1736 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\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\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\copyExtensionFolderToTempFolder(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\copyFolderWithinStorage(), TYPO3\CMS\Core\Utility\GeneralUtility\createDirectoryPath(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\createFolder(), 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\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsCorrectlySetsPermissionsRecursive(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsDefaultPermissionsToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToHiddenDirectory(), 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\Extensionmanager\Utility\InstallUtility\importInitialFiles(), TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importMultipleImagesWithMultipleStorages(), TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesAndNewStorage(), TYPO3\CMS\Extensionmanager\Utility\InstallUtility\importSiteConfiguration(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\importT3DFileDoesNotImportFileIfAlreadyImported(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesDirectoryWithTrailingSlash(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesHiddenDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirSetsPermissionsOfCreatedDirectory(), 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 (   $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 1753 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\__construct(), TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Hooks\PagesTsConfigGuardTest\addSiteConfiguration(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\buildFileDeclarations(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\clearAssetsFolderClearsFolder(), TYPO3\CMS\Extensionmanager\Tests\Unit\Controller\ActionControllerTest\createFakeExtension(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\createFakeExtension(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\createFakeExtension(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\createFinalCacheDirectory(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\createFolder(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\createNestedDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\createVersionNumberedFilenameDoesNotResolveBackpathForAbsolutePath(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\createVersionNumberedFilenameKeepsInvalidAbsolutePathInFrontendAndAddsQueryString(), TYPO3\CMS\Core\Core\ClassLoadingInformation\ensureAutoloadInfoDirExists(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\ensureSessionSavePathExists(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\AbstractNodeTest\existsReturnsTrueIfIsLinkAndTargetIsDead(), TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\getDefaultUploadFolderFallsBackToDefaultStorage(), 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\Core\Tests\Unit\Http\StreamTest\getTestDirectory(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\AbstractFolderStructureTestCase\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\Imaging\GraphicalFunctions\imageMagickConvert(), 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\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectoryWithDoubleSlashes(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesSubdirectoriesRecursive(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepFixesPermissionsOfCreatedDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepFixesPermissionsOnNewParentDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepThrowsExceptionIfBaseDirectoryIsNotOfTypeString(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepThrowsExceptionIfDirectoryCreationFails(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\randomName(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\readPngGif(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\removeDirectoryDoesNotRemoveContentOfSymlinkedTargetDirectory(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceFactoryTest\retrieveFileOrFolderObjectReturnsFileFromPublicFolderWhenProjectRootIsNotPublic(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDeadLinkToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectoryWithTrailingSlash(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesFile(), 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\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\setUp(), TYPO3\CMS\Webhooks\Tests\Functional\WebhookExecutionTest\setUp(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\TitleTagRenderingTest\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataScenarios\AbstractDataHandlerActionTestCase\setUpFrontendSite(), 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\SiteConfiguration\write(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\writeOnlyWritesModifiedKeys(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\writingOfNestedStructuresPreservesOrder(), and TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\writingPlaceholdersIsHandled().

◆ normalizeIPv6()

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

Normalize an IPv6 address to full length

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

Definition at line 349 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 (   $delimiter,
  $string,
  $limit = 0 
)
static

◆ rmdir()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::rmdir (   $path,
  $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 1806 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\Resource\Driver\LocalDriver\copyFolderWithinStorage(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\createVersionNumberedFilenameKeepsInvalidAbsolutePathInFrontendAndAddsQueryString(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\deleteFolder(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\diCachesDoesNotWarmSystemCaches(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\flush(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys(), TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\getDefaultUploadFolderFallsBackToDefaultStorage(), 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\Unit\Utility\GeneralUtilityTest\rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDeadLinkToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDeadLinkToFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectoriesRecursiveAndReturnsTrue(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectoryWithTrailingSlash(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesLinkToDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirReturnFalseIfNoFileWasRemoved(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirReturnTrueIfFileWasRemoved(), 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 (   $delim,
  $string,
  $removeEmptyValues = false,
  $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

Definition at line 916 of file GeneralUtility.php.

Referenced by TYPO3\CMS\FrontendLogin\Configuration\RedirectConfiguration\__construct(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\__construct(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\__construct(), TYPO3\CMS\Scheduler\CronCommand\CronCommand\__construct(), TYPO3\CMS\Filelist\FileList\__construct(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\__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\Frontend\Typolink\LinkFactory\addSecurityRelValues(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addService(), TYPO3\CMS\Backend\Controller\EditDocumentController\addSlugFieldsToColumnsOnly(), TYPO3\CMS\IndexedSearch\Indexer\addSpacesToKeywordList(), TYPO3\CMS\Core\TypoScript\IncludeTree\TreeFromLineStreamBuilder\addStaticMagicFromGlobals(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes(), TYPO3\CMS\Backend\FrontendBackendUserAuthentication\allowedToEdit(), 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\Configuration\Loader\PageTsConfigLoader\collect(), TYPO3\CMS\Core\DependencyInjection\MessageHandlerPass\collectHandlers(), TYPO3\CMS\Core\DependencyInjection\ListenerProviderPass\collectListeners(), TYPO3\CMS\Core\DependencyInjection\MessengerMiddlewarePass\collectMiddlewares(), TYPO3\CMS\Extbase\Utility\ExtensionUtility\configurePlugin(), 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\Core\Resource\Driver\LocalDriver\createFolder(), TYPO3\CMS\Backend\Form\Container\PaletteAndSingleContainer\createPaletteContentArray(), 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\Controller\FileDumpController\dumpAction(), TYPO3\CMS\Backend\Http\RouteDispatcher\enforceReferrer(), TYPO3\CMS\Core\TypoScript\AST\AbstractAstBuilder\evaluateValueModifier(), 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\Core\TypoScript\Parser\TypoScriptParser\executeValueModifier(), 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\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\FrontendBackendUserAuthentication\getAllowedEditActions(), 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\View\BackendLayoutView\getColPosListItemsParsed(), TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator\getCurrentPageCacheConfiguration(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\getDataStructureIdentifierFromRecord(), 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\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\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\getInlineRelatedRecordsUidArray(), TYPO3\CMS\Core\Html\RteHtmlParser\getKeepTags(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider\getLoginUserFunction(), 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\Core\TypoScript\IncludeTree\TsConfigTreeBuilder\getPagesTsConfigTree(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getPathFromPageId(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\getPlaceholderValue(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRawRecord(), 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\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\Backend\Controller\Page\NewMultiplePagesController\getTypeSelectData(), TYPO3\CMS\Workspaces\Hook\DataHandlerHook\getUniqueFields(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider\getUsergroupFunction(), TYPO3\CMS\Backend\Form\AbstractNode\getValidationDataAsJsonString(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getWizards(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getWorkspaceVersionOfRecord(), 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\handleSingleIncludeStaticFile(), TYPO3\CMS\Install\Updates\BackendModulePermissionMigration\hasRecordsToUpdate(), TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), 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\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\Migrations\TcaMigration\migrateEmailFlagToEmailType(), TYPO3\CMS\Core\Migrations\TcaMigration\migrateEvalIntAndDouble2ToTypeNumber(), TYPO3\CMS\Core\Migrations\TcaMigration\migrateNullFlag(), TYPO3\CMS\Core\Migrations\TcaMigration\migratePasswordAndSaltedPasswordToPasswordType(), TYPO3\CMS\Core\Migrations\TcaMigration\migrateRenderTypeInputDateTimeToTypeDatetime(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideConfigurationFromFlexForm(), TYPO3\CMS\Impexp\Command\ImportCommand\parseAssociativeArray(), 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\Frontend\Plugin\AbstractPlugin\pi_classParam(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_exec_query(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_getLL(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_isOnlyFields(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_loadLL(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_prependFieldsWithTable(), 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\Impexp\Tests\Functional\Export\ExportPageTreeViewTest\printTreeSucceeds(), TYPO3\CMS\Core\TimeTracker\TimeTracker\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\redirectModeRefererDomains(), 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\removeFieldsByBitmaskExcludeBits(), 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\Form\Container\ListOfFieldsContainer\render(), TYPO3\CMS\Backend\Form\Container\FullRecordContainer\render(), TYPO3\CMS\Backend\Form\FieldWizard\TableList\render(), TYPO3\CMS\Backend\Form\FieldControl\ListModule\render(), TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser\render(), TYPO3\CMS\Backend\Form\FieldControl\AddRecord\render(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\render(), TYPO3\CMS\Backend\Form\Element\EmailElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\InputSlugElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Backend\Form\Element\TextTableElement\render(), TYPO3\CMS\Backend\ElementBrowser\DatabaseBrowser\render(), TYPO3\CMS\Backend\Form\Container\FilesControlContainer\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\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\Domain\Repository\AdministrationRepository\saveKeywords(), 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\Core\Imaging\GraphicalFunctions\splitString(), TYPO3\CMS\Core\Database\RelationHandler\start(), TYPO3\CMS\IndexedSearch\Controller\AdministrationController\statisticDetailsAction(), 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\Tests\Unit\Utility\GeneralUtilityTest\trimExplodeReturnsCorrectResult(), TYPO3\CMS\Core\Utility\StringUtility\uniqueList(), 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(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateIfHashHasExpired(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

◆ 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 755 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(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\ColumnMapFactoryTest\setTypeDetectsTypeProperly(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToLowerCamelCase().

◆ 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 743 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToUpperCamelCase().

◆ validIP()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::validIP (   $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 413 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 (   $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 426 of file GeneralUtility.php.

◆ validIPv6()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::validIPv6 (   $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 439 of file GeneralUtility.php.

◆ writeFile()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::writeFile (   $file,
  $content,
  $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 1567 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Hooks\PagesTsConfigGuardTest\addSiteConfiguration(), 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\IndexedSearch\Indexer\indexExternalUrl(), 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\Webhooks\Tests\Functional\WebhookExecutionTest\setUp(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\TitleTagRenderingTest\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataScenarios\AbstractDataHandlerActionTestCase\setUpFrontendSite(), TYPO3\CMS\Core\Configuration\SiteConfiguration\write(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\writeEmConfToFile(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\writeExtensionFiles(), TYPO3\CMS\Core\Resource\ResourceCompressor\writeFileAndCompressed(), TYPO3\CMS\Impexp\Import\writeFilesToTemporaryFolder(), TYPO3\CMS\Impexp\Import\writeFileVerify(), TYPO3\CMS\Core\Configuration\SiteConfiguration\writeSettings(), and TYPO3\CMS\Impexp\Import\writeSysFileRecords().

◆ writeFileToTypo3tempDir()

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

Writes $content to a filename in the typo3temp/ folder (and possibly one or two subfolders...) Accepts an additional subdirectory in the file path!

Parameters
string$filepath‪Absolute file path to write within the typo3temp/ or Environment::getVarPath() folder - the file path must be prefixed with this path
string$content‪Content string to write
Returns
‪string|null Returns NULL on success, otherwise an error string telling about the problem.

Reimplemented in TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture.

Definition at line 1659 of file GeneralUtility.php.

References TYPO3\CMS\Core\Core\Environment\getProjectPath(), TYPO3\CMS\Core\Core\Environment\getPublicPath(), and TYPO3\CMS\Core\Core\Environment\getVarPath().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper\createNewFile(), TYPO3\CMS\Extensionmanager\Remote\TerExtensionRemote\fetchPackageList(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsWithRelativeFileReference(), TYPO3\CMS\Core\Charset\CharsetConverter\initCharset(), TYPO3\CMS\Core\Charset\CharsetConverter\initToASCII(), TYPO3\CMS\Core\Charset\CharsetConverter\initUnicodeData(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceFactoryTest\retrieveFileOrFolderObjectReturnsFileFromPublicFolderWhenProjectRootIsNotPublic(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceFactoryTest\retrieveFileOrFolderObjectReturnsFileIfPathIsGiven(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\writeFileToTypo3tempDirFailsWithInvalidPath(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\writeFileToTypo3tempDirWorksWithValidPath().

◆ xml2array()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::xml2array (   $string,
  $NSprefix = '',
  $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
‪mixed 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 1363 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\convertDataStructureToArray(), TYPO3\CMS\Core\Service\FlexFormService\convertFlexFormContentToArray(), TYPO3\CMS\Core\DataHandling\DataHandler\copyRecord_procBasedOnFieldType(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexPrepare\initializeDataValues(), TYPO3\CMS\Form\EventListener\DataStructureIdentifierListener\modifyDataStructureIdentifier(), TYPO3\CMS\Form\Controller\FormFrontendController\overrideByFlexFormSettings(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_initPIflexForm(), TYPO3\CMS\Core\DataHandling\DataHandler\remapListedDBRecords(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\resolveFileDirectives(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\traverseFlexFormXMLData(), TYPO3\CMS\Core\DataHandling\DataHandler\updateFlexFormData(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayUsesCache().

◆ xml2arrayProcess()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::xml2arrayProcess (   $string,
  $NSprefix = '',
  $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
‪mixed 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 1386 of file GeneralUtility.php.

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

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\xml2array(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesAttributeTypes(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesBigXmlContent(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesDocumentTag(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesTagNamespaces(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesWhitespaces().

◆ 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 1492 of file GeneralUtility.php.

Member Data Documentation

◆ $container

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

Definition at line 52 of file GeneralUtility.php.

◆ $finalClassNameCache

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

Definition at line 74 of file GeneralUtility.php.

◆ $indpEnvCache

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

Definition at line 79 of file GeneralUtility.php.

◆ $labelArr

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

Definition at line 669 of file GeneralUtility.php.

◆ $localeInfo

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

Definition at line 672 of file GeneralUtility.php.

◆ $multiplier [1/2]

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

Definition at line 674 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 679 of file GeneralUtility.php.

◆ $nl

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

Definition at line 1251 of file GeneralUtility.php.

◆ $nonSingletonInstances

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

Definition at line 66 of file GeneralUtility.php.

◆ $output [1/2]

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

Definition at line 1253 of file GeneralUtility.php.

◆ $output [2/2]

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

Definition at line 1348 of file GeneralUtility.php.

◆ $singletonInstances

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

Definition at line 59 of file GeneralUtility.php.

◆ $sizeInBytes

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

Definition at line 673 of file GeneralUtility.php.

◆ $sizeInUnits

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

Definition at line 675 of file GeneralUtility.php.

◆ $spaceInd

array<string, function explodeUrl2Array($string) { $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($tag, bool $decodeEntities = false) { $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($tag) { $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, $xhtmlSafe = false, $keepBlankAttributes = false) { 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 = []) { 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 mixed function xml2tree($string, $depth = 999, $parserOptions = []) { $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, $NSprefix = '', $level = 0, $docTag = 'phparray', $spaceInd = 0, array $options = [], array $stackData = []) { $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<string, 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 1250 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 664 of file GeneralUtility.php.