r25658 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25657‎ | r25658 | r25659 >
Date:08:58, 8 September 2007
Author:tstarling
Status:old
Tags:
Comment:
noicon option for audio players
Modified paths:
  • /trunk/extensions/OggHandler/OggHandler.i18n.php (modified) (history)
  • /trunk/extensions/OggHandler/OggHandler_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OggHandler/OggHandler_body.php
@@ -24,6 +24,7 @@
2525 return array(
2626 'img_width' => 'width',
2727 'ogg_noplayer' => 'noplayer',
 28+ 'ogg_noicon' => 'noicon',
2829 'ogg_thumbtime' => 'thumbtime',
2930 );
3031 }
@@ -178,6 +179,7 @@
179180 $height = $srcWidth == 0 ? $srcHeight : $width * $srcHeight / $srcWidth;
180181 $length = $this->getLength( $file );
181182 $noPlayer = isset( $params['noplayer'] );
 183+ $noIcon = isset( $params['noicon'] );
182184
183185 if ( !$noPlayer ) {
184186 // Hack for miscellaneous callers
@@ -204,7 +206,7 @@
205207 } else {
206208 $width = $params['width'];
207209 }
208 - return new OggAudioDisplay( $file, $file->getURL(), $width, $height, $length, $dstPath );
 210+ return new OggAudioDisplay( $file, $file->getURL(), $width, $height, $length, $dstPath, $noIcon );
209211 }
210212
211213 // Video thumbnail only
@@ -450,7 +452,9 @@
451453 class OggTransformOutput extends MediaTransformOutput {
452454 static $serial = 0;
453455
454 - function __construct( $file, $videoUrl, $thumbUrl, $width, $height, $length, $isVideo, $path ) {
 456+ function __construct( $file, $videoUrl, $thumbUrl, $width, $height, $length, $isVideo,
 457+ $path, $noIcon = false )
 458+ {
455459 $this->file = $file;
456460 $this->videoUrl = $videoUrl;
457461 $this->url = $thumbUrl;
@@ -459,6 +463,7 @@
460464 $this->length = round( $length );
461465 $this->isVideo = $isVideo;
462466 $this->path = $path;
 467+ $this->noIcon = $noIcon;
463468 }
464469
465470 function toHtml( $options = array() ) {
@@ -502,7 +507,7 @@
503508 } else {
504509 // make an icon later if necessary
505510 $imgAttribs = false;
506 - $showDescIcon = true;
 511+ $showDescIcon = !$this->noIcon;
507512 //$thumbDivAttribs = array( 'style' => 'text-align: right;' );
508513 }
509514 $msgStartPlayer = wfMsg( 'ogg-play-sound' );
@@ -525,9 +530,11 @@
526531 $descIcon = Xml::tags( 'a', $linkAttribs,
527532 Xml::element( 'img', $imgAttribs, null ) );
528533 $thumb = '';
529 - } else {
 534+ } elseif ( $imgAttribs ) {
530535 $thumb = Xml::tags( 'a', $linkAttribs,
531536 Xml::element( 'img', $imgAttribs, null ) );
 537+ } else {
 538+ $thumb = '';
532539 }
533540 $linkUrl = $linkAttribs['href'];
534541 } else {
@@ -582,13 +589,13 @@
583590
584591 class OggVideoDisplay extends OggTransformOutput {
585592 function __construct( $file, $videoUrl, $thumbUrl, $width, $height, $length, $path ) {
586 - parent::__construct( $file, $videoUrl, $thumbUrl, $width, $height, $length, true, $path );
 593+ parent::__construct( $file, $videoUrl, $thumbUrl, $width, $height, $length, true, $path, false );
587594 }
588595 }
589596
590597 class OggAudioDisplay extends OggTransformOutput {
591 - function __construct( $file, $videoUrl, $width, $height, $length, $path ) {
592 - parent::__construct( $file, $videoUrl, false, $width, $height, $length, false, $path );
 598+ function __construct( $file, $videoUrl, $width, $height, $length, $path, $noIcon = false ) {
 599+ parent::__construct( $file, $videoUrl, false, $width, $height, $length, false, $path, $noIcon );
593600 }
594601 }
595602
Index: trunk/extensions/OggHandler/OggHandler.i18n.php
@@ -266,6 +266,7 @@
267267 $magicWords = array(
268268 'en' => array(
269269 'ogg_noplayer' => array( 0, 'noplayer' ),
 270+ 'ogg_noicon' => array( 0, 'noicon' ),
270271 'ogg_thumbtime' => array( 0, 'thumbtime=$1' ),
271272 ),
272273 );

Status & tagging log