Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Embedded.php |
— | — | @@ -25,16 +25,8 @@ |
26 | 26 | protected function readParameters( $params, $outputmode ) { |
27 | 27 | SMWResultPrinter::readParameters( $params, $outputmode ); |
28 | 28 | |
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'; |
39 | 31 | } |
40 | 32 | |
41 | 33 | public function getName() { |
— | — | @@ -78,9 +70,11 @@ |
79 | 71 | foreach ( $res->getResults() as $page ) { |
80 | 72 | if ( $page->getTypeID() == '_wpg' ) { // ensure that we deal with title-likes |
81 | 73 | $result .= $embstart; |
| 74 | + |
82 | 75 | if ( $this->m_showhead ) { |
83 | 76 | $result .= $headstart . $page->getLongWikiText( $this->mLinker ) . $headend; |
84 | 77 | } |
| 78 | + |
85 | 79 | if ( $page->getLongWikiText() != $title ) { |
86 | 80 | $result .= '{{' . ( ( $page->getNamespace() == NS_MAIN ) ? |
87 | 81 | ':' . $page->getDBkey():$page->getLongWikiText() ) . |
— | — | @@ -88,6 +82,7 @@ |
89 | 83 | } else { |
90 | 84 | $result .= '<b>' . $page->getLongWikiText() . '</b>'; |
91 | 85 | } |
| 86 | + |
92 | 87 | $result .= $embend; |
93 | 88 | } |
94 | 89 | } |
— | — | @@ -112,11 +107,13 @@ |
113 | 108 | return $result; |
114 | 109 | } |
115 | 110 | |
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 | + } |
122 | 119 | |
123 | 120 | } |