mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +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:
@@ -3233,19 +3233,18 @@ class e_parser
|
|||||||
* Parse xxxxx.glyph file to bootstrap glyph format.
|
* Parse xxxxx.glyph file to bootstrap glyph format.
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param array of $parms
|
* @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=" ")
|
public function toGlyph($text, $space=" ")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!deftrue('BOOTSTRAP') || empty($text))
|
if(!deftrue('BOOTSTRAP') || empty($text))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(is_array($space))
|
if(is_array($space))
|
||||||
{
|
{
|
||||||
$parm = $space;
|
$parm = $space;
|
||||||
@@ -3281,8 +3280,10 @@ class e_parser
|
|||||||
$removePrefix = array('glyphicon-','icon-','fa-');
|
$removePrefix = array('glyphicon-','icon-','fa-');
|
||||||
|
|
||||||
$id = str_replace($removePrefix, "", $cls);
|
$id = str_replace($removePrefix, "", $cls);
|
||||||
|
|
||||||
|
$spin = null;
|
||||||
|
$rotate = null;
|
||||||
|
|
||||||
// return print_r($fa4,true);
|
// return print_r($fa4,true);
|
||||||
|
|
||||||
if(deftrue('FONTAWESOME') && in_array($id ,$fa4)) // Contains FontAwesome 3 set also.
|
if(deftrue('FONTAWESOME') && in_array($id ,$fa4)) // Contains FontAwesome 3 set also.
|
||||||
@@ -3290,6 +3291,8 @@ class e_parser
|
|||||||
$prefix = 'fa fa-';
|
$prefix = 'fa fa-';
|
||||||
$size = (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
|
$size = (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : '';
|
||||||
$tag = 'i';
|
$tag = 'i';
|
||||||
|
$spin = !empty($parm['spin']) ? ' fa-spin' : '';
|
||||||
|
$rotate = !empty($parm['rotate']) ? ' fa-rotate-'.intval($parm['rotate']) : '';
|
||||||
}
|
}
|
||||||
elseif(deftrue("BOOTSTRAP"))
|
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 : "";
|
$text .= ($space !== false) ? $space : "";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
@@ -904,7 +904,7 @@ class e_media
|
|||||||
if($type == 'fa4')
|
if($type == 'fa4')
|
||||||
{
|
{
|
||||||
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before/';
|
$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);
|
// print_a($subject);
|
||||||
}
|
}
|
||||||
elseif($type == 'fa3')
|
elseif($type == 'fa3')
|
||||||
|
Reference in New Issue
Block a user