Source code for file /pattemplate/patTemplate/InputFilter/ShortModifiers.php
Documentation is available at ShortModifiers.php
* patTemplate input filter to allow the short modifier syntax
* $Id: ShortModifiers.php 47 2005-09-15 02:55:27Z rhuk $
// Check to ensure this file is within the rest of the framework
* patTemplate input filter to allow the short modifier syntax
* $Id: ShortModifiers.php 47 2005-09-15 02:55:27Z rhuk $
* This will replace the variables with patTemplate:var/> tags that
* have the name and the modifier attribute set.
var $_name =
'ShortModifiers';
* parameters of the filter
* reference to the patTemplate object
* @var object patTemplate
* set the template reference
* @param object patTemplate
* generate the <patTemplate:var/> tag
* @param array matches from preg_replace
if ($this->getParam('copyVars') ===
true) {
$newName =
$matches[2] .
'_' .
$matches[3];
if (isset
( $matches[4] )) {
$replace =
$matches[1] .
'<' .
$this->_ns .
':var copyFrom="' .
$matches[2] .
'" name="' .
$newName .
'" modifier="' .
$matches[3] .
'"';
$replace =
$matches[1] .
'<' .
$this->_ns .
':var name="' .
$matches[2] .
'" modifier="' .
$matches[3] .
'"';
$n =
count($matches) -
1;
for ($i =
4; $i <
$n; $i++
) {
$replace .=
' ' .
$matches[++
$i] .
'="' .
$matches[++
$i] .
'"';
* @return string data with variables replaced
$regex =
chr( 1 ) .
"([^\\\])" .
$startTag .
"([^a-z]+)\|(.+[^\\\])(\|(.+):(.+[^\\\]))*" .
$endTag .
chr( 1 ) .
"U";