diff --git a/e107_handlers/library_manager.php b/e107_handlers/library_manager.php index f91bedbab..79a4dd01c 100644 --- a/e107_handlers/library_manager.php +++ b/e107_handlers/library_manager.php @@ -709,7 +709,7 @@ class e_library_manager // Check whether the library exists. 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']); @@ -1034,7 +1034,7 @@ class e_library_manager * @return string * The path to the specified library or FALSE if the library wasn't found. */ - private function getPath($name) + private function detectPath($name) { static $libraries; @@ -1096,6 +1096,24 @@ class e_library_manager 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. * diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index e049ee4f0..098864542 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -955,8 +955,8 @@ class e_media $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)) @@ -965,10 +965,11 @@ class e_media } - if($type === 'fa4') // todo use e107::library + if($type === 'fa4') { $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-'; } elseif($type === 'fa3') @@ -1009,9 +1010,9 @@ class e_media 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;