'PRE', 'auto_activate' => false, 'requires_pair' => true, 'load_function' => '\data_pre', 'title' => 'Pre', 'help_page' => 'DataPluginPre', 'description' => KernelTools::tra( "This plugin allows you to easily create a preformatted text block with a number of optional CSS parameters." ), 'help_function' => '\data_pre_help', 'syntax' => "{pre border='3px solid blue'}", 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAPRE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAPRE ); function data_pre_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . KernelTools::tra( "Key" ) . '' . KernelTools::tra( "Type" ) . '' . KernelTools::tra( "Comments" ) . '
' . KernelTools::tra( "CSS rules" ) . '' . KernelTools::tra( "string") . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "This can be any CSS style rule. e.g.: ") . "border='3px solid blue'" .'
preset' . KernelTools::tra( "string") . '
' . KernelTools::tra( "(optional)" ) . '
' . KernelTools::tra( "There are a few presets, which you can use to style with. Presets include: dark, orange, red, blue, centered.") .'
' . KernelTools::tra( "Example: " ) . "{pre preset=centered border='3px solid blue'}"; return $help; } function data_pre( $pData, $pParams, $pCommonObject, $pParseHash ) { $style = ''; foreach( $pParams as $key => $value ) { if( !empty( $value ) ) { switch( $key ) { case 'preset': if( $value == 'dark' ) { $style .= 'background:#333;color:#ccc;border:2px solid #000;padding:0.5em 1em;margin:0.5em;'; } elseif( $value == "orange" ) { $style .= 'background:#f60;color:#fff;border:2px solid #900;padding:0.5em 1em;margin:0.5em;'; } elseif( $value == "red" ) { $style .= 'background:#eee;color:#900;border:2px solid #900;padding:0.5em 1em;margin:0.5em;'; } elseif( $value == "blue" ) { $style .= 'background:#def;color:#009;border:2px solid #acf;padding:0.5em 1em;margin:0.5em;'; } elseif( $value == "centered" ) { $style .= 'background:#eee;color:#333;border:2px solid #ddd;padding:0.5em 1em;margin:0.5em auto;width:50%;text-align:center;'; } break; case 'style': $style .= $value; break; case 'class': $class = $value; break; default: $style .= $key.':'.$value.';'; break; } } } $parseHash['content_id'] = $pParseHash['content_id']; $parseHash['user_id'] = $pParseHash['user_id']; $parseHash['no_cache'] = true; $parseHash['data'] = $pData; $ret = '
'.LibertyContent::parseDataHash( $parseHash, $pCommonObject ).'
'; return $ret; }