wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
NodeProcessor Class Reference

Public Member Functions

 NodeProcessor ($callback, $params=array(), $obj=null)
 
 run (&$node, $recursive=false)
 

Public Attributes

 $_obj
 
 $_callback
 
 $_params
 

Detailed Description

NodeProcessor is used to iterate over all values of a Node and apply a given callback function.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.NodeProcessor.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 28 of file class.NodeProcessor.php.

Member Function Documentation

NodeProcessor::NodeProcessor (   $callback,
  $params = array(),
  $obj = null 
)

Constructor.

Parameters
callbackThe callback function to apply on Node values.
paramsAn array of paramters to pass to the callback (default: none).
objA reference to the object that defines the callback. If null the callback must be a global function (default: null).
Note
The callback function must have the following interface: callback(&$node, $valueName, $dataType, &$param0, &$param1, ...)

usage example:

// use NodeProcessor to iterate over all Node values
// and call the global myCallback function on each
$processor = new NodeProcessor('myCallback', array(&$result));
$processor->run($node, false);
// myCallback simply concats all node values to a result string
function myCallback(&$node, $valueName, $dataType, &$result)
{
$value = $node->getValue($valueName, $dataType);
// add the value to the result
$result .= ' '.$value;
}

Definition at line 60 of file class.NodeProcessor.php.

NodeProcessor::run ( $node,
  $recursive = false 
)

Run the processor.

Parameters
nodeThe Node to start from.
recursiveTrue/False wether to process child Nodes or not (default: false).

Definition at line 71 of file class.NodeProcessor.php.

References $_params.

Member Data Documentation

NodeProcessor::$_obj

Definition at line 30 of file class.NodeProcessor.php.

NodeProcessor::$_callback

Definition at line 31 of file class.NodeProcessor.php.

NodeProcessor::$_params

Definition at line 32 of file class.NodeProcessor.php.

Referenced by run().


The documentation for this class was generated from the following file: