r97225 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97224‎ | r97225 | r97226 >
Date:00:53, 16 September 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Follow up to r97223;
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QueryPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -370,7 +370,17 @@
371371 if ( array_key_exists( 'order', $this->m_params ) ) $urlArgs['order'] = $this->m_params['order'];
372372
373373 if ( $this->m_querystring != '' ) {
374 - $queryobj = SMWQueryProcessor::createQuery( $this->m_querystring, $this->m_params, SMWQueryProcessor::SPECIAL_PAGE , $this->m_params['format'], $this->m_printouts );
 374+ $params = SMWQueryProcessor::getProcessedParams( $this->m_params );
 375+ $this->m_params['format'] = $params['format'];
 376+
 377+ $queryobj = SMWQueryProcessor::createQuery(
 378+ $this->m_querystring,
 379+ $params,
 380+ SMWQueryProcessor::SPECIAL_PAGE ,
 381+ $this->m_params['format'],
 382+ $this->m_printouts
 383+ );
 384+
375385 $res = smwfGetStore()->getQueryResult( $queryobj );
376386
377387 // Try to be smart for rss/ical if no description/title is given and we have a concept query:
@@ -423,7 +433,7 @@
424434
425435 $navigation = $this->getNavigationBar( $res, $urlArgs );
426436 $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n";
427 - $query_result = $printer->getResult( $res, $this->m_params, SMW_OUTPUT_HTML );
 437+ $query_result = $printer->getResult( $res, $params, SMW_OUTPUT_HTML );
428438
429439 if ( is_array( $query_result ) ) {
430440 $result .= $query_result[0];
@@ -436,7 +446,7 @@
437447 $result = '<div style="text-align: center;">' . wfMsgHtml( 'smw_result_noresults' ) . '</div>';
438448 }
439449 } else { // make a stand-alone file
440 - $result = $printer->getResult( $res, $this->m_params, SMW_OUTPUT_FILE );
 450+ $result = $printer->getResult( $res, $params, SMW_OUTPUT_FILE );
441451 $result_name = $printer->getFileName( $res ); // only fetch that after initialising the parameters
442452 }
443453 }
@@ -498,8 +508,8 @@
499509 if ( ! array_key_exists( 'sort', $this->m_params ) || ! array_key_exists( 'order', $this->m_params ) ) {
500510 $orders = array(); // do not even show one sort input here
501511 } else {
502 - $sorts = explode( ',', $this->m_params['sort'] );
503 - $orders = explode( ',', $this->m_params['order'] );
 512+ $sorts = $this->m_params['sort'];
 513+ $orders = $this->m_params['order'];
504514 reset( $sorts );
505515 }
506516
@@ -725,8 +735,12 @@
726736 protected function showFormatOptions( $format, array $paramValues ) {
727737 $printer = SMWQueryProcessor::getResultPrinter( $format, SMWQueryProcessor::SPECIAL_PAGE );
728738
729 - $params = method_exists( $printer, 'getValidatorParameters' ) ? $printer->getValidatorParameters() : array();
 739+ $params = SMWQueryProcessor::getParameters();
730740
 741+ if ( method_exists( $printer, 'getValidatorParameters' ) ) {
 742+ $params = array_merge( $params, $printer->getValidatorParameters() );
 743+ }
 744+
731745 $optionsHtml = array();
732746
733747 foreach ( $params as $param ) {
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php
@@ -145,7 +145,7 @@
146146
147147 public function getShortHTMLText( $linker = null ) {
148148 if ( ( $linker !== null ) && ( $this->m_caption !== '' ) && ( $this->m_outformat != '-' ) ) $this->getTitle(); // init the Title object, may reveal hitherto unnoticed errors
149 - if ( ( $linker === null ) || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $this->m_caption === '' ) ) {
 149+ if ( is_null( $linker ) || $linker === false || ( !$this->isValid() ) || ( $this->m_outformat == '-' ) || ( $this->m_caption === '' ) ) {
150150 return htmlspecialchars( $this->getCaption() );
151151 } elseif ( $this->getNamespace() == NS_MEDIA ) { // this extra case *is* needed
152152 return $linker->makeMediaLinkObj( $this->getTitle(), $this->getCaption() );
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QueryPrinter.php
@@ -303,7 +303,7 @@
304304 if ( array_key_exists( 'searchlabel', $params ) ) {
305305 $this->mSearchlabel = $params['searchlabel'] === false ? null : $params['searchlabel'];
306306 }
307 -
 307+
308308 switch ( $params['link'] ) {
309309 case 'head': case 'subject':
310310 $this->mLinkFirst = true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97223changing param handling to happen on query processor level instead of in the ...jeroendedauw00:26, 16 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   05:34, 16 September 2011
is_null( $linker ) || $linker === false

is_object perhaps?