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

Static Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 22 of file GeneralUtilityFilesystemFixture.php.

Member Function Documentation

◆ isAllowedAbsPath()

static TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture::isAllowedAbsPath (   $path)
static

For testing, we must allow vfs:// as first part file path

Parameters
string$path‪File path to evaluate

Definition at line 29 of file GeneralUtilityFilesystemFixture.php.

◆ validPathStr()

static bool TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture::validPathStr (   $theFile)
static

For testing we must allow vfs:// as first part of file path

Parameters
string$theFile‪File path to evaluate
Returns
‪bool TRUE, $theFile is allowed path string, FALSE otherwise

Definition at line 40 of file GeneralUtilityFilesystemFixture.php.

◆ writeFileToTypo3tempDir()

static TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir (   $filepath,
  $content 
)
static