summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-05-20 10:09:14 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-05-20 10:09:14 +0000
commitdcb599fd79db1a1be8aa50cb4fdc74a2c26a2afc (patch)
tree706423c1ad53382863b47cd5f69555cab49717e0
parent4420e14e61a23e8f3717a42814d3ed1c18bd6a9b (diff)
downloadliberty-dcb599fd79db1a1be8aa50cb4fdc74a2c26a2afc.tar.gz
liberty-dcb599fd79db1a1be8aa50cb4fdc74a2c26a2afc.tar.bz2
liberty-dcb599fd79db1a1be8aa50cb4fdc74a2c26a2afc.zip
try to use the <span> wrapper and apply styling to mimic a div layout
-rwxr-xr-xLibertySystem.php24
-rw-r--r--plugins/data.attachment.php29
-rw-r--r--plugins/data.biticon.php8
-rw-r--r--plugins/data.flashvideo.php14
-rw-r--r--plugins/data.img.php18
5 files changed, 45 insertions, 48 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 88c978c..c859466 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.73 2007/05/20 09:18:10 laetzer Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.74 2007/05/20 10:09:14 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -844,7 +844,7 @@ $gLibertySystem = new LibertySystem();
* @access public
* @return hash full of styling goodies
*/
-function liberty_plugins_div_style( $pParamHash ) {
+function liberty_plugins_wrapper_style( $pParamHash ) {
$ret = array();
$ret['style'] = $ret['description'] = '';
@@ -854,6 +854,11 @@ function liberty_plugins_div_style( $pParamHash ) {
$pParamHash['text-align'] = 'right';
}
+ // force display:block to the "div" if not specified otherwise
+ if( empty( $pParamHash['display'] )) {
+ $pParamHash['display'] = "block";
+ }
+
foreach( $pParamHash as $key => $value ) {
if( !empty( $value ) ) {
switch( $key ) {
@@ -864,8 +869,6 @@ function liberty_plugins_div_style( $pParamHash ) {
$ret[$key] = $value;
break;
// styling
- case 'background-color':
- $key = 'background';
case 'width':
case 'height':
if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) {
@@ -873,9 +876,10 @@ function liberty_plugins_div_style( $pParamHash ) {
} elseif( preg_match( "/^\d+$/", $value ) ) {
$ret['style'] .= "{$key}:{$value}px;";
}
+ break;
+ case 'background':
+ $key = 'background-color';
case 'float':
- case 'width':
- case 'height':
case 'padding':
case 'margin':
case 'background':
@@ -886,6 +890,7 @@ function liberty_plugins_div_style( $pParamHash ) {
case 'font-size':
case 'font-weight':
case 'font-family':
+ case 'display':
$ret['style'] .= "{$key}:{$value};";
break;
// align and float are special
@@ -903,13 +908,6 @@ function liberty_plugins_div_style( $pParamHash ) {
}
}
}
-
- // force display:block to the "div" if not specified otherwise
- if( empty($pParamHash['display_prop']) || !isset($pParamHash['display_prop']) ){
- $ret['style'] .= "display:block;";
- }else{
- $ret['style'] .= "display:" . $pParamHash['display_prop'] . "";
- }
}
return $ret;
diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php
index 6cf0648..cd10534 100644
--- a/plugins/data.attachment.php
+++ b/plugins/data.attachment.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.20 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Authors: drewslater <andrew@andrewslater.com>
// +----------------------------------------------------------------------+
-// $Id: data.attachment.php,v 1.19 2007/05/20 01:31:17 laetzer Exp $
+// $Id: data.attachment.php,v 1.20 2007/05/20 10:09:14 squareing Exp $
/**
* definitions
@@ -81,9 +81,9 @@ function data_attachment_help() {
Avaliable content can be viewed <a href="'.LIBERTY_PKG_URL.'list_content.php">here</a>' ).'</td>
</tr>
<tr class="even">
- <td>display</td>
+ <td>output</td>
<td>'.tra( 'keyword (optional)' ).'</td>
- <td>'.tra( "If you are attaching a file and you only want to display the description and not the image that goes with it, use: display=desc" ).'</td>
+ <td>'.tra( "If you are attaching a file and you only want to display the description and not the image that goes with it, use: output=desc" ).'</td>
</tr>'
.'<tr class="odd">'
.'<td>'.tra( "styling" ).'</td>'
@@ -119,12 +119,12 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had
// check if we have a valid thumbnail
if( !empty( $thumburl ) ) {
- $div = liberty_plugins_div_style( $pParams );
+ $wrapper = liberty_plugins_wrapper_style( $pParams );
// set up image first
$ret = '<img'.
- ' alt="'. ( !empty( $div['description'] ) ? $div['description'] : tra( 'Image' ) ).'"'.
- ' title="'.( !empty( $div['description'] ) ? $div['description'] : tra( 'Image' ) ).'"'.
+ ' alt="'. ( !empty( $wrapper['description'] ) ? $wrapper['description'] : tra( 'Image' ) ).'"'.
+ ' title="'.( !empty( $wrapper['description'] ) ? $wrapper['description'] : tra( 'Image' ) ).'"'.
' src="' .$thumburl.'"'.
' />';
@@ -149,11 +149,11 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had
$pParams['link'] = $wp->getDisplayUrl( $pParams['page_name'] );
}
- if( !empty( $div['description'] ) && !empty( $pParams['display'] ) && ( $pParams['display'] == 'desc' || $pParams['display'] == 'description' ) ) {
- $ret = ( !empty( $div['description'] ) ? $div['description'] : '' );
- $nodiv = TRUE;
+ if( !empty( $wrapper['description'] ) && !empty( $pParams['output'] ) && ( $pParams['output'] == 'desc' || $pParams['output'] == 'description' ) ) {
+ $ret = ( !empty( $wrapper['description'] ) ? $wrapper['description'] : '' );
+ $nowrapper = TRUE;
} else {
- $ret .= ( !empty( $div['description'] ) ? '<br />'.$div['description'] : '' );
+ $ret .= ( !empty( $wrapper['description'] ) ? '<br />'.$wrapper['description'] : '' );
}
// use specified link as href. insert default link to source only when
@@ -175,11 +175,10 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had
}
}
- // finally, wrap the output with a span instead of a div to avoid invalid markup if att placed inside paragraph or inline element
- if( empty( $nodiv ) ) {
+ // finally, wrap the output with a span. this will avoid invalid markup if att placed inside paragraph or inline element
+ if( empty( $nowrapper )) {
$ret =
- '<span class="'.( isset($div) && !empty( $div['class'] ) ? $div['class'] : "att-plugin" ).'" style="'.(isset($div) ? $div['style'] : '').'">'.
- $ret.'</span>';
+ '<span class="'.( isset( $wrapper ) && !empty( $wrapper['class'] ) ? $wrapper['class'] : "att-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</span>';
}
} else {
$ret = tra( "The attachment id given is not valid." );
diff --git a/plugins/data.biticon.php b/plugins/data.biticon.php
index 18c1082..28755eb 100644
--- a/plugins/data.biticon.php
+++ b/plugins/data.biticon.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @package liberty
* @subpackage plugins_data
*/
@@ -70,9 +70,9 @@ function data_biticon( $pData, $pParams ) {
require_once $gBitSmarty->_get_plugin_filepath( 'function', 'biticon' );
$ret = smarty_function_biticon( $biticon, $gBitSmarty );
- $div = liberty_plugins_div_style( $pParams );
- if( !empty( $div['style'] ) ) {
- $ret ='<div class="'.( !empty( $div['class'] ) ? $div['class'] : "biticon-plugin" ).'" style="'.$div['style'].'">'.$ret.'</div>';
+ $wrapper = liberty_plugins_wrapper_style( $pParams );
+ if( !empty( $wrapper['style'] ) ) {
+ $ret ='<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "biticon-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</span>';
}
return $ret;
}
diff --git a/plugins/data.flashvideo.php b/plugins/data.flashvideo.php
index bad443b..276ce30 100644
--- a/plugins/data.flashvideo.php
+++ b/plugins/data.flashvideo.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Authors: drewslater <andrew@andrewslater.com>
// +----------------------------------------------------------------------+
-// $Id: data.flashvideo.php,v 1.7 2007/02/26 18:03:02 squareing Exp $
+// $Id: data.flashvideo.php,v 1.8 2007/05/20 10:09:14 squareing Exp $
/**
* definitions
@@ -102,23 +102,23 @@ function data_flashvideo( $pData, $pParams ) { // NOTE: The original plugin had
}
if( !empty( $att['flv_url'] )) {
- $div = liberty_plugins_div_style( $pParams );
+ $wrapper = liberty_plugins_wrapper_style( $pParams );
// mPrefs has been passed to us in $att['prefs']
treasury_flv_calculate_videosize( $pParams, $att['prefs'] );
$sizes = array( 'small', 'medium', 'large', 'huge', 'original' );
if( !empty( $pParams['view'] ) && in_array( $pParams['view'], $sizes )) {
- $div['description'] .= ( !empty( $div['description'] ) ? '<br />' : '' );
- $div['description'] .= '<a href="'.$att['display_url'].'&size='.$pParams['view'].'">'.tra( "View larger version" ).'</a>';
+ $wrapper['description'] .= ( !empty( $wrapper['description'] ) ? '<br />' : '' );
+ $wrapper['description'] .= '<a href="'.$att['display_url'].'&size='.$pParams['view'].'">'.tra( "View larger version" ).'</a>';
}
$gBitSmarty->assign( 'flvPrefs', $att['prefs'] );
$gBitSmarty->assign( 'flv', $att );
$ret = $gBitSmarty->fetch( 'bitpackage:treasury/flv_player_inc.tpl' );
- // finally, wrap the output with a div
- $ret = '<div class="'.( !empty( $div['class'] ) ? $div['class'] : "flashvideo-plugin" ).'" style="'.$div['style'].'">'.$ret.( !empty( $div['description'] ) ? '<br />'.$div['description'] : '' ).'</div>';
+ // finally, wrap the output with a span
+ $ret = '<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "flashvideo-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.( !empty( $wrapper['description'] ) ? '<br />'.$wrapper['description'] : '' ).'</span>';
} else {
$ret = tra( "There doesn't seem to be a valid video stream for the id you used" ).": ".$pParams['id'];
}
diff --git a/plugins/data.img.php b/plugins/data.img.php
index 248609a..6cff61d 100644
--- a/plugins/data.img.php
+++ b/plugins/data.img.php
@@ -1,7 +1,7 @@
<?php
/**
- * @version $Revision: 1.13 $
- * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.13 2006/12/31 11:37:01 squareing Exp $
+ * @version $Revision: 1.14 $
+ * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.14 2007/05/20 10:09:14 squareing Exp $
* @package liberty
* @subpackage plugins_data
*/
@@ -78,12 +78,12 @@ function data_img( $pData, $pParams ) {
}
}
- $div = liberty_plugins_div_style( $pParams );
+ $wrapper = liberty_plugins_wrapper_style( $pParams );
// check if we have a source to load an image from
if( !empty( $pParams['src'] ) ) {
// set up image first
- $alt = ( !empty( $div['description'] ) ? $div['description'] : tra( 'Image' ) );
+ $alt = ( !empty( $wrapper['description'] ) ? $wrapper['description'] : tra( 'Image' ) );
$ret = '<img'.
' alt="'. $alt.'"'.
' title="'.$alt.'"'.
@@ -92,13 +92,13 @@ function data_img( $pData, $pParams ) {
' />';
// if this image is linking to something, wrap the image with the <a>
- if( !empty( $div['link'] ) ) {
- $ret = '<a href="'.trim( $div['link'] ).'">'.$ret.'</a>';
+ if( !empty( $wrapper['link'] ) ) {
+ $ret = '<a href="'.trim( $wrapper['link'] ).'">'.$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'] : "img-plugin" ).'" style="'.$div['style'].'">'.$ret.'<br />'.( !empty( $div['description'] ) ? $div['description'] : '' ).'</div>';
+ // finally, wrap the image with a span
+ if( !empty( $wrapper['style'] ) || !empty( $class ) || !empty( $wrapper['description'] ) ) {
+ $ret = '<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "img-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'<br />'.( !empty( $wrapper['description'] ) ? $wrapper['description'] : '' ).'</span>';
}
} else {
$ret = '<span class="warning">'.tra( 'When using <strong>{img}</strong> the <strong>src</strong> parameter is required.' ).'</span>';