Skip to content

Commit

Permalink
Merge pull request #982 from gamma/css.php
Browse files Browse the repository at this point in the history
Allow arbitrary mediatype names for CSS
  • Loading branch information
splitbrain committed Jan 8, 2015
2 parents f25cd16 + fc30ac3 commit 32e9be2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/exe/css.php
Expand Up @@ -32,24 +32,25 @@ function css_out(){
global $config_cascade;
global $INPUT;

// decide from where to get the template
$tpl = trim(preg_replace('/[^\w-]+/','',$INPUT->str('t')));
if(!$tpl) $tpl = $conf['template'];

// load styl.ini
$styleini = css_styleini($tpl);

// find mediatypes
if ($INPUT->str('s') == 'feed') {
$mediatypes = array('feed');
$type = 'feed';
} else {
$mediatypes = array('screen', 'all', 'print');
$mediatypes = array_unique(array_merge(array('screen', 'all', 'print'), array_keys($styleini['stylesheets'])));
$type = '';
}

// decide from where to get the template
$tpl = trim(preg_replace('/[^\w-]+/','',$INPUT->str('t')));
if(!$tpl) $tpl = $conf['template'];

// The generated script depends on some dynamic options
$cache = new cache('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tpl.$type,'.css');

// load styl.ini
$styleini = css_styleini($tpl);

// if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility
if (isset($config_cascade['userstyle']['default'])) {
$config_cascade['userstyle']['screen'] = array($config_cascade['userstyle']['default']);
Expand Down

0 comments on commit 32e9be2

Please sign in to comment.