From: Benjamin Lorteau Date: Fri, 21 Sep 2018 13:54:09 +0000 (-0400) Subject: Register Friendica stylesheet using App->registerStylesheet() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f0cdd25e34aca7ee1fbde0dd729a548a2af0e70c;p=friendica.git Register Friendica stylesheet using App->registerStylesheet() - Remove mentions of {{$stylesheet}} in head.tpl templates --- diff --git a/index.php b/index.php index 359be7dcba..184a195924 100644 --- a/index.php +++ b/index.php @@ -426,16 +426,6 @@ if ($a->module != 'install' && $a->module != 'maintenance') { /** * Build the page - now that we have all the components */ - -if (!$a->theme['stylesheet']) { - $stylesheet = $a->getCurrentThemeStylesheetPath(); -} else { - $stylesheet = $a->theme['stylesheet']; -} - -$a->page['htmlhead'] = str_replace('{{$stylesheet}}', $stylesheet, $a->page['htmlhead']); -//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet)); - if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) { $doc = new DOMDocument(); diff --git a/src/App.php b/src/App.php index 479813703c..3f67dbada9 100644 --- a/src/App.php +++ b/src/App.php @@ -770,21 +770,14 @@ class App $this->page['title'] = $this->config['sitename']; } - /* put the head template at the beginning of page['htmlhead'] - * since the code added by the modules frequently depends on it - * being first - */ - - // If we're using Smarty, then doing replace_macros() will replace - // any unrecognized variables with a blank string. Since we delay - // replacing $stylesheet until later, we need to replace it now - // with another variable name - if ($this->theme['template_engine'] === 'smarty3') { - $stylesheet = $this->get_template_ldelim('smarty3') . '$stylesheet' . $this->get_template_rdelim('smarty3'); + if (!empty($this->theme['stylesheet'])) { + $stylesheet = $this->theme['stylesheet']; } else { - $stylesheet = '$stylesheet'; + $stylesheet = $this->getCurrentThemeStylesheetPath(); } + $this->registerStylesheet($stylesheet); + $shortcut_icon = Config::get('system', 'shortcut_icon'); if ($shortcut_icon == '') { $shortcut_icon = 'images/friendica-32.png'; @@ -801,6 +794,10 @@ class App Core\Addon::callHooks('head', $this->page['htmlhead']); $tpl = get_markup_template('head.tpl'); + /* put the head template at the beginning of page['htmlhead'] + * since the code added by the modules frequently depends on it + * being first + */ $this->page['htmlhead'] = replace_macros($tpl, [ '$baseurl' => $this->get_baseurl(), '$local_user' => local_user(), @@ -811,7 +808,6 @@ class App '$update_interval' => $interval, '$shortcut_icon' => $shortcut_icon, '$touch_icon' => $touch_icon, - '$stylesheet' => $stylesheet, '$infinite_scroll' => $infinite_scroll, '$block_public' => intval(Config::get('system', 'block_public')), '$stylesheets' => $this->stylesheets, @@ -820,10 +816,6 @@ class App public function initFooter() { - if (!isset($this->page['footer'])) { - $this->page['footer'] = ''; - } - // If you're just visiting, let javascript take you home if (!empty($_SESSION['visitor_home'])) { $homebase = $_SESSION['visitor_home']; diff --git a/view/templates/head.tpl b/view/templates/head.tpl index 46b7283ac2..a53ae8f747 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -9,16 +9,10 @@ - - {{foreach $stylesheets as $stylesheetUrl}} {{/foreach}} - diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index 109127ccee..e7c3a4de88 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -26,21 +26,14 @@ -{{* The own style.css *}} - +{{foreach $stylesheets as $stylesheetUrl}} + +{{/foreach}} {{* own css files *}} -{{foreach $stylesheets as $stylesheetUrl}} - -{{/foreach}} - -