r106566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106565‎ | r106566 | r106567 >
Date:15:31, 18 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
fix escaping issue and some code cleanup
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php
@@ -59,17 +59,29 @@
6060 reset( $params );
6161 $this->articletext = current( $params );
6262 }
 63+
6364 $this->subject = SMWDataValueFactory::newTypeIDValue( '_wpg', $this->articletext );
6465 $offsettext = $wgRequest->getVal( 'offset' );
6566 $this->offset = ( is_null( $offsettext ) ) ? 0 : intval( $offsettext );
 67+
6668 $dir = $wgRequest->getVal( 'dir' );
 69+
6770 if ( $smwgBrowseShowAll ) {
6871 $this->showoutgoing = true;
6972 $this->showincoming = true;
7073 }
71 - if ( ( $dir == 'both' ) || ( $dir == 'in' ) ) $this->showincoming = true;
72 - if ( $dir == 'in' ) $this->showoutgoing = false;
73 - if ( $dir == 'out' ) $this->showincoming = false;
 74+
 75+ if ( $dir === 'both' || $dir === 'in' ) {
 76+ $this->showincoming = true;
 77+ }
 78+
 79+ if ( $dir === 'in' ) {
 80+ $this->showoutgoing = false;
 81+ }
 82+
 83+ if ( $dir === 'out' ) {
 84+ $this->showincoming = false;
 85+ }
7486
7587 $wgOut->addHTML( $this->displayBrowse() );
7688 SMWOutputs::commitToOutputPage( $wgOut ); // make sure locally collected output data is pushed to the output!
@@ -85,15 +97,18 @@
8698 global $wgContLang, $wgOut;
8799 $html = "\n";
88100 $leftside = !( $wgContLang->isRTL() ); // For right to left languages, all is mirrored
 101+
89102 if ( $this->subject->isValid() ) {
90103 $wgOut->addStyle( '../extensions/SemanticMediaWiki/skins/SMW_custom.css' );
91104
92105 $html .= $this->displayHead();
 106+
93107 if ( $this->showoutgoing ) {
94108 $data = smwfGetStore()->getSemanticData( $this->subject->getDataItem() );
95109 $html .= $this->displayData( $data, $leftside );
96110 $html .= $this->displayCenter();
97111 }
 112+
98113 if ( $this->showincoming ) {
99114 list( $indata, $more ) = $this->getInData();
100115 global $smwgBrowseShowInverse;
@@ -103,10 +118,17 @@
104119 }
105120
106121 $this->articletext = $this->subject->getWikiValue();
 122+
107123 // Add a bit space between the factbox and the query form
108 - if ( !$this->including() ) $html .= "<p> &#160; </p>\n";
 124+ if ( !$this->including() ) {
 125+ $html .= "<p> &#160; </p>\n";
 126+ }
109127 }
110 - if ( !$this->including() ) $html .= $this->queryForm();
 128+
 129+ if ( !$this->including() ) {
 130+ $html .= $this->queryForm();
 131+ }
 132+
111133 $wgOut->addHTML( $html );
112134 }
113135
@@ -294,16 +316,16 @@
295317 * @return string HTML with the link to this page
296318 */
297319 private function linkHere( $text, $out, $in, $offset ) {
298 - $dir = $out ? ( $in ? 'both' : 'out' ) : 'in';
299320 $frag = ( $text == wfMsg( 'smw_browse_show_incoming' ) ) ? '#smw_browse_incoming' : '';
300321
301322 return Html::element(
302323 'a',
303324 array(
304325 'href' => SpecialPage::getSafeTitleFor( 'Browse' )->getLocalURL( array(
305 - 'offset' => "{$offset}&dir={$dir}",
306 - 'article' => $this->subject->getLongWikiText() . $frag
307 - ) )
 326+ 'offset' => $offset,
 327+ 'dir' => $out ? ( $in ? 'both' : 'out' ) : 'in',
 328+ 'article' => $this->subject->getLongWikiText()
 329+ ) ) . $frag
308330 ),
309331 $text
310332 );

Status & tagging log