r98534 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98533‎ | r98534 | r98535 >
Date:16:05, 30 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
smw 1.6.2+ compat
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Outline/SRF_Outline.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Outline/SRF_Outline.php
@@ -5,13 +5,12 @@
66 * helper classes to handle the aggregation
77 */
88
9 -if ( !defined( 'MEDIAWIKI' ) ) die();
10 -
119 /**
1210 * Represents a single item, or page, in the outline - contains both the
1311 * SMWResultArray and an array of some of its values, for easier aggregation
1412 */
1513 class SRFOutlineItem {
 14+
1615 var $mRow;
1716 var $mVals;
1817
@@ -86,10 +85,7 @@
8786
8887 protected function handleParameters( $params, $outputmode ) {
8988 parent::handleParameters( $params, $outputmode );
90 -
91 - if ( array_key_exists( 'outlineproperties', $params ) ) {
92 - $this->mOutlineProperties = array_map( 'trim', explode( ',', $params['outlineproperties'] ) );
93 - }
 89+ $this->mOutlineProperties = $params['outlineproperties'];
9490 }
9591
9692 public function getName() {
@@ -231,9 +227,14 @@
232228 }
233229
234230 public function getParameters() {
235 - $params = parent::getParameters();
236 - $params[] = array( 'name' => 'outlineproperties', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_outlineproperties' ) );
237 - return $params;
 231+ $params = parent::getParameters();
 232+
 233+ $params['outlineproperties'] = new ListParameter( 'outlineproperties' );
 234+ $params['outlineproperties']->setMessage( 'srf_paramdesc_outlineproperties' );
 235+ $params['outlineproperties']->setDefault( array() );
 236+ $params['outlineproperties']->addManipulations( new ParamManipulationFunctions( 'trim' ) );
 237+
 238+ return $params;
238239 }
239240
240241 }
Index: trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php
@@ -18,6 +18,7 @@
1919 * TODO: make SRFvCardAddress constructor sane
2020 */
2121 class SRFvCard extends SMWResultPrinter {
 22+
2223 protected $m_title = '';
2324 protected $m_description = '';
2425
@@ -34,7 +35,7 @@
3536 }
3637
3738 public function getQueryMode( $context ) {
38 - return ( $context == SMWQueryProcessor::SPECIAL_PAGE ) ? SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE;
 39+ return ( $context == SMWQueryProcessor::SPECIAL_PAGE ) ? SMWQuery::MODE_INSTANCES : SMWQuery::MODE_NONE;
3940 }
4041
4142 public function getName() {
@@ -339,12 +340,7 @@
340341 }
341342
342343 public function getParameters() {
343 - if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) {
344 - return array_merge( parent::getParameters(), $this->exportFormatParameters() );
345 - }
346 - else {
347 - return parent::exportFormatParameters();
348 - }
 344+ return array_merge( parent::getParameters(), $this->exportFormatParameters() );
349345 }
350346 }
351347
@@ -426,6 +422,8 @@
427423
428424 /**
429425 * Creates the vCard output for a single item.
 426+ *
 427+ * CAUTION: this might hurt your eyes
430428 */
431429 public function text() {
432430 $text = "BEGIN:VCARD\r\n";