r69622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69621‎ | r69622 | r69623 >
Date:15:12, 20 July 2010
Author:mah
Status:ok
Tags:
Comment:
revert r69620
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserCache.php (modified) (history)
  • /trunk/phase3/maintenance/install.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install.php
@@ -30,8 +30,8 @@
3131
3232 $this->addArg( 'name', 'The name of the wiki', true);
3333
34 - $this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', true);
35 - $this->addOption( 'pass', 'The password for the wiki administrator. You will be prompted for this if it isn\'t provided', false, true);
 34+ $this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', false);
 35+ $this->addOption( 'pass', 'The password for the wiki administrator. You will be prompted for this if it isn\'t provided', false, true);
3636 $this->addOption( 'email', 'The email for the wiki administrator', false, true);
3737
3838 $this->addOption( 'lang', 'The language to use (en)', false, true );
Index: trunk/phase3/includes/parser/ParserCache.php
@@ -4,8 +4,6 @@
55 * @todo document
66 */
77 class ParserCache {
8 - private $mMemc;
9 -
108 /**
119 * Get an instance of this object
1210 */
@@ -25,10 +23,6 @@
2624 * @param $memCached Object
2725 */
2826 function __construct( $memCached ) {
29 - if ( !$memCached ) {
30 - global $parserMemc;
31 - $parserMemc = $memCached = wfGetParserCacheStorage();
32 - }
3327 $this->mMemc = $memCached;
3428 }
3529
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;
 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;
3939 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;
 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;
@@ -129,8 +129,8 @@
130130 wfProfileIn( __METHOD__ );
131131 # Get variables from query string :P
132132 $section = $wgRequest->getVal( 'section' );
133 -
134 - $preload = $wgRequest->getVal( 'preload',
 133+
 134+ $preload = $wgRequest->getVal( 'preload',
135135 // Custom preload text for new sections
136136 $section === 'new' ? 'MediaWiki:addsection-preload' : '' );
137137 $undoafter = $wgRequest->getVal( 'undoafter' );
@@ -287,7 +287,7 @@
288288 *
289289 * The edit form is self-submitting, so that when things like
290290 * preview and edit conflicts occur, we get the same form back
291 - * with the extra stuff added. Only when the final submission
 291+ * with the extra stuff added. Only when the final submission
292292 * is made and all is well do we actually save and redirect to
293293 * the newly-edited page.
294294 */
@@ -320,7 +320,7 @@
321321 }
322322
323323 $wgOut->addScriptFile( 'edit.js' );
324 -
 324+
325325 if ( $wgUser->getOption( 'uselivepreview', false ) ) {
326326 $wgOut->includeJQuery();
327327 $wgOut->addScriptFile( 'preview.js' );
@@ -360,9 +360,9 @@
361361
362362 $this->isConflict = false;
363363 // css / js subpages of user pages get a special treatment
364 - $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
365 - $this->isCssSubpage = $this->mTitle->isCssSubpage();
366 - $this->isJsSubpage = $this->mTitle->isJsSubpage();
 364+ $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
 365+ $this->isCssSubpage = $this->mTitle->isCssSubpage();
 366+ $this->isJsSubpage = $this->mTitle->isJsSubpage();
367367 $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
368368
369369 # Show applicable editing introductions
@@ -374,9 +374,9 @@
375375 }
376376
377377 # Optional notices on a per-namespace and per-page basis
378 - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
 378+ $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
379379 if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
380 - $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
 380+ $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
381381 }
382382 if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
383383 $parts = explode( '/', $this->mTitle->getDBkey() );
@@ -389,7 +389,7 @@
390390 }
391391 }
392392
393 - # Attempt submission here. This will check for edit conflicts,
 393+ # Attempt submission here. This will check for edit conflicts,
