mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
library getPath() method added. Media class now caches local fontawesome file.
This commit is contained in:
@@ -709,7 +709,7 @@ class e_library_manager
|
|||||||
// Check whether the library exists.
|
// Check whether the library exists.
|
||||||
if(!isset($library['library_path']))
|
if(!isset($library['library_path']))
|
||||||
{
|
{
|
||||||
$library['library_path'] = $this->getPath($library['machine_name']);
|
$library['library_path'] = $this->detectPath($library['machine_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$libraryPath = e107::getParser()->replaceConstants($library['library_path']);
|
$libraryPath = e107::getParser()->replaceConstants($library['library_path']);
|
||||||
@@ -1034,7 +1034,7 @@ class e_library_manager
|
|||||||
* @return string
|
* @return string
|
||||||
* The path to the specified library or FALSE if the library wasn't found.
|
* The path to the specified library or FALSE if the library wasn't found.
|
||||||
*/
|
*/
|
||||||
private function getPath($name)
|
private function detectPath($name)
|
||||||
{
|
{
|
||||||
static $libraries;
|
static $libraries;
|
||||||
|
|
||||||
@@ -1096,6 +1096,24 @@ class e_library_manager
|
|||||||
return varset($lib[$property], false);
|
return varset($lib[$property], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return full path to a library in different formats.
|
||||||
|
* @param string $library
|
||||||
|
* The library name eg. bootstrap
|
||||||
|
*
|
||||||
|
* @param null $mode
|
||||||
|
* The mode: null | 'full' | 'abs'
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPath($library, $mode=null)
|
||||||
|
{
|
||||||
|
$path = self::getProperty($library, 'library_path').'/'. self::getProperty($library, 'path');
|
||||||
|
return e107::getParser()->replaceConstants($path,$mode).'/';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about registered libraries.
|
* Returns information about registered libraries.
|
||||||
*
|
*
|
||||||
|
@@ -955,8 +955,8 @@ class e_media
|
|||||||
|
|
||||||
|
|
||||||
$cache = e107::getCache();
|
$cache = e107::getCache();
|
||||||
$cachTag = !empty($addPrefix) ? "Glyphs_".$addPrefix."_".$type : "Glyphs_".$type;
|
|
||||||
|
|
||||||
|
$cachTag = !empty($addPrefix) ? "Glyphs_".$addPrefix."_".$type : "Glyphs_".$type;
|
||||||
|
|
||||||
|
|
||||||
if($data = $cache->retrieve($cachTag ,360,true,true))
|
if($data = $cache->retrieve($cachTag ,360,true,true))
|
||||||
@@ -965,10 +965,11 @@ class e_media
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($type === 'fa4') // todo use e107::library
|
if($type === 'fa4')
|
||||||
{
|
{
|
||||||
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before/';
|
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before/';
|
||||||
$subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css');
|
$path = e107::getLibrary()->getPath('fontawesome');
|
||||||
|
$subject = file_get_contents($path.'css/font-awesome.css');
|
||||||
$prefix = 'fa-';
|
$prefix = 'fa-';
|
||||||
}
|
}
|
||||||
elseif($type === 'fa3')
|
elseif($type === 'fa3')
|
||||||
@@ -1009,9 +1010,9 @@ class e_media
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = e107::serialize($icons);
|
$data = e107::serialize($icons,'json');
|
||||||
|
|
||||||
$cache->set_sys($cachTag ,$data,true);
|
$cache->set_sys($cachTag ,$data,true,true);
|
||||||
|
|
||||||
return $icons;
|
return $icons;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user