Start better utalizing OutputPage as the focal point for things related to the output...
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index c86061f..714a8eb 100644 (file)
@@ -252,24 +252,25 @@ class ApiParse extends ApiBase {
 
                if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
                        $out = new OutputPage;
+                       $out->setUser( $wgUser );
                        $out->addParserOutputNoText( $p_result );
                        $userSkin = $wgUser->getSkin();
-               }
 
-               if ( isset( $prop['headitems'] ) ) {
-                       $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
+                       if ( isset( $prop['headitems'] ) ) {
+                               $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
 
-                       $userSkin->setupUserCss( $out );
-                       $css = $this->formatCss( $out->buildCssLinksArray() );
+                               $userSkin->setupUserCss( $out );
+                               $css = $this->formatCss( $out->buildCssLinksArray() );
 
-                       $scripts = array( $out->getHeadScripts( $userSkin ) );
+                               $scripts = array( $out->getHeadScripts( $userSkin ) );
 
-                       $result_array['headitems'] = array_merge( $headItems, $css, $scripts );
-               }
+                               $result_array['headitems'] = array_merge( $headItems, $css, $scripts );
+                       }
 
-               if ( isset( $prop['headhtml'] ) ) {
-                       $result_array['headhtml'] = array();
-                       $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) );
+                       if ( isset( $prop['headhtml'] ) ) {
+                               $result_array['headhtml'] = array();
+                               $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) );
+                       }
                }
 
                if ( isset( $prop['iwlinks'] ) ) {
@@ -382,7 +383,7 @@ class ApiParse extends ApiBase {
         * @deprecated No modern skin generates langlinks this way, please use langlinks data to generate your own html
         */
        private function languagesHtml( $languages ) {
-               global $wgOut, $wgUser, $wgContLang, $wgHideInterlanguageLinks;
+               global $wgContLang, $wgHideInterlanguageLinks;
 
                if ( $wgHideInterlanguageLinks || count( $languages ) == 0 ) {
                        return '';