Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eztemplatenl2broperator.php
Go to the documentation of this file.
1 <?php
20 class eZTemplateNl2BrOperator
21 {
22 public $Nl2brName;
26 public function __construct()
27 {
28 $this->Operators = array( 'nl2br' );
29 $this->Nl2brName = 'nl2br';
30 }
31
35 function operatorList()
36 {
37 return $this->Operators;
38 }
39
43 function namedParameterList()
44 {
45 return array( );
46 }
47
48 function operatorTemplateHints()
49 {
50 return array( $this->Nl2brName => array( 'input' => true,
51 'output' => true,
52 'parameters' => true,
53 'element-transformation' => true,
54 'transform-parameters' => true,
55 'input-as-parameter' => true,
56 'element-transformation-func' => 'nl2brTransformation') );
57 }
58
59 function nl2brTransformation( $operatorName, &$node, $tpl, &$resourceData,
60 $element, $lastElement, $elementList, $elementTree, &$parameters )
61 {
62 $values = array();
63 $function = $operatorName;
64
65 if ( ( count( $parameters ) != 1) )
66 {
67 return false;
68 }
69 $newElements = array();
70
71 $values[] = $parameters[0];
72 $code = "%output% = nl2br( %1% );\n";
73
74 $newElements[] = eZTemplateNodeTool::createCodePieceElement( $code, $values );
75 return $newElements;
76 }
77
81 function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
82 {
83 $operatorValue = str_replace( "\n",
84 "<br />",
85 $operatorValue );
86 }
87
89 public $Operators;
90 }
91
92 ?>
eZTemplateNl2BrOperator
Definition: eztemplatenl2broperator.php:21
eZTemplateNl2BrOperator\operatorTemplateHints
operatorTemplateHints()
Definition: eztemplatenl2broperator.php:48
eZTemplateNl2BrOperator\__construct
__construct()
Definition: eztemplatenl2broperator.php:26
eZTemplateNl2BrOperator\namedParameterList
namedParameterList()
Definition: eztemplatenl2broperator.php:43
eZTemplateNl2BrOperator\modify
modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
Definition: eztemplatenl2broperator.php:81
eZTemplateNl2BrOperator\nl2brTransformation
nl2brTransformation( $operatorName, &$node, $tpl, &$resourceData, $element, $lastElement, $elementList, $elementTree, &$parameters)
Definition: eztemplatenl2broperator.php:59
eZTemplateNl2BrOperator\operatorList
operatorList()
Definition: eztemplatenl2broperator.php:35
eZTemplateNl2BrOperator\$Operators
$Operators
The array of operators, used for registering operators.
Definition: eztemplatenl2broperator.php:89
eZTemplateNl2BrOperator\$Nl2brName
$Nl2brName
Definition: eztemplatenl2broperator.php:22
eZTemplateNodeTool\createCodePieceElement
static createCodePieceElement( $codePiece, $values=false, $placement=false, $tmpValues=false, $knownTypes=true)
Definition: eztemplatenodetool.php:437
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.