diff --git a/e107_admin/header.php b/e107_admin/header.php index 00df0b9e02..2716938cff 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -384,17 +384,8 @@ function loadJSAddons() e107::getJs()->renderJs('header_inline', 4); // ---------- Favicon --------- +echo e107::getJs()->renderFavicon(); -$sitetheme = e107::getPref('sitetheme'); -if(file_exists(e_THEME . $sitetheme . "/favicon.ico")) -{ - echo "\n\n"; -} -elseif(file_exists(e_BASE . "favicon.ico")) -{ - echo "\n\n"; -} -unset($sitetheme); // // G: Send Theme Headers // diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index a8d742c4e0..ef8efaea75 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -253,9 +253,8 @@ function renderTitle() unset($ret); } -// -------- Generate Apple Touch Icon --------- -echo renderFavicon(); +echo $e_js->renderFavicon(); // Register Plugin specific CSS @@ -500,30 +499,7 @@ function renderMeta($type) return $ret; } -function renderFavicon() -{ - // ---------- Favicon --------- - if (file_exists(THEME."favicon.ico")) - { - return "\n\n"; - } - elseif(file_exists(e_MEDIA_ICON.'16x16_favicon.png')) - { - $iconSizes = [16 => 'icon',32 => 'icon',48 => 'icon',192 => 'icon',167 => 'apple-touch-icon',180 => 'apple-touch-icon']; - $text = ''; - foreach($iconSizes as $size => $rel) - { - $sizes = $size.'x'.$size; - $text .= "\n"; - } - return $text; - } - elseif (file_exists(e_BASE."favicon.ico")) - { - return "\n\n"; - } -} // legay meta-tag checks. /* $isKeywords = e107::getUrl()->response()->getMetaKeywords(); diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index 591b7a22dc..4715cdca88 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -1075,7 +1075,7 @@ protected function addJs($type, $file_path, $runtime_location = '', $opts = arra $plugfile_path = $runtime_location.$this->_sep.'{e_PLUGIN}'.$pfile_path[0].'/'.trim($pfile_path[1], '/').$this->_sep.$pre.$this->_sep.$post; // allow for URLs to be attributed to plugins. (loads after theme css in admin area header) - $file_path = ((strpos($pfile_path[1], 'http') !== 0 && strpos($pfile_path[1], '//') !== 0)) ? $plugfile_path : 'all'.$this->_sep.$pfile_path[1].$this->_sep.$pre.$this->_sep.$post;; + $file_path = ((strpos($pfile_path[1], 'http') !== 0 && strpos($pfile_path[1], '//') !== 0)) ? $plugfile_path : 'all'.$this->_sep.$pfile_path[1].$this->_sep.$pre.$this->_sep.$post; if(!isset($this->_e_css['plugin'])) $this->_e_css['plugin'] = array(); $registry = &$this->_e_css['plugin']; $runtime = true; @@ -1383,9 +1383,7 @@ public function renderJs($mod, $zone = null, $external = true, $return = false) if($return) { - $ret = ob_get_clean(); - - return $ret; + return ob_get_clean(); } } @@ -1475,9 +1473,9 @@ public function renderFile($file_path_array, $external = false, $label = '', $mo if(strpos($path, 'http') === 0 || strpos($path, '//') === 0) continue; // not allowed $path = explode($this->_sep, $path, 3); - $pre = varset($path[1], ''); + $pre = varset($path[1]); if($pre) $pre .= "\n"; - $post = varset($path[2], ''); + $post = varset($path[2]); if($post) $post = "\n".$post; $path = $path[0]; @@ -2248,4 +2246,43 @@ public function setData($data) return $this; } + + /** + * Render favicon HTML code - used in header.php and header_default.php + * @return string + */ + public function renderFavicon() + { + $sitetheme = $this->getCurrentTheme(); + + $ret = ''; + + if(file_exists(e_THEME . $sitetheme . "/favicon.ico")) + { + $ret = "\n\n"; + } + elseif(file_exists(e_MEDIA_ICON.'16x16_favicon.png')) + { + $iconSizes = [16 => 'icon',32 => 'icon',48 => 'icon',192 => 'icon',167 => 'apple-touch-icon',180 => 'apple-touch-icon']; + + foreach($iconSizes as $size => $rel) + { + $sizes = $size.'x'.$size; + $ret .= "\n"; + } + + } + elseif (file_exists(e_BASE."favicon.ico")) + { + $ret = "\n\n"; + } + + + return $ret; + + } + + + + }