1: <?php
2: 3: 4: 5: 6:
7:
8:
9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22: function smarty_function_popup($params, &$smarty)
23: {
24: $append = '';
25: foreach ($params as $_key=>$_value) {
26: switch ($_key) {
27: case 'text':
28: case 'trigger':
29: case 'function':
30: case 'inarray':
31: $$_key = (string)$_value;
32: if ($_key == 'function' || $_key == 'inarray')
33: $append .= ',' . strtoupper($_key) . ",'$_value'";
34: break;
35:
36: case 'caption':
37: case 'closetext':
38: case 'status':
39: $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
40: break;
41:
42: case 'fgcolor':
43: case 'bgcolor':
44: case 'textcolor':
45: case 'capcolor':
46: case 'closecolor':
47: case 'textfont':
48: case 'captionfont':
49: case 'closefont':
50: case 'fgbackground':
51: case 'bgbackground':
52: case 'caparray':
53: case 'capicon':
54: case 'background':
55: case 'frame':
56: $append .= ',' . strtoupper($_key) . ",'$_value'";
57: break;
58:
59: case 'textsize':
60: case 'captionsize':
61: case 'closesize':
62: case 'width':
63: case 'height':
64: case 'border':
65: case 'offsetx':
66: case 'offsety':
67: case 'snapx':
68: case 'snapy':
69: case 'fixx':
70: case 'fixy':
71: case 'padx':
72: case 'pady':
73: case 'timeout':
74: case 'delay':
75: $append .= ',' . strtoupper($_key) . ",$_value";
76: break;
77:
78: case 'sticky':
79: case 'left':
80: case 'right':
81: case 'center':
82: case 'above':
83: case 'below':
84: case 'noclose':
85: case 'autostatus':
86: case 'autostatuscap':
87: case 'fullhtml':
88: case 'hauto':
89: case 'vauto':
90: case 'mouseoff':
91: case 'followmouse':
92: case 'closeclick':
93: if ($_value) $append .= ',' . strtoupper($_key);
94: break;
95:
96: default:
97: $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
98: }
99: }
100:
101: if (empty($text) && !isset($inarray) && empty($function)) {
102: $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
103: return false;
104: }
105:
106: if (empty($trigger)) { $trigger = "onmouseover"; }
107:
108: $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
109: $retval .= $append . ');"';
110: if ($trigger == 'onmouseover')
111: $retval .= ' onmouseout="nd();"';
112:
113:
114: return $retval;
115: }
116:
117:
118:
119: ?>
120: