1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02: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) public static function secureIdAttr($string)
{ {
$string = str_replace(array('/','_'),'-',$string);
return preg_replace(self::$_idRegEx, '', $string); return preg_replace(self::$_idRegEx, '', $string);
} }

View File

@@ -1356,13 +1356,25 @@ class e_jsmanager
if('css' === $external) if('css' === $external)
{ {
$path = explode($this->_sep, $path, 4); $path = explode($this->_sep, $path, 4);
$media = $path[0]; $media = $path[0];
// support of IE checks // support of IE checks
$pre = varset($path[2]) ? $path[2]."\n" : ''; $pre = varset($path[2]) ? $path[2]."\n" : '';
$post = varset($path[3]) ? "\n".$path[3] : ''; $post = varset($path[3]) ? "\n".$path[3] : '';
$path = $path[1]; $path = $path[1];
$insertID ='';
if(strpos($path, 'http') !== 0) // local file. 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. if($this->addCache($external,$path) === true) // if cache enabled, then skip and continue.
{ {
continue; continue;
@@ -1374,7 +1386,8 @@ class e_jsmanager
continue; 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"; echo "\n";
continue; continue;