Add plugin hook 'head'.
authorJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Mon, 25 Mar 2013 15:37:06 +0000 (16:37 +0100)
committerRobert Treat <rob@xzilla.net>
Tue, 26 Mar 2013 17:57:11 +0000 (13:57 -0400)
Allows to add tags in <head /> from plugins

classes/Misc.php
classes/PluginManager.php

index 0457b4d8205d4ae002ae210a84d49a2c383daf44..cd22df8b2dbe3db31f1c2b57055e1c95096dc268 100644 (file)
                 * @param $script script tag
                 */
                function printHeader($title = '', $script = null, $frameset = false) {
-                       global $appName, $lang, $_no_output, $conf;
+                       global $appName, $lang, $_no_output, $conf, $plugin_manager;
 
                        if (!isset($_no_output)) {
                                header("Content-Type: text/html; charset=utf-8");
                                echo "</title>\n";
 
                                if ($script) echo "{$script}\n";
+
+                               $plugins_head = array();
+                               $_params = array('heads' => &$plugins_head);
+
+                               $plugin_manager->do_hook('head', $_params);
+
+                               foreach($plugins_head as $tag) {
+                                       echo $tag;
+                               }
+
                                echo "</head>\n";
                        }
                }
index 3bc1eb3996541b0717195980db6f24f4f1531541..9634b41281ffa1cef069b1fd4ed882d93cfca8da 100644 (file)
@@ -11,6 +11,7 @@ class PluginManager {
         */
        private $plugins_list = array();
        private $available_hooks = array(
+               'head',
                'toplinks',
                'tabs',
                'trail',