* Added wfMsgHtml() function for escaping messages and leaving params intact
* Fix ordering of Special:Listusers; fix groups list so it shows all groups
when searching for a specific group and can't be split across pages
-
+* (bug 1702) Display a handy upload link instead of a useless blank link
+ for [[media:]] links to nonexistent files.
=== Caveats ===
} else {
$name = $title->getDBKey();
$img = new Image( $title );
- $url = $img->getURL();
- if( $nourl ) {
- $url = str_replace( "http://", "http-noparse://", $url );
+ if( $img->exists() ) {
+ $url = $img->getURL();
+ if( $nourl ) {
+ $url = str_replace( "http://", "http-noparse://", $url );
+ }
+ $class = 'internal';
+ } else {
+ $upload = Title::makeTitle( NS_SPECIAL, 'Upload' );
+ $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $img->getName() ) );
+ $class = 'new';
}
$alt = htmlspecialchars( $title->getText() );
if( $text == '' ) {
$text = $alt;
}
$u = htmlspecialchars( $url );
- return "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$text}</a>";
+ return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";
}
}
</p>
!! end
+!! test
+Media link to nonexistent file (bug 1702)
+!! input
+[[Media:No such.jpg]]
+!! result
+<p><a href="/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class='new' title="No such.jpg">Media:No such.jpg</a>
+</p>
+!! end
+
+
!! test
Character reference normalization in link text (bug 1938)