... maybe in action=parse or meta=siteinfo. Take note that these URLs depend on site config and part of it varies per skin.
Version: 1.15.x
Severity: enhancement
... maybe in action=parse or meta=siteinfo. Take note that these URLs depend on site config and part of it varies per skin.
Version: 1.15.x
Severity: enhancement
Seems we need OutputPage::headElement, passing in the current skin...
But we don't really want it just outputting it however.. Can we get a reference to the output page via any method?
(In reply to comment #1)
Seems we need OutputPage::headElement, passing in the current skin...
But we don't really want it just outputting it however..
headElement() doesn't do any output, it just returns a string.
Can we get a reference
to the output page via any method?
Creating a new one should work just fine, as $wgOut (the global one) doesn't contain anything useful anyway and messing it up is bad style.
$out = new OutputPage;
$out->addParserOutputNoText( $po ); // PO object generated by action=parse
$headHTML = $out->headElement();
In parse..
if ( isset( $prop['stylesheets'] ) ) { $out = new OutputPage; $out->addParserOutputNoText( $p_result ); // PO object generated by action=parse $result_array['stylesheets'] = $out->headElement( $wgUser->getSkin() ); }
http://mediawiki.pastebin.com/f5e69e38a
Obviously too much information, but on the right track...
<link rel="stylesheet" href="/w/skins/common/shared.css?265" media="screen" />
<link rel="stylesheet" href="/w/skins/common/commonPrint.css?265" media="print" />
<link rel="stylesheet" href="/w/skins/monobook/main.css?265" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="/w/skins/monobook/IE60Fixes.css?265" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="/w/skins/monobook/IE70Fixes.css?265" media="screen" /><![endif]-->
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=18000&action=raw&maxage=18000" />
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Print.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=18000&action=raw&maxage=18000" media="print" />
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=18000&action=raw&maxage=18000" />
<link rel="stylesheet" href="/w/index.php?title=-&action=raw&maxage=18000&gen=css" />
How much do we want to give them? Or do we just give them it like that, htmlencoded?
r62195
Not quite as originally requested, but prop=headhtml on action=parse will give a dump of the <head> stuff
Reopening, think I should do this in a better fashion
From OutputPage.php
<Reedy> 02121 $this->buildCssLinks(),
<Reedy> 02122 $this->getHeadScripts( $sk ),
<Reedy> 02123 $this->getHeadItems(),
<Reedy> Is what it should be returning
<Reedy> but as a proper list
<Reedy> Annoyingly, most of those functions make the result into a string
HeadItems comes from prop=headitems (from extensions...)
Maybe prop=headscripts and prop=csslinks....
Suggestions?
(In reply to comment #6)
Reopening, think I should do this in a better fashion
From OutputPage.php
<Reedy> 02121 $this->buildCssLinks(),
<Reedy> 02122 $this->getHeadScripts( $sk ),
<Reedy> 02123 $this->getHeadItems(),
<Reedy> Is what it should be returning
<Reedy> but as a proper list
<Reedy> Annoyingly, most of those functions make the result into a stringHeadItems comes from prop=headitems (from extensions...)
Maybe prop=headscripts and prop=csslinks....
Suggestions?
Returning these separately means sense I guess, but it's probably also convenient to have a way to get the whole thing at once.
Per IRC..
Can we get away with changing/adding onto headitems, and backport to 1.16
Or just keep seperate, and have an option to get all..
(In reply to comment #8)
Per IRC..
Can we get away with changing/adding onto headitems, and backport to 1.16
Or just keep seperate, and have an option to get all..
Adding stuff onto headitems is definitely acceptable IMO
http://mediawiki.pastebin.com/2k8UJEb2
Script is a bit nasty. Don't know if we want to split it off a bit more (find some way of
We can explode, and array_filter. But we strip whatever we add.. So would have to reappend...
Unless we regex split.
Worth doing, or not worth the faff?
http://mediawiki.pastebin.com/RwwEqfQm
Is the original head items, CSS, and scripts...