5 |
* |
* |
6 |
* $Id$ |
* $Id$ |
7 |
* |
* |
8 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
9 |
* @author Suren Markosyan <suren@bcsweb.com> |
* @author Suren Markosyan <suren@bcsweb.com> |
10 |
* @package phpHtmlLib |
* @package phpHtmlLib |
11 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
19 |
* text input field. It has no validation method. |
* text input field. It has no validation method. |
20 |
* |
* |
21 |
* |
* |
22 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
23 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
24 |
* @package phpHtmlLib |
* @package phpHtmlLib |
25 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
74 |
* text input field, and validates against the |
* text input field, and validates against the |
75 |
* is_name() method. |
* is_name() method. |
76 |
* |
* |
77 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
78 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
79 |
* @package phpHtmlLib |
* @package phpHtmlLib |
80 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
105 |
* It validatest he data as is_email() |
* It validatest he data as is_email() |
106 |
* |
* |
107 |
* |
* |
108 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
109 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
110 |
* @package phpHtmlLib |
* @package phpHtmlLib |
111 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
113 |
* @copyright LGPL - See LICENCE |
* @copyright LGPL - See LICENCE |
114 |
*/ |
*/ |
115 |
class FEEmail extends FEText { |
class FEEmail extends FEText { |
116 |
|
|
117 |
|
/** Holds the flag to indicate |
118 |
|
* whether we allow email in |
119 |
|
* the long name format like |
120 |
|
* Foo Bar <email@email.com> |
121 |
|
*/ |
122 |
|
var $_allow_name = true; |
123 |
|
|
124 |
/** |
/** |
125 |
* This method validates the data |
* This method validates the data |
129 |
* @param FormValidation object. |
* @param FormValidation object. |
130 |
*/ |
*/ |
131 |
function validate($_FormValidation) { |
function validate($_FormValidation) { |
132 |
if (!$_FormValidation->is_email($this->get_value())) { |
if (!$_FormValidation->is_email($this->get_value(), $this->_allow_name)) { |
133 |
$this->set_error_message( $_FormValidation->get_error_message() ); |
$this->set_error_message( $_FormValidation->get_error_message() ); |
134 |
return FALSE; |
return FALSE; |
135 |
} |
} |
136 |
return TRUE; |
return TRUE; |
137 |
} |
} |
138 |
|
|
139 |
|
/** |
140 |
|
* Sets the flag to indicate |
141 |
|
* whether we allow email in |
142 |
|
* the long name format like |
143 |
|
* Foo Bar <email@email.com> |
144 |
|
* |
145 |
|
* @param bool |
146 |
|
*/ |
147 |
|
function set_allow_name($flag) { |
148 |
|
$this->_allow_name = $flag; |
149 |
|
} |
150 |
} |
} |
151 |
|
|
152 |
/** |
/** |
157 |
* It validatest he data as is_manyemails() |
* It validatest he data as is_manyemails() |
158 |
* |
* |
159 |
* |
* |
160 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
161 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
162 |
* @package phpHtmlLib |
* @package phpHtmlLib |
163 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
188 |
* It validates as is_domainname(). |
* It validates as is_domainname(). |
189 |
* |
* |
190 |
* |
* |
191 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
192 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
193 |
* @package phpHtmlLib |
* @package phpHtmlLib |
194 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
219 |
* It validates as is_domainname(). |
* It validates as is_domainname(). |
220 |
* |
* |
221 |
* |
* |
222 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
223 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
224 |
* @package phpHtmlLib |
* @package phpHtmlLib |
225 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
356 |
* It validates as is_ip(). |
* It validates as is_ip(). |
357 |
* |
* |
358 |
* |
* |
359 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
360 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
361 |
* @package phpHtmlLib |
* @package phpHtmlLib |
362 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
387 |
* It validates as is_ip(). |
* It validates as is_ip(). |
388 |
* |
* |
389 |
* |
* |
390 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
391 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
392 |
* @package phpHtmlLib |
* @package phpHtmlLib |
393 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
420 |
* It validates as is_url(). |
* It validates as is_url(). |
421 |
* |
* |
422 |
* |
* |
423 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
424 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
425 |
* @package phpHtmlLib |
* @package phpHtmlLib |
426 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
452 |
* It validates as is_strict_url(). |
* It validates as is_strict_url(). |
453 |
* |
* |
454 |
* |
* |
455 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
456 |
* @author Suren Markossian <suren@bcsweb.com> |
* @author Suren Markossian <suren@bcsweb.com> |
457 |
* @package phpHtmlLib |
* @package phpHtmlLib |
458 |
* @subpackage FormProcessing |
* @subpackage FormProcessing |
480 |
/** |
/** |
481 |
* This is the FEZipcode class. |
* This is the FEZipcode class. |
482 |
* |
* |
483 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
* @author Walter A. Boring IV <waboring@newsblob.com> |
484 |
*/ |
*/ |
485 |
class FEZipcode extends FEText { |
class FEZipcode extends FEText { |
486 |
/** |
/** |
513 |
} |
} |
514 |
|
|
515 |
/** |
/** |
516 |
* This is the RegEx FormElement which builds a |
* This is the RegEx FormElement which builds a text input field, and validates |
517 |
* text input field, and validates against the |
* against the is_regex() method. |
518 |
* is_regex() method. |
* |
519 |
|
* Example as it would appear in FormContent::form_init_elements(): |
520 |
|
* <code> |
521 |
|
* $this->add_element( new FERegEx("FERegEx label", false, '200px', 3, '/^pattern to match$/', 'error message when pattern does not match') ); |
522 |
|
* </code> |
523 |
* |
* |
524 |
* @author Culley Harrelson <culley@fastmail.fm> |
* @author Culley Harrelson <culley@fastmail.fm> |
525 |
* @package phpHtmlLib |
* @package phpHtmlLib |
554 |
* |
* |
555 |
* It validates as is_regex(). |
* It validates as is_regex(). |
556 |
* @param FormValidation object. |
* @param FormValidation object. |
557 |
|
* @return boolean |
558 |
*/ |
*/ |
559 |
function validate(&$_FormValidation) { |
function validate(&$_FormValidation) { |
560 |
if (!$_FormValidation->is_regex($this->_regex, $this->get_value())) { |
if (!$_FormValidation->is_regex($this->_regex, $this->get_value())) { |