diff options
| -rwxr-xr-x | LibertySystem.php | 31 | ||||
| -rw-r--r-- | admin/admin_liberty_inc.php | 6 | ||||
| -rw-r--r-- | plugins/data.attachment.php | 11 | ||||
| -rw-r--r-- | plugins/data.biticon.php | 4 | ||||
| -rw-r--r-- | plugins/data.flashvideo.php | 8 | ||||
| -rw-r--r-- | plugins/data.img.php | 8 |
6 files changed, 43 insertions, 25 deletions
diff --git a/LibertySystem.php b/LibertySystem.php index 6056cc0..0630729 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.78 2007/05/31 22:04:59 squareing Exp $ +* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.79 2007/06/01 09:02:36 squareing Exp $ * @author spider <spider@steelsun.com> */ @@ -846,23 +846,36 @@ $gLibertySystem = new LibertySystem(); * @access public * @return hash full of styling goodies */ -function liberty_plugins_wrapper_style( $pParamHash, $autoBlock = TRUE ) { +function liberty_plugins_wrapper_style( $pParamHash ) { + global $gBitSystem; + $ret = array(); $ret['style'] = $ret['description'] = ''; - if( !empty( $pParamHash ) && is_array( $pParamHash ) ) { + if( !empty( $pParamHash ) && is_array( $pParamHash )) { // if align is right and text-align isn't set, we'll align that right as well if( empty( $pParamHash['text-align'] ) && ( !empty( $pParamHash['align'] ) && $pParamHash['align'] == 'right' || !empty( $pParamHash['align'] ) && $pParamHash['align'] == 'right' )) { $pParamHash['text-align'] = 'right'; } - // force display:block to the "div" if not specified otherwise - if( empty( $pParamHash['display'] ) && $autoBlock ) { - $pParamHash['display'] = "block"; + // this defines what the wrapper should be - div or span + // if someone sets this value manually, they know what they are doing + if( empty( $pParamHash['wrapper'] )) { + $pParamHash['wrapper'] = 'div'; + + if( $gBitSystem->isFeatureActive( 'liberty_use_span_wrapper' )) { + // set to 'span' if desired + $pParamHash['wrapper'] = 'span'; + + // 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 ) ) { + if( !empty( $value )) { switch( $key ) { // description case 'desc': @@ -873,9 +886,9 @@ function liberty_plugins_wrapper_style( $pParamHash, $autoBlock = TRUE ) { // styling case 'width': case 'height': - if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ) ) ) { + if( preg_match( "/^\d+(em|px|%|pt)$/", trim( $value ))) { $ret['style'] .= "{$key}:{$value};"; - } elseif( preg_match( "/^\d+$/", $value ) ) { + } elseif( preg_match( "/^\d+$/", $value )) { $ret['style'] .= "{$key}:{$value}px;"; } break; diff --git a/admin/admin_liberty_inc.php b/admin/admin_liberty_inc.php index 1eed7a5..89c188a 100644 --- a/admin/admin_liberty_inc.php +++ b/admin/admin_liberty_inc.php @@ -85,6 +85,12 @@ $formLibertyHtmlPurifierFeatures = array( 'note' => 'Allow YouTube videos to be passed through.', 'default' => 'n' ), + // not entirely sure where this should go. liberty plugins? here? some other tab? + 'liberty_use_span_wrapper' => array( + 'label' => 'Use a span wrapper', + 'note' => 'Some plugins such as the attachment plugin wrap their output with a div. This might not work well when you are using a WYSYWIG such as TinyMCE or FCKeditor in combination with HTML Purifier. There are Pros and Cons to using either wrapper.', + 'default' => 'n' + ), ); $gBitSmarty->assign( 'formLibertyHtmlPurifierFeatures', $formLibertyHtmlPurifierFeatures ); diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php index cd10534..d611d13 100644 --- a/plugins/data.attachment.php +++ b/plugins/data.attachment.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ * @package liberty * @subpackage plugins_data */ @@ -15,7 +15,7 @@ // +----------------------------------------------------------------------+ // | Authors: drewslater <andrew@andrewslater.com> // +----------------------------------------------------------------------+ -// $Id: data.attachment.php,v 1.20 2007/05/20 10:09:14 squareing Exp $ +// $Id: data.attachment.php,v 1.21 2007/06/01 09:02:37 squareing Exp $ /** * definitions @@ -149,7 +149,7 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had $pParams['link'] = $wp->getDisplayUrl( $pParams['page_name'] ); } - if( !empty( $wrapper['description'] ) && !empty( $pParams['output'] ) && ( $pParams['output'] == 'desc' || $pParams['output'] == 'description' ) ) { + if( !empty( $wrapper['description'] ) && !empty( $pParams['output'] ) && ( $pParams['output'] == 'desc' || $pParams['output'] == 'description' )) { $ret = ( !empty( $wrapper['description'] ) ? $wrapper['description'] : '' ); $nowrapper = TRUE; } else { @@ -175,10 +175,9 @@ function data_attachment( $pData, $pParams ) { // NOTE: The original plugin had } } - // finally, wrap the output with a span. this will avoid invalid markup if att placed inside paragraph or inline element + // finally, wrap the output. if( empty( $nowrapper )) { - $ret = - '<span class="'.( isset( $wrapper ) && !empty( $wrapper['class'] ) ? $wrapper['class'] : "att-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</span>'; + $ret = '<'.$wrapper['wrapper'].' class="'.( isset( $wrapper ) && !empty( $wrapper['class'] ) ? $wrapper['class'] : "att-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</'.$wrapper['wrapper'].'>'; } } else { $ret = tra( "The attachment id given is not valid." ); diff --git a/plugins/data.biticon.php b/plugins/data.biticon.php index 33ea0c5..8caa2fc 100644 --- a/plugins/data.biticon.php +++ b/plugins/data.biticon.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @package liberty * @subpackage plugins_data */ @@ -72,7 +72,7 @@ function data_biticon( $pData, $pParams ) { $wrapper = liberty_plugins_wrapper_style( $pParams, FALSE ); if( !empty( $wrapper['style'] ) ) { - $ret ='<span class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "biticon-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</span>'; + $ret ='<'.$wrapper['wrapper'].' class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "biticon-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'</'.$wrapper['wrapper'].'>'; } return $ret; } diff --git a/plugins/data.flashvideo.php b/plugins/data.flashvideo.php index 276ce30..5cd8bf1 100644 --- a/plugins/data.flashvideo.php +++ b/plugins/data.flashvideo.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ * @package liberty * @subpackage plugins_data */ @@ -15,7 +15,7 @@ // +----------------------------------------------------------------------+ // | Authors: drewslater <andrew@andrewslater.com> // +----------------------------------------------------------------------+ -// $Id: data.flashvideo.php,v 1.8 2007/05/20 10:09:14 squareing Exp $ +// $Id: data.flashvideo.php,v 1.9 2007/06/01 09:02:37 squareing Exp $ /** * definitions @@ -117,8 +117,8 @@ function data_flashvideo( $pData, $pParams ) { // NOTE: The original plugin had $gBitSmarty->assign( 'flv', $att ); $ret = $gBitSmarty->fetch( 'bitpackage:treasury/flv_player_inc.tpl' ); - // 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>'; + // finally, wrap the output + $ret = '<'.$wrapper['wrapper'].' class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "flashvideo-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.( !empty( $wrapper['description'] ) ? '<br />'.$wrapper['description'] : '' ).'</'.$wrapper['wrapper'].'>'; } 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 6cff61d..0d86082 100644 --- a/plugins/data.img.php +++ b/plugins/data.img.php @@ -1,7 +1,7 @@ <?php /** - * @version $Revision: 1.14 $ - * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.14 2007/05/20 10:09:14 squareing Exp $ + * @version $Revision: 1.15 $ + * $Header: /cvsroot/bitweaver/_bit_liberty/plugins/data.img.php,v 1.15 2007/06/01 09:02:37 squareing Exp $ * @package liberty * @subpackage plugins_data */ @@ -96,9 +96,9 @@ function data_img( $pData, $pParams ) { $ret = '<a href="'.trim( $wrapper['link'] ).'">'.$ret.'</a>'; } - // finally, wrap the image with a span + // finally, wrap the image 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>'; + $ret = '<'.$wrapper['wrapper'].' class="'.( !empty( $wrapper['class'] ) ? $wrapper['class'] : "img-plugin" ).'" style="'.$wrapper['style'].'">'.$ret.'<br />'.( !empty( $wrapper['description'] ) ? $wrapper['description'] : '' ).'</'.$wrapper['wrapper'].'>'; } } else { $ret = '<span class="warning">'.tra( 'When using <strong>{img}</strong> the <strong>src</strong> parameter is required.' ).'</span>'; |
