1<?php 2/** 3 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 4 * @author Brend Wanders <b.wanders@utwente.nl> 5 */ 6// must be run within Dokuwiki 7if(!defined('DOKU_INC')) die('Meh.'); 8 9/** 10 * The minimum aggregator. 11 */ 12class plugin_strata_aggregate_min extends plugin_strata_aggregate { 13 function aggregate($values, $hint = null) { 14 if($hint == 'strict') $values = array_filter($values, 'is_numeric'); 15 if(empty($values)) return array(); 16 return array(min($values)); 17 } 18 19 function getInfo() { 20 return array( 21 'desc'=>'Returns the minimum value. Any item that does not have a clear numeric value (i.e. starts with a number) is counted as 0. If the \'strict\' hint is used, values that are not strictly numeric (i.e. contains only a number) are ignored.', 22 'hint'=>'\'strict\' to ignore non-numeric values', 23 'tags'=>array('numeric') 24 ); 25 } 26} 27