394394 # and redundantly check for locked database, blocked IPs, etc.
395395 # that edit() already checked just in case someone tries to sneak
396396 # in the back door with a hand-edited submission URL.
@@ -493,7 +493,7 @@
494494 /**
495495 * Does this EditPage class support section editing?
496496 * This is used by EditPage subclasses to indicate their ui cannot handle section edits
497 - *
 497+ *
498498 * @return bool
499499 */
500500 protected function isSectionEditSupported() {
@@ -505,7 +505,7 @@
506506 * This is used by EditPage subclasses when simply customizing the action
507507 * variable in the constructor is not enough. This can be used when the
508508 * EditPage lives inside of a Special page rather than a custom page action.
509 - *
 509+ *
510510 * @param $title Title object for which is being edited (where we go to for &action= links)
511511 * @return string
512512 */
@@ -591,7 +591,7 @@
592592 $this->starttime = null;
593593 }
594594
595 - $this->recreate = $request->getCheck( 'wpRecreate' );
 595+ $this->recreate = $request->getCheck( 'wpRecreate' );
596596
597597 $this->minoredit = $request->getCheck( 'wpMinoredit' );
598598 $this->watchthis = $request->getCheck( 'wpWatchthis' );
@@ -609,17 +609,17 @@
610610 } else {
611611 # Not a posted form? Start with nothing.
612612 wfDebug( __METHOD__ . ": Not a posted form.\n" );
613 - $this->textbox1 = '';
614 - $this->summary = '';
615 - $this->edittime = '';
 613+ $this->textbox1 = '';
 614+ $this->summary = '';
 615+ $this->edittime = '';
616616 $this->starttime = wfTimestampNow();
617 - $this->edit = false;
618 - $this->preview = false;
619 - $this->save = false;
620 - $this->diff = false;
 617+ $this->edit = false;
 618+ $this->preview = false;
 619+ $this->save = false;
 620+ $this->diff = false;
621621 $this->minoredit = false;
622622 $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters
623 - $this->recreate = false;
 623+ $this->recreate = false;
624624
625625 if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
626626 $this->summary = $request->getVal( 'preloadtitle' );
@@ -655,7 +655,7 @@
656656 * posted form to be placed in $this->textbox1, if using customized input
657657 * this method should be overrided and return the page text that will be used
658658 * for saving, preview parsing and so on...
659 - *
 659+ *
660660 * @param $request WebRequest
661661 */
662662 protected function importContentFormData( &$request ) {
@@ -768,7 +768,7 @@
769769 global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
770770 global $wgMaxArticleSize;
771771
772 - wfProfileIn( __METHOD__ );
 772+ wfProfileIn( __METHOD__ );
773773 wfProfileIn( __METHOD__ . '-checks' );
774774
775775 if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) {
@@ -1064,10 +1064,11 @@
10651065 $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
10661066 ( $this->minoredit ? EDIT_MINOR : 0 ) |
10671067 ( $bot ? EDIT_FORCE_BOT : 0 );
1068 - $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
 1068+ $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
10691069 false, null, $this->watchthis, false, $sectionanchor, true );
1070 -
1071 - if ( $status->isOK() ) {
 1070+
 1071+ if ( $status->isOK() )
 1072+ {
10721073 wfProfileOut( __METHOD__ );
10731074 return self::AS_SUCCESS_UPDATE;
10741075 } else {
@@ -1185,8 +1186,8 @@
11861187 /**
11871188 * Send the edit form and related headers to $wgOut
11881189 * @param $formCallback Optional callable that takes an OutputPage
1189 - * parameter; will be called during form output
1190 - * near the top, for captchas and the like.
 1190+ * parameter; will be called during form output
 1191+ * near the top, for captchas and the like.
11911192 */
11921193 function showEditForm( $formCallback=null ) {
11931194 global $wgOut, $wgUser, $wgTitle;
@@ -1302,7 +1303,7 @@
13031304 }
13041305
13051306 $wgOut->addHTML( $this->editFormTextBeforeContent );
1306 -
 1307+
13071308 if ( $this->isConflict ) {
13081309 // In an edit conflict bypass the overrideable content form method
13091310 // and fallback to the raw wpTextbox1 since editconflicts can't be
@@ -1339,7 +1340,7 @@
13401341
13411342 if ( $this->isConflict )
13421343 $this->showConflict();
1343 -
 1344+
13441345 $wgOut->addHTML( $this->editFormTextBottom );
13451346 $wgOut->addHTML( "</form>\n" );
13461347 if ( !$wgUser->getOption( 'previewontop' ) ) {
@@ -1348,7 +1349,7 @@
13491350
13501351 wfProfileOut( __METHOD__ );
13511352 }
1352 -
 1353+
13531354 protected function showHeader() {
13541355 global $wgOut, $wgUser, $wgTitle, $wgMaxArticleSize, $wgLang;
13551356 if ( $this->isConflict ) {
@@ -1462,7 +1463,7 @@
14631464 }
14641465 if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
14651466 LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
1466 - array( 'lim' => 1,
 1467+ array( 'lim' => 1,
14671468 'showIfEmpty' => false,
14681469 'msgKey' => array( 'titleprotectedwarning' ),
14691470 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
@@ -1489,12 +1490,12 @@
14901491 * Note that you do not need to worry about the label's for=, it will be
14911492 * inferred by the id given to the input. You can remove them both by
14921493 * passing array( 'id' => false ) to $userInputAttrs.
1493 - *
 1494+ *
14941495 * @param $summary The value of the summary input
14951496 * @param $labelText The html to place inside the label
14961497 * @param $inputAttrs An array of attrs to use on the input
14971498 * @param $spanLabelAttrs An array of attrs to use on the span inside the label
1498 - *
 1499+ *
14991500 * @return array An array in the format array( $label, $input )
15001501 */
15011502 function getSummaryInput($summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null) {
@@ -1526,8 +1527,8 @@
15271528
15281529 /**
15291530 * @param $isSubjectPreview Boolean: true if this is the section subject/title
1530 - * up top, or false if this is the comment summary
1531 - * down below the textarea
 1531+ * up top, or false if this is the comment summary
 1532+ * down below the textarea
15321533 * @param $summary String: The text of the summary to display
15331534 * @return String
15341535 */
@@ -1550,18 +1551,18 @@
15511552
15521553 /**
15531554 * @param $isSubjectPreview Boolean: true if this is the section subject/title
1554 - * up top, or false if this is the comment summary
1555 - * down below the textarea
 1555+ * up top, or false if this is the comment summary
 1556+ * down below the textarea
15561557 * @param $summary String: the text of the summary to display
15571558 * @return String
15581559 */
15591560 protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
15601561 if ( !$summary || ( !$this->preview && !$this->diff ) )
15611562 return "";
1562 -
 1563+
15631564 global $wgParser, $wgUser;
15641565 $sk = $wgUser->getSkin();
1565 -
 1566+
15661567 if ( $isSubjectPreview )
15671568 $summary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $summary ) );
15681569
@@ -1585,7 +1586,7 @@
15861587 if ( !$this->checkUnicodeCompliantBrowser() )
15871588 $wgOut->addHTML(Xml::hidden( 'safemode', '1' ));
15881589 }
1589 -
 1590+
15901591 protected function showFormAfterText() {
15911592 global $wgOut, $wgUser;
15921593 /**
@@ -1610,7 +1611,7 @@
16111612 * be it a form, or simply wpTextbox1 with a modified content that will be
16121613 * reverse modified when extracted from the post data.
16131614 * Note that this is basically the inverse for importContentFormData
1614 - *
 1615+ *
16151616 * @param $request WebRequest
16161617 */
16171618 protected function showContentForm() {
@@ -1621,7 +1622,7 @@
16221623 * Method to output wpTextbox1
16231624 * The $textoverride method can be used by subclasses overriding showContentForm
16241625 * to pass back to this method.
1625 - *
 1626+ *
16261627 * @param $customAttribs An array of html attributes to use in the textarea
16271628 * @param $textoverride String: optional text to override $this->textarea1 with
16281629 */
@@ -1647,7 +1648,7 @@
16481649 $classes[] = $attribs['class'];
16491650 $attribs['class'] = implode( ' ', $classes );
16501651 }
1651 -
 1652+
16521653 $this->showTextbox( isset($textoverride) ? $textoverride : $this->textbox1, 'wpTextbox1', $attribs );
16531654 }
16541655
@@ -1670,7 +1671,7 @@
16711672 $attribs = $customAttribs + array(
16721673 'accesskey' => ',',
16731674 'id' => $name,
1674 - 'cols' => $wgUser->getIntOption( 'cols' ),
 1675+ 'cols' => $wgUser->getIntOption( 'cols' ),
16751676 'rows' => $wgUser->getIntOption( 'rows' ),
16761677 'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
16771678 );
@@ -1726,7 +1727,7 @@
17271728 * Give a chance for site and per-namespace customizations of
17281729 * terms of service summary link that might exist separately
17291730 * from the copyright notice.
1730 - *
 1731+ *
17311732 * This will display between the save button and the edit tools,
17321733 * so should remain short!
17331734 */
@@ -1748,7 +1749,7 @@
17491750 $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) );
17501751 $wgOut->addHTML( '</div>' );
17511752 }
1752 -
 1753+
17531754 protected function getCopywarn() {
17541755 global $wgRightsText;
17551756 if ( $wgRightsText ) {
@@ -1761,10 +1762,10 @@
17621763 }
17631764 // Allow for site and per-namespace customization of contribution/copyright notice.
17641765 wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
1765 -
 1766+
17661767 return "<div id=\"editpage-copywarn\">\n" . call_user_func_array("wfMsgNoTrans", $copywarnMsg) . "\n</div>";
17671768 }
1768 -
 1769+
17691770 protected function showStandardInputs( &$tabindex = 2 ) {
17701771 global $wgOut, $wgUser;
17711772 $wgOut->addHTML( "<div class='editOptions'>\n" );
@@ -1815,20 +1816,20 @@
18161817 $data = $dbr->selectRow(
18171818 array( 'logging', 'user' ),
18181819 array( 'log_type',
1819 - 'log_action',
1820 - 'log_timestamp',
1821 - 'log_user',
1822 - 'log_namespace',
1823 - 'log_title',
1824 - 'log_comment',
1825 - 'log_params',
1826 - 'log_deleted',
1827 - 'user_name' ),
 1820+ 'log_action',
 1821+ 'log_timestamp',
 1822+ 'log_user',
 1823+ 'log_namespace',
 1824+ 'log_title',
 1825+ 'log_comment',
 1826+ 'log_params',
 1827+ 'log_deleted',
 1828+ 'user_name' ),
18281829 array( 'log_namespace' => $this->mTitle->getNamespace(),
1829 - 'log_title' => $this->mTitle->getDBkey(),
1830 - 'log_type' => 'delete',
1831 - 'log_action' => 'delete',
1832 - 'user_id=log_user' ),
 1830+ 'log_title' => $this->mTitle->getDBkey(),
 1831+ 'log_type' => 'delete',
 1832+ 'log_action' => 'delete',
 1833+ 'user_id=log_user' ),
18331834 __METHOD__,
18341835 array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
18351836 );
@@ -2138,103 +2139,103 @@
21392140 */
21402141 $toolarray = array(
21412142 array(
2142 - 'image' => $wgLang->getImageFile( 'button-bold' ),
2143 - 'id' => 'mw-editbutton-bold',
2144 - 'open' => '\'\'\'',
2145 - 'close' => '\'\'\'',
 2143+ 'image' => $wgLang->getImageFile( 'button-bold' ),
 2144+ 'id' => 'mw-editbutton-bold',
 2145+ 'open' => '\'\'\'',
 2146+ 'close' => '\'\'\'',
21462147 'sample' => wfMsg( 'bold_sample' ),
2147 - 'tip' => wfMsg( 'bold_tip' ),
2148 - 'key' => 'B'
 2148+ 'tip' => wfMsg( 'bold_tip' ),
 2149+ 'key' => 'B'
21492150 ),
21502151 array(
2151 - 'image' => $wgLang->getImageFile( 'button-italic' ),
2152 - 'id' => 'mw-editbutton-italic',
2153 - 'open' => '\'\'',
2154 - 'close' => '\'\'',
 2152+ 'image' => $wgLang->getImageFile( 'button-italic' ),
 2153+ 'id' => 'mw-editbutton-italic',
 2154+ 'open' => '\'\'',
 2155+ 'close' => '\'\'',
21552156 'sample' => wfMsg( 'italic_sample' ),
2156 - 'tip' => wfMsg( 'italic_tip' ),
2157 - 'key' => 'I'
 2157+ 'tip' => wfMsg( 'italic_tip' ),
 2158+ 'key' => 'I'
21582159 ),
21592160 array(
2160 - 'image' => $wgLang->getImageFile( 'button-link' ),
2161 - 'id' => 'mw-editbutton-link',
2162 - 'open' => '[[',
2163 - 'close' => ']]',
 2161+ 'image' => $wgLang->getImageFile( 'button-link' ),
 2162+ 'id' => 'mw-editbutton-link',
 2163+ 'open' => '[[',
 2164+ 'close' => ']]',
21642165 'sample' => wfMsg( 'link_sample' ),
2165 - 'tip' => wfMsg( 'link_tip' ),
2166 - 'key' => 'L'
 2166+ 'tip' => wfMsg( 'link_tip' ),
 2167+ 'key' => 'L'
21672168 ),
21682169 array(
2169 - 'image' => $wgLang->getImageFile( 'button-extlink' ),
2170 - 'id' => 'mw-editbutton-extlink',
2171 - 'open' => '[',
2172 - 'close' => ']',
 2170+ 'image' => $wgLang->getImageFile( 'button-extlink' ),
 2171+ 'id' => 'mw-editbutton-extlink',
 2172+ 'open' => '[',
 2173+ 'close' => ']',
21732174 'sample' => wfMsg( 'extlink_sample' ),
2174 - 'tip' => wfMsg( 'extlink_tip' ),
2175 - 'key' => 'X'
 2175+ 'tip' => wfMsg( 'extlink_tip' ),
 2176+ 'key' => 'X'
21762177 ),
21772178 array(
2178 - 'image' => $wgLang->getImageFile( 'button-headline' ),
2179 - 'id' => 'mw-editbutton-headline',
2180 - 'open' => "\n== ",
2181 - 'close' => " ==\n",
 2179+ 'image' => $wgLang->getImageFile( 'button-headline' ),
 2180+ 'id' => 'mw-editbutton-headline',
 2181+ 'open' => "\n== ",
 2182+ 'close' => " ==\n",
21822183 'sample' => wfMsg( 'headline_sample' ),
2183 - 'tip' => wfMsg( 'headline_tip' ),
2184 - 'key' => 'H'
 2184+ 'tip' => wfMsg( 'headline_tip' ),
 2185+ 'key' => 'H'
21852186 ),
21862187 array(
2187 - 'image' => $wgLang->getImageFile( 'button-image' ),
2188 - 'id' => 'mw-editbutton-image',
2189 - 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
2190 - 'close' => ']]',
 2188+ 'image' => $wgLang->getImageFile( 'button-image' ),
 2189+ 'id' => 'mw-editbutton-image',
 2190+ 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
 2191+ 'close' => ']]',
21912192 'sample' => wfMsg( 'image_sample' ),
2192 - 'tip' => wfMsg( 'image_tip' ),
2193 - 'key' => 'D'
 2193+ 'tip' => wfMsg( 'image_tip' ),
 2194+ 'key' => 'D'
21942195 ),
21952196 array(
2196 - 'image' => $wgLang->getImageFile( 'button-media' ),
2197 - 'id' => 'mw-editbutton-media',
2198 - 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
2199 - 'close' => ']]',
 2197+ 'image' => $wgLang->getImageFile( 'button-media' ),
 2198+ 'id' => 'mw-editbutton-media',
 2199+ 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
 2200+ 'close' => ']]',
22002201 'sample' => wfMsg( 'media_sample' ),
2201 - 'tip' => wfMsg( 'media_tip' ),
2202 - 'key' => 'M'
 2202+ 'tip' => wfMsg( 'media_tip' ),
 2203+ 'key' => 'M'
22032204 ),
22042205 array(
2205 - 'image' => $wgLang->getImageFile( 'button-math' ),
2206 - 'id' => 'mw-editbutton-math',
2207 - 'open' => "<math>",
2208 - 'close' => "</math>",
 2206+ 'image' => $wgLang->getImageFile( 'button-math' ),
 2207+ 'id' => 'mw-editbutton-math',
 2208+ 'open' => "<math>",
 2209+ 'close' => "</math>",
22092210 'sample' => wfMsg( 'math_sample' ),
2210 - 'tip' => wfMsg( 'math_tip' ),
2211 - 'key' => 'C'
 2211+ 'tip' => wfMsg( 'math_tip' ),
 2212+ 'key' => 'C'
22122213 ),
22132214 array(
2214 - 'image' => $wgLang->getImageFile( 'button-nowiki' ),
2215 - 'id' => 'mw-editbutton-nowiki',
2216 - 'open' => "<nowiki>",
2217 - 'close' => "</nowiki>",
 2215+ 'image' => $wgLang->getImageFile( 'button-nowiki' ),
 2216+ 'id' => 'mw-editbutton-nowiki',
 2217+ 'open' => "<nowiki>",
 2218+ 'close' => "</nowiki>",
22182219 'sample' => wfMsg( 'nowiki_sample' ),
2219 - 'tip' => wfMsg( 'nowiki_tip' ),
2220 - 'key' => 'N'
 2220+ 'tip' => wfMsg( 'nowiki_tip' ),
 2221+ 'key' => 'N'
22212222 ),
22222223 array(
2223 - 'image' => $wgLang->getImageFile( 'button-sig' ),
2224 - 'id' => 'mw-editbutton-signature',
2225 - 'open' => '--~~~~',
2226 - 'close' => '',
 2224+ 'image' => $wgLang->getImageFile( 'button-sig' ),
 2225+ 'id' => 'mw-editbutton-signature',
 2226+ 'open' => '--~~~~',
 2227+ 'close' => '',
22272228 'sample' => '',
2228 - 'tip' => wfMsg( 'sig_tip' ),
2229 - 'key' => 'Y'
 2229+ 'tip' => wfMsg( 'sig_tip' ),
 2230+ 'key' => 'Y'
22302231 ),
22312232 array(
2232 - 'image' => $wgLang->getImageFile( 'button-hr' ),
2233 - 'id' => 'mw-editbutton-hr',
2234 - 'open' => "\n----\n",
2235 - 'close' => '',
 2233+ 'image' => $wgLang->getImageFile( 'button-hr' ),
 2234+ 'id' => 'mw-editbutton-hr',
 2235+ 'open' => "\n----\n",
 2236+ 'close' => '',
22362237 'sample' => '',
2237 - 'tip' => wfMsg( 'hr_tip' ),
2238 - 'key' => 'R'
 2238+ 'tip' => wfMsg( 'hr_tip' ),
 2239+ 'key' => 'R'
22392240 )
22402241 );
22412242 $toolbar = "<div id='toolbar'>\n";
@@ -2274,7 +2275,7 @@
22752276 * @param $tabindex Current tabindex
22762277 * @param $skin Skin object
22772278 * @param $checked Array of checkbox => bool, where bool indicates the checked
2278 - * status of the checkbox
 2279+ * status of the checkbox
22792280 *
22802281 * @return array
22812282 */
@@ -2287,9 +2288,9 @@
22882289 $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) );
22892290 if ( $wgUser->isAllowed( 'minoredit' ) ) {
22902291 $attribs = array(
2291 - 'tabindex' => ++$tabindex,
 2292+ 'tabindex' => ++$tabindex,
22922293 'accesskey' => wfMsg( 'accesskey-minoredit' ),
2293 - 'id' => 'wpMinoredit',
 2294+ 'id' => 'wpMinoredit',
22942295 );
22952296 $checkboxes['minor'] =
22962297 Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
@@ -2300,9 +2301,9 @@
23012302 $checkboxes['watch'] = '';
23022303 if ( $wgUser->isLoggedIn() ) {
23032304 $attribs = array(
2304 - 'tabindex' => ++$tabindex,
 2305+ 'tabindex' => ++$tabindex,
23052306 'accesskey' => wfMsg( 'accesskey-watch' ),
2306 - 'id' => 'wpWatchthis',
 2307+ 'id' => 'wpWatchthis',
23072308 );
23082309 $checkboxes['watch'] =
23092310 Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
@@ -2324,37 +2325,37 @@
23252326 $buttons = array();
23262327
23272328 $temp = array(
2328 - 'id' => 'wpSave',
2329 - 'name' => 'wpSave',
2330 - 'type' => 'submit',
2331 - 'tabindex' => ++$tabindex,
2332 - 'value' => wfMsg( 'savearticle' ),
 2329+ 'id' => 'wpSave',
 2330+ 'name' => 'wpSave',
 2331+ 'type' => 'submit',
 2332+ 'tabindex' => ++$tabindex,
 2333+ 'value' => wfMsg( 'savearticle' ),
23332334 'accesskey' => wfMsg( 'accesskey-save' ),
2334 - 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
 2335+ 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
23352336 );
23362337 $buttons['save'] = Xml::element('input', $temp, '');
23372338
23382339 ++$tabindex; // use the same for preview and live preview
23392340 $temp = array(
2340 - 'id' => 'wpPreview',
2341 - 'name' => 'wpPreview',
2342 - 'type' => 'submit',
2343 - 'tabindex' => $tabindex,
2344 - 'value' => wfMsg( 'showpreview' ),
 2341+ 'id' => 'wpPreview',
 2342+ 'name' => 'wpPreview',
 2343+ 'type' => 'submit',
 2344+ 'tabindex' => $tabindex,
 2345+ 'value' => wfMsg( 'showpreview' ),
23452346 'accesskey' => wfMsg( 'accesskey-preview' ),
2346 - 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
 2347+ 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
23472348 );
23482349 $buttons['preview'] = Xml::element( 'input', $temp, '' );
23492350 $buttons['live'] = '';
23502351
23512352 $temp = array(
2352 - 'id' => 'wpDiff',
2353 - 'name' => 'wpDiff',
2354 - 'type' => 'submit',
2355 - 'tabindex' => ++$tabindex,
2356 - 'value' => wfMsg( 'showdiff' ),
 2353+ 'id' => 'wpDiff',
 2354+ 'name' => 'wpDiff',
 2355+ 'type' => 'submit',
 2356+ 'tabindex' => ++$tabindex,
 2357+ 'value' => wfMsg( 'showdiff' ),
23572358 'accesskey' => wfMsg( 'accesskey-diff' ),
2358 - 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
 2359+ 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
23592360 );
23602361 $buttons['diff'] = Xml::element( 'input', $temp, '' );
23612362
@@ -2370,9 +2371,9 @@
23712372 * failure, etc).
23722373 *
23732374 * @todo This doesn't include category or interlanguage links.
2374 - * Would need to enhance it a bit, <s>maybe wrap them in XML
2375 - * or something...</s> that might also require more skin
2376 - * initialization, so check whether that's a problem.
 2375+ * Would need to enhance it a bit, <s>maybe wrap them in XML
 2376+ * or something...</s> that might also require more skin
 2377+ * initialization, so check whether that's a problem.
23772378 */
23782379 function livePreview() {
23792380 global $wgOut;
@@ -2427,7 +2428,7 @@
24282429 $newtext = $this->mArticle->preSaveTransform( $newtext );
24292430 $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) );
24302431 $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) );
2431 - if ( $oldtext !== false || $newtext != '' ) {
 2432+ if ( $oldtext !== false || $newtext != '' ) {
24322433 $de = new DifferenceEngine( $this->mTitle );
24332434 $de->setText( $oldtext, $newtext );
24342435 $difftext = $de->getDiff( $oldtitle, $newtitle );
@@ -2587,7 +2588,7 @@
25882589 switch ( $value ) {
25892590 case self::AS_HOOK_ERROR_EXPECTED:
25902591 case self::AS_CONTENT_TOO_BIG:
2591 - case self::AS_ARTICLE_WAS_DELETED:
 2592+ case self::AS_ARTICLE_WAS_DELETED:
25922593 case self::AS_CONFLICT_DETECTED:
25932594 case self::AS_SUMMARY_NEEDED:
25942595 case self::AS_TEXTBOX_EMPTY:
@@ -2617,22 +2618,22 @@
26182619 $this->userNotLoggedInPage();
26192620 return false;
26202621
2621 - case self::AS_READ_ONLY_PAGE_LOGGED:
2622 - case self::AS_READ_ONLY_PAGE:
2623 - $wgOut->readOnlyPage();
2624 - return false;
 2622+ case self::AS_READ_ONLY_PAGE_LOGGED:
 2623+ case self::AS_READ_ONLY_PAGE:
 2624+ $wgOut->readOnlyPage();
 2625+ return false;
26252626
2626 - case self::AS_RATE_LIMITED:
2627 - $wgOut->rateLimited();
2628 - return false;
 2627+ case self::AS_RATE_LIMITED:
 2628+ $wgOut->rateLimited();
 2629+ return false;
26292630
2630 - case self::AS_NO_CREATE_PERMISSION:
2631 - $this->noCreatePermission();
2632 - return;
 2631+ case self::AS_NO_CREATE_PERMISSION:
 2632+ $this->noCreatePermission();
 2633+ return;
26332634
26342635 case self::AS_BLANK_ARTICLE:
2635 - $wgOut->redirect( $wgTitle->getFullURL() );
2636 - return false;
 2636+ $wgOut->redirect( $wgTitle->getFullURL() );
 2637+ return false;
26372638
26382639 case self::AS_IMAGE_REDIRECT_LOGGED:
26392640 $wgOut->permissionRequired( 'upload' );
@@ -2649,5 +2650,5 @@
26502651 } else {
26512652 return $this->mBaseRevision;
26522653 }
2653 - }
 2654+ }
