Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / smarty / Smarty-2.6.10 / libs / plugins / function.popup.php
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 $append = '';
24 foreach ($params as $_key=>$_value) {
25 switch ($_key) {
26 case 'text':
27 case 'trigger':
28 case 'function':
29 case 'inarray':
30 $$_key = (string)$_value;
31 if ($_key == 'function' || $_key == 'inarray')
32 $append .= ',' . strtoupper($_key) . ",'$_value'";
33 break;
34
35 case 'caption':
36 case 'closetext':
37 case 'status':
38 $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
39 break;
40
41 case 'fgcolor':
42 case 'bgcolor':
43 case 'textcolor':
44 case 'capcolor':
45 case 'closecolor':
46 case 'textfont':
47 case 'captionfont':
48 case 'closefont':
49 case 'fgbackground':
50 case 'bgbackground':
51 case 'caparray':
52 case 'capicon':
53 case 'background':
54 case 'frame':
55 $append .= ',' . strtoupper($_key) . ",'$_value'";
56 break;
57
58 case 'textsize':
59 case 'captionsize':
60 case 'closesize':
61 case 'width':
62 case 'height':
63 case 'border':
64 case 'offsetx':
65 case 'offsety':
66 case 'snapx':
67 case 'snapy':
68 case 'fixx':
69 case 'fixy':
70 case 'padx':
71 case 'pady':
72 case 'timeout':
73 case 'delay':
74 $append .= ',' . strtoupper($_key) . ",$_value";
75 break;
76
77 case 'sticky':
78 case 'left':
79 case 'right':
80 case 'center':
81 case 'above':
82 case 'below':
83 case 'noclose':
84 case 'autostatus':
85 case 'autostatuscap':
86 case 'fullhtml':
87 case 'hauto':
88 case 'vauto':
89 case 'mouseoff':
90 case 'followmouse':
91 if ($_value) $append .= ',' . strtoupper($_key);
92 break;
93
94 default:
95 $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
96 }
97 }
98
99 if (empty($text) && !isset($inarray) && empty($function)) {
100 $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
101 return false;
102 }
103
104 if (empty($trigger)) { $trigger = "onmouseover"; }
105
106 $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
107 $retval .= $append . ');"';
108 if ($trigger == 'onmouseover')
109 $retval .= ' onmouseout="nd();"';
110
111
112 return $retval;
113 }
114
115 /* vim: set expandtab: */
116
117 ?>
This page took 0.339475 seconds and 4 git commands to generate.