From b579c0f51d5fb18b35eb083599c22fe627fe7bfa Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 8 Jan 2003 17:34:45 +0000 Subject: [PATCH] update plugins to return values instead of echo, fix config file cache to include global config variables in cache file --- Smarty.class.php | 4 +- libs/Smarty.class.php | 4 +- libs/plugins/function.counter.php | 10 ++- libs/plugins/function.cycle.php | 6 +- libs/plugins/function.debug.php | 2 +- libs/plugins/function.eval.php | 12 +-- libs/plugins/function.fetch.php | 2 +- libs/plugins/function.html_options.php | 7 +- libs/plugins/function.html_select_date.php | 2 +- libs/plugins/function.html_select_time.php | 2 +- libs/plugins/function.mailto.php | 6 +- libs/plugins/function.math.php | 2 +- libs/plugins/function.popup.php | 100 +++++++++++---------- libs/plugins/function.popup_init.php | 4 +- plugins/function.counter.php | 10 ++- plugins/function.cycle.php | 6 +- plugins/function.debug.php | 2 +- plugins/function.eval.php | 12 +-- plugins/function.fetch.php | 2 +- plugins/function.html_options.php | 7 +- plugins/function.html_select_date.php | 2 +- plugins/function.html_select_time.php | 2 +- plugins/function.mailto.php | 6 +- plugins/function.math.php | 2 +- plugins/function.popup.php | 100 +++++++++++---------- plugins/function.popup_init.php | 4 +- 26 files changed, 168 insertions(+), 150 deletions(-) diff --git a/Smarty.class.php b/Smarty.class.php index 3b3d6fe6..01e55d95 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -1260,8 +1260,8 @@ function _generate_debug_output() { $this->_conf_obj->fix_newlines = $this->config_fix_newlines; $this->_conf_obj->set_path = $_config_dir; } - if($_config_vars = $this->_conf_obj->get($file, $section)) { - + if($_config_vars = @array_merge($this->_conf_obj->get($file), + $this->_conf_obj->get($file, $section))) { if(function_exists('var_export')) { $_compile_data = ''; } else { diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 3b3d6fe6..01e55d95 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1260,8 +1260,8 @@ function _generate_debug_output() { $this->_conf_obj->fix_newlines = $this->config_fix_newlines; $this->_conf_obj->set_path = $_config_dir; } - if($_config_vars = $this->_conf_obj->get($file, $section)) { - + if($_config_vars = @array_merge($this->_conf_obj->get($file), + $this->_conf_obj->get($file, $section))) { if(function_exists('var_export')) { $_compile_data = ''; } else { diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php index 08db6a55..dc46771e 100644 --- a/libs/plugins/function.counter.php +++ b/libs/plugins/function.counter.php @@ -42,8 +42,11 @@ function smarty_function_counter($params, &$smarty) $smarty->assign($assign, $count[$name]); } - if ($printval[$name]) - echo $count[$name]; + if ($printval[$name]) { + $retval = $count[$name]; + } else { + $retval = null; + } if (isset($skip)) $skipval[$name] = $skip; @@ -59,6 +62,9 @@ function smarty_function_counter($params, &$smarty) $count[$name] -= $skipval[$name]; else $count[$name] += $skipval[$name]; + + return $retval; + } /* vim: set expandtab: */ diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php index 90dc3cfe..f4e9dc42 100644 --- a/libs/plugins/function.cycle.php +++ b/libs/plugins/function.cycle.php @@ -86,7 +86,9 @@ function smarty_function_cycle($params, &$smarty) } if($print) { - echo $cycle_array[$cycle_vars[$name]['index']]; + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; } if($advance) { @@ -96,6 +98,8 @@ function smarty_function_cycle($params, &$smarty) $cycle_vars[$name]['index']++; } } + + return $retval; } /* vim: set expandtab: */ diff --git a/libs/plugins/function.debug.php b/libs/plugins/function.debug.php index 6573d964..d059a42f 100644 --- a/libs/plugins/function.debug.php +++ b/libs/plugins/function.debug.php @@ -16,7 +16,7 @@ function smarty_function_debug($params, &$smarty) if($params['output']) { $smarty->assign('_smarty_debug_output',$params['output']); } - echo $smarty->_generate_debug_output(); + return $smarty->_generate_debug_output(); } /* vim: set expandtab: */ diff --git a/libs/plugins/function.eval.php b/libs/plugins/function.eval.php index b17338fa..662d2c78 100644 --- a/libs/plugins/function.eval.php +++ b/libs/plugins/function.eval.php @@ -22,13 +22,15 @@ function smarty_function_eval($params, &$this) $this->_compile_template("evaluated template", $var, $source); + ob_start(); + eval('?>' . $source); + $contents = ob_get_contents(); + ob_end_clean(); + if (!empty($assign)) { - ob_start(); - eval('?>' . $source); - $this->assign($assign, ob_get_contents()); - ob_end_clean(); + $this->assign($assign, $contents); } else { - eval('?>' . $source); + return $contents; } } diff --git a/libs/plugins/function.fetch.php b/libs/plugins/function.fetch.php index e5cef2ba..d1035f54 100644 --- a/libs/plugins/function.fetch.php +++ b/libs/plugins/function.fetch.php @@ -202,7 +202,7 @@ function smarty_function_fetch($params, &$smarty) if (!empty($params['assign'])) { $smarty->assign($params['assign'],$content); } else { - echo $content; + return $content; } } diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php index ed5d06f6..450524da 100644 --- a/libs/plugins/function.html_options.php +++ b/libs/plugins/function.html_options.php @@ -11,8 +11,6 @@ */ function smarty_function_html_options($params, &$smarty) { - $print_result = true; - extract($params); $html_result = ''; @@ -35,10 +33,7 @@ function smarty_function_html_options($params, &$smarty) } } - if ($print_result) - print $html_result; - else - return $html_result; + return $html_result; } function smarty_function_html_options_optoutput($key, $value, $selected) { diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php index e4dca646..c50083bd 100644 --- a/libs/plugins/function.html_select_date.php +++ b/libs/plugins/function.html_select_date.php @@ -224,7 +224,7 @@ function smarty_function_html_select_date($params, &$smarty) } } - print $html_result; + return $html_result; } /* vim: set expandtab: */ diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php index 0e82ce07..06bd7787 100644 --- a/libs/plugins/function.html_select_time.php +++ b/libs/plugins/function.html_select_time.php @@ -144,7 +144,7 @@ function smarty_function_html_select_time($params, &$smarty) $html_result .= "\n"; } - print $html_result; + return $html_result; } /* vim: set expandtab: */ diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php index 21180dbb..9091bf42 100644 --- a/libs/plugins/function.mailto.php +++ b/libs/plugins/function.mailto.php @@ -89,7 +89,7 @@ function smarty_function_mailto($params, &$smarty) $js_encode .= '%' . bin2hex($string[$x]); } - echo ''; + return ''; } elseif ($encode == 'hex') { @@ -109,11 +109,11 @@ function smarty_function_mailto($params, &$smarty) $text_encode .= '&#x' . bin2hex($text[$x]).';'; } - echo ''.$text_encode.''; + return ''.$text_encode.''; } else { // no encoding - echo ''.$text.''; + return ''.$text.''; } diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php index 3926e379..3e6d2c06 100644 --- a/libs/plugins/function.math.php +++ b/libs/plugins/function.math.php @@ -55,7 +55,7 @@ function smarty_function_math($params, &$smarty) if (empty($params['format'])) { if (empty($params['assign'])) { - echo $smarty_math_result; + return $smarty_math_result; } else { $smarty->assign($params['assign'],$smarty_math_result); } diff --git a/libs/plugins/function.popup.php b/libs/plugins/function.popup.php index be88ad9b..74804a72 100644 --- a/libs/plugins/function.popup.php +++ b/libs/plugins/function.popup.php @@ -19,55 +19,57 @@ function smarty_function_popup($params, &$smarty) if (empty($trigger)) { $trigger = "onMouseOver"; } - echo $trigger.'="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; - if ($sticky) { echo ",STICKY"; } - if (!empty($caption)) { echo ",CAPTION,'".str_replace("'","\'",$caption)."'"; } - if (!empty($fgcolor)) { echo ",FGCOLOR,'$fgcolor'"; } - if (!empty($bgcolor)) { echo ",BGCOLOR,'$bgcolor'"; } - if (!empty($textcolor)) { echo ",TEXTCOLOR,'$textcolor'"; } - if (!empty($capcolor)) { echo ",CAPCOLOR,'$capcolor'"; } - if (!empty($closecolor)) { echo ",CLOSECOLOR,'$closecolor'"; } - if (!empty($textfont)) { echo ",TEXTFONT,'$textfont'"; } - if (!empty($captionfont)) { echo ",CAPTIONFONT,'$captionfont'"; } - if (!empty($closefont)) { echo ",CLOSEFONT,'$closefont'"; } - if (!empty($textsize)) { echo ",TEXTSIZE,$textsize"; } - if (!empty($captionsize)) { echo ",CAPTIONSIZE,$captionsize"; } - if (!empty($closesize)) { echo ",CLOSESIZE,$closesize"; } - if (!empty($width)) { echo ",WIDTH,$width"; } - if (!empty($height)) { echo ",HEIGHT,$height"; } - if (!empty($left)) { echo ",LEFT"; } - if (!empty($right)) { echo ",RIGHT"; } - if (!empty($center)) { echo ",CENTER"; } - if (!empty($above)) { echo ",ABOVE"; } - if (!empty($below)) { echo ",BELOW"; } - if (isset($border)) { echo ",BORDER,$border"; } - if (isset($offsetx)) { echo ",OFFSETX,$offsetx"; } - if (isset($offsety)) { echo ",OFFSETY,$offsety"; } - if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; } - if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; } - if (!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } - if (!empty($noclose)) { echo ",NOCLOSE"; } - if (!empty($status)) { echo ",STATUS,'".str_replace("'","\'",$status)."'"; } - if (!empty($autostatus)) { echo ",AUTOSTATUS"; } - if (!empty($autostatuscap)) { echo ",AUTOSTATUSCAP"; } - if (isset($inarray)) { echo ",INARRAY,'$inarray'"; } - if (isset($caparray)) { echo ",CAPARRAY,'$caparray'"; } - if (!empty($capicon)) { echo ",CAPICON,'$capicon'"; } - if (!empty($snapx)) { echo ",SNAPX,$snapx"; } - if (!empty($snapy)) { echo ",SNAPY,$snapy"; } - if (isset($fixx)) { echo ",FIXX,$fixx"; } - if (isset($fixy)) { echo ",FIXY,$fixy"; } - if (!empty($background)) { echo ",BACKGROUND,'$background'"; } - if (!empty($padx)) { echo ",PADX,$padx"; } - if (!empty($pady)) { echo ",PADY,$pady"; } - if (!empty($fullhtml)) { echo ",FULLHTML"; } - if (!empty($frame)) { echo ",FRAME,'$frame'"; } - if (isset($timeout)) { echo ",TIMEOUT,$timeout"; } - if (!empty($function)) { echo ",FUNCTION,'$function'"; } - if (isset($delay)) { echo ",DELAY,$delay"; } - if (!empty($hauto)) { echo ",HAUTO"; } - if (!empty($vauto)) { echo ",VAUTO"; } - echo ');" onMouseOut="nd();"'; + $retval .= $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; + if ($sticky) { $retval .= ",STICKY"; } + if (!empty($caption)) { $retval .= ",CAPTION,'".str_replace("'","\'",$caption)."'"; } + if (!empty($fgcolor)) { $retval .= ",FGCOLOR,'$fgcolor'"; } + if (!empty($bgcolor)) { $retval .= ",BGCOLOR,'$bgcolor'"; } + if (!empty($textcolor)) { $retval .= ",TEXTCOLOR,'$textcolor'"; } + if (!empty($capcolor)) { $retval .= ",CAPCOLOR,'$capcolor'"; } + if (!empty($closecolor)) { $retval .= ",CLOSECOLOR,'$closecolor'"; } + if (!empty($textfont)) { $retval .= ",TEXTFONT,'$textfont'"; } + if (!empty($captionfont)) { $retval .= ",CAPTIONFONT,'$captionfont'"; } + if (!empty($closefont)) { $retval .= ",CLOSEFONT,'$closefont'"; } + if (!empty($textsize)) { $retval .= ",TEXTSIZE,$textsize"; } + if (!empty($captionsize)) { $retval .= ",CAPTIONSIZE,$captionsize"; } + if (!empty($closesize)) { $retval .= ",CLOSESIZE,$closesize"; } + if (!empty($width)) { $retval .= ",WIDTH,$width"; } + if (!empty($height)) { $retval .= ",HEIGHT,$height"; } + if (!empty($left)) { $retval .= ",LEFT"; } + if (!empty($right)) { $retval .= ",RIGHT"; } + if (!empty($center)) { $retval .= ",CENTER"; } + if (!empty($above)) { $retval .= ",ABOVE"; } + if (!empty($below)) { $retval .= ",BELOW"; } + if (isset($border)) { $retval .= ",BORDER,$border"; } + if (isset($offsetx)) { $retval .= ",OFFSETX,$offsetx"; } + if (isset($offsety)) { $retval .= ",OFFSETY,$offsety"; } + if (!empty($fgbackground)) { $retval .= ",FGBACKGROUND,'$fgbackground'"; } + if (!empty($bgbackground)) { $retval .= ",BGBACKGROUND,'$bgbackground'"; } + if (!empty($closetext)) { $retval .= ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } + if (!empty($noclose)) { $retval .= ",NOCLOSE"; } + if (!empty($status)) { $retval .= ",STATUS,'".str_replace("'","\'",$status)."'"; } + if (!empty($autostatus)) { $retval .= ",AUTOSTATUS"; } + if (!empty($autostatuscap)) { $retval .= ",AUTOSTATUSCAP"; } + if (isset($inarray)) { $retval .= ",INARRAY,'$inarray'"; } + if (isset($caparray)) { $retval .= ",CAPARRAY,'$caparray'"; } + if (!empty($capicon)) { $retval .= ",CAPICON,'$capicon'"; } + if (!empty($snapx)) { $retval .= ",SNAPX,$snapx"; } + if (!empty($snapy)) { $retval .= ",SNAPY,$snapy"; } + if (isset($fixx)) { $retval .= ",FIXX,$fixx"; } + if (isset($fixy)) { $retval .= ",FIXY,$fixy"; } + if (!empty($background)) { $retval .= ",BACKGROUND,'$background'"; } + if (!empty($padx)) { $retval .= ",PADX,$padx"; } + if (!empty($pady)) { $retval .= ",PADY,$pady"; } + if (!empty($fullhtml)) { $retval .= ",FULLHTML"; } + if (!empty($frame)) { $retval .= ",FRAME,'$frame'"; } + if (isset($timeout)) { $retval .= ",TIMEOUT,$timeout"; } + if (!empty($function)) { $retval .= ",FUNCTION,'$function'"; } + if (isset($delay)) { $retval .= ",DELAY,$delay"; } + if (!empty($hauto)) { $retval .= ",HAUTO"; } + if (!empty($vauto)) { $retval .= ",VAUTO"; } + $retval .= ');" onMouseOut="nd();"'; + + return $retval; } /* vim: set expandtab: */ diff --git a/libs/plugins/function.popup_init.php b/libs/plugins/function.popup_init.php index d23dc9ea..eca76ee8 100644 --- a/libs/plugins/function.popup_init.php +++ b/libs/plugins/function.popup_init.php @@ -17,8 +17,8 @@ function smarty_function_popup_init($params, &$smarty) } if (!empty($params['src'])) { - echo ''."\n"; - echo ''."\n"; + return '' . "\n" + . '' . "\n"; } else { $smarty->trigger_error("popup_init: missing src parameter"); } diff --git a/plugins/function.counter.php b/plugins/function.counter.php index 08db6a55..dc46771e 100644 --- a/plugins/function.counter.php +++ b/plugins/function.counter.php @@ -42,8 +42,11 @@ function smarty_function_counter($params, &$smarty) $smarty->assign($assign, $count[$name]); } - if ($printval[$name]) - echo $count[$name]; + if ($printval[$name]) { + $retval = $count[$name]; + } else { + $retval = null; + } if (isset($skip)) $skipval[$name] = $skip; @@ -59,6 +62,9 @@ function smarty_function_counter($params, &$smarty) $count[$name] -= $skipval[$name]; else $count[$name] += $skipval[$name]; + + return $retval; + } /* vim: set expandtab: */ diff --git a/plugins/function.cycle.php b/plugins/function.cycle.php index 90dc3cfe..f4e9dc42 100644 --- a/plugins/function.cycle.php +++ b/plugins/function.cycle.php @@ -86,7 +86,9 @@ function smarty_function_cycle($params, &$smarty) } if($print) { - echo $cycle_array[$cycle_vars[$name]['index']]; + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; } if($advance) { @@ -96,6 +98,8 @@ function smarty_function_cycle($params, &$smarty) $cycle_vars[$name]['index']++; } } + + return $retval; } /* vim: set expandtab: */ diff --git a/plugins/function.debug.php b/plugins/function.debug.php index 6573d964..d059a42f 100644 --- a/plugins/function.debug.php +++ b/plugins/function.debug.php @@ -16,7 +16,7 @@ function smarty_function_debug($params, &$smarty) if($params['output']) { $smarty->assign('_smarty_debug_output',$params['output']); } - echo $smarty->_generate_debug_output(); + return $smarty->_generate_debug_output(); } /* vim: set expandtab: */ diff --git a/plugins/function.eval.php b/plugins/function.eval.php index b17338fa..662d2c78 100644 --- a/plugins/function.eval.php +++ b/plugins/function.eval.php @@ -22,13 +22,15 @@ function smarty_function_eval($params, &$this) $this->_compile_template("evaluated template", $var, $source); + ob_start(); + eval('?>' . $source); + $contents = ob_get_contents(); + ob_end_clean(); + if (!empty($assign)) { - ob_start(); - eval('?>' . $source); - $this->assign($assign, ob_get_contents()); - ob_end_clean(); + $this->assign($assign, $contents); } else { - eval('?>' . $source); + return $contents; } } diff --git a/plugins/function.fetch.php b/plugins/function.fetch.php index e5cef2ba..d1035f54 100644 --- a/plugins/function.fetch.php +++ b/plugins/function.fetch.php @@ -202,7 +202,7 @@ function smarty_function_fetch($params, &$smarty) if (!empty($params['assign'])) { $smarty->assign($params['assign'],$content); } else { - echo $content; + return $content; } } diff --git a/plugins/function.html_options.php b/plugins/function.html_options.php index ed5d06f6..450524da 100644 --- a/plugins/function.html_options.php +++ b/plugins/function.html_options.php @@ -11,8 +11,6 @@ */ function smarty_function_html_options($params, &$smarty) { - $print_result = true; - extract($params); $html_result = ''; @@ -35,10 +33,7 @@ function smarty_function_html_options($params, &$smarty) } } - if ($print_result) - print $html_result; - else - return $html_result; + return $html_result; } function smarty_function_html_options_optoutput($key, $value, $selected) { diff --git a/plugins/function.html_select_date.php b/plugins/function.html_select_date.php index e4dca646..c50083bd 100644 --- a/plugins/function.html_select_date.php +++ b/plugins/function.html_select_date.php @@ -224,7 +224,7 @@ function smarty_function_html_select_date($params, &$smarty) } } - print $html_result; + return $html_result; } /* vim: set expandtab: */ diff --git a/plugins/function.html_select_time.php b/plugins/function.html_select_time.php index 0e82ce07..06bd7787 100644 --- a/plugins/function.html_select_time.php +++ b/plugins/function.html_select_time.php @@ -144,7 +144,7 @@ function smarty_function_html_select_time($params, &$smarty) $html_result .= "\n"; } - print $html_result; + return $html_result; } /* vim: set expandtab: */ diff --git a/plugins/function.mailto.php b/plugins/function.mailto.php index 21180dbb..9091bf42 100644 --- a/plugins/function.mailto.php +++ b/plugins/function.mailto.php @@ -89,7 +89,7 @@ function smarty_function_mailto($params, &$smarty) $js_encode .= '%' . bin2hex($string[$x]); } - echo ''; + return ''; } elseif ($encode == 'hex') { @@ -109,11 +109,11 @@ function smarty_function_mailto($params, &$smarty) $text_encode .= '&#x' . bin2hex($text[$x]).';'; } - echo ''.$text_encode.''; + return ''.$text_encode.''; } else { // no encoding - echo ''.$text.''; + return ''.$text.''; } diff --git a/plugins/function.math.php b/plugins/function.math.php index 3926e379..3e6d2c06 100644 --- a/plugins/function.math.php +++ b/plugins/function.math.php @@ -55,7 +55,7 @@ function smarty_function_math($params, &$smarty) if (empty($params['format'])) { if (empty($params['assign'])) { - echo $smarty_math_result; + return $smarty_math_result; } else { $smarty->assign($params['assign'],$smarty_math_result); } diff --git a/plugins/function.popup.php b/plugins/function.popup.php index be88ad9b..74804a72 100644 --- a/plugins/function.popup.php +++ b/plugins/function.popup.php @@ -19,55 +19,57 @@ function smarty_function_popup($params, &$smarty) if (empty($trigger)) { $trigger = "onMouseOver"; } - echo $trigger.'="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; - if ($sticky) { echo ",STICKY"; } - if (!empty($caption)) { echo ",CAPTION,'".str_replace("'","\'",$caption)."'"; } - if (!empty($fgcolor)) { echo ",FGCOLOR,'$fgcolor'"; } - if (!empty($bgcolor)) { echo ",BGCOLOR,'$bgcolor'"; } - if (!empty($textcolor)) { echo ",TEXTCOLOR,'$textcolor'"; } - if (!empty($capcolor)) { echo ",CAPCOLOR,'$capcolor'"; } - if (!empty($closecolor)) { echo ",CLOSECOLOR,'$closecolor'"; } - if (!empty($textfont)) { echo ",TEXTFONT,'$textfont'"; } - if (!empty($captionfont)) { echo ",CAPTIONFONT,'$captionfont'"; } - if (!empty($closefont)) { echo ",CLOSEFONT,'$closefont'"; } - if (!empty($textsize)) { echo ",TEXTSIZE,$textsize"; } - if (!empty($captionsize)) { echo ",CAPTIONSIZE,$captionsize"; } - if (!empty($closesize)) { echo ",CLOSESIZE,$closesize"; } - if (!empty($width)) { echo ",WIDTH,$width"; } - if (!empty($height)) { echo ",HEIGHT,$height"; } - if (!empty($left)) { echo ",LEFT"; } - if (!empty($right)) { echo ",RIGHT"; } - if (!empty($center)) { echo ",CENTER"; } - if (!empty($above)) { echo ",ABOVE"; } - if (!empty($below)) { echo ",BELOW"; } - if (isset($border)) { echo ",BORDER,$border"; } - if (isset($offsetx)) { echo ",OFFSETX,$offsetx"; } - if (isset($offsety)) { echo ",OFFSETY,$offsety"; } - if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; } - if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; } - if (!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } - if (!empty($noclose)) { echo ",NOCLOSE"; } - if (!empty($status)) { echo ",STATUS,'".str_replace("'","\'",$status)."'"; } - if (!empty($autostatus)) { echo ",AUTOSTATUS"; } - if (!empty($autostatuscap)) { echo ",AUTOSTATUSCAP"; } - if (isset($inarray)) { echo ",INARRAY,'$inarray'"; } - if (isset($caparray)) { echo ",CAPARRAY,'$caparray'"; } - if (!empty($capicon)) { echo ",CAPICON,'$capicon'"; } - if (!empty($snapx)) { echo ",SNAPX,$snapx"; } - if (!empty($snapy)) { echo ",SNAPY,$snapy"; } - if (isset($fixx)) { echo ",FIXX,$fixx"; } - if (isset($fixy)) { echo ",FIXY,$fixy"; } - if (!empty($background)) { echo ",BACKGROUND,'$background'"; } - if (!empty($padx)) { echo ",PADX,$padx"; } - if (!empty($pady)) { echo ",PADY,$pady"; } - if (!empty($fullhtml)) { echo ",FULLHTML"; } - if (!empty($frame)) { echo ",FRAME,'$frame'"; } - if (isset($timeout)) { echo ",TIMEOUT,$timeout"; } - if (!empty($function)) { echo ",FUNCTION,'$function'"; } - if (isset($delay)) { echo ",DELAY,$delay"; } - if (!empty($hauto)) { echo ",HAUTO"; } - if (!empty($vauto)) { echo ",VAUTO"; } - echo ');" onMouseOut="nd();"'; + $retval .= $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; + if ($sticky) { $retval .= ",STICKY"; } + if (!empty($caption)) { $retval .= ",CAPTION,'".str_replace("'","\'",$caption)."'"; } + if (!empty($fgcolor)) { $retval .= ",FGCOLOR,'$fgcolor'"; } + if (!empty($bgcolor)) { $retval .= ",BGCOLOR,'$bgcolor'"; } + if (!empty($textcolor)) { $retval .= ",TEXTCOLOR,'$textcolor'"; } + if (!empty($capcolor)) { $retval .= ",CAPCOLOR,'$capcolor'"; } + if (!empty($closecolor)) { $retval .= ",CLOSECOLOR,'$closecolor'"; } + if (!empty($textfont)) { $retval .= ",TEXTFONT,'$textfont'"; } + if (!empty($captionfont)) { $retval .= ",CAPTIONFONT,'$captionfont'"; } + if (!empty($closefont)) { $retval .= ",CLOSEFONT,'$closefont'"; } + if (!empty($textsize)) { $retval .= ",TEXTSIZE,$textsize"; } + if (!empty($captionsize)) { $retval .= ",CAPTIONSIZE,$captionsize"; } + if (!empty($closesize)) { $retval .= ",CLOSESIZE,$closesize"; } + if (!empty($width)) { $retval .= ",WIDTH,$width"; } + if (!empty($height)) { $retval .= ",HEIGHT,$height"; } + if (!empty($left)) { $retval .= ",LEFT"; } + if (!empty($right)) { $retval .= ",RIGHT"; } + if (!empty($center)) { $retval .= ",CENTER"; } + if (!empty($above)) { $retval .= ",ABOVE"; } + if (!empty($below)) { $retval .= ",BELOW"; } + if (isset($border)) { $retval .= ",BORDER,$border"; } + if (isset($offsetx)) { $retval .= ",OFFSETX,$offsetx"; } + if (isset($offsety)) { $retval .= ",OFFSETY,$offsety"; } + if (!empty($fgbackground)) { $retval .= ",FGBACKGROUND,'$fgbackground'"; } + if (!empty($bgbackground)) { $retval .= ",BGBACKGROUND,'$bgbackground'"; } + if (!empty($closetext)) { $retval .= ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } + if (!empty($noclose)) { $retval .= ",NOCLOSE"; } + if (!empty($status)) { $retval .= ",STATUS,'".str_replace("'","\'",$status)."'"; } + if (!empty($autostatus)) { $retval .= ",AUTOSTATUS"; } + if (!empty($autostatuscap)) { $retval .= ",AUTOSTATUSCAP"; } + if (isset($inarray)) { $retval .= ",INARRAY,'$inarray'"; } + if (isset($caparray)) { $retval .= ",CAPARRAY,'$caparray'"; } + if (!empty($capicon)) { $retval .= ",CAPICON,'$capicon'"; } + if (!empty($snapx)) { $retval .= ",SNAPX,$snapx"; } + if (!empty($snapy)) { $retval .= ",SNAPY,$snapy"; } + if (isset($fixx)) { $retval .= ",FIXX,$fixx"; } + if (isset($fixy)) { $retval .= ",FIXY,$fixy"; } + if (!empty($background)) { $retval .= ",BACKGROUND,'$background'"; } + if (!empty($padx)) { $retval .= ",PADX,$padx"; } + if (!empty($pady)) { $retval .= ",PADY,$pady"; } + if (!empty($fullhtml)) { $retval .= ",FULLHTML"; } + if (!empty($frame)) { $retval .= ",FRAME,'$frame'"; } + if (isset($timeout)) { $retval .= ",TIMEOUT,$timeout"; } + if (!empty($function)) { $retval .= ",FUNCTION,'$function'"; } + if (isset($delay)) { $retval .= ",DELAY,$delay"; } + if (!empty($hauto)) { $retval .= ",HAUTO"; } + if (!empty($vauto)) { $retval .= ",VAUTO"; } + $retval .= ');" onMouseOut="nd();"'; + + return $retval; } /* vim: set expandtab: */ diff --git a/plugins/function.popup_init.php b/plugins/function.popup_init.php index d23dc9ea..eca76ee8 100644 --- a/plugins/function.popup_init.php +++ b/plugins/function.popup_init.php @@ -17,8 +17,8 @@ function smarty_function_popup_init($params, &$smarty) } if (!empty($params['src'])) { - echo ''."\n"; - echo ''."\n"; + return '' . "\n" + . '' . "\n"; } else { $smarty->trigger_error("popup_init: missing src parameter"); }