Last active
January 3, 2016 01:19
-
-
Save Mad182/8388401 to your computer and use it in GitHub Desktop.
yt embed
This file contains 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 embed_youtube($params) { | |
var_dump($params); | |
//druka ārā embed kodu, | |
//var atvilkt title un sīkbildi caur api, | |
//pieglabāt lokāli, vai ko nu katram vajag | |
} | |
$txt = preg_replace_callback("#(^|[\n ]|<a(.*?)>)https?://(www\.)?youtube\.com/watch\?v=([a-zA-Z0-9\-_]+)((.*?)</a>)?#im", embed_youtube, $txt); | |
$txt = preg_replace_callback("#(^|[\n ]|<a(.*?)>)https?://(www\.)?youtu\.be/([a-zA-Z0-9\-_]+)((.*?)</a>)?#im", embed_youtube, $txt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment