1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Added an id to local theme stylesheets.

This commit is contained in:
Cameron 2017-01-25 11:04:14 -08:00
parent d776d116dc
commit 988519a0f8
2 changed files with 15 additions and 1 deletions

View File

@ -4319,6 +4319,7 @@ class eHelper
public static function secureIdAttr($string)
{
$string = str_replace(array('/','_'),'-',$string);
return preg_replace(self::$_idRegEx, '', $string);
}

View File

@ -1356,13 +1356,25 @@ class e_jsmanager
if('css' === $external)
{
$path = explode($this->_sep, $path, 4);
$media = $path[0];
// support of IE checks
$pre = varset($path[2]) ? $path[2]."\n" : '';
$post = varset($path[3]) ? "\n".$path[3] : '';
$path = $path[1];
$insertID ='';
if(strpos($path, 'http') !== 0) // local file.
{
if($label === 'Theme CSS') // add an id for local theme stylesheets.
{
$insertID = 'id="stylesheet-'. eHelper::secureIdAttr(str_replace(array('{e_THEME}','.css'),'',$path)).'"' ;
}
if($this->addCache($external,$path) === true) // if cache enabled, then skip and continue.
{
continue;
@ -1374,7 +1386,8 @@ class e_jsmanager
continue;
}
echo $pre.'<link rel="stylesheet" media="'.$media.'" property="stylesheet" type="text/css" href="'.$path.'" />'.$post;
echo $pre.'<link '.$insertID.' rel="stylesheet" media="'.$media.'" property="stylesheet" type="text/css" href="'.$path.'" />'.$post;
echo "\n";
continue;