File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,19 @@ class getvar implements ArrayAccess {
2525
2626
2727
28- public function __invoke ($ name =false , $ flags =false ) {
28+ public function __invoke ($ name =false , $ flags =false , $ recurse = false ) {
2929 if ($ flags === false ) $ flags = $ this ->default ;
3030
31+ //RECURSIVE SEARCH
32+ if (is_array ($ name )) {
33+ foreach ($ name as $ item ) {
34+ $ value = $ this ($ item , $ flags , true );
35+ if (!is_null ($ value )) break ;
36+ }
37+ }
38+
3139 //ATTEMPT TO GET THE VALUE FROM POST
32- if (!($ flags & _GETVAR_NOPOST )) {
40+ if (!isset ( $ value ) && ! ($ flags & _GETVAR_NOPOST )) {
3341 if (is_bool ($ name )) return $ this ->post ($ name );
3442
3543 if ($ this ->type () === 'application/json ' ) {
@@ -50,8 +58,11 @@ class getvar implements ArrayAccess {
5058 if (isset ($ _GET [$ name ])) $ value = $ _GET [$ name ];
5159 }
5260
61+ //HANDLE RECURSIVE SEARCHING
62+ if (!isset ($ value ) && $ recurse ) return NULL ;
63+
5364 //VALUE NOT FOUND
54- if (!isset ($ value ) || $ value === '' ) {
65+ if (!isset ($ value ) || is_null ( $ value ) || $ value === '' ) {
5566 return ($ flags & _GETVAR_NULL ) ? NULL : '' ;
5667 }
5768
You can’t perform that action at this time.
0 commit comments