]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Output code to explicitly reference favicons.
authorMeitar Moscovitz <meitarm@gmail.com>
Mon, 16 Mar 2009 21:42:24 +0000 (17:42 -0400)
committerMeitar Moscovitz <meitarm@gmail.com>
Mon, 16 Mar 2009 21:42:24 +0000 (17:42 -0400)
This makes favicons work when Laconica is not installed at a web
server's DOCUMENT_ROOT. I've also added the capability to override the
Laconica default favicon.ico file with a theme-specific one simply by
dropping a themed favicon.ico in the appropriate theme directory.

lib/action.php

index 975c2bfcb8a23adb01c4ec7dbeb479119547479c..285eae59ab9ab4b0f58584ac2f6c1029c4fa0309 100644 (file)
@@ -112,6 +112,7 @@ class Action extends HTMLOutputter // lawsuit
         // XXX: attributes (profile?)
         $this->elementStart('head');
         $this->showTitle();
+        $this->showShortcutIcon();
         $this->showStylesheets();
         $this->showScripts();
         $this->showOpenSearch();
@@ -147,6 +148,22 @@ class Action extends HTMLOutputter // lawsuit
         return _("Untitled page");
     }
 
+    /**
+     * Show themed shortcut icon
+     *
+     * @return nothing
+     */
+    function showShortcutIcon()
+    {
+        if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/favicon.ico')) {
+            $this->element('link', array('rel' => 'shortcut icon',
+                                         'href' => theme_path('favicon.ico')));
+        } else {
+            $this->element('link', array('rel' => 'shortcut icon',
+                                         'href' => common_path('favicon.ico')));
+        }
+    }
+
     /**
      * Show stylesheets
      *