blob: 987ff18e27a4cec7666f69f108649fcae23f9986 [file] [log] [blame]
Derek Allard2067d1a2008-11-13 22:59:24 +00001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
8 * @author ExpressionEngine Dev Team
Derek Jonesfc395a12009-04-22 14:15:09 +00009 * @copyright Copyright (c) 2008 - 2009, EllisLab, Inc.
Derek Allard2067d1a2008-11-13 22:59:24 +000010 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
12 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * CodeIgniter Form Helpers
20 *
21 * @package CodeIgniter
22 * @subpackage Helpers
23 * @category Helpers
24 * @author ExpressionEngine Dev Team
25 * @link http://codeigniter.com/user_guide/helpers/form_helper.html
26 */
27
28// ------------------------------------------------------------------------
29
30/**
31 * Form Declaration
32 *
33 * Creates the opening portion of the form.
34 *
35 * @access public
36 * @param string the URI segments of the form destination
37 * @param array a key/value pair of attributes
38 * @param array a key/value pair hidden data
39 * @return string
40 */
41if ( ! function_exists('form_open'))
42{
43 function form_open($action = '', $attributes = '', $hidden = array())
44 {
45 $CI =& get_instance();
46
47 if ($attributes == '')
48 {
49 $attributes = 'method="post"';
50 }
51
52 $action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action;
53
54 $form = '<form action="'.$action.'"';
55
56 $form .= _attributes_to_string($attributes, TRUE);
57
58 $form .= '>';
59
60 if (is_array($hidden) AND count($hidden) > 0)
61 {
62 $form .= form_hidden($hidden);
63 }
64
65 return $form;
66 }
67}
68
69// ------------------------------------------------------------------------
70
71/**
72 * Form Declaration - Multipart type
73 *
74 * Creates the opening portion of the form, but with "multipart/form-data".
75 *
76 * @access public
77 * @param string the URI segments of the form destination
78 * @param array a key/value pair of attributes
79 * @param array a key/value pair hidden data
80 * @return string
81 */
82if ( ! function_exists('form_open_multipart'))
83{
84 function form_open_multipart($action, $attributes = array(), $hidden = array())
85 {
86 $attributes['enctype'] = 'multipart/form-data';
87 return form_open($action, $attributes, $hidden);
88 }
89}
90
91// ------------------------------------------------------------------------
92
93/**
94 * Hidden Input Field
95 *
96 * Generates hidden fields. You can pass a simple key/value string or an associative
97 * array with multiple values.
98 *
99 * @access public
100 * @param mixed
101 * @param string
102 * @return string
103 */
104if ( ! function_exists('form_hidden'))
105{
Robin Sowell57fe4102009-03-26 18:58:46 +0000106 function form_hidden($name, $value = '', $recursing = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000107 {
Robin Sowell57fe4102009-03-26 18:58:46 +0000108 static $form;
109
110 if ($recursing === FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000111 {
Robin Sowell57fe4102009-03-26 18:58:46 +0000112 $form = "\n";
Derek Allard2067d1a2008-11-13 22:59:24 +0000113 }
114
Robin Sowell57fe4102009-03-26 18:58:46 +0000115 if (is_array($name))
Derek Allard2067d1a2008-11-13 22:59:24 +0000116 {
Robin Sowell57fe4102009-03-26 18:58:46 +0000117 foreach ($name as $key => $val)
118 {
119 form_hidden($key, $val, TRUE);
120 }
121 return $form;
122 }
123
124 if ( ! is_array($value))
125 {
126 $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />'."\n";
127 }
128 else
129 {
130 foreach ($value as $k => $v)
131 {
132 $k = (is_int($k)) ? '' : $k;
133 form_hidden($name.'['.$k.']', $v, TRUE);
134 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000135 }
136
137 return $form;
138 }
139}
140
141// ------------------------------------------------------------------------
142
143/**
144 * Text Input Field
145 *
146 * @access public
147 * @param mixed
148 * @param string
149 * @param string
150 * @return string
151 */
152if ( ! function_exists('form_input'))
153{
154 function form_input($data = '', $value = '', $extra = '')
155 {
156 $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
157
158 return "<input "._parse_form_attributes($data, $defaults).$extra." />";
159 }
160}
161
162// ------------------------------------------------------------------------
163
164/**
165 * Password Field
166 *
167 * Identical to the input function but adds the "password" type
168 *
169 * @access public
170 * @param mixed
171 * @param string
172 * @param string
173 * @return string
174 */
175if ( ! function_exists('form_password'))
176{
177 function form_password($data = '', $value = '', $extra = '')
178 {
179 if ( ! is_array($data))
180 {
181 $data = array('name' => $data);
182 }
183
184 $data['type'] = 'password';
185 return form_input($data, $value, $extra);
186 }
187}
188
189// ------------------------------------------------------------------------
190
191/**
192 * Upload Field
193 *
194 * Identical to the input function but adds the "file" type
195 *
196 * @access public
197 * @param mixed
198 * @param string
199 * @param string
200 * @return string
201 */
202if ( ! function_exists('form_upload'))
203{
204 function form_upload($data = '', $value = '', $extra = '')
205 {
206 if ( ! is_array($data))
207 {
208 $data = array('name' => $data);
209 }
210
211 $data['type'] = 'file';
212 return form_input($data, $value, $extra);
213 }
214}
215
216// ------------------------------------------------------------------------
217
218/**
219 * Textarea field
220 *
221 * @access public
222 * @param mixed
223 * @param string
224 * @param string
225 * @return string
226 */
227if ( ! function_exists('form_textarea'))
228{
229 function form_textarea($data = '', $value = '', $extra = '')
230 {
231 $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
232
233 if ( ! is_array($data) OR ! isset($data['value']))
234 {
235 $val = $value;
236 }
237 else
238 {
239 $val = $data['value'];
240 unset($data['value']); // textareas don't use the value attribute
241 }
242
Pascal Kriete6d1998c2009-06-09 14:03:19 +0000243 return "<textarea "._parse_form_attributes($data, $defaults).$extra.">".form_prep($val)."</textarea>";
Derek Allard2067d1a2008-11-13 22:59:24 +0000244 }
245}
246
247// ------------------------------------------------------------------------
248
249/**
Derek Jones26399292009-04-08 16:14:17 +0000250 * Multi-select menu
251 *
252 * @access public
253 * @param string
254 * @param array
255 * @param mixed
256 * @param string
257 * @return type
258 */
259if (! function_exists('form_multiselect'))
260{
261 function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
262 {
263 if ( ! strpos($extra, 'multiple'))
264 {
265 $extra .= ' multiple="multiple"';
266 }
267
268 return form_dropdown($name, $options, $selected, $extra);
269 }
270}
271
272// --------------------------------------------------------------------
273
274/**
Derek Allard2067d1a2008-11-13 22:59:24 +0000275 * Drop-down Menu
276 *
277 * @access public
278 * @param string
279 * @param array
280 * @param string
281 * @param string
282 * @return string
283 */
284if ( ! function_exists('form_dropdown'))
285{
286 function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
287 {
288 if ( ! is_array($selected))
289 {
290 $selected = array($selected);
291 }
292
293 // If no selected state was submitted we will attempt to set it automatically
294 if (count($selected) === 0)
295 {
296 // If the form name appears in the $_POST array we have a winner!
297 if (isset($_POST[$name]))
298 {
299 $selected = array($_POST[$name]);
300 }
301 }
302
303 if ($extra != '') $extra = ' '.$extra;
304
305 $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
306
307 $form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
Robin Sowell57fe4102009-03-26 18:58:46 +0000308
Derek Allard2067d1a2008-11-13 22:59:24 +0000309 foreach ($options as $key => $val)
310 {
311 $key = (string) $key;
Derek Allard2067d1a2008-11-13 22:59:24 +0000312
Derek Allard78a5fc92009-02-05 16:34:35 +0000313 if (is_array($val))
314 {
315 $form .= '<optgroup label="'.$key.'">'."\n";
Derek Allard2067d1a2008-11-13 22:59:24 +0000316
Derek Allard78a5fc92009-02-05 16:34:35 +0000317 foreach ($val as $optgroup_key => $optgroup_val)
318 {
Derek Allard86a840c2009-02-05 17:31:58 +0000319 $sel = (in_array($optgroup_key, $selected)) ? ' selected="selected"' : '';
Derek Allard78a5fc92009-02-05 16:34:35 +0000320
321 $form .= '<option value="'.$optgroup_key.'"'.$sel.'>'.(string) $optgroup_val."</option>\n";
322 }
323
324 $form .= '</optgroup>'."\n";
325 }
326 else
327 {
328 $sel = (in_array($key, $selected)) ? ' selected="selected"' : '';
329
330 $form .= '<option value="'.$key.'"'.$sel.'>'.(string) $val."</option>\n";
331 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000332 }
333
334 $form .= '</select>';
335
336 return $form;
337 }
338}
339
340// ------------------------------------------------------------------------
341
342/**
343 * Checkbox Field
344 *
345 * @access public
346 * @param mixed
347 * @param string
348 * @param bool
349 * @param string
350 * @return string
351 */
352if ( ! function_exists('form_checkbox'))
353{
354 function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
355 {
356 $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
357
358 if (is_array($data) AND array_key_exists('checked', $data))
359 {
360 $checked = $data['checked'];
361
362 if ($checked == FALSE)
363 {
364 unset($data['checked']);
365 }
366 else
367 {
368 $data['checked'] = 'checked';
369 }
370 }
371
372 if ($checked == TRUE)
373 {
374 $defaults['checked'] = 'checked';
375 }
376 else
377 {
378 unset($defaults['checked']);
379 }
380
381 return "<input "._parse_form_attributes($data, $defaults).$extra." />";
382 }
383}
384
385// ------------------------------------------------------------------------
386
387/**
388 * Radio Button
389 *
390 * @access public
391 * @param mixed
392 * @param string
393 * @param bool
394 * @param string
395 * @return string
396 */
397if ( ! function_exists('form_radio'))
398{
399 function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
400 {
401 if ( ! is_array($data))
402 {
403 $data = array('name' => $data);
404 }
405
406 $data['type'] = 'radio';
407 return form_checkbox($data, $value, $checked, $extra);
408 }
409}
410
411// ------------------------------------------------------------------------
412
413/**
414 * Submit Button
415 *
416 * @access public
417 * @param mixed
418 * @param string
419 * @param string
420 * @return string
421 */
422if ( ! function_exists('form_submit'))
423{
424 function form_submit($data = '', $value = '', $extra = '')
425 {
426 $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
427
428 return "<input "._parse_form_attributes($data, $defaults).$extra." />";
429 }
430}
431
432// ------------------------------------------------------------------------
433
434/**
435 * Reset Button
436 *
437 * @access public
438 * @param mixed
439 * @param string
440 * @param string
441 * @return string
442 */
443if ( ! function_exists('form_reset'))
444{
445 function form_reset($data = '', $value = '', $extra = '')
446 {
447 $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
448
449 return "<input "._parse_form_attributes($data, $defaults).$extra." />";
450 }
451}
452
453// ------------------------------------------------------------------------
454
455/**
456 * Form Button
457 *
458 * @access public
459 * @param mixed
460 * @param string
461 * @param string
462 * @return string
463 */
464if ( ! function_exists('form_button'))
465{
466 function form_button($data = '', $content = '', $extra = '')
467 {
Derek Allard904094a2009-02-10 14:00:34 +0000468 $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'button');
Derek Allard2067d1a2008-11-13 22:59:24 +0000469
470 if ( is_array($data) AND isset($data['content']))
471 {
472 $content = $data['content'];
473 unset($data['content']); // content is not an attribute
474 }
475
476 return "<button "._parse_form_attributes($data, $defaults).$extra.">".$content."</button>";
477 }
478}
479
480// ------------------------------------------------------------------------
481
482/**
483 * Form Label Tag
484 *
485 * @access public
486 * @param string The text to appear onscreen
487 * @param string The id the label applies to
488 * @param string Additional attributes
489 * @return string
490 */
491if ( ! function_exists('form_label'))
492{
493 function form_label($label_text = '', $id = '', $attributes = array())
494 {
495
496 $label = '<label';
497
498 if ($id != '')
499 {
500 $label .= " for=\"$id\"";
501 }
502
503 if (is_array($attributes) AND count($attributes) > 0)
504 {
505 foreach ($attributes as $key => $val)
506 {
507 $label .= ' '.$key.'="'.$val.'"';
508 }
509 }
510
511 $label .= ">$label_text</label>";
512
513 return $label;
514 }
515}
516
517// ------------------------------------------------------------------------
518/**
519 * Fieldset Tag
520 *
521 * Used to produce <fieldset><legend>text</legend>. To close fieldset
522 * use form_fieldset_close()
523 *
524 * @access public
525 * @param string The legend text
526 * @param string Additional attributes
527 * @return string
528 */
529if ( ! function_exists('form_fieldset'))
530{
531 function form_fieldset($legend_text = '', $attributes = array())
532 {
533 $fieldset = "<fieldset";
534
535 $fieldset .= _attributes_to_string($attributes, FALSE);
536
537 $fieldset .= ">\n";
538
539 if ($legend_text != '')
540 {
541 $fieldset .= "<legend>$legend_text</legend>\n";
542 }
543
544 return $fieldset;
545 }
546}
547
548// ------------------------------------------------------------------------
549
550/**
551 * Fieldset Close Tag
552 *
553 * @access public
554 * @param string
555 * @return string
556 */
557if ( ! function_exists('form_fieldset_close'))
558{
559 function form_fieldset_close($extra = '')
560 {
561 return "</fieldset>".$extra;
562 }
563}
564
565// ------------------------------------------------------------------------
566
567/**
568 * Form Close Tag
569 *
570 * @access public
571 * @param string
572 * @return string
573 */
574if ( ! function_exists('form_close'))
575{
576 function form_close($extra = '')
577 {
578 return "</form>".$extra;
579 }
580}
581
582// ------------------------------------------------------------------------
583
584/**
585 * Form Prep
586 *
587 * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
588 *
589 * @access public
590 * @param string
591 * @return string
592 */
593if ( ! function_exists('form_prep'))
594{
595 function form_prep($str = '')
596 {
597 // if the field name is an array we do this recursively
598 if (is_array($str))
599 {
600 foreach ($str as $key => $val)
601 {
602 $str[$key] = form_prep($val);
603 }
604
605 return $str;
606 }
607
608 if ($str === '')
609 {
610 return '';
611 }
612
Derek Allard2067d1a2008-11-13 22:59:24 +0000613 $str = htmlspecialchars($str);
614
615 // In case htmlspecialchars misses these.
616 $str = str_replace(array("'", '"'), array("&#39;", "&quot;"), $str);
617
Derek Allard2067d1a2008-11-13 22:59:24 +0000618 return $str;
619 }
620}
621
622// ------------------------------------------------------------------------
623
624/**
625 * Form Value
626 *
627 * Grabs a value from the POST array for the specified field so you can
628 * re-populate an input field or textarea. If Form Validation
629 * is active it retrieves the info from the validation class
630 *
631 * @access public
632 * @param string
633 * @return mixed
634 */
635if ( ! function_exists('set_value'))
636{
637 function set_value($field = '', $default = '')
638 {
639 if (FALSE === ($OBJ =& _get_validation_object()))
640 {
641 if ( ! isset($_POST[$field]))
642 {
643 return $default;
644 }
645
646 return form_prep($_POST[$field]);
647 }
648
649 return form_prep($OBJ->set_value($field, $default));
650 }
651}
652
653// ------------------------------------------------------------------------
654
655/**
656 * Set Select
657 *
658 * Let's you set the selected value of a <select> menu via data in the POST array.
659 * If Form Validation is active it retrieves the info from the validation class
660 *
661 * @access public
662 * @param string
663 * @param string
664 * @param bool
665 * @return string
666 */
667if ( ! function_exists('set_select'))
668{
669 function set_select($field = '', $value = '', $default = FALSE)
670 {
671 $OBJ =& _get_validation_object();
672
673 if ($OBJ === FALSE)
674 {
675 if ( ! isset($_POST[$field]))
676 {
Rick Ellis28e5c8f2009-03-09 22:36:48 +0000677 if (count($_POST) === 0 AND $default == TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000678 {
679 return ' selected="selected"';
680 }
681 return '';
682 }
683
684 $field = $_POST[$field];
685
686 if (is_array($field))
687 {
688 if ( ! in_array($value, $field))
689 {
690 return '';
691 }
692 }
693 else
694 {
695 if (($field == '' OR $value == '') OR ($field != $value))
696 {
697 return '';
698 }
699 }
700
701 return ' selected="selected"';
702 }
703
704 return $OBJ->set_select($field, $value, $default);
705 }
706}
707
708// ------------------------------------------------------------------------
709
710/**
711 * Set Checkbox
712 *
713 * Let's you set the selected value of a checkbox via the value in the POST array.
714 * If Form Validation is active it retrieves the info from the validation class
715 *
716 * @access public
717 * @param string
718 * @param string
719 * @param bool
720 * @return string
721 */
722if ( ! function_exists('set_checkbox'))
723{
724 function set_checkbox($field = '', $value = '', $default = FALSE)
725 {
726 $OBJ =& _get_validation_object();
727
728 if ($OBJ === FALSE)
729 {
730 if ( ! isset($_POST[$field]))
731 {
Rick Ellis28e5c8f2009-03-09 22:36:48 +0000732 if (count($_POST) === 0 AND $default == TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000733 {
734 return ' checked="checked"';
735 }
736 return '';
737 }
738
739 $field = $_POST[$field];
740
741 if (is_array($field))
742 {
743 if ( ! in_array($value, $field))
744 {
745 return '';
746 }
747 }
748 else
749 {
750 if (($field == '' OR $value == '') OR ($field != $value))
751 {
752 return '';
753 }
754 }
755
756 return ' checked="checked"';
757 }
758
759 return $OBJ->set_checkbox($field, $value, $default);
760 }
761}
762
763// ------------------------------------------------------------------------
764
765/**
766 * Set Radio
767 *
768 * Let's you set the selected value of a radio field via info in the POST array.
769 * If Form Validation is active it retrieves the info from the validation class
770 *
771 * @access public
772 * @param string
773 * @param string
774 * @param bool
775 * @return string
776 */
777if ( ! function_exists('set_radio'))
778{
779 function set_radio($field = '', $value = '', $default = FALSE)
780 {
781 $OBJ =& _get_validation_object();
782
783 if ($OBJ === FALSE)
784 {
785 if ( ! isset($_POST[$field]))
786 {
Rick Ellis28e5c8f2009-03-09 22:36:48 +0000787 if (count($_POST) === 0 AND $default == TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000788 {
789 return ' checked="checked"';
790 }
791 return '';
792 }
793
794 $field = $_POST[$field];
795
796 if (is_array($field))
797 {
798 if ( ! in_array($value, $field))
799 {
800 return '';
801 }
802 }
803 else
804 {
805 if (($field == '' OR $value == '') OR ($field != $value))
806 {
807 return '';
808 }
809 }
810
811 return ' checked="checked"';
812 }
813
814 return $OBJ->set_radio($field, $value, $default);
815 }
816}
817
818// ------------------------------------------------------------------------
819
820/**
821 * Form Error
822 *
823 * Returns the error for a specific form field. This is a helper for the
824 * form validation class.
825 *
826 * @access public
827 * @param string
828 * @param string
829 * @param string
830 * @return string
831 */
832if ( ! function_exists('form_error'))
833{
834 function form_error($field = '', $prefix = '', $suffix = '')
835 {
836 if (FALSE === ($OBJ =& _get_validation_object()))
837 {
838 return '';
839 }
840
841 return $OBJ->error($field, $prefix, $suffix);
842 }
843}
844
845// ------------------------------------------------------------------------
846
847/**
848 * Validation Error String
849 *
850 * Returns all the errors associated with a form submission. This is a helper
851 * function for the form validation class.
852 *
853 * @access public
854 * @param string
855 * @param string
856 * @return string
857 */
858if ( ! function_exists('validation_errors'))
859{
860 function validation_errors($prefix = '', $suffix = '')
861 {
862 if (FALSE === ($OBJ =& _get_validation_object()))
863 {
864 return '';
865 }
866
867 return $OBJ->error_string($prefix, $suffix);
868 }
869}
870
871// ------------------------------------------------------------------------
872
873/**
874 * Parse the form attributes
875 *
876 * Helper function used by some of the form helpers
877 *
878 * @access private
879 * @param array
880 * @param array
881 * @return string
882 */
883if ( ! function_exists('_parse_form_attributes'))
884{
885 function _parse_form_attributes($attributes, $default)
886 {
887 if (is_array($attributes))
888 {
889 foreach ($default as $key => $val)
890 {
891 if (isset($attributes[$key]))
892 {
893 $default[$key] = $attributes[$key];
894 unset($attributes[$key]);
895 }
896 }
897
898 if (count($attributes) > 0)
899 {
900 $default = array_merge($default, $attributes);
901 }
902 }
903
904 $att = '';
905
906 foreach ($default as $key => $val)
907 {
908 if ($key == 'value')
909 {
910 $val = form_prep($val);
911 }
912
913 $att .= $key . '="' . $val . '" ';
914 }
915
916 return $att;
917 }
918}
919
920// ------------------------------------------------------------------------
921
922/**
923 * Attributes To String
924 *
925 * Helper function used by some of the form helpers
926 *
927 * @access private
928 * @param mixed
929 * @param bool
930 * @return string
931 */
932if ( ! function_exists('_attributes_to_string'))
933{
934 function _attributes_to_string($attributes, $formtag = FALSE)
935 {
936 if (is_string($attributes) AND strlen($attributes) > 0)
937 {
938 if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
939 {
940 $attributes .= ' method="post"';
941 }
942
943 return ' '.$attributes;
944 }
945
946 if (is_object($attributes) AND count($attributes) > 0)
947 {
948 $attributes = (array)$attributes;
949 }
950
951 if (is_array($attributes) AND count($attributes) > 0)
952 {
953 $atts = '';
954
955 if ( ! isset($attributes['method']) AND $formtag === TRUE)
956 {
957 $atts .= ' method="post"';
958 }
959
960 foreach ($attributes as $key => $val)
961 {
962 $atts .= ' '.$key.'="'.$val.'"';
963 }
964
965 return $atts;
966 }
967 }
968}
969
970// ------------------------------------------------------------------------
971
972/**
973 * Validation Object
974 *
975 * Determines what the form validation class was instantiated as, fetches
976 * the object and returns it.
977 *
978 * @access private
979 * @return mixed
980 */
981if ( ! function_exists('_get_validation_object'))
982{
983 function &_get_validation_object()
984 {
985 $CI =& get_instance();
986
987 // We set this as a variable since we're returning by reference
988 $return = FALSE;
989
990 if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes['form_validation']))
991 {
992 return $return;
993 }
994
995 $object = $CI->load->_ci_classes['form_validation'];
996
997 if ( ! isset($CI->$object) OR ! is_object($CI->$object))
998 {
999 return $return;
1000 }
1001
1002 return $CI->$object;
1003 }
1004}
1005
1006
1007/* End of file form_helper.php */
Derek Jonesa3ffbbb2008-05-11 18:18:29 +00001008/* Location: ./system/helpers/form_helper.php */