Source code for file /pattemplate/patTemplate/Modifier/Surround.php
Documentation is available at Surround.php
* patTemplate modfifier Surround
* $Id: Surround.php 297 2004-10-03 11:35:57Z gerd $
// Check to ensure this file is within the rest of the framework
* patTemplate modfifier Surround
* splits a text and surrunds each part by custom start and end strings
* Possible attributes are:
* - keepdelimiter (yes|no) default: no
* - withfirst (yes|no) default: yes
* - withlast (yes|no) default: yes
* @return string modified value
function modify( $value, $params =
array() )
if( isset
( $params['delimiter'] ) )
$delimiter =
$params['delimiter'];
if( isset
( $params['start'] ) )
$start =
$params['start'];
if( isset
( $params['end'] ) )
if( isset
( $params['keepdelimiter'] ) &&
$params['keepdelimiter'] ===
'yes' )
$split =
explode( $delimiter, $value );
$value =
implode( $end .
$start, $split );
if( !isset
( $params['withfirst'] ) ||
$params['withfirst'] !==
'no' )
$value =
$start .
$value;
if( !isset
( $params['withlast'] ) ||
$params['withlast'] !==
'no' )