From: Daniel Friesen Date: Tue, 8 Feb 2011 01:31:21 +0000 (+0000) Subject: Followup r81583, break some of the long lines and centralize the regex. X-Git-Tag: 1.31.0-rc.0~32128 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=f0fd318a4e0337ec47baf3d4b83372b99862dca3;p=lhc%2Fweb%2Fwiklou.git Followup r81583, break some of the long lines and centralize the regex. --- diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 80d53439d8..caac802f43 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -125,6 +125,8 @@ class ParserOutput extends CacheTime { private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. private $mAccessedOptions = null; # List of ParserOptions (stored in the keys) + const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#'; + function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = false, $titletext = '' ) { @@ -137,7 +139,8 @@ class ParserOutput extends CacheTime { function getText() { if ( $this->mEditSectionTokens ) { - return preg_replace_callback( '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#', array( &$this, 'replaceEditSectionLinksCallback' ), $this->mText ); + return preg_replace_callback( ParserOutput::EDITSECTION_REGEX, + array( &$this, 'replaceEditSectionLinksCallback' ), $this->mText ); } return $this->mText; } diff --git a/includes/parser/Tidy.php b/includes/parser/Tidy.php index 2988f3e399..d2b58f6064 100644 --- a/includes/parser/Tidy.php +++ b/includes/parser/Tidy.php @@ -26,9 +26,11 @@ class MWTidyWrapper { public function getWrapped( $text ) { $this->mTokens = new ReplacementArray; - $this->mUniqPrefix = "\x7fUNIQ" . dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) ); + $this->mUniqPrefix = "\x7fUNIQ" . + dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) ); $this->mMarkerIndex = 0; - $wrappedtext = preg_replace_callback( '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#', array( &$this, 'replaceEditSectionLinksCallback' ), $text ); + $wrappedtext = preg_replace_callback( ParserOutput::EDITSECTION_REGEX, + array( &$this, 'replaceEditSectionLinksCallback' ), $text ); $wrappedtext = ''.