dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
46c335f
)
Remark static functions for performance. Same 15 test failures as before this change.
author
Aaron Schulz
<aaron@users.mediawiki.org>
Wed, 20 Aug 2008 01:03:01 +0000
(
01:03
+0000)
committer
Aaron Schulz
<aaron@users.mediawiki.org>
Wed, 20 Aug 2008 01:03:01 +0000
(
01:03
+0000)
includes/parser/Parser.php
patch
|
blob
|
history
diff --git
a/includes/parser/Parser.php
b/includes/parser/Parser.php
index
5f97184
..
0e94c99
100644
(file)
--- a/
includes/parser/Parser.php
+++ b/
includes/parser/Parser.php
@@
-512,7
+512,7
@@
class Parser
* @public
* @static
*/
* @public
* @static
*/
- function extractTagsAndParams($elements, $text, &$matches, $uniq_prefix = ''){
+
static
function extractTagsAndParams($elements, $text, &$matches, $uniq_prefix = ''){
static $n = 1;
$stripped = '';
$matches = array();
static $n = 1;
$stripped = '';
$matches = array();
@@
-652,7
+652,7
@@
class Parser
* @public
* @static
*/
* @public
* @static
*/
- function tidy( $text ) {
+
static
function tidy( $text ) {
global $wgTidyInternal;
$wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'.
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>'.
global $wgTidyInternal;
$wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'.
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>'.
@@
-675,7
+675,7
@@
class Parser
* @private
* @static
*/
* @private
* @static
*/
- function externalTidy( $text ) {
+
static
function externalTidy( $text ) {
global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
$fname = 'Parser::externalTidy';
wfProfileIn( $fname );
global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
$fname = 'Parser::externalTidy';
wfProfileIn( $fname );
@@
-727,7
+727,7
@@
class Parser
* @private
* @static
*/
* @private
* @static
*/
- function internalTidy( $text ) {
+
static
function internalTidy( $text ) {
global $wgTidyConf, $IP, $wgDebugTidy;
$fname = 'Parser::internalTidy';
wfProfileIn( $fname );
global $wgTidyConf, $IP, $wgDebugTidy;
$fname = 'Parser::internalTidy';
wfProfileIn( $fname );
@@
-974,12
+974,12
@@
class Parser
$text = preg_replace( '/(^|\n)-----*/', '\\1<hr />', $text );
$text = $this->doDoubleUnderscore( $text );
$text = preg_replace( '/(^|\n)-----*/', '\\1<hr />', $text );
$text = $this->doDoubleUnderscore( $text );
- $text =
$this->
doHeadings( $text );
+ $text =
self::
doHeadings( $text );
if($this->mOptions->getUseDynamicDates()) {
$df = DateFormatter::getInstance();
$text = $df->reformat( $this->mOptions->getDateFormat(), $text );
}
if($this->mOptions->getUseDynamicDates()) {
$df = DateFormatter::getInstance();
$text = $df->reformat( $this->mOptions->getDateFormat(), $text );
}
- $text =
$this->
doAllQuotes( $text );
+ $text =
self::
doAllQuotes( $text );
$text = $this->replaceInternalLinks( $text );
$text = $this->replaceExternalLinks( $text );
$text = $this->replaceInternalLinks( $text );
$text = $this->replaceExternalLinks( $text );
@@
-1059,7
+1059,7
@@
class Parser
*
* @private
*/
*
* @private
*/
- function doHeadings( $text ) {
+
static
function doHeadings( $text ) {
$fname = 'Parser::doHeadings';
wfProfileIn( $fname );
for ( $i = 6; $i >= 1; --$i ) {
$fname = 'Parser::doHeadings';
wfProfileIn( $fname );
for ( $i = 6; $i >= 1; --$i ) {
@@
-1076,13
+1076,13
@@
class Parser
* @private
* @return string the altered text
*/
* @private
* @return string the altered text
*/
- function doAllQuotes( $text ) {
+
static
function doAllQuotes( $text ) {
$fname = 'Parser::doAllQuotes';
wfProfileIn( $fname );
$outtext = '';
$lines = explode( "\n", $text );
foreach ( $lines as $line ) {
$fname = 'Parser::doAllQuotes';
wfProfileIn( $fname );
$outtext = '';
$lines = explode( "\n", $text );
foreach ( $lines as $line ) {
- $outtext .=
$this->doQuotes
( $line ) . "\n";
+ $outtext .=
self::doQuotes
( $line ) . "\n";
}
$outtext = substr($outtext, 0,-1);
wfProfileOut( $fname );
}
$outtext = substr($outtext, 0,-1);
wfProfileOut( $fname );
@@
-1092,7
+1092,7
@@
class Parser
/**
* Helper function for doAllQuotes()
*/
/**
* Helper function for doAllQuotes()
*/
- public function doQuotes( $text ) {
+ public
static
function doQuotes( $text ) {
$arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( count( $arr ) == 1 )
return $text;
$arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( count( $arr ) == 1 )
return $text;
@@
-1969,7
+1969,7
@@
class Parser
# getCommon() returns the length of the longest common substring
# of both arguments, starting at the beginning of both.
#
# getCommon() returns the length of the longest common substring
# of both arguments, starting at the beginning of both.
#
- /* private */ function getCommon( $st1, $st2 ) {
+ /* private */
static
function getCommon( $st1, $st2 ) {
$fl = strlen( $st1 );
$shorter = strlen( $st2 );
if ( $fl < $shorter ) { $shorter = $fl; }
$fl = strlen( $st1 );
$shorter = strlen( $st2 );
if ( $fl < $shorter ) { $shorter = $fl; }
@@
-2085,14
+2085,14
@@
class Parser
# So we check for : in the remainder text to split up the
# title and definition, without b0rking links.
$term = $t2 = '';
# So we check for : in the remainder text to split up the
# title and definition, without b0rking links.
$term = $t2 = '';
- if (
$this->findColonNoLinks($t, $term, $t2) !== false
) {
+ if (
self::findColonNoLinks($t, $term, $t2) !== false
) {
$t = $t2;
$output .= $term . $this->nextItem( ':' );
}
}
} elseif( $prefixLength || $lastPrefixLength ) {
# Either open or close a level...
$t = $t2;
$output .= $term . $this->nextItem( ':' );
}
}
} elseif( $prefixLength || $lastPrefixLength ) {
# Either open or close a level...
- $commonPrefixLength =
$this->
getCommon( $pref, $lastPrefix );
+ $commonPrefixLength =
self::
getCommon( $pref, $lastPrefix );
$paragraphStack = false;
while( $commonPrefixLength < $lastPrefixLength ) {
$paragraphStack = false;
while( $commonPrefixLength < $lastPrefixLength ) {
@@
-2108,7
+2108,7
@@
class Parser
if ( ';' == $char ) {
# FIXME: This is dupe of code above
if ( ';' == $char ) {
# FIXME: This is dupe of code above
- if (
$this->findColonNoLinks($t, $term, $t2) !== false
) {
+ if (
self::findColonNoLinks($t, $term, $t2) !== false
) {
$t = $t2;
$output .= $term . $this->nextItem( ':' );
}
$t = $t2;
$output .= $term . $this->nextItem( ':' );
}
@@
-2205,7
+2205,7
@@
class Parser
* @param string &$after set to everything after the ':'
* return string the position of the ':', or false if none found
*/
* @param string &$after set to everything after the ':'
* return string the position of the ':', or false if none found
*/
- function findColonNoLinks($str, &$before, &$after) {
+
static
function findColonNoLinks($str, &$before, &$after) {
$fname = 'Parser::findColonNoLinks';
wfProfileIn( $fname );
$fname = 'Parser::findColonNoLinks';
wfProfileIn( $fname );
@@
-3155,10
+3155,10
@@
class Parser
if (strlen($url) > 255)
return wfMsg('scarytranscludetoolong');
if (strlen($url) > 255)
return wfMsg('scarytranscludetoolong');
- return
$this->
fetchScaryTemplateMaybeFromCache($url);
+ return
self::
fetchScaryTemplateMaybeFromCache($url);
}
}
- function fetchScaryTemplateMaybeFromCache($url) {
+
static
function fetchScaryTemplateMaybeFromCache($url) {
global $wgTranscludeCacheExpiry;
$dbr = wfGetDB(DB_SLAVE);
$obj = $dbr->selectRow('transcache', array('tc_time', 'tc_contents'),
global $wgTranscludeCacheExpiry;
$dbr = wfGetDB(DB_SLAVE);
$obj = $dbr->selectRow('transcache', array('tc_time', 'tc_contents'),
@@
-3789,7
+3789,7
@@
class Parser
wfDebug( __METHOD__ . ": $username has overlong signature.\n" );
} elseif( $user->getBoolOption( 'fancysig' ) !== false ) {
# Sig. might contain markup; validate this
wfDebug( __METHOD__ . ": $username has overlong signature.\n" );
} elseif( $user->getBoolOption( 'fancysig' ) !== false ) {
# Sig. might contain markup; validate this
- if(
$this->
validateSig( $nickname ) !== false ) {
+ if(
self::
validateSig( $nickname ) !== false ) {
# Validated; clean up (if needed) and return it
return $this->cleanSig( $nickname, true );
} else {
# Validated; clean up (if needed) and return it
return $this->cleanSig( $nickname, true );
} else {
@@
-3800,7
+3800,7
@@
class Parser
}
// Make sure nickname doesnt get a sig in a sig
}
// Make sure nickname doesnt get a sig in a sig
- $nickname =
$this->
cleanSigInSig( $nickname );
+ $nickname =
self::
cleanSigInSig( $nickname );
# If we're still here, make it a link to the user page
$userText = wfEscapeWikiText( $username );
# If we're still here, make it a link to the user page
$userText = wfEscapeWikiText( $username );
@@
-3818,7
+3818,7
@@
class Parser
* @param string $text
* @return mixed An expanded string, or false if invalid.
*/
* @param string $text
* @return mixed An expanded string, or false if invalid.
*/
- function validateSig( $text ) {
+
static
function validateSig( $text ) {
return( wfIsWellFormedXmlFragment( $text ) ? $text : false );
}
return( wfIsWellFormedXmlFragment( $text ) ? $text : false );
}
@@
-3853,7
+3853,7
@@
class Parser
$substText = '{{' . $substWord->getSynonym( 0 );
$text = preg_replace( $substRegex, $substText, $text );
$substText = '{{' . $substWord->getSynonym( 0 );
$text = preg_replace( $substRegex, $substText, $text );
- $text =
$this->
cleanSigInSig( $text );
+ $text =
self::
cleanSigInSig( $text );
$dom = $this->preprocessToDom( $text );
$frame = $this->getPreprocessor()->newFrame();
$text = $frame->expand( $dom );
$dom = $this->preprocessToDom( $text );
$frame = $this->getPreprocessor()->newFrame();
$text = $frame->expand( $dom );
@@
-3870,7
+3870,7
@@
class Parser
* @param string $text
* @return string Signature text with /~{3,5}/ removed
*/
* @param string $text
* @return string Signature text with /~{3,5}/ removed
*/
- function cleanSigInSig( $text ) {
+
static
function cleanSigInSig( $text ) {
$text = preg_replace( '/~{3,5}/', '', $text );
return $text;
}
$text = preg_replace( '/~{3,5}/', '', $text );
return $text;
}