TYPO3  7.6
Static Public Member Functions | Public Attributes | Static Protected Member Functions | Static Protected Attributes | List of all members
GeneralUtility Class Reference
Inheritance diagram for GeneralUtility:
GeneralUtilityFixture

Static Public Member Functions

static _GP ($var)
 
static _GPmerged ($parameter)
 
static _GET ($var=null)
 
static _POST ($var=null)
 
static _GETset ($inputGet, $key= '')
 
static removeXSS ($string)
 
static gif_compress ($theFile, $type)
 
static png_to_gif_by_imagemagick ($theFile)
 
static read_png_gif ($theFile, $output_png=false)
 
static fixed_lgd_cs ($string, $chars, $appendString= '...')
 
static cmpIP ($baseIP, $list)
 
static cmpIPv4 ($baseIP, $list)
 
static cmpIPv6 ($baseIP, $list)
 
static IPv6Hex2Bin ($hex)
 
static IPv6Bin2Hex ($bin)
 
static normalizeIPv6 ($address)
 
static compressIPv6 ($address)
 
static validIP ($ip)
 
static validIPv4 ($ip)
 
static validIPv6 ($ip)
 
static cmpFQDN ($baseHost, $list)
 
static isOnCurrentHost ($url)
 
static inList ($list, $item)
 
static rmFromList ($element, $list)
 
static expandList ($list)
 
static compat_version ($verNumberStr)
 
static md5int ($str)
 
static shortMD5 ($input, $len=10)
 
static hmac ($input, $additionalSecret= '')
 
static uniqueList ($in_list, $secondParameter=null)
 
static split_fileref ($fileNameWithPath)
 
static dirname ($path)
 
static modifyHTMLColor ($color, $R, $G, $B)
 
static modifyHTMLColorAll ($color, $all)
 
static isFirstPartOfStr ($str, $partStr)
 
static formatSize ($sizeInBytes, $labels= '', $base=0)
 
static convertMicrotime ($microtime)
 
static splitCalc ($string, $operators)
 
static deHSCentities ($str)
 
static slashJS ($string, $extended=false, $char= '\'')
 
static rawUrlEncodeJS ($str)
 
static rawUrlEncodeFP ($str)
 
static validEmail ($email)
 
static isBrokenEmailEnvironment ()
 
static normalizeMailAddress ($address)
 
static formatForTextarea ($content)
 
static strtoupper ($str)
 
static strtolower ($str)
 
static generateRandomBytes ($bytesToReturn)
 
static idnaEncode ($value)
 
static getRandomHexString ($count)
 
static underscoredToUpperCamelCase ($string)
 
static underscoredToLowerCamelCase ($string)
 
static camelCaseToLowerCaseUnderscored ($string)
 
static lcfirst ($string)
 
static isValidUrl ($url)
 
static inArray (array $in_array, $item)
 
static intExplode ($delimiter, $string, $removeEmptyValues=false, $limit=0)
 
static revExplode ($delimiter, $string, $count=0)
 
static trimExplode ($delim, $string, $removeEmptyValues=false, $limit=0)
 
static removeArrayEntryByValue (array $array, $cmpValue)
 
static keepItemsInArray (array $array, $keepItems, $getValueFunc=null)
 
static implodeArrayForUrl ($name, array $theArray, $str= '', $skipBlank=false, $rawurlencodeParamName=false)
 
static explodeUrl2Array ($string, $multidim=false)
 
static compileSelectedGetVarsFromArray ($varList, array $getArray, $GPvarAlt=true)
 
static addSlashesOnArray (array &$theArray)
 
static stripSlashesOnArray (array &$theArray)
 
static slashArray (array $arr, $cmd)
 
static remapArrayKeys (&$array, $mappingTable)
 
static array_merge (array $arr1, array $arr2)
 
static arrayDiffAssocRecursive (array $array1, array $array2)
 
static csvValues (array $row, $delim= ',', $quote= '"')
 
static removeDotsFromTS (array $ts)
 
static naturalKeySortRecursive (&$array)
 
static get_tag_attributes ($tag)
 
static split_tag_attributes ($tag)
 
static implodeAttributes (array $arr, $xhtmlSafe=false, $dontOmitBlankAttribs=false)
 
static wrapJS ($string, $linebreak=true)
 
static xml2tree ($string, $depth=999, $parserOptions=array())
 
static array2xml_cs (array $array, $docTag= 'phparray', array $options=array(), $charset= '')
 
static array2xml (array $array, $NSprefix= '', $level=0, $docTag= 'phparray', $spaceInd=0, array $options=array(), array $stackData=array())
 
static xml2array ($string, $NSprefix= '', $reportDocTag=false)
 
static xmlRecompileFromStructValArray (array $vals)
 
static xmlGetHeaderAttribs ($xmlData)
 
static minifyJavaScript ($script, &$error= '')
 
static getUrl ($url, $includeHeader=0, $requestHeaders=false, &$report=null)
 
static writeFile ($file, $content, $changePermissions=false)
 
static fixPermissions ($path, $recursive=false)
 
static writeFileToTypo3tempDir ($filepath, $content)
 
static mkdir ($newFolder)
 
static mkdir_deep ($directory, $deepDirectory= '')
 
static rmdir ($path, $removeNonEmpty=false)
 
static flushDirectory ($directory, $keepOriginalDirectory=false, $flushOpcodeCache=false)
 
static get_dirs ($path)
 
static getFilesInDir ($path, $extensionList= '', $prependPath=false, $order= '', $excludePattern= '')
 
static getAllFilesAndFoldersInPath (array $fileArr, $path, $extList= '', $regDirs=false, $recursivityLevels=99, $excludePattern= '')
 
static removePrefixPathFromList (array $fileArr, $prefixToRemove)
 
static fixWindowsFilePath ($theFile)
 
static resolveBackPath ($pathStr)
 
static locationHeaderUrl ($path)
 
static getMaxUploadFileSize ()
 
static getBytesFromSizeMeasurement ($measurement)
 
static getMaximumPathLength ()
 
static createVersionNumberedFilename ($file)
 
static getThisUrl ()
 
static linkThisScript (array $getParams=array())
 
static linkThisUrl ($url, array $getParams=array())
 
static getIndpEnv ($getEnvName)
 
static isAllowedHostHeaderValue ($hostHeaderValue)
 
static hostHeaderValueMatchesTrustedHostsPattern ($hostHeaderValue)
 
static milliseconds ()
 
static clientInfo ($useragent= '')
 
static getHostname ($requestHost=true)
 
static getFileAbsFileName ($filename, $onlyRelative=true, $relToTYPO3_mainDir=false)
 
static validPathStr ($theFile)
 
static isAbsPath ($path)
 
static isAllowedAbsPath ($path)
 
static verifyFilenameAgainstDenyPattern ($filename)
 
static copyDirectory ($source, $destination)
 
static sanitizeLocalUrl ($url= '')
 
static upload_copy_move ($source, $destination)
 
static upload_to_tempfile ($uploadedFileName)
 
static unlink_tempfile ($uploadedTempFileName)
 
static tempnam ($filePrefix, $fileSuffix= '')
 
static stdAuthCode ($uid_or_record, $fields= '', $codeLength=8)
 
static hideIfNotTranslated ($l18n_cfg_fieldValue)
 
static hideIfDefaultLanguage ($localizationConfiguration)
 
static llXmlAutoFileName ($fileRef, $language, $sameLocation=false)
 
static resolveSheetDefInDS ($dataStructArray, $sheet= 'sDEF')
 
static resolveAllSheetsInDS (array $dataStructArray)
 
static callUserFunction ($funcName, &$params, &$ref, $checkPrefix= '', $errorMode=0)
 
static getUserObj ($classRef)
 
static makeInstance ($className)
 
static setSingletonInstance ($className, SingletonInterface $instance)
 
static removeSingletonInstance ($className, SingletonInterface $instance)
 
static resetSingletonInstances (array $newSingletonInstances)
 
static getSingletonInstances ()
 
static addInstance ($className, $instance)
 
static purgeInstances ()
 
static flushInternalRuntimeCaches ()
 
static makeInstanceService ($serviceType, $serviceSubType= '', $excludeServiceKeys=array())
 
static requireOnce ($requireFile)
 
static requireFile ($requireFile)
 
static quoted_printable ($string, $maxlen=76)
 
static encodeHeader ($line, $enc= 'quoted-printable', $charset= 'utf-8')
 
static substUrlsInPlainText ($message, $urlmode= '76', $index_script_url= '')
 
static makeRedirectUrl ($inUrl, $l=0, $index_script_url= '')
 
static freetypeDpiComp ($fontSize)
 
static initSysLog ()
 
static devLog ($msg, $extKey, $severity=0, $dataVar=false)
 
static deprecationLog ($msg)
 
static getDeprecationLogFileName ()
 
static logDeprecatedFunction ()
 
static arrayToLogString (array $arr, $valueList=array(), $valueLength=20)
 
static imageMagickCommand ($command, $parameters, $path= '')
 
static unQuoteFilenames ($parameters, $unQuote=false)
 
static quoteJSvalue ($value)
 
static cleanOutputBuffers ()
 
static flushOutputBuffers ()
 
static presetApplicationContext (ApplicationContext $applicationContext)
 
static getApplicationContext ()
 
static isRunningOnCgiServerApi ()
 

Public Attributes

const SYSLOG_SEVERITY_INFO = 0
 
const SYSLOG_SEVERITY_NOTICE = 1
 
const SYSLOG_SEVERITY_WARNING = 2
 
const SYSLOG_SEVERITY_ERROR = 3
 
const SYSLOG_SEVERITY_FATAL = 4
 
const ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL = '.*'
 
const ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME = 'SERVER_NAME'
 

Static Protected Member Functions

static generateRandomBytesOpenSsl ($bytesToGenerate)
 
static generateRandomBytesMcrypt ($bytesToGenerate)
 
static generateRandomBytesUrandom ($bytesToGenerate)
 
static generateRandomBytesFallback ($bytesToReturn)
 
static xml2arrayProcess ($string, $NSprefix= '', $reportDocTag=false)
 
static getRedirectUrlFromHttpHeaders ($content)
 
static stripHttpHeaders ($content)
 
static createDirectoryPath ($fullDirectoryPath)
 
static isInternalRequestType ()
 
static instantiateClass ($className, $arguments)
 
static getClassName ($className)
 
static getImplementationForClass ($className)
 
static classHasImplementation ($className)
 
static checkInstanceClassName ($className, $instance)
 

Static Protected Attributes

static $allowHostHeaderValue = false
 
static $singletonInstances = array()
 
static $nonSingletonInstances = array()
 
static $finalClassNameCache = array()
 
static $applicationContext = null
 
static $idnaStringCache = array()
 
static $idnaConverter = null
 
static $supportedCgiServerApis
 
static $indpEnvCache = []
 

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: The class is intended to be used without creating an instance of it. So: Don't instantiate - call functions with "\TYPO3\CMS\Core\Utility\GeneralUtility::" prefixed the function name. So use ::[method-name] to refer to the functions, eg. '::milliseconds()'

Definition at line 36 of file GeneralUtility.php.

Member Function Documentation

static _GET (   $var = null)
static

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

Parameters
string$varOptional pointer to value in GET array (basically name of GET var)
Returns
mixed If $var is set it returns the value of $_GET[$var]. If $var is NULL (default), returns $_GET itself. In any case slashes are stipped from the output!
See Also
_POST(), _GP(), _GETset()

Definition at line 176 of file GeneralUtility.php.

Referenced by DocumentTemplate\__construct(), UriBuilder\buildBackendUri(), TypoScriptFrontendController\calculateLinkVars(), Application\defineAdditionalEntryPointRelatedConstants(), AdminPanelView\display(), UninstallExtension\executeAction(), ExtensionCompatibilityTester\executeAction(), SecurityStatusReport\executeAdminCommand(), ConfigurationStatus\executeAdminCommand(), ServerRequestFactory\fromGlobals(), TypoScriptFrontendController\getConfigArray(), ClickMenuController\getContextMenuAction(), ContentObjectRenderer\getData(), ExtDirectApi\getExtDirectApi(), FrontendLoginController\getPreserveGetVars(), PreviewHook\getPreviewConfiguration(), ContentObjectRenderer\getQueryArguments(), ContentObjectRenderer\getUrlToCurrentLocation(), BackendController\handlePageEditing(), ElementInformationController\init(), ReportController\initializeAction(), AdministrationController\initializeAction(), ClickMenuController\main(), TemplateAnalyzerModuleFunctionController\main(), TypoScriptTemplateObjectBrowserModuleFunctionController\main(), TypoScriptFrontendController\makeCacheHash(), ModuleTemplate\makeShortcutIcon(), DocumentTemplate\makeShortcutIcon(), ModuleTemplate\makeShortcutUrl(), DocumentTemplate\makeShortcutUrl(), TypoScriptFrontendController\mergingWithGetVars(), TypoScriptTemplateObjectBrowserModuleFunctionController\modMenu(), EditDocumentController\preInit(), TypoScriptTemplateInfoHook\preStartPageHook(), FileEditHook\preStartPageHook(), AdministrationController\processRequest(), ElementInformationController\renderBackButton(), BackendController\setStartupModule(), AbstractLinkHandler\setTemporaryDbMounts(), DatabaseBrowser\setTemporaryDbMounts(), PageLinkHandler\setTemporaryDbMounts(), and AbstractUserAuthentication\start().

static _GETset (   $inputGet,
  $key = '' 
)
static

Writes input value to $_GET.

Parameters
mixed$inputGet
string$key
Returns
void

Definition at line 211 of file GeneralUtility.php.

References $GLOBALS, elseif, and ArrayUtility\mergeRecursiveWithOverrule().

Referenced by TypoScriptFrontendController\getConfigArray(), PreviewHook\getPreviewConfiguration(), and TypoScriptFrontendController\mergingWithGetVars().

static _GP (   $var)
static

Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST (that is equalent to 'GP' order) To enhance security in your scripts, please consider using GeneralUtility::_GET or GeneralUtility::_POST if you already know by which method your data is arriving to the scripts!

Parameters
string$varGET/POST var to return
Returns
mixed POST var named $var and if not set, the GET var of the same name.

Definition at line 139 of file GeneralUtility.php.

Referenced by RecyclerAjaxController\__construct(), ListController\__construct(), ClickMenuController\__construct(), LoginController\__construct(), UriBuilder\buildBackendUri(), AbstractUserAuthentication\checkAuthentication(), AbstractFunctionModule\checkExtObj(), BaseScriptClass\checkExtObj(), PreviewHook\checkForPreview(), LoginController\checkRedirect(), ImportExportController\checkUpload(), DataHandler\checkValueForFlex(), LoginController\detectLoginProvider(), TypoScriptFrontendController\determineId(), ConditionMatcher\determinePageId(), AbstractElementBrowser\determineScriptUrl(), AbstractRecordList\determineScriptUrl(), AbstractTreeView\determineScriptUrl(), FrontendEditPanel\editIcons(), FrontendEditPanel\editPanelLinkWrap(), FolderTreeView\evaluateExpandCollapseParameter(), ExtendedTemplateService\ext_getObjTree(), TypoScriptFrontendController\fetch_the_id(), ReviewController\fullIndexAction(), DatabaseIntegrityView\func_refindex(), PageTsBackendLayoutDataProvider\generatePageTsConfig(), AbstractController\getAction(), RecordHistory\getArgument(), FileBrowser\getBulkSelector(), ElementHistoryController\getButtons(), ImportExportController\getButtons(), AbstractAction\getContext(), AdminPanelView\getEditModule(), RecyclerModuleController\getJavaScriptConfiguration(), LinkAnalyzer\getLinkStatistics(), FrontendUserAuthentication\getLoginFormData(), AbstractUserAuthentication\getLoginFormData(), SchedulerModuleController\getModuleContent(), ActionTask\getOverview(), PreviewHook\getPreviewConfiguration(), ViewModuleController\getPreviewFrameWidths(), PreviewHook\getPreviewInputCode(), ViewModuleController\getPreviewLanguages(), ActionTask\getTask(), AbstractConditionMatcher\getVariableCommon(), AbstractFunctionModule\handleExternalFunctionValue(), BackendUserController\indexAction(), UserElementsController\init(), EditController\init(), ParseHtmlController\init(), ElementBrowserController\init(), RenameFileController\init(), FileUploadController\init(), RteController\init(), ReplaceFileController\init(), MoveElementController\init(), CreateFolderController\init(), EditFileController\init(), AddController\init(), FileController\init(), FileSystemNavigationFrameController\init(), PageTreeNavigationController\init(), ImportExportController\init(), TableController\init(), SimpleDataHandlerController\init(), TypoScriptTemplateModuleController\init(), ColorpickerController\init(), NewContentElementController\init(), NewRecordController\init(), ClickMenu\init(), BaseScriptClass\init(), RecordList\init(), PageLayoutController\init(), EditDocumentController\init(), FrontendEditingController\initConfigOptions(), TypoScriptFrontendController\initFEuser(), AdminPanelView\initialize(), AbstractController\initializeAction(), RecyclerModuleController\initializeAction(), PermissionController\initializeAction(), RequestHandler\initializeController(), AbstractTreeView\initializePositionSaving(), FolderBrowser\initVariables(), DatabaseBrowser\initVariables(), FileBrowser\initVariables(), AbstractElementBrowser\initVariables(), SelectImage\initVariables(), BrowseLinksController\initVariables(), LoginController\isLoginInProgress(), ActionList\listURL(), EditDocumentController\localizationRedirect(), SortPagesWizardModuleFunction\main(), Clickmenu\main(), CreatePagesWizardModuleFunctionController\main(), ImportExportTask\main(), ElementBrowserFramesetController\main(), InfoPageTyposcriptConfigController\main(), ModuleController\main(), TypoScriptTemplateConstantEditorModuleFunctionController\main(), FrontendLoginController\main(), ImportExportController\main(), LinkValidatorReport\main(), VersionModuleController\main(), ColorpickerController\main(), TypoScriptTemplateObjectBrowserModuleFunctionController\main(), ParseHtmlController\main_parse_html(), UserElementsController\main_user(), ConfigurationView\menuConfig(), DatabaseIntegrityView\menuConfig(), VersionModuleController\menuConfig(), BaseScriptClass\menuConfig(), RecordList\menuConfig(), FileListController\menuConfig(), PageLayoutController\menuConfig(), PageLayoutView\newLanguageButton(), Compatibility6ExtractionUpdate\performUpdate(), EditDocumentController\preInit(), ModuleController\printLogMgm(), ClickMenu\printNewDBLevel(), ModuleController\printSqlCheck(), PageTreeView\printTree(), ModuleSettings\processStoreControl(), QueryView\procesStoreControl(), AbstractController\redirect(), DocumentTemplate\redirectUrls(), ModuleTemplate\redirectUrls(), UsernamePasswordLoginProvider\render(), PagePathViewHelper\renderStatic(), AdminPanelView\saveConfigOptions(), DatabaseRowInitializeNew\setDefaultsFromDevVals(), FrontendLoginController\showLogin(), SetupModuleController\simulateUser(), ReviewController\singleIndexAction(), AbstractDatabaseRecordList\start(), ArrayBrowser\tree(), LinkValidatorReport\updateBrokenLinks(), ActionTask\viewNewBackendUser(), ActionTask\viewRecordList(), and ArrayBrowser\wrapArrayKey().

static _GPmerged (   $parameter)
static

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

Parameters
string$parameterKey (variable name) from GET or POST vars
Returns
array Returns the GET vars merged recursively onto the POST vars.

Definition at line 158 of file GeneralUtility.php.

References ArrayUtility\mergeRecursiveWithOverrule().

Referenced by SchedulerModuleController\getModuleContent(), and AbstractConditionMatcher\getVariableCommon().

static _POST (   $var = null)
static

Returns the global $_POST array (or value from) normalized to contain un-escaped values. ALWAYS use this API function to acquire the $_POST variables!

Parameters
string$varOptional pointer to value in POST array (basically name of POST var)
Returns
mixed If $var is set it returns the value of $_POST[$var]. If $var is NULL (default), returns $_POST itself. In any case slashes are stipped from the output!
See Also
_GET(), _GP()

Definition at line 194 of file GeneralUtility.php.

Referenced by PermissionAjaxController\__construct(), ShortcutToolbarItem\addShortcut(), UriBuilder\buildBackendUri(), FrontendLoginController\changePassword(), SchedulerModuleController\executeTasks(), ServerRequestFactory\fromGlobals(), TypoScriptTemplateModuleController\getButtons(), ContentObjectRenderer\getData(), FrontendUserAuthentication\getLoginFormData(), AbstractUserAuthentication\getLoginFormData(), AbstractController\getPostValues(), PreviewHook\getPreviewConfiguration(), ContentObjectRenderer\getQueryArguments(), TypoScriptTemplateConstantEditorModuleFunctionController\main(), TypoScriptTemplateInformationModuleFunctionController\main(), TypoScriptTemplateObjectBrowserModuleFunctionController\main(), QueryGenerator\procesData(), SpellCheckingController\processRequest(), ModuleMenuView\saveMenuState(), SpellCheckingController\setPersonalDictionaryPath(), FrontendLoginController\showForgot(), ShortcutToolbarItem\tryAddingTheShortcut(), VersionModuleController\versioningMgm(), and ActionTask\viewNewBackendUser().

static addInstance (   $className,
  $instance 
)
static

Sets the instance of a non-singleton class to be returned by makeInstance.

If this function is called multiple times for the same $className, makeInstance will return the instances in the order in which they have been added (FIFO).

Warning: This is a helper method for unit tests. Do not call this directly in production code!

See Also
makeInstance
Exceptions
\InvalidArgumentExceptionif class extends
Parameters
string$className
object$instance
Returns
void

Definition at line 4682 of file GeneralUtility.php.

Referenced by TcaInputPlaceholdersTest\addDataReturnsValueFromRelationsRecursively(), TcaSelectItemsTest\processSelectFieldValueAddsInvalidValuesToItemsForSingleSelects(), TcaSelectItemsTest\processSelectFieldValueDoesNotCallRelationManagerForStaticOnlyItems(), TypolinkViewHelperTest\renderReturnsResultOfContentObjectRenderer(), CropViewHelperTest\respectHtmlCanBeDisabled(), CropViewHelperTest\respectWordBoundariesCanBeDisabled(), StandaloneViewTest\setUp(), CropViewHelperTest\viewHelperCallsCropHtmlByDefault(), and CropViewHelperTest\viewHelperCallsCropHtmlByDefault2().

static addSlashesOnArray ( array &  $theArray)
static

AddSlash array This function traverses a multidimensional array and adds slashes to the values. NOTE that the input array is and argument by reference.!! Twin-function to stripSlashesOnArray

Parameters
array$theArrayMultidimensional input array, (REFERENCE!)
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
Returns
array

Definition at line 1687 of file GeneralUtility.php.

static array2xml ( array  $array,
  $NSprefix = '',
  $level = 0,
  $docTag = 'phparray',
  $spaceInd = 0,
array  $options = array(),
array  $stackData = array() 
)
static

Deprecated to call directly (unless you are aware of using XML prologues)! Use "array2xml_cs" instead (which adds an XML-prologue)

Converts a PHP array into an XML string. The XML output is optimized for readability since associative keys are used as tag names. This also means that only alphanumeric characters are allowed in the tag names AND only keys NOT starting with numbers (so watch your usage of keys!). However there are options you can set to avoid this problem. Numeric keys are stored with the default tag name "numIndex" but can be overridden to other formats) The function handles input values from the PHP array in a binary-safe way; All characters below 32 (except 9,10,13) will trigger the content to be converted to a base64-string The PHP variable type of the data IS preserved as long as the types are strings, arrays, integers and booleans. Strings are the default type unless the "type" attribute is set. The output XML has been tested with the PHP XML-parser and parses OK under all tested circumstances with 4.x versions. However, with PHP5 there seems to be the need to add an XML prologue a la <?xml version="1.0" encoding="[charset]" standalone="yes" ?> - otherwise UTF-8 is assumed! Unfortunately, many times the output from this function is used without adding that prologue meaning that non-ASCII characters will break the parsing!! This suchs of course! Effectively it means that the prologue should always be prepended setting the right characterset, alternatively the system should always run as utf-8! However using MSIE to read the XML output didn't always go well: One reason could be that the character encoding is not observed in the PHP data. The other reason may be if the tag-names are invalid in the eyes of MSIE. Also using the namespace feature will make MSIE break parsing. There might be more reasons...

