Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezkerneloperator.php
Go to the documentation of this file.
1 <?php
16 class eZKernelOperator
17 {
23 public function __construct( $name = "ezpreference" )
24 {
25 $this->Operators = array( $name );
26 }
27
31 function operatorList()
32 {
33 return $this->Operators;
34 }
35
39 function namedParameterPerOperator()
40 {
41 return true;
42 }
43
47 function namedParameterList()
48 {
49 return array( 'ezpreference' => array( 'name' => array( 'type' => 'string',
50 'required' => true,
51 'default' => false ) ) );
52 }
53
54 function operatorTemplateHints()
55 {
56 return array( 'ezpreference' => array( 'input' => false,
57 'output' => true,
58 'parameters' => 1,
59 'element-transformation' => true,
60 'transform-parameters' => true,
61 'input-as-parameter' => false,
62 'element-transformation-func' => 'preferencesTransformation') );
63 }
64
65 function preferencesTransformation( $operatorName, &$node, $tpl, &$resourceData,
66 $element, $lastElement, $elementList, $elementTree, &$parameters )
67 {
68 if ( count( $parameters[0] ) == 0 )
69 return false;
70 $values = array();
71 if ( eZTemplateNodeTool::isConstantElement( $parameters[0] ) )
72 {
73 $name = eZTemplateNodeTool::elementConstantValue( $parameters[0] );
74 $nameText = eZPHPCreator::variableText( $name, 0, 0, false );
75 }
76 else
77 {
78 $nameText = '%1%';
79 $values[] = $parameters[0];
80 }
81 return array( eZTemplateNodeTool::createCodePieceElement( "%output% = eZPreferences::value( $nameText );\n",
82 $values ) );
83 }
84
85 function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
86 {
87 switch ( $operatorName )
88 {
89 case 'ezpreference':
90 {
91 $name = $namedParameters['name'];
92 $value = eZPreferences::value( $name );
93 $operatorValue = $value;
94 }break;
95
96 default:
97 {
98 eZDebug::writeError( "Unknown kernel operator: $operatorName" );
99 }break;
100 }
101 }
102 public $Operators;
103 }
104 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZKernelOperator
Definition: ezkerneloperator.php:17
eZKernelOperator\operatorList
operatorList()
Definition: ezkerneloperator.php:31
eZKernelOperator\modify
modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
Definition: ezkerneloperator.php:85
eZKernelOperator\operatorTemplateHints
operatorTemplateHints()
Definition: ezkerneloperator.php:54
eZKernelOperator\__construct
__construct( $name="ezpreference")
Definition: ezkerneloperator.php:23
eZKernelOperator\namedParameterPerOperator
namedParameterPerOperator()
Definition: ezkerneloperator.php:39
eZKernelOperator\preferencesTransformation
preferencesTransformation( $operatorName, &$node, $tpl, &$resourceData, $element, $lastElement, $elementList, $elementTree, &$parameters)
Definition: ezkerneloperator.php:65
eZKernelOperator\namedParameterList
namedParameterList()
Definition: ezkerneloperator.php:47
eZKernelOperator\$Operators
$Operators
Definition: ezkerneloperator.php:102
eZPreferences\value
static value( $name, $user=false)
Definition: ezpreferences.php:106
eZTemplateNodeTool\elementConstantValue
static elementConstantValue( $elements)
Definition: eztemplatenodetool.php:197
eZTemplateNodeTool\createCodePieceElement
static createCodePieceElement( $codePiece, $values=false, $placement=false, $tmpValues=false, $knownTypes=true)
Definition: eztemplatenodetool.php:437
eZTemplateNodeTool\isConstantElement
static isConstantElement( $elements)
Definition: eztemplatenodetool.php:233
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.