From b59ab2490b1bb82dc1d0b58d89584182b405d0a0 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 19 Jun 2006 02:31:27 +0000 Subject: build script update. Fixed #82 and #165. --- .../Smarty-2.6.0/libs/plugins/function.counter.php | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.counter.php (limited to 'buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.counter.php') diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.counter.php b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.counter.php new file mode 100644 index 00000000..8d17d2bb --- /dev/null +++ b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.counter.php @@ -0,0 +1,88 @@ + + * Name: counter
+ * Purpose: print out a counter value + * @link http://smarty.php.net/manual/en/language.function.counter.php {counter} + * (Smarty online manual) + * @param array parameters + * @param Smarty + * @return string|null + */ +function smarty_function_counter($params, &$smarty) +{ + static $counters = array(); + + extract($params); + + if (!isset($name)) { + if(isset($id)) { + $name = $id; + } else { + $name = "default"; + } + } + + if (!isset($counters[$name])) { + $counters[$name] = array( + 'start'=>1, + 'skip'=>1, + 'direction'=>'up', + 'count'=>1 + ); + } + $counter =& $counters[$name]; + + if (isset($start)) { + $counter['start'] = $counter['count'] = $start; + } + + if (!empty($assign)) { + $counter['assign'] = $assign; + } + + if (isset($counter['assign'])) { + $smarty->assign($counter['assign'], $counter['count']); + } + + if (isset($print)) { + $print = (bool)$print; + } else { + $print = empty($counter['assign']); + } + + if ($print) { + $retval = $counter['count']; + } else { + $retval = null; + } + + if (isset($skip)) { + $counter['skip'] = $skip; + } + + if (isset($direction)) { + $counter['direction'] = $direction; + } + + if ($counter['direction'] == "down") + $counter['count'] -= $counter['skip']; + else + $counter['count'] += $counter['skip']; + + return $retval; + +} + +/* vim: set expandtab: */ + +?> -- cgit v1.2.3