use callHook() instead of interating over hookObjects

This commit is contained in:
Uwe Steinmann 2021-04-23 09:55:25 +02:00
parent 1a114830a5
commit fd90623de4

View File

@ -79,12 +79,8 @@ class SeedDMS_Theme_Style extends SeedDMS_View_Common {
header($name . ": " . $value);
}
}
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'startPage')) {
$hookObj->startPage($this);
}
}
if($this->hasHook('startPage'))
$this->callHook('startPage');
echo "<!DOCTYPE html>\n";
echo "<html lang=\"en\">\n<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
@ -147,11 +143,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<div class=\"splash\" data-type=\"".$flashmsg['type']."\"".(!empty($flashmsg['timeout']) ? ' data-timeout="'.$flashmsg['timeout'].'"': '').">".$flashmsg['msg']."</div>\n";
}
echo "<div class=\"statusbar-container\"><h1>".getMLText('recent_uploads')."</h1></div>\n";
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'startBody')) {
$hookObj->startBody($this);
}
}
if($this->hasHook('startBody'))
$this->callHook('startBody');
} /* }}} */
function htmlAddHeader($head, $type='js') { /* {{{ */
@ -166,13 +159,9 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function htmlEndPage($nofooter=false) { /* {{{ */
if(!$nofooter) {
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
$html = $this->footNote();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'footNote')) {
$html = $hookObj->footNote($this, $html);
}
}
if($this->hasHook('footNote'))
$html = $this->callHook('footNote', $html);
echo $html;
if($this->params['showmissingtranslations']) {
$this->missingLanguageKeys();
@ -326,12 +315,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['my_documents'] = array('link'=>"../out/out.MyDocuments.php?inProcess=1", 'label'=>'my_documents');
if ($accessobject->check_view_access('MyAccount'))
$menuitems['my_account'] = array('link'=>"../out/out.MyAccount.php", 'label'=>'my_account');
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'userMenuItems')) {
$menuitems = $hookObj->userMenuItems($this, $menuitems);
}
}
if($this->hasHook('userMenuItems'))
$menuitems = $this->callHook('userMenuItems', $menuitems);
if($menuitems) {
foreach($menuitems as $menuitem) {
echo "<li><a href=\"".$menuitem['link']."\">".getMLText($menuitem['label'])."</a></li>";
@ -427,11 +412,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['help'] = array('link'=>'../out/out.Help.php?context='.$tmp[1], 'label'=>"help");
}
/* Check if hook exists because otherwise callHook() will override $menuitems */
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'globalNavigationBar')) {
$menuitems = $hookObj->globalNavigationBar($this, $menuitems);
}
}
if($this->hasHook('globalNavigationBar'))
$menuitems = $this->callHook('globalNavigationBar', $menuitems);
foreach($menuitems as $menuitem) {
if(!empty($menuitem['children'])) {
echo " <li class=\"dropdown\">\n";