我們的WHMCS地理定位鉤的認可在WHMCS用戶的全球社區中不斷增長。考慮到這種令人振奮的趨勢,我們非常想在2013年3月的原始博客文章中為新的生活注入新的活力,并展示當前潛力在這個簡單但無疑是強大的工具中。
我們在下面介紹的是您可以通過我們的鉤子進行的最重要的操作目錄。為了幫助您更輕松地找到特定功能,本文補充了確切的代碼行和如何調整它們的明確指南。
-
- 配置貨幣,語言和模板更改規則
根據客戶位置調整客戶區頁面已簡化為最大可能級別。使用注釋區域提示中提供的代碼編輯代碼,以實現貨幣,語言和模板的任何配置。
|
1
2
3
4
5
6
7
8
9
10
|
/**
* Define relations between countries and currencies.
* Enter the currency code for each country (codes used), use the below pattern, edit it or add new entries below:
*/
$countryToCurrency = array(
‘default’ => ‘USD’,
‘US’ => ‘USD’,
‘GB’ => ‘GBP’,
// NOTE: You can add more below
);
|
|
1
2
3
4
5
6
7
8
9
10
11
|
/**
* Define language rules by assigning a language to a single country.
* Use the below pattern (language name for country code) edit it and/or add new entries below:
*/
$countryToLanguage = array(
‘default’ => ‘english’,
‘US’ => ‘english’,
‘DE’ => ‘german’,
‘NO’ => ‘norwegian’,
// NOTE: You can add more below
);
|
|
1
2
3
4
5
6
7
8
9
10
|
/**
* Configure additional settings:
* Firstly assign a WHMCS template to each country used.
* Use the below pattern (template name for country code) edit it and/or add new entries below:
*/
$countryToTemplate = array(
‘US’ => ‘six’,
‘default’ => ‘six’,
// NOTE: You can add more below
);
|
|
1
2
3
4
5
6
7
8
9
10
11
12
|
/**
* Now, define the language for each WHMCS template used.
* Please note that a template available in WHMCS V7 is: ‘six’.
* It is important to use a template that exists within your WHMCS system.
* Not Logged In Users
*/
$templateToLanguage = array(
‘english’ => ‘six’,
‘german’ => ‘six’,
‘default’ => ‘six’,
// NOTE: You can add more below
);
|
-
- 根據移動設備或使用的域選擇模板
您可以根據使用的設備類型,平板電腦或手機指向要調用的模板。以同樣的方式,指向訪問者重定向的域名,為他們啟用特定模板。取消注釋行并提供所需的模板名稱。
|
1
2
3
4
5
6
7
8
9
|
/**
* You may define a mobile template per a mobile device: mobile and tablet types.
* Use the below pattern (template name for mobile device) and edit the entries.
* Comment out to disable the option.
*/
$mobileToTemplate = [
// ‘mobile’ => ‘mobile_template’,
// ‘tablet’ => ‘tablet_template’,
];
|
|
1
2
3
4
5
6
7
8
|
/**
* You may define templates per domain name. Enter a domain name and assign a template to each one of them.
* Uncomment the below examples to turn on.
*/
$domainToTemplate = [
//’www.example.mobi’ => ‘mobile_template’,
//’www.example.com’ => ‘six’,
];
|
-
- 選擇客戶區域的可調頁面
當涉及到個性化整個或僅僅是客戶區域的特定部分時,鉤子提供了巨大的靈活性。您可以自由選擇應執行更改的確切頁面。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/**
* Enter pages in your WHMCS which the hook will be active for.
* Add more pages at the bottom of the list, comment out single pages to disable the hook for them:
*/
$allowedScripts = array(
‘p1.php’,
‘index.php’,
‘clientarea.php’,
‘cart.php’,
‘knowledgebase.php’,
‘announcements.php’,
‘serverstatus.php’,
‘affiliates.php’,
‘contact.php’,
// NOTE: You can add more below
);
|
-
- 輕松禁用掛鉤
可能存在您不希望鉤子改變客戶區域的情況。您可以通過各種方式關閉特定IP地址,IP池或某些用戶代理 – 所有這一切都取決于您!
|
1
2
3
4
5
6
7
8
9
|
/**
* Point single IP addresses. The hook will be turned off for these addresses.
* Uncomment the below list and edit the exemplary addresses, add more at the bottom of the list:
*/
$disabledForIPs = array(
// ‘91.192.166.22’,
// ‘192.168.0.39’,
// NOTE: You can uncomment or add more below
);
|
|
1
2
3
4
5
6
7
8
9
|
/**
* Point full IP pools. The hook will be turned off for the addresses in these pools.
* Uncomment the below list and edit the exemplary addresses, add more at the bottom of the list:
*/
$disabledForCidrIPs = array(
// ‘192.168.56.0/24’,
// ‘192.168.0.39/24’,
// NOTE: You can uncomment or add more below
);
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/**
* Point user agents. The hook will be turned off for the enumerated here devices/browsers.
* Enter a short or a full user agent name like in the examples below.
* Uncomment the below list and edit the exemplary entries, add more at the bottom of the list:
*/
$disabledForBrowsers = array(
// ‘Chrome’,
// ‘Firefox’,
// ‘Google-Site-Verification’,
// ‘Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html )’,
// ‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 7.1; Trident/5.0)’,
// NOTE: You can uncomment or add more below
);
|
-
- 使用MaxMind GeoIP2獲取國家/地區
要跟蹤客戶的位置,請使用包子模塊中包含的內容,或者添加自己的子模塊。
|
1
2
3
4
5
6
|
/**
* Get the country using an external service, e.g. MaxMind GeoLite
* http://dev.maxmind.com/geoip/geolite
* NOTE: You can also create your own submodule, edit the below line in such case as only one submodule can work at a time.
*/
$submodule = ‘GeoIP2’;
|


















