NewsNewsFeaturesDownloadsDevelopmentSupportForumDocumentsAbout Us

HttpUrlValidator 類別 參考文件
[Validator]

類別HttpUrlValidator的繼承圖:

Validator Validation Object 全部成員列表

公開方法(Public Methods)

 HttpUrlValidator ()

詳細描述

Checks whether the string is a valid http/https url

參閱:
NonEmptyRule

定義在 httpurlvalidator.class.php 檔案之第 14 行.


建構子與解構子說明文件

HttpUrlValidator::HttpUrlValidator  ) 
 

定義在 httpurlvalidator.class.php 檔案之第 16 行.

參考 $path, Validator::addRule(), 及 Validator::Validator().

00017         {
00018             // trying to be RFC 1736 compatible, except where common
00019             // usage goes against it, such as allowing unencoded 
00020             // '~', '^', ' ', etc.
00021 
00022             $prefix = "^([[:alnum:]\-\+\.]+)\://";
00023             $ftp_login = "([[:alnum:]\.\-]+(\:[[:alnum:]\.&%\$\-]+)*@)*";
00024             $ip_num = "(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]?)";
00025             $ip_address = "($ip_num\.($ip_num|0)\.($ip_num|0)\.$ip_num)";
00026             $tld = "(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|([[:alpha:]]{2}))";
00027             $port = "(\:[[:digit:]]+)*";
00028             $path = "(/($|[[:alnum:] \.\,\?\'\"\\\+^&%\$#\=~_\-]+))*";
00029 
00030             // allow underscores, even though we shouldn't
00031             $domain_part = "([[:alnum:]_\-]+\.)+";
00032             
00033             $this->Validator();
00034             $this->addRule( new NonEmptyRule());
00035             $this->addRule( new RegExpRule("(" . $prefix . $ftp_login . "(" . $ip_address . "|localhost|(" .
00036                                                  $domain_part . $tld . "))" . $port . ")?" . $path . "$",
00037                                            false ));
00038         }


此類別(class) 文件是由下列檔案中產生: