12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /*
- * This file is part of the symfony package.
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- /**
- * sfValidatorUrl validates Urls.
- *
- * @package symfony
- * @subpackage validator
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfValidatorUrl.class.php 9048 2008-05-19 09:11:23Z FabianLange $
- */
- class sfValidatorUrl extends sfValidatorRegex
- {
- /**
- * @param array $options An array of options
- * @param array $messages An array of error messages
- *
- * @see sfValidatorRegex
- */
- protected function configure($options = array(), $messages = array())
- {
- parent::configure($options, $messages);
- $this->setOption('pattern', '~^
- (https?|ftps?):// # http or ftp (+SSL)
- (
- ([a-z0-9-]+\.)+[a-z]{2,6} # a domain name
- | # or
- \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
- )
- (:[0-9]+)? # a port (optional)
- (/?|/\S+) # a /, nothing or a / with something
- $~ix');
- }
- }
|