r82944 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82943‎ | r82944 | r82945 >
Date:18:34, 28 February 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
minor cleanup
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Embedded.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Embedded.php
@@ -25,16 +25,8 @@
2626 protected function readParameters( $params, $outputmode ) {
2727 SMWResultPrinter::readParameters( $params, $outputmode );
2828
29 - if ( array_key_exists( 'embedonly', $params ) ) {
30 - $this->m_showhead = false;
31 - } else {
32 - $this->m_showhead = true;
33 - }
34 - if ( array_key_exists( 'embedformat', $params ) ) {
35 - $this->m_embedformat = trim( $params['embedformat'] );
36 - } else {
37 - $this->m_embedformat = 'h1';
38 - }
 29+ $this->m_showhead = !array_key_exists( 'embedonly', $params );
 30+ $this->m_embedformat = array_key_exists( 'embedformat', $params ) ? trim( $params['embedformat'] ) : 'h1';
3931 }
4032
4133 public function getName() {
@@ -78,9 +70,11 @@
7971 foreach ( $res->getResults() as $page ) {
8072 if ( $page->getTypeID() == '_wpg' ) { // ensure that we deal with title-likes
8173 $result .= $embstart;
 74+
8275 if ( $this->m_showhead ) {
8376 $result .= $headstart . $page->getLongWikiText( $this->mLinker ) . $headend;
8477 }
 78+
8579 if ( $page->getLongWikiText() != $title ) {
8680 $result .= '{{' . ( ( $page->getNamespace() == NS_MAIN ) ?
8781 ':' . $page->getDBkey():$page->getLongWikiText() ) .
@@ -88,6 +82,7 @@
8983 } else {
9084 $result .= '<b>' . $page->getLongWikiText() . '</b>';
9185 }
 86+
9287 $result .= $embend;
9388 }
9489 }
@@ -112,11 +107,13 @@
113108 return $result;
114109 }
115110
116 - public function getParameters() {
117 - $params = parent::getParameters();
118 - $params[] = array( 'name' => 'embedformat', 'type' => 'string', 'description' => wfMsg( 'smw_paramdesc_embedformat' ) );
119 - $params[] = array( 'name' => 'embedonly', 'type' => 'boolean', 'description' => wfMsg( 'smw_paramdesc_embedonly' ) );
120 - return $params;
121 - }
 111+ public function getParameters() {
 112+ $params = parent::getParameters();
 113+
 114+ $params[] = array( 'name' => 'embedformat', 'type' => 'string', 'description' => wfMsg( 'smw_paramdesc_embedformat' ) );
 115+ $params[] = array( 'name' => 'embedonly', 'type' => 'boolean', 'description' => wfMsg( 'smw_paramdesc_embedonly' ) );
 116+
 117+ return $params;
 118+ }
122119
123120 }

Status & tagging log