Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file function.popup.php

Documentation is available at 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. require_once(LIBERTY_PKG_PATH."LibertyContent.php");
  22.  
  23. function smarty_function_popup($params&$gBitSmarty{
  24.     $append '';
  25.     foreach ($params as $_key=>$_value{
  26.         switch ($_key{
  27.             case 'target':
  28.             case 'text':
  29.             case 'trigger':
  30.             case 'content_id':
  31.                 $$_key = (string)$_value;
  32.                 break;
  33.  
  34.             case 'caption':
  35.             case 'closetext':
  36.             case 'status':
  37.                 $append .= ',' strtoupper($_key",'" str_replace("'","\'",$_value"'";
  38.                 break;
  39.  
  40.             case 'fgcolor':
  41.             case 'bgcolor':
  42.             case 'textcolor':
  43.             case 'capcolor':
  44.             case 'closecolor':
  45.             case 'textfont':
  46.             case 'captionfont':
  47.             case 'closefont':
  48.             case 'textsize':
  49.             case 'captionsize':
  50.             case 'closesize':
  51.             case 'width':
  52.             case 'height':
  53.             case 'border':
  54.             case 'offsetx':
  55.             case 'offsety':
  56.             case 'fgbackground':
  57.             case 'bgbackground':
  58.             case 'inarray':
  59.             case 'caparray':
  60.             case 'capicon':
  61.             case 'snapx':
  62.             case 'snapy':
  63.             case 'fixx':
  64.             case 'fixy':
  65.             case 'background':
  66.             case 'padx':
  67.             case 'pady':
  68.             case 'frame':
  69.             case 'timeout':
  70.             case 'delay':
  71.             case 'function':
  72.                 $append .= ',' strtoupper($_key",'$_value'";
  73.                 break;
  74.  
  75.             case 'sticky':
  76.             case 'left':
  77.             case 'right':
  78.             case 'center':
  79.             case 'above':
  80.             case 'below':
  81.             case 'noclose':
  82.             case 'autostatus':
  83.             case 'autostatuscap':
  84.             case 'fullhtml':
  85.             case 'hauto':
  86.             case 'vauto':
  87.             case 'mouseoff':
  88.                 if ($_value$append .= ',' strtoupper($_key);
  89.                 break;
  90.             case 'closeclick':
  91.                 if ($_value$append .= ',' strtoupper($_key);
  92.                 if ($_value$target_append $_key.'=1';
  93.                 break;
  94.  
  95.             default:
  96.                 $gBitSmarty->trigger_error("[popup] unknown parameter $_key"E_USER_WARNING);
  97.         }
  98.     }
  99.  
  100.     if (empty($target&& empty($text&& empty($content_id&& !isset($inarray&& empty($function)) {
  101.         $gBitSmarty->trigger_error("overlib: attribute 'target' or 'text' or 'inarray' or 'function' required");
  102.         return false;
  103.     }
  104.  
  105.     if ((!empty($target&& !empty($text)) || (!empty($target&& !empty($content_id)) || (!empty($text&& !empty($content_id)) ) {
  106.         $gBitSmarty->trigger_error("overlib: You may only specify one of 'target', 'text' and 'content_id'..");
  107.     }
  108.  
  109.     if (empty($trigger)) $trigger "onmouseover"}
  110.  
  111.     if (!empty($content_id)) {
  112.         $target LibertyContent::getPreviewUrl($content_id);
  113.     }
  114.  
  115.     if (!empty($target&& !empty($target_append)) {
  116.       if (strstr($target"?")) {
  117.         $target .= "&".$target_append;
  118.       }
  119.       else {
  120.         $target .= "?".$target_append;
  121.       }
  122.     }
  123.  
  124.     if (!empty($text)) {
  125.         $retval $trigger '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
  126.         $retval .= $append ');" onmouseout="nd();"';
  127.     }
  128.     else {
  129.         $retval $trigger '="of=function(t){overlib(t'.$append.');};BitAjax.getAndCall(this,of,\''.$target.'\');" onmouseout="nd();"';
  130.     }
  131.  
  132.     return $retval;
  133. }
  134. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:39 +0000 by phpDocumentor 1.5.0-lsces