2009-06-05 09:53:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ExtParserFunctions {
|
|
|
|
var $mExprParser;
|
|
|
|
var $mTimeCache = array();
|
|
|
|
var $mTimeChars = 0;
|
|
|
|
var $mMaxTimeChars = 6000; # ~10 seconds
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
function clearState( $parser ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$this->mTimeChars = 0;
|
|
|
|
$parser->pf_ifexist_breakdown = array();
|
|
|
|
$parser->pf_markerRegex = null;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the marker regex. Cached.
|
|
|
|
*/
|
|
|
|
function getMarkerRegex( $parser ) {
|
|
|
|
if ( isset( $parser->pf_markerRegex ) ) {
|
|
|
|
return $parser->pf_markerRegex;
|
|
|
|
}
|
|
|
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
|
$prefix = preg_quote( $parser->uniqPrefix(), '/' );
|
|
|
|
|
|
|
|
// The first line represents Parser from release 1.12 forward.
|
|
|
|
// subsequent lines are hacks to accomodate old Mediawiki versions.
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( defined( 'Parser::MARKER_SUFFIX' ) )
|
2009-06-05 09:53:05 +00:00
|
|
|
$suffix = preg_quote( Parser::MARKER_SUFFIX, '/' );
|
2010-10-02 22:36:34 +00:00
|
|
|
elseif ( isset( $parser->mMarkerSuffix ) )
|
2009-06-05 09:53:05 +00:00
|
|
|
$suffix = preg_quote( $parser->mMarkerSuffix, '/' );
|
2010-10-02 22:36:34 +00:00
|
|
|
elseif ( defined( 'MW_PARSER_VERSION' ) &&
|
2009-06-05 09:53:05 +00:00
|
|
|
strcmp( MW_PARSER_VERSION, '1.6.1' ) > 0 )
|
|
|
|
$suffix = "QINU\x07";
|
|
|
|
else $suffix = 'QINU';
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
$parser->pf_markerRegex = '/' . $prefix . '(?:(?!' . $suffix . ').)*' . $suffix . '/us';
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $parser->pf_markerRegex;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Removes unique markers from passed parameters, used by string functions.
|
|
|
|
private function killMarkers ( $parser, $text ) {
|
|
|
|
return preg_replace( $this->getMarkerRegex( $parser ), '' , $text );
|
|
|
|
}
|
|
|
|
|
2011-01-14 00:40:30 +00:00
|
|
|
/**
|
|
|
|
* @return ExprParser
|
|
|
|
*/
|
2009-06-05 09:53:05 +00:00
|
|
|
function &getExprParser() {
|
|
|
|
if ( !isset( $this->mExprParser ) ) {
|
|
|
|
$this->mExprParser = new ExprParser;
|
|
|
|
}
|
|
|
|
return $this->mExprParser;
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function expr( $parser, $expr = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
try {
|
|
|
|
return $this->getExprParser()->doExpression( $expr );
|
2010-10-02 22:36:34 +00:00
|
|
|
} catch ( ExprError $e ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifexpr( $parser, $expr = '', $then = '', $else = '' ) {
|
2010-10-02 22:36:34 +00:00
|
|
|
try {
|
2010-03-18 11:35:28 +00:00
|
|
|
$ret = $this->getExprParser()->doExpression( $expr );
|
|
|
|
if ( is_numeric( $ret ) ) {
|
|
|
|
$ret = floatval( $ret );
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $ret ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $then;
|
|
|
|
} else {
|
|
|
|
return $else;
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
} catch ( ExprError $e ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ifexprObj( $parser, $frame, $args ) {
|
|
|
|
$expr = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
|
|
|
$then = isset( $args[1] ) ? $args[1] : '';
|
|
|
|
$else = isset( $args[2] ) ? $args[2] : '';
|
|
|
|
$result = $this->ifexpr( $parser, $expr, $then, $else );
|
|
|
|
if ( is_object( $result ) ) {
|
|
|
|
$result = trim( $frame->expand( $result ) );
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifHook( $parser, $test = '', $then = '', $else = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $test !== '' ) {
|
|
|
|
return $then;
|
|
|
|
} else {
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifObj( $parser, $frame, $args ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
|
|
|
if ( $test !== '' ) {
|
|
|
|
return isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : '';
|
|
|
|
} else {
|
|
|
|
return isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifeq( $parser, $left = '', $right = '', $then = '', $else = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $left == $right ) {
|
|
|
|
return $then;
|
|
|
|
} else {
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifeqObj( $parser, $frame, $args ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$left = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
|
|
|
$right = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : '';
|
|
|
|
if ( $left == $right ) {
|
|
|
|
return isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
|
|
|
|
} else {
|
|
|
|
return isset( $args[3] ) ? trim( $frame->expand( $args[3] ) ) : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function iferror( $parser, $test = '', $then = '', $else = false ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( preg_match( '/<(?:strong|span|p|div)\s(?:[^\s>]*\s+)*?class="(?:[^"\s>]*\s+)*?error(?:\s[^">]*)?"/', $test ) ) {
|
|
|
|
return $then;
|
|
|
|
} elseif ( $else === false ) {
|
|
|
|
return $test;
|
|
|
|
} else {
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function iferrorObj( $parser, $frame, $args ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
|
|
|
$then = isset( $args[1] ) ? $args[1] : false;
|
|
|
|
$else = isset( $args[2] ) ? $args[2] : false;
|
|
|
|
$result = $this->iferror( $parser, $test, $then, $else );
|
|
|
|
if ( $result === false ) {
|
|
|
|
return '';
|
|
|
|
} else {
|
|
|
|
return trim( $frame->expand( $result ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function switchHook( $parser /*,...*/ ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
array_shift( $args );
|
2010-10-02 22:36:34 +00:00
|
|
|
$primary = trim( array_shift( $args ) );
|
2009-06-05 17:14:03 +00:00
|
|
|
$found = $defaultFound = false;
|
2009-06-05 09:53:05 +00:00
|
|
|
$parts = null;
|
|
|
|
$default = null;
|
|
|
|
$mwDefault =& MagicWord::get( 'default' );
|
2010-10-02 22:36:34 +00:00
|
|
|
foreach ( $args as $arg ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$parts = array_map( 'trim', explode( '=', $arg, 2 ) );
|
|
|
|
if ( count( $parts ) == 2 ) {
|
|
|
|
# Found "="
|
|
|
|
if ( $found || $parts[0] == $primary ) {
|
|
|
|
# Found a match, return now
|
|
|
|
return $parts[1];
|
2009-06-05 17:14:03 +00:00
|
|
|
} elseif ( $defaultFound || $mwDefault->matchStartAndRemove( $parts[0] ) ) {
|
2009-06-05 16:31:43 +00:00
|
|
|
$default = $parts[1];
|
|
|
|
} # else wrong case, continue
|
2009-06-05 09:53:05 +00:00
|
|
|
} elseif ( count( $parts ) == 1 ) {
|
|
|
|
# Multiple input, single output
|
|
|
|
# If the value matches, set a flag and continue
|
|
|
|
if ( $parts[0] == $primary ) {
|
|
|
|
$found = true;
|
2009-06-05 17:14:03 +00:00
|
|
|
} elseif ( $mwDefault->matchStartAndRemove( $parts[0] ) ) {
|
|
|
|
$defaultFound = true;
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
} # else RAM corruption due to cosmic ray?
|
|
|
|
}
|
|
|
|
# Default case
|
|
|
|
# Check if the last item had no = sign, thus specifying the default case
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( count( $parts ) == 1 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $parts[0];
|
|
|
|
} elseif ( !is_null( $default ) ) {
|
|
|
|
return $default;
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchObj( $parser, $frame, $args ) {
|
|
|
|
if ( count( $args ) == 0 ) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
$primary = trim( $frame->expand( array_shift( $args ) ) );
|
2009-06-05 16:53:59 +00:00
|
|
|
$found = $defaultFound = false;
|
2009-06-05 09:53:05 +00:00
|
|
|
$default = null;
|
|
|
|
$lastItemHadNoEquals = false;
|
|
|
|
$mwDefault =& MagicWord::get( 'default' );
|
|
|
|
foreach ( $args as $arg ) {
|
|
|
|
$bits = $arg->splitArg();
|
|
|
|
$nameNode = $bits['name'];
|
|
|
|
$index = $bits['index'];
|
|
|
|
$valueNode = $bits['value'];
|
|
|
|
|
|
|
|
if ( $index === '' ) {
|
|
|
|
# Found "="
|
|
|
|
$lastItemHadNoEquals = false;
|
|
|
|
if ( $found ) {
|
|
|
|
# Multiple input match
|
|
|
|
return trim( $frame->expand( $valueNode ) );
|
|
|
|
} else {
|
2010-03-20 16:39:03 +00:00
|
|
|
$test = trim( $frame->expand( $nameNode ) );
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $test == $primary ) {
|
|
|
|
# Found a match, return now
|
|
|
|
return trim( $frame->expand( $valueNode ) );
|
2009-06-05 16:53:59 +00:00
|
|
|
} elseif ( $defaultFound || $mwDefault->matchStartAndRemove( $test ) ) {
|
2009-06-05 16:31:43 +00:00
|
|
|
$default = $valueNode;
|
|
|
|
} # else wrong case, continue
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Multiple input, single output
|
|
|
|
# If the value matches, set a flag and continue
|
|
|
|
$lastItemHadNoEquals = true;
|
|
|
|
$test = trim( $frame->expand( $valueNode ) );
|
|
|
|
if ( $test == $primary ) {
|
|
|
|
$found = true;
|
2009-06-05 16:53:59 +00:00
|
|
|
} elseif ( $mwDefault->matchStartAndRemove( $test ) ) {
|
|
|
|
$defaultFound = true;
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Default case
|
|
|
|
# Check if the last item had no = sign, thus specifying the default case
|
|
|
|
if ( $lastItemHadNoEquals ) {
|
|
|
|
return $test;
|
|
|
|
} elseif ( !is_null( $default ) ) {
|
|
|
|
return trim( $frame->expand( $default ) );
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the absolute path to a subpage, relative to the current article
|
|
|
|
* title. Treats titles as slash-separated paths.
|
|
|
|
*
|
|
|
|
* Following subpage link syntax instead of standard path syntax, an
|
|
|
|
* initial slash is treated as a relative path, and vice versa.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
public function rel2abs( $parser , $to = '' , $from = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
$from = trim( $from );
|
|
|
|
if ( $from == '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$from = $parser->getTitle()->getPrefixedText();
|
|
|
|
}
|
|
|
|
|
|
|
|
$to = rtrim( $to , ' /' );
|
|
|
|
|
|
|
|
// if we have an empty path, or just one containing a dot
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $to == '' || $to == '.' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $from;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if the path isn't relative
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( substr( $to , 0 , 1 ) != '/' &&
|
|
|
|
substr( $to , 0 , 2 ) != './' &&
|
|
|
|
substr( $to , 0 , 3 ) != '../' &&
|
2009-06-05 09:53:05 +00:00
|
|
|
$to != '..' )
|
|
|
|
{
|
|
|
|
$from = '';
|
|
|
|
}
|
|
|
|
// Make a long path, containing both, enclose it in /.../
|
|
|
|
$fullPath = '/' . $from . '/' . $to . '/';
|
|
|
|
|
|
|
|
// remove redundant current path dots
|
|
|
|
$fullPath = preg_replace( '!/(\./)+!', '/', $fullPath );
|
|
|
|
|
|
|
|
// remove double slashes
|
|
|
|
$fullPath = preg_replace( '!/{2,}!', '/', $fullPath );
|
|
|
|
|
|
|
|
// remove the enclosing slashes now
|
|
|
|
$fullPath = trim( $fullPath , '/' );
|
|
|
|
$exploded = explode ( '/' , $fullPath );
|
|
|
|
$newExploded = array();
|
|
|
|
|
|
|
|
foreach ( $exploded as $current ) {
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $current == '..' ) { // removing one level
|
|
|
|
if ( !count( $newExploded ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
// attempted to access a node above root node
|
|
|
|
return '<strong class="error">' . wfMsgForContent( 'pfunc_rel2abs_invalid_depth', $fullPath ) . '</strong>';
|
|
|
|
}
|
|
|
|
// remove last level from the stack
|
|
|
|
array_pop( $newExploded );
|
|
|
|
} else {
|
|
|
|
// add the current level to the stack
|
|
|
|
$newExploded[] = $current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// we can now join it again
|
|
|
|
return implode( '/' , $newExploded );
|
|
|
|
}
|
|
|
|
|
|
|
|
function incrementIfexistCount( $parser, $frame ) {
|
|
|
|
// Don't let this be called more than a certain number of times. It tends to make the database explode.
|
|
|
|
global $wgExpensiveParserFunctionLimit;
|
|
|
|
$parser->mExpensiveFunctionCount++;
|
|
|
|
if ( $frame ) {
|
|
|
|
$pdbk = $frame->getPDBK( 1 );
|
|
|
|
if ( !isset( $parser->pf_ifexist_breakdown[$pdbk] ) ) {
|
|
|
|
$parser->pf_ifexist_breakdown[$pdbk] = 0;
|
|
|
|
}
|
|
|
|
$parser->pf_ifexist_breakdown[$pdbk] ++;
|
|
|
|
}
|
|
|
|
return $parser->mExpensiveFunctionCount <= $wgExpensiveParserFunctionLimit;
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifexist( $parser, $title = '', $then = '', $else = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $this->ifexistCommon( $parser, false, $title, $then, $else );
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifexistCommon( $parser, $frame, $titletext = '', $then = '', $else = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
global $wgContLang;
|
|
|
|
$title = Title::newFromText( $titletext );
|
|
|
|
$wgContLang->findVariantLink( $titletext, $title, true );
|
|
|
|
if ( $title ) {
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $title->getNamespace() == NS_MEDIA ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
/* If namespace is specified as NS_MEDIA, then we want to
|
|
|
|
* check the physical file, not the "description" page.
|
|
|
|
*/
|
|
|
|
if ( !$this->incrementIfexistCount( $parser, $frame ) ) {
|
|
|
|
return $else;
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
$file = wfFindFile( $title );
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( !$file ) {
|
|
|
|
return $else;
|
|
|
|
}
|
2011-04-04 01:22:08 +00:00
|
|
|
$parser->mOutput->addImage(
|
|
|
|
$file->getName(), $file->getTimestamp(), $file->getSha1() );
|
2009-06-05 09:53:05 +00:00
|
|
|
return $file->exists() ? $then : $else;
|
2010-10-02 22:36:34 +00:00
|
|
|
} elseif ( $title->getNamespace() == NS_SPECIAL ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
/* Don't bother with the count for special pages,
|
|
|
|
* since their existence can be checked without
|
|
|
|
* accessing the database.
|
|
|
|
*/
|
|
|
|
return SpecialPage::exists( $title->getDBkey() ) ? $then : $else;
|
2010-10-02 22:36:34 +00:00
|
|
|
} elseif ( $title->isExternal() ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
/* Can't check the existence of pages on other sites,
|
|
|
|
* so just return $else. Makes a sort of sense, since
|
|
|
|
* they don't exist _locally_.
|
|
|
|
*/
|
|
|
|
return $else;
|
|
|
|
} else {
|
|
|
|
$pdbk = $title->getPrefixedDBkey();
|
|
|
|
$lc = LinkCache::singleton();
|
|
|
|
if ( !$this->incrementIfexistCount( $parser, $frame ) ) {
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
if ( 0 != ( $id = $lc->getGoodLinkID( $pdbk ) ) ) {
|
|
|
|
$parser->mOutput->addLink( $title, $id );
|
|
|
|
return $then;
|
|
|
|
} elseif ( $lc->isBadLink( $pdbk ) ) {
|
|
|
|
$parser->mOutput->addLink( $title, 0 );
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
$id = $title->getArticleID();
|
|
|
|
$parser->mOutput->addLink( $title, $id );
|
|
|
|
if ( $id ) {
|
|
|
|
return $then;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $else;
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function ifexistObj( $parser, $frame, $args ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$title = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
|
|
|
$then = isset( $args[1] ) ? $args[1] : null;
|
|
|
|
$else = isset( $args[2] ) ? $args[2] : null;
|
|
|
|
|
|
|
|
$result = $this->ifexistCommon( $parser, $frame, $title, $then, $else );
|
|
|
|
if ( $result === null ) {
|
|
|
|
return '';
|
|
|
|
} else {
|
|
|
|
return trim( $frame->expand( $result ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function time( $parser, $format = '', $date = '', $local = false ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
global $wgContLang, $wgLocaltimezone;
|
|
|
|
if ( isset( $this->mTimeCache[$format][$date][$local] ) ) {
|
|
|
|
return $this->mTimeCache[$format][$date][$local];
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
# compute the timestamp string $ts
|
|
|
|
# PHP >= 5.2 can handle dates before 1970 or after 2038 using the DateTime object
|
|
|
|
# PHP < 5.2 is limited to dates between 1970 and 2038
|
|
|
|
|
2009-06-05 09:53:05 +00:00
|
|
|
$invalidTime = false;
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
if ( class_exists( 'DateTime' ) ) { # PHP >= 5.2
|
|
|
|
# the DateTime constructor must be used because it throws exceptions
|
|
|
|
# when errors occur, whereas date_create appears to just output a warning
|
2009-06-05 09:53:05 +00:00
|
|
|
# that can't really be detected from within the code
|
|
|
|
try {
|
|
|
|
# Determine timezone
|
|
|
|
if ( $local ) {
|
|
|
|
# convert to MediaWiki local timezone if set
|
|
|
|
if ( isset( $wgLocaltimezone ) ) {
|
|
|
|
$tz = new DateTimeZone( $wgLocaltimezone );
|
|
|
|
} else {
|
2010-01-08 01:51:00 +00:00
|
|
|
$tz = new DateTimeZone( date_default_timezone_get() );
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# if local time was not requested, convert to UTC
|
|
|
|
$tz = new DateTimeZone( 'UTC' );
|
|
|
|
}
|
|
|
|
|
|
|
|
# Parse date
|
|
|
|
if ( $date !== '' ) {
|
|
|
|
$dateObject = new DateTime( $date, $tz );
|
|
|
|
} else {
|
|
|
|
# use current date and time
|
|
|
|
$dateObject = new DateTime( 'now', $tz );
|
|
|
|
}
|
|
|
|
|
|
|
|
# Generate timestamp
|
|
|
|
$ts = $dateObject->format( 'YmdHis' );
|
2010-10-02 22:36:34 +00:00
|
|
|
} catch ( Exception $ex ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$invalidTime = true;
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
} else { # PHP < 5.2
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $date !== '' ) {
|
|
|
|
$unix = @strtotime( $date );
|
|
|
|
} else {
|
|
|
|
$unix = time();
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $unix == -1 || $unix == false ) {
|
|
|
|
$invalidTime = true;
|
|
|
|
} else {
|
|
|
|
if ( $local ) {
|
|
|
|
# Use the time zone
|
|
|
|
if ( isset( $wgLocaltimezone ) ) {
|
|
|
|
$oldtz = getenv( 'TZ' );
|
2010-10-02 22:36:34 +00:00
|
|
|
putenv( 'TZ=' . $wgLocaltimezone );
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
wfSuppressWarnings(); // E_STRICT system time bitching
|
|
|
|
$ts = date( 'YmdHis', $unix );
|
|
|
|
wfRestoreWarnings();
|
|
|
|
if ( isset( $wgLocaltimezone ) ) {
|
2010-10-02 22:36:34 +00:00
|
|
|
putenv( 'TZ=' . $oldtz );
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$ts = wfTimestamp( TS_MW, $unix );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
# format the timestamp and return the result
|
2009-06-05 09:53:05 +00:00
|
|
|
if ( $invalidTime ) {
|
|
|
|
$result = '<strong class="error">' . wfMsgForContent( 'pfunc_time_error' ) . '</strong>';
|
|
|
|
} else {
|
|
|
|
$this->mTimeChars += strlen( $format );
|
|
|
|
if ( $this->mTimeChars > $this->mMaxTimeChars ) {
|
|
|
|
return '<strong class="error">' . wfMsgForContent( 'pfunc_time_too_long' ) . '</strong>';
|
|
|
|
} else {
|
2010-10-02 22:36:34 +00:00
|
|
|
$result = $wgContLang->sprintfDate( $format, $ts );
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->mTimeCache[$format][$date][$local] = $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2010-04-16 11:00:07 +00:00
|
|
|
function localTime( $parser, $format = '', $date = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
return $this->time( $parser, $format, $date, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a specified number of slash-separated parts of a title,
|
|
|
|
* e.g. {{#titleparts:Hello/World|1}} => "Hello"
|
|
|
|
*
|
|
|
|
* @param Parser $parser Parent parser
|
|
|
|
* @param string $title Title to split
|
|
|
|
* @param int $parts Number of parts to keep
|
|
|
|
* @param int $offset Offset starting at 1
|
|
|
|
* @return string
|
|
|
|
*/
|
2010-10-02 22:36:34 +00:00
|
|
|
public function titleparts( $parser, $title = '', $parts = 0, $offset = 0 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$parts = intval( $parts );
|
|
|
|
$offset = intval( $offset );
|
|
|
|
$ntitle = Title::newFromText( $title );
|
|
|
|
if ( $ntitle instanceof Title ) {
|
|
|
|
$bits = explode( '/', $ntitle->getPrefixedText(), 25 );
|
|
|
|
if ( count( $bits ) <= 0 ) {
|
|
|
|
return $ntitle->getPrefixedText();
|
|
|
|
} else {
|
|
|
|
if ( $offset > 0 ) {
|
|
|
|
--$offset;
|
|
|
|
}
|
|
|
|
if ( $parts == 0 ) {
|
|
|
|
return implode( '/', array_slice( $bits, $offset ) );
|
|
|
|
} else {
|
|
|
|
return implode( '/', array_slice( $bits, $offset, $parts ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
(bug 235) parser function for conversion of units of measurement.
[[Template:Convert]] on enwiki is a behemoth of a construction that just about manages to do this sort of conversion, taking {{convert|5|mi|km}} and outputting "5 miles (8 km)", etc. To port this to another wiki requires copying over three and a half thousand subtemplates. The additional load produced by including numerous copies of this template is measurable on large pages on enwiki, and it eats voraciously into the template limits.
This revision introduces {{#convert: 5 mi | km }}, outputting "8 km" or thereabouts. See http://www.mediawiki.org/wiki/User:Happy-melon/Convert for more details, or look at the examples in the parser tests.
In a very rough profile, comparing 50 calls to {{convert}} verses the same 50 calls to the wrapper template shown at the link above, the parser function implementation reduces page load time by 72%, preprocessor node count by 83%, post-expand include size by 86% and template argument size by 97%. More detailed profiling would probably reveal places where extra caching could improve performance further.
The primary reason for putting it in ParserFunctions instead of its own extension is availability: PFs are already available across the cluster, and it's accepted as an essential extension for any wiki wishing to emulate or mirror WMF content. One less separate extension installed on the cluster is one less extension which has to be matched by reusers.
It's still missing a lot of units, which I ran out of patience to copy from {{convert}}; I thought I'd get some feedback on the infrastructure first.
2011-01-27 00:13:10 +00:00
|
|
|
/**
|
|
|
|
* Get a ConvertParser object
|
|
|
|
* @return ConvertParser
|
|
|
|
*/
|
|
|
|
protected function &getConvertParser() {
|
|
|
|
if ( !isset( $this->mConvertParser ) ) {
|
|
|
|
$this->mConvertParser = new ConvertParser;
|
|
|
|
}
|
|
|
|
return $this->mConvertParser;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function convert( /*...*/ ) {
|
|
|
|
try {
|
|
|
|
$args = func_get_args();
|
|
|
|
return $this->getConvertParser()->execute( $args );
|
|
|
|
} catch ( ConvertError $e ) {
|
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-05 09:53:05 +00:00
|
|
|
// Verifies parameter is less than max string length.
|
|
|
|
private function checkLength( $text ) {
|
|
|
|
global $wgPFStringLengthLimit;
|
|
|
|
return ( mb_strlen( $text ) < $wgPFStringLengthLimit );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generates error message. Called when string is too long.
|
|
|
|
private function tooLongError() {
|
|
|
|
global $wgPFStringLengthLimit, $wgContLang;
|
2010-10-02 22:36:34 +00:00
|
|
|
return '<strong class="error">' .
|
2009-06-05 09:53:05 +00:00
|
|
|
wfMsgExt( 'pfunc_string_too_long',
|
2010-10-02 22:36:34 +00:00
|
|
|
array( 'escape', 'parsemag', 'content' ),
|
2009-06-05 09:53:05 +00:00
|
|
|
$wgContLang->formatNum( $wgPFStringLengthLimit ) ) .
|
|
|
|
'</strong>';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#len:string}}
|
2010-10-02 22:36:34 +00:00
|
|
|
*
|
2009-06-05 09:53:05 +00:00
|
|
|
* Reports number of characters in string.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
function runLen ( $parser, $inStr = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$len = mb_strlen( $inStr );
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#pos: string | needle | offset}}
|
|
|
|
*
|
|
|
|
* Finds first occurrence of "needle" in "string" starting at "offset".
|
|
|
|
*
|
|
|
|
* Note: If the needle is an empty string, single space is used instead.
|
|
|
|
* Note: If the needle is not found, empty string is returned.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
function runPos ( $parser, $inStr = '', $inNeedle = '', $inOffset = 0 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$inNeedle = $this->killMarkers( $parser, (string)$inNeedle );
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
if ( !$this->checkLength( $inStr ) ||
|
2009-06-05 09:53:05 +00:00
|
|
|
!$this->checkLength( $inNeedle ) ) {
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $inNeedle == '' ) { $inNeedle = ' '; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
$pos = mb_strpos( $inStr, $inNeedle, $inOffset );
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $pos === false ) { $pos = ""; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#rpos: string | needle}}
|
|
|
|
*
|
|
|
|
* Finds last occurrence of "needle" in "string".
|
|
|
|
*
|
|
|
|
* Note: If the needle is an empty string, single space is used instead.
|
|
|
|
* Note: If the needle is not found, -1 is returned.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
function runRPos ( $parser, $inStr = '', $inNeedle = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$inNeedle = $this->killMarkers( $parser, (string)$inNeedle );
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
if ( !$this->checkLength( $inStr ) ||
|
2009-06-05 09:53:05 +00:00
|
|
|
!$this->checkLength( $inNeedle ) ) {
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $inNeedle == '' ) { $inNeedle = ' '; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
$pos = mb_strrpos( $inStr, $inNeedle );
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $pos === false ) { $pos = -1; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#sub: string | start | length }}
|
|
|
|
*
|
|
|
|
* Returns substring of "string" starting at "start" and having
|
2010-10-02 22:36:34 +00:00
|
|
|
* "length" characters.
|
2009-06-05 09:53:05 +00:00
|
|
|
*
|
|
|
|
* Note: If length is zero, the rest of the input is returned.
|
2010-10-02 22:36:34 +00:00
|
|
|
* Note: A negative value for "start" operates from the end of the
|
2009-06-05 09:53:05 +00:00
|
|
|
* "string".
|
|
|
|
* Note: A negative value for "length" returns a string reduced in
|
|
|
|
* length by that amount.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
function runSub ( $parser, $inStr = '', $inStart = 0, $inLength = 0 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( !$this->checkLength( $inStr ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
if ( intval( $inLength ) == 0 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$result = mb_substr( $inStr, $inStart );
|
|
|
|
} else {
|
|
|
|
$result = mb_substr( $inStr, $inStart, $inLength );
|
|
|
|
}
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2010-10-02 22:36:34 +00:00
|
|
|
return $result;
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#count: string | substr }}
|
|
|
|
*
|
|
|
|
* Returns number of occurrences of "substr" in "string".
|
|
|
|
*
|
|
|
|
* Note: If "substr" is empty, a single space is used.
|
|
|
|
*/
|
2010-04-16 11:00:07 +00:00
|
|
|
function runCount ( $parser, $inStr = '', $inSubStr = '' ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$inSubStr = $this->killMarkers( $parser, (string)$inSubStr );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( !$this->checkLength( $inStr ) ||
|
2009-06-05 09:53:05 +00:00
|
|
|
!$this->checkLength( $inSubStr ) ) {
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $inSubStr == '' ) { $inSubStr = ' '; }
|
|
|
|
|
2009-06-05 09:53:05 +00:00
|
|
|
$result = mb_substr_count( $inStr, $inSubStr );
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2010-10-02 22:36:34 +00:00
|
|
|
return $result;
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#replace:string | from | to | limit }}
|
|
|
|
*
|
|
|
|
* Replaces each occurrence of "from" in "string" with "to".
|
|
|
|
* At most "limit" replacements are performed.
|
2010-10-02 22:36:34 +00:00
|
|
|
*
|
2009-06-05 09:53:05 +00:00
|
|
|
* Note: Armored against replacements that would generate huge strings.
|
|
|
|
* Note: If "from" is an empty string, single space is used instead.
|
|
|
|
*/
|
2010-10-02 22:36:34 +00:00
|
|
|
function runReplace( $parser, $inStr = '',
|
2009-06-05 09:53:05 +00:00
|
|
|
$inReplaceFrom = '', $inReplaceTo = '', $inLimit = -1 ) {
|
|
|
|
global $wgPFStringLengthLimit;
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$inReplaceFrom = $this->killMarkers( $parser, (string)$inReplaceFrom );
|
|
|
|
$inReplaceTo = $this->killMarkers( $parser, (string)$inReplaceTo );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( !$this->checkLength( $inStr ) ||
|
2009-06-05 09:53:05 +00:00
|
|
|
!$this->checkLength( $inReplaceFrom ) ||
|
2010-10-02 22:36:34 +00:00
|
|
|
!$this->checkLength( $inReplaceTo ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $inReplaceFrom == '' ) { $inReplaceFrom = ' '; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
|
|
|
// Precompute limit to avoid generating enormous string:
|
|
|
|
$diff = mb_strlen( $inReplaceTo ) - mb_strlen( $inReplaceFrom );
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $diff > 0 ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$limit = ( ( $wgPFStringLengthLimit - mb_strlen( $inStr ) ) / $diff ) + 1;
|
|
|
|
} else {
|
|
|
|
$limit = -1;
|
|
|
|
}
|
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
$inLimit = intval( $inLimit );
|
|
|
|
if ( $inLimit >= 0 ) {
|
|
|
|
if ( $limit > $inLimit || $limit == -1 ) { $limit = $inLimit; }
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Use regex to allow limit and handle UTF-8 correctly.
|
|
|
|
$inReplaceFrom = preg_quote( $inReplaceFrom, '/' );
|
2010-01-27 11:25:23 +00:00
|
|
|
$inReplaceTo = StringUtils::escapeRegexReplacement( $inReplaceTo );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
$result = preg_replace( '/' . $inReplaceFrom . '/u',
|
|
|
|
$inReplaceTo, $inStr, $limit );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( !$this->checkLength( $result ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-08-08 16:18:33 +00:00
|
|
|
* {{#explode:string | delimiter | position | limit}}
|
2009-06-05 09:53:05 +00:00
|
|
|
*
|
|
|
|
* Breaks "string" into chunks separated by "delimiter" and returns the
|
|
|
|
* chunk identified by "position".
|
|
|
|
*
|
|
|
|
* Note: Negative position can be used to specify tokens from the end.
|
|
|
|
* Note: If the divider is an empty string, single space is used instead.
|
|
|
|
* Note: Empty string is returned if there are not enough exploded chunks.
|
|
|
|
*/
|
2010-08-08 16:18:33 +00:00
|
|
|
function runExplode ( $parser, $inStr = '', $inDiv = '', $inPos = 0, $inLim = null ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
2009-06-11 03:05:49 +00:00
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
$inDiv = $this->killMarkers( $parser, (string)$inDiv );
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( $inDiv == '' ) { $inDiv = ' '; }
|
2009-06-05 09:53:05 +00:00
|
|
|
|
2010-10-02 22:36:34 +00:00
|
|
|
if ( !$this->checkLength( $inStr ) ||
|
|
|
|
!$this->checkLength( $inDiv ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
|
|
|
$inDiv = preg_quote( $inDiv, '/' );
|
2010-10-02 22:36:34 +00:00
|
|
|
|
|
|
|
$matches = preg_split( '/' . $inDiv . '/u', $inStr, $inLim );
|
|
|
|
|
|
|
|
if ( $inPos >= 0 && isset( $matches[$inPos] ) ) {
|
2009-06-05 09:53:05 +00:00
|
|
|
$result = $matches[$inPos];
|
2010-10-02 22:36:34 +00:00
|
|
|
} elseif ( $inPos < 0 && isset( $matches[count( $matches ) + $inPos] ) ) {
|
|
|
|
$result = $matches[count( $matches ) + $inPos];
|
2009-06-05 09:53:05 +00:00
|
|
|
} else {
|
|
|
|
$result = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $result;
|
|
|
|
}
|
2010-05-29 16:12:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* {{#urldecode:string}}
|
|
|
|
*
|
|
|
|
* Decodes URL-encoded (like%20that) strings.
|
|
|
|
*/
|
|
|
|
function runUrlDecode( $parser, $inStr = '' ) {
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
|
$inStr = $this->killMarkers( $parser, (string)$inStr );
|
|
|
|
if ( !$this->checkLength( $inStr ) ) {
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $this->tooLongError();
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = urldecode( $inStr );
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
return $result;
|
|
|
|
}
|
2009-06-05 09:53:05 +00:00
|
|
|
}
|