Parameters
array$arrayThe input PHP array with any kind of data; text, binary, integers. Not objects though.
string$NSprefixtag-prefix, eg. a namespace prefix like "T3:"
int$levelCurrent recursion level. Don't change, stay at zero!
string$docTagAlternative document tag. Default is "phparray".
int$spaceIndIf greater than zero, then the number of spaces corresponding to this number is used for indenting, if less than zero - no indentation, if zero - a single TAB is used
array$optionsOptions for the compilation. Key "useNindex" => 0/1 (boolean: whether to use "n0, n1, n2" for num. indexes); Key "useIndexTagForNum" => "[tag for numerical indexes]"; Key "useIndexTagForAssoc" => "[tag for associative indexes"; Key "parentTagMap" => array('parentTag' => 'thisLevelTag')
array$stackDataStack data. Don't touch.
Returns
string An XML string made from the input content in the array.
See Also
xml2array()

Definition at line 2081 of file GeneralUtility.php.

References MathUtility\canBeInterpretedAsInteger(), and elseif.

Referenced by ImportExport\createXML(), and FlexFormTools\flexArray2Xml().

static array2xml_cs ( array  $array,
  $docTag = 'phparray',
array  $options = array(),
  $charset = '' 
)
static

Turns PHP array into XML. See array2xml()

Parameters
array$arrayThe input PHP array with any kind of data; text, binary, integers. Not objects though.
string$docTagAlternative document tag. Default is "phparray".
array$optionsOptions for the compilation. See array2xml() for description.
string$charsetForced charset to prologue
Returns
string An XML string made from the input content in the array.
See Also
xml2array(),array2xml()

Definition at line 2051 of file GeneralUtility.php.

static array_merge ( array  $arr1,
array  $arr2 
)
static

An array_merge function where the keys are NOT renumbered as they happen to be with the real php-array_merge function. It is "binary safe" in the sense that integer keys are overridden as well.

Parameters
array$arr1First array
array$arr2Second array
Returns
array Merged result.
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - native php '+' operator instead

Definition at line 1765 of file GeneralUtility.php.

Referenced by GeneralUtility\getAllFilesAndFoldersInPath(), and GeneralUtility\makeInstanceService().

static arrayDiffAssocRecursive ( array  $array1,
array  $array2 
)
static

Filters keys off from first array that also exist in second array. Comparison is done by keys. This method is a recursive version of php array_diff_assoc()

Parameters
array$array1Source array
array$array2Reduce source array by this array
Returns
array Source array reduced by keys also present in second array
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::arrayDiffAssocRecursive() instead

Definition at line 1780 of file GeneralUtility.php.

References ArrayUtility\arrayDiffAssocRecursive().

static arrayToLogString ( array  $arr,
  $valueList = array(),
  $valueLength = 20 
)
static

Converts a one dimensional array to a one line string which can be used for logging or debugging output Example: "loginType: FE; refInfo: Array; HTTP_HOST: www.example.org; REMOTE_ADDR: 192.168.1.5; REMOTE_HOST:; security_level:; showHiddenRecords: 0;"

Parameters
array$arrData array which should be outputted
mixed$valueListList of keys which should be listed in the output string. Pass a comma list or an array. An empty list outputs the whole array.
int$valueLengthLong string values are shortened to this length. Default: 20
Returns
string Output string with key names and their value as string

Definition at line 5245 of file GeneralUtility.php.

Referenced by AbstractUserAuthentication\checkAuthentication(), FrontendUserAuthentication\fetchGroupData(), AuthenticationService\getUser(), SyslogCommand\main(), AbstractUserAuthentication\processLoginData(), and ModuleSettings\processStoreControl().

static callUserFunction (   $funcName,
$params,
$ref,
  $checkPrefix = '',
  $errorMode = 0 
)
static

Calls a user-defined function/method in class Such a function/method should look like this: "function proc(&$params, &$ref) {...}"

Parameters
string$funcNameFunction/Method reference or Closure, '[file-reference":"]["&"]class/function["->"method-name]'. You can prefix this reference with "[file-reference]:" and ::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl->encodeSpURL". Finally; you can prefix the class name with "&" if you want to reuse a former instance of the same object call ("singleton").
mixed$paramsParameters to be pass along (typically an array) (REFERENCE!)
mixed$refReference to be passed along (typically "$this" - being a reference to the calling object) (REFERENCE!)
string$checkPrefixNot used anymore since 6.0
int$errorModeError mode (when class/function could not be found): 0 - call debug(), 1 - do nothing, 2 - raise an exception (allows to call a user function that may return FALSE)
Returns
mixed Content from method/function call or FALSE if the class/method/function was not found
See Also
getUserObj()

Definition at line 4278 of file GeneralUtility.php.

References $GLOBALS, debug(), and elseif.

Referenced by TypoScriptFrontendController\__construct(), TcaRecordTitle\addData(), DatabaseUserPermissionCheck\addData(), DataHandler\applyFiltersToValues(), ValidatorTask\buildMail(), BackendUserAuthentication\calcPerms(), WizardView\callRenderHook(), FrontendLoginController\changePassword(), TypoScriptFrontendController\checkAlternativeIdMethods(), AbstractUserAuthentication\checkAuthentication(), TypoScriptFrontendController\checkEnableFields(), DataHandler\clear_cacheCmd(), TypoScriptFrontendController\connectToDB(), TypoScriptFrontendController\contentStrReplace(), TypoScriptFrontendController\createHashBase(), TypoScriptFrontendController\determineId(), PageRenderer\doCompressCss(), PageRenderer\doCompressJavaScript(), PageRenderer\doConcatenateCss(), PageRenderer\doConcatenateJavaScript(), FrontendEditingController\editAction(), PageRepository\enableFields(), BackendController\executeHook(), PageRenderer\executePostRenderHook(), PageRenderer\executePreRenderHook(), PageRenderer\executeRenderPostTransformHook(), TypoScriptParser\executeValueModifier(), TypoScriptFrontendController\fetch_the_id(), BackendUserAuthentication\fetchGroups(), AbstractFrontend\flushByTag(), NoneElement\formatValue(), FrontendLoginController\generateAndSendHash(), TypoScriptFrontendController\generatePage_postProcessing(), ClientUtility\getBrowserInfo(), ButtonBar\getButtons(), TypoScriptFrontendController\getConfigArray(), DocumentTemplate\getDocHeaderButtons(), TypoScriptFrontendController\getFromCache(), SetupModuleController\getJavaScript(), BackendUserAuthentication\getPagePermsClause(), QueryView\getQueryResultCode(), AbstractDatabaseRecordList\getSearchFields(), EidRequestHandler\handleRequest(), TypoScriptFrontendController\headerNoCache(), TypoScriptFrontendController\hook_eofe(), TemplateService\includeStaticTypoScriptSources(), TypoScriptFrontendController\initFEuser(), TypoScriptFrontendController\isOutputting(), ElementBrowserRecordList\isRowListingConditionFulfilled(), TemplateService\linkData(), AbstractUserAuthentication\logoff(), PageInformationController\main(), FrontendLoginController\main(), MoveElementController\main(), EditFileController\main(), TypoScriptTemplateInformationModuleFunctionController\main(), NewContentElementController\main(), PageLayoutController\main(), IconFactory\mapRecordTypeToIconIdentifier(), IconUtility\mapRecordTypeToSpriteIconName(), EvaluateDisplayConditions\matchUserCondition(), DocumentTemplate\moduleBody(), TypoScriptFrontendController\pageErrorHandler(), TypoScriptFrontendController\previewInfo(), PagePositionMap\printRecordMap(), TypoScriptFrontendController\processOutput(), FrontendLoginController\processRedirect(), BackendUserAuthentication\recordEditAccessInternals(), UserElement\render(), SuggestWizardDefaultReceiver\renderRecord(), SetupModuleController\renderUserSetup(), ExtDirectEidController\routeAction(), VariableFrontend\set(), TypoScriptFrontendController\settingLanguage(), FrontendLoginController\showLogin(), AbstractUserAuthentication\start(), DocumentTemplate\startPage(), PageLayoutView\tt_content_drawHeader(), WorkspaceService\viewSingleRecord(), and PageTreeView\wrapTitle().

static camelCaseToLowerCaseUnderscored (   $string)
static

Returns a given CamelCasedString as an lowercase string with underscores. Example: Converts BlogExample to blog_example, and minimalValue to minimal_value

Parameters
string$stringString to be converted to lowercase underscore
Returns
string lowercase_and_underscored_string

Definition at line 1360 of file GeneralUtility.php.

Referenced by ExtensionManagementUtility\addExtJSModule(), and ResourceViewHelper\renderStatic().

static checkInstanceClassName (   $className,
  $instance 
)
staticprotected

Checks that $className is non-empty and that $instance is an instance of $className.

Exceptions
\InvalidArgumentExceptionif $className is empty or if $instance is no instance of $className
Parameters
string$classNamea class name
object$instancean object
Returns
void

Definition at line 4703 of file GeneralUtility.php.

static classHasImplementation (   $className)
staticprotected

Checks if a class has a configured implementation

Parameters
string$className
Returns
bool

Definition at line 4564 of file GeneralUtility.php.

References $GLOBALS.

static cleanOutputBuffers ( )
static

Ends and cleans all output buffers

Returns
void
Deprecated:
since TYPO3 CMS 7, will be removed in CMS 8, use ob_* functions directly or self::flushOutputBuffers

Definition at line 5340 of file GeneralUtility.php.

static clientInfo (   $useragent = '')
static

Client Browser Information

Parameters
string$useragentAlternative User Agent string (if empty, ::getIndpEnv('HTTP_USER_AGENT') is used)
Returns
array Parsed information about the HTTP_USER_AGENT in categories BROWSER, VERSION, SYSTEM

Definition at line 3722 of file GeneralUtility.php.

References elseif.

Referenced by TypoScriptFrontendController\__construct(), SelectImage\getAllowedItems(), FormResultCompiler\JSbottom(), and AbstractUserAuthentication\start().

static cmpFQDN (   $baseHost,
  $list 
)
static

Match fully qualified domain name with list of strings with wildcard

Parameters
string$baseHostA hostname or an IPv4/IPv6-address (will by reverse-resolved; typically REMOTE_ADDR)
string$listA 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 609 of file GeneralUtility.php.

References $list, and elseif.

Referenced by AbstractConditionMatcher\evaluateConditionCommon().

static cmpIP (   $baseIP,
  $list 
)
static

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

Parameters
string$baseIPIs the current remote IP address for instance, typ. REMOTE_ADDR
string$listIs a comma-list of IP-addresses to match with. *-wildcard 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 347 of file GeneralUtility.php.

References $list, and elseif.

Referenced by TypoScriptFrontendController\beLoginLinkIPList(), FrontendBackendUserAuthentication\checkBackendAccessSettingsFromInitPhp(), Bootstrap\checkBackendIpOrDie(), BackendUserAuthentication\checkLockToIP(), TypoScriptFrontendController\checkPageUnavailableHandler(), AbstractConditionMatcher\evaluateConditionCommon(), DatabaseConnection\explain(), AuthenticationService\getGroups(), and Bootstrap\initializeErrorHandling().

static cmpIPv4 (   $baseIP,
  $list 
)
static

Match IPv4 number with list of numbers with wildcard

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

Definition at line 369 of file GeneralUtility.php.

References $list.

static cmpIPv6 (   $baseIP,
  $list 
)
static

Match IPv6 address with a list of IPv6 prefixes

Parameters
string$baseIPIs the current remote IP address for instance
string$listIs a comma-list of IPv6 prefixes, could also contain IPv4 addresses
Returns
bool TRUE If an baseIP matches any prefix

Definition at line 416 of file GeneralUtility.php.

References $list, and elseif.

static compat_version (   $verNumberStr)
static

Returns TRUE if the current TYPO3 version (or compatibility version) is compatible to the input version Notice that this function compares branches, not versions (4.0.1 would be > 4.0.0 although they use the same compat_version)

Parameters
string$verNumberStrMinimum branch number required (format x.y / e.g. "4.0" NOT "4.0.0"!)
Returns
bool Returns TRUE if this setup is compatible with the provided version number
Todo:
Still needs a function to convert versions to branches

Definition at line 754 of file GeneralUtility.php.

References VersionNumberUtility\convertVersionNumberToInteger().

Referenced by AbstractConditionMatcher\evaluateConditionCommon().

static compileSelectedGetVarsFromArray (   $varList,
array  $getArray,
  $GPvarAlt = true 
)
static

Returns an array with selected keys from incoming data. (Better read source code if you want to find out...)

Parameters
string$varListList of variable/key names
array$getArrayArray from where to get values based on the keys in $varList
bool$GPvarAltIf set, then ::_GP() is used to fetch the value if not found (isset) in the $getArray
Returns
array Output array with selected variables.

Definition at line 1663 of file GeneralUtility.php.

References elseif.

Referenced by EditDocumentController\compileStoreDat(), ModuleTemplate\makeShortcutUrl(), and DocumentTemplate\makeShortcutUrl().

static compressIPv6 (   $address)
static

Compress an IPv6 address to the shortest notation

Parameters
string$addressGiven IPv6 address
Returns
string Compressed address
See Also
normalizeIPv6()

Definition at line 558 of file GeneralUtility.php.

static convertMicrotime (   $microtime)
static

Returns microtime input to milliseconds

Parameters
string$microtimeMicrotime
Returns
int Microtime input string converted to an integer (milliseconds)

Definition at line 987 of file GeneralUtility.php.

static copyDirectory (   $source,
  $destination 
)
static

Low level utility function to copy directories and content recursive

Parameters
string$sourcePath to source directory, relative to document root or absolute
string$destinationPath to destination directory, relative to document root or absolute

Definition at line 3934 of file GeneralUtility.php.

Referenced by ExtensionManagementService\copyDependencies(), UploadExtensionFileController\copyExtensionFolderToTempFolder(), InstallUtility\importInitialFiles(), ImportExport\loadFile(), and UploadExtensionFileController\removeExtensionAndRestoreFromBackup().

static 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
::mkdir_deep
Exceptions
\RuntimeExceptionIf directory could not be created

Definition at line 2865 of file GeneralUtility.php.

References $GLOBALS, and GeneralUtility\mkdir().

static createVersionNumberedFilename (   $file)
static

Function for static version numbers on files, based on the filemtime

This will make the filename automatically change when a file is changed, and by that re-cached by the browser. If the file does not exist physically the original file passed to the function is returned without the timestamp.

Behaviour is influenced by the setting TYPO3_CONF_VARS[TYPO3_MODE][versionNumberInFilename] = TRUE (BE) / "embed" (FE) : modify filename = FALSE (BE) / "querystring" (FE) : add timestamp as parameter

Parameters
string$fileRelative path to file including all potential query parameters (not htmlspecialchared yet)
Returns
string Relative path with version filename including the timestamp

Definition at line 3221 of file GeneralUtility.php.

References $GLOBALS, and GeneralUtility\strtolower().

Referenced by RichTextElement\getRteInitJsCode(), PageRenderer\processJsFile(), PageRenderer\renderAdditionalJavaScriptLibraries(), PageRenderer\renderCssFiles(), PageRenderer\renderCssLibraries(), and PageRenderer\renderJavaScriptFiles().

static csvValues ( array  $row,
  $delim = ',',
  $quote = '"' 
)
static

