diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index cd33f1d8d02..439e31caae1 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -186,7 +186,8 @@ class HookManager 'sendMail', 'sendMailAfter', 'showLinkToObjectBlock', - 'setContentSecurityPolicy' + 'setContentSecurityPolicy', + 'setHtmlTitle' ) )) $hooktype='addreplace'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 770d35d1ab3..826f83356c4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1154,7 +1154,7 @@ function top_httphead($contenttype='text/html', $forcenocache=0) */ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0) { - global $user, $conf, $langs, $db; + global $db, $conf, $langs, $user, $hookmanager; top_httphead(); @@ -1188,9 +1188,22 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $appli=constant('DOL_APPLICATION_TITLE'); if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; - if ($title && ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/',$conf->global->MAIN_HTML_TITLE)) print ''.dol_htmlentities($title).''; - else if ($title) print ''.dol_htmlentities($appli.' - '.$title).''; - else print "".dol_htmlentities($appli).""; + print ''; + $titletoshow=''; + if ($title && ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/',$conf->global->MAIN_HTML_TITLE)) $titletoshow = dol_htmlentities($title); + else if ($title) $titletoshow = dol_htmlentities($appli.' - '.$title); + else $titletoshow = dol_htmlentities($appli); + + if (! is_object($hookmanager)) $hookmanager = new HookManager($db); + $hookmanager->initHooks("main"); + $parameters=array('title'=>$titletoshow); + $result=$hookmanager->executeHooks('setHtmlTitle',$parameters); // Note that $action and $object may have been modified by some hooks + if ($result > 0) $titletoshow = $hookmanager->resPrint; // Replace Title to show + else $titletoshow .= $hookmanager->resPrint; // Concat to Title to show + + print $titletoshow; + print ''; + print "\n"; if (GETPOST('version','int')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js @@ -1471,7 +1484,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a { print "\n".''."\n"; - print '
'; + print '
'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. // Show menu entries print '
'."\n";