r98517 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98516‎ | r98517 | r98518 >
Date:14:31, 30 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r98488; fixing compat of ical format
Modified paths:
  • /trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php
@@ -15,25 +15,15 @@
1616 * @ingroup SemanticResultFormats
1717 */
1818 class SRFiCalendar extends SMWResultPrinter {
19 - protected $m_title = '';
20 - protected $m_description = '';
 19+
 20+ protected $m_title;
 21+ protected $m_description;
2122
22 - protected function handleParameters( $params, $outputmode ) {
 23+ protected function handleParameters( array $params, $outputmode ) {
2324 parent::handleParameters( $params, $outputmode );
2425
25 - if ( array_key_exists( 'title', $this->m_params ) ) {
26 - $this->m_title = trim( $this->m_params['title'] );
27 - // for backward compatibility
28 - } elseif ( array_key_exists( 'icalendartitle', $this->m_params ) ) {
29 - $this->m_title = trim( $this->m_params['icalendartitle'] );
30 - }
31 -
32 - if ( array_key_exists( 'description', $this->m_params ) ) {
33 - $this->m_description = trim( $this->m_params['description'] );
34 - // for backward compatibility
35 - } elseif ( array_key_exists( 'icalendardescription', $this->m_params ) ) {
36 - $this->m_description = trim( $this->m_params['icalendardescription'] );
37 - }
 26+ $this->m_params = trim( $this->m_params['title'] );
 27+ $this->m_description = trim( $this->m_params['icalendardescription'] );
3828 }
3929
4030 public function getMimeType( $res ) {
@@ -244,25 +234,16 @@
245235 }
246236
247237 public function getParameters() {
248 - if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) {
249 - $params = array_merge( parent::getParameters(), $this->exportFormatParameters() );
250 -
251 - $params['title'] = new Parameter( 'title' );
252 - $params['title']->setDescription( wfMsg( 'srf_paramdesc_icalendartitle' ) );
253 - $params['title']->setDefault( '' );
254 -
255 - $params['description'] = new Parameter( 'description' );
256 - $params['description']->setDescription( wfMsg( 'srf_paramdesc_icalendardescription' ) );
257 - $params['description']->setDefault( '' );
258 - }
259 - else {
260 - // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects.
261 - $params = parent::exportFormatParameters();
262 -
263 - $params[] = array( 'name' => 'title', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_icalendartitle' ) );
264 - $params[] = array( 'name' => 'description', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_icalendardescription' ) );
265 - }
 238+ $params = array_merge( parent::getParameters(), $this->exportFormatParameters() );
266239
 240+ $params['title'] = new Parameter( 'title' );
 241+ $params['title']->setMessage( 'srf_paramdesc_icalendartitle' );
 242+ $params['title']->setDefault( '' );
 243+
 244+ $params['description'] = new Parameter( 'description' );
 245+ $params['description']->setMessage( 'srf_paramdesc_icalendardescription' );
 246+ $params['description']->setDefault( '' );
 247+
267248 return $params;
268249 }
269250

Follow-up revisions

RevisionCommit summaryAuthorDate
r98518follow up to r98517jeroendedauw14:33, 30 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98488refactoring nessasery because of changes in r98036...dasch23:20, 29 September 2011