From da6e7d437db6b0623f0bff64849288afa637f129 Mon Sep 17 00:00:00 2001 From: Max Kremmel Date: Thu, 11 Mar 2010 07:10:42 +0000 Subject: add link=download option --- plugins/data.attachment.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php index 9f77ea7..0e2cf8f 100644 --- a/plugins/data.attachment.php +++ b/plugins/data.attachment.php @@ -1,6 +1,6 @@ // +----------------------------------------------------------------------+ -// $Id: data.attachment.php,v 1.45 2009/10/23 21:34:34 spiderr Exp $ +// $Id: data.attachment.php,v 1.46 2010/03/11 07:10:42 squareing Exp $ /** * definitions @@ -75,7 +75,7 @@ function data_attachment_help() { .'' .'link' .'' . tra( "string") . '
' . tra("(optional)") . '' - .'' . tra( "Allows you to specify a relative or absolute URL the image will link to if clicked. You can also link to one of the sizes of the image: icon, avatar, small, medium, large and original. If set to false, no link is inserted.") + .'' . tra( "Allows you to specify a relative or absolute URL the image will link to if clicked. You can also link to one of the sizes of the image: icon, avatar, small, medium, large, original and download (insert download link, which will activate the download counter). If set to false, no link is inserted.") . tra("(Default = ") . ''.tra( 'link to image details page' ).')' .'' .' @@ -159,6 +159,10 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) { } elseif( $pParams['link'] == 'original' && !empty( $att['source_url'] )) { $pParams['link'] = $att['source_url']; + // Allow the use of 'download' to link to download link. this will allow us to count downloads + } elseif( $pParams['link'] == 'download' && !empty( $att['download_url'] )) { + $pParams['link'] = $att['download_url']; + // Adjust class name if we are leaving this server } elseif( !strstr( $pParams['link'], $_SERVER["SERVER_NAME"] ) && strstr( $pParams['link'], '//' )) { $wrapper['href_class'] = 'class="external"'; @@ -181,10 +185,10 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) { $gBitSmarty->assign( 'wrapper', $wrapper ); $gBitSmarty->assign( 'thumbsize', (( !empty( $pParams['size'] ) && ( $pParams['size'] == 'original' || !empty( $att['thumbnail_url'][$pParams['size']] ))) ? $pParams['size'] : 'medium' )); - //Carry only these attributes to the image tags + //Carry only these attributes to the image tags $width = !empty( $pParams['width'] ) ? $pParams['width'] : ''; $gBitSmarty->assign( 'width', $width ); - + $height = !empty( $pParams['height'] ) ? $pParams['height'] : ''; $gBitSmarty->assign( 'height', $height ); -- cgit v1.3