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

Static Public Member Functions

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

Public Attributes

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

Static Protected Member Functions

static string createDirectoryPath (string $fullDirectoryPath)
 

Static Protected Attributes

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

Private Member Functions

 __construct ()
 

Detailed Description

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

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

Definition at line 51 of file GeneralUtility.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 82 of file GeneralUtility.php.

Member Function Documentation

◆ camelCaseToLowerCaseUnderscored()

◆ cmpFQDN()

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

Match fully qualified domain name with list of strings with wildcard

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

Definition at line 341 of file GeneralUtility.php.

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

◆ cmpIP()

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

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

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

Definition at line 113 of file GeneralUtility.php.

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

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

◆ cmpIPv4()

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

Match IPv4 number with list of numbers with wildcard

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

Definition at line 135 of file GeneralUtility.php.

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

◆ cmpIPv6()

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

Match IPv6 address with a list of IPv6 prefixes

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

Definition at line 184 of file GeneralUtility.php.

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

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

◆ createDirectoryPath()

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

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

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

Definition at line 1671 of file GeneralUtility.php.

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

◆ expandList()

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

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

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

Definition at line 434 of file GeneralUtility.php.

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

◆ fixed_lgd_cs()

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

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

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

Definition at line 92 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Impexp\ImportExport\addSoftRefs(), TYPO3\CMS\Lowlevel\Command\ListSysLogCommand\arrayToLogString(), TYPO3\CMS\IndexedSearch\Controller\SearchController\compileSingleResultRow(), TYPO3\CMS\Backend\Clipboard\Clipboard\confirmMsgText(), TYPO3\CMS\Impexp\Export\exportAddRecord(), TYPO3\CMS\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\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\DatetimeElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Backend\Form\Element\LinkElement\render(), TYPO3\CMS\Backend\Form\Element\GroupElement\render(), TYPO3\CMS\Info\Controller\TranslationStatusController\renderL10nTable(), TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\renderStatic(), TYPO3\CMS\Backend\ElementBrowser\DatabaseBrowser\renderTableRecords(), TYPO3\CMS\Backend\LinkHandler\RecordLinkHandler\renderTableRecords(), and TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer\renderText().

◆ fixPermissions()

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

◆ get_dirs()

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

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

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

Definition at line 1755 of file GeneralUtility.php.

References $dir.

◆ getUrl()

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

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

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

Definition at line 1440 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 474 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\Backend\Controller\Security\SudoModeController\buildUriParametersForClaim(), 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\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\Core\FormProtection\AbstractFormProtection\generateToken(), 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\Frontend\ContentObject\ContentObjectRenderer\imageLinkWrap(), 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\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\EditPopup\render(), TYPO3\CMS\Backend\Form\FieldControl\LinkPopup\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\Backend\Controller\Security\SudoModeController\resolveClaimFromRequest(), 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\validateHashArgument(), TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController\validateNewPassword(), and TYPO3\CMS\Core\FormProtection\AbstractFormProtection\validateToken().

◆ inList()

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

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

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

Definition at line 422 of file GeneralUtility.php.

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

◆ isOnCurrentHost()

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

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

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

Definition at line 409 of file GeneralUtility.php.

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

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

◆ isValid()

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

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

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

◆ isValidUrl()

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

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

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

filter_var() requires a scheme to be present.

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

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

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

Definition at line 708 of file GeneralUtility.php.

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

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

◆ md5int()

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

◆ mkdir()

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

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

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

