Created
January 26, 2016 14:03
-
-
Save dededey/88b352017c1739b3e225 to your computer and use it in GitHub Desktop.
rewrite the youtube vimeo url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function to rewrite the VIMEO YOUTUBE URL | |
function mod_url($url){ | |
$yt = strpos($url, 'youtube'); | |
$vim = strpos($url, 'vimeo'); | |
if($yt): | |
$url = str_replace("watch?v=","v/",$url); | |
endif; | |
if($vim): | |
$url = str_replace("vimeo.com","player.vimeo.com/video",$url); | |
endif; | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment