http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88978
Revision: 88978
Author: foxtrott
Date: 2011-05-27 17:06:34 +0000 (Fri, 27 May 2011)
Log Message:
-----------
followup r88927 & r88928: use wfSuppressWarnings; enable UTF8
Modified Paths:
--------------
trunk/extensions/SemanticGlossary/COPYING
trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
Modified: trunk/extensions/SemanticGlossary/COPYING
===================================================================
--- trunk/extensions/SemanticGlossary/COPYING 2011-05-27 16:23:39 UTC (rev
88977)
+++ trunk/extensions/SemanticGlossary/COPYING 2011-05-27 17:06:34 UTC (rev
88978)
@@ -3,8 +3,8 @@
or "COPYING", or a subdirectory thereof. For those files, the license text
contained in said file overrides any license information contained in
directories of smaller depth. Alternative licenses are typically used for
-software that is provided by external parties, and merely packaged with the
-Semantic Lingo release for convenience.
+software that is provided by external parties, and merely packaged with this
+software for convenience.
----
Modified: trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
===================================================================
--- trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
2011-05-27 16:23:39 UTC (rev 88977)
+++ trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
2011-05-27 17:06:34 UTC (rev 88978)
@@ -50,7 +50,7 @@
$this -> mFullDefinition = $doc -> createElement(
'span' );
foreach ( $this -> mDefinitions as $definition ) {
- $element = $doc -> createElement( 'span',
$definition[ self::SG_DEFINITION ] . ' ' );
+ $element = $doc -> createElement( 'span',
html_entity_decode( $definition[ self::SG_DEFINITION ], ENT_COMPAT, 'UTF-8' ) .
' ' );
if ( $definition[ self::SG_LINK ] ) {
$link = $this -> getLinkTemplate( $doc
);
$link -> setAttribute( 'href',
Title::newFromText( $definition[ self::SG_LINK ] ) -> getFullURL() );
Modified: trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
===================================================================
--- trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
2011-05-27 16:23:39 UTC (rev 88977)
+++ trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
2011-05-27 17:06:34 UTC (rev 88978)
@@ -139,13 +139,11 @@
//Get the minimum length abbreviation so we don't bother
checking against words shorter than that
$min = min( array_map( 'strlen', array_keys( $terms ) ) );
-// var_export($text);
//Parse HTML from page
-// $doc = new DOMDocument();
-// @$doc -> loadHTML( '<html><meta http-equiv="content-type"
content="charset=utf-8"/>' . $text . '</html>' );
-// $doc -> loadHTML( $text );
// FIXME: this works in PHP 5.3.3. What about 5.1?
- $doc = @DOMDocument::loadHTML( $text );
+ wfSuppressWarnings();
+ $doc = DOMDocument::loadHTML( '<html><meta
http-equiv="content-type" content="charset=utf-8"/>' . $text . '</html>' );
+ wfRestoreWarnings();
//Find all text in HTML.
$xpath = new DOMXpath( $doc );
@@ -182,11 +180,11 @@
$afterMatchNode = $doc ->
createTextNode( substr( $el -> nodeValue, $offset[ 1 ] + strlen( $offset[ 0 ]
), strlen( $el -> nodeValue ) - 1 ) );
//Wrap abbreviation in <span> tags
- $span = @$doc -> createElement( 'span'
);
+ $span = $doc -> createElement( 'span' );
$span -> setAttribute( 'class',
"tooltip" );
//Wrap abbreviation in <span> tags,
hidden
- $spanAbr = @$doc -> createElement(
'span', $offset[ 0 ] );
+ $spanAbr = $doc -> createElement(
'span', $offset[ 0 ] );
$spanAbr -> setAttribute( 'class',
"tooltip_abbr" );
//Wrap definition in <span> tags, hidden
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs