r40528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40527‎ | r40528 | r40529 >
Date:11:43, 6 September 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Unescape < and > in parser function input (required in MediaWiki 1.11)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -352,7 +352,8 @@
353353 // process input:
354354 $params = func_get_args();
355355 array_shift( $params ); // we already know the $parser ...
356 - $concept_input = array_shift( $params ); // use first parameter as concept (query) string
 356+ $concept_input = str_replace(array('&gt;','&lt;'),array('>','<'),array_shift( $params )); // use first parameter as concept (query) string
 357+ /// NOTE: the str_replace above is required in MediaWiki 1.11, but not in MediaWiki 1.14
357358 $query = SMWQueryProcessor::createQuery($concept_input, array('limit' => 20, 'format' => 'list'), SMWQueryProcessor::CONCEPT_DESC);
358359 $concept_text = $query->getDescription()->getQueryString();
359360 $concept_docu = array_shift( $params ); // second parameter, if any, might be a description
@@ -367,18 +368,11 @@
368369 $rdflink = SMWInfolink::newInternalLink(wfMsgForContent('smw_viewasrdf'), $wgContLang->getNsText(NS_SPECIAL) . ':ExportRDF/' . $title->getPrefixedText(), 'rdflink');
369370 smwfRequireHeadItem(SMW_HEADER_STYLE);
370371
371 -// $qresult = smwfGetStore()->getQueryResult($query);
372 -// $printer = SMWQueryProcessor::getResultPrinter('list', SMWQueryProcessor::CONCEPT_DESC, $qresult);
373 -// $printer->setShowErrors(false);
374 -// $resultlink = $printer->getResult($qresult, array('sep' => ',_'), SMW_OUTPUT_WIKI);
375 -
376372 $result = '<div class="smwfact"><span class="smwfactboxhead">' . wfMsgForContent('smw_concept_description',$title->getText()) .
377373 (count($query->getErrors())>0?' ' . smwfEncodeMessages($query->getErrors()):'') .
378374 '</span>' . '<span class="smwrdflink">' . $rdflink->getWikiText() . '</span>' . '<br />' .
379375 ($concept_docu?"<p>$concept_docu</p>":'') .
380 - '<pre>' . str_replace('[', '&#x005B;', $concept_text) . "</pre>\n" .
381 -// $resultlink .
382 - '</div>';
 376+ '<pre>' . str_replace('[', '&#x005B;', $concept_text) . "</pre>\n</div>";
383377 return $result;
384378 }
385379

Status & tagging log