Changeset 449 for trunk/patTemplate/InputFilter
- Timestamp:
- 12/12/06 22:00:38 (2 years ago)
- Files:
-
- trunk/patTemplate/InputFilter/ShortModifiers.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/patTemplate/InputFilter/ShortModifiers.php
r409 r449 43 43 'copyVars' => true 44 44 ); 45 45 46 46 /** 47 47 * namespace … … 51 51 */ 52 52 var $_ns = null; 53 53 54 54 /** 55 55 * reference to the patTemplate object … … 70 70 $this->_tmpl = &$tmpl; 71 71 } 72 72 73 73 /** 74 74 * generate the <patTemplate:var/> tag … … 80 80 function _generateReplace($matches) 81 81 { 82 if ($this->getParam('copyVars') === true) { 83 $newName = $matches[2] . '_' . $matches[3]; 84 $replace = $matches[1] . '<' . $this->_ns . ':var copyFrom="' . $matches[2] . '" name="' . $newName . '" modifier="' . $matches[3] . '"'; 85 } else { 82 if ($this->getParam('copyVars') === true) { 83 $newName = $matches[2] . '_' . $matches[3]; 84 if (isset( $matches[4] )) { 85 $newName .= $matches[4]; 86 } 87 $replace = $matches[1] . '<' . $this->_ns . ':var copyFrom="' . $matches[2] . '" name="' . $newName . '" modifier="' . $matches[3] . '"'; 88 } else { 86 89 $replace = $matches[1] . '<' . $this->_ns . ':var name="' . $matches[2] . '" modifier="' . $matches[3] . '"'; 87 }88 89 for ($i = 4; $i < count($matches) - 1; $i++ ) {90 $replace .= ' ' . $matches[++$i] . '="' . $matches[++$i] . '"';91 }92 $replace .= '/>';93 return $replace;90 } 91 $n = count($matches) - 1; 92 for ($i = 4; $i < $n; $i++ ) { 93 $replace .= ' ' . $matches[++$i] . '="' . $matches[++$i] . '"'; 94 } 95 $replace .= '/>'; 96 return $replace; 94 97 } 95 98 … … 110 113 $this->_ns = array_shift($this->_ns); 111 114 } 112 $regex = "°([^\\\])" . $startTag . "([^a-z]+)\|(.+[^\\\])(\|(.+):(.+[^\\\]))*" . $endTag . "°U";115 $regex = chr( 1 ) . "([^\\\])" . $startTag . "([^a-z]+)\|(.+[^\\\])(\|(.+):(.+[^\\\]))*" . $endTag . chr( 1 ) . "U"; 113 116 $data = preg_replace_callback($regex, array( $this, '_generateReplace' ), $data); 114 117 return $data;
