Development

/branches/1.2/lib/validator/sfValidatorUrl.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/validator/sfValidatorUrl.class.php

Revision 9048, 1.2 kB (checked in by FabianLange, 6 years ago)

1.1: fixed @param phpdoc to fit specs in validator (refs #2991)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfValidatorUrl validates Urls.
13  *
14  * @package    symfony
15  * @subpackage validator
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfValidatorUrl extends sfValidatorRegex
20 {
21   /**
22    * @param array $options   An array of options
23    * @param array $messages  An array of error messages
24    *
25    * @see sfValidatorRegex
26    */
27   protected function configure($options = array(), $messages = array())
28   {
29     parent::configure($options, $messages);
30
31     $this->setOption('pattern', '~^
32       (https?|ftps?)://                       # http or ftp (+SSL)
33       (
34         ([a-z0-9-]+\.)+[a-z]{2,6}             # a domain name
35           |                                   #  or
36         \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}    # a IP address
37       )
38       (:[0-9]+)?                              # a port (optional)
39       (/?|/\S+)                               # a /, nothing or a / with something
40     $~ix');
41   }
42 }
43
Note: See TracBrowser for help on using the browser.