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

Source for file function.attachhelp.php

Documentation is available at function.attachhelp.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9. * smarty_function_attachmenthelp
  10. */
  11. function smarty_function_attachhelp( $pParams, &$gBitSmarty ) {
  12.     global $gBitSystem;
  13.  
  14.     // print legend if desired
  15.     if( !empty( $pParams['legend'] )) {
  16.         $gBitSmarty->assign( 'legend', TRUE );
  17.     }
  18.  
  19.     // get all the info into the right place
  20.     if( !empty( $pParams['hash'] ) && is_array( $pParams['hash'] )) {
  21.         $pParams = array_merge( $pParams, $pParams['hash'] );
  22.         unset( $pParams['hash'] );
  23.     }
  24.  
  25.     // prepare the output
  26.     if( empty( $pParams['attachment_id'] )) {
  27.         $gBitSmarty->trigger_error( tra( 'You need to provide an attachment_id' ));
  28.         return;
  29.     } elseif( !empty( $pParams['wiki_plugin_link'] )) {
  30.         $attachhelp = trim( $pParams['wiki_plugin_link'] );
  31.     } else {
  32.         $attachhelp = "{attachment id={$pParams['attachment_id']}}";
  33.     }
  34.  
  35.     // if we're viewing this page at a particular size, we want to include that in the output
  36.     if( !empty( $_REQUEST['size'] )) {
  37.         $attachhelp = str_replace( "}", " size={$_REQUEST['size']}}", $attachhelp );
  38.     }
  39.  
  40.     $gBitSmarty->assign( 'attachhelp', $attachhelp );
  41.     return $gBitSmarty->fetch( 'bitpackage:liberty/attachhelp.tpl' );
  42. }
  43. ?>

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