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