r83598 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83597‎ | r83598 | r83599 >
Date:18:09, 9 March 2011
Author:maxsem
Status:deferred
Tags:
Comment:
ImageTagging: use proper accessor
Modified paths:
  • /trunk/extensions/ImageTagging/ImageTagging.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageTagging/ImageTagging.php
@@ -410,8 +410,8 @@
411411
412412 $this->modifiedImagePageOpenShowImage();
413413
414 - if ( $this->img->exists() ) {
415 - $tagList = wfGetImageTags($this->img, $imgName);
 414+ if ( $this->getFile()->exists() ) {
 415+ $tagList = wfGetImageTags($this->getFile(), $imgName);
416416
417417 #if ( $tagList )
418418 $wgOut->addHTML("<div id='tagListDiv'><span id='tagList'>$tagList</span></div>");
@@ -425,7 +425,7 @@
426426
427427 wfProfileIn( __METHOD__ );
428428
429 - $full_url = $this->img->getURL();
 429+ $full_url = $this->getFile()->getURL();
430430 $anchoropen = '';
431431 $anchorclose = '';
432432
@@ -444,17 +444,17 @@
445445 $maxHeight = 460;
446446 $sk = $wgUser->getSkin();
447447
448 - if ( $this->img->exists() ) {
 448+ if ( $this->getFile()->exists() ) {
449449 # image
450 - $width = $this->img->getWidth();
451 - $height = $this->img->getHeight();
 450+ $width = $this->getFile()->getWidth();
 451+ $height = $this->getFile()->getHeight();
452452 $showLink = false;
453453
454 - if ( $this->img->allowInlineDisplay() and $width and $height) {
 454+ if ( $this->getFile()->allowInlineDisplay() and $width and $height) {
455455 # image
456456
457457 # "Download high res version" link below the image
458 - $msg = wfMsgHtml('show-big-image', $width, $height, intval( $this->img->getSize()/1024 ) );
 458+ $msg = wfMsgHtml('show-big-image', $width, $height, intval( $this->getFile()->getSize()/1024 ) );
459459
460460 # We'll show a thumbnail of this image
461461 if ( $width > $maxWidth || $height > $maxHeight ) {
@@ -472,22 +472,22 @@
473473 # because of rounding.
474474 }
475475
476 - $thumbnail = $this->img->getThumbnail( $width );
 476+ $thumbnail = $this->getFile()->getThumbnail( $width );
477477 if ( $thumbnail == null ) {
478 - $url = $this->img->getViewURL();
 478+ $url = $this->getFile()->getViewURL();
479479 } else {
480480 $url = $thumbnail->getURL();
481481 }
482482
483483 $anchoropen = "<a href=\"{$full_url}\">";
484484 $anchorclose = "</a><br />";
485 - if( $this->img->mustRender() ) {
 485+ if( $this->getFile()->mustRender() ) {
486486 $showLink = true;
487487 } else {
488488 $anchorclose .= "\n$anchoropen{$msg}</a>";
489489 }
490490 } else {
491 - $url = $this->img->getViewURL();
 491+ $url = $this->getFile()->getViewURL();
492492 $showLink = true;
493493 }
494494
@@ -501,8 +501,8 @@
502502 $anchoropen . $anchorclose . '</div>' );
503503 } else {
504504 #if direct link is allowed but it's not a renderable image, show an icon.
505 - if ($this->img->isSafeFile()) {
506 - $icon= $this->img->iconThumb();
 505+ if ($this->getFile()->isSafeFile()) {
 506+ $icon= $this->getFile()->iconThumb();
507507
508508 $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
509509 $icon->toHtml() .
@@ -513,12 +513,12 @@
514514 }
515515
516516 if ($showLink) {
517 - $filename = wfEscapeWikiText( $this->img->getName() );
 517+ $filename = wfEscapeWikiText( $this->getFile()->getName() );
518518 $info = wfMsg( 'file-info',
519 - $sk->formatSize( $this->img->getSize() ),
520 - $this->img->getMimeType() );
 519+ $sk->formatSize( $this->getFile()->getSize() ),
 520+ $this->getFile()->getMimeType() );
521521
522 - if (!$this->img->isSafeFile()) {
 522+ if (!$this->getFile()->isSafeFile()) {
523523 $warning = wfMsg( 'mediawarning' );
524524 $wgOut->addWikiText( <<<END
525525 <div class="fullMedia">
@@ -539,7 +539,7 @@
540540 }
541541 }
542542
543 - if($this->img->fromSharedDirectory) {
 543+ if($this->getFile()->fromSharedDirectory) {
544544 $this->printSharedImageText();
545545 }
546546 } else {

Status & tagging log