Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
a7e0cebe
Commit
a7e0cebe
authored
Aug 20, 2017
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Input fix
parent
0384f319
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
57 deletions
+46
-57
Input.php
Input.php
+46
-57
No files found.
Input.php
View file @
a7e0cebe
<?php
<?php
/**
/**
*
*
*/
*/
class
X_Input
class
X_Input
{
{
protected
$Value
;
protected
$Value
;
protected
$Default
=
false
;
protected
$Default
=
false
;
function
__construct
()
function
__construct
()
{}
{
public
function
lower_string
()
{
}
public
function
lower_string
()
{
return
strtolower
(
$this
->
string
());
return
strtolower
(
$this
->
string
());
}
}
public
function
bool
()
public
function
bool
()
{
{
if
(
!
is_string
(
$this
->
Value
))
{
if
(
!
is_string
(
$this
->
Value
))
return
(
bool
)
$this
->
Value
;
return
(
bool
)
$this
->
Value
;
switch
(
strtolower
(
trim
(
$this
->
Value
)
)
)
}
{
switch
(
strtolower
(
trim
(
$this
->
Value
)))
{
case
'true'
:
case
'true'
:
case
'on'
:
case
'on'
:
case
'yes'
:
case
'yes'
:
case
'y'
:
case
'y'
:
case
'1'
:
case
'1'
:
return
true
;
return
true
;
break
;
break
;
default
:
default
:
...
@@ -34,81 +29,75 @@ class X_Input
...
@@ -34,81 +29,75 @@ class X_Input
}
}
}
}
public
function
str_replace
(
$search
,
$replace
)
public
function
str_replace
(
$search
,
$replace
)
{
{
return
(
is_string
(
$this
->
Value
))
?
str_replace
(
$search
,
$replace
,
$this
->
Value
)
:
""
;
return
(
is_string
(
$this
->
Value
))
?
str_replace
(
$search
,
$replace
,
$this
->
Value
)
:
""
;
}
}
public
function
explode
(
$delimiter
)
public
function
explode
(
$delimiter
)
{
{
return
(
is_string
(
$this
->
Value
))
?
explode
(
$delimiter
,
$this
->
Value
)
:
[];
return
(
is_string
(
$this
->
Value
))
?
explode
(
$delimiter
,
$this
->
Value
)
:
[];
}
}
public
function
int
()
public
function
int
()
{
{
if
(
$this
->
Default
===
false
)
{
if
(
$this
->
Default
===
false
)
$this
->
Default
=
0
;
$this
->
Default
=
0
;
}
return
intval
(
$this
->
Value
);
return
intval
(
$this
->
Value
);
}
}
public
function
numeric
()
public
function
numeric
()
{
{
return
(
is_numeric
(
$this
->
Value
))
?
$this
->
Value
:
0
;
return
(
is_numeric
(
$this
->
Value
))
?
$this
->
Value
:
0
;
}
}
public
function
float
()
public
function
float
()
{
{
return
floatval
(
$this
->
Value
);
return
floatval
(
$this
->
Value
);
}
}
public
function
string
()
public
function
string
()
{
{
return
strval
(
$this
->
Value
);
return
strval
(
$this
->
Value
);
}
}
public
function
json_decode
()
public
function
json_decode
()
{
{
if
(
$this
->
Value
==
null
)
{
if
(
$this
->
Value
==
null
)
return
null
;
return
null
;
if
(
$this
->
Value
==
false
)
return
false
;
}
return
json_decode
(
$this
->
Value
,
true
);
if
(
$this
->
Value
==
false
)
{
return
false
;
}
return
json_decode
(
$this
->
Value
,
true
);
}
}
public
function
RequestValue
(
$Name
,
$Default
=
false
)
public
function
RequestValue
(
$Name
,
$Default
=
false
)
{
{
return
$this
->
Request
(
$Name
,
$Default
)
->
Value
;
return
$this
->
Request
(
$Name
,
$Default
)
->
Value
;
}
}
public
function
Request
(
$Name
,
$Default
=
false
)
public
function
Request
(
$Name
,
$Default
=
false
)
{
{
return
(
new
X_Input_RequestItem
(
$Name
,
$Default
));
return
(
new
X_Input_RequestItem
(
$Name
,
$Default
));
}
}
public
function
PostValue
(
$Name
,
$Default
=
false
)
public
function
PostValue
(
$Name
,
$Default
=
false
)
{
{
return
$this
->
Post
(
$Name
,
$Default
)
->
Value
;
return
$this
->
Request
(
$Name
,
$Default
)
->
Value
;
}
}
public
function
Post
(
$Name
,
$Default
=
false
)
public
function
Post
(
$Name
,
$Default
=
false
)
{
{
return
(
new
X_Input_MethodPostItem
(
$Name
,
$Default
));
return
(
new
X_Input_MethodPostItem
(
$Name
,
$Default
));
}
}
public
function
GetValue
(
$Name
,
$Default
=
false
)
public
function
GetValue
(
$Name
,
$Default
=
false
)
{
{
return
$this
->
Get
(
$Name
,
$Default
)
->
Value
;
return
$this
->
Get
(
$Name
,
$Default
)
->
Value
;
}
}
public
function
Get
(
$Name
,
$Default
=
false
)
public
function
Get
(
$Name
,
$Default
=
false
)
{
{
return
(
new
X_Input_MethodGetItem
(
$Name
,
$Default
));
return
(
new
X_Input_MethodGetItem
(
$Name
,
$Default
));
}
}
public
function
CookieValue
(
$Name
,
$Default
=
false
)
public
function
CookieValue
(
$Name
,
$Default
=
false
)
{
{
return
$this
->
Cookie
(
$Name
,
$Default
)
->
Value
;
return
$this
->
Cookie
(
$Name
,
$Default
)
->
Value
;
}
}
public
function
Cookie
(
$Name
,
$Default
=
false
)
public
function
Cookie
(
$Name
,
$Default
=
false
)
{
{
return
(
new
X_Input_MethodCookieItem
(
$Name
,
$Default
));
return
(
new
X_Input_MethodCookieItem
(
$Name
,
$Default
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment