*******************************************************************************
* *
* IDNA Convert (idna_convert.class.php) *
* *
* http://idnaconv.phlymail.de mailto:phlymail@phlylabs.de *
*******************************************************************************
* (c) 2004-2007 phlyLabs, Berlin *
* This file is encoded in UTF-8 *
*******************************************************************************
Introduction
------------
The class idna_convert allows to convert internationalized domain names
(see RFC 3490, 3491, 3492 and 3454 for detials) as they can be used with various
registries worldwide to be translated between their original (localized) form
and their encoded form as it will be used in the DNS (Domain Name System).
The class provides two public methods, encode() and decode(), which do exactly
what you would expect them to do. You are allowed to use complete domain names,
simple strings and complete email addresses as well. That means, that you might
use any of the following notations:
- www.nörgler.com
- xn--nrgler-wxa
- xn--brse-5qa.xn--knrz-1ra.info
Errors, incorrectly encoded or invalid strings will lead to either a FALSE
response (when in strict mode) or to only partially converted strings.
You can query the occured error by calling the method get_last_error().
Unicode strings are expected to be either UTF-8 strings, UCS-4 strings or UCS-4
arrays. The default format is UTF-8. For setting different encodings, you can
call the method setParams() - please see the inline documentation for details.
ACE strings (the Punycode form) are always 7bit ASCII strings.
ATTENTION: We no longer supply the PHP5 version of the class. It is not
necessary for achieving a successfull conversion, since the supplied PHP code is
compatible with both PHP4 and PHP5. We expect to see no compatibility issues
with the upcoming PHP6, too.
Files
-----
idna_convert.class.php - The actual class
idna_convert.create.npdata.php - Useful for (re)creating the NPData file
npdata.ser - Serialized data for NamePrep
example.php - An example web page for converting
ReadMe.txt - This file
LICENCE - The LGPL licence file
The class is contained in idna_convert.class.php.
MAKE SURE to copy the npdata.ser file into the same folder as the class file
itself!
Examples
--------
1. Say we wish to encode the domain name nörgler.com:
// Include the class
include_once('idna_convert.class.php');
// Instantiate it *
$IDN = new idna_convert();
// The input string, if input is not UTF-8 or UCS-4, it must be converted before
$input = utf8_encode('nörgler.com');
// Encode it to its punycode presentation
$output = $IDN->encode($input);
// Output, what we got now
echo $output; // This will read: xn--nrgler-wxa.com
2. We received an email from a punycoded domain and are willing to learn, how
the domain name reads originally
// Include the class
include_once('idna_convert.class.php');
// Instantiate it (depending on the version you are using) with
$IDN = new idna_convert();
// The input string
$input = 'andre@xn--brse-5qa.xn--knrz-1ra.info';
// Encode it to its punycode presentation
$output = $IDN->decode($input);
// Output, what we got now, if output should be in a format different to UTF-8
// or UCS-4, you will have to convert it before outputting it
echo utf8_decode($output); // This will read: andre@börse.knörz.info
3. The input is read from a UCS-4 coded file and encoded line by line. By
appending the optional second parameter we tell enode() about the input
format to be used
// Include the class
include_once('idna_convert.class.php');
// Instantiate it
$IDN = new dinca_convert();
// Iterate through the input file line by line
foreach (file('ucs4-domains.txt') as $line) {
echo $IDN->encode(trim($line), 'ucs4_string');
echo "\n";
}
NPData
------
Should you need to recreate the npdata.ser file, which holds all necessary translation
tables in a serialized format, you can run the file idna_convert.create.npdata.php, which
creates the file for you and stores it in the same folder, where it is placed.
Should you need to do changes to the tables you can do so, but beware of the consequences.
Contact us
----------
In case of errors, bugs, questions, wishes, please don't hesitate to contact us
under the email address above.
The team of phlyLabs
http://phlylabs.de
mailto:phlymail@phlylabs.de
没有合适的资源?快使用搜索试试~ 我知道了~
Joomla_1.5.11-Stable-Full_Package-zh-CN.zip
共2000个文件
php:1041个
html:796个
png:726个
需积分: 10 25 下载量 190 浏览量
2009-06-14
11:31:31
上传
评论
收藏 5.84MB ZIP 举报
温馨提示
Joomla!是一套获得过多个奖项的内容管理系统(Content Management System, CMS)。Joomla!采用PHP+MySQL数据库开发,可运行在Linux、Windows、MacOSX、Solaris等各种平台上。Joomla!除了具有新闻/文章管理,文档/图片管理,网站布局设置,模板/主题管理等一些基本功能之外。还可通过其提供的上千个插件进行功能扩展包括:电子商务与购物车引擎,论坛与聊天软件,日历,博客软件,目录分类管理,广告管理系统,电子报,数据收集与报表工具,期刊订阅服务等。 Joomla! 1.5.11[Vea] 发布,因为此版本为安全发行版,强烈建议广大用户升级到此最新版本。 此次版本包含了26个补丁修正,其中两个中级别的安全修正和一个低级别的安全修正。这是距 Joomla 1.5.10 发布11个星期后,Joomla开发小组的最新成果。Joomla开发小组旨在为Joomla社区提供常规、快捷的更新。
资源推荐
资源详情
资源评论
收起资源包目录
Joomla_1.5.11-Stable-Full_Package-zh-CN.zip (2000个子文件)
CHANGES-2.1.0 2KB
Changelog 55KB
CHANGELOG 627B
COPYING 11KB
template.css 26KB
layout.css 22KB
docbook.css 20KB
general.css 15KB
template_rtl.css 13KB
template.css 12KB
editor_ui.css 8KB
ja-sosdmenu.css 8KB
template.css 7KB
style.css 7KB
icon.css 7KB
style.css 7KB
template_rtl.css 7KB
theme.css 6KB
calendar-system.css 6KB
editor_popup.css 5KB
theme.css 5KB
general_rtl.css 5KB
calendar-jos.css 4KB
calendar-mos.css 4KB
position.css 3KB
general.css 3KB
menu.css 3KB
template_rtl.css 3KB
fullpage.css 3KB
popup-imagemanager.css 3KB
rounded.css 2KB
type_rtl.css 2KB
general.css 2KB
popup-imagemanager.css 2KB
type.css 2KB
ieonly.css 2KB
editor_ui.css 2KB
style.css 2KB
style.css 2KB
tabpane.css 2KB
login.css 2KB
tabpane_rtl.css 2KB
print.css 2KB
mediamanager.css 2KB
medialist-thumbs.css 2KB
error.css 2KB
menu.css 2KB
offline.css 2KB
component.css 1KB
popup-imagelist.css 1KB
system.css 1KB
template.css 1KB
menu_rtl.css 1KB
popup-imagelist.css 1KB
media.css 1KB
devkit.css 1KB
norounded.css 1KB
editor_content.css 1KB
modal.css 1KB
contextmenu.css 1KB
system.css 1KB
props.css 1KB
error.css 1KB
login_rtl.css 1KB
editor.css 1014B
medialist-details.css 1012B
inlinepopup.css 961B
ie7only.css 951B
template_rtl.css 945B
editor_content.css 878B
toolbar.css 876B
dtree_rtl.css 848B
dtree.css 847B
template.css 834B
white.css 820B
popup.css 813B
advimage.css 769B
offline_rtl.css 768B
editor_popup.css 765B
template_rtl.css 764B
orange_bg.css 748B
green_bg.css 739B
orange.css 739B
white_bg.css 736B
black_bg.css 736B
green.css 734B
black.css 733B
blue_bg.css 730B
blue.css 723B
red_bg.css 721B
red.css 721B
colorpicker.css 664B
content.css 583B
advlink.css 559B
style.css 541B
style.css 533B
style.css 533B
poll_bars.css 532B
searchreplace.css 516B
page.css 509B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
zhaocong666
- 粉丝: 13
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功