Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
952bfb6e
Commit
952bfb6e
authored
Feb 24, 2020
by
Carsten Rose
Browse files
Refs #9517: TypeAhead - escaping ':' ',' partly implemented.
parent
6a4a04e4
Pipeline
#3322
passed with stages
in 3 minutes and 49 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/AbstractBuildForm.php
View file @
952bfb6e
...
...
@@ -1363,23 +1363,13 @@ abstract class AbstractBuildForm {
$attribute
.
=
Support
::
doAttribute
(
DATA_TYPEAHEAD_TAG_DELIMITER
,
$kk
);
$formElement
[
FE_INPUT_TYPE
]
=
'hidden'
;
// TAG handling expects the '$value' as a JSON string.
// Old, much to complicated
$kk
=
KeyValueStringParser
::
parse
(
$value
,
':'
,
','
,
KVP_IF_VALUE_EMPTY_COPY_KEY
);
// Client: TAG handling expects the '$value' as a JSON string.
$kk
=
KeyValueStringParser
::
parse
(
$value
,
PARAM_KEY_VALUE_DELIMITER
,
PARAM_LIST_DELIMITER
,
KVP_IF_VALUE_EMPTY_COPY_KEY
);
$jj
=
''
;
foreach
(
$kk
as
$arrKey
=>
$arrValue
)
{
$jj
.
=
','
.
json_encode
([
"key"
=>
$arrKey
,
"value"
=>
$arrValue
]);
}
$value
=
'['
.
substr
(
$jj
,
1
)
.
']'
;
// $tags = [
// ['value' => "Alabama", 'key' => "AL"],
// ['value' => "Alaska", 'key' => "AK"]
// ];
// $tagsSafeJson = htmlentities(json_encode($tags), ENT_QUOTES, 'UTF-8');
//
// $tags1=KeyValueStringParser::parse($value, ':', ',', KVP_IF_VALUE_EMPTY_COPY_KEY);
// $tags1SafeJson = htmlentities(json_encode($tags1), ENT_QUOTES, 'UTF-8');
}
}
...
...
@@ -1460,6 +1450,7 @@ abstract class AbstractBuildForm {
}
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
FE_TYPE
,
'size'
]);
$attribute
.
=
Support
::
doAttribute
(
'value'
,
htmlentities
(
$value
),
false
);
// $attribute .= Support::doAttribute('value', htmlentities($value, ENT_QUOTES, 'UTF-8'), false);
}
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
FE_INPUT_AUTOCOMPLETE
,
'autofocus'
,
'placeholder'
]);
...
...
extension/Classes/Core/Constants.php
View file @
952bfb6e
...
...
@@ -1741,6 +1741,9 @@ const QUESTION_INDEX_FLAG_MODAL = 5;
const
PARAM_DELIMITER
=
'|'
;
const
PARAM_TOKEN_DELIMITER
=
':'
;
const
PARAM_LIST_DELIMITER
=
','
;
const
PARAM_KEY_VALUE_DELIMITER
=
':'
;
const
TOKEN_URL
=
'u'
;
const
TOKEN_MAIL
=
'm'
;
const
TOKEN_PAGE
=
'p'
;
...
...
extension/Classes/Core/Helper/KeyValueStringParser.php
View file @
952bfb6e
...
...
@@ -41,7 +41,8 @@ class KeyValueStringParser {
*
* @return string
*/
public
static
function
unparse
(
array
$keyValueArray
,
$keyValueDelimiter
=
":"
,
$listDelimiter
=
","
)
{
public
static
function
unparse
(
array
$keyValueArray
,
$keyValueDelimiter
=
PARAM_KEY_VALUE_DELIMITER
,
$listDelimiter
=
PARAM_LIST_DELIMITER
,
$flagEscape
=
false
)
{
array_walk
(
$keyValueArray
,
function
(
&
$value
)
{
if
(
!
is_string
(
$value
)
||
$value
===
""
||
strlen
(
$value
)
===
1
)
{
return
;
...
...
@@ -54,6 +55,13 @@ class KeyValueStringParser {
$newKeyValuePairImploded
=
array
();
foreach
(
$keyValueArray
as
$key
=>
$value
)
{
if
(
$flagEscape
)
{
$key
=
str_replace
(
$keyValueDelimiter
,
'\\'
.
$keyValueDelimiter
,
$key
);
$key
=
str_replace
(
$listDelimiter
,
'\\'
.
$listDelimiter
,
$key
);
$value
=
str_replace
(
$keyValueDelimiter
,
'\\'
.
$keyValueDelimiter
,
$value
);
$value
=
str_replace
(
$listDelimiter
,
'\\'
.
$listDelimiter
,
$value
);
}
$newKeyValuePairImploded
[]
=
trim
(
$key
)
.
$keyValueDelimiter
.
$value
;
}
...
...
extension/Classes/Core/Store/FillStoreForm.php
View file @
952bfb6e
...
...
@@ -304,7 +304,7 @@ class FillStoreForm {
$arrValue
=
$this
->
doValue
(
$formElement
,
$formMode
,
$row
[
'value'
]);
$arrTmp
[
$arrKey
]
=
$arrValue
;
}
$val
=
KeyValueStringParser
::
unparse
(
$arrTmp
);
$val
=
KeyValueStringParser
::
unparse
(
$arrTmp
,
PARAM_KEY_VALUE_DELIMITER
,
PARAM_LIST_DELIMITER
,
true
);
}
else
{
// Single Value
...
...
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