/** * parse vimeo url * * @param string $url * @return string hash */ function ossn_embed_vimeo_parse_url($url) { // separate parsing embed url if (strpos($url, 'object') != false) { return ossn_embed_vimeo_parse_embed($url); } if (strpos($url, 'groups') != false) { if (!preg_match('/(https?:\\/\\/)(www\\.)?(vimeo\\.com\\/groups)(.*)(\\/videos\\/)([0-9]*)/', $url, $matches)) { //echo "malformed vimeo group url"; return; } $hash = $matches[6]; } else { if (!preg_match('/(http:\\/\\/)(www\\.)?(vimeo.com\\/)([0-9]*)/', $url, $matches)) { //echo "malformed vimeo url"; return; } $hash = $matches[4]; } //echo $hash; return $hash; }
/** * parse vimeo url * * @param string $url * @return string hash */ function ossn_embed_vimeo_parse_url($url) { // separate parsing embed url if (strpos($url, 'object') != false) { return ossn_embed_vimeo_parse_embed($url); } if (strpos($url, 'groups') != false) { if (!preg_match('/(https?:\\/\\/)(www\\.)?(vimeo\\.com\\/groups)(.*)(\\/videos\\/)([0-9]*)/', $url, $matches)) { //echo "malformed vimeo group url"; return; } return $matches[6]; } if (preg_match('/(http:\\/\\/)(www\\.)?(vimeo.com\\/)([0-9]*)/', $url, $matches)) { // this one seems to be obsolete return $matches[4]; } if (preg_match('/(https:\\/\\/)(player\\.)?(vimeo.com\\/video\\/)([0-9]*)/', $url, $matches)) { // at least this one is working for me entering // https://player.vimeo.com/video/xxxxxxxx return $matches[4]; } }