summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-12-31 11:37:01 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-12-31 11:37:01 +0000
commit10716b0ddd3f3294a425158d3175673e3851e1b7 (patch)
treeeae4bcb3649f2f77f7ebf17adf0ae702cb858866
parentcf4bd08971a378a6173be50fad78f943b10fc3ea (diff)
downloadliberty-10716b0ddd3f3294a425158d3175673e3851e1b7.tar.gz
liberty-10716b0ddd3f3294a425158d3175673e3851e1b7.tar.bz2
liberty-10716b0ddd3f3294a425158d3175673e3851e1b7.zip
add width and hight to the mix
-rwxr-xr-xLibertySystem.php15
-rw-r--r--plugins/data.img.php19
2 files changed, 23 insertions, 11 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 009297e..c905ebd 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.52 2006/12/26 04:59:39 spiderr Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.53 2006/12/31 11:37:01 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -685,7 +685,16 @@ function liberty_plugins_div_style( $pParamHash ) {
// styling
case 'background-color':
$key = 'background';
+ case 'width':
+ case 'height':
+ if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) {
+ $ret['style'] .= "{$key}:{$value};";
+ } elseif( preg_match( "/^\d+$/", $value ) ) {
+ $ret['style'] .= "{$key}:{$value}px;";
+ }
case 'float':
+ case 'width':
+ case 'height':
case 'padding':
case 'margin':
case 'background':
@@ -696,14 +705,14 @@ function liberty_plugins_div_style( $pParamHash ) {
case 'font-size':
case 'font-weight':
case 'font-family':
- $ret['style'] .= "$key:$value;";
+ $ret['style'] .= "{$key}:{$value};";
break;
// align and float are special
case 'align':
if( $value == 'center' || $value == 'middle' ) {
$ret['style'] .= 'text-align:center;';
} else {
- $ret['style'] .= "float:$value;";
+ $ret['style'] .= "float:{$value};";
}
break;
// default just gets re-assigned
diff --git a/plugins/data.img.php b/plugins/data.img.php
index d565f87..248609a 100644
--- a/plugins/data.img.php
+++ b/plugins/data.img.php
@@ -1,7 +1,7 @@
<?php
/**
- * @version $Revision: 1.12 $
- * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.12 2006/12/15 20:42:44 squareing Exp $
+ * @version $Revision: 1.13 $
+ * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.13 2006/12/31 11:37:01 squareing Exp $
* @package liberty
* @subpackage plugins_data
*/
@@ -58,8 +58,7 @@ function data_img_help() {
}
function data_img( $pData, $pParams ) {
- $div = liberty_plugins_div_style( $pParams );
- $div['img_style'] = '';
+ $img_style = '';
foreach( $pParams as $key => $value ) {
if( !empty( $value ) ) {
@@ -67,16 +66,20 @@ function data_img( $pData, $pParams ) {
// rename a couple of parameters
case 'width':
case 'height':
- if( preg_match( "/^\d+(em|px|%|pt)$/", $value ) ) {
- $div['img_style'] .= $key.':'.$value.';';
+ if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) {
+ $img_style .= $key.':'.$value.';';
} elseif( preg_match( "/^\d+$/", $value ) ) {
- $div['img_style'] .= $key.':'.$value.'px;';
+ $img_style .= $key.':'.$value.'px;';
}
+ // remove values from the hash that they don't get used in the div as well
+ $pParams[$key] = NULL;
break;
}
}
}
+ $div = liberty_plugins_div_style( $pParams );
+
// check if we have a source to load an image from
if( !empty( $pParams['src'] ) ) {
// set up image first
@@ -85,7 +88,7 @@ function data_img( $pData, $pParams ) {
' alt="'. $alt.'"'.
' title="'.$alt.'"'.
' src="' .$pParams['src'].'"'.
- ' style="'.$div['img_style'].'"'.
+ ' style="'.$img_style.'"'.
' />';
// if this image is linking to something, wrap the image with the <a>