Takes a row and returns a CSV string of the values with $delim (default is ,) and $quote (default is ") as separator chars.

Parameters
array$rowInput array of values
string$delimDelimited, default is comma
string$quoteQuote-character to wrap around the values.
Returns
string A single line of CSV

Definition at line 1794 of file GeneralUtility.php.

static deHSCentities (   $str)
static

Re-converts HTML entities if they have been converted by htmlspecialchars() Note: Use htmlspecialchars($str, ENT_COMPAT, 'UTF-8', FALSE) to avoid double encoding. This makes the call to this method obsolete.

Parameters
string$strString which contains eg. "&amp;amp;" which should stay "&amp;". Or "&amp;#1234;" to "&#1234;". Or "&amp;#x1b;" to "&#x1b;
Returns
string Converted result.

Definition at line 1025 of file GeneralUtility.php.

static deprecationLog (   $msg)
static

Writes a message to the deprecation log.

Parameters
string$msgMessage (in English).
Returns
void

Definition at line 5165 of file GeneralUtility.php.

References $GLOBALS, and DebugUtility\debug().

Referenced by DuplicationBehavior\__construct(), PageTreeNavigationController\__construct(), ModuleSettings\__construct(), DocumentTemplate\__construct(), SpriteManager\addIconSprite(), ExtensionManagementUtility\addModule(), SpriteManager\addSingleIcons(), ExtensionManagementUtility\addTCAcolumns(), SpriteManager\addTcaTypeIcon(), ExtensionManagementUtility\buildBaseTcaFromSingleFiles(), ModuleLoader\checkMod(), DebugUtility\debugRows(), DatabaseTreeDataProvider\emitDeprecatedPostProcessTreeDataSignal(), AbstractConditionMatcher\evaluateConditionCommon(), Bootstrap\executeExtTablesAdditionalFile(), ClickMenu\FILE_launch(), DataHandler\fillInFieldArray(), PageRepository\getExtURL(), CompatibilityLayerUtility\getGlobalLayoutByElementType(), IconRegistry\getIconConfigurationByIdentifier(), CompatibilityLayerUtility\getNewAttributeName(), BackendUtility\getSpecConfParts(), IconUtility\getSpriteIconForFile(), IconUtility\getSpriteIconForRecord(), IconUtility\getSpriteIconForResource(), Bootstrap\initializeErrorHandling(), AbstractLinkBrowserController\initVariables(), PageGenerator\JSeventFunctions(), ValidatorTask\loadModTsConfig(), TypoScriptFrontendController\logDeprecatedTyposcript(), FrontendLoginController\main(), NewContentElementController\main(), EvaluateDisplayConditions\matchHideL10nSiblingsCondition(), TcaFlexPrepare\migrateFlexformTcaRecursive(), DataHandler\newlog2(), TypoScriptFrontendController\processOutput(), FlashMessagesViewHelper\render(), FormBuilder\reviveElement(), CompatibilityLayerUtility\setElementLayouts(), CompatibilityLayerUtility\setGlobalLayoutConfiguration(), TypoScriptFrontendController\settingLanguage(), DocumentTemplate\startPage(), and ArrayBrowser\tree().

static devLog (   $msg,
  $extKey,
  $severity = 0,
  $dataVar = false 
)
static

Logs message to the development log. This should be implemented around the source code, both frontend and backend, logging everything from the flow through an application, messages, results from comparisons to fatal errors. The result is meant to make sense to developers during development or debugging of a site. The idea is that this function is only a wrapper for external extensions which can set a hook which will be allowed to handle the logging of the information to any format they might wish and with any kind of filter they would like. If you want to implement the devLog in your applications, simply add lines like: if (TYPO3_DLOG) ::devLog('[write message in english here]', 'extension key');

Parameters
string$msgMessage (in english).
string$extKeyExtension key (from which extension you are calling the log)
int$severitySeverity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
mixed$dataVarAdditional data you want to pass to the logger.
Returns
void

Definition at line 5148 of file GeneralUtility.php.

References $GLOBALS.

Referenced by ModuleSettings\addToStoreList(), ModuleSettings\addToStoreListFromPrefix(), AuthenticationService\authUser(), AbstractUserAuthentication\checkAuthentication(), AbstractUserAuthentication\createUserSession(), ValidatorResolver\createValidator(), DatabaseConnection\debug_check_recordset(), DocumentTemplate\endPage(), FrontendUserAuthentication\fetchGroupData(), AbstractUserAuthentication\fetchUserSession(), AuthenticationService\getGroups(), CssStyledContentController\getImgColumnRelations(), AuthenticationService\getUser(), TypoScriptFrontendController\initUserGroups(), AbstractUserAuthentication\logoff(), DatabaseConnection\prepare_SELECTquery(), RsaAuthService\processLoginData(), AbstractUserAuthentication\processLoginData(), ModuleSettings\processStoreControl(), AbstractUserAuthentication\setAndSaveSessionData(), AbstractUserAuthentication\setSessionCookie(), AbstractUserAuthentication\start(), AbstractExceptionHandler\writeLogEntries(), and AbstractUserAuthentication\writeUC().

static dirname (   $path)
static

Returns the directory part of a path without trailing slash If there is no dir-part, then an empty string is returned. Behaviour:

'/dir1/dir2/script.php' => '/dir1/dir2' '/dir1/' => '/dir1' 'dir1/script.php' => 'dir1' 'd/script.php' => 'd' '/script.php' => '' '' => ''

Parameters
string$pathDirectory name / path
Returns
string Processed input value. See function description.

Definition at line 878 of file GeneralUtility.php.

Referenced by PreviewController\generateJavascript(), BackendController\generateJavascript(), and GeneralUtility\getIndpEnv().

static encodeHeader (   $line,
  $enc = 'quoted-printable',
  $charset = 'utf-8' 
)
static

Encode header lines Email headers must be ASCII, therefore they will be encoded to quoted_printable (default) or base64.

Parameters
string$lineContent to encode
string$encEncoding type: "base64" or "quoted-printable". Default value is "quoted-printable".
string$charsetCharset used for encoding
Returns
string The encoded string
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use mailer API instead

Definition at line 4897 of file GeneralUtility.php.

static 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$listComma-separated list of integers with ranges (string)
Returns
string New comma-separated list of items

Definition at line 724 of file GeneralUtility.php.

References $list.

Referenced by ContentObjectRenderer\stdWrap_expandList().

static explodeUrl2Array (   $string,
  $multidim = false 
)
static

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

Parameters
string$stringGETvars string
bool$multidimIf set, the string will be parsed into a multidimensional array if square brackets are used in variable names (using PHP function parse_str())
Returns
array 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 1637 of file GeneralUtility.php.

Referenced by UriBuilder\buildBackendUri(), ShortcutToolbarItem\createShortcutAction(), FrontendLoginController\getPreserveGetVars(), ContentObjectRenderer\getQueryArguments(), ContentObjectRenderer\getUrlToCurrentLocation(), RenameFileController\init(), ReplaceFileController\init(), ShortcutToolbarItem\initShortcuts(), TemplateService\linkData(), NewContentElementController\removeInvalidElements(), and EditRecordViewHelper\renderStatic().

static fixed_lgd_cs (   $string,
  $chars,
  $appendString = '...' 
)
static

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

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

Definition at line 325 of file GeneralUtility.php.

References $GLOBALS, and elseif.

Referenced by PageLayoutView\dataFields(), FrontendEditPanel\editPanel(), FileLinkHandler\expandFolder(), ImportExport\export_addRecord(), ExtendedTemplateService\ext_fixed_lgd(), TimeTracker\fixCLen(), PageLinkHandler\formatCurrentUrl(), FileList\getButtonsAndOtherMarkers(), DocumentTemplate\getHeader(), DocumentTemplate\getPagePath(), MetaInformation\getPath(), PageRepository\getPathFromRootline(), RecyclerUtility\getRecordPath(), BackendUtility\getRecordPath(), LiveSearch\getRecordTitlePrep(), DocumentTemplate\getResourceHeader(), AbstractTreeView\getTitleStr(), ShortcutToolbarItem\initShortcuts(), AbstractDatabaseRecordList\linkWrapItems(), SortPagesWizardModuleFunction\main(), CreatePagesWizardModuleFunctionController\main(), PageTreeNavigationController\main(), PageLayoutController\makeQuickEditMenu(), Clipboard\printContentFromTab(), ClickMenu\printDBClickMenu(), ClickMenu\printFileClickMenu(), TimeTracker\printTSlog(), RelationHandler\readyForInterface(), FileBrowser\renderFilesInFolder(), FolderBrowser\renderFolders(), PermissionAjaxController\renderGroupname(), TranslationStatusController\renderL10nTable(), InfoPageTyposcriptConfigController\renderList(), TypoScriptTemplateModuleController\renderList(), PermissionAjaxController\renderOwnername(), PagePathViewHelper\renderStatic(), and PageLayoutView\renderText().

static fixPermissions (   $path,
  $recursive = false 
)
static

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

Parameters
string$pathPath of file or folder, must not be escaped. Path can be absolute or relative
bool$recursiveIf 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 2694 of file GeneralUtility.php.

References $GLOBALS, and elseif.

Referenced by FileLockStrategy\acquire(), SimpleLockStrategy\acquire(), Locker\acquire(), Locker\acquireExclusiveLock(), LocalDriver\addFile(), GraphicalFunctions\combineExec(), LocalDriver\copyFileWithinStorage(), LocalDriver\createFile(), YouTubeHelper\getPreviewImage(), VimeoHelper\getPreviewImage(), GraphicalFunctions\gifCompress(), GraphicalFunctions\imageMagickExec(), IconUtility\imagemake(), GraphicalFunctions\ImageWrite(), ThumbnailView\main(), GraphicalFunctions\readPngGif(), LocalDriver\replaceFile(), and MboxTransport\send().

static fixWindowsFilePath (   $theFile)
static
static 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$directoryThe directory to be renamed and flushed
bool$keepOriginalDirectoryWhether to only empty the directory and not remove it
bool$flushOpcodeCacheAlso flush the opcode cache right after renaming the directory.
Returns
bool Whether the action was successful

Definition at line 2936 of file GeneralUtility.php.

References StringUtility\getUniqueId(), and GeneralUtility\makeInstance().

Referenced by ClearCacheService\clearAll().

static flushInternalRuntimeCaches ( )
static

Flush internal runtime caches

Used in unit tests only.

Returns
void

Definition at line 4738 of file GeneralUtility.php.

Referenced by TypoScriptFrontendControllerTest\setUp(), ConditionMatcherTest\setUp(), and FrontendLoginControllerTest\setUpFakeSitePathAndHost().

static flushOutputBuffers ( )
static

Ends and flushes all output buffers

Returns
void

Definition at line 5353 of file GeneralUtility.php.

References GeneralUtility\strtolower().

Referenced by CliRequestHandler\boot().

static formatForTextarea (   $content)
static

Formats a string for output between <textarea>-tags All content outputted in a textarea form should be passed through this function Not only is the content htmlspecialchar'ed on output but there is also a single newline added in the top. The newline is necessary because browsers will ignore the first newline after <textarea> if that is the first character. Therefore better set it!

Parameters
string$contentInput string to be formatted.
Returns
string Formatted for <textarea>-tags
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 1152 of file GeneralUtility.php.

static formatSize (   $sizeInBytes,
  $labels = '',
  $base = 0 
)
static

Formats the input integer $sizeInBytes as bytes/kilobytes/megabytes (-/K/M)

Parameters
int$sizeInBytesNumber of bytes to format.
string$labelsBinary unit name "iec", decimal unit name "si" or labels for bytes, kilo, mega, giga, and so on separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G". Defaults to "iec".
int$baseThe unit base if not using a unit name. Defaults to 1024.
Returns
string Formatted representation of the byte number, for output.

Definition at line 940 of file GeneralUtility.php.

References $GLOBALS.

Referenced by SearchController\compileSingleResultRow(), ImportExport\displayContentOverview(), ImportExport\export_addFile(), ImportExport\export_addRecord(), ImportExport\export_addSysFile(), NoneElement\formatValue(), ConfigurationStatus\getDeprecationLogStatus(), FileFacade\getSize(), UserElementsController\main_user(), AbstractContainer\previewFieldValue(), Clipboard\printContentFromTab(), ClickMenu\printFileClickMenu(), FileInfoHook\renderFileInformationContent(), FileBrowser\renderFilesInFolder(), FileLinkHandler\renderItem(), SizeViewHelper\renderStatic(), ContentObjectRenderer\stdWrap_bytes(), FileMaximumSizeValidator\substituteMarkers(), and FileMinimumSizeValidator\substituteMarkers().

static freetypeDpiComp (   $fontSize)
static

Function to compensate for DPI resolution.

Parameters
float$fontSizefont size for freetype function call
Returns
float compensated font size based on 96 dpi

Definition at line 5018 of file GeneralUtility.php.

Referenced by ThumbnailView\fontGif(), GraphicalFunctions\ImageTTFBBoxWrapper(), and GraphicalFunctions\ImageTTFTextWrapper().

static generateRandomBytes (   $bytesToReturn)
static

Returns a string of highly randomized bytes (over the full 8-bit range).

Note: Returned values are not guaranteed to be crypto-safe, most likely they are not, depending on the used retrieval method.

Parameters
int$bytesToReturnNumber of characters (bytes) to return
Returns
string Random Bytes
See Also
http://bugs.php.net/bug.php?id=52523
http://www.php-security.org/2010/05/09/mops-submission-04-generating-unpredictable-session-ids-and-hashes/index.html

Definition at line 1197 of file GeneralUtility.php.

Referenced by FrontendLoginController\generateAndSendHash(), and AbstractFormProtection\generateSessionToken().

static generateRandomBytesFallback (   $bytesToReturn)
staticprotected

Generate pseudo random bytes as last resort

Parameters
$bytesToReturn
Returns
string

Definition at line 1284 of file GeneralUtility.php.

References $GLOBALS, and StringUtility\getUniqueId().

static generateRandomBytesMcrypt (   $bytesToGenerate)
staticprotected

Generate random bytes using mcrypt if available

Parameters
$bytesToGenerate
Returns
string

Definition at line 1250 of file GeneralUtility.php.

static generateRandomBytesOpenSsl (   $bytesToGenerate)
staticprotected

Generate random bytes using openssl if available

Parameters
string$bytesToGenerate
Returns
string

Definition at line 1235 of file GeneralUtility.php.

static generateRandomBytesUrandom (   $bytesToGenerate)
staticprotected

Read random bytes from /dev/urandom if it is accessible

Parameters
$bytesToGenerate
Returns
string

Definition at line 1264 of file GeneralUtility.php.

static 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.

Parameters
string$pathPath to list directories from
Returns
array Returns an array with the directory entries as values. If no path, the return value is nothing.

Definition at line 2964 of file GeneralUtility.php.

Referenced by CrawlerHook\crawler_execute_type2(), and SpriteGenerator\getFolder().

static get_tag_attributes (   $tag)
static

Returns an array with all attributes of the input HTML tag as key/value pairs. Attributes are only lowercase a-z $tag is either a whole tag (eg '<TAG option="" attrib="VALUE">') or the parameter list (ex ' OPTION ATTRIB=VALUE>') If an attribute is empty, then the value for the key is empty. You can check if it existed with isset()

Parameters
string$tagHTML-tag string (or attributes only)
Returns
array Array with the attribute values.

Definition at line 1851 of file GeneralUtility.php.

References GeneralUtility\strtolower().

Referenced by ContentObjectRenderer\_parseFunc(), ContentObjectRenderer\addParams(), ContentObjectRenderer\encaps_lineSplit(), BrowseLinksController\initVariables(), AbstractPlugin\pi_openAtagHrefInJSwindow(), and Indexer\splitHTMLContent().

static getAllFilesAndFoldersInPath ( array  $fileArr,
  $path,
  $extList = '',
  $regDirs = false,
  $recursivityLevels = 99,
  $excludePattern = '' 
)
static

Recursively gather all files and folders of a path.

Parameters
array$fileArrEmpty input array (will have files added to it)
string$pathThe path to read recursively from (absolute) (include trailing slash!)
string$extListComma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
bool$regDirsIf set, directories are also included in output.
int$recursivityLevelsThe number of levels to dig down...
string$excludePatternregex pattern of files/directories to exclude
Returns
array An array with the found files/directories.

Definition at line 3056 of file GeneralUtility.php.

References GeneralUtility\array_merge().

Referenced by AbstractItemProvider\addItemsFromFolder(), CrawlerHook\crawler_execute_type2(), FileHandlingUtility\createZipFileFromExtension(), and TypoScriptParser\includeDirectory().

static getApplicationContext ( )
static
static getBytesFromSizeMeasurement (   $measurement)
static

Gets the bytes value from a measurement string like "100k".

Parameters
string$measurementThe measurement (e.g. "100k")
Returns
int The bytes value (e.g. 102400)

Definition at line 3182 of file GeneralUtility.php.

References elseif.

static getClassName (   $className)
staticprotected

Returns the class name for a new instance, taking into account registered implementations for this class

Parameters
string$classNameBase class name to evaluate
Returns
string Final class name to instantiate with "new [classname]

Definition at line 4537 of file GeneralUtility.php.

References ClassLoadingInformation\getClassNameForAlias().

static getDeprecationLogFileName ( )
static

Gets the absolute path to the deprecation log file.

Returns
string Absolute path to the deprecation log file

Definition at line 5203 of file GeneralUtility.php.

References $GLOBALS.

Referenced by ConfigurationStatus\getDeprecationLogFileLink(), and ConfigurationStatus\getDeprecationLogStatus().

static getFileAbsFileName (   $filename,
  $onlyRelative = true,
  $relToTYPO3_mainDir = false 
)
static

Returns the absolute filename of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the PATH_site of the TYPO3 installation and implies a check with ::validPathStr().

Parameters
string$filenameThe input filename/filepath to evaluate
bool$onlyRelativeIf $onlyRelative is set (which it is by default), then only return values relative to the current PATH_site is accepted.
bool$relToTYPO3_mainDirIf $relToTYPO3_mainDir is set, then relative paths are relative to PATH_typo3 constant - otherwise (default) they are relative to PATH_site
Returns
string Returns the absolute filename of $filename if valid, otherwise blank string.

Definition at line 3836 of file GeneralUtility.php.

References $filename, elseif, ExtensionManagementUtility\extPath(), and ExtensionManagementUtility\isLoaded().

Referenced by AbstractItemProvider\addItemsFromFolder(), AdditionalResourceService\addLocalizationResource(), FluidTemplateContentObject\applyStandardWrapToFluidPaths(), MicroDataSchema\buildJavascriptConfiguration(), ImportExport\checkOrCreateDir(), CrawlerHook\crawler_execute_type2(), UpdateScriptUtility\determineUpdateClassName(), ValidatorTask\execute(), ImportExport\export_addFile(), ImportExport\export_addFilesFromRelations(), ExtendedTemplateService\ext_getTSCE_config_image(), TypoScriptParser\extractIncludes(), Indexer\extractLinks(), SoftReferenceIndex\fileadminReferences(), SoftReferenceIndex\findRef_images(), SoftReferenceIndex\findRef_TStemplate(), SvgIconProvider\generateInlineMarkup(), BitmapIconProvider\generateMarkup(), SvgIconProvider\generateMarkup(), FileHandlingUtility\getAbsolutePath(), ModuleTemplate\getDynamicTabMenu(), DocumentTemplate\getDynamicTabMenu(), TemplateService\getFileName(), BackendUtility\getFlexFormDS(), ImageManipulationWizard\getFluidTemplateObject(), BackendController\getFluidTemplateObject(), PageLayoutController\getHeaderFlashMessagesForCurrentPid(), T3editorElement\getHTMLCodeForEditor(), DocumentTemplate\getHtmlTemplate(), FormEngineUtility\getIconHtml(), ImageViewHelper\getImageUri(), CliRequestHandler\getIncludeScriptByCommandLineKey(), DocumentationService\getLocalExtensions(), DocumentationService\getOfficialDocuments(), LocallangXmlParser\getParsedData(), AbstractXmlParser\getParsedData(), T3editor\getPreparedTemplate(), AbstractItemProvider\getRegisteredFlexForms(), BackendUtility\getRegisteredFlexForms(), PageRenderer\getTemplateForPart(), LoginController\getUriForFileName(), TypoScriptParser\includeDirectory(), TypoScriptParser\includeFile(), BackendController\includeLegacyBackendItems(), TaskModuleController\indexAction(), Indexer\indexRegularDocument(), ColorpickerController\init(), CharsetConverter\initCaseFolding(), CharsetConverter\initCharset(), AbstractAction\initializeHandle(), CharsetConverter\initToASCII(), CharsetConverter\initUnicodeData(), LocallangArrayParser\isWithinWebRoot(), PageRenderer\loadRequireJs(), LocalizationFactory\localizationOverride(), PageFunctionsController\main(), DatabaseIntegrityView\main(), TypoScriptTemplateObjectBrowserModuleFunctionController\main(), PageLayoutController\main(), RteImagesCommand\main_autoFix(), UploadedFile\moveTo(), TypoScriptFrontendController\pageErrorHandler(), AbstractContainer\previewFieldValue(), ImportExport\processSoftReferences_saveFile(), ImportExport\processSoftReferences_saveFile_createRelFile(), UsernamePasswordLoginProvider\render(), CssStyledContentController\render_uploads(), TaskModuleController\renderListMenu(), ResourceViewHelper\renderStatic(), AbstractContainer\renderTabMenu(), StandaloneView\resolveFileNamePath(), TemplateView\resolveFileNamePath(), AdditionalResourceService\resolvePath(), TcaFlexFetch\resolvePossibleExternalFileInDataStructure(), ResourceFactory\retrieveFileOrFolderObject(), LanguageStore\setConfiguration(), FluidTemplateContentObject\setLayoutRootPath(), FileWriter\setLogFile(), FluidTemplateContentObject\setPartialRootPath(), SoftReferenceIndex\setTypoLinkPartsElement(), DocumentTemplate\startPage(), DocumentationService\unzipDocumentPackage(), TerService\unzipTranslationFile(), TerService\updateTranslation(), AbstractWidgetControllerTest\viewConfigurationCanBeOverriddenThroughFrameworkConfiguration(), and ImportExport\writeFileVerify().

static getFilesInDir (   $path,
  $extensionList = '',
  $prependPath = false,
  $order = '',
  $excludePattern = '' 
)
static

Finds all files in a given path and returns them as an array. Each array key is a md5 hash of the full path to the file. This is done because 'some' extensions like the import/export extension depend on this.

Parameters
string$pathThe path to retrieve the files from.
string$extensionListA comma-separated list of file extensions. Only files of the specified types will be retrieved. When left blank, files of any type will be retrieved.
bool$prependPathIf TRUE, the full path to the file is returned. If FALSE only the file name is returned.
string$orderThe sorting order. The default sorting order is alphabetical. Setting $order to 'mtime' will sort the files by modification time.
string$excludePatternA regular expression pattern of file names to exclude. For example: 'clear.gif' or '(clear.gif|.htaccess)'. The pattern will be wrapped with: '/^' and '$/'.
Returns
array|string Array of the files found, or an error message in case the path could not be opened.

Definition at line 2994 of file GeneralUtility.php.

Referenced by DocumentTemplate\addStyleSheetDirectory(), SpriteGenerator\getFolder(), CleanUp\getTypo3TempStatistics(), AbstractSpriteHandler\loadRegisteredSprites(), and BackendController\loadResourcesForRegisteredNavigationComponents().

static getHostname (   $requestHost = true)
static

Get the fully-qualified domain name of the host.

Parameters
bool$requestHostUse request host (when not in CLI mode).
Returns
string The fully-qualified host name.

Definition at line 3787 of file GeneralUtility.php.

static getImplementationForClass (   $className)
staticprotected

Returns the configured implementation of the class

Parameters
string$className
Returns
string

Definition at line 4553 of file GeneralUtility.php.

References $GLOBALS.

static getIndpEnv (   $getEnvName)
static

Abstraction method which returns System Environment Variables regardless of server OS, CGI/MODULE version etc. Basically this is SERVER variables for most of them. This should be used instead of getEnv() and $_SERVER/ENV_VARS to get reliable values for all situations.

Parameters
string$getEnvNameName of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY
Returns
string Value based on the input key, independent of server/os environment.
Exceptions
\UnexpectedValueException

Definition at line 3342 of file GeneralUtility.php.

References $GLOBALS, $url, GeneralUtility\dirname(), elseif, if, PathUtility\stripPathSitePrefix(), and GeneralUtility\strtolower().

Referenced by StandaloneView\__construct(), SessionService\__construct(), LoginController\__construct(), TypoScriptFrontendController\__construct(), DocumentTemplate\addStyleSheetDirectory(), VersionModuleController\adminLinks(), BackendUserAuthentication\backendCheckLogin(), TypoScriptFrontendController\beLoginLinkIPList(), UriBuilder\buildBackendUri(), Typo3Link\buildJSClassesAnchorArray(), UriBuilder\buildUri(), TypoScriptFrontendController\checkAlternativeIdMethods(), AbstractUserAuthentication\checkAuthentication(), FrontendBackendUserAuthentication\checkBackendAccessSettingsFromInitPhp(), Bootstrap\checkBackendIpOrDie(), BackendUserAuthentication\checkLockToIP(), TypoScriptFrontendController\checkPageUnavailableHandler(), Bootstrap\checkSslBackendAndRedirectIfNeeded(), ImportExportController\checkUpload(), StandaloneViewTest\constructorSetsBaseUri(), StandaloneViewTest\constructorSetsRequestUri(), Indexer\createLocalPathUsingDomainURL(), ResourceCompressor\createMergedFile(), Application\defineAdditionalEntryPointRelatedConstants(), AbstractElementBrowser\determineScriptUrl(), AbstractRecordList\determineScriptUrl(), AbstractLinkBrowserController\determineScriptUrl(), AbstractTreeView\determineScriptUrl(), AdminPanelView\display(), RecordHistory\displaySettings(), TypoScriptFrontendController\domainNameMatchesCurrentRequest(), DebugExceptionHandler\echoExceptionWeb(), FrontendEditPanel\editPanel(), RsaEncryptionEncoder\enableRsaEncryption(), AbstractConditionMatcher\evaluateConditionCommon(), DatabaseConnection\explain(), TypoScriptFrontendController\fetch_the_id(), BackendUserAuthentication\fetchGroups(), TypoScriptFrontendController\findDomainRecord(), ServerRequestFactory\fromGlobals(), PreviewController\generateJavascript(), BackendController\generateJavascript(), ConditionMatcherTest\genericGetVariablesSucceedsWithNamespaceIENV(), PathUtility\getAbsoluteWebPath(), ActionTask\getActions(), AbstractUserAuthentication\getAuthInfoArray(), FileLinktype\getBrokenUrl(), InternalLinktype\getBrokenUrl(), PageTreeNavigationController\getButtons(), VersionModuleController\getButtons(), TaskModuleController\getButtons(), AbstractUserAuthentication\getCookieDomain(), AbstractStandaloneMessage\getDefaultMarkers(), ConfigurationStatus\getDeprecationLogStatus(), ExtDirectApi\getExtDirectApi(), PageRepository\getExtURL(), ImageService\getImageUri(), SecurityStatusReport\getInstallToolProtectionStatus(), RecyclerModuleController\getJavaScriptConfiguration(), PreviewHook\getPreviewConfiguration(), ElementInformationController\getRecordActions(), LoginController\getUriForFileName(), AbstractConditionMatcher\getVariableCommon(), RequestHandler\handleRequest(), AbstractUserAuthentication\hashLockClause_getHashInt(), UserElementsController\init(), FileUploadController\init(), TableController\init(), BasicFileUtility\init(), Bootstrap\initializeErrorHandling(), BrowseLinksController\initVariables(), AbstractUserAuthentication\ipLockClause_remoteIPNumber(), FrontendLoginController\isInCurrentDomain(), FrontendLoginController\isRelativeUrl(), PageLayoutView\languageSelector(), SearchController\linkPage(), InfoPageTyposcriptConfigController\main(), ListController\main(), FileController\main(), VersionModuleController\main(), TypoScriptTemplateInformationModuleFunctionController\main(), SimpleDataHandlerController\main(), PageLayoutController\makeButtons(), ElementInformationController\makeRef(), ElementInformationController\makeRefFrom(), ModuleTemplate\makeShortcutIcon(), DocumentTemplate\makeShortcutIcon(), IconUtility\mapFileExtensionToSpriteIconName(), PageLayoutView\newContentElementOnClick(), TaskModuleController\openInNewWindow(), TypoScriptFrontendController\pageErrorHandler(), DocumentTemplate\parseTime(), AbstractPlugin\pi_getEditIcon(), AbstractPlugin\pi_list_searchBox(), TypoScriptFrontendController\prefixLocalAnchorsWithScript(), EditDocumentController\preInit(), SearchFormController\printResultSectionLinks(), NewRecordController\regularNew(), AbstractUserAuthentication\removeCookie(), UsernamePasswordLoginProvider\render(), InlineRecordContainer\render(), YouTubeRenderer\render(), FileBrowser\renderFilesInFolder(), TranslationStatusController\renderL10nTable(), DatabaseRecordList\renderListHeader(), EditLinkViewHelper\renderStatic(), DeleteLinkViewHelper\renderStatic(), EditSysFileMetadataRecordViewHelper\renderStatic(), ResourceCompressor\returnFileReference(), EditDocumentController\setDocument(), TypoScriptFrontendController\setIDfromArgV(), AbstractUserAuthentication\setSessionCookie(), MailPostProcessor\setSubject(), FrontendLoginController\showLogin(), ReviewController\singleIndexAction(), RteHtmlParser\siteUrl(), AbstractUserAuthentication\start(), TypoScriptTemplateInformationModuleFunctionController\tableRow(), TypoScriptFrontendController\tempPageCacheContent(), RteHtmlParser\TS_images_rte(), PageLayoutView\tt_content_drawHeader(), FrontendLoginControllerTest\typo3SitePathEqualsStubSitePath(), FrontendLoginControllerTest\typo3SitePathEqualsStubSitePathAfterChangingInTest(), FrontendLoginControllerTest\typo3SiteUrlEqualsStubSiteUrl(), FrontendLoginControllerTest\typo3SiteUrlEqualsStubSiteUrlAfterChangingInTest(), VersionModuleController\versioningMgm(), DocumentTemplate\viewPageIcon(), ActionTask\viewRecordList(), ActionTask\viewSqlQuery(), AbstractExceptionHandler\writeLog(), ErrorHandler\writeLog(), BackendUserAuthentication\writelog(), AbstractExceptionHandler\writeLogEntries(), SearchController\writeSearchStat(), and SearchFormController\writeSearchStat().

static getMaximumPathLength ( )
static

Retrieves the maximum path length that is valid in the current environment.

Returns
int The maximum available path length

Definition at line 3200 of file GeneralUtility.php.

Referenced by SimpleFileBackend\setCache().

static getMaxUploadFileSize ( )
static

Returns the maximum upload size for a file that is allowed. Measured in KB. This might be handy to find out the real upload limit that is possible for this TYPO3 installation.

Returns
int The maximum size of uploads that are allowed (measured in kilobytes)

Definition at line 3164 of file GeneralUtility.php.

Referenced by ResourceStorage\assureFileUploadPermissions(), and InlineControlContainer\renderPossibleRecordsSelectorTypeGroupDB().

static getRandomHexString (   $count)
static

Returns a hex representation of a random byte string.

Parameters
int$countNumber of hex characters to return
Returns
string Random Bytes

Definition at line 1321 of file GeneralUtility.php.

Referenced by AbstractUserAuthentication\createSessionId(), SilentConfigurationUpgradeService\generateEncryptionKeyIfNeeded(), and ProductionExceptionHandler\handle().

static getRedirectUrlFromHttpHeaders (   $content)
staticprotected

Parses HTTP headers and returns the content of the "Location" header or the empty string if no such header found.

Parameters
string$content
Returns
string

Definition at line 2625 of file GeneralUtility.php.

static getSingletonInstances ( )
static

Get all currently registered singletons

Warning: This is NOT a public API method and must not be used in own extensions! This method is usually only used in tests in setUp() to fetch the list of currently registered singletons, if this list is manipulated with setSingletonInstance() in tests.

Definition at line 4662 of file GeneralUtility.php.

Referenced by TcaCheckboxItemsTest\setUp(), TcaRadioItemsTest\setUp(), TcaSelectItemsTest\setUp(), DatabaseSystemLanguageRowsTest\setUp(), TcaSelectTreeItemsTest\setUp(), and StandaloneViewTest\setUp().

static getThisUrl ( )
static

Returns the HOST+DIR-PATH of the current script (The URL, but without 'http://' and without script-filename)

Returns
string
Deprecated:
since TYPO3 CMS 7, will be removed in CMS 8, use GeneralUtility::getIndpEnv* instead

Definition at line 3278 of file GeneralUtility.php.

References $url.

static getUrl (   $url,
  $includeHeader = 0,
  $requestHeaders = false,
$report = null 
)
static

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

Parameters
string$urlFile/URL to read
int$includeHeaderWhether the HTTP header should be fetched or not. 0=disable, 1=fetch header+content, 2=fetch header only
array$requestHeadersHTTP headers to be used in the request
array$reportError code/message and, if $includeHeader is 1, response meta data (HTTP status and content type)
Returns
mixed The content from the resource given as input. FALSE if an error has occurred.

Definition at line 2430 of file GeneralUtility.php.

References $GLOBALS, $url, and elseif.

Referenced by TemplateService\addExtensionStatics(), ImportExport\addThumbnail(), MicroDataSchema\buildJavascriptConfiguration(), Bootstrap\checkLockedBackendAndRedirectOrDie(), CleanerCommand\cli_main(), ResourceCompressor\compressCssFile(), ResourceCompressor\compressJsFile(), ExtensionManagementUtility\createExtLocalconfCacheEntry(), ExtensionManagementUtility\createExtTablesCacheEntry(), ResourceCompressor\createMergedFile(), UpdateScriptUtility\determineUpdateClassName(), ImportExport\export_addFile(), AbstractDownloadExtensionUpdate\fetchUrl(), CoreVersionService\fetchVersionMatrixFromRemote(), TemplateService\fileContent(), DocumentationService\getAvailablePackages(), UploadExtensionFileController\getExtensionFromT3xFile(), ExtensionCompatibilityTester\getExtensionsToExclude(), BackendUtility\getFlexFormDS(), T3editorElement\getHTMLCodeForEditor(), DocumentTemplate\getHtmlTemplate(), AbstractOEmbedHelper\getOEmbedData(), DocumentationService\getOfficialDocuments(), BackendUtility\getPagesTSconfig(), T3editor\getPreparedTemplate(), PreviewHook\getPreviewConfiguration(), YouTubeHelper\getPreviewImage(), VimeoHelper\getPreviewImage(), AbstractItemProvider\getRegisteredFlexForms(), BackendUtility\getRegisteredFlexForms(), InstallUtility\getSqlDataDumpForFile(), SqlExpectedSchemaService\getTablesDefinitionString(), PageRenderer\getTemplateForPart(), TemplateService\getTypoScriptSourceFileContent(), RteHtmlParser\getUrl(), Indexer\getUrlHeaders(), InstallUtility\importStaticSqlFile(), TypoScriptParser\includeFile(), TemplateService\includeStaticTypoScriptSources(), Indexer\indexExternalUrl(), CharsetConverter\initCaseFolding(), CharsetConverter\initCharset(), CharsetConverter\initToASCII(), CharsetConverter\initUnicodeData(), ImportExport\loadFile(), BackendController\loadResourcesForRegisteredNavigationComponents(), ExtensionCompatibilityTester\logError(), TypoScriptFrontendController\pageErrorHandler(), InstallUtility\processDatabaseUpdates(), FileContentParser\readFileContent(), ExtensionCompatibilityTester\removeCurrentExtensionFromFile(), AbstractStandaloneMessage\render(), TcaFlexFetch\resolvePossibleExternalFileInDataStructure(), ResourceCompressor\retrieveExternalFile(), ExtensionCompatibilityTester\writeCurrentExtensionToFile(), and ImportExport\writeFileVerify().

static getUserObj (   $classRef)
static

Creates and returns reference to a user defined object. This function can return an object reference if you like. Just prefix the function call with "&": "$objRef = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:myext/class.tx_myext_myclass.php:&tx_myext_myclass');". This will work ONLY if you prefix the class name with "&" as well. See description of function arguments. Please note that the reference functionality is deprecated as of TYPO3 CMS 7, and will be removed with TYPO3 CMS 8, let the class use the SingletonInterface of TYPO3 instead.

Todo:
Deprecate the whole method in several steps:
  1. Deprecated singleton pattern, (will be removed in TYPO3 CMS 8)
  2. Deprecate file prefix/ require file,
  3. Deprecate usage without valid class name.
  4. The last step should be to deprecate the method itself.
Parameters
string$classRefClass reference, '[file-reference":"]["&"]class-name'. You can prefix the class name with "[file-reference]:" and ::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl". Finally; for the class name you can prefix it with "&" and you will reuse the previous instance of the object identified by the full reference string (meaning; if you ask for the same $classRef later in another place in the code you will get a reference to the first created one!).
Returns
object The instance of the class asked for. Instance is created with ::makeInstance
See Also
callUserFunction()

Definition at line 4385 of file GeneralUtility.php.

References $GLOBALS.

Referenced by ClearCacheToolbarItem\__construct(), ActionTask\__construct(), LinkAnalyzer\__construct(), ExtensionManagerConfigurationUtility\buildHashMethodSelector(), DataHandler\checkValueForFlex(), CleanerCommand\cli_main(), DatabaseConnection\connectDB(), CrawlerHook\crawler_execute(), CrawlerHook\crawler_init(), MediaItemHooks\customMediaParams(), MediaItemHooks\customMediaRenderTypes(), DataHandler\deleteAction(), AdminPanelView\display(), FrontendEditingController\displayEditIcons(), FrontendEditingController\displayEditPanel(), FileDumpController\dumpAction(), BackendUserAuthentication\fetchGroups(), AbstractMenuContentObject\filterMenuPages(), ExtDirectApi\generateAPI(), TypoScriptFrontendController\generatePage_postProcessing(), DataHandler\getCheckModifyAccessListHookObjects(), ContentObjectRenderer\getData(), BackendUtility\getFlexFormDS(), ContentObjectRenderer\getGetImgResourceHookObjects(), ContentObjectRenderer\getImageSourceCollection(), PageRepository\getPage(), PageRepository\getPagesOverlay(), PageRepository\getRecordOverlay(), TypoScriptFrontendController\handleDataSubmission(), IndexSearchRepository\hookRequest(), CssStyledContentController\hookRequest(), SearchController\hookRequest(), SearchFormController\hookRequest(), ModulesController\indexAction(), Indexer\init(), InlineRecordContainer\initHookObjects(), SearchFormController\initialize(), LinkValidatorReport\initialize(), Indexer\initializeExternalParsers(), SearchController\initializeExternalParsers(), FrontendBackendUserAuthentication\initializeFrontendEdit(), ElementBrowserController\main(), NewContentElementController\main(), ElementInformationController\main(), ParseHtmlController\main_parse_html(), AbstractDatabaseRecordList\makeQueryArray(), DataHandler\moveRecord(), DataHandler\moveRecord_raw(), ExtendedFileUtility\processData(), ExtDirectRouter\processRpc(), SearchController\procSearchWordsByLexer(), TypoScriptFrontendController\realPageCacheContent(), ContentObjectRenderer\resolveMixedLinkParameter(), RteHtmlParser\RTE_transform(), ContentObjectRenderer\start(), RteHtmlParser\TS_links_db(), RteHtmlParser\TS_links_rte(), and PageLayoutView\tt_content_drawFooter().

static gif_compress (   $theFile,
  $type 
)
static

Compressing a GIF file if not already LZW compressed. This function is a workaround for the fact that ImageMagick and/or GD does not compress GIF-files to their minimun size (that is RLE or no compression used)

The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file GIF: If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!) If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively PNG: No changes.

