diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 82de5a3fa..5187ec0f2 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2713,36 +2713,41 @@ class e_parser return ""; } - // 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) ? "" : ""; // retain space. + list($cls,$tmp) = explode('.glyph',$text); + // list($type, $tmp2) = explode("-",$text,2); - $text = "" ; + $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."'>" ; $text .= ($space !== false) ? $space : ""; return $text; diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 85f00f2a0..239ed8acd 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -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);