r28333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28332‎ | r28333 | r28334 >
Date:02:17, 10 December 2007
Author:tlaqua
Status:old
Tags:
Comment:
Fixing tolerance to non-existent Titles.
Modified paths:
  • /trunk/extensions/Icon/Icon.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Icon/Icon.php
@@ -55,20 +55,22 @@
5656 $ptitle = Title::newFromText( $page );
5757
5858 // this might happen in templates...
59 - if (!is_object( $ptitle ))
60 - return 'IconLink: invalid title name.';
61 -
62 - if ( $ptitle->isLocal() )
63 - {
64 - $tURL = $ptitle->getLocalUrl();
65 - $aClass='';
 59+ if (!is_object( $ptitle )) {
 60+ //May be too assuming... w/e.
 61+ $output = $imageString;
 62+ } else {
 63+ if ( $ptitle->isLocal() )
 64+ {
 65+ $tURL = $ptitle->getLocalUrl();
 66+ $aClass='';
 67+ }
 68+ else
 69+ {
 70+ $tURL = $ptitle->getFullURL();
 71+ $aClass = 'class="extiw"';
 72+ }
 73+ $output = "<a ".$aClass." href='${tURL}'>{$imageString}</a>";
6674 }
67 - else
68 - {
69 - $tURL = $ptitle->getFullURL();
70 - $aClass = 'class="extiw"';
71 - }
72 - $output = "<a ".$aClass." href='${tURL}'>{$imageString}</a>";
7375 } else {
7476 $output = $imageString;
7577 }

Status & tagging log