Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
GenericSequencerFilter.inc.php
1 <?php
18 import('lib.pkp.classes.filter.CompositeFilter');
19 
24  function GenericSequencerFilter(&$filterGroup, $displayName = null) {
25  parent::CompositeFilter($filterGroup, $displayName);
26  }
27 
28 
29  //
30  // Implementing abstract template methods from PersistableFilter
31  //
35  function getClassName() {
36  return 'lib.pkp.classes.filter.GenericSequencerFilter';
37  }
38 
39 
40  //
41  // Implementing abstract template methods from Filter
42  //
48  function &process(&$input) {
49  // Iterate over all filters and always feed the
50  // output of one filter as input to the next
51  // filter.
52  $previousOutput = null;
53  foreach($this->getFilters() as $filter) {
54  if(is_null($previousOutput)) {
55  // First filter
56  $previousOutput =& $input;
57  }
58  $output = $filter->execute($previousOutput);
59 
60  // Propagate errors of sub-filters (if any)
61  foreach($filter->getErrors() as $errorMessage) $this->addError($errorMessage);
62 
63  // If one filter returns null then we'll abort
64  // execution of the filter chain.
65  if (is_null($output)) break;
66 
67  unset($previousOutput);
68  $previousOutput = $output;
69  }
70  return $output;
71  }
72 }
73 ?>
A generic filter that is configured with a number of ordered filters. It takes the input argument of ...
An abstract base class for generic filters that compose other filters into filter networks...
addError($message)
Definition: Filter.inc.php:265
GenericSequencerFilter(&$filterGroup, $displayName=null)