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

Source for file function.jspopup.php

Documentation is available at function.jspopup.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * smarty_function_jspopup
  10.  */
  11.  
  12. /**
  13.  * smarty_function_jspopup
  14.  * 
  15.  * @param array $pParams hash of options
  16.  * @param srting $pParams[href] link the popup should open
  17.  * @param srting $pParams[title] title of the link
  18.  * @param srting $pParams[img] source of an image that is to be displayed instead of the title
  19.  * @param srting $pParams[href] 
  20.  * @param srting $pParams[href] 
  21.  * @param array $gBitSmarty 
  22.  * @access public
  23.  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  24.  */
  25. function smarty_function_jspopup$pParams&$gBitSmarty {
  26.     global $gBitThemes;
  27.  
  28.     $ret '';
  29.     ifempty$pParams['href') ) {
  30.         return'assign: missing "href" parameter' );
  31.     }
  32.  
  33.     ifempty$pParams['title') ) {
  34.         return'assign: missing "title" parameter' );
  35.     else {
  36.         $title empty$pParams['notra'$pParams['title'tra$pParams['title');
  37.     }
  38.  
  39.     ifempty$pParams['text')){
  40.         $text $title;
  41.     else {
  42.         $text empty$pParams['notra'$pParams['text'tra$pParams['text');
  43.         // remove it from the hash since later the params are looped over for to formulate the a tag
  44.         unset$pParams['text');
  45.     }
  46.  
  47.  
  48.     $optionHash array'type''width''height''gutsonly''img' );
  49.     foreach$pParams as $param => $val {
  50.         if!in_array$param$optionHash ) ) {
  51.             if$param == 'title' {
  52.                 $guts .= ' '.$param.'="'.tra'This will open a new window: ' ).$title.'"';
  53.             }elseif$param == 'href' && $gBitThemes->isJavascriptEnabled()){
  54.                 $guts .= ' '.$param.'="javascript:void(0)"';
  55.             else {
  56.                 $guts .= ' '.$param.'="'.$val.'"';
  57.             }
  58.         }
  59.     }
  60.  
  61.     if!empty$pParams['ibiticon') ) {
  62.         $gBitSmarty->loadPlugin'smarty_function_biticon' );
  63.  
  64.         $tmp explode'/'$pParams['ibiticon');
  65.         $ibiticon array(
  66.             'ipackage' => $tmp[0],
  67.             'iname'    => $tmp[1],
  68.             'iexplain' => $title,
  69.         );
  70.  
  71.         if!empty$pParams['iforce') ) {
  72.             $ibiticon['iforce'$pParams['iforce'];
  73.         }
  74.         $img smarty_function_biticon$ibiticon$gBitSmarty );
  75.     }
  76.  
  77.     if!empty$pParams['img')) {
  78.         $img_size NULL;
  79.         $file str_replace'//''/'BIT_BASE_PATH.str_replaceBIT_ROOT_URI''urldecode$pParams['img'))));
  80.         ifis_file$file )) {
  81.             if$imgSizeHash @getimagesize$file )) {
  82.                 $img_size $imgSizeHash[3];
  83.             }
  84.         }
  85.         $img '<img src="'.$pParams['img'].'" alt="'.$title.'" title="'.$title.'" '.$img_size.' />';
  86.     }
  87.  
  88.     if!empty$pParams['type'&& $pParams['type'== 'fullscreen' {
  89.         $js 'BitBase.popUpWin(\''.$pParams['href'].'\',\'fullScreen\');';
  90.     else {
  91.         $js 'BitBase.popUpWin(\''.$pParams['href'].'\',\'standard\','.!empty$pParams['width'$pParams['width'600 ).','.!empty$pParams['height'$pParams['height'400 ).');';
  92.     }
  93.  
  94.     // deprecated slated for removal - onkeypress causes focus problems with browsers - if this is an ada issue get in touch -wjames5.
  95.     // $guts .= ' onkeypress="'.$js.'" onclick="'.$js.'return false;"';
  96.     $guts .= ' onclick="'.$js.'return false;"';
  97.  
  98.     if!empty$pParams['gutsonly') ) {
  99.         return $guts;
  100.     else {
  101.         return'<a '.$guts.'>'.!empty$img $img $text ).'</a>' );
  102.     }
  103. }

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