Project

General

Profile

Bug #57824 » patch-1.patch

Christian Ludwig, 2014-11-10 22:59

View differences:

typo3\sysext\core\Classes\Utility\ExtensionManagementUtility.php
*/
static protected function removeDuplicatesForInsertion($insertionList, $list = '') {
$insertionListParts = preg_split('/\\s*,\\s*/', $insertionList);
$cleanInsertionListParts = array();
foreach ($insertionListParts as $fieldName) {
if ($fieldName == '--linebreak--' || !in_array($fieldName, $cleanInsertionListParts)) {
$cleanInsertionListParts[] = $fieldName;
}
}
$cleanInsertionList = implode(', ', $cleanInsertionListParts);
$insertionList = implode(', ', array_unique($insertionListParts));
if ($list === '') {
return $cleanInsertionList;
return $insertionList;
}
// Get a list of fieldNames that are present in the list.
preg_match_all('/(?:^|,)\\s*\\b([^;,]+)\\b[^,]*/', $list, $listMatches);
// Remove the field names from the insertionlist.
$fieldReplacePatterns = array();
foreach ($listMatches[1] as $fieldName) {
if ($fieldName != '--linebreak--') {
$fieldReplacePatterns[] = '/(?:^|,)\\s*\\b' . preg_quote($fieldName, '/') . '\\b[^,$]*/';
}
return preg_replace($fieldReplacePatterns, '', $insertionList);
}
return preg_replace($fieldReplacePatterns, '', $cleanInsertionList);
}
/**
* Generates search needles that are used for inserting fields/items into an existing list.
(1-1/2)