core/model/modx/modparser095.class.php
- Package
- modx
\modParser095
An extension of the MODX parser to support legacy MODX tags.
Use of this class is only necessary if you have a site that contains legacy MODX tags. It provides facilities for translating the legacy tags, as well as for supporting legacy behavior of the onParseDocument event used in many legacy MODX plugins.
- Parent(s)
- \modParser
Properties

bool
$_processingTag= 'false'
falseDetails- Type
- bool
- Inherited_from
- \modParser::$$_processingTag

bool
$_processingUncacheable= 'false'
If the parser is currently processing an uncacheable tag
Inherited from: \modParser::$$_processingUncacheablefalseDetails- Type
- bool
- Inherited_from
- \modParser::$$_processingUncacheable

bool
$_removingUnprocessed= 'false'
If the parser is currently removing all unprocessed tags
Inherited from: \modParser::$$_removingUnprocessedfalseDetails- Type
- bool
- Inherited_from
- \modParser::$$_removingUnprocessed

array
$tagTranslation= 'array (
'[[++' => array ('[(', ')]', '++'),
'[[$' => array ('{{', '}}', '$'),
'[[*' => array ('[*', '*]', '*'),
'[[~' => array ('[~', '~]', '~'),
'[[+' => array ('[+', '+]', '+'),
'[[!' => array ('[!', '!]', '!'),
)'
An array of translation strings from migrating from Evolution
array (
'[[++' => array ('[(', ')]', '++'),
'[[$' => array ('{{', '}}', '$'),
'[[*' => array ('[*', '*]', '*'),
'[[~' => array ('[~', '~]', '~'),
'[[+' => array ('[+', '+]', '+'),
'[[!' => array ('[!', '!]', '!'),
)Details- Type
- array
Methods

_XType(
string $type
)
:
string
| Name | Type | Description |
|---|---|---|
| $type | string | A property type string. |
| Type | Description |
|---|---|
| string | A valid xtype. |
- Access
- protected

__construct(
\xPDO $modx
)
:
void| Name | Type | Description |
|---|---|---|
| $modx | \xPDO | A reference to the modX|xPDO instance |

collectElementTags(
string $origContent, array $matches, string $prefix
=
'[[', string $suffix
=
']]'
)
:
integerCollects element tags in a string and injects them into an array.
Inherited from: \modParser::collectElementTags()| Name | Type | Description |
|---|---|---|
| $origContent | string | The content to collect tags from. |
| $matches | array | &$matches An array in which the collected tags will be stored (by reference) |
| $prefix | string | The characters that define the start of a tag (default= "[["). |
| $suffix | string | The characters that define the end of a tag (default= "]]"). |
| Type | Description |
|---|---|
| integer | The number of tags collected from the content. |

getElement(
string $class, string $name
)
:
\modElement | nullGet a modElement instance taking advantage of the modX::$sourceCache.
Inherited from: \modParser::getElement()| Name | Type | Description |
|---|---|---|
| $class | string | The modElement derivative class to load. |
| $name | string | An element name or raw tagName to identify the modElement instance. |
| Type | Description |
|---|---|
| \modElement | null | An instance of the specified modElement derivative class. |

isProcessingTag(
)
:
boolReturns true if the parser is currently processing a tag
Inherited from: \modParser::isProcessingTag()| Type | Description |
|---|---|
| bool |

isProcessingUncacheable(
)
:
boolReturns true if the parser is currently processing an uncacheable tag
Inherited from: \modParser::isProcessingUncacheable()| Type | Description |
|---|---|
| bool |

isRemovingUnprocessed(
)
:
boolReturns true if the parser is currently removing any unprocessed tags
Inherited from: \modParser::isRemovingUnprocessed()| Type | Description |
|---|---|
| bool |

loadFromCache(
string $tag
)
:
stringLoads output cached by complete tag signature from the elementCache.
Inherited from: \modParser::loadFromCache()| Name | Type | Description |
|---|---|---|
| $tag | string | The tag signature representing the element instance. |
| Type | Description |
|---|---|
| string | The cached output from the element instance. |

mergeTagOutput(
array $tagMap, string $content
)
:
voidMerges processed tag output into provided content string.
Inherited from: \modParser::mergeTagOutput()| Name | Type | Description |
|---|---|---|
| $tagMap | array | An array with full tags as keys and processed output as the values. |
| $content | string | The content to merge the tag output with (passed by reference). |

parseProperties(
string $propSource
)
:
arrayParses an element/tag property string or array definition.
Inherited from: \modParser::parseProperties()| Name | Type | Description |
|---|---|---|
| $propSource | string | A valid property string or array source to parse. |
| Type | Description |
|---|---|
| array | An associative array of property values parsed from the property string or array definition. |

parsePropertyString(
string $string, boolean $valuesOnly
=
false
)
:
arrayParses an element/tag property string and returns an array of properties.
Inherited from: \modParser::parsePropertyString()| Name | Type | Description |
|---|---|---|
| $string | string | The property string to parse. |
| $valuesOnly | boolean | Indicates only the property value should be returned. |
| Type | Description |
|---|---|
| array | The processed properties in array format |

processElementTags(
string $parentTag, $content, bool $processUncacheable
=
false, bool $removeUnprocessed
=
false, string $prefix
=
"[[", string $suffix
=
"]]", array $tokens
=
array (), bool $echo
=
false
)
:
stringAdds the legacy tag translation and legacy OnParseDocument event support.
| Name | Type | Description |
|---|---|---|
| $parentTag | string | |
| $content | ||
| $processUncacheable | bool | |
| $removeUnprocessed | bool | |
| $prefix | string | |
| $suffix | string | |
| $tokens | array | |
| $echo | bool |
| Type | Description |
|---|---|
| string |

processTag(
string $tag, boolean $processUncacheable
=
true
)
:
mixedProcesses a modElement tag and returns the result.
Inherited from: \modParser::processTag()| Name | Type | Description |
|---|---|---|
| $tag | string | A full tag string parsed from content. |
| $processUncacheable | boolean |
| Type | Description |
|---|---|
| mixed | The output of the processed element represented by the specified tag. |

realname(
string $unfiltered
)
:
stringGets the real name of an element containing filter modifiers.
Inherited from: \modParser::realname()| Name | Type | Description |
|---|---|---|
| $unfiltered | string | The unfiltered name of a {@link modElement}. |
| Type | Description |
|---|---|
| string | The name minus any filter modifiers. |

translate(
string $content, array $tokens
=
array (), boolean $echo
=
false
)
:
voidCollects MODX legacy tags and translates them to the new tag format.
| Name | Type | Description |
|---|---|---|
| $content | string | &$content The content in which legacy tags are to be replaced. |
| $tokens | array | An optional array of tag tokens on which to exclude translation of the tags. |
| $echo | boolean |