'node', 'W' => 'way', 'R' => 'relation'][ substr($locationOsmid, 0, 1) ] . '/' . substr($locationOsmid, 1); } elseif (!empty($locationGeo)) { $uri = 'https://www.openstreetmap.org/#map=17/' . str_replace(',', '/', substr($locationGeo, 4)); } elseif (!empty($locationName)) { $uri = 'https://www.openstreetmap.org/search?query=' . urlencode($locationName); } return $uri; } } //-------------------------------------------------------------------- if (!function_exists('extract_params_from_episode_uri')) { /** * Returns podcast name and episode slug from episode string uri * * @param URI $episodeUri * @return string|null */ function extract_params_from_episode_uri($episodeUri) { preg_match( '/@(?P[a-zA-Z0-9\_]{1,32})\/episodes\/(?P[a-zA-Z0-9\-]{1,191})/', $episodeUri->getPath(), $matches, ); if ( $matches && array_key_exists('podcastName', $matches) && array_key_exists('episodeSlug', $matches) ) { return [ 'podcastName' => $matches['podcastName'], 'episodeSlug' => $matches['episodeSlug'], ]; } return null; } }