diff --git a/e107_core/shortcodes/batch/search_shortcodes.php b/e107_core/shortcodes/batch/search_shortcodes.php index 56cb3372c..60e8fd8e0 100644 --- a/e107_core/shortcodes/batch/search_shortcodes.php +++ b/e107_core/shortcodes/batch/search_shortcodes.php @@ -36,7 +36,9 @@ class search_shortcodes extends e_shortcode if(isset($parm['label'])) { - $label = (strpos($parm['label'], '.glyph')!==false) ? e107::getParser()->toGlyph($parm['label'],'') : LAN_SEARCH; + $opts = $parm; + unset($opts['label'],$opts['class']); + $label = (strpos($parm['label'], '.glyph')!==false) ? e107::getParser()->toGlyph($parm['label'], $opts) : LAN_SEARCH; unset($parm['label']); } diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index a1dcbf91c..e10b2c0fa 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3706,6 +3706,34 @@ class e_parse return $ret; } + /** + * Glyph Embed Method Direct from svg file. + * @param string $cat far|fab|fas + * @param string $id eg. fa-search + * @param array $parm eg. ['fw'=>true] + * @return array|false|string|string[]|void + */ + private function toGlyphEmbed($cat, $id, $parm=array()) + { + $dirs = ['far'=>'regular', 'fab'=>'brands', 'fas'=>'solid']; + $path = e_WEB.'lib/font-awesome/5/svgs/'; + $path .= $dirs[$cat].'/'; + $path .= str_replace('fa-','',$id).".svg"; + + if($ret = file_get_contents($path)) + { + $class = 'svg-inline--fa '; + $class .= $id; + $class .= ' fa-w-16'; + $class .= !empty($parm['fw']) ? ' fa-fw' : ''; + + return str_replace(''regular', 'fab'=>'brands', 'fas'=>'solid']; - - $path = e_WEB.'lib/font-awesome/5/svgs/'; - $path .= $dirs[$cat].'/'; - $path .= str_replace('fa-','',$id).".svg"; - - if($ret = file_get_contents($path)) + if($ret = $this->toGlyphEmbed($cat, $id, $parm)) { - $class = 'svg-inline--fa '; - $class .= $id; - $class .= ' fa-w-16'; - $class .= !empty($parm['fw']) ? ' fa-fw' : ''; - - return str_replace('bootstrap === 3) ? 'glyphicon glyphicon-' : 'fa fa-'; } + /** @experimental - subject to removal at any time. */ + if(!empty($parm['embed'])) + { + $cat = trim($prefix); + + if($ret = $this->toGlyphEmbed($cat, $id, $parm)) + { + return $ret; + } + } + + $cat = trim($prefix); + } elseif($this->fontawesome === 4) {