Set visibility for some methods and remove unused ones
[lhc/web/wiklou.git] / includes / EditPage.php
index 5f5cb53..68a4932 100644 (file)
@@ -36,7 +36,6 @@
  * headaches, which may be fatal.
  */
 class EditPage {
-
        /**
         * Status: Article successfully updated
         */
@@ -2082,10 +2081,27 @@ class EditPage {
                }
                # Try to add a custom edit intro, or use the standard one if this is not possible.
                if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) {
+                       $helpLink = Skin::makeInternalOrExternalUrl(
+                               wfMessage( 'helppage' )->inContentLanguage()->text()
+                       );
                        if ( $wgUser->isLoggedIn() ) {
-                               $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletext\">\n$1\n</div>", 'newarticletext' );
+                               $wgOut->wrapWikiMsg(
+                                       // Suppress the external link icon, consider the help url an internal one
+                                       "<div class=\"mw-newarticletext plainlinks\">\n$1\n</div>",
+                                       array(
+                                               'newarticletext',
+                                               $helpLink
+                                       )
+                               );
                        } else {
-                               $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1\n</div>", 'newarticletextanon' );
+                               $wgOut->wrapWikiMsg(
+                                       // Suppress the external link icon, consider the help url an internal one
+                                       "<div class=\"mw-newarticletextanon plainlinks\">\n$1\n</div>",
+                                       array(
+                                               'newarticletextanon',
+                                               $helpLink
+                                       )
+                               );
                        }
                }
                # Give a notice if the user is editing a deleted/moved page...
@@ -3446,16 +3462,16 @@ HTML
                        }
 
                        $params = array(
-                               $image = $wgStylePath . '/common/images/' . $tool['image'],
+                               $wgStylePath . '/common/images/' . $tool['image'],
                                // Note that we use the tip both for the ALT tag and the TITLE tag of the image.
                                // Older browsers show a "speedtip" type message only for ALT.
                                // Ideally these should be different, realistically they
                                // probably don't need to be.
-                               $tip = $tool['tip'],
-                               $open = $tool['open'],
-                               $close = $tool['close'],
-                               $sample = $tool['sample'],
-                               $cssId = $tool['id'],
+                               $tool['tip'],
+                               $tool['open'],
+                               $tool['close'],
+                               $tool['sample'],
+                               $tool['id'],
                        );
 
                        $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params );
@@ -3688,25 +3704,13 @@ HTML
                $wgOut->addReturnTo( $this->getContextTitle(), array( 'action' => 'edit' ) );
        }
 
-       /**
-        * Format an anchor fragment as it would appear for a given section name
-        * @param $text String
-        * @return String
-        * @private
-        */
-       function sectionAnchor( $text ) {
-               global $wgParser;
-               return $wgParser->guessSectionNameFromWikiText( $text );
-       }
-
        /**
         * Check if the browser is on a blacklist of user-agents known to
         * mangle UTF-8 data on form submission. Returns true if Unicode
         * should make it through, false if it's known to be a problem.
         * @return bool
-        * @private
         */
-       function checkUnicodeCompliantBrowser() {
+       private function checkUnicodeCompliantBrowser() {
                global $wgBrowserBlackList, $wgRequest;
 
                $currentbrowser = $wgRequest->getHeader( 'User-Agent' );
@@ -3727,27 +3731,14 @@ HTML
         * Filter an input field through a Unicode de-armoring process if it
         * came from an old browser with known broken Unicode editing issues.
         *
-        * @param $request WebRequest
-        * @param $field String
-        * @return String
-        * @private
-        */
-       function safeUnicodeInput( $request, $field ) {
-               $text = rtrim( $request->getText( $field ) );
-               return $request->getBool( 'safemode' )
-                       ? $this->unmakesafe( $text )
-                       : $text;
-       }
-
-       /**
-        * @param $request WebRequest
-        * @param $text string
+        * @param WebRequest $request
+        * @param string $field
         * @return string
         */
-       function safeUnicodeText( $request, $text ) {
-               $text = rtrim( $text );
+       protected function safeUnicodeInput( $request, $field ) {
+               $text = rtrim( $request->getText( $field ) );
                return $request->getBool( 'safemode' )
-                       ? $this->unmakesafe( $text )
+                       ? $this->unmakeSafe( $text )
                        : $text;
        }
 
@@ -3755,16 +3746,15 @@ HTML
         * Filter an output field through a Unicode armoring process if it is
         * going to an old browser with known broken Unicode editing issues.
         *
-        * @param $text String
-        * @return String
-        * @private
+        * @param string $text
+        * @return string
         */
-       function safeUnicodeOutput( $text ) {
+       protected function safeUnicodeOutput( $text ) {
                global $wgContLang;
                $codedText = $wgContLang->recodeForEdit( $text );
                return $this->checkUnicodeCompliantBrowser()
                        ? $codedText
-                       : $this->makesafe( $codedText );
+                       : $this->makeSafe( $codedText );
        }
 
        /**
@@ -3776,11 +3766,10 @@ HTML
         * Preexisting such character references will have a 0 added to them
         * to ensure that round-trips do not alter the original data.
         *
-        * @param $invalue String
-        * @return String
-        * @private
+        * @param string $invalue
+        * @return string
         */
-       function makesafe( $invalue ) {
+       private function makeSafe( $invalue ) {
                // Armor existing references for reversibility.
                $invalue = strtr( $invalue, array( "&#x" => "&#x0" ) );
 
@@ -3818,13 +3807,13 @@ HTML
         * back to UTF-8. Used to protect data from corruption by broken web browsers
         * as listed in $wgBrowserBlackList.
         *
-        * @param $invalue String
-        * @return String
-        * @private
+        * @param string $invalue
+        * @return string
         */
-       function unmakesafe( $invalue ) {
+       private function unmakeSafe( $invalue ) {
                $result = "";
-               for ( $i = 0; $i < strlen( $invalue ); $i++ ) {
+               $valueLength = strlen( $invalue );
+               for ( $i = 0; $i < $valueLength; $i++ ) {
                        if ( ( substr( $invalue, $i, 3 ) == "&#x" ) && ( $invalue[$i + 3] != '0' ) ) {
                                $i += 3;
                                $hexstring = "";