Definition at line 1634 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\Extensionmanager\Controller\UploadExtensionFileController\copyExtensionFolderToTempFolder(), TYPO3\CMS\Core\Utility\GeneralUtility\createDirectoryPath(), TYPO3\CMS\Extensionmanager\Controller\ActionController\createZipFileFromExtension(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\fileContentIsExtractedAsExpected(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\fileContentIsExtractedAsExpectedAndSetsPermissions(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\filesCanNotGetExtractedOutsideTargetDirectory(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\flush(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\getDefaultUploadFolderForPageTest(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\getDefaultUploadFolderForUserTest(), TYPO3\CMS\Install\Report\InstallStatusReport\getFileSystemStatus(), TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importImagesWithStaticAndFallbackStorages(), TYPO3\CMS\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\Core\Tests\Functional\Service\Archive\ZipServiceTest\nonExistentFileThrowsException(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\resolveAllExistingSitesReadsConfiguration(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\resolveWithUserAndPageConfigTest(), and TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\resolveWithUserConfigTest().

◆ mkdir_deep()

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

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

Parameters
string$directory‪Target directory to create
Exceptions

Definition at line 1650 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\__construct(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\buildFileDeclarations(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\clearAssetsFolderClearsFolder(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\createDirectoriesForExtensionFiles(), TYPO3\CMS\Extensionmanager\Tests\Unit\Controller\ActionControllerTest\createFakeExtension(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\createFakeExtension(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\createFinalCacheDirectory(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Core\Tests\Unit\Utility\ExtensionManagementUtilityTest\createMockPackageManagerWithMockPackage(), TYPO3\CMS\Core\Core\ClassLoadingInformation\ensureAutoloadInfoDirExists(), TYPO3\CMS\Install\Service\Session\FileSessionHandler\ensureSessionSavePathExists(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\AbstractNodeTest\existsReturnsTrueIfIsLinkAndTargetIsDead(), TYPO3\CMS\Install\Controller\EnvironmentController\getImagesPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusCallsGetChildrenStatusForStatus(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\FileNodeTest\getStatusReturnsArray(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\RootNodeTest\getStatusReturnsArrayWithOkStatusAndCallsOwnStatusMethods(), TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper\getTempFolderPath(), TYPO3\CMS\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\Resource\ResourceCompressor\initialize(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\DirectoryNodeTest\isDirectoryReturnsFalseIfNameIsALinkToADirectory(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\FileNodeTest\isFileReturnsFalseIfNameIsALinkFile(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\removeDirectoryDoesNotRemoveContentOfSymlinkedTargetDirectory(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceFactoryTest\retrieveFileOrFolderObjectReturnsFileFromPublicFolderWhenProjectRootIsNotPublic(), TYPO3\CMS\Install\Service\SetupDatabaseService\setDefaultConnectionSettings(), TYPO3\CMS\Install\Service\CoreUpdateService\setDownloadTargetPath(), TYPO3\CMS\Install\Tests\Unit\FolderStructure\LinkNodeTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Package\PackageTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Log\Writer\FileWriterTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Log\Writer\RotatingFileWriterTest\setUp(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\FileHandlingUtilityTest\setUp(), TYPO3\CMS\Core\Tests\Unit\Configuration\SiteConfigurationTest\setUp(), TYPO3\CMS\Frontend\Tests\Functional\Imaging\GifBuilderTest\setupFullTestEnvironment(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\systemCachesCanBeWarmedIfCacheIsBroken(), TYPO3\CMS\Install\Service\LanguagePackService\unzipTranslationFile(), TYPO3\CMS\Core\Configuration\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 ( string  $address)
static

Normalize an IPv6 address to full length

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

Definition at line 239 of file GeneralUtility.php.

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

◆ rmdir()

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

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

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

Definition at line 1698 of file GeneralUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\cachesCanBeWarmed(), TYPO3\CMS\Install\Service\Typo3tempFileService\clearAssetsFolder(), TYPO3\CMS\Core\Tests\Unit\Locking\SimpleLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\diCachesDoesNotWarmSystemCaches(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\flush(), TYPO3\CMS\Install\Service\LanguagePackService\languagePackDownload(), TYPO3\CMS\Install\SystemEnvironment\ServerResponse\ServerResponseCheck\purgeFileDeclarations(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeBackupFolder(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\removeDirectory(), TYPO3\CMS\Extensionmanager\Controller\UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), TYPO3\CMS\Core\Tests\Functional\Command\CacheWarmupCommandTest\systemCachesCanBeWarmed(), TYPO3\CMS\Core\Tests\Functional\Service\Archive\ZipServiceTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceCompressorTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\DefaultUploadFolderResolverTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\StorageRepositoryTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\ResourceStorageTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\Service\Typo3tempFileServiceTest\tearDown(), TYPO3\CMS\Core\Tests\Functional\Resource\Driver\LocalDriverTest\tearDown(), TYPO3\CMS\Form\Tests\Functional\Mvc\Validation\MimeTypeValidatorTest\tearDown(), TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\SysRedirectRootPageMoveMigrationTest\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().

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

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

◆ underscoredToUpperCamelCase()

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

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

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

Definition at line 654 of file GeneralUtility.php.

◆ validIP()

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

Validate a given IP address.

Possible format are IPv4 and IPv6.

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

Definition at line 303 of file GeneralUtility.php.

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

◆ validIPv4()

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

Validate a given IP address to the IPv4 address format.

Example for possible format: 10.0.45.99

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

Definition at line 316 of file GeneralUtility.php.

◆ validIPv6()

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

Validate a given IP address to the IPv6 address format.

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

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

Definition at line 329 of file GeneralUtility.php.

◆ writeFile()

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

Writes $content to the file $file

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

Definition at line 1465 of file GeneralUtility.php.

Referenced by 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\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(), TYPO3\CMS\Core\Configuration\SiteConfiguration\writeSettings(), and TYPO3\CMS\Impexp\Import\writeSysFileRecords().

◆ writeFileToTypo3tempDir()

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

◆ xml2array()

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

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

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

Definition at line 1261 of file GeneralUtility.php.

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

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

◆ xml2arrayProcess()

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

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

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

Definition at line 1284 of file GeneralUtility.php.

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

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

◆ xmlRecompileFromStructValArray()

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

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

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

Definition at line 1390 of file GeneralUtility.php.

Member Data Documentation

◆ $container

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

Definition at line 53 of file GeneralUtility.php.

◆ $currentLocale

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

Definition at line 564 of file GeneralUtility.php.

◆ $finalClassNameCache

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

Definition at line 75 of file GeneralUtility.php.

◆ $indpEnvCache

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

Definition at line 80 of file GeneralUtility.php.

◆ $isValid

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

Definition at line 644 of file GeneralUtility.php.

◆ $labelArr

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

Definition at line 559 of file GeneralUtility.php.

◆ $localeInfo

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

Definition at line 567 of file GeneralUtility.php.

◆ $multiplier [1/2]

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

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

◆ $nonSingletonInstances

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

Definition at line 67 of file GeneralUtility.php.

◆ $oldLocale

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

Definition at line 565 of file GeneralUtility.php.

◆ $output [1/2]

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

Definition at line 1155 of file GeneralUtility.php.

◆ $output [2/2]

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

Definition at line 1246 of file GeneralUtility.php.

◆ $singletonInstances

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

Definition at line 60 of file GeneralUtility.php.

◆ $sizeInBytes

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

Definition at line 570 of file GeneralUtility.php.

◆ $sizeInUnits

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

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