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: {
- 48: /**
- 49: * Sets control's value.
- 52: */
- 54: {
- 58: }
- 60: }
- 64: /**
- 65: * Loads HTTP data.
- 68: */
- 70: {
- 74: }
- 78: /**
- 79: * Sets the special value which is treated as empty string.
- 82: */
- 84: {
- 87: }
- 91: /**
- 92: * Returns the special value which is treated as empty string.
- 94: */
- 96: {
- 98: }
- 102: /**
- 103: * Appends input string filter callback.
- 106: */
- 108: {
- 112: throw new InvalidArgumentException("Filter '$textual' is not " . ($able ? 'callable.' : 'valid PHP callback.'));
- 113: }
- 116: }
- 121: {
- 124: }
- 127: }
- 131: /**
- 132: * Min-length validator: has control's value minimal length?
- 136: */
- 138: {
- 140: }
- 144: /**
- 145: * Max-length validator: is control's value length in limit?
- 149: */
- 151: {
- 153: }
- 157: /**
- 158: * Length validator: is control's value length in range?
- 162: */
- 164: {
- 167: }
- 170: }
- 174: /**
- 175: * Email validator: is control's value valid email address?
- 178: */
- 180: {
- 182: $localPart = "(\"([ !\\x23-\\x5B\\x5D-\\x7E]*|\\\\[ -~])+\"|$atom+(\\.$atom+)*)"; // quoted or unquoted
- 185: return (bool) preg_match("(^$localPart@($domain?\\.)+[a-z]{2,10}\\z)i", $control->getValue()); // strict top-level domain
- 186: }
- 190: /**
- 191: * URL validator: is control's value valid URL?
- 194: */
- 196: {
- 198: }
- 202: /**
- 203: * Regular expression validator: matches control's value regular expression?
- 207: */
- 209: {
- 211: }
- 215: /**
- 216: * Integer validator: is a control's value decimal number?
- 219: */
- 221: {
- 223: }
- 227: /**
- 228: * Float validator: is a control's value float number?
- 231: */
- 233: {
- 235: }
- 239: /**
- 240: * Rangle validator: is a control's value number in specified range?
- 244: */
- 246: {
- 247: return ($range[0] === NULL || $control->getValue() >= $range[0]) && ($range[1] === NULL || $control->getValue() <= $range[1]);
- 248: }
- 252: /**
- 253: * Float string cleanup.
- 256: */
- 258: {
- 260: }
- 262: }