Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -44,6 +44,7 @@ |
45 | 45 | } |
46 | 46 | |
47 | 47 | $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? trim( $this->m_params['autocaptions'] ) != 'off' : true; |
| 48 | + $this->m_params['fileextensions'] = isset( $this->m_params['fileextensions'] ) ? trim( $this->m_params['fileextensions'] ) != 'off' : true; |
48 | 49 | |
49 | 50 | $printReqLabels = array(); |
50 | 51 | |
— | — | @@ -148,7 +149,16 @@ |
149 | 150 | global $wgParser; |
150 | 151 | |
151 | 152 | if ( empty( $imgCaption ) ) { |
152 | | - $imgCaption = $this->m_params['autocaptions'] ? preg_replace( '#\.[^.]+$#', '', $imgTitle->getBaseText() ) : ''; |
| 153 | + if ( $this->m_params['autocaptions'] ) { |
| 154 | + $imgCaption = $imgTitle->getBaseText(); |
| 155 | + |
| 156 | + if ( !$this->m_params['fileextensions'] ) { |
| 157 | + $imgCaption = preg_replace( '#\.[^.]+$#', '', $imgCaption ); |
| 158 | + } |
| 159 | + } |
| 160 | + else { |
| 161 | + $imgCaption = ''; |
| 162 | + } |
153 | 163 | } |
154 | 164 | else { |
155 | 165 | $imgCaption = $wgParser->recursiveTagParse( $imgCaption ); |
— | — | @@ -189,6 +199,10 @@ |
190 | 200 | $params['autocaptions']->setDescription( wfMsg( 'srf_paramdesc_autocaptions' ) ); |
191 | 201 | $params['autocaptions']->setDefault( true ); |
192 | 202 | |
| 203 | + $params['fileextensions'] = new Parameter( 'fileextensions', Parameter::TYPE_BOOLEAN ); |
| 204 | + $params['fileextensions']->setDescription( wfMsg( 'srf_paramdesc_fileextensions' ) ); |
| 205 | + $params['fileextensions']->setDefault( false ); |
| 206 | + |
193 | 207 | $params['captionproperty'] = new Parameter( 'captionproperty' ); |
194 | 208 | $params['captionproperty']->setDescription( wfMsg( 'srf_paramdesc_captionproperty' ) ); |
195 | 209 | $params['captionproperty']->setDefault( '' ); |
— | — | @@ -206,6 +220,7 @@ |
207 | 221 | $params[] = array( 'name' => 'imageproperty', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_imageproperty' ) ); |
208 | 222 | |
209 | 223 | $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) ); |
| 224 | + $params[] = array( 'name' => 'fileextensions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_fileextensions' ), 'values' => array( 'on', 'off' ) ); |
210 | 225 | } |
211 | 226 | |
212 | 227 | return $params; |