TYPO3
7.6
|
Public Member Functions | |
parse ($string, $matchObj= '') | |
nextDivider () | |
parseSub (array &$setup) | |
rollParseSub ($string, array &$setup) | |
getVal ($string, $setup) | |
setVal ($string, array &$setup, $value, $wipeOut=false) | |
error ($err, $num=2) | |
doSyntaxHighlight ($string, $lineNum= '', $highlightBlockMode=false) | |
regHighLight ($code, $pointer, $strlen=-1) | |
syntaxHighlight_print ($lineNumDat, $highlightBlockMode) | |
Static Public Member Functions | |
static | includeFile ($filename, $cycle_counter=1, $returnFiles=false, &$newString= '', array &$includedFiles=array(), $optionalProperties= '', $parentFilenameOrPath= '') |
static | checkIncludeLines_array (array $array) |
static | extractIncludes ($string, $cycle_counter=1, array $extractedFileNames=array(), $parentFilenameOrPath= '') |
static | extractIncludes_array (array $array) |
Public Attributes | |
$strict = true | |
$setup = array() | |
$raw | |
$rawP | |
$lastComment = '' | |
$commentSet = false | |
$multiLineEnabled = false | |
$multiLineObject = '' | |
$multiLineValue = array() | |
$inBrace = 0 | |
$lastConditionTrue = true | |
$sections = array() | |
$sectionsMatch = array() | |
$syntaxHighLight = false | |
$highLightData = array() | |
$highLightData_bracelevel = array() | |
$regComments = false | |
$regLinenumbers = false | |
$errors = array() | |
$lineNumberOffset = 0 | |
$breakPointLN = 0 | |
$highLightStyles | |
$highLightBlockStyles = '' | |
$highLightBlockStyles_basecolor = '#cccccc' | |
$parentObject | |
Protected Member Functions | |
executeValueModifier ($modifierName, $modifierArgument=null, $currentValue=null) | |
parseNextKeySegment ($key) | |
getTimeTracker () | |
modifyHTMLColor ($color, $R, $G, $B) | |
modifyHTMLColorAll ($color, $all) | |
Static Protected Member Functions | |
static | includeDirectory ($dirPath, $cycle_counter=1, $returnFiles=false, &$newString= '', array &$includedFiles=array(), $optionalProperties= '', $parentFilenameOrPath= '') |
static | typoscriptIncludeError ($error) |
The TypoScript parser
Definition at line 28 of file TypoScriptParser.php.
|
static |
Parses the string in each value of the input array for include-commands
array | $array | Array with TypoScript in each value |
Definition at line 1029 of file TypoScriptParser.php.
Referenced by BackendUtility\getPagesTSconfig(), TypoScriptFrontendController\getPagesTSconfig(), and FrontendUserAuthentication\getUserTSconf().
doSyntaxHighlight | ( | $string, | |
$lineNum = '' , |
|||
$highlightBlockMode = false |
|||
) |
Syntax highlight a TypoScript text Will parse the content. Remember, the internal setup array may contain invalid parsed content since conditions are ignored!
string | $string | The TypoScript text |
mixed | $lineNum | If blank, linenumbers are NOT printed. If array then the first key is the linenumber offset to add to the internal counter. |
bool | $highlightBlockMode | If set, then the highlighted output will be formatted in blocks based on the brace levels. prespace will be ignored and empty lines represented with a single no-break-space. |
Definition at line 1220 of file TypoScriptParser.php.
References TypoScriptParser\parse(), and TypoScriptParser\syntaxHighlight_print().
error | ( | $err, | |
$num = 2 |
|||
) |
Stacks errors/messages from the TypoScript parser into an internal array, $this->error If "TT" is a global object (as it is in the frontend when backend users are logged in) the message will be registered here as well.
string | $err | The error message string |
int | $num | The error severity (in the scale of $GLOBALS['TT']->setTSlogMessage: Approx: 2=warning, 1=info, 0=nothing, 3=fatal.) |
Definition at line 777 of file TypoScriptParser.php.
References TypoScriptParser\getTimeTracker().
Referenced by TypoScriptParser\parse(), and TypoScriptParser\parseSub().
|
protected |
Executes operator functions, called from TypoScript example: page.10.value := appendString(!)
string | $modifierName | TypoScript function called |
string | $modifierArgument | Function arguments; In case of multiple arguments, the method must split on its own |
string | $currentValue | Current TypoScript value |
Definition at line 528 of file TypoScriptParser.php.
References $GLOBALS, GeneralUtility\callUserFunction(), GeneralUtility\SYSLOG_SEVERITY_WARNING, and GeneralUtility\trimExplode().
Referenced by TypoScriptParser\parseSub().
|
static |
Search for commented INCLUDE_TYPOSCRIPT statements and save the content between the BEGIN and the END line to the specified file
string | $string | Template content |
int | $cycle_counter | Counter for detecting endless loops |
array | $extractedFileNames | |
string | $parentFilenameOrPath |
\RuntimeException | |
\UnexpectedValueException |
Definition at line 1050 of file TypoScriptParser.php.
References PathUtility\getAbsolutePathOfRelativeReferencedFileOrPath(), GeneralUtility\getFileAbsFileName(), GeneralUtility\SYSLOG_SEVERITY_WARNING, GeneralUtility\verifyFilenameAgainstDenyPattern(), and GeneralUtility\writeFile().
|
static |
Processes the string in each value of the input array with extractIncludes
array | $array | Array with TypoScript in each value |
Definition at line 1198 of file TypoScriptParser.php.
Referenced by TypoScriptTemplateInformationModuleFunctionController\processTemplateRowBeforeSaving().
|
protected |
Definition at line 1314 of file TypoScriptParser.php.
References $GLOBALS.
Referenced by TypoScriptParser\error().
getVal | ( | $string, | |
$setup | |||
) |
Get a value/property pair for an object path in TypoScript, eg. "myobject.myvalue.mysubproperty". Here: Used by the "copy" operator, <
string | $string | Object path for which to get the value |
array | $setup | Global setup code if $string points to a global object path. But if string is prefixed with "." then its the local setup array. |
Definition at line 637 of file TypoScriptParser.php.
References TypoScriptParser\$setup, and TypoScriptParser\parseNextKeySegment().
Referenced by TypoScriptParser\parseSub().
|
staticprotected |
Include all files with matching Typoscript extensions in directory $dirPath. Contents of the files are prepended to &$newstring, filename to &$includedFiles. Order of the directory items to be processed: files first, then directories, both in alphabetical order. Further include_typoscript tags in the contents of the files are processed recursively.
string | $dirPath | Relative path to the directory to be included |
int | $cycle_counter | Counter for detecting endless loops |
bool | $returnFiles | When set, filenames of included files will be prepended to the array &$includedFiles |
string | &$newString | The output string to which the content of the file will be prepended (referenced) |
array | &$includedFiles | Array to which the filenames of included files will be prepended (referenced) |
string | $optionalProperties | |
string | $parentFilenameOrPath | The parent file (with absolute path) or path for relative includes |
Definition at line 975 of file TypoScriptParser.php.
References PathUtility\getAbsolutePathOfRelativeReferencedFileOrPath(), GeneralUtility\getAllFilesAndFoldersInPath(), GeneralUtility\getFileAbsFileName(), and Composer\Autoload\includeFile().
|
static |
Include file $filename. Contents of the file will be prepended to &$newstring, filename to &$includedFiles Further include_typoscript tags in the contents are processed recursively
string | $filename | Relative path to the typoscript file to be included |
int | $cycle_counter | Counter for detecting endless loops |
bool | $returnFiles | When set, filenames of included files will be prepended to the array &$includedFiles |
string | &$newString | The output string to which the content of the file will be prepended (referenced |
array | &$includedFiles | Array to which the filenames of included files will be prepended (referenced) |
string | $optionalProperties | |
string | $parentFilenameOrPath | The parent file (with absolute path) or path for relative includes |
Definition at line 926 of file TypoScriptParser.php.
References $filename, elseif, PathUtility\getAbsolutePathOfRelativeReferencedFileOrPath(), GeneralUtility\getFileAbsFileName(), GeneralUtility\getUrl(), and GeneralUtility\verifyFilenameAgainstDenyPattern().
|
protected |
Modifies a HTML Hex color by adding/subtracting $R,$G and $B integers
string | $color | A hexadecimal color code, #xxxxxx |
int | $R | Offset value 0-255 |
int | $G | Offset value 0-255 |
int | $B | Offset value 0-255 |
Definition at line 1330 of file TypoScriptParser.php.
References MathUtility\forceIntegerInRange().
Referenced by TypoScriptParser\modifyHTMLColorAll().
|
protected |
Modifies a HTML Hex color by adding/subtracting $all integer from all R/G/B channels
string | $color | A hexadecimal color code, #xxxxxx |
int | $all | Offset value 0-255 for all three channels. |
Definition at line 1347 of file TypoScriptParser.php.
References TypoScriptParser\modifyHTMLColor().
Referenced by TypoScriptParser\syntaxHighlight_print().
nextDivider | ( | ) |
Will search for the next condition. When found it will return the line content (the condition value) and have advanced the internal $this->rawP pointer to point to the next line after the condition.
Definition at line 289 of file TypoScriptParser.php.
Referenced by TypoScriptParser\parse().
parse | ( | $string, | |
$matchObj = '' |
|||
) |
Start parsing the input TypoScript text piece. The result is stored in $this->setup
string | $string | The TypoScript text |
object | string | $matchObj | If is object, then this is used to match conditions found in the TypoScript code. If matchObj not specified, then no conditions will work! (Except [GLOBAL]) |
Definition at line 238 of file TypoScriptParser.php.
References TypoScriptParser\$syntaxHighLight, TypoScriptParser\error(), TypoScriptParser\nextDivider(), and TypoScriptParser\parseSub().
Referenced by TypoScriptParser\doSyntaxHighlight().
|
protected |
Determines the first key segment of a TypoScript key by searching for the first unescaped dot in the given key string.
Since the escape characters are only needed to correctly determine the key segment any escape characters before the first unescaped dot are stripped from the key.
string | $key | The key, possibly consisting of multiple key segments separated by unescaped dots |
Definition at line 728 of file TypoScriptParser.php.
Referenced by TypoScriptParser\getVal(), TypoScriptParser\rollParseSub(), and TypoScriptParser\setVal().
parseSub | ( | array & | $setup | ) |
Parsing the $this->raw TypoScript lines from pointer, $this->rawP
array | $setup | Reference to the setup array in which to accumulate the values. |
Definition at line 307 of file TypoScriptParser.php.
References TypoScriptParser\$lastComment, TypoScriptParser\$multiLineObject, TypoScriptParser\$rawP, StringUtility\beginsWith(), elseif, TypoScriptParser\error(), TypoScriptParser\executeValueModifier(), TypoScriptParser\getVal(), TypoScriptParser\regHighLight(), TypoScriptParser\rollParseSub(), and TypoScriptParser\setVal().
Referenced by TypoScriptParser\parse(), and TypoScriptParser\rollParseSub().
regHighLight | ( | $code, | |
$pointer, | |||
$strlen = -1 |
|||
) |
Registers a part of a TypoScript line for syntax highlighting.
string | $code | Key from the internal array $this->highLightStyles |
int | $pointer | Pointer to the line in $this->raw which this is about |
int | $strlen | The number of chars LEFT on this line before the end is reached. |
Definition at line 1241 of file TypoScriptParser.php.
References TypoScriptParser\$inBrace.
Referenced by TypoScriptParser\parseSub().
rollParseSub | ( | $string, | |
array & | $setup | ||
) |
Parsing of TypoScript keys inside a curly brace where the key is composite of at least two keys, thus having to recursively call itself to get the value
string | $string | The object sub-path, eg "thisprop.another_prot |
array | $setup | The local setup array from the function calling this function |
Definition at line 612 of file TypoScriptParser.php.
References TypoScriptParser\parseNextKeySegment(), and TypoScriptParser\parseSub().
Referenced by TypoScriptParser\parseSub().
setVal | ( | $string, | |
array & | $setup, | ||
$value, | |||
$wipeOut = false |
|||
) |
Setting a value/property of an object string in the setup array.
string | $string | The object sub-path, eg "thisprop.another_prot |
array | $setup | The local setup array from the function calling this function. |
array | string | $value | The value/property pair array to set. If only one of them is set, then the other is not touched (unless $wipeOut is set, which it is when copies are made which must include both value and property) |
bool | $wipeOut | If set, then both value and property is wiped out when a copy is made of another value. |
Definition at line 671 of file TypoScriptParser.php.
References TypoScriptParser\$lastComment, and TypoScriptParser\parseNextKeySegment().
Referenced by TypoScriptParser\parseSub().
syntaxHighlight_print | ( | $lineNumDat, | |
$highlightBlockMode | |||
) |
Formatting the TypoScript code in $this->raw based on the data collected by $this->regHighLight in $this->highLightData
mixed | $lineNumDat | If blank, linenumbers are NOT printed. If array then the first key is the linenumber offset to add to the internal counter. |
bool | $highlightBlockMode | If set, then the highlighted output will be formatted in blocks based on the brace levels. prespace will be ignored and empty lines represented with a single no-break-space. |
Definition at line 1260 of file TypoScriptParser.php.
References TypoScriptParser\$rawP, debug(), elseif, and TypoScriptParser\modifyHTMLColorAll().
Referenced by TypoScriptParser\doSyntaxHighlight().
|
staticprotected |
Process errors in INCLUDE_TYPOSCRIPT tags Errors are logged in sysLog and printed in the concatenated Typoscript result (as can be seen in Template Analyzer)
string | $error | Text of the error message |
Definition at line 1017 of file TypoScriptParser.php.
References GeneralUtility\SYSLOG_SEVERITY_WARNING.
$breakPointLN = 0 |
Definition at line 176 of file TypoScriptParser.php.
$commentSet = false |
Definition at line 70 of file TypoScriptParser.php.
$errors = array() |
Definition at line 162 of file TypoScriptParser.php.
$highLightBlockStyles = '' |
Definition at line 216 of file TypoScriptParser.php.
$highLightBlockStyles_basecolor = '#cccccc' |
Definition at line 223 of file TypoScriptParser.php.
$highLightData = array() |
Definition at line 134 of file TypoScriptParser.php.
$highLightData_bracelevel = array() |
Definition at line 141 of file TypoScriptParser.php.
$highLightStyles |
Definition at line 181 of file TypoScriptParser.php.
$inBrace = 0 |
Definition at line 98 of file TypoScriptParser.php.
Referenced by TypoScriptParser\regHighLight().
$lastComment = '' |
Definition at line 63 of file TypoScriptParser.php.
Referenced by TypoScriptParser\parseSub(), and TypoScriptParser\setVal().
$lastConditionTrue = true |
Definition at line 106 of file TypoScriptParser.php.
$lineNumberOffset = 0 |
Definition at line 169 of file TypoScriptParser.php.
$multiLineEnabled = false |
Definition at line 77 of file TypoScriptParser.php.
$multiLineObject = '' |
Definition at line 84 of file TypoScriptParser.php.
Referenced by TypoScriptParser\parseSub().
$multiLineValue = array() |
Definition at line 91 of file TypoScriptParser.php.
$parentObject |
Definition at line 228 of file TypoScriptParser.php.
$raw |
Definition at line 49 of file TypoScriptParser.php.
$rawP |
Definition at line 56 of file TypoScriptParser.php.
Referenced by TypoScriptParser\parseSub(), and TypoScriptParser\syntaxHighlight_print().
$regComments = false |
Definition at line 148 of file TypoScriptParser.php.
$regLinenumbers = false |
Definition at line 155 of file TypoScriptParser.php.
$sections = array() |
Definition at line 113 of file TypoScriptParser.php.
$sectionsMatch = array() |
Definition at line 120 of file TypoScriptParser.php.
$setup = array() |
Definition at line 42 of file TypoScriptParser.php.
Referenced by TypoScriptParser\getVal().
$strict = true |
Definition at line 35 of file TypoScriptParser.php.
$syntaxHighLight = false |
Definition at line 127 of file TypoScriptParser.php.
Referenced by TypoScriptParser\parse().