Source for file data.span.php
Documentation is available at data.span.php
* @subpackage plugins_data
* @copyright Copyright (c) 2004, bitweaver.org
define( 'PLUGIN_GUID_DATAspan', 'dataspan' );
'auto_activate' => FALSE,
'load_function' => 'data_span',
'help_page' => 'DataPluginspan',
'description' => tra( "This plugin allows you to easily create a span with a number of optional CSS parameters." ),
'help_function' => 'data_span_help',
'syntax' => "{span border='3px solid blue'}",
'<table class="data help">'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "CSS rules or class" ) . '</td>'
. '<td>' . tra( "string") . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "This can be any CSS style rule. e.g.: ") . "font='small-caps 250% serif'" . '</td>'
. '<td>' . tra( "string") . '<br />' . tra( "(optional)" ) . '</td>'
. '<td>' . tra( "There are a few presets, which you can use to style with. Presets include: caps, smallcaps, big, small, strikethrough, overline, spaced, nodecor.") . '</td>'
. tra( "Example: " ) . "{span preset=overline font='small-caps 250% serif'}";
function data_span( $pData, $pParams, $pCommonObject ) {
foreach( $pParams as $key => $value ) {
$style .= 'text-transform: uppercase;';
} elseif( $value == "smallcaps" ) {
$style .= 'font-variant: small-caps;';
} elseif( $value == "big" ) {
$style .= 'font-size: larger;';
} elseif( $value == "small" ) {
$style .= 'font-size: smaller;';
} elseif( $value == "strikethrough" ) {
$style .= 'text-decoration: line-through;';
} elseif( $value == "spaced" ) {
$style .= 'letter-spacing: 1.5em;';
} elseif( $value == "overline" ) {
$style .= 'text-decoration: overline;';
} elseif( $value == "nodecor" ) {
$style .= 'text-decoration: none;';
$style .= $key. ':'. $value. ';';
// we need to parse the data. we shouldn't cache this to avoid problems with the regular cache file
$parseHash = $pCommonObject->mInfo;
$parseHash['no_cache'] = TRUE;
$parseHash['data'] = $pData;
$parsedData = $pCommonObject->parseData( $parseHash );
$parsedData = preg_replace( '|<br\s*/?>$|', '', $parsedData );
return( '<span '. ( !empty( $class ) ? 'class="'. $class. '" ' : '' ). 'style="'. $style. '">'. $parsedData. '</span>' );
|