r94385 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94384‎ | r94385 | r94386 >
Date:21:13, 12 August 2011
Author:hartman
Status:deferred (Comments)
Tags:
Comment:
Html5 player should be able to output actual valid Html5.
Modified paths:
  • /trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
@@ -73,17 +73,17 @@
7474 if( $this->width <= $wgMinimumVideoPlayerSize && $this->isVideo ){
7575 return $this->getImagePopUp();
7676 } else {
77 - return $this->getXmlMediaTagOutput();
 77+ return $this->getHtmlMediaTagOutput();
7878 }
7979 }
80 - // XXX migrate this to the mediawiki XML class as 'tagSet' helper function
81 - static function xmlTagSet( $tagName, $tagSet ){
 80+ // XXX migrate this to the mediawiki Html class as 'tagSet' helper function
 81+ static function htmlTagSet( $tagName, $tagSet ){
8282 $s = '';
8383 if( empty( $tagSet ) ){
8484 return '';
8585 }
8686 foreach( $tagSet as $attr ){
87 - $s.= Xml::tags($tagName, $attr, '');
 87+ $s.= Html::rawElement($tagName, $attr, '');
8888 }
8989 return $s;
9090 }
@@ -94,7 +94,7 @@
9595 'class' => 'PopUpMediaTransform',
9696 'style' => "width:" . intval( $this->width ) . "px;height:" .
9797 intval( $this->height ) . "px",
98 - 'data-videopayload' => $this->getXmlMediaTagOutput( $this->getPopupPlayerSize() ),
 98+ 'data-videopayload' => $this->getHtmlMediaTagOutput( $this->getPopupPlayerSize() ),
9999 ),
100100 Xml::tags( 'img', array(
101101 'style' => "width:" . intval( $this->width ) . "px;height:" .
@@ -128,7 +128,7 @@
129129 * Call mediaWiki xml helper class to build media tag output from
130130 * supplied arrays
131131 */
132 - function getXmlMediaTagOutput( $sizeOverride = array() ){
 132+ function getHtmlMediaTagOutput( $sizeOverride = array() ){
133133 // Try to get the first source src attribute ( usually this should be the source file )
134134 $mediaSources = $this->getMediaSources();
135135 $firstSource = current( $mediaSources );
@@ -137,13 +137,13 @@
138138 return 'Error missing media source';
139139 };
140140 // Build the video tag output:
141 - $s = Xml::tags( $this->getTagName(), $this->getMediaAttr( $sizeOverride ),
 141+ $s = Html::rawElement( $this->getTagName(), $this->getMediaAttr( $sizeOverride ),
142142
143143 // The set of media sources:
144 - self::xmlTagSet( 'source', $mediaSources ) .
 144+ self::htmlTagSet( 'source', $mediaSources ) .
145145
146146 // Timed text:
147 - self::xmlTagSet( 'track', $this->getTextHandler()->getTracks() ) .
 147+ self::htmlTagSet( 'track', $this->getTextHandler()->getTracks() ) .
148148
149149 // Fallback text displayed for browsers without js and without video tag support:
150150 /// XXX note we may want to replace this with an image and download link play button

Sign-offs

UserFlagDate
Simetricalinspected19:20, 15 August 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r94479Use Html::element instead....hartman20:13, 14 August 2011

Comments

#Comment by Simetrical (talk | contribs)   15:42, 14 August 2011
-			$s.= Xml::tags($tagName, $attr, );
+			$s.= Html::rawElement($tagName, $attr, );

There's no reason to use Html::rawElement() if the contents are empty. There's no reason to provide the third parameter either, since it defaults to the empty string. This should be

+			$s.= Html::element( $tagName, $attr );

(note also spacing, while I'm at it).

I dunno what the conventions are these days for marking fixme, so change this back to new if the fixme is unwarranted. I'll sign off as inspected with this change made.

#Comment by Simetrical (talk | contribs)   15:43, 14 August 2011

Actually that should be

+			$s .= Html::element( $tagName, $attr );

with an extra space before the .= too. The whole file could probably use some stylize.php. But that's a detail.

Status & tagging log