Merge "Use camel case for variable names in Article.php"
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index 9dc4d03..d09470b 100644 (file)
@@ -213,7 +213,7 @@ class ApiParse extends ApiBase {
                        }
 
                        if ( $this->section !== false ) {
-                               $this->content = $this->getSectionContent( $this->content, $titleObj->getText() );
+                               $this->content = $this->getSectionContent( $this->content, $titleObj->getPrefixedText() );
                        }
 
                        if ( $params['pst'] || $params['onlypst'] ) {
@@ -270,7 +270,7 @@ class ApiParse extends ApiBase {
                        );
                }
 
-               if ( isset( $prop['langlinks'] ) || isset( $prop['languageshtml'] ) ) {
+               if ( isset( $prop['langlinks'] ) ) {
                        $langlinks = $p_result->getLanguageLinks();
 
                        if ( $params['effectivelanglinks'] ) {
@@ -286,12 +286,6 @@ class ApiParse extends ApiBase {
                if ( isset( $prop['langlinks'] ) ) {
                        $result_array['langlinks'] = $this->formatLangLinks( $langlinks );
                }
-               if ( isset( $prop['languageshtml'] ) ) {
-                       $languagesHtml = $this->languagesHtml( $langlinks );
-
-                       $result_array['languageshtml'] = array();
-                       ApiResult::setContent( $result_array['languageshtml'], $languagesHtml );
-               }
                if ( isset( $prop['categories'] ) ) {
                        $result_array['categories'] = $this->formatCategoryLinks( $p_result->getCategories() );
                }
@@ -456,7 +450,7 @@ class ApiParse extends ApiBase {
                if ( $this->section !== false && $this->content !== null ) {
                        $this->content = $this->getSectionContent(
                                $this->content,
-                               !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getText()
+                               !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getPrefixedText()
                        );
 
                        // Not cached (save or load)
@@ -476,6 +470,10 @@ class ApiParse extends ApiBase {
                return $pout;
        }
 
+       /**
+        * @param Content $content
+        * @param string $what Identifies the content in error messages, e.g. page title.
+        */
        private function getSectionContent( Content $content, $what ) {
                // Not cached (save or load)
                $section = $content->getSection( $this->section );
@@ -563,46 +561,6 @@ class ApiParse extends ApiBase {
                return $context->getSkin()->getCategories();
        }
 
-       /**
-        * @deprecated since 1.18 No modern skin generates language links this way,
-        * please use language links data to generate your own HTML.
-        * @param array $languages
-        * @return string
-        */
-       private function languagesHtml( $languages ) {
-               wfDeprecated( __METHOD__, '1.18' );
-               $this->setWarning( '"action=parse&prop=languageshtml" is deprecated ' .
-                       'and will be removed in MediaWiki 1.24. Use "prop=langlinks" ' .
-                       'to generate your own HTML.' );
-
-               global $wgContLang;
-
-               if ( $this->getConfig()->get( 'HideInterlanguageLinks' ) || count( $languages ) == 0 ) {
-                       return '';
-               }
-
-               $s = htmlspecialchars( wfMessage( 'otherlanguages' )->text() .
-                       wfMessage( 'colon-separator' )->text() );
-
-               $langs = array();
-               foreach ( $languages as $l ) {
-                       $nt = Title::newFromText( $l );
-                       $text = Language::fetchLanguageName( $nt->getInterwiki() );
-
-                       $langs[] = Html::element( 'a',
-                               array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => 'external' ),
-                               $text == '' ? $l : $text );
-               }
-
-               $s .= implode( wfMessage( 'pipe-separator' )->escaped(), $langs );
-
-               if ( $wgContLang->isRTL() ) {
-                       $s = Html::rawElement( 'span', array( 'dir' => 'LTR' ), $s );
-               }
-
-               return $s;
-       }
-
        private function formatLinks( $links ) {
                $result = array();
                foreach ( $links as $ns => $nslinks ) {
@@ -723,7 +681,6 @@ class ApiParse extends ApiBase {
                                ApiBase::PARAM_TYPE => array(
                                        'text',
                                        'langlinks',
-                                       'languageshtml',
                                        'categories',
                                        'categorieshtml',
                                        'links',
@@ -782,8 +739,6 @@ class ApiParse extends ApiBase {
                                ' langlinks      - Gives the language links in the parsed wikitext',
                                ' categories     - Gives the categories in the parsed wikitext',
                                ' categorieshtml - Gives the HTML version of the categories',
-                               ' languageshtml  - DEPRECATED. Will be removed in MediaWiki 1.24.',
-                               '                  Gives the HTML version of the language links',
                                ' links          - Gives the internal links in the parsed wikitext',
                                ' templates      - Gives the templates in the parsed wikitext',
                                ' images         - Gives the images in the parsed wikitext',
@@ -804,7 +759,7 @@ class ApiParse extends ApiBase {
                        ),
                        'effectivelanglinks' => array(
                                'Includes language links supplied by extensions',
-                               '(for use with prop=langlinks|languageshtml)',
+                               '(for use with prop=langlinks)',
                        ),
                        'pst' => array(
                                'Do a pre-save transform on the input before parsing it',
@@ -849,29 +804,6 @@ class ApiParse extends ApiBase {
                );
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array(
-                               'code' => 'params',
-                               'info' => 'The page parameter cannot be used together with the text and title parameters'
-                       ),
-                       array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
-                       array(
-                               'code' => 'permissiondenied',
-                               'info' => 'You don\'t have permission to view deleted revisions'
-                       ),
-                       array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
-                       array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
-                       array( 'nosuchpageid' ),
-                       array( 'invalidtitle', 'title' ),
-                       array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
-                       array(
-                               'code' => 'notwikitext',
-                               'info' => 'The requested operation is only supported on wikitext content.'
-                       ),
-               ) );
-       }
-
        public function getExamples() {
                return array(
                        'api.php?action=parse&page=Project:Sandbox' => 'Parse a page',