Exemple #1
0
 function processOperator($operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$valueData, $placement = false, $checkExistance = false)
 {
     $namedParameters = array();
     $operatorParameterDefinition = $this->operatorParameterList($operatorName);
     $i = 0;
     foreach ($operatorParameterDefinition as $parameterName => $parameterType) {
         if (!isset($operatorParameters[$i]) or !isset($operatorParameters[$i][0]) or $operatorParameters[$i][0] == eZTemplate::TYPE_VOID) {
             if ($parameterType["required"]) {
                 if (!$checkExistance) {
                     $this->warning("eZTemplateOperatorElement", "Parameter '{$parameterName}' ({$i}) missing", $placement);
                 }
                 $namedParameters[$parameterName] = $parameterType["default"];
             } else {
                 $namedParameters[$parameterName] = $parameterType["default"];
             }
         } else {
             $parameterData = $operatorParameters[$i];
             $namedParameters[$parameterName] = $this->elementValue($parameterData, $rootNamespace, $currentNamespace, false, $checkExistance);
         }
         ++$i;
     }
     if (isset($this->Operators[$operatorName])) {
         if (is_array($this->Operators[$operatorName])) {
             $this->loadAndRegisterOperators($this->Operators[$operatorName]);
         }
         $op = $this->Operators[$operatorName];
         if (is_object($op) and method_exists($op, 'modify')) {
             $value = $valueData['value'];
             if (eZTemplate::isMethodDebugEnabled()) {
                 eZDebug::writeDebug("START OPERATOR: {$operatorName}");
             }
             $op->modify($this, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, $value, $namedParameters, $placement);
             if (eZTemplate::isMethodDebugEnabled()) {
                 eZDebug::writeDebug("END OPERATOR: {$operatorName}");
             }
             $valueData['value'] = $value;
         } else {
             $this->error('', "Object problem with operator '{$operatorName}' ", $placement);
         }
     } else {
         if (!$checkExistance) {
             $this->warning("", "Operator '{$operatorName}' is not registered", $placement);
         }
     }
 }