$theFile is expected to be a valid GIF-file! The function returns a code for the operation.

Parameters
string$theFileFilepath
string$typeSee description of function
Returns
string Returns "GD" if GD was used, otherwise "IM" if ImageMagick was used. If nothing done at all, it returns empty string.
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use ::gifCompress() instead.

Definition at line 274 of file GeneralUtility.php.

References GraphicalFunctions\gifCompress().

static hideIfDefaultLanguage (   $localizationConfiguration)
static

Returns true if the "l18n_cfg" field value is not set to hide pages in the default language

Parameters
int$localizationConfiguration
Returns
bool

Definition at line 4131 of file GeneralUtility.php.

Referenced by AbstractMenuContentObject\isSubMenu().

static hideIfNotTranslated (   $l18n_cfg_fieldValue)
static

Responds on input localization setting value whether the page it comes from should be hidden if no translation exists or not.

Parameters
int$l18n_cfg_fieldValueValue from "l18n_cfg" field of a page record
Returns
bool TRUE if the page should be hidden

Definition at line 4119 of file GeneralUtility.php.

References $GLOBALS.

Referenced by AbstractMenuContentObject\filterMenuPages(), AbstractMenuContentObject\isSubMenu(), AbstractMenuContentObject\prepareMenuItemsForLanguageMenu(), TranslationStatusController\renderL10nTable(), and TypoScriptFrontendController\settingLanguage().

static hmac (   $input,
  $additionalSecret = '' 
)
static
static hostHeaderValueMatchesTrustedHostsPattern (   $hostHeaderValue)
static

Checks if the provided host header value matches the trusted hosts pattern without any preprocessing.

Parameters
string$hostHeaderValue
Returns
bool

Definition at line 3670 of file GeneralUtility.php.

References $GLOBALS, and GeneralUtility\strtolower().

Referenced by Check\checkTrustedHostPattern().

static idnaEncode (   $value)
static

Returns an ASCII string (punicode) representation of $value

Parameters
string$value
Returns
string An ASCII encoded (punicode) string

Definition at line 1302 of file GeneralUtility.php.

Referenced by DataHandler\checkValue_input_Eval().

static imageMagickCommand (   $command,
  $parameters,
  $path = '' 
)
static

Compile the command for running ImageMagick/GraphicsMagick.

Parameters
string$commandCommand to be run: identify, convert or combine/composite
string$parametersThe parameters string
string$pathOverride the default path (e.g. used by the install tool)
Returns
string Compiled command that deals with IM6 & GraphicsMagick

Definition at line 5268 of file GeneralUtility.php.

References CommandUtility\imageMagickCommand().

Referenced by GraphicalFunctions\combineExec(), GraphicalFunctions\gifCompress(), GraphicalFunctions\imageMagickExec(), GraphicalFunctions\imageMagickIdentify(), ThumbnailView\main(), GraphicalFunctions\readPngGif(), and PreviewProcessing\resizeImage().

static 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$nameName prefix for entries. Set to blank if you wish none.
array$theArrayThe (multidimensional) array to implode
string$str(keep blank)
bool$skipBlankIf set, parameters which were blank strings would be removed.
bool$rawurlencodeParamNameIf 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 1614 of file GeneralUtility.php.

Referenced by Indexer\backend_initIndexer(), UriBuilder\buildTypolinkConfiguration(), UriBuilder\buildUri(), TypoScriptFrontendController\calculateLinkVars(), EditDocumentController\compileStoreDat(), FolderUtilityRenderer\createFolder(), EditDocumentController\generatePreviewCode(), WorkspaceService\generateWorkspacePreviewLink(), LinkBrowserController\getBodyTagAttributes(), AbstractLinkBrowserController\getBodyTagAttributes(), FileBrowser\getBulkSelector(), FileBrowser\getFileSearchField(), FrontendLoginController\getPreserveGetVars(), ContentObjectRenderer\getQueryArguments(), DocumentTemplate\getTabMenu(), ContentObjectRenderer\getTypoLink(), EditDocumentController\init(), TemplateService\linkData(), SearchController\linkPage(), TypoScriptFrontendController\makeCacheHash(), ModuleTemplate\makeShortcutUrl(), DocumentTemplate\makeShortcutUrl(), AbstractPlugin\pi_linkTP(), ElementBrowserFolderTreeView\PM_ATagWrap(), ElementBrowserPageTreeView\PM_ATagWrap(), ElementBrowserPageTreeView\printTree(), NewContentElementController\removeInvalidElements(), FolderUtilityRenderer\uploadForm(), ElementBrowserPageTreeView\wrapTitle(), and ElementBrowserFolderTreeView\wrapTitle().

static implodeAttributes ( array  $arr,
  $xhtmlSafe = false,
  $dontOmitBlankAttribs = false 
)
static

Implodes attributes in the array $arr for an attribute list in eg. and HTML tag (with quotes)

Parameters
array$arrArray with attribute key/value pairs, eg. "bgcolor"=>"red", "border"=>0
bool$xhtmlSafeIf set the resulting attribute list will have a) all attributes in lowercase (and duplicates weeded out, first entry taking precedence) and b) all values htmlspecialchar()'ed. It is recommended to use this switch!
bool$dontOmitBlankAttribsIf TRUE, don't check if values are blank. Default is to omit attributes with blank values.
Returns
string Imploded attributes, eg. 'bgcolor="red" border="0"'

Definition at line 1923 of file GeneralUtility.php.

References $list, and GeneralUtility\strtolower().

Referenced by ContentObjectRenderer\addParams(), ContentObjectRenderer\encaps_lineSplit(), CssStyledContentController\render_table(), CssStyledContentController\render_uploads(), ImageRenderingController\renderImageAttributes(), AbstractMenuContentObject\setATagParts(), RteHtmlParser\transformStyledATags(), RteHtmlParser\TS_AtagToAbs(), RteHtmlParser\TS_images_rte(), RteHtmlParser\TS_links_db(), RteHtmlParser\TS_reglinks(), PageTreeView\wrapTitle(), and FolderTreeView\wrapTitle().

static inArray ( array  $in_array,
  $item 
)
static

Check if an string item exists in an array. Please note that the order of function parameters is reverse compared to the PHP function in_array()!!!

Comparison to PHP in_array(): -> $array = array(0, 1, 2, 3); -> variant_a := ::inArray($array, $needle) -> variant_b := in_array($needle, $array) -> variant_c := in_array($needle, $array, TRUE) +------—+--------—+--------—+--------—+ | $needle | variant_a | variant_b | variant_c | +------—+--------—+--------—+--------—+ | '1a' | FALSE | TRUE | FALSE | | '' | FALSE | TRUE | FALSE | | '0' | TRUE | TRUE | FALSE | | 0 | TRUE | TRUE | TRUE | +------—+--------—+--------—+--------—+

Parameters
array$in_arrayOne-dimensional array of items
string$itemItem to check for
Returns
bool TRUE if $item is in the one-dimensional array $in_array
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::inArray() instead

Definition at line 1453 of file GeneralUtility.php.

References ArrayUtility\inArray().

static initSysLog ( )
static

Initialize the system log.

Returns
void
See Also
sysLog()

Definition at line 5031 of file GeneralUtility.php.

References $GLOBALS, MathUtility\forceIntegerInRange(), and GeneralUtility\strtoupper().

static inList (   $list,
  $item 
)
static

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

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

Definition at line 691 of file GeneralUtility.php.

References $list.

Referenced by ContentObjectRenderer\_parseFunc(), DatabaseConnection\_quoteWhereClause(), DatabaseRowDateTimeFields\addData(), DatabaseRowDefaultValues\addData(), AbstractTreeView\addField(), AbstractItemProvider\addItemsFromFolder(), ExtensionManagementUtility\addModule(), CategoryRegistry\addTcaColumn(), ExtensionManagementUtility\addToAllTCAtypes(), UserSettingsController\addToList(), CommandMap\applyWorkspacesSetStageBehaviour(), BackendUtility\blindUserNames(), SelectFont\buildJSFontItemsConfig(), WorkspaceService\canCreatePreviewLink(), BackendUserAuthentication\check(), BackendUserAuthentication\checkAuthMode(), ExtensionManagerConfigurationUtility\checkConfigurationFrontend(), ResourceStorage\checkFileExtensionPermission(), ContentObjectRenderer\checkIf(), ModuleLoader\checkModWorkspace(), DataHandler\checkValue(), DataHandler\checkValue_SW(), BackendUserAuthentication\checkWorkspace(), DataHandler\compareFieldArrayWithCurrentAndUnset(), Mysql\compileWhereClause(), Adodb\compileWhereClause(), GraphicalFunctions\copyImageOntoImage(), ElementEntityProcessor\createNewDependentElementChildReferenceCallback(), ElementEntityProcessor\createNewDependentElementParentReferenceCallback(), ContentObjectRenderer\DBgetInsert(), ContentObjectRenderer\DBgetUpdate(), ContentObjectRenderer\DBmayFEUserEdit(), ContentObjectRenderer\detectLinkTypeFromLinkParameter(), ClickMenu\enableDisableItems(), ConditionMatcher\evaluateCondition(), AbstractConditionMatcher\evaluateConditionCommon(), DatabaseConnection\explain(), ImportExport\export_addFile(), ExtendedTemplateService\ext_getObjTree(), ExtendedTemplateService\ext_getTypeData(), ExtendedTemplateService\ext_procesInput(), BackendUserAuthentication\fetchGroups(), StagesService\fetchGroupsRecursive(), SelectImage\fileIsSelectableInFileList(), ContentObjectRenderer\filelist(), AbstractMenuContentObject\filterMenuPages(), FileController\flattenResultDataValue(), ExtendedFileUtility\func_edit(), JavaScriptMenuContentObject\generate_level(), SelectTreeElement\generateJavascript(), AbstractDatabaseRecordList\generateList(), PageLayoutView\generateTtContentDataArray(), ContentObjectRenderer\getBorderAttr(), SetupModuleController\getCSH(), SqlSchemaMigrationService\getDatabaseExtra(), GraphicalFunctions\getImageDimensions(), FileFacade\getIsEditable(), FileFacade\getIsImage(), XmlParserFactory\getParserInstance(), TcaRecordTitle\getRecordTitleForInputType(), BackendUtility\getRecordWSOL(), TemplateService\getRootlineLevel(), PageLayoutView\getTableMenu(), SoftReferenceIndex\getTypoLinkParts(), ActionTask\getUsergroups(), SqlParser\getValue(), AbstractUserAuthentication\hashLockClause_getHashInt(), ContentObjectRenderer\imageLinkWrap(), GraphicalFunctions\imageMagickConvert(), SearchFormController\initialize(), BasicFileUtility\is_allowed(), CacheHashCalculator\isCoreParameter(), BackendUserAuthentication\isMemberOfGroup(), AbstractMenuContentObject\isSubMenu(), NewRecordController\isTableAllowedForThisPage(), SaltedPasswordsUtility\isUsageEnabled(), ParseHtmlController\keepSpanTagsWithId(), ActionList\listURL(), SortPagesWizardModuleFunction\main(), ImportExportController\main(), EditFileController\main(), ThumbnailView\main(), PageLayoutController\makeActionMenu(), AbstractMenuContentObject\makeMenu(), QueryGenerator\makeOptionList(), LiveSearch\makeQuerySearchByTable(), AbstractDatabaseRecordList\makeSearchString(), GraphicalFunctions\maskImageOntoImage(), EvaluateDisplayConditions\matchFieldCondition(), BaseScriptClass\mergeExternalItems(), BackendUserAuthentication\modAccess(), SqlParser\parseALTERTABLE(), SqlParser\parseWhereClause(), EvaluatorTest\passwordIsTurnedIntoSaltedString(), AbstractPlugin\pi_exec_query(), Clipboard\printContentFromTab(), ClickMenu\printFileClickMenu(), ContentObjectRenderer\processParams(), SpellCheckingController\processRequest(), TemplateService\processTemplate(), UserSettingsController\removeFromList(), AbstractItemProvider\removeItemsByDoktypeUserRestriction(), FlexFormElementContainer\render(), ImageManipulationElement\render(), FileBrowser\renderFilesInFolder(), StagesService\resolveBackendUserIds(), CommandMap\resolveWorkspacesSetStageDependencies(), CommandMap\resolveWorkspacesSwapDependencies(), SetupModuleController\setAvatarFileUid(), FrontendLoginController\showLogin(), GraphicalFunctions\splitString(), DatabaseConnection\sql_query(), ContentObjectRenderer\stdWrap(), RteHtmlParser\TS_links_rte(), RteHtmlParser\TS_transform_rte(), Lexer\utf8_is_letter(), VersionModuleController\versioningMgm(), and BackendUserAuthentication\workspaceCheckStageForCurrent().

static instantiateClass (   $className,
  $arguments 
)
staticprotected

Speed optimized alternative to ReflectionClass::newInstanceArgs()

Parameters
string$classNameName of the class to instantiate
array$argumentsArguments passed to self::makeInstance() thus the first one with index 0 holds the requested class name
Returns
mixed

Definition at line 4489 of file GeneralUtility.php.

static intExplode (   $delimiter,
  $string,
  $removeEmptyValues = false,
  $limit = 0 
)
static

Explodes a $string delimited by $delim and casts each item in the array to (int). Corresponds to ::trimExplode(), but with conversion to integers for all values.

Parameters
string$delimiterDelimiter string to explode with
string$stringThe string to explode
bool$removeEmptyValuesIf set, all empty values (='') will NOT be set in output
int$limitIf positive, the result will contain a maximum of limit elements,
Returns
array Exploded values, all converted to integers

Definition at line 1469 of file GeneralUtility.php.

References elseif.

Referenced by GraphicalFunctions\adjust(), Abbreviation\buildJSAbbreviationArray(), GraphicalFunctions\calcTextCordsForMap(), QueryGenerator\cleanInputVal(), DatabaseConnection\cleanIntList(), CategoryMenuUtility\collectPages(), RecordsContentObject\collectRecordsFromCategories(), VersionNumberUtility\convertVersionStringToArray(), GraphicalFunctions\copyGifOntoGif(), QueryFactory\create(), GraphicalFunctions\crop(), ContentObjectRenderer\DBmayFEUserEditSelect(), SearchFormController\doSearch(), DatabaseConnection\exec_SELECTquery(), IndexSearchRepository\execFinalQuery(), SearchFormController\execFinalQuery(), AdodbPreparedStatement\execute(), ExtendedTemplateService\ext_getTypeData(), BackendUserAuthentication\fetchGroups(), StagesService\fetchGroupsRecursive(), FilesContentObject\findAndSortFiles(), GraphicalMenuContentObject\findLargestDims(), BackendController\generateJavascript(), SearchController\getAllAvailableIndexConfigurationsOptions(), AbstractMenuContentObject\getBannedUids(), NewRecordController\getButtons(), EditDocumentController\getButtons(), DataMapper\getConstraint(), BackendUserAuthentication\getFileMountRecords(), PageRepository\getMultipleGroupsWhereClause(), VersionNumberUtility\getNumericTypo3Version(), TypoScriptFrontendController\getPageShortcut(), DatabaseConnection\getQueryComponents(), IndexSearchRepository\getSearchRootPageIdList(), ContentObjectRenderer\getSlidePids(), DataProvider\getWhereClause(), ContentObjectRenderer\imageLinkWrap(), GraphicalFunctions\IMparams(), TemplateService\includeStaticTypoScriptSources(), EditDocumentController\init(), SearchController\initialize(), SearchFormController\initialize(), BackendUserAuthentication\initializeDbMountpointsInWorkspace(), PageLayoutController\main(), GraphicalFunctions\makeBox(), GraphicalFunctions\makeEllipse(), GraphicalFunctions\makeEmboss(), GraphicalMenuContentObject\makeGifs(), QueryGenerator\makeSelectorTable(), GraphicalFunctions\makeShadow(), GraphicalFunctions\objPosition(), RootlineUtility\parseMountPointParameter(), AbstractMenuContentObject\prepareMenuItemsForBrowseMenu(), AbstractMenuContentObject\prepareMenuItemsForDirectoryMenu(), AbstractMenuContentObject\prepareMenuItemsForKeywordsMenu(), AbstractMenuContentObject\prepareMenuItemsForLanguageMenu(), AbstractMenuContentObject\prepareMenuItemsForUpdatedMenu(), SplitProcessor\process(), TemplateService\processTemplate(), VersionNumberUtility\raiseVersionNumber(), SearchController\searchAction(), IndexSearchRepository\sectionTableWhere(), SearchFormController\sectionTableWhere(), DatabaseConnection\SELECTquery(), AbstractLinkHandler\setTemporaryDbMounts(), DatabaseBrowser\setTemporaryDbMounts(), PageLinkHandler\setTemporaryDbMounts(), TypoScriptFrontendController\settingLanguage(), BackendUserAuthentication\setWebmounts(), GraphicalFunctions\setWorkArea(), GraphicalFunctions\splitString(), AbstractMenuContentObject\start(), ContentObjectRenderer\substring(), and GraphicalFunctions\txtPosition().

static IPv6Bin2Hex (   $bin)
static

Transform an IPv6 address from binary to hex-representation

Parameters
string$binIPv6 address in hex-presentation
Returns
string Binary representation (16 characters, 128 characters)
See Also
IPv6Hex2Bin()

Definition at line 482 of file GeneralUtility.php.

static IPv6Hex2Bin (   $hex)
static

Transform a regular IPv6 address from hex-representation into binary

Parameters
string$hexIPv6 address in hex-presentation
Returns
string Binary representation (16 characters, 128 characters)
See Also
IPv6Bin2Hex()

Definition at line 470 of file GeneralUtility.php.

static isAbsPath (   $path)
static
static isAllowedAbsPath (   $path)
static
static isAllowedHostHeaderValue (   $hostHeaderValue)
static

Checks if the provided host header value matches the trusted hosts pattern. If the pattern is not defined (which only can happen early in the bootstrap), deny any value. The result is saved, so the check needs to be executed only once.

Parameters
string$hostHeaderValueHTTP_HOST header value as sent during the request (may include port)
Returns
bool

Definition at line 3639 of file GeneralUtility.php.

References $GLOBALS.

static isBrokenEmailEnvironment ( )
static

Checks if current e-mail sending method does not accept recipient/sender name in a call to PHP mail() function. Windows version of mail() and mini_sendmail program are known not to process such input correctly and they cause SMTP errors. This function will return TRUE if current mail sending method has problem with recipient name in recipient/sender argument for mail().

Todo:
4.3 should have additional configuration variable, which is combined by || with the rest in this function.
Returns
bool TRUE if mail() does not accept recipient name
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 1120 of file GeneralUtility.php.

