1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-24 15:13:04 +02:00
This commit is contained in:
Cameron
2021-04-06 18:41:15 -07:00
parent 920a881898
commit 2862e18db9
6 changed files with 806 additions and 624 deletions

View File

@@ -1103,6 +1103,15 @@ class e_theme
unset($vars['libraries']);
}
else // detect defined constants in legacy theme.php file.
{
if($data = self::getLegacyBSFA($path))
{
$vars['library'] = $data;
}
}
if(!empty($vars['stylesheets']['css']))
{
@@ -1158,6 +1167,37 @@ class e_theme
return $vars;
}
/**
* Read legacy bootstrap/fontawesome constants from theme.php
* @param string $path theme directory
*/
public static function getLegacyBSFA($path)
{
if(!$content = file_get_contents(e_THEME.$path.'/theme.php'))
{
return false;
}
$ret = [];
if(preg_match('/define[ ]*?\([\'|"]BOOTSTRAP[\'|"],[ \t]*(\d)\);/', $content, $m))
{
$ret[] = array('name' => 'bootstrap',
'version' => $m[1],
'scope' => 'front,wysiwyg',
);
}
if(preg_match('/define[ ]*?\([\'|"]FONTAWESOME[\'|"],[ \t]*(\d)\);/', $content, $m))
{
$ret[] = array('name' => 'fontawesome',
'version' => $m[1],
'scope' => 'front,wysiwyg',
);
}
return $ret;
}
/**
* Validate and return the name of the categories.