Thursday 19 March 2009 1:35:04 pm
I wanted to modify the pad function (to allow for non-breaking spaces to be added) so I did a quick search for pad in the ezpublish code (using version 4.0.1). I noticed after some tinkering that the case for PadName under the function:
/*
The modify function takes care of the various operations.
*/
function modify( $tpl,
$operatorName,
$operatorParameters,
$rootNamespace,
$currentNamespace,
&$operatorValue,
$namedParameters,
$placement )
never gets used. It appears instead that the somewhat less friendly:
'pad' => array( 'return' => 'string',
'code' => '$result = $paramCount == 2 ? str_pad( $staticValues[0], $staticValues[1] ) : str_pad ( $staticValues[0], $staticValues[1], $staticValues[2] );',
'code2' => '$result = str_pad( $staticValues[0], $staticValues[1] );',
'code3' => '$result = str_pad( $staticValues[0], $staticValues[1], $staticValues[2] );',
),
Is what actually gets used to perform the pad operation. This seems like an ugly place to modify the pad behavior and I would like to adjust the code inside the modify function instead if possible. Can someone explain the purpose of the modify function and when it gets called? I found nothing in the documentation and the comment leaves a bit to be desired. Thanks in advance.
working at www.wardnet.com
blogging at www.jamesward.ca
|