http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89142
Revision: 89142
Author: foxtrott
Date: 2011-05-29 23:23:40 +0000 (Sun, 29 May 2011)
Log Message:
-----------
followup r89140: removed disabled code and debug printouts
Modified Paths:
--------------
trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
trunk/extensions/SemanticGlossary/SemanticGlossaryMessageLog.php
trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
trunk/extensions/SemanticGlossary/SpecialSemanticGlossaryBrowser.php
Modified: trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
===================================================================
--- trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
2011-05-29 23:18:47 UTC (rev 89141)
+++ trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php
2011-05-29 23:23:40 UTC (rev 89142)
@@ -67,10 +67,10 @@
return key( $this -> mDefinitions );
}
-// public function getTerm ( $key ) {
-// return $this -> mDefinitions[ $key ][ self::SG_TERM ];
-// }
-//
+ public function getTerm ( $key ) {
+ return $this -> mDefinitions[ $key ][ self::SG_TERM ];
+ }
+
public function getSource ( &$key ) {
return $this -> mDefinitions[ $key ][ self::SG_SOURCE ];
}
Modified: trunk/extensions/SemanticGlossary/SemanticGlossaryMessageLog.php
===================================================================
--- trunk/extensions/SemanticGlossary/SemanticGlossaryMessageLog.php
2011-05-29 23:18:47 UTC (rev 89141)
+++ trunk/extensions/SemanticGlossary/SemanticGlossaryMessageLog.php
2011-05-29 23:23:40 UTC (rev 89142)
@@ -56,7 +56,6 @@
foreach ( $this -> mMessages as $message ) {
if ( $message[ 1 ] <= $severity ) {
-// $ret .= Html::element( 'li', null, $message[ 0
] );
$ret .= "* " . $message[ 0 ] . "\n";
}
}
Modified: trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
===================================================================
--- trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
2011-05-29 23:18:47 UTC (rev 89141)
+++ trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php
2011-05-29 23:23:40 UTC (rev 89142)
@@ -35,7 +35,6 @@
static function parse ( &$parser, &$text ) {
wfProfileIn( __METHOD__ );
-// echo( __METHOD__ );
if ( !self::$parserSingleton ) {
self::$parserSingleton = new SemanticGlossaryParser();
@@ -157,7 +156,6 @@
$this -> mGlossaryTree -> addTerm( $term, $elementData
);
}
- var_export($this->mGlossaryTree);
wfProfileOut( __METHOD__ );
}
@@ -175,7 +173,6 @@
global $wgRequest, $sggSettings;
wfProfileIn( __METHOD__ );
-// echo( __METHOD__ );
$action = $wgRequest -> getVal( 'action', 'view' );
@@ -192,16 +189,13 @@
// Get array of terms
$glossary = $this -> getGlossaryTree();
-//
-// if ( empty( $terms ) ) {
+
if ( $glossary == null ) {
wfProfileOut( __METHOD__ );
return true;
}
- //Get the minimum length abbreviation so we don't bother
checking against words shorter than that
-// $min = min( array_map( 'strlen', array_keys( $terms ) ) );
//Parse HTML from page
// FIXME: this works in PHP 5.3.3. What about 5.1?
wfProfileIn( __METHOD__ . " 1 loadHTML" );
@@ -249,16 +243,12 @@
$index = 0;
$changedElem = false;
-// echo("\nrealParse: nodeValue: {$el->nodeValue}\n");
while ( $index < $countLexemes ) {
wfProfileIn( __METHOD__ . " 4 findNextTerm" );
list( $skipped, $used, $definition ) =
$glossary -> findNextTerm( $lexemes, $index, $countLexemes );
wfProfileOut( __METHOD__ . " 4 findNextTerm" );
-// echo("realParse: skipped: $skipped used:
$used\n");
-// var_export($definition);
-
wfProfileIn( __METHOD__ . " 5 insert" );
if ( $used > 0 ) { // found a term
if ( $skipped > 0 ) { // skipped some
text, insert it as is
@@ -331,66 +321,10 @@
$changedDoc = true;
}
- //Split node text into words, putting offset and text
into $offsets[0] array
-// preg_match_all(
-// "/[^\s{$sggSettings ->
punctuationCharacters}]+/",
-// $el -> nodeValue,
-// $offsets,
-// PREG_OFFSET_CAPTURE
-// );
-//
-// var_export($offsets);
-//
-// //Search and replace words in reverse order (from end
of string backwards),
-// //This way we don't mess up the offsets of the words as
we iterate
-// $len = count( $offsets[ 0 ] );
-//
-// for ( $i = $len - 1; $i >= 0; $i-- ) {
-//
-// $offset = $offsets[ 0 ][ $i ];
-//
-// //Check if word is an abbreviation from the
terminologies
-// if ( !is_numeric( $offset[ 0 ] ) && isset(
$terms[ $offset[ 0 ] ] ) ) {
-// //Word matches, replace with
appropriate span tag
-//
-// $changed = true;
-//
-// $beforeMatchNode = $doc ->
createTextNode(
-// substr( $el ->
nodeValue, 0, $offset[ 1 ] )
-// );
-//
-// $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 -> setAttribute( 'class',
"tooltip" );
-//
-// //Wrap abbreviation in <span> tags,
hidden
-// $spanAbr = $doc -> createElement(
'span', $offset[ 0 ] );
-// $spanAbr -> setAttribute( 'class',
"tooltip_abbr" );
-//
-// //Wrap definition in <span> tags, hidden
-// $spanTip = $terms[ $offset[ 0 ] ] ->
getFullDefinition( $doc );
-// $spanTip -> setAttribute( 'class',
"tooltip_tip" );
-//
-// $el -> parentNode -> insertBefore(
$beforeMatchNode, $el );
-// $el -> parentNode -> insertBefore(
$span, $el );
-// $span -> appendChild( $spanAbr );
-// $span -> appendChild( $spanTip );
-// $el -> parentNode -> insertBefore(
$afterMatchNode, $el );
-// $el -> parentNode -> removeChild( $el );
-// $el = $beforeMatchNode; //Set new
element to the text before the match for next iteration
-// }
-// }
}
if ( $changedDoc ) {
$body = $xpath -> query( '/html/body' );
-// $text = $doc -> saveXML( $body -> item( 0 ) );
$text = '';
foreach ( $body -> item( 0 ) -> childNodes as $child ) {
Modified: trunk/extensions/SemanticGlossary/SpecialSemanticGlossaryBrowser.php
===================================================================
--- trunk/extensions/SemanticGlossary/SpecialSemanticGlossaryBrowser.php
2011-05-29 23:18:47 UTC (rev 89141)
+++ trunk/extensions/SemanticGlossary/SpecialSemanticGlossaryBrowser.php
2011-05-29 23:23:40 UTC (rev 89142)
@@ -418,7 +418,6 @@
// set new data if defined, else ignore
property (i.e. delete property from page)
if ( $data[ $propertyID ] != null ) {
-// $value =
SMWDataValueFactory::newPropertyObjectValue( $property, $data[ $propertyID ] );
$newData -> addPropertyObjectValue(
$property, $data[ $propertyID ] );
}
@@ -440,7 +439,6 @@
if ( $data[ $propertyID ] != null ) {
$property = new SMWDIProperty( $propertyID );
-// $value =
SMWDataValueFactory::newPropertyObjectValue( $property, $data[ $propertyID ] );
$newData -> addPropertyObjectValue( $property,
$data[ $propertyID ] );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs