]> git.mxchange.org Git - friendica.git/commitdiff
Register Friendica stylesheet using App->registerStylesheet()
authorBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 21 Sep 2018 13:54:09 +0000 (09:54 -0400)
committerBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 21 Sep 2018 13:54:09 +0000 (09:54 -0400)
- Remove mentions of {{$stylesheet}} in head.tpl templates

index.php
src/App.php
view/templates/head.tpl
view/theme/frio/templates/head.tpl

index 359be7dcbabc4fb8145a7fee5dc503a481a16d95..184a195924cc8acb715dc2f7654dfb8301b847b2 100644 (file)
--- 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();
 
index 479813703c780027af4b9df639711d49ae24e83c..3f67dbada9ba1edaf73315cab8045e8cbb283ebb 100644 (file)
@@ -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'];
index 46b7283ac2e72fae9df8969bf09595a447b19aa7..a53ae8f74755bfd803d69060d076ef3de674805b 100644 (file)
@@ -9,16 +9,10 @@
 <link rel="stylesheet" href="view/asset/perfect-scrollbar/css/perfect-scrollbar.min.css" type="text/css" media="screen" />
 <link rel="stylesheet" href="vendor/pear/text_highlighter/sample.css" type="text/css" media="screen" />
 
-<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />
-
 {{foreach $stylesheets as $stylesheetUrl}}
 <link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="screen" />
 {{/foreach}}
 
-<!--
-<link rel="shortcut icon" href="images/friendica-32.png" />
-<link rel="apple-touch-icon" href="images/friendica-128.png"/>
--->
 <link rel="shortcut icon" href="{{$shortcut_icon}}" />
 <link rel="apple-touch-icon" href="{{$touch_icon}}"/>
 
index 109127cceef881c04bb48c04369c5086b4738bc3..e7c3a4de88587faf09bf9fc6ff5e92338214d3b1 100644 (file)
 <link rel="stylesheet" href="view/theme/frio/frameworks/bootstrap-toggle/css/bootstrap-toggle.min.css" type="text/css" media="screen"/>
 <link rel="stylesheet" href="view/theme/frio/font/open_sans/open-sans.css" type="text/css" media="screen"/>
 
-{{* The own style.css *}}
-<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />
+{{foreach $stylesheets as $stylesheetUrl}}
+<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="screen" />
+{{/foreach}}
 
 {{* own css files *}}
 <link rel="stylesheet" href="view/theme/frio/css/hovercard.css" type="text/css" media="screen"/>
 <link rel="stylesheet" href="view/theme/frio/css/font-awesome.custom.css" type="text/css" media="screen"/>
 
-{{foreach $stylesheets as $stylesheetUrl}}
-<link rel="stylesheet" href="{{$stylesheetUrl}}" type="text/css" media="screen" />
-{{/foreach}}
-
-<!--
-<link rel="shortcut icon" href="images/friendica-32.png" />
-<link rel="apple-touch-icon" href="images/friendica-128.png"/>
--->
 <link rel="shortcut icon" href="{{$shortcut_icon}}" />
 <link rel="apple-touch-icon" href="{{$touch_icon}}"/>