From: Daniel Friesen Date: Mon, 20 Feb 2012 00:03:24 +0000 (+0000) Subject: Followup r111898; Do the same for the attribute whitelist. X-Git-Tag: 1.31.0-rc.0~24621 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=524741dcc41898ba0611241a7b3ede0537f3b7f6;p=lhc%2Fweb%2Fwiklou.git Followup r111898; Do the same for the attribute whitelist. --- diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 4e38c4f5b1..785e2ec9c1 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -1478,10 +1478,7 @@ class Sanitizer { * @return Array */ static function attributeWhitelist( $element ) { - static $list; - if( !isset( $list ) ) { - $list = Sanitizer::setupAttributeWhitelist(); - } + $list = Sanitizer::setupAttributeWhitelist(); return isset( $list[$element] ) ? $list[$element] : array(); @@ -1495,6 +1492,13 @@ class Sanitizer { static function setupAttributeWhitelist() { global $wgAllowRdfaAttributes, $wgHtml5, $wgAllowMicrodataAttributes; + static $whitelist, $staticInitialised; + $globalContext = implode( '-', compact( 'wgAllowRdfaAttributes', 'wgHtml5', 'wgAllowMicrodataAttributes' ) ); + + if ( isset( $whitelist ) && $staticInitialised == $globalContext ) { + return $whitelist; + } + $common = array( 'id', 'class', 'lang', 'dir', 'title', 'style' ); if ( $wgAllowRdfaAttributes ) { @@ -1673,6 +1677,8 @@ class Sanitizer { ); } + $staticInitialised = $globalContext; + return $whitelist; }