1<?php
2
3use WHMCS\Billing\Currency;
4
5require("../init.php");
6require("../includes/domainfunctions.php");
7
8/*
9*** USAGE SAMPLES ***
10
11<style type="text/css">
12table.domainpricing {
13 width: 600px;
14 background-color: #ccc;
15}
16table.domainpricing th {
17 padding: 3px;
18 background-color: #efefef;
19 font-weight: bold;
20}
21table.domainpricing td {
22 padding: 3px;
23 background-color: #fff;
24 text-align: center;
25}
26</style>
27<script language="javascript" src="feeds/domainpricing.php?currency=1"></script>
28
29*/
30
31$code = '<table cellspacing="1" cellpadding="0" class="domainpricing"><tr><th>' . \Lang::trans('domaintld') . '</th><th>' . \Lang::trans('domainminyears') . '</th><th>' . \Lang::trans('domainsregister') . '</th><th>' . \Lang::trans('domainstransfer') . '</th><th>' . \Lang::trans('domainsrenew') . '</th></tr>';
32
33if (!isset($currency) || !is_numeric($currency)) {
34 $currency = array();
35} else {
36 $currency = getCurrency(null, $currency);
37}
38
39if (!$currency || !is_array($currency) || !isset($currency['id'])) {
40 $currency = Currency::factoryForClientArea();
41}
42
43$freeamt = formatCurrency(0);
44$tldslist = getTLDList();
45foreach ($tldslist AS $tld) {
46 $tldpricing = getTLDPriceList($tld, true);
47 $firstoption = current($tldpricing);
48 $year = key($tldpricing);
49 $transfer = ($firstoption["transfer"] == $freeamt) ? $_LANG['orderfree'] : $firstoption["transfer"];
50 $code .= sprintf(
51 '<tr><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td></tr>',
52 htmlspecialchars($tld, ENT_QUOTES, 'UTF-8'),
53 $year,
54 htmlspecialchars($firstoption["register"], ENT_QUOTES, 'UTF-8'),
55 htmlspecialchars($transfer, ENT_QUOTES, 'UTF-8'),
56 htmlspecialchars($firstoption["renew"], ENT_QUOTES, 'UTF-8')
57 );
58}
59
60$code .= '</table>';
61
62echo "document.write('".$code."');";
63
64