r45228 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45227‎ | r45228 | r45229 >
Date:17:10, 31 December 2008
Author:brion
Status:ok (Comments)
Tags:
Comment:
Revert r45027, r45028 "* summary and subject messages now uses wiki text rather than raw HTML"
Changing the format of existing messages is disruptive, which is why we don't do it as a rule -- we introduce new messages that replace the old ones.
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Xml.php
@@ -277,7 +277,7 @@
278278 * @param $attribs other attributes
279279 * @return string HTML
280280 */
281 - public static function check( $name, $checked=false, $attribs = array() ) {
 281+ public static function check( $name, $checked=false, $attribs=array() ) {
282282 return self::element( 'input', array_merge(
283283 array(
284284 'name' => $name,
@@ -295,7 +295,7 @@
296296 * @param $attribs other attributes
297297 * @return string HTML
298298 */
299 - public static function radio( $name, $value, $checked = false, $attribs = array() ) {
 299+ public static function radio( $name, $value, $checked=false, $attribs=array() ) {
300300 return self::element( 'input', array(
301301 'name' => $name,
302302 'type' => 'radio',
@@ -305,12 +305,11 @@
306306 /**
307307 * Convenience function to build an HTML form label
308308 * @param $label text of the label
309 - * @param $id
310 - * @param $attribs Array: extra attributes
 309+ * @param $id
311310 * @return string HTML
312311 */
313 - public static function label( $label, $id, $attribs = array() ) {
314 - return self::element( 'label', array( 'for' => $id ) + $attribs, $label );
 312+ public static function label( $label, $id ) {
 313+ return self::element( 'label', array( 'for' => $id ), $label );
315314 }
316315
317316 /**
@@ -320,22 +319,21 @@
321320 * @param $id id of the input
322321 * @param $size value of the size attribute
323322 * @param $value value of the value attribute
324 - * @param $inputAttribs other attributes for the input
325 - * @param $labelAttribs other attributes for the label
 323+ * @param $attribs other attributes
326324 * @return string HTML
327325 */
328 - public static function inputLabel( $label, $name, $id, $size = false, $value = false, $inputAttribs = array(), $labelAttribs = array() ) {
329 - list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $inputAttribs, $labelAttribs );
 326+ public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {
 327+ list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
330328 return $label . ' ' . $input;
331329 }
332330
333331 /**
334332 * Same as Xml::inputLabel() but return input and label in an array
335333 */
336 - public static function inputLabelSep( $label, $name, $id, $size = false, $value = false, $inputAttribs = array(), $labelAttribs = array() ) {
 334+ public static function inputLabelSep( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {
337335 return array(
338 - Xml::label( $label, $id, $labelAttribs ),
339 - self::input( $name, $size, $value, array( 'id' => $id ) + $inputAttribs )
 336+ Xml::label( $label, $id ),
 337+ self::input( $name, $size, $value, array( 'id' => $id ) + $attribs )
340338 );
341339 }
342340
@@ -343,20 +341,20 @@
344342 * Convenience function to build an HTML checkbox with a label
345343 * @return string HTML
346344 */
347 - public static function checkLabel( $label, $name, $id, $checked = false, $inputAttribs = array(), $labelAttribs = array() ) {
348 - return self::check( $name, $checked, array( 'id' => $id ) + $inputAttribs ) .
 345+ public static function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) {
 346+ return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .
349347 ' ' .
350 - self::label( $label, $id, $labelAttribs );
 348+ self::label( $label, $id );
351349 }
352350
353351 /**
354352 * Convenience function to build an HTML radio button with a label
355353 * @return string HTML
356354 */
357 - public static function radioLabel( $label, $name, $value, $id, $checked = false, $inputAttribs = array(), $labelAttribs = array() ) {
358 - return self::radio( $name, $value, $checked, array( 'id' => $id ) + $inputAttribs ) .
 355+ public static function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) {
 356+ return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .
359357 ' ' .
360 - self::label( $label, $id, $labelAttribs );
 358+ self::label( $label, $id );
361359 }
362360
363361 /**
@@ -365,7 +363,7 @@
366364 * @param $attribs Array: optional custom attributes
367365 * @return string HTML
368366 */
369 - public static function submitButton( $value, $attribs = array() ) {
 367+ public static function submitButton( $value, $attribs=array() ) {
370368 return self::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs );
371369 }
372370
@@ -376,7 +374,7 @@
377375 * @param $attribs Array: optional custom attributes
378376 * @return string HTML
379377 */
380 - public static function hidden( $name, $value, $attribs = array() ) {
 378+ public static function hidden( $name, $value, $attribs=array() ) {
381379 return self::element( 'input', array(
382380 'name' => $name,
383381 'type' => 'hidden',
@@ -391,8 +389,8 @@
392390 * @param $attribs array: optional additional HTML attributes
393391 * @return string HTML
394392 */
395 - public static function option( $text, $value = null, $selected = false,
396 - $attribs = array() ) {
 393+ public static function option( $text, $value=null, $selected=false,
 394+ $attribs=array() ) {
397395 if( !is_null( $value ) ) {
398396 $attribs['value'] = $value;
399397 }
@@ -426,7 +424,7 @@
427425 } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) {
428426 // A new group is starting ...
429427 $value = trim( substr( $value, 1 ) );
430 - if( $optgroup ) $options .= self::closeElement( 'optgroup' );
 428+ if( $optgroup ) $options .= self::closeElement('optgroup');
431429 $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
432430 $optgroup = true;
433431 } elseif ( substr( $value, 0, 2) == '**' ) {
@@ -435,7 +433,7 @@
436434 $options .= self::option( $value, $value, $selected === $value );
437435 } else {
438436 // groupless reason list
439 - if( $optgroup ) $options .= self::closeElement( 'optgroup' );
 437+ if( $optgroup ) $options .= self::closeElement('optgroup');
440438 $options .= self::option( $value, $value, $selected === $value );
441439 $optgroup = false;
442440 }
Index: trunk/phase3/includes/EditPage.php
@@ -17,30 +17,30 @@
1818 * usually the same, but they are now allowed to be different.
1919 */
2020 class EditPage {
21 - const AS_SUCCESS_UPDATE = 200;
22 - const AS_SUCCESS_NEW_ARTICLE = 201;
23 - const AS_HOOK_ERROR = 210;
24 - const AS_FILTERING = 211;
25 - const AS_HOOK_ERROR_EXPECTED = 212;
26 - const AS_BLOCKED_PAGE_FOR_USER = 215;
27 - const AS_CONTENT_TOO_BIG = 216;
28 - const AS_USER_CANNOT_EDIT = 217;
29 - const AS_READ_ONLY_PAGE_ANON = 218;
30 - const AS_READ_ONLY_PAGE_LOGGED = 219;
31 - const AS_READ_ONLY_PAGE = 220;
32 - const AS_RATE_LIMITED = 221;
33 - const AS_ARTICLE_WAS_DELETED = 222;
34 - const AS_NO_CREATE_PERMISSION = 223;
35 - const AS_BLANK_ARTICLE = 224;
36 - const AS_CONFLICT_DETECTED = 225;
37 - const AS_SUMMARY_NEEDED = 226;
38 - const AS_TEXTBOX_EMPTY = 228;
39 - const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229;
40 - const AS_OK = 230;
41 - const AS_END = 231;
42 - const AS_SPAM_ERROR = 232;
43 - const AS_IMAGE_REDIRECT_ANON = 233;
44 - const AS_IMAGE_REDIRECT_LOGGED = 234;
 21+ const AS_SUCCESS_UPDATE = 200;
 22+ const AS_SUCCESS_NEW_ARTICLE = 201;
 23+ const AS_HOOK_ERROR = 210;
 24+ const AS_FILTERING = 211;
 25+ const AS_HOOK_ERROR_EXPECTED = 212;
 26+ const AS_BLOCKED_PAGE_FOR_USER = 215;
 27+ const AS_CONTENT_TOO_BIG = 216;
 28+ const AS_USER_CANNOT_EDIT = 217;
 29+ const AS_READ_ONLY_PAGE_ANON = 218;
 30+ const AS_READ_ONLY_PAGE_LOGGED = 219;
 31+ const AS_READ_ONLY_PAGE = 220;
 32+ const AS_RATE_LIMITED = 221;
 33+ const AS_ARTICLE_WAS_DELETED = 222;
 34+ const AS_NO_CREATE_PERMISSION = 223;
 35+ const AS_BLANK_ARTICLE = 224;
 36+ const AS_CONFLICT_DETECTED = 225;
 37+ const AS_SUMMARY_NEEDED = 226;
 38+ const AS_TEXTBOX_EMPTY = 228;
 39+ const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229;
 40+ const AS_OK = 230;
 41+ const AS_END = 231;
 42+ const AS_SPAM_ERROR = 232;
 43+ const AS_IMAGE_REDIRECT_ANON = 233;
 44+ const AS_IMAGE_REDIRECT_LOGGED = 234;
4545
4646 var $mArticle;
4747 var $mTitle;
@@ -237,7 +237,7 @@
238238 * To turn the feature on, set $wgUseMetadataEdit = true ; in LocalSettings
239239 * and set $wgMetadataWhitelist to the *full* title of the template whitelist
240240 */
241 - function extractMetaDataFromArticle() {
 241+ function extractMetaDataFromArticle () {
242242 global $wgUseMetadataEdit, $wgMetadataWhitelist, $wgContLang;
243243 $this->mMetaData = '';
244244 if ( !$wgUseMetadataEdit ) return;
@@ -546,9 +546,9 @@
547547 */
548548 function importFormData( &$request ) {
549549 global $wgLang, $wgUser;
 550+ $fname = 'EditPage::importFormData';
 551+ wfProfileIn( $fname );
550552
551 - wfProfileIn( __METHOD__ );
552 -
553553 # Section edit can come from either the form or a link
554554 $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
555555
@@ -572,7 +572,7 @@
573573
574574 if ( is_null( $this->edittime ) ) {
575575 # If the form is incomplete, force to preview.
576 - wfDebug( __METHOD__ . ": Form data appears to be incomplete\n" );
 576+ wfDebug( "$fname: Form data appears to be incomplete\n" );
577577 wfDebug( "POST DATA: " . var_export( $_POST, true ) . "\n" );
578578 $this->preview = true;
579579 } else {
@@ -589,14 +589,14 @@
590590 # if the user hits enter in the comment box.
591591 # The unmarked state will be assumed to be a save,
592592 # if the form seems otherwise complete.
593 - wfDebug( __METHOD__ . ": Passed token check.\n" );
 593+ wfDebug( "$fname: Passed token check.\n" );
594594 } else if ( $this->diff ) {
595595 # Failed token check, but only requested "Show Changes".
596 - wfDebug( __METHOD__ . ": Failed token check; Show Changes requested.\n" );
 596+ wfDebug( "$fname: Failed token check; Show Changes requested.\n" );
597597 } else {
598598 # Page might be a hack attempt posted from
599599 # an external site. Preview instead of saving.
600 - wfDebug( __METHOD__ . ": Failed token check; forcing preview\n" );
 600+ wfDebug( "$fname: Failed token check; forcing preview\n" );
601601 $this->preview = true;
602602 }
603603 }
@@ -626,7 +626,7 @@
627627 $this->autoSumm = $request->getText( 'wpAutoSummary' );
628628 } else {
629629 # Not a posted form? Start with nothing.
630 - wfDebug( __METHOD__ . ": Not a posted form.\n" );
 630+ wfDebug( "$fname: Not a posted form.\n" );
631631 $this->textbox1 = '';
632632 $this->textbox2 = '';
633633 $this->mMetaData = '';
@@ -651,7 +651,7 @@
652652 $this->live = $request->getCheck( 'live' );
653653 $this->editintro = $request->getText( 'editintro' );
654654
655 - wfProfileOut( __METHOD__ );
 655+ wfProfileOut( $fname );
656656 }
657657
658658 /**
@@ -731,8 +731,9 @@
732732 global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
733733 global $wgMaxArticleSize;
734734
735 - wfProfileIn( __METHOD__ );
736 - wfProfileIn( __METHOD__ . '-checks' );
 735+ $fname = 'EditPage::attemptSave';
 736+ wfProfileIn( $fname );
 737+ wfProfileIn( "$fname-checks" );
737738
738739 if ( !wfRunHooks( 'EditPage::attemptSave', array( &$this ) ) )
739740 {
@@ -766,96 +767,96 @@
767768 $pdbk = $this->mTitle->getPrefixedDBkey();
768769 $match = str_replace( "\n", '', $match );
769770 wfDebugLog( 'SpamRegex', "$ip spam regex hit [[$pdbk]]: \"$match\"" );
770 - wfProfileOut( __METHOD__ . '-checks' );
771 - wfProfileOut( __METHOD__ );
 771+ wfProfileOut( "$fname-checks" );
 772+ wfProfileOut( $fname );
772773 return self::AS_SPAM_ERROR;
773774 }
774775 if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section, $this->hookError, $this->summary ) ) {
775776 # Error messages or other handling should be performed by the filter function
776 - wfProfileOut( __METHOD__ . '-checks' );
777 - wfProfileOut( __METHOD__ );
 777+ wfProfileOut( "$fname-checks" );
 778+ wfProfileOut( $fname );
778779 return self::AS_FILTERING;
779780 }
780781 if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError, $this->summary ) ) ) {
781782 # Error messages etc. could be handled within the hook...
782 - wfProfileOut( __METHOD__ . '-checks' );
783 - wfProfileOut( __METHOD__ );
 783+ wfProfileOut( "$fname-checks" );
 784+ wfProfileOut( $fname );
784785 return self::AS_HOOK_ERROR;
785786 } elseif ( $this->hookError != '' ) {
786787 # ...or the hook could be expecting us to produce an error
787 - wfProfileOut( __METHOD__ . '-checks' );
788 - wfProfileOut( __METHOD__ );
 788+ wfProfileOut( "$fname-checks" );
 789+ wfProfileOut( $fname );
789790 return self::AS_HOOK_ERROR_EXPECTED;
790791 }
791792 if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
792793 # Check block state against master, thus 'false'.
793 - wfProfileOut( __METHOD__ . '-checks' );
794 - wfProfileOut( __METHOD__ );
 794+ wfProfileOut( "$fname-checks" );
 795+ wfProfileOut( $fname );
795796 return self::AS_BLOCKED_PAGE_FOR_USER;
796797 }
797798 $this->kblength = (int)(strlen( $this->textbox1 ) / 1024);
798799 if ( $this->kblength > $wgMaxArticleSize ) {
799800 // Error will be displayed by showEditForm()
800801 $this->tooBig = true;
801 - wfProfileOut( __METHOD__ . '-checks' );
802 - wfProfileOut( __METHOD__ );
 802+ wfProfileOut( "$fname-checks" );
 803+ wfProfileOut( $fname );
803804 return self::AS_CONTENT_TOO_BIG;
804805 }
805806
806807 if ( !$wgUser->isAllowed('edit') ) {
807808 if ( $wgUser->isAnon() ) {
808 - wfProfileOut( __METHOD__ . '-checks' );
809 - wfProfileOut( __METHOD__ );
 809+ wfProfileOut( "$fname-checks" );
 810+ wfProfileOut( $fname );
810811 return self::AS_READ_ONLY_PAGE_ANON;
811812 }
812813 else {
813 - wfProfileOut( __METHOD__ . '-checks' );
814 - wfProfileOut( __METHOD__ );
 814+ wfProfileOut( "$fname-checks" );
 815+ wfProfileOut( $fname );
815816 return self::AS_READ_ONLY_PAGE_LOGGED;
816817 }
817818 }
818819
819820 if ( wfReadOnly() ) {
820 - wfProfileOut( __METHOD__ . '-checks' );
821 - wfProfileOut( __METHOD__ );
 821+ wfProfileOut( "$fname-checks" );
 822+ wfProfileOut( $fname );
822823 return self::AS_READ_ONLY_PAGE;
823824 }
824825 if ( $wgUser->pingLimiter() ) {
825 - wfProfileOut( __METHOD__ . '-checks' );
826 - wfProfileOut( __METHOD__ );
 826+ wfProfileOut( "$fname-checks" );
 827+ wfProfileOut( $fname );
827828 return self::AS_RATE_LIMITED;
828829 }
829830
830831 # If the article has been deleted while editing, don't save it without
831832 # confirmation
832833 if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) {
833 - wfProfileOut( __METHOD__ . '-checks' );
834 - wfProfileOut( __METHOD__ );
 834+ wfProfileOut( "$fname-checks" );
 835+ wfProfileOut( $fname );
835836 return self::AS_ARTICLE_WAS_DELETED;
836837 }
837838
838 - wfProfileOut( __METHOD__ . '-checks' );
 839+ wfProfileOut( "$fname-checks" );
839840
840841 # If article is new, insert it.
841842 $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
842843 if ( 0 == $aid ) {
843844 // Late check for create permission, just in case *PARANOIA*
844845 if ( !$this->mTitle->userCan( 'create' ) ) {
845 - wfDebug( __METHOD__ . ": no create permission\n" );
846 - wfProfileOut( __METHOD__ );
 846+ wfDebug( "$fname: no create permission\n" );
 847+ wfProfileOut( $fname );
847848 return self::AS_NO_CREATE_PERMISSION;
848849 }
849850
850851 # Don't save a new article if it's blank.
851852 if ( '' == $this->textbox1 ) {
852 - wfProfileOut( __METHOD__ );
 853+ wfProfileOut( $fname );
853854 return self::AS_BLANK_ARTICLE;
854855 }
855856
856857 // Run post-section-merge edit filter
857858 if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
858859 # Error messages etc. could be handled within the hook...
859 - wfProfileOut( __METHOD__ );
 860+ wfProfileOut( $fname );
860861 return self::AS_HOOK_ERROR;
861862 }
862863
@@ -864,7 +865,7 @@
865866 $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
866867 $this->minoredit, $this->watchthis, false, $isComment, $bot);
867868
868 - wfProfileOut( __METHOD__ );
 869+ wfProfileOut( $fname );
869870 return self::AS_SUCCESS_NEW_ARTICLE;
870871 }
871872
@@ -929,7 +930,7 @@
930931 }
931932
932933 if ( $this->isConflict ) {
933 - wfProfileOut( __METHOD__ );
 934+ wfProfileOut( $fname );
934935 return self::AS_CONFLICT_DETECTED;
935936 }
936937
@@ -938,7 +939,7 @@
939940 // Run post-section-merge edit filter
940941 if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) {
941942 # Error messages etc. could be handled within the hook...
942 - wfProfileOut( __METHOD__ );
 943+ wfProfileOut( $fname );
943944 return self::AS_HOOK_ERROR;
944945 }
945946
@@ -948,7 +949,7 @@
949950 ) {
950951 if ( md5( $this->summary ) == $this->autoSumm ) {
951952 $this->missingSummary = true;
952 - wfProfileOut( __METHOD__ );
 953+ wfProfileOut( $fname );
953954 return self::AS_SUMMARY_NEEDED;
954955 }
955956 }
@@ -957,13 +958,13 @@
958959 if ( $this->section == 'new' && !$this->allowBlankSummary ) {
959960 if (trim($this->summary) == '') {
960961 $this->missingSummary = true;
961 - wfProfileOut( __METHOD__ );
 962+ wfProfileOut( $fname );
962963 return self::AS_SUMMARY_NEEDED;
963964 }
964965 }
965966
966967 # All's well
967 - wfProfileIn( __METHOD__ . '-sectionanchor' );
 968+ wfProfileIn( "$fname-sectionanchor" );
968969 $sectionanchor = '';
969970 if ( $this->section == 'new' ) {
970971 if ( $this->textbox1 == '' ) {
@@ -988,7 +989,7 @@
989990 $sectionanchor = $wgParser->guessSectionNameFromWikiText( $matches[2] );
990991 }
991992 }
992 - wfProfileOut( __METHOD__ . '-sectionanchor' );
 993+ wfProfileOut( "$fname-sectionanchor" );
993994
994995 // Save errors may fall down to the edit form, but we've now
995996 // merged the section into full text. Clear the section field
@@ -1001,19 +1002,19 @@
10021003 $this->kblength = (int)(strlen( $text ) / 1024);
10031004 if ( $this->kblength > $wgMaxArticleSize ) {
10041005 $this->tooBig = true;
1005 - wfProfileOut( __METHOD__ );
 1006+ wfProfileOut( $fname );
10061007 return self::AS_MAX_ARTICLE_SIZE_EXCEEDED;
10071008 }
10081009
10091010 # update the article here
10101011 if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
10111012 $this->watchthis, $bot, $sectionanchor ) ) {
1012 - wfProfileOut( __METHOD__ );
 1013+ wfProfileOut( $fname );
10131014 return self::AS_SUCCESS_UPDATE;
10141015 } else {
10151016 $this->isConflict = true;
10161017 }
1017 - wfProfileOut( __METHOD__ );
 1018+ wfProfileOut( $fname );
10181019 return self::AS_END;
10191020 }
10201021
@@ -1084,7 +1085,7 @@
10851086 $wgOut->setPageTitle( wfMsg( $msg, $wgTitle->getPrefixedText() ) );
10861087 } else {
10871088 # Use the title defined by DISPLAYTITLE magic word when present
1088 - if ( isset( $this->mParserOutput )
 1089+ if ( isset($this->mParserOutput)
10891090 && ( $dt = $this->mParserOutput->getDisplayTitle() ) !== false ) {
10901091 $title = $dt;
10911092 } else {
@@ -1107,10 +1108,11 @@
11081109 # Some hook probably called this function without checking
11091110 # for is_null($wgTitle) first. Bail out right here so we don't
11101111 # do lots of work just to discard it right after.
1111 - if ( is_null( $wgTitle ) )
 1112+ if (is_null($wgTitle))
11121113 return;
11131114
1114 - wfProfileIn( __METHOD__ );
 1115+ $fname = 'EditPage::showEditForm';
 1116+ wfProfileIn( $fname );
11151117
11161118 $sk = $wgUser->getSkin();
11171119
@@ -1256,13 +1258,16 @@
12571259 #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
12581260 $action = $wgTitle->escapeLocalURL( $q );
12591261
1260 - $summary = wfMsgExt( 'summary', array( 'parseinline' ) );
1261 - $subject = wfMsgExt( 'subject', array( 'parseinline' ) );
 1262+ $colonSep = wfMsg( 'colon-separator' );
 1263+ $summary = wfMsg( 'summary' ) . $colonSep;
 1264+ $subject = wfMsg( 'subject' ) . $colonSep;
12621265
1263 - $cancel = $sk->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'cancel' ) );
1264 - $edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ) );
1265 - $edithelp = Xml::element( 'a', array( 'target' => 'helpwindow', 'href' => $edithelpurl ), wfMsg( 'edithelp' ) ) .
1266 - ' ' . wfMsgExt( 'newwindow', array( 'parseinline' ) );
 1266+ $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(),
 1267+ wfMsgExt('cancel', array('parseinline')) );
 1268+ $edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ));
 1269+ $edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
 1270+ htmlspecialchars( wfMsg( 'edithelp' ) ).'</a> '.
 1271+ htmlspecialchars( wfMsg( 'newwindow' ) );
12671272
12681273 global $wgRightsText;
12691274 if ( $wgRightsText ) {
@@ -1328,25 +1333,17 @@
13291334 $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
13301335 $summaryhiddens .= Xml::hidden( 'wpAutoSummary', $autosumm );
13311336 if ( $this->section == 'new' ) {
1332 - $commentsubject = "<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}</label></span>\n" .
1333 - "<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />" .
1334 - "{$summaryhiddens}<br />";
 1337+ $commentsubject="<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}</label></span>\n<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />{$summaryhiddens}<br />";
13351338 $editsummary = "<div class='editOptions'>\n";
13361339 global $wgParser;
13371340 $formattedSummary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $this->summary ) );
1338 - $subjectpreview = $summarytext && $this->preview ?
1339 - "<div class=\"mw-summary-preview\">" . wfMsgExt( 'subject-preview', array( 'escapenoentities' ) ) .
1340 - $sk->commentBlock( $formattedSummary, $this->mTitle, true ) . "</div>\n" : '';
 1341+ $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">".wfMsg('subject-preview').$colonSep.$sk->commentBlock( $formattedSummary, $this->mTitle, true )."</div>\n" : '';
13411342 $summarypreview = '';
13421343 } else {
13431344 $commentsubject = '';
1344 - $editsummary = "<div class='editOptions'>\n<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}</label></span>\n" .
1345 - "<input tabindex='2' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />" .
1346 - "{$summaryhiddens}<br />";
 1345+ $editsummary="<div class='editOptions'>\n<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}</label></span>\n<input tabindex='2' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />{$summaryhiddens}<br />";
 1346+ $summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">".wfMsg('summary-preview').$colonSep.$sk->commentBlock( $this->summary, $this->mTitle )."</div>\n" : '';
13471347 $subjectpreview = '';
1348 - $summarypreview = $summarytext && $this->preview ?
1349 - "<div class=\"mw-summary-preview\">" . wfMsgExt( 'summary-preview', array( 'escapenoentities' ) ) .
1350 - $sk->commentBlock( $this->summary, $this->mTitle ) . "</div>\n" : '';
13511348 }
13521349
13531350 # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
@@ -1361,7 +1358,7 @@
13621359
13631360 global $wgUseMetadataEdit ;
13641361 if ( $wgUseMetadataEdit ) {
1365 - $metadata = $this->mMetaData;
 1362+ $metadata = $this->mMetaData ;
13661363 $metadata = htmlspecialchars( $wgContLang->recodeForEdit( $metadata ) ) ;
13671364 $top = wfMsgWikiHtml( 'metadata_help' );
13681365 /* ToDo: Replace with clean code */
@@ -1377,15 +1374,15 @@
13781375 $recreate = '';
13791376 if ( $this->wasDeletedSinceLastEdit() ) {
13801377 if ( 'save' != $this->formtype ) {
1381 - $wgOut->addWikiMsg( 'deletedwhileediting' );
 1378+ $wgOut->addWikiMsg('deletedwhileediting');
13821379 } else {
13831380 // Hide the toolbar and edit area, use can click preview to get it back
13841381 // Add an confirmation checkbox and explanation.
13851382 $toolbar = '';
1386 - $recreate = wfMsgExt( 'confirmrecreate', array( 'parse' ), $this->lastDelete->user_name , $this->lastDelete->log_comment ) .
1387 - "<br />" .
1388 - Xml::checkLabel( wfMsg( 'recreate' ), 'wpRecreate', 'wpRecreate', false,
1389 - array( 'tabindex' => '1' ), array( 'title' => wfMsg( 'tooltip-recreate' ) ) );
 1383+ $recreate = $wgOut->parse( wfMsg( 'confirmrecreate', $this->lastDelete->user_name , $this->lastDelete->log_comment ));
 1384+ $recreate .=
 1385+ "<br /><input tabindex='1' type='checkbox' value='1' name='wpRecreate' id='wpRecreate' />".
 1386+ "<label for='wpRecreate' title='".wfMsg('tooltip-recreate')."'>". wfMsg('recreate')."</label>";
13901387 }
13911388 }
13921389
@@ -1473,13 +1470,13 @@
14741471 );
14751472
14761473 if ( $this->isConflict && wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) ) ) {
1477 - $wgOut->wrapWikiMsg( '==$1==', 'yourdiff' );
 1474+ $wgOut->wrapWikiMsg( '==$1==', "yourdiff" );
14781475
14791476 $de = new DifferenceEngine( $this->mTitle );
14801477 $de->setText( $this->textbox2, $this->textbox1 );
1481 - $de->showDiff( wfMsgExt( 'yourtext', array( 'parseinline' ) ), wfMsgExt( 'storedversion', array( 'parseinline' ) ) );
 1478+ $de->showDiff( wfMsg( "yourtext" ), wfMsg( "storedversion" ) );
14821479
1483 - $wgOut->wrapWikiMsg( '==$1==', 'yourtext' );
 1480+ $wgOut->wrapWikiMsg( '==$1==', "yourtext" );
14841481 $this->showTextbox2();
14851482 }
14861483 $wgOut->addHTML( $this->editFormTextBottom );
@@ -1488,7 +1485,7 @@
14891486 $this->displayPreviewArea( $previewOutput, false );
14901487 }
14911488
1492 - wfProfileOut( __METHOD__ );
 1489+ wfProfileOut( $fname );
14931490 }
14941491
14951492 protected function showFormBeforeText() {
@@ -1824,14 +1821,15 @@
18251822 * @todo document
18261823 */
18271824 function mergeChangesInto( &$editText ){
1828 - wfProfileIn( __METHOD__ );
 1825+ $fname = 'EditPage::mergeChangesInto';
 1826+ wfProfileIn( $fname );
18291827
18301828 $db = wfGetDB( DB_MASTER );
18311829
18321830 // This is the revision the editor started from
18331831 $baseRevision = $this->getBaseRevision();
18341832 if ( is_null( $baseRevision ) ) {
1835 - wfProfileOut( __METHOD__ );
 1833+ wfProfileOut( $fname );
18361834 return false;
18371835 }
18381836 $baseText = $baseRevision->getText();
@@ -1840,7 +1838,7 @@
18411839 $currentRevision = Revision::loadFromTitle(
18421840 $db, $this->mTitle );
18431841 if ( is_null( $currentRevision ) ) {
1844 - wfProfileOut( __METHOD__ );
 1842+ wfProfileOut( $fname );
18451843 return false;
18461844 }
18471845 $currentText = $currentRevision->getText();
@@ -1848,10 +1846,10 @@
18491847 $result = '';
18501848 if ( wfMerge( $baseText, $editText, $currentText, $result ) ) {
18511849 $editText = $result;
1852 - wfProfileOut( __METHOD__ );
 1850+ wfProfileOut( $fname );
18531851 return true;
18541852 } else {
1855 - wfProfileOut( __METHOD__ );
 1853+ wfProfileOut( $fname );
18561854 return false;
18571855 }
18581856 }
@@ -1920,109 +1918,109 @@
19211919 */
19221920 $toolarray = array(
19231921 array(
1924 - 'image' => $wgLang->getImageFile( 'button-bold' ),
 1922+ 'image' => $wgLang->getImageFile('button-bold'),
19251923 'id' => 'mw-editbutton-bold',
19261924 'open' => '\'\'\'',
19271925 'close' => '\'\'\'',
1928 - 'sample' => wfMsg( 'bold_sample' ),
1929 - 'tip' => wfMsg( 'bold_tip' ),
 1926+ 'sample' => wfMsg('bold_sample'),
 1927+ 'tip' => wfMsg('bold_tip'),
19301928 'key' => 'B'
19311929 ),
19321930 array(
1933 - 'image' => $wgLang->getImageFile( 'button-italic' ),
 1931+ 'image' => $wgLang->getImageFile('button-italic'),
19341932 'id' => 'mw-editbutton-italic',
19351933 'open' => '\'\'',
19361934 'close' => '\'\'',
1937 - 'sample' => wfMsg( 'italic_sample' ),
1938 - 'tip' => wfMsg( 'italic_tip' ),
 1935+ 'sample' => wfMsg('italic_sample'),
 1936+ 'tip' => wfMsg('italic_tip'),
19391937 'key' => 'I'
19401938 ),
19411939 array(
1942 - 'image' => $wgLang->getImageFile( 'button-link' ),
 1940+ 'image' => $wgLang->getImageFile('button-link'),
19431941 'id' => 'mw-editbutton-link',
19441942 'open' => '[[',
19451943 'close' => ']]',
1946 - 'sample' => wfMsg( 'link_sample' ),
1947 - 'tip' => wfMsg( 'link_tip' ),
 1944+ 'sample' => wfMsg('link_sample'),
 1945+ 'tip' => wfMsg('link_tip'),
19481946 'key' => 'L'
19491947 ),
19501948 array(
1951 - 'image' => $wgLang->getImageFile( 'button-extlink' ),
 1949+ 'image' => $wgLang->getImageFile('button-extlink'),
19521950 'id' => 'mw-editbutton-extlink',
19531951 'open' => '[',
19541952 'close' => ']',
1955 - 'sample' => wfMsg( 'extlink_sample' ),
1956 - 'tip' => wfMsg( 'extlink_tip' ),
 1953+ 'sample' => wfMsg('extlink_sample'),
 1954+ 'tip' => wfMsg('extlink_tip'),
19571955 'key' => 'X'
19581956 ),
19591957 array(
1960 - 'image' => $wgLang->getImageFile( 'button-headline' ),
 1958+ 'image' => $wgLang->getImageFile('button-headline'),
19611959 'id' => 'mw-editbutton-headline',
19621960 'open' => "\n== ",
19631961 'close' => " ==\n",
1964 - 'sample' => wfMsg( 'headline_sample' ),
1965 - 'tip' => wfMsg( 'headline_tip' ),
 1962+ 'sample' => wfMsg('headline_sample'),
 1963+ 'tip' => wfMsg('headline_tip'),
19661964 'key' => 'H'
19671965 ),
19681966 array(
1969 - 'image' => $wgLang->getImageFile( 'button-image' ),
 1967+ 'image' => $wgLang->getImageFile('button-image'),
19701968 'id' => 'mw-editbutton-image',
1971 - 'open' => '[['.$wgContLang->getNsText( NS_FILE ).':',
 1969+ 'open' => '[['.$wgContLang->getNsText(NS_FILE).':',
19721970 'close' => ']]',
1973 - 'sample' => wfMsg( 'image_sample' ),
1974 - 'tip' => wfMsg( 'image_tip' ),
 1971+ 'sample' => wfMsg('image_sample'),
 1972+ 'tip' => wfMsg('image_tip'),
19751973 'key' => 'D'
19761974 ),
19771975 array(
1978 - 'image' => $wgLang->getImageFile( 'button-media' ),
 1976+ 'image' => $wgLang->getImageFile('button-media'),
19791977 'id' => 'mw-editbutton-media',
1980 - 'open' => '[['.$wgContLang->getNsText( NS_MEDIA ).':',
 1978+ 'open' => '[['.$wgContLang->getNsText(NS_MEDIA).':',
19811979 'close' => ']]',
1982 - 'sample' => wfMsg( 'media_sample' ),
1983 - 'tip' => wfMsg( 'media_tip' ),
 1980+ 'sample' => wfMsg('media_sample'),
 1981+ 'tip' => wfMsg('media_tip'),
19841982 'key' => 'M'
19851983 ),
19861984 array(
1987 - 'image' => $wgLang->getImageFile( 'button-math' ),
 1985+ 'image' => $wgLang->getImageFile('button-math'),
19881986 'id' => 'mw-editbutton-math',
19891987 'open' => "<math>",
19901988 'close' => "</math>",
1991 - 'sample' => wfMsg( 'math_sample' ),
1992 - 'tip' => wfMsg( 'math_tip' ),
 1989+ 'sample' => wfMsg('math_sample'),
 1990+ 'tip' => wfMsg('math_tip'),
19931991 'key' => 'C'
19941992 ),
19951993 array(
1996 - 'image' => $wgLang->getImageFile( 'button-nowiki' ),
 1994+ 'image' => $wgLang->getImageFile('button-nowiki'),
19971995 'id' => 'mw-editbutton-nowiki',
19981996 'open' => "<nowiki>",
19991997 'close' => "</nowiki>",
2000 - 'sample' => wfMsg( 'nowiki_sample' ),
2001 - 'tip' => wfMsg( 'nowiki_tip' ),
 1998+ 'sample' => wfMsg('nowiki_sample'),
 1999+ 'tip' => wfMsg('nowiki_tip'),
20022000 'key' => 'N'
20032001 ),
20042002 array(
2005 - 'image' => $wgLang->getImageFile( 'button-sig' ),
 2003+ 'image' => $wgLang->getImageFile('button-sig'),
20062004 'id' => 'mw-editbutton-signature',
20072005 'open' => '--~~~~',
20082006 'close' => '',
20092007 'sample' => '',
2010 - 'tip' => wfMsg( 'sig_tip' ),
 2008+ 'tip' => wfMsg('sig_tip'),
20112009 'key' => 'Y'
20122010 ),
20132011 array(
2014 - 'image' => $wgLang->getImageFile( 'button-hr' ),
 2012+ 'image' => $wgLang->getImageFile('button-hr'),
20152013 'id' => 'mw-editbutton-hr',
20162014 'open' => "\n----\n",
20172015 'close' => '',
20182016 'sample' => '',
2019 - 'tip' => wfMsg( 'hr_tip' ),
 2017+ 'tip' => wfMsg('hr_tip'),
20202018 'key' => 'R'
20212019 )
20222020 );
20232021 $toolbar = "<div id='toolbar'>\n";
20242022 $toolbar.="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";
20252023
2026 - foreach( $toolarray as $tool ) {
 2024+ foreach($toolarray as $tool) {
20272025 $params = array(
20282026 $image = $wgStylePath.'/common/images/'.$tool['image'],
20292027 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
@@ -2063,8 +2061,8 @@
20642062 $checkboxes = array();
20652063
20662064 $checkboxes['minor'] = '';
2067 - $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) );
2068 - if ( $wgUser->isAllowed( 'minoredit' ) ) {
 2065+ $minorLabel = wfMsgExt('minoredit', array('parseinline'));
 2066+ if ( $wgUser->isAllowed('minoredit') ) {
20692067 $attribs = array(
20702068 'tabindex' => ++$tabindex,
20712069 'accesskey' => wfMsg( 'accesskey-minoredit' ),
@@ -2072,10 +2070,10 @@
20732071 );
20742072 $checkboxes['minor'] =
20752073 Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
2076 - "&nbsp;<label for='wpMinoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
 2074+ "&nbsp;<label for='wpMinoredit'".$skin->tooltip('minoredit', 'withaccess').">{$minorLabel}</label>";
20772075 }
20782076
2079 - $watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) );
 2077+ $watchLabel = wfMsgExt('watchthis', array('parseinline'));
20802078 $checkboxes['watch'] = '';
20812079 if ( $wgUser->isLoggedIn() ) {
20822080 $attribs = array(
@@ -2085,7 +2083,7 @@
20862084 );
20872085 $checkboxes['watch'] =
20882086 Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
2089 - "&nbsp;<label for='wpWatchthis'" . $skin->tooltip('watch', 'withaccess') . ">{$watchLabel}</label>";
 2087+ "&nbsp;<label for='wpWatchthis'".$skin->tooltip('watch', 'withaccess').">{$watchLabel}</label>";
20902088 }
20912089 wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
20922090 return $checkboxes;
@@ -2099,7 +2097,7 @@
21002098 *
21012099 * @return array
21022100 */
2103 - public function getEditButtons( &$tabindex ) {
 2101+ public function getEditButtons(&$tabindex) {
21042102 global $wgLivePreview, $wgUser;
21052103
21062104 $buttons = array();
@@ -2109,11 +2107,11 @@
21102108 'name' => 'wpSave',
21112109 'type' => 'submit',
21122110 'tabindex' => ++$tabindex,
2113 - 'value' => wfMsg( 'savearticle' ),
2114 - 'accesskey' => wfMsg( 'accesskey-save' ),
 2111+ 'value' => wfMsg('savearticle'),
 2112+ 'accesskey' => wfMsg('accesskey-save'),
21152113 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
21162114 );
2117 - $buttons['save'] = Xml::element( 'input', $temp, '' );
 2115+ $buttons['save'] = Xml::element('input', $temp, '');
21182116
21192117 ++$tabindex; // use the same for preview and live preview
21202118 if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
@@ -2122,12 +2120,12 @@
21232121 'name' => 'wpPreview',
21242122 'type' => 'submit',
21252123 'tabindex' => $tabindex,
2126 - 'value' => wfMsg( 'showpreview' ),
 2124+ 'value' => wfMsg('showpreview'),
21272125 'accesskey' => '',
21282126 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
21292127 'style' => 'display: none;',
21302128 );
2131 - $buttons['preview'] = Xml::element( 'input', $temp, '' );
 2129+ $buttons['preview'] = Xml::element('input', $temp, '');
21322130
21332131 $temp = array(
21342132 'id' => 'wpLivePreview',
@@ -2139,18 +2137,18 @@
21402138 'title' => '',
21412139 'onclick' => $this->doLivePreviewScript(),
21422140 );
2143 - $buttons['live'] = Xml::element( 'input', $temp, '' );
 2141+ $buttons['live'] = Xml::element('input', $temp, '');
21442142 } else {
21452143 $temp = array(
21462144 'id' => 'wpPreview',
21472145 'name' => 'wpPreview',
21482146 'type' => 'submit',
21492147 'tabindex' => $tabindex,
2150 - 'value' => wfMsg( 'showpreview' ),
2151 - 'accesskey' => wfMsg( 'accesskey-preview' ),
 2148+ 'value' => wfMsg('showpreview'),
 2149+ 'accesskey' => wfMsg('accesskey-preview'),
21522150 'title' => wfMsg( 'tooltip-preview' ).' ['.wfMsg( 'accesskey-preview' ).']',
21532151 );
2154 - $buttons['preview'] = Xml::element( 'input', $temp, '' );
 2152+ $buttons['preview'] = Xml::element('input', $temp, '');
21552153 $buttons['live'] = '';
21562154 }
21572155
@@ -2159,11 +2157,11 @@
21602158 'name' => 'wpDiff',
21612159 'type' => 'submit',
21622160 'tabindex' => ++$tabindex,
2163 - 'value' => wfMsg( 'showdiff' ),
2164 - 'accesskey' => wfMsg( 'accesskey-diff' ),
 2161+ 'value' => wfMsg('showdiff'),
 2162+ 'accesskey' => wfMsg('accesskey-diff'),
21652163 'title' => wfMsg( 'tooltip-diff' ).' ['.wfMsg( 'accesskey-diff' ).']',
21662164 );
2167 - $buttons['diff'] = Xml::element( 'input', $temp, '' );
 2165+ $buttons['diff'] = Xml::element('input', $temp, '');
21682166
21692167 wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) );
21702168 return $buttons;
@@ -2212,8 +2210,8 @@
22132211 $newtext = $this->mArticle->replaceSection(
22142212 $this->section, $this->textbox1, $this->summary, $this->edittime );
22152213 $newtext = $this->mArticle->preSaveTransform( $newtext );
2216 - $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) );
2217 - $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) );
 2214+ $oldtitle = wfMsgExt( 'currentrev', array('parseinline') );
 2215+ $newtitle = wfMsgExt( 'yourtext', array('parseinline') );
22182216 if ( $oldtext !== false || $newtext != '' ) {
22192217 $de = new DifferenceEngine( $this->mTitle );
22202218 $de->setText( $oldtext, $newtext );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1024,8 +1024,8 @@
10251025 'hr_tip' => 'Horizontal line (use sparingly)',
10261026
10271027 # Edit pages
1028 -'summary' => 'Summary:',
1029 -'subject' => 'Subject/headline:',
 1028+'summary' => 'Summary',
 1029+'subject' => 'Subject/headline',
10301030 'minoredit' => 'This is a minor edit',
10311031 'watchthis' => 'Watch this page',
10321032 'savearticle' => 'Save page',
@@ -1040,8 +1040,8 @@
10411041 'missingcommenttext' => 'Please enter a comment below.',
10421042 'missingcommentheader' => "'''Reminder:''' You have not provided a subject/headline for this comment.
10431043 If you click Save again, your edit will be saved without one.",
1044 -'summary-preview' => 'Summary preview:',
1045 -'subject-preview' => 'Subject/headline preview:',
 1044+'summary-preview' => 'Summary preview',
 1045+'subject-preview' => 'Subject/headline preview',
10461046 'blockedtitle' => 'User is blocked',
10471047 'blockedtext' => "<big>'''Your user name or IP address has been blocked.'''</big>
10481048

Follow-up revisions

RevisionCommit summaryAuthorDate
r45229Partial re-introduction of r45027 after being reverted in r45228...siebrand17:20, 31 December 2008
r45375Per r45228: also revert the RELEASE-NOTES entryialex16:43, 3 January 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45027* summary and subject messages now uses wiki text rather than raw HTML...ialex15:22, 25 December 2008
r45028oops, forgot summary-preview :(ialex15:38, 25 December 2008

Comments

#Comment by Siebrand (talk | contribs)   17:25, 31 December 2008

Partially reintroduced r45027 in r45229:

  • Added the colon in summary, subject and subject-preview messages rather than using colon-separator

Status & tagging log