mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Corrected processing of Glyph-types.
This commit is contained in:
@@ -2713,36 +2713,41 @@ class e_parser
|
||||
return "<i class='".$size." ".$text."'></i>";
|
||||
}
|
||||
|
||||
// Bootstrap 3 Glyph names.
|
||||
// Get Glyph names.
|
||||
$bs3 = e107::getMedia()->getGlyphs('bs3','');
|
||||
|
||||
if(substr($text,0,5) != 'icon-' && substr($text,0,3) != 'fa-')
|
||||
{
|
||||
$text = 'icon-'.$text.'.glyph';
|
||||
}
|
||||
|
||||
list($cls,$tmp) = explode('.glyph',$text);
|
||||
list($type, $tmp2) = explode("-",$text,2);
|
||||
|
||||
$id = str_replace("icon-","",$cls);
|
||||
|
||||
if(deftrue('FONTAWESOME') == 4 && !in_array($id ,$bs3)) // Convert FontAwesome 3 to 4.
|
||||
{
|
||||
$cls = str_replace('icon-', 'fa fa-', $cls);
|
||||
}
|
||||
elseif(defset("BOOTSTRAP")===3)
|
||||
{
|
||||
$cls = str_replace('icon-', 'glyphicon glyphicon-', $cls);
|
||||
}
|
||||
$fa4 = e107::getMedia()->getGlyphs('fa4','');
|
||||
|
||||
if($type == 'fa')
|
||||
{
|
||||
$cls = str_replace('fa-', 'fa fa-', $cls);
|
||||
$cls .= (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
|
||||
}
|
||||
// $text = (deftrue('BOOTSTRAP') === 3) ? "<span class='".$cls."'></span>" : "<i class='".$cls."'></i>"; // retain space.
|
||||
list($cls,$tmp) = explode('.glyph',$text);
|
||||
// list($type, $tmp2) = explode("-",$text,2);
|
||||
|
||||
$text = "<span class='".$cls."'></span>" ;
|
||||
$removePrefix = array('glyphicon-','icon-','fa-');
|
||||
|
||||
$id = str_replace($removePrefix, "", $cls);
|
||||
|
||||
// return print_r($fa4,true);
|
||||
|
||||
if(deftrue('FONTAWESOME') && in_array($id ,$fa4)) // Contains FontAwesome 3 set also.
|
||||
{
|
||||
$prefix = 'fa fa-';
|
||||
$prefix .= (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
|
||||
$tag = 'span';
|
||||
}
|
||||
elseif(deftrue("BOOTSTRAP"))
|
||||
{
|
||||
if(BOOTSTRAP === 3 && in_array($id ,$bs3))
|
||||
{
|
||||
$prefix = 'glyphicon glyphicon-';
|
||||
$tag = 'span';
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix = 'icon-';
|
||||
$tag = 'i';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$text = "<".$tag." class='".$prefix.$id."'></".$tag.">" ;
|
||||
$text .= ($space !== false) ? $space : "";
|
||||
|
||||
return $text;
|
||||
|
@@ -830,7 +830,7 @@ class e_media
|
||||
}
|
||||
|
||||
$cache = e107::getCache();
|
||||
$cache->setMD5('_');
|
||||
$cache->setMD5('_'.$prefix.$type);
|
||||
|
||||
if($data = $cache->retrieve($type,360,true))
|
||||
{
|
||||
@@ -840,12 +840,13 @@ class e_media
|
||||
|
||||
if($type == 'fa4')
|
||||
{
|
||||
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
|
||||
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before/';
|
||||
$subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css');
|
||||
// print_a($subject);
|
||||
}
|
||||
elseif($type == 'fa3')
|
||||
{
|
||||
$pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
|
||||
$pattern = '/\.(icon-(?:\w+(?:-)?)+):before/';
|
||||
$subject = file_get_contents(e_WEB_JS.'font-awesome/css/font-awesome.css');
|
||||
}
|
||||
|
||||
@@ -855,7 +856,7 @@ class e_media
|
||||
|
||||
foreach($matches as $match)
|
||||
{
|
||||
$icons[] = $match[1];
|
||||
$icons[] = $prefix.substr($match[1],3);
|
||||
}
|
||||
|
||||
$data = e107::serialize($icons);
|
||||
|
Reference in New Issue
Block a user