我们的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’;
|