[TASK] Remove empty constructors in EXT:form
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / System / Validate / Ip.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * IP address rule
27 *
28 * @author Patrick Broens <patrick@patrickbroens.nl>
29 * @package TYPO3
30 * @subpackage form
31 */
32 class tx_form_System_Validate_Ip extends tx_form_System_Validate_Abstract {
33
34 /**
35 * Returns TRUE if submitted value validates according to rule
36 *
37 * @return boolean
38 * @see tx_form_System_Validate_Interface::isValid()
39 */
40 public function isValid() {
41 if ($this->requestHandler->has($this->fieldName)) {
42 $value = $this->requestHandler->getByMethod($this->fieldName);
43 if (!preg_match('/\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b/', $value)) {
44 return FALSE;
45 }
46 }
47 return TRUE;
48 }
49 }
50 ?>