mirror of
https://github.com/friendica/friendica
synced 2025-04-27 16:30:10 +00:00
Relocated function
This commit is contained in:
parent
34cb0aa406
commit
0d51474e73
2 changed files with 54 additions and 53 deletions
|
@ -65,4 +65,39 @@ class JsonLD
|
|||
|
||||
return json_decode(json_encode($compacted), true);
|
||||
}
|
||||
|
||||
public static function fetchElement($array, $element, $key, $type = null, $type_value = null)
|
||||
{
|
||||
if (empty($array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($array[$element])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_string($array[$element])) {
|
||||
return $array[$element];
|
||||
}
|
||||
|
||||
if (is_null($type_value)) {
|
||||
if (!empty($array[$element][$key])) {
|
||||
return $array[$element][$key];
|
||||
}
|
||||
|
||||
if (!empty($array[$element][0][$key])) {
|
||||
return $array[$element][0][$key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($array[$element][$key]) && !empty($array[$element][$type]) && ($array[$element][$type] == $type_value)) {
|
||||
return $array[$element][$key];
|
||||
}
|
||||
|
||||
/// @todo Add array search
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue