Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
69f3eac4
Commit
69f3eac4
authored
Oct 11, 2018
by
Elias Villiger
Browse files
B3850 - Change set input maxlength - refs #3850, closes #3850
parent
8203e8f7
Pipeline
#985
passed with stage
in 1 minute and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/helper/Support.php
View file @
69f3eac4
...
...
@@ -1093,27 +1093,34 @@ class Support {
}
/**
* Get the strlen of the longest element in enum('val1','val2',...,'valn') or set('val1','val2',...,'valn')
* Get the strlen of the longest element in enum('val1','val2',...,'valn')
* or the maximum total length of a set('val1','val2',...,'valn')
*
* @param string $typeSpec
*
* @return int
*/
private
static
function
maxLengthSetEnum
(
$typeSpec
)
{
$startPos
=
(
substr
(
$typeSpec
,
0
,
4
)
===
'set('
)
?
4
:
5
;
$isSet
=
substr
(
$typeSpec
,
0
,
4
)
===
'set('
;
$startPos
=
$isSet
?
4
:
5
;
$max
=
0
;
$valueList
=
substr
(
$typeSpec
,
$startPos
,
strlen
(
$typeSpec
)
-
$startPos
-
1
);
$valueArr
=
explode
(
','
,
$valueList
);
foreach
(
$valueArr
as
$value
)
{
$value
=
trim
(
$value
,
"'"
);
$len
=
strlen
(
$value
);
if
(
$len
>
$max
)
{
$max
=
$len
;
if
(
$isSet
)
{
// set
return
strlen
(
implode
(
', '
,
$valueArr
));
}
else
{
// enum
foreach
(
$valueArr
as
$value
)
{
$value
=
trim
(
$value
,
"'"
);
$len
=
strlen
(
$value
);
if
(
$len
>
$max
)
{
$max
=
$len
;
}
}
}
return
$max
;
return
$max
;
}
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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