r88978 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88977‎ | r88978 | r88979 >
Date:17:06, 27 May 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
followup r88927 & r88928: use wfSuppressWarnings; enable UTF8
Modified paths:
  • /trunk/extensions/SemanticGlossary/COPYING (modified) (history)
  • /trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php (modified) (history)
  • /trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
@@ -50,7 +50,7 @@
5151 $this -> mFullDefinition = $doc -> createElement( 'span' );
5252
5353 foreach ( $this -> mDefinitions as $definition ) {
54 - $element = $doc -> createElement( 'span', $definition[ self::SG_DEFINITION ] . ' ' );
 54+ $element = $doc -> createElement( 'span', html_entity_decode( $definition[ self::SG_DEFINITION ], ENT_COMPAT, 'UTF-8' ) . ' ' );
5555 if ( $definition[ self::SG_LINK ] ) {
5656 $link = $this -> getLinkTemplate( $doc );
5757 $link -> setAttribute( 'href', Title::newFromText( $definition[ self::SG_LINK ] ) -> getFullURL() );
Index: trunk/extensions/SemanticGlossary/COPYING
@@ -3,8 +3,8 @@
44 or "COPYING", or a subdirectory thereof. For those files, the license text
55 contained in said file overrides any license information contained in
66 directories of smaller depth. Alternative licenses are typically used for
7 -software that is provided by external parties, and merely packaged with the
8 -Semantic Lingo release for convenience.
 7+software that is provided by external parties, and merely packaged with this
 8+software for convenience.
99
1010 ----
1111
Index: trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
@@ -139,13 +139,11 @@
140140 //Get the minimum length abbreviation so we don't bother checking against words shorter than that
141141 $min = min( array_map( 'strlen', array_keys( $terms ) ) );
142142
143 -// var_export($text);
144143 //Parse HTML from page
145 -// $doc = new DOMDocument();
146 -// @$doc -> loadHTML( '<html><meta http-equiv="content-type" content="charset=utf-8"/>' . $text . '</html>' );
147 -// $doc -> loadHTML( $text );
148144 // FIXME: this works in PHP 5.3.3. What about 5.1?
149 - $doc = @DOMDocument::loadHTML( $text );
 145+ wfSuppressWarnings();
 146+ $doc = DOMDocument::loadHTML( '<html><meta http-equiv="content-type" content="charset=utf-8"/>' . $text . '</html>' );
 147+ wfRestoreWarnings();
150148
151149 //Find all text in HTML.
152150 $xpath = new DOMXpath( $doc );
@@ -182,11 +180,11 @@
183181 $afterMatchNode = $doc -> createTextNode( substr( $el -> nodeValue, $offset[ 1 ] + strlen( $offset[ 0 ] ), strlen( $el -> nodeValue ) - 1 ) );
184182
185183 //Wrap abbreviation in <span> tags
186 - $span = @$doc -> createElement( 'span' );
 184+ $span = $doc -> createElement( 'span' );
187185 $span -> setAttribute( 'class', "tooltip" );
188186
189187 //Wrap abbreviation in <span> tags, hidden
190 - $spanAbr = @$doc -> createElement( 'span', $offset[ 0 ] );
 188+ $spanAbr = $doc -> createElement( 'span', $offset[ 0 ] );
191189 $spanAbr -> setAttribute( 'class', "tooltip_abbr" );
192190
193191 //Wrap definition in <span> tags, hidden

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88927bugfix: injected illegal tagsfoxtrott20:27, 26 May 2011
r88928bugfix: injected illegal tagsfoxtrott20:28, 26 May 2011

Status & tagging log