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