2 namespace TYPO3\CMS\Lowlevel\Utility;
96 public function tree($array, $positionKey, $depthData = null)
99 GeneralUtility::deprecationLog(
'ArrayBrowser::tree parameter $depthData is deprecated since TYPO3 CMS 7 and is not used anymore. Please remove the parameter.');
101 $output =
'<ul class="list-tree text-monospace">';
103 $positionKey = $positionKey .
'.';
105 foreach ($array as $key => $value) {
106 $depth = $positionKey . $key;
107 if (is_object($value) && !$value instanceof \Traversable) {
108 $value = (array)$value;
110 $isArray = is_array($value) || $value instanceof \Traversable;
111 $isResult = (bool)$this->searchKeys[$depth];
113 $output .=
'<li' . ($isResult ?
' class="active"' :
'') .
'>';
114 if ($isArray && !$this->expAll) {
115 $goto =
'a' . substr(md5($depth), 0, 6);
116 $output .=
'<a class="list-tree-control' . ($isExpanded ?
' list-tree-control-open' :
' list-tree-control-closed') .
'" id="' . $goto .
'" href="' . htmlspecialchars((BackendUtility::getModuleUrl(
GeneralUtility::_GP(
'M')) .
'&node[' . $depth .
']=' . ($isExpanded ? 0 : 1) .
'#' . $goto)) .
'"><i class="fa"></i></a> ';
118 $output .=
'<span class="list-tree-group">';
119 $output .= $this->
wrapArrayKey($key, $depth, !$isArray ? $value :
'');
121 $output .=
' = <span class="list-tree-value">' . $this->
wrapValue($value) .
'</span>';
123 $output .=
'</span>';
125 $output .= $this->
tree(
145 if ((
string)$theValue !==
'') {
146 $wrappedValue = htmlspecialchars($theValue);
148 return $wrappedValue;
162 $label = htmlspecialchars($label);
165 if ($this->varName && !$this->dontLinkVar) {
166 $variableName = $this->varName
167 .
'[\'' . str_replace(
'.',
'\'][\
'', $depth) .
'\'] =
'
168 . (!MathUtility::canBeInterpretedAsInteger($theValue) ? '\
''
169 . addslashes($theValue) .
'\'' : $theValue) .
'; ';
170 $label =
'<a class="list-tree-label" href="'
172 .
'&varname=' . urlencode($variableName)))
173 .
'#varname">' . $label .
'</a>';
175 return '<span class="list-tree-label">' . $label .
'</span>';
191 $depth_in = $depth_in .
'.';
193 foreach ($keyArr as $key => $value) {
194 $depth = $depth_in . $key;
195 $deeper = is_array($keyArr[$key]);
196 if ($this->regexMode) {
198 is_scalar($keyArr[$key]) && preg_match(
'/' . $searchString .
'/', $keyArr[$key])
199 || $this->searchKeysToo && preg_match(
'/' . $searchString .
'/', $key)
201 $this->searchKeys[$depth] = 1;
205 is_scalar($keyArr[$key]) && stristr($keyArr[$key], $searchString)
206 || $this->searchKeysToo && stristr($key, $searchString)
208 $this->searchKeys[$depth] = 1;
212 $cS = count($this->searchKeys);
213 $keyArray = $this->
getSearchKeys($keyArr[$key], $depth, $searchString, $keyArray);
214 if ($cS != count($this->searchKeys)) {
215 $keyArray[$depth] = 1;
231 $tsbrArray = array();
232 foreach ($arr as $theK => $theV) {
233 $theKeyParts = explode(
'.', $theK);
235 $c = count($theKeyParts);
237 foreach ($theKeyParts as $p) {
239 $depth .= ($depth ?
'.' :
'') . $p;
240 $tsbrArray[$depth] = $c == $a ? $theV : 1;
244 foreach ($tsbrArray as $theK => $theV) {
246 $settings[$theK] = 1;
248 unset($settings[$theK]);