r22828 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22827‎ | r22828 | r22829 >
Date:22:16, 7 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* (bug 8760) Allow wiki links in "protectexpiry" message
* Introduce wfMsgWithLinks() and a content-language counterpart, wfMsgForContentWithLinks(); these escape HTML and render wiki links in text, so should be suitable for labels and so on
* Make Linker::formatLinksInComment() public
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProtectionForm.php
@@ -318,22 +318,11 @@
319319 }
320320
321321 function buildExpiryInput() {
322 - $id = 'mwProtect-expiry';
323 -
324 - $ci = "<tr><td align=\"right\">";
325 - $ci .= wfElement( 'label', array (
326 - 'id' => "$id-label",
327 - 'for' => $id ),
328 - wfMsg( 'protectexpiry' ) );
329 - $ci .= "</td> <td align=\"left\">";
330 - $ci .= wfElement( 'input', array(
331 - 'size' => 60,
332 - 'name' => $id,
333 - 'id' => $id,
334 - 'value' => $this->mExpiry ) + $this->disabledAttrib );
335 - $ci .= "</td></tr>";
336 -
337 - return $ci;
 322+ $attribs = array( 'id' => 'expires' ) + $this->disabledAttrib;
 323+ return '<tr>'
 324+ . '<td><label for="expires">' . wfMsgWithLinks( 'protectexpiry' ) . '</label></td>'
 325+ . '<td>' . Xml::input( 'mwProtect-expiry', 60, $this->mExpiry, $attribs ) . '</td>'
 326+ . '</tr>';
338327 }
339328
340329 function buildWatchInput() {
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -327,6 +327,20 @@
328328 }
329329
330330 /**
 331+ * Get a message in the user interface language and replace wiki
 332+ * links with clickable ones, escaping other HTML
 333+ *
 334+ * @param string $key Message key
 335+ * @return string
 336+ */
 337+function wfMsgWithLinks( $key ) {
 338+ global $wgUser;
 339+ $args = func_get_args();
 340+ return $wgUser->getSkin()->formatLinksInComment( htmlspecialchars(
 341+ call_user_func_array( 'wfMsg', $args ) ) );
 342+}
 343+
 344+/**
331345 * Same as above except doesn't transform the message
332346 */
333347 function wfMsgNoTrans( $key ) {
@@ -369,6 +383,19 @@
370384 }
371385
372386 /**
 387+ * Get a message in the content language and replace wiki
 388+ * links with clickable ones, escaping other HTML
 389+ *
 390+ * @param string $key Message key
 391+ * @return string
 392+ */
 393+function wfMsgForContentWithLinks( $key ) {
 394+ global $wgUser;
 395+ return $wgUser->getSkin()->formatLinksInComment( htmlspecialchars(
 396+ call_user_func_array( 'wfMsgForContent', func_get_args() ) ) );
 397+}
 398+
 399+/**
373400 * Same as above except doesn't transform the message
374401 */
375402 function wfMsgForContentNoTrans( $key ) {
Index: trunk/phase3/includes/Linker.php
@@ -926,12 +926,13 @@
927927 }
928928
929929 /**
930 - * Format regular and media links - all other wiki formatting is ignored
931 - * Called by Linker::formatComment.
932 - * @param $comment The comment text.
933 - * @return Comment text with links using HTML.
 930+ * Formats wiki links and media links in text; all other wiki formatting
 931+ * is ignored
 932+ *
 933+ * @param string $comment Text to format links in
 934+ * @return string
934935 */
935 - private function formatLinksInComment( $comment ) {
 936+ public function formatLinksInComment( $comment ) {
936937 global $wgContLang;
937938
938939 $medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
Index: trunk/phase3/RELEASE-NOTES
@@ -66,6 +66,7 @@
6767 files
6868 * (bug 7997) Allow users to be blocked from using Special:Emailuser
6969 * (bug 8989) Blacklist 'mhtml' and 'mht' files from upload
 70+* (bug 8760) Allow wiki links in "protectexpiry" message
7071
7172 == Bugfixes since 1.10 ==
7273

Follow-up revisions

RevisionCommit summaryAuthorDate
r22857Merged revisions 22811-22855 via svnmerge from...david00:48, 9 June 2007

Status & tagging log