Source for file TextBase.php
Documentation is available at TextBase.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 26: /**
- 27: * Implements the basic functionality common to text input controls.
- 28: *
- 32: *
- 34: */
- 36: {
- 45: /**
- 46: * Sets control's value.
- 49: */
- 51: {
- 54: }
- 58: /**
- 59: * Returns control's value.
- 61: */
- 63: {
- 67: }
- 69: }
- 73: /**
- 74: * Sets the special value which is treated as empty string.
- 77: */
- 79: {
- 82: }
- 86: /**
- 87: * Returns the special value which is treated as empty string.
- 89: */
- 91: {
- 93: }
- 97: /**
- 98: * Appends input string filter callback.
- 101: */
- 103: {
- 107: throw new InvalidArgumentException("Filter '$textual' is not " . ($able ? 'callable.' : 'valid PHP callback.'));
- 108: }
- 111: }
- 116: {
- 119: }
- 122: }
- 126: /**
- 127: * Min-length validator: has control's value minimal length?
- 131: */
- 133: {
- 135: }
- 139: /**
- 140: * Max-length validator: is control's value length in limit?
- 144: */
- 146: {
- 148: }
- 152: /**
- 153: * Length validator: is control's value length in range?
- 157: */
- 159: {
- 162: }
- 165: }
- 169: /**
- 170: * Email validator: is control's value valid email address?
- 173: */
- 175: {
- 177: $localPart = "(\"([ !\\x23-\\x5B\\x5D-\\x7E]*|\\\\[ -~])+\"|$atom+(\\.$atom+)*)"; // quoted or unquoted
- 180: return (bool) preg_match("(^$localPart@($domain?\\.)+[a-z]{2,14}\\z)i", $control->getValue()); // strict top-level domain
- 181: }
- 185: /**
- 186: * URL validator: is control's value valid URL?
- 189: */
- 191: {
- 193: }
- 197: /**
- 198: * Regular expression validator: matches control's value regular expression?
- 202: */
- 204: {
- 206: }
- 210: /**
- 211: * Integer validator: is a control's value decimal number?
- 214: */
- 216: {
- 218: }
- 222: /**
- 223: * Float validator: is a control's value float number?
- 226: */
- 228: {
- 230: }
- 234: /**
- 235: * Rangle validator: is a control's value number in specified range?
- 239: */
- 241: {
- 242: return ($range[0] === NULL || $control->getValue() >= $range[0]) && ($range[1] === NULL || $control->getValue() <= $range[1]);
- 243: }
- 247: /**
- 248: * Float string cleanup.
- 251: */
- 253: {
- 255: }
- 257: }