Deprecate rarely or unused *LinkAttributes methods in Linker
[lhc/web/wiklou.git] / includes / EditPage.php
index a423f26..d106da2 100644 (file)
@@ -779,7 +779,8 @@ class EditPage {
                                // TODO: softened the check for cutover.  Once we determine
                                // that it is safe, we should complete the transition by
                                // removing the "edittime" clause.
-                               $this->incompleteForm = ( !$request->getVal( 'wpUltimateParam' ) && is_null( $this->edittime ) );
+                               $this->incompleteForm = ( !$request->getVal( 'wpUltimateParam' )
+                                       && is_null( $this->edittime ) );
                        }
                        if ( $this->incompleteForm ) {
                                # If the form is incomplete, force to preview.
@@ -2106,6 +2107,17 @@ class EditPage {
                if ( $namespace == NS_MEDIAWIKI ) {
                        # Show a warning if editing an interface message
                        $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1\n</div>", 'editinginterface' );
+                       # If this is a default message (but not css or js),
+                       # show a hint that it is translatable on translatewiki.net
+                       if ( !$this->mTitle->hasContentModel( CONTENT_MODEL_CSS )
+                               && !$this->mTitle->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+                       ) {
+                               $defaultMessageText = $this->mTitle->getDefaultMessageText();
+                               if ( $defaultMessageText !== false ) {
+                                       $wgOut->wrapWikiMsg( "<div class='mw-translateinterface'>\n$1\n</div>",
+                                               'translateinterface' );
+                               }
+                       }
                } elseif ( $namespace == NS_FILE ) {
                        # Show a hint to shared repo
                        $file = wfFindFile( $this->mTitle );
@@ -2137,7 +2149,8 @@ class EditPage {
                        if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
                                $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
                                        array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
-                       } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { # Show log extract if the user is currently blocked
+                       } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
+                               # Show log extract if the user is currently blocked
                                LogEventsList::showLogExtract(
                                        $wgOut,
                                        'block',
@@ -2204,7 +2217,10 @@ class EditPage {
                        if ( $title instanceof Title && $title->exists() && $title->userCan( 'read' ) ) {
                                global $wgOut;
                                // Added using template syntax, to take <noinclude>'s into account.
-                               $wgOut->addWikiTextTitleTidy( '<div class="mw-editintro">{{:' . $title->getFullText() . '}}</div>', $this->mTitle );
+                               $wgOut->addWikiTextTitleTidy(
+                                       '<div class="mw-editintro">{{:' . $title->getFullText() . '}}</div>',
+                                       $this->mTitle
+                               );
                                return true;
                        }
                }
@@ -2940,7 +2956,7 @@ HTML
                );
 
                $pageLang = $this->mTitle->getPageLanguage();
-               $attribs['lang'] = $pageLang->getCode();
+               $attribs['lang'] = $pageLang->getHtmlCode();
                $attribs['dir'] = $pageLang->getDir();
 
                $wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) );
@@ -3968,7 +3984,7 @@ HTML
                                // Do some sanity checks. These aren't needed for reversibility,
                                // but should help keep the breakage down if the editor
                                // breaks one of the entities whilst editing.
-                               if ( ( substr( $invalue, $i, 1 ) == ";" ) and ( strlen( $hexstring ) <= 6 ) ) {
+                               if ( ( substr( $invalue, $i, 1 ) == ";" ) && ( strlen( $hexstring ) <= 6 ) ) {
                                        $codepoint = hexdec( $hexstring );
                                        $result .= codepointToUtf8( $codepoint );
                                } else {