function find_intl_properties($schema_obj, $base_path = '') { $intl_properties = array(); foreach ($schema_obj as $key => $value) { if ($key == "schedule") { continue; } if ($key != "properties") { //Denote array in the path with a "*" if ($key == "items") { $path = $base_path . "*"; } else { $path = $base_path . $key; } } else { $path = $base_path; } if (isset($value->id) and gettype($value->id) == "string") { //if ($value->title == "Internationalized string" or $value->title == "Internationalized URI") if (strpos($value->id, "intl_string") != FALSE or strpos($value->id, "intl_uri") != FALSE) { $intl_properties[] = $path; continue; } } if (is_object($value)) { if (substr($path, -1) != ".") { $path = $path . "."; } $intl_p = find_intl_properties($value, $path); $intl_properties = array_merge($intl_properties, $intl_p); } } return $intl_properties; }
function filter_poi_intl_properties(&$pois_data, $langs) { $pois =& $pois_data['pois']; $schema = load_poi_schema(); $intl_properties = find_intl_properties($schema->properties); // var_dump($intl_properties); foreach ($pois as &$poi) { foreach ($poi as &$poi_data_comp) { if (isset($poi_data_comp['last_update'])) { unset($poi_data_comp['last_update']); } } foreach ($intl_properties as $intl_prop) { $prop_values = get_arr_ref_by_path($poi, $intl_prop); foreach ($prop_values as &$prop_val) { $prop_val = filter_intl_string_by_langs($prop_val, $langs); } } } }