51ff3226 |
1 | <?php |
2 | /** |
3 | * Smarty plugin |
4 | * @package Smarty |
5 | * @subpackage plugins |
6 | */ |
7 | |
8 | |
9 | /** |
10 | * Smarty {popup} function plugin |
11 | * |
12 | * Type: function<br> |
13 | * Name: popup<br> |
14 | * Purpose: make text pop up in windows via overlib |
15 | * @link http://smarty.php.net/manual/en/language.function.popup.php {popup} |
16 | * (Smarty online manual) |
17 | * @param array |
18 | * @param Smarty |
19 | * @return string |
20 | */ |
21 | function smarty_function_popup($params, &$smarty) |
22 | { |
23 | extract($params); |
24 | |
25 | if (empty($text) && !isset($inarray) && empty($function)) { |
26 | $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required"); |
27 | return false; |
28 | } |
29 | |
30 | if (empty($trigger)) { $trigger = "onmouseover"; } |
31 | |
32 | $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; |
33 | if ($sticky) { $retval .= ",STICKY"; } |
34 | if (!empty($caption)) { $retval .= ",CAPTION,'".str_replace("'","\'",$caption)."'"; } |
35 | if (!empty($fgcolor)) { $retval .= ",FGCOLOR,'$fgcolor'"; } |
36 | if (!empty($bgcolor)) { $retval .= ",BGCOLOR,'$bgcolor'"; } |
37 | if (!empty($textcolor)) { $retval .= ",TEXTCOLOR,'$textcolor'"; } |
38 | if (!empty($capcolor)) { $retval .= ",CAPCOLOR,'$capcolor'"; } |
39 | if (!empty($closecolor)) { $retval .= ",CLOSECOLOR,'$closecolor'"; } |
40 | if (!empty($textfont)) { $retval .= ",TEXTFONT,'$textfont'"; } |
41 | if (!empty($captionfont)) { $retval .= ",CAPTIONFONT,'$captionfont'"; } |
42 | if (!empty($closefont)) { $retval .= ",CLOSEFONT,'$closefont'"; } |
43 | if (!empty($textsize)) { $retval .= ",TEXTSIZE,$textsize"; } |
44 | if (!empty($captionsize)) { $retval .= ",CAPTIONSIZE,$captionsize"; } |
45 | if (!empty($closesize)) { $retval .= ",CLOSESIZE,$closesize"; } |
46 | if (!empty($width)) { $retval .= ",WIDTH,$width"; } |
47 | if (!empty($height)) { $retval .= ",HEIGHT,$height"; } |
48 | if (!empty($left)) { $retval .= ",LEFT"; } |
49 | if (!empty($right)) { $retval .= ",RIGHT"; } |
50 | if (!empty($center)) { $retval .= ",CENTER"; } |
51 | if (!empty($above)) { $retval .= ",ABOVE"; } |
52 | if (!empty($below)) { $retval .= ",BELOW"; } |
53 | if (isset($border)) { $retval .= ",BORDER,$border"; } |
54 | if (isset($offsetx)) { $retval .= ",OFFSETX,$offsetx"; } |
55 | if (isset($offsety)) { $retval .= ",OFFSETY,$offsety"; } |
56 | if (!empty($fgbackground)) { $retval .= ",FGBACKGROUND,'$fgbackground'"; } |
57 | if (!empty($bgbackground)) { $retval .= ",BGBACKGROUND,'$bgbackground'"; } |
58 | if (!empty($closetext)) { $retval .= ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } |
59 | if (!empty($noclose)) { $retval .= ",NOCLOSE"; } |
60 | if (!empty($status)) { $retval .= ",STATUS,'".str_replace("'","\'",$status)."'"; } |
61 | if (!empty($autostatus)) { $retval .= ",AUTOSTATUS"; } |
62 | if (!empty($autostatuscap)) { $retval .= ",AUTOSTATUSCAP"; } |
63 | if (isset($inarray)) { $retval .= ",INARRAY,'$inarray'"; } |
64 | if (isset($caparray)) { $retval .= ",CAPARRAY,'$caparray'"; } |
65 | if (!empty($capicon)) { $retval .= ",CAPICON,'$capicon'"; } |
66 | if (!empty($snapx)) { $retval .= ",SNAPX,$snapx"; } |
67 | if (!empty($snapy)) { $retval .= ",SNAPY,$snapy"; } |
68 | if (isset($fixx)) { $retval .= ",FIXX,$fixx"; } |
69 | if (isset($fixy)) { $retval .= ",FIXY,$fixy"; } |
70 | if (!empty($background)) { $retval .= ",BACKGROUND,'$background'"; } |
71 | if (!empty($padx)) { $retval .= ",PADX,$padx"; } |
72 | if (!empty($pady)) { $retval .= ",PADY,$pady"; } |
73 | if (!empty($fullhtml)) { $retval .= ",FULLHTML"; } |
74 | if (!empty($frame)) { $retval .= ",FRAME,'$frame'"; } |
75 | if (isset($timeout)) { $retval .= ",TIMEOUT,$timeout"; } |
76 | if (!empty($function)) { $retval .= ",FUNCTION,'$function'"; } |
77 | if (isset($delay)) { $retval .= ",DELAY,$delay"; } |
78 | if (!empty($hauto)) { $retval .= ",HAUTO"; } |
79 | if (!empty($vauto)) { $retval .= ",VAUTO"; } |
80 | $retval .= ');" onmouseout="nd();"'; |
81 | |
82 | return $retval; |
83 | } |
84 | |
85 | /* vim: set expandtab: */ |
86 | |
87 | ?> |