diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-12-15 20:42:44 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-12-15 20:42:44 +0000 |
| commit | 964482cf5bc7b048e6143f0a27fd0809c97e36ae (patch) | |
| tree | 8441e73ad6868e5fbde33b2d9eec8502ec056919 | |
| parent | d9e1b60fafa4e2a94e17efab894552d3a976241d (diff) | |
| download | liberty-964482cf5bc7b048e6143f0a27fd0809c97e36ae.tar.gz liberty-964482cf5bc7b048e6143f0a27fd0809c97e36ae.tar.bz2 liberty-964482cf5bc7b048e6143f0a27fd0809c97e36ae.zip | |
lots of cleanup and fixed description parameter for img and attachment plugin
| -rwxr-xr-x | LibertySystem.php | 17 | ||||
| -rw-r--r-- | plugins/data.attachment.php | 26 | ||||
| -rw-r--r-- | plugins/data.img.php | 8 |
3 files changed, 32 insertions, 19 deletions
diff --git a/LibertySystem.php b/LibertySystem.php index b211de5..80ef49e 100755 --- a/LibertySystem.php +++ b/LibertySystem.php @@ -3,7 +3,7 @@ * System class for handling the liberty package * * @package liberty -* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.49 2006/12/13 18:01:37 squareing Exp $ +* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.50 2006/12/15 20:42:44 squareing Exp $ * @author spider <spider@steelsun.com> */ @@ -606,18 +606,21 @@ $gLibertySystem = new LibertySystem(); */ function liberty_plugins_div_style( $pParamHash ) { $ret = array(); - $ret['style'] = ''; + $ret['style'] = $ret['description'] = ''; if( !empty( $pParamHash ) && is_array( $pParamHash ) ) { foreach( $pParamHash as $key => $value ) { if( !empty( $value ) ) { switch( $key ) { - // rename a couple of parameters - case 'background-color': - $key = 'background'; + // description case 'desc': $key = 'description'; - // these are used as-is + case 'description': + $ret[$key] = $value; + break; + // styling + case 'background-color': + $key = 'background'; case 'float': case 'padding': case 'margin': @@ -631,6 +634,7 @@ function liberty_plugins_div_style( $pParamHash ) { case 'font-family': $ret['style'] .= "$key:$value;"; break; + // align and float are special case 'align': if( $value == 'center' || $value == 'middle' ) { $ret['style'] .= 'text-align:center;'; @@ -638,6 +642,7 @@ function liberty_plugins_div_style( $pParamHash ) { $ret['style'] .= "float:$value;"; } break; + // default just gets re-assigned default: $ret[$key] = $value; break; diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php index 9ebd824..ffd80e7 100644 --- a/plugins/data.attachment.php +++ b/plugins/data.attachment.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ * @package liberty * @subpackage plugins_data */ @@ -15,7 +15,7 @@ // +----------------------------------------------------------------------+ // | Authors: drewslater <andrew@andrewslater.com> // +----------------------------------------------------------------------+ -// $Id: data.attachment.php,v 1.10 2006/12/13 20:10:36 squareing Exp $ +// $Id: data.attachment.php,v 1.11 2006/12/15 20:42:44 squareing Exp $ /** * definitions @@ -110,20 +110,28 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had ' src="' .$thumburl.'"'. ' />'; - // use specified link as href. insert default link to source only when source not already displayed + $ret .= ( !empty( $att['file_details'] ) ? '<br />'.$att['file_details'] : '' ); + + // use specified link as href. insert default link to source only when + // source not already displayed if( !empty( $pParams['link'] ) && $pParams['link'] == 'false' ) { } elseif( !empty( $pParams['link'] ) ) { $ret = '<a href="'.trim( $pParams['link'] ).'">'.$ret.'</a>'; } elseif( empty( $pParams['size'] ) || $pParams['size'] != 'original' ) { - $ret = '<a href="'.trim( $att['source_url'] ).'">'.$ret.'</a>'; + if( !empty( $att['download_url'] ) ) { + $ret = '<a href="'.trim( $att['download_url'] ).'">'.$ret.'</a>'; + } else { + $ret = '<a href="'.trim( $att['source_url'] ).'">'.$ret.'</a>'; + } } - // finally, wrap the image with a div - if( !empty( $div['style'] ) || !empty( $class ) || !empty( $div['description'] ) ) { - $ret = '<div class="'.( !empty( $div['class'] ) ? $div['class'] : "att-plugin" ).'" style="'.$div['style'].'">'.$ret.'<br />'.( !empty( $div['description'] ) ? $div['description'] : '' ).'</div>'; - } + // finally, wrap the output with a div + $ret = + '<div class="'.( !empty( $div['class'] ) ? $div['class'] : "att-plugin" ).'" style="'.$div['style'].'">'. $ret. + ( !empty( $div['description'] ) ? '<br />'.$div['description'] : '' ). + '</div>'; } else { - $ret = tra( "The attachment id given is not valid." ); + $ret = tra( "The attachment id given is not valid." ); } return $ret; diff --git a/plugins/data.img.php b/plugins/data.img.php index dfa07cc..d565f87 100644 --- a/plugins/data.img.php +++ b/plugins/data.img.php @@ -1,7 +1,7 @@ <?php /** - * @version $Revision: 1.11 $ - * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.11 2006/12/13 18:01:38 squareing Exp $ + * @version $Revision: 1.12 $ + * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.12 2006/12/15 20:42:44 squareing Exp $ * @package liberty * @subpackage plugins_data */ @@ -78,13 +78,13 @@ function data_img( $pData, $pParams ) { } // check if we have a source to load an image from - if( !empty( $div['src'] ) ) { + if( !empty( $pParams['src'] ) ) { // set up image first $alt = ( !empty( $div['description'] ) ? $div['description'] : tra( 'Image' ) ); $ret = '<img'. ' alt="'. $alt.'"'. ' title="'.$alt.'"'. - ' src="' .$div['src'].'"'. + ' src="' .$pParams['src'].'"'. ' style="'.$div['img_style'].'"'. ' />'; |
