1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

toGlyph() enhancements. Support for spin and rotate.

Example 1: $tp->toGlyph('fa-spinner', array('spin'=>1));
Example 2: $tp->toGlyph('fa-shield', array('rotate'=>90, 'size'=>'2x'));
This commit is contained in:
Cameron
2016-02-11 12:01:26 -08:00
parent 579bf52090
commit 5e62f383cf
2 changed files with 12 additions and 9 deletions

View File

@@ -3233,19 +3233,18 @@ class e_parser
* Parse xxxxx.glyph file to bootstrap glyph format.
* @param string $text
* @param array of $parms
* @example $tp->toGlyph('fa-spinner', 'spin=1');
* @example $tp->toGlyph('fa-spinner', array('spin'=>1));
* @example $tp->toGlyph('fa-shield', array('rotate'=>90, 'size'=>'2x'));
*/
public function toGlyph($text, $space=" ")
{
if(!deftrue('BOOTSTRAP') || empty($text))
{
return false;
}
if(is_array($space))
{
$parm = $space;
@@ -3281,8 +3280,10 @@ class e_parser
$removePrefix = array('glyphicon-','icon-','fa-');
$id = str_replace($removePrefix, "", $cls);
$spin = null;
$rotate = null;
// return print_r($fa4,true);
if(deftrue('FONTAWESOME') && in_array($id ,$fa4)) // Contains FontAwesome 3 set also.
@@ -3290,6 +3291,8 @@ class e_parser
$prefix = 'fa fa-';
$size = (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
$tag = 'i';
$spin = !empty($parm['spin']) ? ' fa-spin' : '';
$rotate = !empty($parm['rotate']) ? ' fa-rotate-'.intval($parm['rotate']) : '';
}
elseif(deftrue("BOOTSTRAP"))
{
@@ -3308,7 +3311,7 @@ class e_parser
}
$text = "<".$tag." class='".$prefix.$id.$size."'></".$tag.">" ;
$text = "<".$tag." class='".$prefix.$id.$size.$spin.$rotate."'></".$tag.">" ;
$text .= ($space !== false) ? $space : "";
return $text;

View File

@@ -904,7 +904,7 @@ class e_media
if($type == 'fa4')
{
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before/';
$subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.css');
$subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css');
// print_a($subject);
}
elseif($type == 'fa3')