26542655 }
Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -45,7 +45,6 @@
4646 define( 'UNORM_FCD', 6 );
4747
4848 define( 'NORMALIZE_ICU', function_exists( 'utf8_normalize' ) );
49 -define( 'NORMALIZE_INTL', function_exists( 'normalizer_normalize' ) );
5049
5150 /**
5251 * Unicode normalization routines for working with UTF-8 strings.
@@ -80,7 +79,7 @@
8180 return $ret;
8281 }
8382
84 - if( NORMALIZE_ICU || NORMALIZE_INTL ) {
 83+ if( NORMALIZE_ICU ) {
8584 # We exclude a few chars that ICU would not.
8685 $string = preg_replace(
8786 '/[\x00-\x08\x0b\x0c\x0e-\x1f]/',
@@ -91,8 +90,7 @@
9291
9392 # UnicodeString constructor fails if the string ends with a
9493 # head byte. Add a junk char at the end, we'll strip it off.
95 - if ( NORMALIZE_ICU ) return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" );
96 - if ( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_C );
 94+ return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" );
9795 } elseif( UtfNormal::quickIsNFCVerify( $string ) ) {
9896 # Side effect -- $string has had UTF-8 errors cleaned up.
9997 return $string;
@@ -110,9 +108,7 @@
111109 * @return string a UTF-8 string in normal form C
112110 */
113111 static function toNFC( $string ) {
114 - if( NORMALIZE_INTL )
115 - return normalizer_normalize( $string, Normalizer::FORM_C );
116 - elseif( NORMALIZE_ICU )
 112+ if( NORMALIZE_ICU )
117113 return utf8_normalize( $string, UNORM_NFC );
118114 elseif( UtfNormal::quickIsNFC( $string ) )
119115 return $string;
@@ -128,9 +124,7 @@
129125 * @return string a UTF-8 string in normal form D
130126 */
131127 static function toNFD( $string ) {
132 - if( NORMALIZE_INTL )
133 - return normalizer_normalize( $string, Normalizer::FORM_D );
134 - elseif( NORMALIZE_ICU )
 128+ if( NORMALIZE_ICU )
135129 return utf8_normalize( $string, UNORM_NFD );
136130 elseif( preg_match( '/[\x80-\xff]/', $string ) )
137131 return UtfNormal::NFD( $string );
@@ -147,9 +141,7 @@
148142 * @return string a UTF-8 string in normal form KC
149143 */
150144 static function toNFKC( $string ) {
151 - if( NORMALIZE_INTL )
152 - return normalizer_normalize( $string, Normalizer::FORM_KC );
153 - elseif( NORMALIZE_ICU )
 145+ if( NORMALIZE_ICU )
154146 return utf8_normalize( $string, UNORM_NFKC );
155147 elseif( preg_match( '/[\x80-\xff]/', $string ) )
156148 return UtfNormal::NFKC( $string );
@@ -166,9 +158,7 @@
167159 * @return string a UTF-8 string in normal form KD
168160 */
169161 static function toNFKD( $string ) {
170 - if( NORMALIZE_INTL )
171 - return normalizer_normalize( $string, Normalizer::FORM_KD );
172 - elseif( NORMALIZE_ICU )
 162+ if( NORMALIZE_ICU )
173163 return utf8_normalize( $string, UNORM_NFKD );
174164 elseif( preg_match( '/[\x80-\xff]/', $string ) )
175165 return UtfNormal::NFKD( $string );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69620Admin is required now.mah15:05, 20 July 2010

Status & tagging log