From fac8fb59fcabfe11e2dd38f6dad97dc3eebc99cc Mon Sep 17 00:00:00 2001 From: cellog Date: Sun, 20 Apr 2003 21:18:26 +0000 Subject: [PATCH] *** empty log message *** --- libs/plugins/function.assign_debug_info.php | 21 ++- libs/plugins/function.config_load.php | 26 +++- libs/plugins/function.counter.php | 22 ++- libs/plugins/function.cycle.php | 152 +++++++++++--------- 4 files changed, 132 insertions(+), 89 deletions(-) diff --git a/libs/plugins/function.assign_debug_info.php b/libs/plugins/function.assign_debug_info.php index 8bc9a897..c281ce87 100644 --- a/libs/plugins/function.assign_debug_info.php +++ b/libs/plugins/function.assign_debug_info.php @@ -1,12 +1,19 @@ + * Name: assign_debug_info
+ * Purpose: assign debug info to the template
+ * @param array unused in this plugin, this plugin uses {@link Smarty::$_config}, + * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info} + * @param Smarty */ function smarty_function_assign_debug_info($params, &$smarty) { diff --git a/libs/plugins/function.config_load.php b/libs/plugins/function.config_load.php index d978529a..3e3a5f5b 100644 --- a/libs/plugins/function.config_load.php +++ b/libs/plugins/function.config_load.php @@ -1,12 +1,26 @@ + * Name: config_load
* Purpose: load config file vars - * ------------------------------------------------------------- + * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load} + * (Smarty online manual) + * @param array Format: + *
+ * array('file' => required config file name,
+ *       'section' => optional config file section to load
+ *       'scope' => local/parent/global
+ *       'global' => overrides scope, setting to parent if true)
+ * 
+ * @param Smarty */ function smarty_function_config_load($params, &$smarty) { diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php index dc46771e..939cda9d 100644 --- a/libs/plugins/function.counter.php +++ b/libs/plugins/function.counter.php @@ -1,12 +1,22 @@ + * 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) { diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php index f4e9dc42..d5909a61 100644 --- a/libs/plugins/function.cycle.php +++ b/libs/plugins/function.cycle.php @@ -1,38 +1,50 @@ - * Credits: Mark Priatel - * Gerard - * Jason Sweat - * Purpose: cycle through given values - * Input: name = name of cycle (optional) - * values = comma separated list of values to cycle, + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {cycle} function plugin + * + * Type: function
+ * Name: cycle
+ * Date: May 3, 2002
+ * Purpose: cycle through given values
+ * Input: + * - name = name of cycle (optional) + * - values = comma separated list of values to cycle, * or an array of values to cycle * (this can be left out for subsequent calls) - * - * reset = boolean - resets given var to true - * print = boolean - print var or not. default is true - * advance = boolean - whether or not to advance the cycle - * delimiter = the value delimiter, default is "," - * assign = boolean, assigns to template var instead of + * - reset = boolean - resets given var to true + * - print = boolean - print var or not. default is true + * - advance = boolean - whether or not to advance the cycle + * - delimiter = the value delimiter, default is "," + * - assign = boolean, assigns to template var instead of * printed. * - * Examples: {cycle values="#eeeeee,#d0d0d0d"} - * {cycle name=row values="one,two,three" reset=true} - * {cycle name=row} - * ------------------------------------------------------------- + * Examples:
+ *
+ * {cycle values="#eeeeee,#d0d0d0d"}
+ * {cycle name=row values="one,two,three" reset=true}
+ * {cycle name=row}
+ * 
+ * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle} + * (Smarty online manual) + * @author Monte Ohrt + * @author credit to Mark Priatel + * @author credit to Gerard + * @author credit to Jason Sweat + * @version 1.3 + * @param array + * @param Smarty + * @return string|null */ function smarty_function_cycle($params, &$smarty) { - static $cycle_vars; - + static $cycle_vars; + extract($params); if (empty($name)) { @@ -44,62 +56,62 @@ function smarty_function_cycle($params, &$smarty) } if (!isset($advance)) { - $advance = true; - } + $advance = true; + } if (!isset($reset)) { - $reset = false; - } - + $reset = false; + } + if (!in_array('values', array_keys($params))) { - if(!isset($cycle_vars[$name]['values'])) { - $smarty->trigger_error("cycle: missing 'values' parameter"); - return; - } + if(!isset($cycle_vars[$name]['values'])) { + $smarty->trigger_error("cycle: missing 'values' parameter"); + return; + } } else { - if(isset($cycle_vars[$name]['values']) - && $cycle_vars[$name]['values'] != $values ) { - $cycle_vars[$name]['index'] = 0; - } - $cycle_vars[$name]['values'] = $values; - } + if(isset($cycle_vars[$name]['values']) + && $cycle_vars[$name]['values'] != $values ) { + $cycle_vars[$name]['index'] = 0; + } + $cycle_vars[$name]['values'] = $values; + } if (isset($delimiter)) { - $cycle_vars[$name]['delimiter'] = $delimiter; + $cycle_vars[$name]['delimiter'] = $delimiter; } elseif (!isset($cycle_vars[$name]['delimiter'])) { - $cycle_vars[$name]['delimiter'] = ','; - } - - if(!is_array($cycle_vars[$name]['values'])) { - $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); - } else { - $cycle_array = $cycle_vars[$name]['values']; - } - - if(!isset($cycle_vars[$name]['index']) || $reset ) { - $cycle_vars[$name]['index'] = 0; - } - + $cycle_vars[$name]['delimiter'] = ','; + } + + if(!is_array($cycle_vars[$name]['values'])) { + $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); + } else { + $cycle_array = $cycle_vars[$name]['values']; + } + + if(!isset($cycle_vars[$name]['index']) || $reset ) { + $cycle_vars[$name]['index'] = 0; + } + if (isset($assign)) { $print = false; $smarty->assign($assign, $cycle_array[$cycle_vars[$name]['index']]); } - - if($print) { - $retval = $cycle_array[$cycle_vars[$name]['index']]; - } else { - $retval = null; - } + + if($print) { + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; + } - if($advance) { - if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { - $cycle_vars[$name]['index'] = 0; - } else { - $cycle_vars[$name]['index']++; - } - } - - return $retval; + if($advance) { + if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { + $cycle_vars[$name]['index'] = 0; + } else { + $cycle_vars[$name]['index']++; + } + } + + return $retval; } /* vim: set expandtab: */