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

Static Public Member Functions

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(strpos( $email, '@')===false) { return false;} $validator=new EmailValidator();return $validator-> isValid ($email, new RFCValidation())
 
static string idnaEncode ($value)
 
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 string[] revExplode ($delimiter, $string, $count=0)
 
static 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 minifyJavaScript ($script, &$error='')
 
static mixed getUrl ($url, $includeHeader=0, $requestHeaders=null, &$report=null)
 
static bool writeFile ($file, $content, $changePermissions=false)
 
static mixed fixPermissions ($path, $recursive=false)
 
static string writeFileToTypo3tempDir ($filepath, $content)
 
static bool mkdir ($newFolder)
 
static mkdir_deep ($directory)
 
static bool rmdir ($path, $removeNonEmpty=false)
 
static bool flushDirectory ($directory, $keepOriginalDirectory=false, $flushOpcodeCache=false)
 
static string[] string null get_dirs ($path)
 

Public Attributes

const ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL = '.*'
 
const ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME = 'SERVER_NAME'
 
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 !=='') {[ $pK, $pV]=explode('=', $v, 2);$output[rawurldecode( $pK)]=rawurldecode( $pV);} } return $output;} public static array function compileSelectedGetVarsFromArray( $varList, array $getArray, $GPvarAlt=true) { $keys=self::trimExplode(',', $varList, true);$outArr=[];foreach( $keys as $v) { if(isset( $getArray[ $v])) { $outArr[ $v]=$getArray[ $v];} elseif( $GPvarAlt) { $outArr[ $v]=self::_GP( $v);} } return $outArr;} public static array function removeDotsFromTS(array $ts) { $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, $dontOmitBlankAttribs = false) { if ($xhtmlSafe) { $newArr = []; foreach ($arr as $p => $v) { if (!isset($newArr[strtolower($p)])) { $newArr[strtolower($p)] = htmlspecialchars($v); } } $arr = $newArr; } $list = []; foreach ($arr as $p => $v) { if ((string)$v !== '' || $dontOmitBlankAttribs) { $list[] = $p . '="' . $v . '"'; } } return implode(' ', $list); } public static string function wrapJS($string) { if (trim($string)) { $string = ltrim($string, LF); $match = []; if (preg_match('/^(\\t+)/', $string, $match)) { $string = str_replace($match[1], "\t", $string); } return '<script>' . $string . '</script>'; } return ''; } public static mixed function xml2tree($string, $depth = 999, $parserOptions = []) { $previousValueOfEntityLoader = null; if (PHP_MAJOR_VERSION < 8) { $previousValueOfEntityLoader = libxml_disable_entity_loader(true); } $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 (PHP_MAJOR_VERSION < 8) { libxml_disable_entity_loader($previousValueOfEntityLoader); } 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 bool $allowHostHeaderValue = false
 
static ContainerInterface null $container
 

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

Member Function Documentation

◆ camelCaseToLowerCaseUnderscored()

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

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

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

References $GLOBALS, 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\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName(), 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().

◆ flushDirectory()

static bool TYPO3\CMS\Core\Utility\GeneralUtility::flushDirectory (   $directory,
  $keepOriginalDirectory = false,
  $flushOpcodeCache = false 
)
static

Flushes a directory by first moving to a temporary resource, and then triggering the remove process. This way directories can be flushed faster to prevent race conditions on concurrent processes accessing the same directory.

Parameters
string$directory‪The directory to be renamed and flushed
bool$keepOriginalDirectory‪Whether to only empty the directory and not remove it
bool$flushOpcodeCache‪Also flush the opcode cache right after renaming the directory.
Returns
‪bool Whether the action was successful
Deprecated:
‪will be removed in TYPO3 v11.0. This is a specific logic needed for the caching framework, and should be implemented where needed directly.

Definition at line 2135 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\StringUtility\getUniqueId().

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

References $dir.

Referenced by TYPO3\CMS\IndexedSearch\Hook\CrawlerHook\crawler_execute_type2(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsArrayOfDirectoriesFromGivenDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsStringErrorOnPathFailure(), and TYPO3\CMS\Extensionmanager\Utility\DependencyUtility\getExtensionFromInExtensionRepository().

◆ getUrl()

static mixed TYPO3\CMS\Core\Utility\GeneralUtility::getUrl (   $url,
  $includeHeader = 0,
  $requestHeaders = null,
$report = null 
)
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
int$includeHeader‪Whether the HTTP header should be fetched or not. 0=disable, 1=fetch header+content, 2=fetch header only - deprecated and will be removed in TYPO3 v11.
array$requestHeaders‪HTTP headers to be used in the request - deprecated and will be removed in TYPO3 v11.
array$reportError code/message and, if $includeHeader is 1, response meta data (HTTP status and content type) - deprecated and will be removed in TYPO3 v11.
Returns
‪mixed The content from the resource given as input. FALSE if an error has occurred.

Definition at line 1748 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility\determineUpdateClassName(), TYPO3\CMS\Install\Service\CoreUpdateService\downloadVersion(), TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility\fetchExtension(), TYPO3\CMS\Extensionmanager\Utility\Repository\Helper\fetchFile(), TYPO3\CMS\Install\Updates\AbstractDownloadExtensionUpdate\fetchUrl(), 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\Extensionmanager\Utility\Repository\Helper\isExtListUpdateNecessary(), TYPO3\CMS\IndexedSearch\FileContentParser\readFileContent(), TYPO3\CMS\Core\Resource\ResourceCompressor\retrieveExternalFile(), and TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\GeneralUtilityTest\splitHeaderLines().

◆ idnaEncode()

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

Returns an ASCII string (punicode) representation of $value

Parameters
string$value
Returns
‪string An ASCII encoded (punicode) string
Deprecated:
‪since TYPO3 v10.0, will be removed in TYPO3 v11.0, use PHP's native idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) function directly.

Definition at line 863 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\HttpUtility\idn_to_ascii().

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

◆ 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 1097 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().

◆ 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‪If positive, the result will contain a maximum of limit elements,
Returns
‪int[] Exploded values, all converted to integers

Definition at line 988 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver\__construct(), TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseLanguageRows\addData(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\adjust(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\calcTextCordsForMap(), TYPO3\CMS\Core\DataHandling\DataHandler\canDeletePage(), TYPO3\CMS\Core\Database\QueryGenerator\cleanInputVal(), TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility\collectPages(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\collectRecordsFromCategories(), TYPO3\CMS\Core\Utility\VersionNumberUtility\convertVersionStringToArray(), 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\IndexedSearch\Domain\Repository\IndexSearchRepository\execFinalQuery_fulltext(), TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getTypeData(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\fetchGroupData(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\fetchGroups(), TYPO3\CMS\Workspaces\Service\StagesService\fetchGroupsRecursive(), TYPO3\CMS\Frontend\ContentObject\FilesContentObject\findAndSortFiles(), TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository\findByPidsAndAuthorId(), TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider\generateItems(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getAllAvailableIndexConfigurationsOptions(), TYPO3\CMS\Linkvalidator\QueryRestrictions\EditableRestriction\getAllowedLanguagesForCurrentUser(), TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getAuthInfoArray(), TYPO3\CMS\Core\Site\Entity\NullSite\getAvailableLanguages(), TYPO3\CMS\Workspaces\Service\StagesService\getBackendUsers(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\getBannedUids(), TYPO3\CMS\Backend\Controller\NewRecordController\getButtons(), TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider\getChildrenUidsFromChildrenRelation(), TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager\getConfiguration(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getConstraint(), TYPO3\CMS\Backend\Controller\Page\TreeController\getDokTypes(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFileMountRecords(), TYPO3\CMS\Core\Context\UserAspect\getGroupIds(), TYPO3\CMS\Frontend\ContentObject\ImageContentObject\getImageSourceCollection(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getImageSourceCollection(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getMoveToPlaceHolderFromPages(), TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\getNoViewWithDokTypes(), TYPO3\CMS\Core\Utility\VersionNumberUtility\getNumericTypo3Version(), TYPO3\CMS\Linkvalidator\Report\LinkValidatorReport\getPageList(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getPagePermsClause(), TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider\getPages(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageShortcut(), TYPO3\CMS\Backend\Controller\Page\TreeController\getPageTreeRepository(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getRecursiveStoragePids(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\getRecursiveStoragePids(), TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository\getSearchRootPageIdList(), TYPO3\CMS\Backend\View\PageLayoutView\getSelectedLanguages(), TYPO3\CMS\Core\Database\QueryGenerator\getSelectQuery(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getSlidePids(), TYPO3\CMS\FrontendLogin\Controller\AbstractLoginFormController\getStorageFolders(), TYPO3\CMS\Core\Authentication\AuthenticationService\getSubGroups(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getTreeUids(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\imageLinkWrap(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\IMparams(), TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), TYPO3\CMS\Backend\Tree\View\BrowseTreeView\init(), TYPO3\CMS\Linkvalidator\LinkAnalyzer\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\Core\Authentication\BackendUserAuthentication\initializeWebmountsForElementBrowser(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\intExplodeConvertsStringsToInteger(), TYPO3\CMS\Recycler\Domain\Model\DeletedRecords\loadData(), TYPO3\CMS\Lowlevel\Integrity\DatabaseIntegrityCheck\lostRecords(), TYPO3\CMS\Backend\Controller\PageLayoutController\main(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeBox(), TYPO3\CMS\Backend\Controller\PageLayoutController\makeButtons(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeEllipse(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeEmboss(), TYPO3\CMS\Core\Database\QueryGenerator\makeOptionList(), TYPO3\CMS\Core\Database\QueryGenerator\makeSelectorTable(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\makeShadow(), TYPO3\CMS\Core\Database\QueryView\makeValueList(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\objPosition(), TYPO3\CMS\Core\Utility\RootlineUtility\parseMountPointParameter(), 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\prepareMenuItemsForUpdatedMenu(), TYPO3\CMS\Frontend\DataProcessing\FilesProcessor\process(), TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator\process(), TYPO3\CMS\Frontend\DataProcessing\SplitProcessor\process(), TYPO3\CMS\Workspaces\Hook\DataHandlerHook\processCmdmap(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processForeignTableClause(), TYPO3\CMS\Core\TypoScript\TemplateService\processTemplate(), TYPO3\CMS\Core\Utility\VersionNumberUtility\raiseVersionNumber(), TYPO3\CMS\Backend\Controller\EditDocumentController\registerViewButtonToButtonBar(), TYPO3\CMS\Backend\Controller\PageLayoutController\renderContent(), TYPO3\CMS\Recordlist\LinkHandler\RecordLinkHandler\renderPageTree(), TYPO3\CMS\Core\Routing\PageRouter\resolveMountPointParameterIntoPageSlug(), 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\Felogin\Controller\FrontendLoginController\showForgot(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\splitString(), TYPO3\CMS\Frontend\Imaging\GifBuilder\start(), TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject\start(), TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\start(), TYPO3\CMS\Backend\Utility\BackendUtility\titleAttribForPages(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\txtPosition(), and TYPO3\CMS\Beuser\Controller\PermissionController\updateAction().

◆ 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 (strpos($email, '@') === false) { return false; } $validator = new EmailValidator(); return $validator-> TYPO3\CMS\Core\Utility\GeneralUtility::isValid (   $email,
new   RFCValidation() 
)
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 944 of file GeneralUtility.php.

References TYPO3\CMS\Core\Utility\HttpUtility\buildUrl(), and TYPO3\CMS\Core\Utility\HttpUtility\idn_to_ascii().

Referenced by TYPO3\CMS\Core\Html\DefaultSanitizerBuilder\__construct(), TYPO3\CMS\Core\Resource\ResourceCompressor\createMergedFile(), TYPO3\CMS\Backend\Command\ResetPasswordCommand\execute(), TYPO3\CMS\Core\Resource\ResourceStorage\getPublicUrl(), TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\getPublicUrlReturnsValidUrlContainingSpecialCharacters(), TYPO3\CMS\Backend\Backend\Avatar\Image\getUrl(), TYPO3\CMS\FrontendLogin\Validation\RedirectUrlValidator\isInLocalDomain(), TYPO3\CMS\Extbase\Validation\Validator\UrlValidator\isValid(), TYPO3\CMS\Extensionmanager\Domain\Model\Repository\setMirrorListUrl(), TYPO3\CMS\Extensionmanager\Domain\Model\Repository\setWsdlUrl(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsFalseForInvalidResource(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsTrueForValidResource().

◆ minifyJavaScript()

static string TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript (   $script,
$error = '' 
)
static

Minifies JavaScript

Parameters
string$script‪Script to minify
string$errorError message (if any)
Returns
‪string Minified script or source string if error happened

Definition at line 1713 of file GeneralUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Page\PageRenderer\doCompressJavaScript(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\minifyJavaScriptReturnsInputStringIfNoHookIsRegistered(), and TYPO3\CMS\Frontend\Http\RequestHandler\processHtmlBasedRenderingSettings().

◆ 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 2005 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\Impexp\Import\checkOrCreateDir(), TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService\copyDependencies(), 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\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\createFakeExtension(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\createFakeExtension(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\createFolder(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\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\Install\Report\InstallStatusReport\getFileSystemStatus(), TYPO3\CMS\Extensionmanager\Utility\InstallUtility\importInitialFiles(), 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\mkdirSetsGroupOwnershipOfCreatedDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirSetsPermissionsOfCreatedDirectory(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\nonWritableDirectoryThrowsException(), TYPO3\CMS\Impexp\Import\processSoftReferences_saveFile_createRelFile(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), and TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\resolveAllExistingSitesReadsConfiguration().

◆ 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. Must a have trailing slash
Exceptions

Definition at line 2022 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Resource\ResourceCompressor\__construct(), TYPO3\CMS\Core\Mail\FileSpool\__construct(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\buildFileDeclarations(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\clearAssetsFolderClearsFolder(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\copyFileGeneratesNewFileNameWhenFileAlreadyExistsInTargetFolderAndConflictModeIsRename(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\copyFileThrowsErrorWhenFileWithSameNameAlreadyExistsInTargetFolderAndConflictModeIsCancel(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\copyFolderGeneratesNewFolderNameWhenFolderAlreadyExistsInTargetFolderAndConflictModeIsRename(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\copyFolderThrowsErrorWhenFolderAlreadyExistsInTargetFolderAndConflictModeIsCancel(), TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesFileInSingleSubFolderToNewFolderName(), TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\copyFolderWithinStorageCopiesSingleSubFolderToNewFolderName(), 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\Functional\Resource\ResourceStorageTest\deleteFileMovesFileToRecyclerFolderIfAvailable(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\deleteFileUnlinksFileIfNoRecyclerFolderAvailable(), TYPO3\CMS\Core\Core\ClassLoadingInformation\ensureAutoloadInfoDirExists(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\ensureSessionSavePathExists(), TYPO3\CMS\Install\Controller\InstallerController\executeDatabaseConnectAction(), TYPO3\CMS\Core\Tests\Functional\Authentication\BackendUserAuthenticationTest\getDefaultUploadFolderFallsBackToDefaultStorage(), TYPO3\CMS\Install\Controller\EnvironmentController\getImagesPath(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\getNestedProcessingFolderTest(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusCallsGetChildrenStatusForStatus(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper\getTempFolderPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructureTestCase\getVirtualTestDir(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getVirtualTestDir(), TYPO3\CMS\Frontend\Imaging\GifBuilder\gifBuild(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\imageMagickConvert(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\DirectoryNodeTest\isDirectoryReturnsFalseIfNameIsALinkToADirectory(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\FileNodeTest\isFileReturnsFalseIfNameIsALinkFile(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\isWithinFileMountBoundariesRespectsReadOnlyFileMounts(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Install\Updates\BackendLayoutIconUpdateWizard\migrateField(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectoryInVfsStream(), 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\mkdirDeepSetsGroupOwnershipOfCreatedDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepSetsGroupOwnershipOfCreatedParentDirectory(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepSetsGroupOwnershipOnNewSubDirectory(), 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\Core\Tests\Functional\Resource\ResourceStorageTest\replaceFileFailsIfLocalFileDoesNotExist(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\searchFilesFindsFilesInFolder(), TYPO3\CMS\Install\Service\CoreUpdateService\setDownloadTargetPath(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\setUp(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\TitleTagRenderingTest\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase\setUpFrontendSite(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\siteConfigGetsMovedIntoPlace(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\siteConfigGetsNotOverriddenIfExistsAlready(), 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().

◆ revExplode()

static string [] TYPO3\CMS\Core\Utility\GeneralUtility::revExplode (   $delimiter,
  $string,
  $count = 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 2075 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Install\Service\Typo3tempFileService\clearAssetsFolder(), TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Tests\Unit\Locking\SimpleLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\copyFolderWithinStorage(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\deleteFolder(), TYPO3\CMS\Impexp\Controller\ExportController\exportData(), 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\Resource\ResourceStorageTest\searchFilesFindsFilesInFolder(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\tearDown(), TYPO3\CMS\Core\Tests\Unit\Resource\Driver\LocalDriverTest\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 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
‪string[] Exploded values

Definition at line 1059 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\__construct(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\__construct(), TYPO3\CMS\FrontendLogin\Configuration\RedirectConfiguration\__construct(), TYPO3\CMS\Scheduler\CronCommand\CronCommand\__construct(), TYPO3\CMS\Core\Utility\RootlineUtility\__construct(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\__construct(), 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\TcaInputPlaceholders\addData(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaTypesShowitem\addFieldsBySubtypeAddList(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addFieldsToAllPalettesOfField(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\addItemsFromSpecial(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addModule(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addService(), TYPO3\CMS\Backend\Controller\EditDocumentController\addSlugFieldsToColumnsOnly(), TYPO3\CMS\IndexedSearch\Indexer\addSpacesToKeywordList(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes(), TYPO3\CMS\Backend\FrontendBackendUserAuthentication\allowedToEdit(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\applyHttpHeadersToResponse(), TYPO3\CMS\Workspaces\DataHandler\CommandMap\applyWorkspacesSetStageBehaviour(), TYPO3\CMS\Core\DataHandling\PagePermissionAssembler\assemblePermissions(), TYPO3\CMS\Core\DataHandling\DataHandler\assemblePermissions(), TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser\buildConfigurationArray(), TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver\buildConstraintBlock(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\buildForeignTableQueryBuilder(), TYPO3\CMS\Backend\Utility\BackendUtility\calcAge(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calcOffset(), TYPO3\CMS\Frontend\Imaging\GifBuilder\calculateMaximum(), TYPO3\CMS\IndexedSearch\Hook\CrawlerHook\checkDeniedSuburls(), TYPO3\CMS\Core\Service\AbstractService\checkExec(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValue_group_select_explodeSelectGroupValue(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForCheck(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForGroupSelect(), 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\Workspaces\Authentication\PreviewUserAuthentication\checkWorkspace(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\checkWorkspace(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\clearPageCache(), TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader\collect(), 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\IndexedSearch\Hook\CrawlerHook\crawler_execute_type2(), TYPO3\CMS\Backend\Controller\OnlineMediaController\createAction(), TYPO3\CMS\Dashboard\DashboardInitializationService\createDefaultDashboards(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\createFolder(), TYPO3\CMS\Backend\Form\Container\PaletteAndSingleContainer\createPaletteContentArray(), TYPO3\CMS\Core\Http\NormalizedParams\determineHttpHost(), TYPO3\CMS\Core\DataHandling\DataHandler\doesPageHaveUnallowedTables(), TYPO3\CMS\Core\Controller\FileDumpController\dumpAction(), TYPO3\CMS\Backend\Http\RouteDispatcher\enforceReferrer(), TYPO3\CMS\Install\Command\LanguagePackCommand\execute(), TYPO3\CMS\Lowlevel\Command\LostFilesCommand\execute(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\execute(), TYPO3\CMS\Form\Domain\Finishers\ConfirmationFinisher\executeInternal(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\executePositionedStringInsertion(), TYPO3\CMS\Install\Updates\MigratePagesLanguageOverlayBeGroupsAccessRights\executeUpdate(), TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\executeValueModifier(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\expandOrCollapseAction(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\explodeItemList(), TYPO3\CMS\Workspaces\DataHandler\CommandMap\explodeSetStage(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\explodeSingleFieldShowItemConfiguration(), TYPO3\CMS\Backend\Utility\BackendUtility\explodeSoftRefParserList(), TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_printFields(), TYPO3\CMS\Install\Controller\UpgradeController\extensionScannerScanFileAction(), TYPO3\CMS\Backend\Form\Container\InlineControlContainer\extractFlexFormParts(), TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser\extractInformationForConfigFieldsOfTypeOptions(), TYPO3\CMS\Info\Controller\InfoPageTyposcriptConfigController\extractLinesFromTSConfig(), TYPO3\CMS\Core\Resource\Search\QueryRestrictions\SearchTermRestriction\extractSearchableFieldsFromTable(), TYPO3\CMS\Backend\Search\LiveSearch\LiveSearch\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\Lowlevel\Command\LostFilesCommand\findLostFiles(), TYPO3\CMS\Core\Resource\Index\FileIndexRepository\findOneByCombinedIdentifier(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\findService(), 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\DataHandling\SlugHelper\generate(), TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\generateList(), TYPO3\CMS\Core\Mail\TransportFactory\get(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getAllAvailableMediaTypesOptions(), TYPO3\CMS\Backend\FrontendBackendUserAuthentication\getAllowedEditActions(), TYPO3\CMS\RteCKEditor\Controller\BrowseLinksController\getAllowedItems(), TYPO3\CMS\Recordlist\Controller\AbstractLinkBrowserController\getAllowedItems(), TYPO3\CMS\RteCKEditor\Controller\BrowseLinksController\getAllowedLinkAttributes(), TYPO3\CMS\Recordlist\Controller\AbstractLinkBrowserController\getAllowedLinkAttributes(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\getAllowedTableForGroupField(), TYPO3\CMS\Core\DataHandling\DataHandler\getAllowedTablesToCopyWhenCopyingAPage(), TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getCandidateSlugsFromRoutePath(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getCategoryMountPoints(), TYPO3\CMS\Linkvalidator\Report\LinkValidatorReport\getCheckOptions(), TYPO3\CMS\Backend\View\BackendLayoutView\getColPosListItemsParsed(), TYPO3\CMS\Backend\Utility\BackendUtility\getCommonSelectFields(), TYPO3\CMS\Core\Utility\CommandUtility\getConfiguredApps(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\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\Core\Authentication\BackendUserAuthentication\getFileMountRecords(), TYPO3\CMS\Core\Resource\ResourceFactory\getFileObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFilePermissions(), TYPO3\CMS\Workspaces\Tests\Unit\Controller\Remote\RemoteServerTest\getFileReferenceProphecies(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\getFirstTimeValueForRecord(), TYPO3\CMS\Core\Resource\ResourceFactory\getFolderObjectFromCombinedIdentifier(), TYPO3\CMS\Core\Database\RelationHandler\getFromDB(), TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\getFromDottedNotation(), TYPO3\CMS\Backend\Utility\BackendUtility\getGroupNames(), TYPO3\CMS\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Backend\Domain\Repository\TableManualRepository\getImages(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\getInlineRelatedRecordsUidArray(), TYPO3\CMS\Core\Html\RteHtmlParser\getKeepTags(), TYPO3\CMS\Backend\Utility\BackendUtility\getLabelsFromItemsList(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\getLinkTypes(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider\getLoginUserFunction(), TYPO3\CMS\Core\Type\File\FileInfo\getMimeExtensions(), TYPO3\CMS\Backend\Utility\BackendUtility\getMovePlaceholder(), TYPO3\CMS\Core\Resource\ResourceFactory\getObjectFromCombinedIdentifier(), TYPO3\CMS\IndexedSearch\Controller\SearchController\getPathFromPageId(), TYPO3\CMS\Core\Utility\CommandUtility\getPathsInternal(), TYPO3\CMS\Core\DataHandling\DataHandler\getPlaceholderTitleForTableLabel(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaInputPlaceholders\getPlaceholderValue(), TYPO3\CMS\Core\Localization\Locales\getPreferredClientLanguage(), TYPO3\CMS\Felogin\Controller\FrontendLoginController\getPreserveGetVars(), TYPO3\CMS\Backend\Utility\BackendUtility\getProcessedValue(), TYPO3\CMS\Core\Resource\ResourceStorage\getProcessingFolders(), TYPO3\CMS\Backend\Utility\BackendUtility\getRawPagesTSconfig(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRawRecord(), TYPO3\CMS\Workspaces\Controller\Remote\ActionHandler\getRecipientList(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), TYPO3\CMS\Core\Database\ReferenceIndex\getRecordRawCached(), TYPO3\CMS\Backend\Domain\Repository\Localization\LocalizationRepository\getRecordsToCopyDatabaseResult(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaRecordTitle\getRecordTitleByLabelProperties(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\getRegisteredFlexForms(), TYPO3\CMS\Workspaces\Controller\Remote\RemoteServer\getRowDetails(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\getSearchField(), TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList\getSearchFields(), TYPO3\CMS\Backend\Domain\Repository\TableManualRepository\getSeeAlsoLinks(), TYPO3\CMS\Core\Database\QueryGenerator\getSelectQuery(), 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\Recordlist\RecordList\DatabaseRecordList\getTable(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\getTablesToQueryFromFieldConfiguration(), TYPO3\CMS\Backend\Controller\Page\NewMultiplePagesController\getTypeSelectData(), TYPO3\CMS\Workspaces\Hook\DataHandlerHook\getUniqueFields(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\Typo3ConditionFunctionsProvider\getUsergroupFunction(), TYPO3\CMS\Backend\Utility\BackendUtility\getUserNames(), TYPO3\CMS\Backend\Form\AbstractNode\getValidationDataAsJsonString(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\getWizards(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getWorkspaceVersionOfRecord(), TYPO3\CMS\Backend\Utility\BackendUtility\getWorkspaceVersionOfRecord(), TYPO3\CMS\Workspaces\Controller\PreviewController\handleRequest(), TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), TYPO3\CMS\IndexedSearch\Hook\CrawlerHook\indexSingleRecord(), TYPO3\CMS\Core\Database\QueryGenerator\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\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\initializeFlatMatcherDefinitions(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\initializeLastArrayKeyNameArray(), TYPO3\CMS\Linkvalidator\Report\LinkValidatorReport\initializeLinkAnalyzer(), TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\initializeMountPointMap(), TYPO3\CMS\IndexedSearch\FileContentParser\initParser(), TYPO3\CMS\Core\Utility\CommandUtility\initPaths(), TYPO3\CMS\Core\Charset\CharsetConverter\initUnicodeData(), TYPO3\CMS\Core\DataHandling\DataHandler\inlineLocalizeSynchronize(), TYPO3\CMS\Core\DataHandling\DataHandler\insertUpdateDB_preprocessBasedOnFieldType(), TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem\isFunctionDisabled(), TYPO3\CMS\Backend\Utility\BackendUtility\isModuleSetInTBE_MODULES(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isServiceAvailable(), TYPO3\CMS\Core\DataHandling\DataHandler\isTableAllowedForThisPage(), TYPO3\CMS\Core\Utility\ArrayUtility\keepItemsInArray(), TYPO3\CMS\Backend\Tests\Functional\View\PageLayoutViewTest\languageSelectorDoesNotOfferLanguageIfTranslationHasBeenDoneAlready(), TYPO3\CMS\Backend\Tests\Functional\View\PageLayoutViewTest\languageSelectorShowsAllAvailableLanguagesForTranslation(), TYPO3\CMS\Backend\Controller\EditDocumentController\languageSwitch(), TYPO3\CMS\Recordlist\Controller\AbstractLinkBrowserController\loadLinkHandlers(), TYPO3\CMS\Filelist\Controller\File\CreateFolderController\main(), TYPO3\CMS\Recordlist\Controller\RecordListController\main(), TYPO3\CMS\Backend\Controller\OnlineMediaController\mainAction(), TYPO3\CMS\Backend\Controller\Wizard\AddController\mainAction(), TYPO3\CMS\Backend\Controller\EditDocumentController\makeEditForm(), TYPO3\CMS\Backend\Controller\LoginController\makeInterfaceSelector(), TYPO3\CMS\Core\Database\QueryGenerator\makeOptionList(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\makeRef(), TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController\makeRefFrom(), TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions\matchFieldCondition(), TYPO3\CMS\Install\Service\SilentConfigurationUpgradeService\migrateCacheHashOptions(), TYPO3\CMS\Install\Updates\BackendLayoutIconUpdateWizard\migrateField(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideControllerConfigurationWithSwitchableControllerActionsFromFlexForm(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideStoragePidIfStartingPointIsSet(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseGroupBy(), TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile\parseIssueId(), TYPO3\CMS\Backend\Module\ModuleLoader\parseModulesArray(), TYPO3\CMS\Core\Utility\RootlineUtility\parseMountPointParameter(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions\parseSingleConditionString(), 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\Install\Updates\PopulatePageSlugs\populateSlugs(), 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\Backend\Tree\View\PagePositionMap\printContentElementColumns(), TYPO3\CMS\Core\TimeTracker\TimeTracker\printTSlog(), TYPO3\CMS\Core\DependencyInjection\ListenerProviderPass\process(), TYPO3\CMS\Frontend\DataProcessing\FilesProcessor\process(), TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator\process(), TYPO3\CMS\Frontend\DataProcessing\SplitProcessor\process(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\processConfiguration(), TYPO3\CMS\Core\Html\RteHtmlParser\processContentWithinParagraph(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processDatabaseFieldValue(), TYPO3\CMS\Core\Hooks\BackendUserGroupIntegrityCheck\processDatamap_afterDatabaseOperations(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\processForeignTableClause(), TYPO3\CMS\Felogin\Controller\FrontendLoginController\processRedirect(), TYPO3\CMS\Form\Mvc\Property\TypeConverter\UploadedFileReferenceConverter\provideUploadFolder(), TYPO3\CMS\Core\Database\Query\QueryBuilder\quoteIdentifiersForSelect(), TYPO3\CMS\Core\Database\RelationHandler\readList(), TYPO3\CMS\Core\DataHandling\DataHandler\recordInfo(), TYPO3\CMS\Core\DataHandling\DataHandler\recordInfoWithPermissionCheck(), TYPO3\CMS\FrontendLogin\Redirect\RedirectModeHandler\redirectModeRefererDomains(), TYPO3\CMS\Core\Category\CategoryRegistry\registerDefaultCategorizedTables(), TYPO3\CMS\Extbase\Utility\ExtensionUtility\registerModule(), 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\Backend\Domain\Repository\Module\BackendModuleRepository\removeHiddenModules(), 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\FieldControl\ElementBrowser\render(), TYPO3\CMS\Backend\Form\FieldControl\ListModule\render(), TYPO3\CMS\Backend\Form\Container\FullRecordContainer\render(), TYPO3\CMS\Backend\Form\FieldWizard\TableList\render(), TYPO3\CMS\Backend\Form\FieldControl\AddRecord\render(), TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer\render(), TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer\render(), TYPO3\CMS\Frontend\ContentObject\RecordsContentObject\render(), TYPO3\CMS\Backend\Form\Element\InputColorPickerElement\render(), TYPO3\CMS\Backend\Form\Element\InputDateTimeElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\InputSlugElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Recordlist\Browser\DatabaseBrowser\render(), TYPO3\CMS\Backend\Form\Element\TextTableElement\render(), TYPO3\CMS\Backend\Form\Element\InputLinkElement\render(), TYPO3\CMS\Recordlist\Browser\FileBrowser\render(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\render(), TYPO3\CMS\Backend\Controller\NewRecordController\renderContent(), TYPO3\CMS\Backend\Controller\PageLayoutController\renderContent(), TYPO3\CMS\RteCKEditor\Controller\BrowseLinksController\renderLinkAttributeFields(), 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\Recordlist\Browser\DatabaseBrowser\renderTableRecords(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\reportEmail(), 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\Controller\SiteConfigurationController\saveAction(), TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandAdditionalFieldProvider\saveAdditionalFields(), TYPO3\CMS\IndexedSearch\Domain\Repository\AdministrationRepository\saveKeywords(), TYPO3\CMS\IndexedSearch\FileContentParser\searchTypeMediaTitle(), TYPO3\CMS\Backend\Utility\BackendUtility\selectVersionsOfRecord(), TYPO3\CMS\Reports\Task\SystemStatusUpdateTask\sendNotificationEmail(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\setAbsRefPrefix(), TYPO3\CMS\Core\Database\QueryGenerator\setAndCleanUpExternalLists(), TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew\setDefaultsFromNeighborRow(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory\setFieldEvaluations(), 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\Recordlist\RecordList\DatabaseRecordList\setTableDisplayOrder(), TYPO3\CMS\Recordlist\Controller\RecordListController\showPageTranslations(), TYPO3\CMS\Core\Html\HtmlParser\splitIntoBlock(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\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\DataHandling\Localization\DataMapProcessor\synchronizeInlineRelations(), TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider\translationInfo(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\trimExplodeReturnsCorrectResult(), TYPO3\CMS\Install\Service\LocalConfigurationValueService\updateLocalConfigurationValues(), TYPO3\CMS\Reports\Task\SystemStatusUpdateTaskNotificationEmailField\validateAdditionalFields(), TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandAdditionalFieldProvider\validateAdditionalFields(), TYPO3\CMS\Linkvalidator\Task\ValidatorTaskAdditionalFieldProvider\validateAdditionalFields(), TYPO3\CMS\Backend\Controller\SiteConfigurationController\validateAndProcessValue(), and TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateIfHashHasExpired().

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

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory\buildDataMapInternal(), TYPO3\CMS\Backend\Controller\BackendController\renderToolbar(), 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 890 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Page\PageRenderer\computeRequireJsConfig(), TYPO3\CMS\Extbase\Utility\ExtensionUtility\registerModule(), and TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToUpperCamelCase().

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

Referenced by TYPO3\CMS\Core\Resource\ResourceCompressor\__construct(), 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\Impexp\Controller\ExportController\exportData(), TYPO3\CMS\Impexp\Import\import_addFileNameToBeCopied(), TYPO3\CMS\IndexedSearch\Indexer\indexExternalUrl(), TYPO3\CMS\Impexp\Import\processSoftReferences_saveFile_createRelFile(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\resolveAllExistingSitesReadsConfiguration(), TYPO3\CMS\Core\Resource\ResourceCompressor\retrieveExternalFile(), TYPO3\CMS\Frontend\Tests\Functional\Rendering\TitleTagRenderingTest\setUpFrontendSite(), TYPO3\CMS\Core\Tests\Functional\DataHandling\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\writeFileVerify(), and TYPO3\CMS\Impexp\Import\writeTemporaryFileFromData().

◆ writeFileToTypo3tempDir()

static string 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 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 1928 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\Utility\UpdateScriptUtility\determineUpdateClassName(), TYPO3\CMS\Extensionmanager\Utility\Repository\Helper\fetchFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsWithRelativeFileReference(), TYPO3\CMS\Core\Tests\UnitDeprecated\Localization\LocalizationFactoryTest\getParsedDataHandlesLocallangXMLOverride(), 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\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 1531 of file GeneralUtility.php.

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

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForFlex(), TYPO3\CMS\Core\Service\FlexFormService\convertFlexFormContentToArray(), TYPO3\CMS\Core\DataHandling\DataHandler\copyRecord_procBasedOnFieldType(), TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\enrichFormDefinitionsInformationWithDataFromReferences(), TYPO3\CMS\Backend\Controller\Wizard\TableController\getConfiguration(), TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook\getDataStructureIdentifierPostProcess(), TYPO3\CMS\Core\Database\ReferenceIndex\getRelations(), TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexPrepare\initializeDataValues(), TYPO3\CMS\Impexp\Import\loadFile(), TYPO3\CMS\Form\Controller\FormFrontendController\overrideByFlexFormSettings(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\parseDataStructureByIdentifier(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_initPIflexForm(), TYPO3\CMS\Impexp\Import\processSoftReferences(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\readFlexformIntoConf(), TYPO3\CMS\Core\DataHandling\DataHandler\remapListedDBRecords(), TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\retrieveAllFlexForms(), TYPO3\CMS\Impexp\Import\setFlexFormRelations(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\traverseFlexFormXMLData(), TYPO3\CMS\Core\DataHandling\DataHandler\updateFlexFormData(), TYPO3\CMS\Core\DataHandling\DataHandler\version_remapMMForVersionSwap(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayFailsWithXmlContentBiggerThanTenMegabytes(), 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 1554 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 1668 of file GeneralUtility.php.

Member Data Documentation

◆ $allowHostHeaderValue

bool TYPO3\CMS\Core\Utility\GeneralUtility::$allowHostHeaderValue = false
staticprotected

State of host header value security check in order to avoid unnecessary multiple checks during one request

Definition at line 55 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture\setAllowHostHeaderValue().

◆ $container

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

Definition at line 59 of file GeneralUtility.php.

◆ $labelArr

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

Definition at line 795 of file GeneralUtility.php.

◆ $localeInfo

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

Definition at line 798 of file GeneralUtility.php.

◆ $multiplier [1/2]

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

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

◆ $nl

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

Definition at line 1420 of file GeneralUtility.php.

◆ $output [1/2]

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

Definition at line 1422 of file GeneralUtility.php.

◆ $output [2/2]

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

Definition at line 1516 of file GeneralUtility.php.

◆ $sizeInBytes

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

Definition at line 799 of file GeneralUtility.php.

◆ $sizeInUnits

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

Definition at line 801 of file GeneralUtility.php.

◆ $spaceInd

array<string, function explodeUrl2Array($string) { $output = []; $p = explode('&', $string); foreach ($p as $v) { if ($v !== '') { [$pK, $pV] = explode('=', $v, 2); $output[rawurldecode($pK)] = rawurldecode($pV); } } return $output; } public static array function compileSelectedGetVarsFromArray($varList, array $getArray, $GPvarAlt = true) { $keys = self::trimExplode(',', $varList, true); $outArr = []; foreach ($keys as $v) { if (isset($getArray[$v])) { $outArr[$v] = $getArray[$v]; } elseif ($GPvarAlt) { $outArr[$v] = self::_GP($v); } } return $outArr; } public static array function removeDotsFromTS(array $ts) { $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, $dontOmitBlankAttribs = false) { if ($xhtmlSafe) { $newArr = []; foreach ($arr as $p => $v) { if (!isset($newArr[strtolower($p)])) { $newArr[strtolower($p)] = htmlspecialchars($v); } } $arr = $newArr; } $list = []; foreach ($arr as $p => $v) { if ((string)$v !== '' || $dontOmitBlankAttribs) { $list[] = $p . '="' . $v . '"'; } } return implode(' ', $list); } public static string function wrapJS($string) { if (trim($string)) { $string = ltrim($string, LF); $match = []; if (preg_match('/^(\\t+)/', $string, $match)) { $string = str_replace($match[1], "\t", $string); } return '<script>' . $string . '</script>'; } return ''; } public static mixed function xml2tree($string, $depth = 999, $parserOptions = []) { $previousValueOfEntityLoader = null; if (PHP_MAJOR_VERSION < 8) { $previousValueOfEntityLoader = libxml_disable_entity_loader(true); } $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 (PHP_MAJOR_VERSION < 8) { libxml_disable_entity_loader($previousValueOfEntityLoader); } 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 1419 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 790 of file GeneralUtility.php.

◆ ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL

◆ ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME