Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2415,15 +2415,18 @@ |
2416 | 2416 | * These will be applied to various media & IE conditionals. |
2417 | 2417 | */ |
2418 | 2418 | public function buildCssLinks() { |
| 2419 | + return implode( "\n", $this->buildCssLinksArray() ); |
| 2420 | + } |
| 2421 | + |
| 2422 | + public function buildCssLinksArray() { |
2419 | 2423 | $links = array(); |
2420 | 2424 | foreach( $this->styles as $file => $options ) { |
2421 | 2425 | $link = $this->styleLink( $file, $options ); |
2422 | 2426 | if( $link ) { |
2423 | | - $links[] = $link; |
| 2427 | + $links[$file] = $link; |
2424 | 2428 | } |
2425 | 2429 | } |
2426 | | - |
2427 | | - return implode( "\n", $links ); |
| 2430 | + return $links; |
2428 | 2431 | } |
2429 | 2432 | |
2430 | 2433 | /** |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -217,15 +217,26 @@ |
218 | 218 | $titleObj->getPrefixedText(); |
219 | 219 | } |
220 | 220 | |
| 221 | + if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) { |
| 222 | + $out = new OutputPage; |
| 223 | + $out->addParserOutputNoText( $p_result ); |
| 224 | + $userSkin = $wgUser->getSkin(); |
| 225 | + } |
| 226 | + |
221 | 227 | if ( isset( $prop['headitems'] ) ) { |
222 | | - $result_array['headitems'] = $this->formatHeadItems( $p_result->getHeadItems() ); |
| 228 | + $headItems = $this->formatHeadItems( $p_result->getHeadItems() ); |
| 229 | + |
| 230 | + $userSkin->setupUserCss( $out ); |
| 231 | + $css = $this->formatCss( $out->buildCssLinksArray() ); |
| 232 | + |
| 233 | + $scripts = array( $out->getHeadScripts( $userSkin ) ); |
| 234 | + |
| 235 | + $result_array['headitems'] = array_merge( $headItems , $css, $scripts ); |
223 | 236 | } |
224 | 237 | |
225 | 238 | if ( isset( $prop['headhtml'] ) ) { |
226 | | - $out = new OutputPage; |
227 | | - $out->addParserOutputNoText( $p_result ); |
228 | 239 | $result_array['headhtml'] = array(); |
229 | | - $result->setContent( $result_array['headhtml'], $out->headElement( $wgUser->getSkin() ) ); |
| 240 | + $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) ); |
230 | 241 | } |
231 | 242 | |
232 | 243 | if ( !is_null( $oldid ) ) { |
— | — | @@ -241,7 +252,7 @@ |
242 | 253 | 'images' => 'img', |
243 | 254 | 'externallinks' => 'el', |
244 | 255 | 'sections' => 's', |
245 | | - 'headitems' => 'hi' |
| 256 | + 'headitems' => 'hi', |
246 | 257 | ); |
247 | 258 | $this->setIndexedTagNames( $result_array, $result_mapping ); |
248 | 259 | $result->addValue( null, $this->getModuleName(), $result_array ); |
— | — | @@ -310,6 +321,17 @@ |
311 | 322 | return $result; |
312 | 323 | } |
313 | 324 | |
| 325 | + private function formatCss( $css ) { |
| 326 | + $result = array(); |
| 327 | + foreach ( $css as $file => $link ) { |
| 328 | + $entry = array(); |
| 329 | + $entry['file'] = $file; |
| 330 | + $this->getResult()->setContent( $entry, $link ); |
| 331 | + $result[] = $entry; |
| 332 | + } |
| 333 | + return $result; |
| 334 | + } |
| 335 | + |
314 | 336 | private function setIndexedTagNames( &$array, $mapping ) { |
315 | 337 | foreach ( $mapping as $key => $name ) { |
316 | 338 | if ( isset( $array[$key] ) ) { |