Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
e797d377
Commit
e797d377
authored
May 30, 2017
by
Côme Chilliet
Browse files
Fixes
#5554
Added feature to trim value in string attributes
parent
e1958962
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/simpleplugin/attributes/class_StringAttribute.inc
View file @
e797d377
...
...
@@ -26,6 +26,7 @@ class StringAttribute extends Attribute
protected
$pattern
;
protected
$example
;
protected
$autocomplete
=
NULL
;
protected
$trim
=
FALSE
;
/*! \brief The constructor of StringAttribute
*
...
...
@@ -105,6 +106,23 @@ class StringAttribute extends Attribute
{
return
$this
->
autocomplete
;
}
function
setValue
(
$value
)
{
if
(
$this
->
trim
)
{
return
parent
::
setValue
(
trim
(
$value
));
}
else
{
return
parent
::
setValue
(
$value
);
}
}
}
/*! \brief This class allow to handle easily a String LDAP attribute that appears as a text area
*
*/
class
TrimmedStringAttribute
extends
StringAttribute
{
protected
$trim
=
TRUE
;
}
/*! \brief This class allow to handle easily a String LDAP attribute that appears as a text area
...
...
include/simpleplugin/class_helpersAttribute.inc
View file @
e797d377
...
...
@@ -23,6 +23,8 @@
*/
class
MailAttribute
extends
StringAttribute
{
protected
$trim
=
TRUE
;
function
validate
()
{
if
(
!
tests
::
is_email
(
$this
->
value
))
{
...
...
@@ -69,6 +71,8 @@ class UidAttribute extends TestValidateAttribute
*/
class
PathAttribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_path'
;
}
...
...
@@ -77,6 +81,8 @@ class PathAttribute extends TestValidateAttribute
*/
class
URLAttribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_url'
;
}
...
...
@@ -85,6 +91,8 @@ class URLAttribute extends TestValidateAttribute
*/
class
PhoneNumberAttribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_phone_nr'
;
}
...
...
@@ -93,6 +101,8 @@ class PhoneNumberAttribute extends TestValidateAttribute
*/
class
IPAttribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_ip'
;
}
...
...
@@ -101,6 +111,8 @@ class IPAttribute extends TestValidateAttribute
*/
class
IPv4Attribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_ipv4'
;
}
...
...
@@ -109,6 +121,8 @@ class IPv4Attribute extends TestValidateAttribute
*/
class
IPv6Attribute
extends
TestValidateAttribute
{
protected
$trim
=
TRUE
;
protected
$testFunc
=
'is_ipv6'
;
}
...
...
@@ -117,6 +131,8 @@ class IPv6Attribute extends TestValidateAttribute
*/
class
MacAddressAttribute
extends
StringAttribute
{
protected
$trim
=
TRUE
;
function
setValue
(
$value
)
{
return
parent
::
setValue
(
strtolower
(
$value
));
...
...
Jonathan Swaelens
@jswaelens
mentioned in issue
#1770 (closed)
·
Sep 02, 2017
mentioned in issue
#1770 (closed)
mentioned in issue #1770
Toggle commit list
Write
Preview
Supports
Markdown
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