From 5583e78db63afc7a06c99d977076e0ccb2704661 Mon Sep 17 00:00:00 2001 From: Kai Schwarz Date: Wed, 9 Oct 2019 11:54:36 +0200 Subject: [PATCH] fix(hooks): move ClientAreaPrimaryNavbar back into hooks.php --- hooks.php | 32 ++++++++++++++++++++++++++++++++ ispapibackorder.php | 33 --------------------------------- 2 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 hooks.php diff --git a/hooks.php b/hooks.php new file mode 100644 index 0000000..66e22eb --- /dev/null +++ b/hooks.php @@ -0,0 +1,32 @@ +addChild($key, array( + "label" => $_ADDONLANG["backorder_nav"], + "uri" => "index.php?m={$key}&p=manage", + "order" => "70" + )); + + $pc = $primaryNavbar->getChild($key); + if (!is_null($pc)) { + $pc->addChild($key . "_manage", array( + "label" => $_ADDONLANG["managebackorders"], + "uri" => "index.php?m={$key}&p=manage", + "order" => "20" + )); + $pc->addChild($key . "_droplist", array( + "label" => $_ADDONLANG["domainheader"], + "uri" => "index.php?m={$key}&p=dropdomains", + "order" => "10" + )); + } +}); \ No newline at end of file diff --git a/ispapibackorder.php b/ispapibackorder.php index aea7494..afd6f0b 100644 --- a/ispapibackorder.php +++ b/ispapibackorder.php @@ -21,7 +21,6 @@ } use WHMCS\Database\Capsule; -use WHMCS\View\Menu\Item as MenuItem; function ispapibackorder_config() { @@ -36,8 +35,6 @@ function ispapibackorder_config() return $configarray; } - - function ispapibackorder_activate() { try { @@ -96,7 +93,6 @@ function ispapibackorder_activate() } } - function ispapibackorder_deactivate() { //DO NOT DELETE TABLES WHEN DEACTIVATING DOMAINS - DEVELOPPER HAS TO DO IT MANUALLY IF WANTED @@ -161,35 +157,6 @@ function ispapibackorder_logs_content($modulelink) function ispapibackorder_clientarea($vars) { - add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { - $key = "ispapibackorder"; - $language = (isset($_SESSION["language"]) ? $_SESSION["language"] : "english"); - $file = getcwd() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "addons" . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $language . ".php"; - if (file_exists($file)) { - include($file); - } - - $primaryNavbar->addChild($key, array( - "label" => $_ADDONLANG["backorder_nav"], - "uri" => "index.php?m={$key}&p=manage", - "order" => "70" - )); - - $pc = $primaryNavbar->getChild($key); - if (!is_null($pc)) { - $pc->addChild($key . "_manage", array( - "label" => $_ADDONLANG["managebackorders"], - "uri" => "index.php?m={$key}&p=manage", - "order" => "20" - )); - $pc->addChild($key . "_droplist", array( - "label" => $_ADDONLANG["domainheader"], - "uri" => "index.php?m={$key}&p=dropdomains", - "order" => "10" - )); - } - }); - $modulename = "ispapibackorder"; $modulepath = "modules" . DIRECTORY_SEPARATOR . "addons" . DIRECTORY_SEPARATOR . $modulename;