static isFirstPartOfStr (   $str,
  $partStr 
)
static

Returns TRUE if the first part of $str matches the string $partStr

Parameters
string$strFull string to check
string$partStrReference string which must be found as the "first part" of the full string
Returns
bool TRUE if $partStr was found to be equal to the first part of $str

Definition at line 927 of file GeneralUtility.php.

Referenced by Locker\__destruct(), ActionTask\action_getUserMainDir(), LocalDriver\addFile(), ConfigurationItemRepository\buildConfigurationArray(), ResourceCompressor\checkBaseDirectory(), CrawlerHook\checkDeniedSuburls(), BasicFileUtility\checkPathAgainstMounts(), CrawlerHook\checkUrl(), DataHandler\clear_cacheCmd(), Adodb\compileWhereClause(), ReferenceIndex\createEntryData_fileRels(), ResourceCompressor\createMergedFile(), GraphicalFunctions\createTempSubDir(), LocalDriver\determineBaseUrl(), ImportExport\export_addFile(), DocumentationService\fetchNearestDocument(), ContentObjectRenderer\filelist(), BasicFileUtility\findFirstWebFolder(), ExtDirectApi\findNamespace(), SoftReferenceIndex\findRef_images(), SoftReferenceIndex\findRef_TStemplate(), ImportExport\fixFileIDsInRelations(), TemplateService\getFileName(), ResourceFactory\getFolderObjectFromCombinedIdentifier(), DocumentTemplate\getHtmlTemplate(), ListUtility\getInstallTypeForPackage(), DocumentRepository\getMetadata(), MailUtility\getSystemFromAddress(), BasicFileUtility\is_webpath(), FrontendLoginController\isInLocalDomain(), FrontendLoginController\isRelativeUrl(), FileHandlingUtility\isValidExtensionPath(), ConfigurationManager\isValidLocalConfigurationPath(), LocalDriver\isWithin(), DoubleFilesCommand\main(), LostFilesCommand\main(), RteImagesCommand\main(), RteImagesCommand\main_autoFix(), EvaluatorTest\md5HashIsUpdatedToTemporarySaltedString(), TypoScriptFrontendController\pageErrorHandler(), ImportExport\processSoftReferences_saveFile(), ImportExport\processSoftReferences_saveFile_createRelFile(), SimpleLockStrategy\release(), Locker\release(), AccessibilityLinkController\removeAccessibilityIcon(), CustomAttributeController\render_clickenlarge(), CssStyledContentController\render_uploads(), ResourceFactory\retrieveFileOrFolderObject(), SimpleFileBackend\setCacheDirectory(), SoftReferenceIndex\setTypoLinkPartsElement(), LocalizationUtility\translate(), ImportExport\unlinkTempFiles(), and ImportExport\verifyFolderAccess().

static isInternalRequestType ( )
staticprotected

Allows internal requests to the install tool and from the command line. We accept this risk to have the install tool always available. Also CLI needs to be allowed as unfortunately AbstractUserAuthentication::getAuthInfoArray() accesses HTTP_HOST without reason on CLI Additionally, allows requests when no REQUESTTYPE is set, which can happen quite early in the Bootstrap. See Application.php in EXT:backend/Classes/Http/.

Returns
bool

Definition at line 3701 of file GeneralUtility.php.

static isOnCurrentHost (   $url)
static

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

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

Definition at line 678 of file GeneralUtility.php.

References $url.

Referenced by ResourceCompressor\createMergedFile().

static isRunningOnCgiServerApi ( )
static

Check if the current request is running on a CGI server API

Returns
bool

Definition at line 5408 of file GeneralUtility.php.

static 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: http://tools.ietf.org/html/rfc3986#appendix-A

Parameters
string$urlThe URL to be validated
Returns
bool Whether the given URL is valid

Definition at line 1401 of file GeneralUtility.php.

References $url, and HttpUtility\buildUrl().

Referenced by ResourceCompressor\createMergedFile(), LocalDriver\determineBaseUrl(), ResourceStorage\getPublicUrl(), Image\getUrl(), and FrontendLoginController\isInLocalDomain().

static keepItemsInArray ( array  $array,
  $keepItems,
  $getValueFunc = null 
)
static

Filters an array to reduce its elements to match the condition. The values in $keepItems can be optionally evaluated by a custom callback function.

