r92160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92159‎ | r92160 | r92161 >
Date:15:16, 14 July 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added missing param descriptions and trim param value
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php
@@ -43,7 +43,7 @@
4444 $ig->setHeights( $this->m_params['heights'] );
4545 }
4646
47 - $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? $this->m_params['autocaptions'] != 'off' : true;
 47+ $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? trim( $this->m_params['autocaptions'] ) != 'off' : true;
4848
4949 $printReqLabels = array();
5050
@@ -148,7 +148,7 @@
149149 global $wgParser;
150150
151151 if ( empty( $imgCaption ) ) {
152 - $imgCaption = $this->m_params['autocaptions'] ? preg_replace( '#\.[^.]+$#', '', $imgTitle->getBaseText() ) : '';
 152+ $imgCaption = $this->m_params['autocaptions'] ? preg_replace( '#\.[^.]+$#', '', $imgTitle->getBaseText() ) : '';
153153 }
154154 else {
155155 $imgCaption = $wgParser->recursiveTagParse( $imgCaption );
@@ -188,12 +188,22 @@
189189 $params['autocaptions'] = new Parameter( 'autocaptions', Parameter::TYPE_BOOLEAN );
190190 $params['autocaptions']->setDescription( wfMsg( 'srf_paramdesc_autocaptions' ) );
191191 $params['autocaptions']->setDefault( true );
 192+
 193+ $params['captionproperty'] = new Parameter( 'captionproperty' );
 194+ $params['captionproperty']->setDescription( wfMsg( 'srf_paramdesc_captionproperty' ) );
 195+ $params['captionproperty']->setDefault( '' );
 196+
 197+ $params['imageproperty'] = new Parameter( 'imageproperty' );
 198+ $params['imageproperty']->setDescription( wfMsg( 'srf_paramdesc_imageproperty' ) );
 199+ $params['imageproperty']->setDefault( '' );
192200 }
193201 else {
194202 // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects.
195203 $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) );
196204 $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) );
197205 $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) );
 206+ $params[] = array( 'name' => 'captionproperty', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_captionproperty' ) );
 207+ $params[] = array( 'name' => 'imageproperty', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_imageproperty' ) );
198208
199209 $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) );
200210 }