r87134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87133‎ | r87134 | r87135 >
Date:21:29, 29 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added some compat stuff
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Embedded.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_QueryPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -498,9 +498,9 @@
499499 * @return string
500500 */
501501 protected function getInputForm( $printoutstring, $urltail ) {
502 - global $wgUser, $smwgQSortingSupport, $smwgResultFormats;
 502+ global $smwgQSortingSupport, $smwgResultFormats;
503503
504 - $skin = $wgUser->getSkin();
 504+ $skin = $this->getSkin();
505505 $result = '';
506506
507507 if ( $this->m_editquery ) {
@@ -643,9 +643,9 @@
644644 * @return string
645645 */
646646 protected function getNavigationBar( SMWQueryResult $res, $urltail ) {
647 - global $wgUser, $smwgQMaxInlineLimit;
 647+ global $smwgQMaxInlineLimit;
648648
649 - $skin = $wgUser->getSkin();
 649+ $skin = $this->getSkin();
650650 $offset = $this->m_params['offset'];
651651 $limit = $this->m_params['limit'];
652652
@@ -813,4 +813,21 @@
814814 return $input->getHtml();
815815 }
816816
 817+ /**
 818+ * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage.
 819+ *
 820+ * @since 1.6
 821+ *
 822+ * @return Skin
 823+ */
 824+ public function getSkin() {
 825+ if ( method_exists( 'SpecialPage', 'getSkin' ) ) {
 826+ return parent::getSkin();
 827+ }
 828+ else {
 829+ global $wgUser;
 830+ return $wgUser->getSkin();
 831+ }
 832+ }
 833+
817834 }
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_QueryPage.php
@@ -40,7 +40,7 @@
4141 * @param $shownavigation show navigation like "next 200"?
4242 */
4343 function doQuery( $offset, $limit, $shownavigation = true ) {
44 - global $wgUser, $wgOut, $wgContLang;
 44+ global $wgOut, $wgContLang;
4545
4646 $options = new SMWRequestOptions();
4747 $options->limit = $limit;
@@ -49,7 +49,7 @@
5050 $res = $this->getResults( $options );
5151 $num = count( $res );
5252
53 - $sk = $wgUser->getSkin();
 53+ $sk = $this->getSkin();
5454 $sname = $this->getName();
5555
5656 if ( $shownavigation ) {
@@ -96,5 +96,22 @@
9797 return $num;
9898 }
9999
 100+ /**
 101+ * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage.
 102+ *
 103+ * @since 1.6
 104+ *
 105+ * @return Skin
 106+ */
 107+ public function getSkin() {
 108+ if ( method_exists( 'SpecialPage', 'getSkin' ) ) {
 109+ return parent::getSkin();
 110+ }
 111+ else {
 112+ global $wgUser;
 113+ return $wgUser->getSkin();
 114+ }
 115+ }
 116+
100117 }
101118
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -18,8 +18,6 @@
1919 global $wgAjaxExportList;
2020 $wgAjaxExportList[] = "smwfGetValues";
2121
22 -// function smwfGetValues($p, $v) { return SMWSearchByProperty::getSuggestedValues($p, $v); }
23 -
2422 /**
2523 * This special page for Semantic MediaWiki implements a
2624 * view on a relation-object pair,i.e. a typed backlink.
@@ -101,8 +99,8 @@
102100 * @return string HTML of the search by property function
103101 */
104102 private function displaySearchByProperty() {
105 - global $wgUser, $wgOut, $smwgSearchByPropertyFuzzy;
106 - $skin = $wgUser->getSkin();
 103+ global $wgOut, $smwgSearchByPropertyFuzzy;
 104+ $skin = $this->getSkin();
107105
108106 if ( $this->propertystring == '' ) {
109107 return '<p>' . wfMsg( 'smw_sbv_docu' ) . "</p>\n";
@@ -175,8 +173,7 @@
176174 * @return string HTML with the bullet list and a header
177175 */
178176 private function displayResults( $results, $number = - 1, $first = true, $highlight = false ) {
179 - global $wgUser;
180 - $skin = $wgUser->getSkin();
 177+ $skin = $this->getSkin();
181178
182179 $html = "<ul>\n";
183180
@@ -206,8 +203,8 @@
207204 * @return string HTML with the navigation bar
208205 */
209206 private function getNavigationBar( $count ) {
210 - global $wgUser, $smwgQMaxInlineLimit;
211 - $skin = $wgUser->getSkin();
 207+ global $smwgQMaxInlineLimit;
 208+ $skin = $this->getSkin();
212209
213210 if ( $this->offset > 0 )
214211 $navigation = '<a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'SearchByProperty', 'offset=' . max( 0, $this->offset - $this->limit ) . '&limit=' . $this->limit . '&property=' . urlencode( $this->property->getWikiValue() ) . '&value=' . urlencode( $this->value->getWikiValue() ) ) ) . '">' . wfMsg( 'smw_result_prev' ) . '</a>';
@@ -329,5 +326,22 @@
330327
331328 return $html;
332329 }
 330+
 331+ /**
 332+ * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage.
 333+ *
 334+ * @since 1.6
 335+ *
 336+ * @return Skin
 337+ */
 338+ public function getSkin() {
 339+ if ( method_exists( 'SpecialPage', 'getSkin' ) ) {
 340+ return parent::getSkin();
 341+ }
 342+ else {
 343+ global $wgUser;
 344+ return $wgUser->getSkin();
 345+ }
 346+ }
333347
334348 }
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
@@ -90,4 +90,5 @@
9191 public function getParameters() {
9292 return array_merge( parent::getParameters(), parent::textDisplayParameters() );
9393 }
 94+
9495 }
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Embedded.php
@@ -112,7 +112,7 @@
113113
114114 public function getParameters() {
115115 $params = parent::getParameters();
116 -
 116+
117117 $params['embedformat'] = new Parameter( 'embedformat' );
118118 $params['embedformat']->setDescription( wfMsg( 'smw_paramdesc_embedformat' ) );
119119 $params['embedformat']->setDefault( '' );

Status & tagging log