Example (arguments used to call this function): $array = array( array('aa' => array('first', 'second'), array('bb' => array('third', 'fourth'), array('cc' => array('fifth', 'sixth'), ); $keepItems = array('third'); $getValueFunc = function($value) { return $value[0]; }

Returns: array( array('bb' => array('third', 'fourth'), )

Parameters
array$arrayThe initial array to be filtered/reduced
mixed$keepItemsThe items which are allowed/kept in the array - accepts array or csv string
string$getValueFunc(optional) Callback function used to get the value to keep
Returns
array The filtered/reduced array with the kept items
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::keepItemsInArray() instead

Definition at line 1597 of file GeneralUtility.php.

References ArrayUtility\keepItemsInArray().

static lcfirst (   $string)
static

Converts the first char of a string to lowercase if it is a latin character (A-Z). Example: Converts "Hello World" to "hello World"

Parameters
string$stringThe string to be used to lowercase the first character
Returns
string The string with the first character as lowercase

Definition at line 1372 of file GeneralUtility.php.

static linkThisScript ( array  $getParams = array())
static

Returns the link-url to the current script. In $getParams you can set associative keys corresponding to the GET-vars you wish to add to the URL. If you set them empty, they will remove existing GET-vars from the current URL. REMEMBER to always use htmlspecialchars() for content in href-properties to get ampersands converted to entities (XHTML requirement and XSS precaution)

Parameters
array$getParamsArray of GET parameters to include
Returns
string

Definition at line 3297 of file GeneralUtility.php.

Referenced by ReturnUrl\addData(), RecordHistory\displaySettings(), ConfigurationForm\ext_getForm(), NewRecordController\getButtons(), DatabaseBrowser\getTemporaryTreeMountCancelNotice(), PageLinkHandler\getTemporaryTreeMountCancelNotice(), RteController\init(), PageLayoutController\local_linkThisScript(), MoveElementController\main(), PageTreeNavigationController\main(), EditDocumentController\openInNewWindowLink(), Clipboard\printClipboard(), ClickMenu\printDBClickMenu(), ModuleController\printLogMgm(), DocumentTemplate\redirectUrls(), ModuleTemplate\redirectUrls(), NewRecordController\regularNew(), InfoPageTyposcriptConfigController\renderList(), TypoScriptTemplateModuleController\renderList(), SwitchUserViewHelper\renderStatic(), PagePositionMap\wrapRecordTitle(), and AbstractTreeView\wrapStop().

static linkThisUrl (   $url,
array  $getParams = array() 
)
static

Takes a full URL, $url, possibly with a querystring and overlays the $getParams arrays values onto the quirystring, packs it all together and returns the URL again. So basically it adds the parameters in $getParams to an existing URL, $url

Parameters
string$urlURL string
array$getParamsArray of key/value pairs for get parameters to add/overrule with. Can be multidimensional.
Returns
string Output URL with added getParams.

Definition at line 3320 of file GeneralUtility.php.

References $url, and ArrayUtility\mergeRecursiveWithOverrule().

Referenced by DatabaseRecordList\getButtons(), DatabaseRecordList\getDocHeaderButtons(), FileUploadController\main(), RenameFileController\main(), ReplaceFileController\main(), and CreateFolderController\main().

static llXmlAutoFileName (   $fileRef,
  $language,
  $sameLocation = false 
)
static

Returns auto-filename for locallang localizations

Parameters
string$fileRefAbsolute file reference to locallang file
string$languageLanguage key
bool$sameLocationIf TRUE, then locallang localization file name will be returned with same directory as $fileRef
Returns
string Returns the filename reference for the language unless error occurred in which case it will be NULL

Definition at line 4162 of file GeneralUtility.php.

References elseif.

Referenced by LocallangXmlParser\getParsedData(), and AbstractXmlParser\getParsedData().

static locationHeaderUrl (   $path)
static

Prefixes a URL used with 'header-location' with 'http://...' depending on whether it has it already.

  • If already having a scheme, nothing is prepended
  • If having REQUEST_URI slash '/', then prefixing 'http://[host]' (relative to host)
  • Otherwise prefixed with TYPO3_REQUEST_DIR (relative to current dir / TYPO3_REQUEST_DIR)
Parameters
string$pathURL / path to prepend full URL addressing to.
Returns
string

Definition at line 3144 of file GeneralUtility.php.

References elseif.

Referenced by AdminPanelView\display(), FrontendLoginController\generateAndSendHash(), AdminPanelView\getAdminPanelHeaderData(), ImageService\getImageUri(), ExtDirectApi\getRoutingUrl(), OnlineMediaController\mainAction(), FileController\mainAction(), SimpleDataHandlerController\mainAction(), HttpUtility\redirect(), and PageRenderer\renderMainJavaScriptLibraries().

static logDeprecatedFunction ( )
static

Logs a call to a deprecated function. The log message will be taken from the annotation.

Returns
void

Definition at line 5214 of file GeneralUtility.php.

References $GLOBALS, DebugUtility\debugTrail(), and PathUtility\stripPathSitePrefix().

Referenced by ModuleController\__construct(), ModuleMenuView\__construct(), LocallangArrayParser\__construct(), Locker\__construct(), AbstractDomainObject\__wakeup(), TypoScriptFrontendController\acquirePageGenerationLock(), ExtensionManagementUtility\addModulePath(), BackendController\addToolbarItem(), CssStyledContentController\beautifyFileLink(), IconUtility\buildSpriteHtmlIconTag(), ContentObjectRenderer\CASEFUNC(), BackendUserAuthentication\checkCLIuser(), SchedulerModuleController\checkDate(), SearchFormController\checkExistance(), TypoScriptFrontendController\checkFileInclude(), DataHandler\checkValue_check(), DataHandler\checkValue_flex(), DataHandler\checkValue_group_select(), DataHandler\checkValue_input(), DataHandler\checkValue_radio(), DataHandler\checkValue_text(), ContentObjectRenderer\CLEARGIF(), EditController\closeWindow(), ContentObjectRenderer\COBJ_ARRAY(), ContentObjectRenderer\COLUMNS(), ResourceCompressor\compressCssPregCallback(), ContentObjectRenderer\CONTENT(), RelationHandler\convertPosNeg(), ContentObjectRenderer\CTABLE(), DocumentTemplate\dfw(), TypoScriptFrontendController\doLocalAnchorFix(), TypoScriptFrontendController\doXHTML_cleaning(), EditDocumentController\editRegularContentFromId(), DocumentTemplate\endPageJS(), RteHtmlParser\evalWriteFile(), ClickMenu\excludeIcon(), ConfigurationForm\ext_getKeyImage(), ExtendedTemplateService\ext_getKeyImage(), ContentObjectRenderer\FILE(), ContentObjectRenderer\FILES(), SimpleDataHandlerController\finish(), ContentObjectRenderer\FLOWPLAYER(), ContentObjectRenderer\FLUIDTEMPLATE(), ContentObjectRenderer\FORM(), QueryGenerator\formatQ(), DocumentTemplate\formatTime(), FlexFormTools\getAvailableLanguages(), FileList\getButtonsAndOtherMarkers(), ContextMenuAction\getClass(), DocumentTemplate\getDynamicTabMenu(), DocumentTemplate\getDynTabMenu(), DocumentTemplate\getDynTabMenuId(), BackendUtility\getExcludeFields(), BackendUtility\getExplicitAuthFieldValues(), IconUtility\getIcon(), SuggestWizardDefaultReceiver\getIcon(), StandaloneView\getLayoutRootPath(), BackendController\getPageRenderer(), DocumentTemplate\getPageRenderer(), TypoScriptFrontendController\getPageRenderer(), StandaloneView\getPartialRootPath(), BackendUtility\getRegisteredFlexForms(), IconUtility\getSpriteIcon(), IconUtility\getSpriteIconClasses(), IconUtility\getSpriteIconForFile(), IconUtility\getSpriteIconForRecord(), IconUtility\getSpriteIconForResource(), TypoScriptFrontendController\getStorageSiterootPids(), HtmlParser\getSubpart(), LocalImageProcessor\getTemporaryImageWithText(), AbstractFormFieldViewHelper\getValue(), NewContentElementController\getWizardItems(), ContentObjectRenderer\HMENU(), ContentObjectRenderer\HRULER(), ContentObjectRenderer\IMAGE(), ContentObjectRenderer\IMG_RESOURCE(), ContentObjectRenderer\IMGTEXT(), BackendUtility\implodeTSParams(), ClickMenuController\init(), T3editor\isEnabled(), StringUtility\isLastPartOfString(), DocumentTemplate\issueCommand(), QueryGenerator\JSbottom(), TypoScriptFrontendController\jumpUrl(), ContentObjectRenderer\LOAD_REGISTER(), ExtensionManagementUtility\loadNewTcaColumnsConfigFiles(), LanguageService\localizedFileRef(), ListFrameLoaderController\main(), ClickMenuController\main(), ParseHtmlController\main(), UserElementsController\main(), ExtendedTemplateService\makeHtmlspecialchars(), IconUtility\mapRecordTypeToSpriteIconClass(), EvaluateDisplayConditions\matchExtensionCondition(), ContentObjectRenderer\MEDIA(), DocumentTemplate\menuTable(), DatabaseConnection\MetaType(), ContentObjectRenderer\MULTIMEDIA(), DatabaseConnection\MySQLActualType(), DatabaseConnection\MySQLMetaType(), ContentObjectRenderer\OTABLE(), DocumentTemplate\parseTime(), AbstractPlugin\pi_list_searchBox(), GraphicalFunctions\pngToGifByImagemagick(), TypoScriptFrontendController\prefixLocalAnchorsWithScript(), DummyController\printContent(), LoginFramesetController\printContent(), ElementBrowserFramesetController\printContent(), ParseHtmlController\printContent(), ClickMenuController\printContent(), InfoModuleController\printContent(), UserElementsController\printContent(), TableController\printContent(), PageFunctionsController\printContent(), ImportExportController\printContent(), FileSystemNavigationFrameController\printContent(), VersionModuleController\printContent(), RteController\printContent(), DatabaseIntegrityView\printContent(), MoveElementController\printContent(), ConfigurationView\printContent(), ColorpickerController\printContent(), TypoScriptTemplateModuleController\printContent(), SetupModuleController\printContent(), ElementInformationController\printContent(), RecordList\printContent(), NewRecordController\printContent(), EditDocumentController\printContent(), ContentObjectRenderer\QTOBJECT(), ContentObjectRenderer\RECORDS(), TypoScriptFrontendController\releasePageGenerationLock(), FlashMessage\render(), SchedulerModuleController\render(), CssStyledContentController\render_bullets(), CssStyledContentController\render_uploads(), PermissionAjaxController\renderGroupname(), PermissionAjaxController\renderOwnername(), IconViewHelper\renderStatic(), DocumentTemplate\rfw(), ContentObjectRenderer\SEARCHRESULT(), ContextMenuAction\setClass(), TypoScriptFrontendController\setExternalJumpUrl(), StandaloneView\setLayoutRootPath(), StandaloneView\setPartialRootPath(), IconUtility\skinImg(), DocumentTemplate\spacer(), DatabaseConnection\splitGroupOrderLimit(), HtmlParser\substituteMarker(), HtmlParser\substituteMarkerAndSubpartArrayRecursive(), HtmlParser\substituteMarkerArray(), HtmlParser\substituteSubpart(), HtmlParser\substituteSubpartArray(), ContentObjectRenderer\SVG(), ContentObjectRenderer\SWFOBJECT(), DocumentTemplate\table(), ContentObjectRenderer\TEMPLATE(), ContentObjectRenderer\TEXT(), ContentObjectRenderer\USER(), TypoScriptTemplateObjectBrowserModuleFunctionController\verify_TSobjects(), TemplateService\wrap(), DocumentTemplate\wrapClickMenuOnIcon(), and ClickMenu\wrapColorTableCM().

static makeInstance (   $className)
static

Creates an instance of a class taking into account the class-extensions API of TYPO3. USE THIS method instead of the PHP "new" keyword. Eg. "$obj = new myclass;" should be "$obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("myclass")" instead!

You can also pass arguments for a constructor: ::makeInstance(::class, $arg1, $arg2, ..., $argN)

You may want to use ::get() if you want TYPO3 to take care about injecting dependencies of the class to be created. Therefore create an instance of ObjectManager via GeneralUtility::makeInstance() first and call its get() method to get the instance of a specific class.

Parameters
string$classNamename of the class to instantiate, must not be empty and not start with a backslash
Returns
object the created instance
Exceptions
\InvalidArgumentExceptionif $className is empty or starts with a backslash

Definition at line 4445 of file GeneralUtility.php.

Referenced by StandaloneView\__construct(), Clickmenu\__construct(), VersionClickMenu\__construct(), ActionHandler\__construct(), InfoPageTyposcriptConfigController\__construct(), BackendModuleRepository\__construct(), TranslationStatusController\__construct(), ModuleController\__construct(), UserToolbarItem\__construct(), LocalizationController\__construct(), DeletedRecordsController\__construct(), FluidTemplateContentObject\__construct(), AbstractModule\__construct(), ActionToolbarItem\__construct(), ExtdirectTreeDataProvider\__construct(), SchedulerCliController\__construct(), TypoScriptRepository\__construct(), OpendocsToolbarItem\__construct(), FileFacade\__construct(), PermissionAjaxController\__construct(), FailsafeView\__construct(), ClearCacheToolbarItem\__construct(), ModuleMenuView\__construct(), TypoScriptTemplateInformationModuleFunctionController\__construct(), DocHeaderComponent\__construct(), ElementBrowserController\__construct(), ActionTask\__construct(), ConfigurationView\__construct(), DatabaseQueryProcessor\__construct(), ProcessedFileRepository\__construct(), TaskModuleController\__construct(), ClickMenuController\__construct(), QueryView\__construct(), PageFunctionsController\__construct(), WizardView\__construct(), InlineControlContainer\__construct(), FrontendEditPanel\__construct(), InfoModuleController\__construct(), DatabaseIntegrityView\__construct(), ResourceFactory\__construct(), RteController\__construct(), IconFactory\__construct(), AbstractFormElement\__construct(), InlineRecordContainer\__construct(), LiveSearch\__construct(), ReplaceFileController\__construct(), ShortcutToolbarItem\__construct(), LanguageRepository\__construct(), AbstractElementBrowser\__construct(), EditFileController\__construct(), SqlParser\__construct(), Clipboard\__construct(), SystemInformationToolbarItem\__construct(), FolderTreeView\__construct(), PageTreeNavigationController\__construct(), SchedulerModuleController\__construct(), MailPostProcessor\__construct(), SuggestWizardDefaultReceiver\__construct(), RecordHistory\__construct(), TypoScriptTemplateModuleController\__construct(), BackendController\__construct(), ImportExportController\__construct(), ElementInformationController\__construct(), PagePositionMap\__construct(), RootlineUtility\__construct(), VersionModuleController\__construct(), TemplateView\__construct(), ReferenceIndex\__construct(), ClickMenu\__construct(), AbstractRecordList\__construct(), FileList\__construct(), DatabaseRecordList\__construct(), DatabaseConnection\__construct(), PageLayoutView\__construct(), ModuleTemplate\__construct(), DocumentTemplate\__construct(), PageRenderer\__construct(), ImportExport\__construct(), CharsetConverter\__construct(), ContentObjectRenderer\__construct(), TypoScriptFrontendController\__construct(), TypoScriptFrontendController\acquireLock(), TypoScriptFrontendController\acquirePageGenerationLock(), ResourceStorage\addFile(), ModuleTemplate\addFlashMessage(), AbstractItemProvider\addItemsFromSpecial(), DatabaseConnection\analyzeCachingTables(), Indexer\backend_initIndexer(), UriBuilder\buildBackendUri(), ExtensionManagementUtility\buildBaseTcaFromSingleFiles(), Abbreviation\buildJSAbbreviationArray(), UriBuilder\buildUri(), ContentObjectRenderer\callUserFunction(), SetupModuleController\checkAccess(), AbstractFunctionModule\checkExtObj(), BaseScriptClass\checkExtObj(), PreviewHook\checkForPreview(), StatusReportConflictsCheckHook\checkIfNoConflictingExtensionIsInstalled(), PageLayoutView\checkIfTranslationsExistInLanguage(), FileLinktype\checkLink(), Check\checkSomePhpOpcodeCacheIsLoaded(), GifBuilder\checkTextObj(), UpdateScriptUtility\checkUpdateScriptExists(), ImportExportController\checkUpload(), DataHandler\checkValue_input_Eval(), DataHandler\checkValue_text_Eval(), DataHandler\checkValueForRadio(), BasicFileUtility\cleanFileName(), FlexFormTools\cleanFlexFormXML(), RecordList\clearCache(), PageLayoutController\clearCache(), ImportantActions\clearOpcodeCache(), CrawlerHook\crawler_execute_type2(), LocallangArrayParser\createCsConvObject(), BackendLayoutView\createDataProviderContext(), ProcessedFileRepository\createDomainObject(), FormBuilder\createElementObject(), ContentObjectRenderer\createExceptionHandler(), ExtractorRegistry\createExtractorInstance(), ResourceFactory\createFolderObject(), IconFactory\createIcon(), ProcessedFileRepository\createNewProcessedFileObject(), DataHandlerHook\createRelationHandlerInstance(), DataHandler\createRelationHandlerInstance(), RendererRegistry\createRendererInstance(), ResourceFactory\createStorageObject(), TextExtractorRegistry\createTextExtractorInstance(), TypolinkViewHelper\createTypolinkParameterArrayFromArguments(), TreeNode\dataFromArray(), DataHandler\deleteRecord(), ReportController\detailAction(), TypoScriptFrontendController\determineId(), TypoScriptFrontendController\determineIdIsHiddenPage(), AbstractElementBrowser\determineScriptUrl(), AbstractRecordList\determineScriptUrl(), AbstractLinkBrowserController\determineScriptUrl(), AbstractTreeView\determineScriptUrl(), RecyclerAjaxController\dispatch(), FileDumpController\dumpAction(), RsaEncryptionEncoder\enableRsaEncryption(), LinkBrowserController\encodeTypoLink(), ValidatorTask\execute(), UpdateScriptUtility\executeUpdateIfNeeded(), ImportExport\export_addFile(), ImportExport\export_addRecord(), ConfigurationForm\ext_mergeIncomingWithExisting(), ExtendedTemplateService\ext_outputTS(), ExportPageTreeView\ext_tree(), AdministrationRepository\extGetTreeList(), BaseScriptClass\extObjContent(), Indexer\extractBaseHref(), Indexer\extractHyperLinks(), Indexer\extractLinks(), Indexer\extractRequiredMetaData(), TypoScriptFrontendController\fetch_the_id(), BackendUserAuthentication\fetchGroupData(), MetaDataRepository\findByFile(), FileBackend\findIdentifiersByTag(), GraphicalMenuContentObject\findLargestDims(), SoftReferenceIndex\findRef_images(), SoftReferenceIndex\findRef_TStemplate(), SoftReferenceIndex\findRef_typolink_tag(), FileController\flattenResultDataValue(), GeneralUtility\flushDirectory(), ReviewController\fullIndexAction(), DatabaseIntegrityView\func_refindex(), DatabaseIntegrityView\func_relations(), DatabaseIntegrityView\func_search(), SpriteBuildingHandler\generate(), AbstractDatabaseRecordList\generateList(), WorkspaceService\generateWorkspacePreviewLink(), LiveSearch\getAvailablePageIds(), PageLayoutView\getBackendLayoutView(), AbstractMenuContentObject\getCache(), ExtensionManagementUtility\getCacheManager(), DeletedRecordsController\getCacheManager(), DataHandler\getCacheManager(), Dispatcher\getCallableFromTarget(), LocalDriver\getCharsetConversion(), FormProtectionFactory\getClassNameAndConstructorArgumentsByState(), AbstractFormElement\getClipboardElements(), DataHandlerHook\getCommandMap(), Typo3Status\getCompatibility6Status(), PageRenderer\getCompressor(), LocalizationUtility\getConfigurationManager(), ContentObjectRenderer\getContentObject(), ClickMenuController\getContextMenuAction(), ConfigurationStatus\getCreatedDirectoriesWorldWritableStatus(), ConfigurationStatus\getCreatedFilesWorldWritableStatus(), TemplateService\getCurrentPageData(), ElementEntityProcessor\getDataHandler(), CollectionService\getDependencyCallback(), CommandMap\getDependencyCallback(), GridDataService\getDependencyCollectionService(), CollectionService\getDependencyResolver(), ConfigurationStatus\getDeprecationLogStatus(), ModuleTemplate\getDynamicTabMenu(), DocumentTemplate\getDynamicTabMenu(), SelectImageController\getElementBrowserInstance(), ElementBrowserController\getElementBrowserInstance(), CollectionService\getElementEntityProcessor(), CommandMap\getElementEntityProcessor(), SecurityStatus\getEncryptionKeyStatus(), DatabaseConnection\getFieldInfoCache(), FileCollector\getFileCollectionRepository(), FilesContentObject\getFileCollector(), SecurityStatus\getFileDenyPatternStatus(), ResourceStorage\getFileFactory(), FileDeletionAspect\getFileIndexRepository(), File\getFileIndexRepository(), ResourceStorage\getFileProcessingService(), FileCollector\getFileRepository(), InstallStatusReport\getFileSystemStatus(), ImageManipulationWizard\getFluidTemplateObject(), BackendController\getFluidTemplateObject(), ResourceStorage\getFolder(), ImageInfo\getGraphicalFunctions(), LocalImageProcessor\getGraphicalFunctionsObject(), PreviewProcessing\getGraphicalFunctionsObject(), ExtDirectServer\getGridDataService(), PageLayoutController\getHeaderFlashMessagesForCurrentPid(), LocalImageProcessor\getHelperByTaskName(), SecurityStatus\getHtaccessUploadStatus(), AbstractTreeView\getIcon(), FormEngineUtility\getIconHtml(), DefaultAvatarProvider\getImage(), ResourceFactory\getIndexer(), ExtendedFileUtility\getIndexer(), ResourceStorage\getIndexer(), UserFileInlineLabelService\getInlineLabel(), SecurityStatusReport\getInstallToolPasswordStatus(), SecurityStatusReport\getInstallToolProtectionStatus(), BackendUtilityHook\getInstance(), OnlineMediaHelperRegistry\getInstance(), ResourceFactory\getInstance(), ExtractorRegistry\getInstance(), RendererRegistry\getInstance(), TextExtractorRegistry\getInstance(), CategoryRegistry\getInstance(), FileIndexRepository\getInstance(), GridDataService\getIntegrityService(), DataHandler\getLocalTCE(), ProductionExceptionHandler\getLogger(), ProcessedFileRepository\getLogger(), AbstractViewHelper\getLogger(), FileCollector\getLogger(), UserSetupHook\getLoginScripts(), ConfigurationStatus\getMemcachedConnectionStatus(), MenuContentObjectFactory\getMenuObjectByType(), FileDeletionAspect\getMetaDataRepository(), File\getMetaDataRepository(), BackendModuleRepository\getModuleIcon(), ImportExport\getNewTCE(), AdditionalResourceService\getObjectManager(), Mailer\getObjectManager(), FormUtility\getObjectManager(), ExtDirectServer\getObjectManager(), LinkAnalyzer\getObjectManager(), DatabaseTreeDataProvider\getObjectManager(), GridDataService\getObjectManager(), WorkspaceService\getObjectManager(), ResourceStorage\getObjectManager(), Typo3Status\getOldXclassUsageStatus(), OnlineMediaHelperRegistry\getOnlineMediaHelper(), UsernamePasswordProviderSlot\getPageRenderer(), BackendControllerHook\getPageRenderer(), AbstractContentObject\getPageRenderer(), LoginFramesetController\getPageRenderer(), LiveSearchToolbarItem\getPageRenderer(), FileEditHook\getPageRenderer(), ElementBrowserFramesetController\getPageRenderer(), AbstractController\getPageRenderer(), WorkspaceSelectorToolbarItem\getPageRenderer(), ClearCacheToolbarItem\getPageRenderer(), OpendocsToolbarItem\getPageRenderer(), AbstractFunctionModule\getPageRenderer(), FormResultCompiler\getPageRenderer(), BaseScriptClass\getPageRenderer(), T3editor\getPageRenderer(), SystemInformationToolbarItem\getPageRenderer(), ColorpickerController\getPageRenderer(), RecordList\getPageRenderer(), ShortcutToolbarItem\getPageRenderer(), PageGenerator\getPageRenderer(), PageLayoutController\getPageRenderer(), BackendUtility\getPagesTSconfig(), TypoScriptFrontendController\getPagesTSconfig(), LanguageStore\getParserInstance(), FileDeletionAspect\getProcessedFileRepository(), ResourceFactory\getProcessedFileRepository(), ResourceStorage\getProcessingFolder(), PreviewProcessing\getProcessor(), BackendModuleRepository\getRawModuleMenuData(), LiveSearch\getRecordArray(), PagePositionMap\getRecordHeader(), MetaInformation\getRecordInformation(), StagesService\getRecordService(), PermissionController\getRecursiveSelectOptions(), ConfigurationStatus\getReferenceIndexStatus(), Typo3Status\getRegisteredXclassStatus(), ReferenceIndex\getRelations(), ReferenceIndex\getRelations_procDB(), ReferenceIndex\getRelations_procFiles(), InstallStatusReport\getRemainingUpdatesStatus(), WizardController\getRepository(), FileCollector\getResourceFactory(), AbstractTreeView\getRootIcon(), PageRepository\getRootLine(), UserSetupHook\getRsaEncryptionDecoder(), RsaAuthService\getRsaEncryptionDecoder(), ImportExportUtility\getSignalSlotDispatcher(), ExtensionManagementUtility\getSignalSlotDispatcher(), FileProcessingService\getSignalSlotDispatcher(), EditDocumentController\getSignalSlotDispatcher(), SystemInformationToolbarItem\getSignalSlotDispatcher(), ExtensionManagementService\getSignalSlotDispatcher(), IconFactory\getSignalSlotDispatcher(), SoftReferenceIndex\getSignalSlotDispatcher(), IconUtility\getSpriteIconForFile(), IconUtility\getSpriteIconForRecord(), IconUtility\getSpriteIconForResource(), ActionHandler\getStageService(), AbstractRecord\getStagesService(), ExtDirectServer\getStagesService(), HtmlParser\getSubpart(), TypoScriptFrontendControllerTest\getSysDomainCacheReturnsCurrentDomainRecord(), TypoScriptFrontendControllerTest\getSysDomainCacheReturnsForcedDomainRecord(), ExtDirectServer\getSystemLanguages(), FileEditHook\getT3editor(), ActionTask\getTask(), DatabaseBrowser\getTemporaryTreeMountCancelNotice(), PageLinkHandler\getTemporaryTreeMountCancelNotice(), AbstractRecordList\getTranslateTools(), SecurityStatus\getTrustedHostsPatternStatus(), EidUtility\getTSFE(), SoftReferenceIndex\getTypoLinkParts(), ClickEnlargeViewHelper\getTypoScriptService(), CrawlerHook\getUidRootLineForClosestTemplate(), UpgradeWizard\getUpdateObjectInstance(), FrontendUserAuthentication\getUserTSconf(), DocumentTemplate\getVersionSelector(), BackendUtilityHook\getWorkspaceService(), PagetreeCollectionsProcessor\getWorkspaceService(), RequestHandler\handleRequest(), CliRequestHandler\handleRequest(), ContentObjectRenderer\HTMLparser_TSbridge(), ModulesController\indexAction(), TaskModuleController\indexAction(), CrawlerHook\indexExtUrl(), CrawlerHook\indexSingleRecord(), ModuleController\init(), ConfigurationView\init(), ParseHtmlController\init(), ElementHistoryController\init(), DatabaseIntegrityView\init(), EditFileController\init(), FileSystemNavigationFrameController\init(), FileController\init(), PageTreeNavigationController\init(), SchedulerModuleController\init(), ElementInformationController\init(), SimpleDataHandlerController\init(), BrowseLinksController\init(), ColorpickerController\init(), NewContentElementController\init(), PageRepository\init(), RecordList\init(), GraphicalFunctions\init(), SetupModuleController\init(), PageLayoutController\init(), Indexer\init(), EditDocumentController\init(), TypoScriptFrontendController\initCaches(), FileController\initClipboard(), SimpleDataHandlerController\initClipboard(), LinkBrowserController\initCurrentUrl(), LinkBrowserController\initDocumentTemplate(), BrowseLinksController\initDocumentTemplate(), AbstractLinkBrowserController\initDocumentTemplate(), TypoScriptFrontendController\initFEuser(), AbstractLinkBrowserController\initHookObjects(), LocalizationFactory\initialize(), AdminPanelView\initialize(), AbstractLinkHandler\initialize(), FileBrowser\initialize(), SearchController\initialize(), IndexSearchRepository\initialize(), DatabaseConnection\initialize(), LinkValidatorReport\initialize(), TypoScriptTemplateConstantEditorModuleFunctionController\initialize_editor(), TemplateAnalyzerModuleFunctionController\initialize_editor(), TypoScriptTemplateObjectBrowserModuleFunctionController\initialize_editor(), PreviewController\initializeAction(), AbstractController\initializeAction(), ViewModuleController\initializeAction(), AdministrationController\initializeAction(), FrontendBackendUserAuthentication\initializeAdminPanel(), Bootstrap\initializeBackendTemplate(), LocalizationFactory\initializeCache(), PageLayoutView\initializeClipboard(), RequestHandler\initializeController(), Bootstrap\initializeErrorHandling(), RootlineUtility\initializeObject(), RequestHandler\initializeOutputCompression(), PreviewHook\initializePreviewUser(), FluidTemplateContentObject\initializeStandaloneViewInstance(), FrontendEditingController\initializeTceMain(), BackendController\initializeToolbarItems(), DatabaseTreeDataProvider\initializeTreeData(), GridDataService\initializeWorkspacesCachingFramework(), EidUtility\initLanguage(), DocumentTemplate\initPageRenderer(), TypoScriptFrontendController\initPageRenderer(), TypoScriptFrontendController\initTemplate(), AbstractTemplateView\injectTemplateCompiler(), NodeFactory\instantiate(), ResourceStorage\isOnline(), LiveSearchController\liveSearchAction(), UriBuilder\loadBackendRoutes(), ValidatorTask\loadModTsConfig(), SortPagesWizardModuleFunction\main(), PageInformationController\main(), CreatePagesWizardModuleFunctionController\main(), TranslationStatusController\main(), InfoPageTyposcriptConfigController\main(), InfoModuleController\main(), ClickMenuController\main(), ElementHistoryController\main(), TemplateAnalyzerModuleFunctionController\main(), PageFunctionsController\main(), TypoScriptTemplateConstantEditorModuleFunctionController\main(), MoveElementController\main(), ImportExportController\main(), LinkValidatorReport\main(), VersionModuleController\main(), TypoScriptTemplateInformationModuleFunctionController\main(), PageTreeNavigationController\main(), NewContentElementController\main(), TypoScriptTemplateObjectBrowserModuleFunctionController\main(), SetupModuleController\main(), PageLayoutController\main(), VersionsCommand\main_autoFix(), ParseHtmlController\main_parse_html(), SelectImage\main_rte(), UserElementsController\main_user(), OnlineMediaController\mainAction(), FramesetRenderer\make(), ButtonBar\makeButton(), ButtonBar\makeFullyRenderedButton(), GraphicalMenuContentObject\makeGifs(), ButtonBar\makeHelpButton(), ButtonBar\makeInputButton(), ButtonBar\makeLinkButton(), MenuRegistry\makeMenu(), Menu\makeMenuItem(), ButtonBar\makeShortcutButton(), ButtonBar\makeSplitButton(), ResourceStorage\markAsTemporaryOffline(), SearchController\markupSWpartsOfString(), AbstractUpdate\markWizardAsDone(), ContentObjectRenderer\mergeTSRef(), TcaFlexPrepare\migrateFlexformTcaRecursive(), TypoScriptFrontendController\newCObj(), TypoScriptFrontendController\pageErrorHandler(), ContentObjectRenderer\parseFunc(), RecordHistory\performRollback(), ProcessedFileChecksumUpdate\performUpdate(), AbstractPlugin\pi_getEditPanel(), DatabaseConnection\prepare_SELECTquery(), AbstractContainer\previewFieldValue(), ContentDataProcessor\process(), DecryptionHook\processDatamap_preProcessFieldArray(), ClickMenu\processingByExtClassArray(), SpellCheckingController\processRequest(), QueryView\procesStoreControl(), ExtendedFileUtility\pushErrorMessagesToFlashMessageQueue(), QueryView\queryMaker(), InstallUtility\reloadOpcache(), TemplateContentObject\render(), RsaInputElement\render(), FlexFormContainerContainer\render(), UsernamePasswordLoginProvider\render(), RemoveExtensionViewHelper\render(), OuterWrapContainer\render(), ConfigureExtensionViewHelper\render(), TextElement\render(), Avatar\render(), UrlLinkHandler\render(), MailLinkHandler\render(), AbstractStandaloneMessage\render(), PageRenderer\render(), ActionTask\renderActionList(), AjaxRequestHandler\renderAsJavascript(), InlineRecordContainer\renderCombinationChild(), SingleFieldContainer\renderDefaultLanguageDiff(), RecordHistory\renderDiff(), TaskModuleController\renderModuleContent(), PageRenderer\renderPageWithUncachedObjects(), TranslateViewHelperTest\renderReturnsDefaultIfNoTranslationIsFound(), TranslateViewHelperTest\renderReturnsStringForGivenId(), TranslateViewHelperTest\renderReturnsStringForGivenKey(), ErrorIconViewHelper\renderStatic(), SwitchUserViewHelper\renderStatic(), TypolinkViewHelper\renderStatic(), ShortcutViewHelper\renderStatic(), IconViewHelper\renderStatic(), HtmlViewHelper\renderStatic(), CaseViewHelper\renderStatic(), AbstractContainer\renderTabMenu(), TranslateViewHelperTest\renderThrowsExceptionIfNoKeyOrIdParameterIsGiven(), SetupModuleController\renderUserSetup(), ValueSliderWizard\renderWizard(), ResourceStorage\replaceFile(), ContentObjectRenderer\resolveMixedLinkParameter(), TranslateViewHelperTest\resultIsNotHtmlEscapedIfSoRequested(), ExtDirectRouter\routeAction(), ExtDirectEidController\routeAction(), AdministrationRepository\saveKeywords(), ActionTask\saveNewBackendUser(), SuggestWizard\searchAction(), MboxTransport\send(), ActionHandler\sendPageToNextStage(), ActionHandler\sendPageToPreviousStage(), FileBackend\set(), SimpleFileBackend\set(), ImportExport\setFlexFormRelations(), Icon\setSize(), TimeTracker\setTSlogMessage(), SoftReferenceIndex\setTypoLinkPartsElement(), SqlParserTest\setUp(), ExtensionCompatibilityTesterTest\setUp(), ConditionMatcherTest\setUp(), AbstractExportTestCase\setUp(), HtmlViewHelper\simulateFrontendEnvironment(), CropViewHelper\simulateFrontendEnvironment(), SetupModuleController\simulateUser(), ReviewController\singleIndexAction(), PackageManager\sortAndSavePackageStates(), AbstractMenuContentObject\start(), ContentObjectRenderer\stdWrap_offsetWrap(), PageRepository\storeHash(), HtmlParser\substituteMarker(), HtmlParser\substituteMarkerAndSubpartArrayRecursive(), HtmlParser\substituteMarkerArray(), HtmlParser\substituteSubpart(), HtmlParser\substituteSubpartArray(), SwitchBackUserHook\switchBack(), DeletedRecordsController\transform(), DataHandler\transformRichtextContentToDatabase(), RteHtmlParser\TS_links_rte(), DeletedRecords\undeleteData(), LanguageRepository\updateSelectedLanguages(), ActionHandler\updateStageChangeButtons(), Avatar\validateSortAndInitiateAvatarProviders(), VersionModuleController\versioningMgm(), ActionTask\viewEditRecord(), ActionTask\viewNewBackendUser(), ActionTask\viewRecordList(), ActionTask\viewSqlQuery(), NewContentElementController\wizard_appendWizards(), ElementBrowserPageTreeView\wrapTitle(), and ConfigurationManager\writeLocalConfiguration().

static makeInstanceService (   $serviceType,
  $serviceSubType = '',
  $excludeServiceKeys = array() 
)
static

Find the best service and check if it works. Returns object of the service class.

Parameters
string$serviceTypeType of service (service key).
string$serviceSubTypeSub type like file extensions or similar. Defined by the service.
mixed$excludeServiceKeysList of service keys which should be excluded in the search for a service. Array or comma list.
Returns
object|string[] The service object or an array with error infos.

Definition at line 4753 of file GeneralUtility.php.

References $GLOBALS, GeneralUtility\array_merge(), ExtensionManagementUtility\deactivateService(), ExtensionManagementUtility\findService(), and DebugUtility\viewArray().

Referenced by AbstractUserAuthentication\checkAuthentication(), FrontendUserAuthentication\fetchGroupData(), and AbstractUserAuthentication\processLoginData().

static makeRedirectUrl (   $inUrl,
  $l = 0,
  $index_script_url = '' 
)
static

Create a shortened "redirect" URL with specified length from an incoming URL

Parameters
string$inUrlInput URL
int$lURL string length limit
string$index_script_urlURL of "index script" - the prefix of the "?RDCT=..." parameter. If not supplied it will default to ::getIndpEnv('TYPO3_REQUEST_DIR').'index.php'
Returns
string Processed URL

Definition at line 4992 of file GeneralUtility.php.

References $GLOBALS.

Referenced by GeneralUtility\substUrlsInPlainText().

static md5int (   $str)
static

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

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

Definition at line 765 of file GeneralUtility.php.

Referenced by CrawlerHook\crawler_init(), FolderTreeView\generateExpandCollapseParameter(), TemplateService\getCurrentPageData(), FolderTreeView\getShortHashNumberForStorage(), and AbstractUserAuthentication\hashLockClause_getHashInt().

static milliseconds ( )
static
static minifyJavaScript (   $script,
$error = '' 
)
static

Minifies JavaScript

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

Definition at line 2393 of file GeneralUtility.php.

References $GLOBALS.

Referenced by AdminPanelView\display(), PageRenderer\doCompressJavaScript(), and RteHtmlAreaApi\writeTemporaryFile().

static mkdir (   $newFolder)
static
static mkdir_deep (   $directory,
  $deepDirectory = '' 
)
static

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

Parameters
string$directoryTarget directory to create. Must a have trailing slash
string$deepDirectoryDirectory to create. This second parameter
Returns
void
Exceptions
\InvalidArgumentExceptionIf $directory or $deepDirectory are not strings
\RuntimeExceptionIf directory could not be created

Definition at line 2836 of file GeneralUtility.php.

Referenced by LocalDriver\createFolder(), FileWriter\createLogFile(), FileHandlingUtility\createNestedDirectory(), ClassLoadingInformation\ensureAutoloadInfoDirExists(), SessionService\ensureSessionSavePathExists(), CoreUpdateService\setDownloadTargetPath(), DocumentationService\unzipDocumentPackage(), FileHandlingUtility\unzipExtensionFromFile(), TerService\unzipTranslationFile(), and TerService\updateTranslation().

static modifyHTMLColor (   $color,
  $R,
  $G,
  $B 
)
static

Modifies a HTML Hex color by adding/subtracting $R,$G and $B integers

Parameters
string$colorA hexadecimal color code, #xxxxxx
int$ROffset value 0-255
int$GOffset value 0-255
int$BOffset value 0-255
Returns
string A hexadecimal color code, #xxxxxx, modified according to input vars
See Also
modifyHTMLColorAll()
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 895 of file GeneralUtility.php.

References MathUtility\forceIntegerInRange().

static modifyHTMLColorAll (   $color,
  $all 
)
static

Modifies a HTML Hex color by adding/subtracting $all integer from all R/G/B channels

Parameters
string$colorA hexadecimal color code, #xxxxxx
int$allOffset value 0-255 for all three channels.
Returns
string A hexadecimal color code, #xxxxxx, modified according to input vars
See Also
modifyHTMLColor()
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 914 of file GeneralUtility.php.

static naturalKeySortRecursive ( $array)
static

Sorts an array by key recursive - uses natural sort order (aAbB-zZ)

Parameters
array$arrayarray to be sorted recursively, passed by reference
Returns
bool TRUE if param is an array
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::naturalKeySortRecursive() instead

Definition at line 1832 of file GeneralUtility.php.

References ArrayUtility\naturalKeySortRecursive().

static normalizeIPv6 (   $address)
static

Normalize an IPv6 address to full length

Parameters
string$addressGiven IPv6 address
Returns
string Normalized address
See Also
compressIPv6()

Definition at line 494 of file GeneralUtility.php.

References GeneralUtility\strtolower().

static normalizeMailAddress (   $address)
static

Changes from/to arguments for mail() function to work in any environment.

Parameters
string$addressAddress to adjust
Returns
string Adjusted address
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 1133 of file GeneralUtility.php.

static png_to_gif_by_imagemagick (   $theFile)
static

Converts a png file to gif. This converts a png file to gif IF the FLAG $GLOBALS['TYPO3_CONF_VARS']['FE']['png_to_gif'] is set TRUE.

Parameters
string$theFileThe filename with path
Returns
string New filename
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use ::pngToGifByImagemagick() instead.

Definition at line 289 of file GeneralUtility.php.

References GraphicalFunctions\pngToGifByImagemagick().

static presetApplicationContext ( ApplicationContext  $applicationContext)
static

Set the ApplicationContext

This function is used by the Bootstrap to hand over the application context. It must not be used anywhere else, because the context shall never be changed on runtime!

Parameters
\TYPO3\CMS\Core\Core\ApplicationContext$applicationContext
Exceptions
\RuntimeExceptionif applicationContext is overriden

Definition at line 5385 of file GeneralUtility.php.

References GeneralUtility\$applicationContext.

Referenced by Bootstrap\baseSetup().

static purgeInstances ( )
static

Purge all instances returned by makeInstance.

This function is most useful when called from tearDown in a test case to drop any instances that have been created by the tests.

Warning: This is a helper method for unit tests. Do not call this directly in production code!

See Also
makeInstance
Returns
void

Definition at line 4724 of file GeneralUtility.php.

Referenced by TcaCheckboxItemsTest\tearDown(), TcaRadioItemsTest\tearDown(), TcaSelectItemsTest\tearDown(), TcaSelectTreeItemsTest\tearDown(), DatabaseSystemLanguageRowsTest\tearDown(), TcaFlexFetchTest\tearDown(), and StandaloneViewTest\tearDown().

static quoted_printable (   $string,
  $maxlen = 76 
)
static

Implementation of quoted-printable encode. See RFC 1521, section 5.1 Quoted-Printable Content-Transfer-Encoding

Parameters
string$stringContent to encode
int$maxlenLength of the lines, default is 76
Returns
string The QP encoded string
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use mailer API instead

Definition at line 4836 of file GeneralUtility.php.

static quoteJSvalue (   $value)
static

Quotes a string for usage as JS parameter.

Parameters
string$valuethe string to encode, may be empty
Returns
string the encoded value already quoted (with single quotes),

Definition at line 5318 of file GeneralUtility.php.

Referenced by BackendController\__construct(), SetupModuleController\addAvatarButtonJs(), UserElements\buildJavascriptConfiguration(), Typo3HtmlParser\buildJavascriptConfiguration(), Typo3Link\buildJavascriptConfiguration(), Typo3Image\buildJavascriptConfiguration(), Typo3Link\buildJSClassesAnchorArray(), SelectImage\buildMenuArray(), SearchFormController\compileResult(), SearchController\compileResultRows(), ClickMenu\DB_changeFlag(), ClickMenu\DB_copycut(), ClickMenu\DB_db_list(), ClickMenu\DB_delete(), ClickMenu\DB_edit(), ClickMenu\DB_info(), ClickMenu\DB_new(), ClickMenu\DB_paste(), DebugUtility\debug(), DebugUtility\debugInPopUpWindow(), RecordHistory\displaySettings(), ClickMenu\dragDrop_copymovefolder(), ClickMenu\dragDrop_copymovepage(), FrontendEditPanel\editPanelLinkWrap(), RsaEncryptionEncoder\enableRsaEncryption(), ConfigurationForm\ext_getForm(), ClickMenu\FILE_copycut(), ClickMenu\FILE_delete(), ClickMenu\FILE_launch(), ClickMenu\FILE_paste(), JavaScriptMenuContentObject\generate_level(), SelectTreeElement\generateJavascript(), DatabaseRecordList\getButtons(), PageTreeNavigationController\getButtons(), EditFileController\getButtons(), RteController\getButtons(), TaskModuleController\getButtons(), EditDocumentController\getButtons(), SchedulerModuleController\getButtons(), DatabaseRecordList\getDocHeaderButtons(), AdminPanelView\getEditModule(), SelectImage\getJSCode(), InlineControlContainer\getLevelInteractionLink(), ContentObjectRenderer\getMailTo(), ModuleMenuView\getModuleData(), BrowseLinksController\getPageConfigLabel(), ModuleMenuView\getRawModuleData(), BackendModuleRepository\getRawModuleMenuData(), TableController\getTableHTML(), BackendController\handlePageEditing(), SelectImage\imageInsertJsStatement(), ContentObjectRenderer\imageLinkWrap(), UserElementsController\init(), CreateFolderController\init(), EditDocumentController\init(), SelectImage\initDocumentTemplate(), ShortcutToolbarItem\initShortcuts(), SelectImage\insertImages(), FormResultCompiler\JSbottom(), PageLayoutView\languageSelector(), AbstractMenuContentObject\link(), ElementBrowserFramesetController\main(), MoveElementController\main(), NewContentElementController\main(), PageLayoutController\main(), SelectImage\main_rte(), UserElementsController\main_user(), PageLayoutController\makeButtons(), PageBrowsingViewHelper\makecurrentPageSelector_link(), ModuleTemplate\makeShortcutIcon(), DocumentTemplate\makeShortcutIcon(), PageLayoutView\newContentElementOnClick(), PagePositionMap\onClickEvent(), ContentLayoutPagePositionMap\onClickInsertRecord(), PagePositionMap\onClickInsertRecord(), TaskModuleController\openInNewWindow(), EditDocumentController\openInNewWindowLink(), AbstractPlugin\pi_openAtagHrefInJSwindow(), ElementBrowserFolderTreeView\PM_ATagWrap(), ElementBrowserPageTreeView\PM_ATagWrap(), FolderTreeView\PMiconATagWrap(), PageTreeView\PMiconATagWrap(), Clipboard\printClipboard(), Clipboard\printContentFromTab(), ClickMenu\printDBClickMenu(), ElementBrowserPageTreeView\printTree(), DocumentTemplate\redirectUrls(), ModuleTemplate\redirectUrls(), RsaInputElement\render(), SelectCheckBoxElement\render(), T3editorElement\render(), TypoScriptConstantsViewHelper\renderColorPicker(), TranslationStatusController\renderL10nTable(), DatabaseRecordList\renderListHeader(), DatabaseRecordList\renderListRow(), OpendocsToolbarItem\renderMenuEntry(), InlineControlContainer\renderPossibleRecordsSelectorTypeGroupDB(), InlineControlContainer\renderPossibleRecordsSelectorTypeSelect(), SelectSingleBoxElement\renderResetButtonElement(), BackendController\setStartupModule(), SetupModuleController\simulateUser(), ContentObjectRenderer\stdWrap_encodeForJavaScriptValue(), PageLayoutView\tt_content_drawHeader(), ClickMenu\urlRefForCM(), BackendUtilityTest\viewOnClickReturnsOnClickCodeWithAlternativeUrl(), ActionTask\viewRecordList(), ContentLayoutPagePositionMap\wrapColumnHeader(), FolderTreeView\wrapIcon(), ContentLayoutPagePositionMap\wrapRecordTitle(), ElementBrowserPageTreeView\wrapTitle(), ElementBrowserFolderTreeView\wrapTitle(), PageTreeView\wrapTitle(), FolderTreeView\wrapTitle(), AbstractTreeView\wrapTitle(), JavaScriptMenuContentObject\writeMenu(), and GraphicalMenuContentObject\writeMenu().

static rawUrlEncodeFP (   $str)
static

rawurlencode which preserves "/" chars Useful when file paths should keep the "/" chars, but have all other special chars encoded.

Parameters
string$strInput string
Returns
string Output string

Definition at line 1065 of file GeneralUtility.php.

Referenced by ContentObjectRenderer\cImage().

static rawUrlEncodeJS (   $str)
static

Version of rawurlencode() where all spaces (%20) are re-converted to space-characters. Useful when passing text to JavaScript where you simply url-encode it to get around problems with syntax-errors, linebreaks etc.

Parameters
string$strString to raw-url-encode with spaces preserved
Returns
string Rawurlencoded result of input string, but with all %20 (space chars) converted to real spaces.

Definition at line 1053 of file GeneralUtility.php.

static read_png_gif (   $theFile,
  $output_png = false 
)
static

Returns filename of the png/gif version of the input file (which can be png or gif). If input file type does not match the wanted output type a conversion is made and temp-filename returned.

Parameters
string$theFileFilepath of image file
bool$output_pngIf set, then input file is converted to PNG, otherwise to GIF
Returns
string If the new image file exists, its filepath is returned
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use ::readPngGif() instead.

Definition at line 305 of file GeneralUtility.php.

References GraphicalFunctions\readPngGif().

static remapArrayKeys ( $array,
  $mappingTable 
)
static

Rename Array keys with a given mapping table

Parameters
array$arrayArray by reference which should be remapped
array$mappingTableArray with remap information, array/$oldKey => $newKey)
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::remapArrayKeys() instead

Definition at line 1751 of file GeneralUtility.php.

References ArrayUtility\remapArrayKeys().

static removeArrayEntryByValue ( array  $array,
  $cmpValue 
)
static

Removes the value $cmpValue from the $array if found there. Returns the modified array

Parameters
array$arrayArray containing the values
string$cmpValueValue to search for and if found remove array entry where found.
Returns
array Output array with entries removed if search string is found
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - use ArrayUtility::removeArrayEntryByValue() instead

Definition at line 1567 of file GeneralUtility.php.

References ArrayUtility\removeArrayEntryByValue().

static removeDotsFromTS ( array  $ts)
static

Removes dots "." from end of a key identifier of TypoScript styled array. array('key.' => array('property.' => 'value')) –> array('key' => array('property' => 'value'))

Parameters
array$tsTypoScript configuration array
Returns
array TypoScript configuration array without dots at the end of all keys

Definition at line 1811 of file GeneralUtility.php.

Referenced by BackendUserAuthentication\backendSetUC(), ContextMenu\buildNestedJSArray(), TypoScriptFrontendController\getConfigArray(), and FormEngineUtility\overrideFieldConf().

static removePrefixPathFromList ( array  $fileArr,
  $prefixToRemove 
)
static

Removes the absolute part of all files/folders in fileArr

Parameters
array$fileArrThe file array to remove the prefix from
string$prefixToRemoveThe prefix path to remove (if found as first part of string!)
Returns
array The input $fileArr processed.

Definition at line 3080 of file GeneralUtility.php.

Referenced by AbstractItemProvider\addItemsFromFolder(), CrawlerHook\crawler_execute_type2(), and FileHandlingUtility\createZipFileFromExtension().

static removeSingletonInstance (   $className,
SingletonInterface  $instance 
)
static

Removes the instance of a singleton class to be returned by makeInstance.

Warning: This is NOT a public API method and must not be used in own extensions! This methods exists mostly for unit tests to inject a mock of a singleton class. If you use this, make sure to always combine this with getSingletonInstances() and resetSingletonInstances() in setUp() and tearDown() of the test class.

See Also
makeInstance
Exceptions
\InvalidArgumentException
Parameters
string$className
\TYPO3\CMS\Core\SingletonInterface$instance
Returns
void

Definition at line 4616 of file GeneralUtility.php.

static removeXSS (   $string)
static

Wrapper for the RemoveXSS function. Removes potential XSS code from an input string.

Using an external class by Travis Puderbaugh kalla.nosp@m.har@.nosp@m.quick.nosp@m.wire.nosp@m.d.com

Parameters
string$stringInput string
Returns
string Input string with potential XSS code removed

Definition at line 245 of file GeneralUtility.php.

Referenced by RemoveXssFilter\filter(), LiveSearch\setQueryString(), and FrontendLoginController\validateRedirectUrl().

static requireFile (   $requireFile)
static

Requires a class for TYPO3 Useful to require classes from inside other classes (not global scope). A limited set of global variables are available (see function)

Parameters
string$requireFile,:Path of the file to be included
Returns
void

Definition at line 4820 of file GeneralUtility.php.

static requireOnce (   $requireFile)
static

Require a class for TYPO3 Useful to require classes from inside other classes (not global scope). A limited set of global variables are available (see function)

Parameters
string$requireFile,:Path of the file to be included
Returns
void

Definition at line 4805 of file GeneralUtility.php.

Referenced by Indexer\includeCrawlerClass().

static resetSingletonInstances ( array  $newSingletonInstances)
static

Set a group of singleton instances. Similar to setSingletonInstance(), but multiple instances can be set.

Warning: This is NOT a public API method and must not be used in own extensions! This method is usually only used in tests to restore the list of singletons in tearDown(), that was backed up with getSingletonInstances() in setUp() and manipulated in tests with setSingletonInstance()

Definition at line 4642 of file GeneralUtility.php.

Referenced by TcaCheckboxItemsTest\tearDown(), TcaRadioItemsTest\tearDown(), TcaSelectItemsTest\tearDown(), TcaSelectTreeItemsTest\tearDown(), DatabaseSystemLanguageRowsTest\tearDown(), TcaFlexFetchTest\tearDown(), FluidTemplateContentObjectTest\tearDown(), ContentObjectRendererTest\tearDown(), and StandaloneViewTest\tearDown().

static resolveAllSheetsInDS ( array  $dataStructArray)
static

Resolves ALL sheet definitions in dataStructArray If no sheet is found, then the default "sDEF" will be created with the dataStructure inside.

Parameters
array$dataStructArrayInput data structure, possibly with a sheet-definition and references to external data source files.
Returns
array Output data structure with all sheets resolved as arrays.

Definition at line 4249 of file GeneralUtility.php.

Referenced by AbstractItemProvider\getRegisteredFlexForms(), BackendUtility\getRegisteredFlexForms(), and SuggestWizard\overrideFieldNameAndConfigurationForFlexform().

static resolveBackPath (   $pathStr)
static

Resolves "../" sections in the input path string. For example "fileadmin/directory/../other_directory/" will be resolved to "fileadmin/other_directory/"

Parameters
string$pathStrFile path in which "/../" is resolved
Returns
string

Definition at line 3111 of file GeneralUtility.php.

Referenced by BackendController\addJavascriptFile(), DocumentTemplate\addStyleSheetDirectory(), SimpleSpriteHandler\buildCssAndRegisterIcons(), Typo3Link\buildJSClassesAnchorArray(), ModuleLoader\checkMod(), AbstractSpriteHandler\collectTcaSpriteIcons(), ResourceCompressor\compressCssFile(), ResourceCompressor\compressJsFile(), ResourceCompressor\createMergedFile(), ImportExport\export_addFile(), SpriteBuildingHandler\generate(), FileHandlingUtility\getAbsolutePath(), PathUtility\getAbsoluteWebPath(), ConfigurationStatus\getDeprecationLogFileLink(), ResourceCompressor\getFilenameFromMainDir(), RteHtmlAreaApi\getFullFileName(), DocumentTemplate\getHtmlTemplate(), FormEngineUtility\getIconHtml(), ModuleMenuView\getRawModuleData(), BackendModuleRepository\getRawModuleMenuData(), ModuleLoader\getRelativePath(), CrawlerHook\indexExtUrl(), Indexer\isAllowedLocalFile(), NewContentElementController\main(), IconUtility\mapFileExtensionToSpriteIconName(), GraphicalFunctions\prependAbsolutePath(), ImportExport\processSoftReferences_saveFile_createRelFile(), IconRegistry\registerTCAIcons(), LogoView\render(), BackendController\render(), CssStyledContentController\render_uploads(), PageRenderer\renderAdditionalJavaScriptLibraries(), PageRenderer\renderCssFiles(), PageRenderer\renderCssLibraries(), PageRenderer\renderJavaScriptFiles(), SpriteGenerator\resolveSpritePath(), and RteHtmlAreaApi\writeTemporaryFile().

static resolveSheetDefInDS (   $dataStructArray,
  $sheet = 'sDEF' 
)
static

Looks for a sheet-definition in the input data structure array. If found it will return the data structure for the sheet given as $sheet (if found). If the sheet definition is in an external file that file is parsed and the data structure inside of that is returned.

Parameters
array$dataStructArrayInput data structure, possibly with a sheet-definition and references to external data source files.
string$sheetThe sheet to return, preferably.
Returns
array An array with two num. keys: key0: The data structure is returned in this key (array) UNLESS an error occurred in which case an error string is returned (string). key1: The used sheet key value!

Definition at line 4211 of file GeneralUtility.php.

Referenced by DataHandler\checkValue_flex_procInData(), and FlexFormTools\traverseFlexFormXMLData().

static revExplode (   $delimiter,
  $string,
  $count = 0 
)
static

Reverse explode which explodes the string counting from behind.

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

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

Parameters
string$delimiterDelimiter string to explode with
string$stringThe string to explode
int$countNumber of array entries
Returns
array Exploded values

Definition at line 1506 of file GeneralUtility.php.

References elseif.

Referenced by ContentObjectRenderer\encaps_lineSplit(), FolderTreeView\evaluateExpandCollapseParameter(), IndexSearchRepository\freeIndexUidWhere(), SearchFormController\freeIndexUidWhere(), DataHandlerHook\getEmailsForStageChangeNotification(), and SilentConfigurationUpgradeService\transferDeprecatedCurlSettings().

static rmdir (   $path,
  $removeNonEmpty = false 
)
static

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

Parameters
string$pathAbsolute path to folder, see PHP rmdir() function. Removes trailing slash internally.
bool$removeNonEmptyAllow deletion of non-empty directories
Returns
bool TRUE if went well!

Definition at line 2892 of file GeneralUtility.php.

References elseif.

Referenced by LocalDriver\deleteFolder(), PackageManager\deletePackage(), UploadExtensionFileController\removeBackupFolder(), FileHandlingUtility\removeDirectory(), UploadExtensionFileController\removeExtensionAndRestoreFromBackup(), and TerService\updateTranslation().

static rmFromList (   $element,
  $list 
)
static

Removes an item from a comma-separated list of items.

If $element contains a comma, the behaviour of this method is undefined. Empty elements in the list are preserved.

Parameters
string$elementElement to remove
string$listComma-separated list of items (string)
Returns
string New comma-separated list of items

Definition at line 706 of file GeneralUtility.php.

References $list.

Referenced by ParseHtmlController\keepSpanTagsWithId(), and Language\main().

static sanitizeLocalUrl (   $url = '')
static
static setSingletonInstance (   $className,
SingletonInterface  $instance 
)
static

Sets the instance of a singleton class to be returned by makeInstance.

If this function is called multiple times for the same $className, makeInstance will return the last set instance.

Warning: This is NOT a public API method and must not be used in own extensions! This methods exists mostly for unit tests to inject a mock of a singleton class. If you use this, make sure to always combine this with getSingletonInstances() and resetSingletonInstances() in setUp() and tearDown() of the test class.

See Also
makeInstance
Parameters
string$className
\TYPO3\CMS\Core\SingletonInterface$instance
Returns
void

Definition at line 4594 of file GeneralUtility.php.

Referenced by ContentObjectRendererTest\createMockedLoggerAndLogManager(), Bootstrap\initializeCachingFramework(), and StandaloneViewTest\setUp().

static shortMD5 (   $input,
  $len = 10 
)
static
static slashArray ( array  $arr,
  $cmd 
)
static

Either slashes ($cmd=add) or strips ($cmd=strip) array $arr depending on $cmd

Parameters
array$arrMultidimensional input array
string$cmd"add" or "strip", depending on usage you wish.
Returns
array
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 1732 of file GeneralUtility.php.

static slashJS (   $string,
  $extended = false,
  $char = '\'' 
)
static

This function is used to escape any ' -characters when transferring text to JavaScript!

Parameters
string$stringString to escape
bool$extendedIf set, also backslashes are escaped.
string$charThe character to escape, default is ' (single-quote)
Returns
string Processed input string

Definition at line 1038 of file GeneralUtility.php.

static split_fileref (   $fileNameWithPath)
static

Splits a reference to a file in 5 parts

Parameters
string$fileNameWithPathFile name with path to be analysed (must exist if open_basedir is set)
Returns
array Contains keys [path], [file], [filebody], [fileext], [realFileext]

Definition at line 839 of file GeneralUtility.php.

References GeneralUtility\strtolower().

Referenced by ContentObjectRenderer\filelist(), ExtendedFileUtility\func_unzip(), BasicFileUtility\getUniqueName(), GraphicalFunctions\IMreduceColors(), T3editor\setModeByFile(), and ImportExport\writeFileVerify().

static split_tag_attributes (   $tag)
static

Returns an array with the 'components' from an attribute list from an HTML tag. The result is normally analyzed by get_tag_attributes Removes tag-name if found

Parameters
string$tagHTML-tag string (or attributes only)
Returns
array Array with the attribute values.

Definition at line 1887 of file GeneralUtility.php.

References elseif.

static splitCalc (   $string,
  $operators 
)
static

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

Parameters
string$stringInput string, eg "123 + 456 / 789 - 4 @param string $operators Operators to split by, typically "/+-*
Returns
array Array with operators and operands separated.
See Also
::calc(), ::calcOffset()

Definition at line 1001 of file GeneralUtility.php.

Referenced by ContentObjectRenderer\calc(), and GifBuilder\calculateValue().

static stdAuthCode (   $uid_or_record,
  $fields = '',
  $codeLength = 8 
)
static

Standard authentication code (used in Direct Mail, checkJumpUrl and setfixed links computations)

Parameters
mixed$uid_or_recordUid (int) or record (array)
string$fieldsList of fields from the record if that is given.
int$codeLengthLength of returned authentication code.
Returns
string MD5 hash of 8 chars.

Definition at line 4092 of file GeneralUtility.php.

References $GLOBALS.

static stripHttpHeaders (   $content)
staticprotected

Strips HTTP headers from the content.

Parameters
string$content
Returns
string

Definition at line 2650 of file GeneralUtility.php.

static stripSlashesOnArray ( array &  $theArray)
static

StripSlash array This function traverses a multidimensional array and strips slashes to the values. NOTE that the input array is and argument by reference.!! Twin-function to addSlashesOnArray

Parameters
array$theArrayMultidimensional input array, (REFERENCE!)
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
Returns
array

Definition at line 1711 of file GeneralUtility.php.

Referenced by DataHandler\fillInFieldArray().

static strtolower (   $str)
static
static strtoupper (   $str)
static

Converts string to uppercase The function converts all Latin characters (a-z, but no accents, etc) to uppercase. It is safe for all supported character sets (incl. utf-8). Unlike strtoupper() it does not honour the locale.

Parameters
string$strInput string
Returns
string Uppercase String

Definition at line 1167 of file GeneralUtility.php.

Referenced by FrontendLoginController\getUserFieldMarkers(), GeneralUtility\initSysLog(), SearchFormController\makeSearchForm(), and SearchFormController\printResultRow().

static substUrlsInPlainText (   $message,
  $urlmode = '76',
  $index_script_url = '' 
)
static

Takes a clear-text message body for a plain text email, finds all 'http://' links and if they are longer than 76 chars they are converted to a shorter URL with a hash parameter. The real parameter is stored in the database and the hash-parameter/URL will be redirected to the real parameter when the link is clicked. This function is about preserving long links in messages.

Parameters
string$messageMessage content
string$urlmodeURL mode; "76" or "all
string$index_script_urlURL of index script (see makeRedirectUrl())
Returns
string Processed message content
See Also
makeRedirectUrl()
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Use mailer API instead

Definition at line 4954 of file GeneralUtility.php.

References GeneralUtility\makeRedirectUrl().

static tempnam (   $filePrefix,
  $fileSuffix = '' 
)
static

Create temporary filename (Create file with unique file name) This function should be used for getting temporary file names - will make your applications safe for open_basedir = on REMEMBER to delete the temporary files after use! This is done by ::unlink_tempfile()

Parameters
string$filePrefixPrefix for temporary file
string$fileSuffixSuffix for temporary file, for example a special file extension
Returns
string result from PHP function tempnam() with PATH_site . 'typo3temp/' set for temp path.
See Also
unlink_tempfile(), upload_to_tempfile()

Definition at line 4069 of file GeneralUtility.php.

Referenced by DatabaseConnectionTest\createFakeExtension(), AbstractOnlineMediaHelper\createNewFile(), SpriteGenerator\generateGraphic(), SpriteGenerator\generateHighDensityGraphic(), LocalPreviewHelper\getTemporaryFilePath(), ImportExport\import_addFileNameToBeCopied(), Indexer\indexExternalUrl(), AbstractImportTestCase\isCaseSensitiveFilesystem(), SpellCheckingController\processRequest(), FileContentParser\readFileContent(), SpellCheckingController\spellCheckHandler(), and ImportExport\writeTemporaryFileFromData().

static trimExplode (   $delim,
  $string,
  $removeEmptyValues = false,
  $limit = 0 
)
static

Explodes a string and trims all values for whitespace in the end. If $onlyNonEmptyValues is set, then all blank ('') values are removed.

Parameters
string$delimDelimiter string to explode with
string$stringThe string to explode
bool$removeEmptyValuesIf set, all empty values will be removed in output
int$limitIf 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
array Exploded values

Definition at line 1537 of file GeneralUtility.php.

References elseif.

Referenced by TreelistCacheUpdateHooks\__construct(), SuggestWizardDefaultReceiver\__construct(), TcaColumnsProcessShowitem\addData(), TcaColumnsProcessPlaceholders\addData(), TcaColumnsProcessRecordTitle\addData(), TcaColumnsProcessCommon\addData(), TcaInputPlaceholders\addData(), TcaTypesShowitem\addFieldsBySubtypeAddList(), ExtensionManagementUtility\addFieldsToAllPalettesOfField(), ClickMenu\addMenuItems(), ExtensionManagementUtility\addModule(), ExtensionManagementUtility\addService(), Indexer\addSpacesToKeywordList(), ExtensionManagementUtility\addToAllTCAtypes(), ModuleSettings\addToStoreList(), BackendUserAuthentication\addTScomment(), FrontendEditingController\allowedToEdit(), DefinitionList\applyToolbarConstraints(), DefaultClean\applyToolbarConstraints(), Typo3HtmlParser\applyToolbarConstraints(), Typo3Link\applyToolbarConstraints(), TableOperations\applyToolbarConstraints(), CommandMap\applyWorkspacesSetStageBehaviour(), DataHandler\assemblePermissions(), ConfigurationItemRepository\buildConfigurationArray(), SpriteGenerator\buildFileInformationCache(), ContextMenu\buildJavascriptConfiguration(), Typo3Color\buildJavascriptConfiguration(), BlockElements\buildJavascriptConfiguration(), SelectFont\buildJavascriptConfiguration(), RteHtmlAreaApi\buildJavascriptConfiguration(), InlineElements\buildJavascriptConfiguration(), Abbreviation\buildJSAbbreviationArray(), SelectFont\buildJSFontItemsConfig(), GifBuilder\calcOffset(), TypoScriptFrontendController\calculateLinkVars(), GifBuilder\calculateMaximum(), DataHandler\canDeletePage(), SchedulerModuleController\checkDate(), CrawlerHook\checkDeniedSuburls(), FormInlineAjaxController\checkInlineFileTypeAccessForField(), DataHandler\checkValue_group_select_explodeSelectGroupValue(), DataHandler\checkValueForCheck(), DataHandler\checkValueForGroupSelect(), DataHandler\checkValueForInline(), DataHandler\checkValueForInput(), DataHandler\checkValueForText(), RteHtmlAreaApi\cleanList(), TypoScriptFrontendController\clearPageCacheContent_pidList(), AbstractConditionMatcher\compareNumber(), ExtensionUtility\configurePlugin(), VersionNumberUtility\convertVersionsStringToVersionNumbers(), DataHandler\copyPages(), CrawlerHook\crawler_execute_type2(), OnlineMediaController\createAction(), LocalDriver\createFolder(), PaletteAndSingleContainer\createPaletteContentArray(), ContentObjectRenderer\DBgetInsert(), ContentObjectRenderer\DBgetUpdate(), ContentObjectRenderer\DBmayFEUserEdit(), ContentObjectRenderer\DBmayFEUserEditSelect(), CleanerTask\deleteFilesForTable(), FrontendEditingController\displayEditIcons(), RteHtmlParser\divideIntoLines(), DataHandler\doesPageHaveUnallowedTables(), ClickMenu\enableDisableItems(), ContentObjectRenderer\encaps_lineSplit(), ConditionMatcher\evaluateCondition(), AbstractConditionMatcher\evaluateConditionCommon(), ValidatorTask\execute(), UninstallExtension\executeAction(), ExtensionManagementUtility\executePositionedStringInsertion(), TypoScriptParser\executeValueModifier(), ExtensionManagementUtility\explodeItemList(), CommandMap\explodeSetStage(), AbstractContainer\explodeSingleFieldShowItemConfiguration(), SpriteGenerator\explodeSizeTag(), InlineControlContainer\extractFlexFormParts(), ConfigurationItemRepository\extractInformationForConfigFieldsOfTypeOptions(), InfoPageTyposcriptConfigController\extractLinesFromTSConfig(), LiveSearch\extractSearchableFieldsFromTable(), ContentObjectRenderer\fillInMarkerArray(), FilesContentObject\findAndSortFiles(), FileIndexRepository\findOneByCombinedIdentifier(), ExtensionManagementUtility\findService(), DataHandler\fixCopyAfterDuplFields(), ActionTask\fixDbMount(), DataHandler\fixUniqueInPid(), EditDocumentController\fixWSversioningInEditConf(), IndexSearchRepository\freeIndexUidWhere(), SearchFormController\freeIndexUidWhere(), BackendController\generateJavascript(), AbstractDatabaseRecordList\generateList(), FileHandlingUtility\getAbsolutePathsToConfiguredDirectories(), SearchController\getAllAvailableMediaTypesOptions(), FrontendEditingController\getAllowedEditActions(), BrowseLinksController\getAllowedItems(), AbstractLinkBrowserController\getAllowedItems(), SelectImage\getAllowedItems(), BrowseLinksController\getAllowedLinkAttributes(), AbstractLinkBrowserController\getAllowedLinkAttributes(), TcaInputPlaceholders\getAllowedTableForGroupField(), DatabaseRecordList\getButtons(), BackendUserAuthentication\getCategoryMountPoints(), AbstractFormElement\getClipboardElements(), BackendLayoutView\getColPosListItemsParsed(), CommandUtility\getConfiguredApps(), TypoScriptFrontendController\getCurrentPageCacheConfiguration(), ContentObjectRenderer\getData(), ContextMenuDataProvider\getDisableActions(), DatabaseRecordList\getDocHeaderButtons(), DataHandlerHook\getEmailsForStageChangeNotification(), DataHandler\getExcludeListArray(), ExtensionCompatibilityTester\getExtensionsToExclude(), SetupModuleController\getFieldsFromShowItem(), ContentObjectRenderer\getFieldVal(), SecurityStatus\getFileDenyPatternStatus(), BackendUserAuthentication\getFileMountRecords(), ResourceFactory\getFileObjectFromCombinedIdentifier(), BackendUserAuthentication\getFilePermissions(), ExtDirectServerTest\getFileReferenceProphecies(), TypoScriptFrontendController\getFirstTimeValueForRecord(), BackendUtility\getFlexFormDS(), TcaFlexProcess\getFlexIdentifier(), ResourceFactory\getFolderObjectFromCombinedIdentifier(), UserSettingsController\getFromDottedNotation(), TemplateService\getFromMPmap(), BackendUtility\getGroupNames(), BackendLayoutView\getIdentifiersToBeExcluded(), FormInlineAjaxController\getInlineRelatedRecordsUidArray(), RteHtmlParser\getKeepTags(), Language\getLanguages(), ValidatorTask\getLinkTypes(), SpellCheckingController\getMainDictionaryCharacterSet(), ExtdirectTreeDataProvider\getNodeTypes(), ResourceFactory\getObjectFromCombinedIdentifier(), PageRepository\getPagesOverlay(), BackendUtility\getPagesTSconfig(), FormInlineAjaxController\getParentConfigFromFlexForm(), CommandUtility\getPathsInternal(), DataHandler\getPlaceholderTitleForTableLabel(), TcaInputPlaceholders\getPlaceholderValue(), CharsetConverter\getPreferredClientLanguage(), FrontendLoginController\getPreserveGetVars(), ActionHandler\getRecipientList(), TcaRecordTitle\getRecordTitleByLabelProperties(), TcaRecordTitle\getRecordTitleForGroupType(), AbstractItemProvider\getRegisteredFlexForms(), BackendUtility\getRegisteredFlexForms(), TcaInputPlaceholders\getRelatedGroupFieldUids(), ValidatorTask\getSearchField(), AbstractDatabaseRecordList\getSearchFields(), BackendUtility\getSpecConfParts(), ResourceFactory\getStorageObjectFromCombinedIdentifier(), SuggestWizard\getTablesToQueryFromFieldConfiguration(), BackendUtility\getTCAtypes(), BackendUserAuthentication\getTSConfig(), CreatePagesWizardModuleFunctionController\getTypeSelectHtml(), SoftReferenceIndex\getTypoLinkParts(), DataHandlerHook\getUniqueFields(), Indexer\getUrlHeaders(), ActionTask\getUsergroups(), BackendUtility\getUserNames(), AbstractNode\getValidationDataAsJsonString(), ContentObjectRenderer\includeLibs(), TemplateService\includeStaticTypoScriptSources(), CrawlerHook\indexSingleRecord(), ClickMenu\init(), QueryGenerator\init(), TemplateService\init(), EditDocumentController\init(), CharsetConverter\initCharset(), LanguageStore\initialize(), SearchFormController\initialize(), InlineStackProcessor\initializeByParsingDomObjectIdString(), RootlineUtility\initializeObject(), FileContentParser\initParser(), CommandUtility\initPaths(), CharsetConverter\initUnicodeData(), DataHandler\insertUpdateDB_preprocessBasedOnFieldType(), TypoScriptFrontendController\INTincScript_includeLibs(), SystemEnvironmentBuilder\isFunctionDisabled(), ExtensionManagementUtility\isServiceAvailable(), DataHandler\isTableAllowedForThisPage(), FileAllowedTypesValidator\isValid(), ArrayUtility\keepItemsInArray(), PageLayoutView\languageSelector(), DocumentController\listAction(), DeletedRecords\loadData(), BackendController\loadResourcesForRegisteredNavigationComponents(), Spellchecker\main(), CopyPaste\main(), Abbreviation\main(), ElementHistoryController\main(), CreateFolderController\main(), NewRecordController\main(), SelectImage\main_rte(), OnlineMediaController\mainAction(), LoginController\makeInterfaceSelectorBox(), PageLayoutView\makeOrdinaryList(), AbstractDatabaseRecordList\makeQueryArray(), SearchFormController\makeSearchForm(), TcaMigration\migrateExtAndSysextPathToEXTPath(), TcaMigration\migrateShowItemAdditionalPaletteToOwnPalette(), TcaMigration\migrateSpecialConfigurationAndRemoveShowItemStylePointerConfig(), TcaMigration\migrateT3editorWizardWithEnabledByTypeConfigToColumnsOverrides(), FrontendEditingController\move(), DataHandlerHook\moveRecord_wsPlaceholders(), SelectImage\orderMenuDefinition(), ContentObjectRenderer\parseFunc(), ModuleLoader\parseModulesArray(), RootlineUtility\parseMountPointParameter(), AbstractPlugin\pi_classParam(), AbstractPlugin\pi_getLL(), AbstractPlugin\pi_getPidList(), AbstractPlugin\pi_isOnlyFields(), AbstractPlugin\pi_prependFieldsWithTable(), DataHandler\placeholderShadowing(), SuggestWizardDefaultReceiver\prepareSelectStatement(), AbstractContainer\previewFieldValue(), PagePositionMap\printContentElementColumns(), TimeTracker\printTSlog(), SplitProcessor\process(), DataHandlerHook\processCmdmap(), AbstractItemProvider\processDatabaseFieldValue(), AbstractItemProvider\processForeignTableClause(), ContentObjectRenderer\processParams(), FrontendLoginController\processRedirect(), SpellCheckingController\processRequest(), RelationHandler\readList(), CategoryRegistry\registerDefaultCategorizedTables(), ExtensionUtility\registerModule(), NewRecordController\regularNew(), DataHandler\remapListedDBRecords_procDBRefs(), ExtensionCompatibilityTester\removeCurrentExtensionFromFile(), TcaFlexProcess\removeExcludeFieldsFromDataStructure(), TcaTypesShowitem\removeFields(), TcaTypesShowitem\removeFieldsByBitmaskExcludeBits(), TcaTypesShowitem\removeFieldsBySubtypeExcludeList(), TcaTypesShowitem\removeFieldsFromPalettes(), UserSettingsController\removeFromList(), NewContentElementController\removeInvalidElements(), AbstractItemProvider\removeItemsByRemoveItemsPageTsConfig(), FlexFormNoTabsContainer\render(), FlexFormTabsContainer\render(), RsaInputElement\render(), ListOfFieldsContainer\render(), FullRecordContainer\render(), SoloFieldContainer\render(), TextElement\render(), ImageManipulationElement\render(), CssStyledContentController\render_bullets(), CssStyledContentController\render_table(), CssStyledContentController\render_uploads(), InlineRecordContainer\renderForeignRecordHeader(), TranslationStatusController\renderL10nTable(), BrowseLinksController\renderLinkAttributeFields(), InlineControlContainer\renderPossibleRecordsSelectorTypeGroupDB(), BytesViewHelper\renderStatic(), ValueSliderWizard\renderWizard(), StagesService\resolveBackendUserIds(), SpriteGenerator\resolveSpritePath(), RteHtmlParser\RTE_transform(), AdministrationRepository\saveKeywords(), FileContentParser\searchTypeMediaTitle(), QueryGenerator\setAndCleanUpExternalLists(), Bootstrap\setCacheHashOptions(), DeletedRecords\setData(), DatabaseRowInitializeNew\setDefaultsFromNeighborRow(), UserSettingsController\setFromDottedNotation(), DataHandler\setMirror(), TypoScriptFrontendController\setPageCacheContent(), TypoScriptFrontendController\settingLanguage(), SpellCheckingController\spellCheckHandler(), HtmlParser\splitIntoBlock(), GraphicalFunctions\splitString(), RelationHandler\start(), AdministrationController\statisticDetailsAction(), ContentObjectRenderer\stdWrap_addPageCacheTags(), MarkerBasedTemplateService\substituteMarkerAndSubpartArrayRecursive(), MarkerBasedTemplateService\substituteMarkerArray(), ContentObjectRenderer\TCAlookup(), PostgresSpecifics\transformQueryParts(), RteHtmlParser\TS_links_rte(), ModuleMenuView\unsetHiddenModules(), PermissionController\updateAction(), LinkValidatorReport\updateBrokenLinks(), ValidatorTaskAdditionalFieldProvider\validateAdditionalFields(), NewContentElementController\wizardArray(), and ExtensionCompatibilityTester\writeCurrentExtensionToFile().

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

Referenced by ContentObjectRenderer\caseshift().

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

Referenced by ContentObjectRenderer\caseshift(), and PageRenderer\loadRequireJs().

static uniqueList (   $in_list,
  $secondParameter = null 
)
static

Takes comma-separated lists and arrays and removes all duplicates If a value in the list is trim(empty), the value is ignored.

Parameters
string$in_listAccept multiple parameters which can be comma-separated lists of values and arrays.
mixed$secondParameterDummy field, which if set will show a warning!
Returns
string Returns the list without any duplicates of values, space around values are trimmed

Definition at line 822 of file GeneralUtility.php.

Referenced by ResourceStorage\checkFileExtensionPermission(), BackendUserAuthentication\fetchGroupData(), ContentObjectRenderer\filelist(), BackendUtility\getRecordWSOL(), BasicFileUtility\init(), and BackendUserAuthentication\workspaceInit().

static unlink_tempfile (   $uploadedTempFileName)
static

Deletes (unlink) a temporary filename in 'PATH_site."typo3temp/"' given as input. The function will check that the file exists, is in PATH_site."typo3temp/" and does not contain back-spaces ("../") so it should be pretty safe. Use this after upload_to_tempfile() or tempnam() from this class!

Parameters
string$uploadedTempFileNameFilepath for a file in PATH_site."typo3temp/". Must be absolute.
Returns
bool Returns TRUE if the file was unlink()'ed
See Also
upload_to_tempfile(), tempnam()

Definition at line 4043 of file GeneralUtility.php.

Referenced by SpriteGenerator\generateGraphic(), SpriteGenerator\generateHighDensityGraphic(), SpellCheckingController\processRequest(), SessionUtility\removeFiles(), SpellCheckingController\spellCheckHandler(), and ImportExport\unlinkTempFiles().

static unQuoteFilenames (   $parameters,
  $unQuote = false 
)
static

Explode a string (normally a list of filenames) with whitespaces by considering quotes in that string.

This is mostly needed by the imageMagickCommand function above.

Parameters
string$parametersThe whole parameters string
bool$unQuoteIf set, the elements of the resulting array are unquoted.
Returns
array Exploded parameters

Definition at line 5282 of file GeneralUtility.php.

References elseif.

Referenced by CommandUtility\imageMagickCommand().

static upload_copy_move (   $source,
  $destination 
)
static

Moves $source file to $destination if uploaded, otherwise try to make a copy

Parameters
string$sourceSource file, absolute path
string$destinationDestination file, absolute path
Returns
bool Returns TRUE if the file was moved.
See Also
upload_to_tempfile()

Definition at line 4000 of file GeneralUtility.php.

Referenced by ImportExport\export_addFile(), ImportExport\export_addSysFile(), SpriteGenerator\generateGraphic(), SpriteGenerator\generateHighDensityGraphic(), and UploadedFile\moveTo().

static upload_to_tempfile (   $uploadedFileName)
static

Will move an uploaded file (normally in "/tmp/xxxxx") to a temporary filename in PATH_site."typo3temp/" from where TYPO3 can use it. Use this function to move uploaded files to where you can work on them. REMEMBER to use ::unlink_tempfile() afterwards - otherwise temp-files will build up! They are NOT automatically deleted in PATH_site."typo3temp/"!

Parameters
string$uploadedFileNameThe temporary uploaded filename, eg. $_FILES['[upload field name here]']['tmp_name']
Returns
string If a new file was successfully created, return its filename, otherwise blank string.
See Also
unlink_tempfile(), upload_copy_move()

Definition at line 4025 of file GeneralUtility.php.

Referenced by UploadExtensionFileController\extractAction(), and HandleIncomingFormValues\saveUploadedFile().

static validEmail (   $email)
static

Checking syntax of input email address

http://tools.ietf.org/html/rfc3696 International characters are allowed in email. So the whole address needs to be converted to punicode before passing it to filter_var(). We convert the user- and domain part separately to increase the chance of hitting an entry in self::$idnaStringCache.

Also the @ sign may appear multiple times in an address. If not used as a boundary marker between the user- and domain part, it must be escaped with a backslash: @. This mean we can not just explode on the @ sign and expect to get just two parts. So we pop off the domain and then glue the rest together again.

Parameters
string$emailInput string to evaluate
Returns
bool Returns TRUE if the $email address (input string) is valid

Definition at line 1088 of file GeneralUtility.php.

Referenced by ActionHandler\getReceipientsOfStage(), ActionHandler\getRecipientList(), MailUtility\getSystemFromAddress(), EmailValidator\isValid(), AbstractMenuContentObject\link(), MailPostProcessor\setFrom(), SystemStatusUpdateTaskNotificationEmailField\validateAdditionalFields(), ValidatorTaskAdditionalFieldProvider\validateAdditionalFields(), and ActionTask\viewNewBackendUser().

static validIP (   $ip)
static

Validate a given IP address.

Possible format are IPv4 and IPv6.

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

Definition at line 571 of file GeneralUtility.php.

static validIPv4 (   $ip)
static

Validate a given IP address to the IPv4 address format.

Example for possible format: 10.0.45.99

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

Definition at line 584 of file GeneralUtility.php.

static validIPv6 (   $ip)
static

Validate a given IP address to the IPv6 address format.

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

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

Definition at line 597 of file GeneralUtility.php.

static validPathStr (   $theFile)
static

Checks for malicious file paths.

Returns TRUE if no '//', '..', '\' or control characters are found in the $theFile. This should make sure that the path is not pointing 'backwards' and further doesn't contain double/back slashes. So it's compatible with the UNIX style path strings valid for TYPO3 internally.

Parameters
string$theFileFile path to evaluate
Returns
bool TRUE, $theFile is allowed path string, FALSE otherwise
See Also
http://php.net/manual/en/security.filesystem.nullbytes.php
Todo:
Possible improvement: Should it rawurldecode the string first to check if any of these characters is encoded?

Definition at line 3879 of file GeneralUtility.php.

Referenced by BasicFileUtility\checkPathAgainstMounts(), ContentObjectRenderer\clean_directory(), CharsetConverter\initCharset(), CharsetConverter\initUnicodeData(), and BasicFileUtility\is_directory().

static verifyFilenameAgainstDenyPattern (   $filename)
static

Verifies the input filename against the 'fileDenyPattern'. Returns TRUE if OK.

Filenames are not allowed to contain control characters. Therefore we always filter on [[:cntrl:]].

Parameters
string$filenameFile path to evaluate
Returns
bool

Definition at line 3919 of file GeneralUtility.php.

References $filename, and $GLOBALS.

Referenced by ResourceStorage\checkFileExtensionPermission(), BasicFileUtility\checkIfAllowed(), TypoScriptParser\extractIncludes(), SecurityStatus\getHtaccessUploadStatus(), TypoScriptParser\includeFile(), CreateFolderController\main(), and FolderUtilityRenderer\uploadForm().

static wrapJS (   $string,
  $linebreak = true 
)
static

Wraps JavaScript code XHTML ready with <script>-tags Automatic re-indenting of the JS code is done by using the first line as indent reference. This is nice for indenting JS code with PHP code on the same level.

Parameters
string$stringJavaScript code
bool$linebreakWrap script element in line breaks? Default is TRUE.
Returns
string The wrapped JS code, ready to put into a XHTML page

Definition at line 1952 of file GeneralUtility.php.

Referenced by DebugUtility\debug(), DebugUtility\debugInPopUpWindow(), ConfigurationForm\ext_getForm(), FormResultCompiler\JSbottom(), PageRenderer\renderJqueryScriptTag(), and PageRenderer\renderMainJavaScriptLibraries().

static writeFile (   $file,
  $content,
  $changePermissions = false 
)
static

Writes $content to the file $file

Parameters
string$fileFilepath to write to
string$contentContent to write
bool$changePermissionsIf TRUE, permissions are forced to be set
Returns
bool TRUE if the file was successfully opened and written to.

Definition at line 2667 of file GeneralUtility.php.

Referenced by ResourceCompressor\__construct(), DatabaseConnectionTest\createFakeExtension(), FileWriter\createHtaccessFile(), FileWriter\createLogFile(), ResourceCompressor\createMergedFile(), ExtensionCompatibilityTesterTest\deleteProtocolFileDeletesFile(), SessionService\ensureSessionSavePathExists(), TypoScriptParser\extractIncludes(), AbstractSpriteHandler\generate(), ImportExport\import_addFileNameToBeCopied(), Indexer\indexExternalUrl(), ExtensionCompatibilityTester\logError(), ImportExport\processSoftReferences_saveFile_createRelFile(), ExtensionCompatibilityTester\removeCurrentExtensionFromFile(), ExtensionCompatibilityTesterTest\removeCurrentExtensionFromFileRemovesGivenExtension(), ResourceCompressor\retrieveExternalFile(), PackageManager\sortAndSavePackageStates(), DocumentationService\unzipDocumentPackage(), FileHandlingUtility\unzipExtensionFromFile(), TerService\unzipTranslationFile(), SessionService\write(), ConfigurationManager\writeAdditionalConfiguration(), ExtensionCompatibilityTester\writeCurrentExtensionToFile(), FileHandlingUtility\writeEmConfToFile(), FileHandlingUtility\writeExtensionFiles(), ResourceCompressor\writeFileAndCompressed(), ImportExport\writeFileVerify(), ConfigurationManager\writeLocalConfiguration(), and ImportExport\writeTemporaryFileFromData().

static 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$filepathAbsolute file path to write to inside "typo3temp/". First part of this string must match PATH_site."typo3temp/"
string$contentContent string to write
Returns
string Returns NULL on success, otherwise an error string telling about the problem.

Definition at line 2760 of file GeneralUtility.php.

Referenced by UpdateScriptUtility\determineUpdateClassName(), Helper\fetchFile(), LocallangArrayParser\generateCacheFile(), BackendController\getLocalLangFileName(), DocumentationService\getOfficialDocuments(), EditDocumentController\init(), CharsetConverter\initCaseFolding(), CharsetConverter\initCharset(), CharsetConverter\initToASCII(), CharsetConverter\initUnicodeData(), PageGenerator\inline2TempFile(), TerService\updateTranslation(), and RteHtmlAreaApi\writeTemporaryFile().

static 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$stringXML content to convert into an array
string$NSprefixThe tag-prefix resolve, eg. a namespace like "T3:"
bool$reportDocTagIf 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 2198 of file GeneralUtility.php.

References PageRepository\storeHash().

Referenced by DataHandler\checkValueForFlex(), ResourceFactory\convertFlexFormDataToConfigurationArray(), DataHandler\copyRecord_procBasedOnFieldType(), BackendUtility\getFlexFormDS(), AbstractItemProvider\getRegisteredFlexForms(), BackendUtility\getRegisteredFlexForms(), ReferenceIndex\getRelations(), TcaFlexFetch\initializeDataValues(), TableFlexFormToTtContentFieldsUpdate\initializeFlexForm(), ImportExport\loadFile(), AbstractPlugin\pi_initPIflexForm(), ContentObjectRenderer\readFlexformIntoConf(), DataHandler\remapListedDBRecords(), ValueSliderWizard\renderWizard(), TcaFlexFetch\resolvePossibleExternalFileInDataStructure(), ImportExport\setFlexFormRelations(), FlexFormTools\traverseFlexFormXMLData(), and DataHandler\updateFlexFormData().

static xml2arrayProcess (   $string,
  $NSprefix = '',
  $reportDocTag = false 
)
staticprotected

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

Parameters
string$stringXML content to convert into an array
string$NSprefixThe tag-prefix resolve, eg. a namespace like "T3:"
bool$reportDocTagIf 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 2229 of file GeneralUtility.php.

References MathUtility\canBeInterpretedAsInteger().

static xml2tree (   $string,
  $depth = 999,
  $parserOptions = array() 
)
static

Parses XML input into a PHP array with associative keys

Parameters
string$stringXML data input
int$depthNumber of element levels to resolve the XML into an array. Any further structure will be set as XML.
array$parserOptionsOptions that will be passed to PHP's xml_parser_set_option()
Returns
mixed The array with the parsed structure unless the XML parser returns with an error in which case the error message string is returned.

Definition at line 1981 of file GeneralUtility.php.

Referenced by FileContentParser\readFileContent().

static xmlGetHeaderAttribs (   $xmlData)
static

Extracts the attributes (typically encoding and version) of an XML prologue (header).

Parameters
string$xmlDataXML data
Returns
array Attributes of the xml prologue (header)

Definition at line 2378 of file GeneralUtility.php.

Referenced by FlexFormTools\traverseFlexFormXMLData().

static xmlRecompileFromStructValArray ( array  $vals)
static

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

Parameters
array$valsAn array of XML parts, see xml2tree
Returns
string Re-compiled XML data.

Definition at line 2334 of file GeneralUtility.php.

Member Data Documentation

$allowHostHeaderValue = false
staticprotected

Definition at line 54 of file GeneralUtility.php.

$applicationContext = null
staticprotected
$finalClassNameCache = array()
staticprotected

Definition at line 76 of file GeneralUtility.php.

$idnaConverter = null
staticprotected

Definition at line 97 of file GeneralUtility.php.

$idnaStringCache = array()
staticprotected

Definition at line 90 of file GeneralUtility.php.

$indpEnvCache = []
staticprotected

Definition at line 115 of file GeneralUtility.php.

$nonSingletonInstances = array()
staticprotected

Definition at line 69 of file GeneralUtility.php.

$singletonInstances = array()
staticprotected

Definition at line 62 of file GeneralUtility.php.

$supportedCgiServerApis
staticprotected
Initial value:
= array(
'fpm-fcgi',
'cgi',
'isapi',
'cgi-fcgi',
'srv',
)

Definition at line 104 of file GeneralUtility.php.

const ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL = '.*'
const ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME = 'SERVER_NAME'

Definition at line 46 of file GeneralUtility.php.

const SYSLOG_SEVERITY_ERROR = 3
const SYSLOG_SEVERITY_FATAL = 4
const SYSLOG_SEVERITY_INFO = 0
const SYSLOG_SEVERITY_NOTICE = 1

Definition at line 40 of file GeneralUtility.php.

Referenced by TypoScriptFrontendController\set_no_cache().

const SYSLOG_SEVERITY_WARNING = 2