46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
|
/**
|
||
|
* Set whmcs links if needed
|
||
|
*
|
||
|
* @param object $item The extension data
|
||
|
*
|
||
|
* @return void
|
||
|
* @since 3.2.0
|
||
|
*/
|
||
|
public function set(object &$item)
|
||
|
{
|
||
|
if (1 == $item->add_license
|
||
|
&& (!isset($item->whmcs_buy_link)
|
||
|
|| !StringHelper::check(
|
||
|
$item->whmcs_buy_link
|
||
|
)))
|
||
|
{
|
||
|
// update with the whmcs url
|
||
|
if (isset($item->whmcs_url)
|
||
|
&& StringHelper::check($item->whmcs_url))
|
||
|
{
|
||
|
$item->whmcs_buy_link = $item->whmcs_url;
|
||
|
}
|
||
|
// use the company website
|
||
|
elseif (isset($item->website)
|
||
|
&& StringHelper::check($item->website))
|
||
|
{
|
||
|
$item->whmcs_buy_link = $item->website;
|
||
|
$item->whmcs_url = rtrim((string) $item->website, '/')
|
||
|
. '/whmcs';
|
||
|
}
|
||
|
// none set
|
||
|
else
|
||
|
{
|
||
|
$item->whmcs_buy_link = '#';
|
||
|
$item->whmcs_url = '#';
|
||
|
}
|
||
|
}
|
||
|
// since the license details are not set clear
|
||
|
elseif (0 == $item->add_license)
|
||
|
{
|
||
|
$item->whmcs_key = '';
|
||
|
$item->whmcs_buy_link = '';
|
||
|
$item->whmcs_url = '';
|
||
|
}
|
||
|
}
|