|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/**
|
|
Chris PeBenito |
696b41 |
* Smarty plugin
|
|
Chris PeBenito |
696b41 |
* @package Smarty
|
|
Chris PeBenito |
696b41 |
* @subpackage plugins
|
|
Chris PeBenito |
696b41 |
*/
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/**
|
|
Chris PeBenito |
696b41 |
* Smarty {popup} function plugin
|
|
Chris PeBenito |
696b41 |
*
|
|
Chris PeBenito |
696b41 |
* Type: function
|
|
Chris PeBenito |
696b41 |
* Name: popup
|
|
Chris PeBenito |
696b41 |
* Purpose: make text pop up in windows via overlib
|
|
Chris PeBenito |
696b41 |
* @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
|
|
Chris PeBenito |
696b41 |
* (Smarty online manual)
|
|
Chris PeBenito |
696b41 |
* @param array
|
|
Chris PeBenito |
696b41 |
* @param Smarty
|
|
Chris PeBenito |
696b41 |
* @return string
|
|
Chris PeBenito |
696b41 |
*/
|
|
Chris PeBenito |
696b41 |
function smarty_function_popup($params, &$smarty)
|
|
Chris PeBenito |
696b41 |
{
|
|
Chris PeBenito |
696b41 |
$append = '';
|
|
Chris PeBenito |
696b41 |
foreach ($params as $_key=>$_value) {
|
|
Chris PeBenito |
696b41 |
switch ($_key) {
|
|
Chris PeBenito |
696b41 |
case 'text':
|
|
Chris PeBenito |
696b41 |
case 'trigger':
|
|
Chris PeBenito |
696b41 |
case 'function':
|
|
Chris PeBenito |
696b41 |
case 'inarray':
|
|
Chris PeBenito |
696b41 |
$$_key = (string)$_value;
|
|
Chris PeBenito |
696b41 |
if ($_key == 'function' || $_key == 'inarray')
|
|
Chris PeBenito |
696b41 |
$append .= ',' . strtoupper($_key) . ",'$_value'";
|
|
Chris PeBenito |
696b41 |
break;
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
case 'caption':
|
|
Chris PeBenito |
696b41 |
case 'closetext':
|
|
Chris PeBenito |
696b41 |
case 'status':
|
|
Chris PeBenito |
696b41 |
$append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
|
|
Chris PeBenito |
696b41 |
break;
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
case 'fgcolor':
|
|
Chris PeBenito |
696b41 |
case 'bgcolor':
|
|
Chris PeBenito |
696b41 |
case 'textcolor':
|
|
Chris PeBenito |
696b41 |
case 'capcolor':
|
|
Chris PeBenito |
696b41 |
case 'closecolor':
|
|
Chris PeBenito |
696b41 |
case 'textfont':
|
|
Chris PeBenito |
696b41 |
case 'captionfont':
|
|
Chris PeBenito |
696b41 |
case 'closefont':
|
|
Chris PeBenito |
696b41 |
case 'fgbackground':
|
|
Chris PeBenito |
696b41 |
case 'bgbackground':
|
|
Chris PeBenito |
696b41 |
case 'caparray':
|
|
Chris PeBenito |
696b41 |
case 'capicon':
|
|
Chris PeBenito |
696b41 |
case 'background':
|
|
Chris PeBenito |
696b41 |
case 'frame':
|
|
Chris PeBenito |
696b41 |
$append .= ',' . strtoupper($_key) . ",'$_value'";
|
|
Chris PeBenito |
696b41 |
break;
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
case 'textsize':
|
|
Chris PeBenito |
696b41 |
case 'captionsize':
|
|
Chris PeBenito |
696b41 |
case 'closesize':
|
|
Chris PeBenito |
696b41 |
case 'width':
|
|
Chris PeBenito |
696b41 |
case 'height':
|
|
Chris PeBenito |
696b41 |
case 'border':
|
|
Chris PeBenito |
696b41 |
case 'offsetx':
|
|
Chris PeBenito |
696b41 |
case 'offsety':
|
|
Chris PeBenito |
696b41 |
case 'snapx':
|
|
Chris PeBenito |
696b41 |
case 'snapy':
|
|
Chris PeBenito |
696b41 |
case 'fixx':
|
|
Chris PeBenito |
696b41 |
case 'fixy':
|
|
Chris PeBenito |
696b41 |
case 'padx':
|
|
Chris PeBenito |
696b41 |
case 'pady':
|
|
Chris PeBenito |
696b41 |
case 'timeout':
|
|
Chris PeBenito |
696b41 |
case 'delay':
|
|
Chris PeBenito |
696b41 |
$append .= ',' . strtoupper($_key) . ",$_value";
|
|
Chris PeBenito |
696b41 |
break;
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
case 'sticky':
|
|
Chris PeBenito |
696b41 |
case 'left':
|
|
Chris PeBenito |
696b41 |
case 'right':
|
|
Chris PeBenito |
696b41 |
case 'center':
|
|
Chris PeBenito |
696b41 |
case 'above':
|
|
Chris PeBenito |
696b41 |
case 'below':
|
|
Chris PeBenito |
696b41 |
case 'noclose':
|
|
Chris PeBenito |
696b41 |
case 'autostatus':
|
|
Chris PeBenito |
696b41 |
case 'autostatuscap':
|
|
Chris PeBenito |
696b41 |
case 'fullhtml':
|
|
Chris PeBenito |
696b41 |
case 'hauto':
|
|
Chris PeBenito |
696b41 |
case 'vauto':
|
|
Chris PeBenito |
696b41 |
case 'mouseoff':
|
|
Chris PeBenito |
696b41 |
case 'followmouse':
|
|
Chris PeBenito |
696b41 |
if ($_value) $append .= ',' . strtoupper($_key);
|
|
Chris PeBenito |
696b41 |
break;
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
default:
|
|
Chris PeBenito |
696b41 |
$smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
|
|
Chris PeBenito |
696b41 |
}
|
|
Chris PeBenito |
696b41 |
}
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
if (empty($text) && !isset($inarray) && empty($function)) {
|
|
Chris PeBenito |
696b41 |
$smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
|
|
Chris PeBenito |
696b41 |
return false;
|
|
Chris PeBenito |
696b41 |
}
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
if (empty($trigger)) { $trigger = "onmouseover"; }
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
$retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
|
|
Chris PeBenito |
696b41 |
$retval .= $append . ');"';
|
|
Chris PeBenito |
696b41 |
if ($trigger == 'onmouseover')
|
|
Chris PeBenito |
696b41 |
$retval .= ' onmouseout="nd();"';
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
return $retval;
|
|
Chris PeBenito |
696b41 |
}
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/* vim: set expandtab: */
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
?>
|