Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
fix(hooks): review hooks usage
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed Oct 8, 2019
1 parent b5c8e4a commit 464d876
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 62 deletions.
57 changes: 0 additions & 57 deletions hooks.php

This file was deleted.

40 changes: 35 additions & 5 deletions ispapibackorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
}

use WHMCS\Database\Capsule;
use WHMCS\View\Menu\Item as MenuItem;

function ispapibackorder_config()
{
global $module_version;
$configarray = array(
"name" => "ISPAPI Backorder",
"description" => "This addon allows you to provide backorders to your customers.",
"version" => $module_version,
"author" => "HEXONET",
"language" => "english"
"name" => "ISPAPI Backorder",
"description" => "This addon allows you to provide backorders to your customers.",
"version" => $module_version,
"author" => "HEXONET",
"language" => "english"
);
return $configarray;
}
Expand Down Expand Up @@ -160,6 +161,35 @@ 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/addons/".$modulename;

Expand Down

0 comments on commit 464d876

Please sign in to comment.