1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 22:27:34 +02:00

Experimental embedding of FA svg.

This commit is contained in:
Cameron
2021-11-15 13:51:01 -08:00
parent 20631296c5
commit db6035f844
3 changed files with 40 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
<?php
function glyph_shortcode($parm = '')
function glyph_shortcode($parm = null)
{
if(!is_array($parm))
{

View File

@@ -3783,6 +3783,27 @@ class e_parse
case "fas":
$prefix = $cat.' ';
$id = str_replace($cat.'-', 'fa-', $id);
/** @experimental - subject to removal at any time. */
if(!empty($parm['embed']))
{
$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('<svg', '<svg class="'.$class.'" role="img" ', $ret);
}
}
break;
case "fa":

View File

@@ -160,6 +160,24 @@ class social_shortcodes extends e_shortcode
return $this->var['class'];
}
/** @experimental inline svg - subject to removal at any time */
public function sc_xurl_icons_svg($parm=null)
{
$path = e_WEB.'lib/font-awesome/5/svgs/brands/';
$path .= $this->var['id'].".svg";
if(!file_exists($path))
{
return null;
}
if($ret = file_get_contents($path))
{
return $ret;
}
}
// ------------------------------------------------
function sc_social_login($parm=null)