summaryrefslogtreecommitdiff
path: root/LibertySystem.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-12-13 18:01:38 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-12-13 18:01:38 +0000
commitc238c95cd8ecef0f0f5fec283c06cb630a4ed895 (patch)
treef994a151347ecd59ffd8e5fad9c65ba7c1a91565 /LibertySystem.php
parentd407aa21957b3e7eb5b1bcadf1364d775aab1092 (diff)
downloadliberty-c238c95cd8ecef0f0f5fec283c06cb630a4ed895.tar.gz
liberty-c238c95cd8ecef0f0f5fec283c06cb630a4ed895.tar.bz2
liberty-c238c95cd8ecef0f0f5fec283c06cb630a4ed895.zip
move div styling options to a common function for easy maintenance and modification
Diffstat (limited to 'LibertySystem.php')
-rwxr-xr-xLibertySystem.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 7c384fa..b211de5 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.48 2006/10/11 10:18:56 squareing Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.49 2006/12/13 18:01:37 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -593,4 +593,59 @@ function parse_data_plugins( &$data, &$preparsed, &$noparsed, &$pParser, &$pComm
global $gLibertySystem;
$gLibertySystem = new LibertySystem();
+
+
+
+// generic functions that make the life of a plugin easier
+/**
+ * pass in the plugin paramaters and out comes a hash with usable styling information
+ *
+ * @param array $pParamHash
+ * @access public
+ * @return hash full of styling goodies
+ */
+function liberty_plugins_div_style( $pParamHash ) {
+ $ret = array();
+ $ret['style'] = '';
+
+ 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';
+ case 'desc':
+ $key = 'description';
+ // these are used as-is
+ case 'float':
+ case 'padding':
+ case 'margin':
+ case 'background':
+ case 'border':
+ case 'text-align':
+ case 'color':
+ case 'font':
+ case 'font-size':
+ case 'font-weight':
+ case 'font-family':
+ $ret['style'] .= "$key:$value;";
+ break;
+ case 'align':
+ if( $value == 'center' || $value == 'middle' ) {
+ $ret['style'] .= 'text-align:center;';
+ } else {
+ $ret['style'] .= "float:$value;";
+ }
+ break;
+ default:
+ $ret[$key] = $value;
+ break;
+ }
+ }
+ }
+ }
+
+ return $ret;
+}
?>