I actually caved in and wrote a snip for youtube embedding. Embedding is slightly annoying though hehe, but i figured why the hell not.
The code looks like this and its ugly, very very ugly:
In the file DATA_ROOT/src/post_proc.inc.t
After the part that contains:
case 'wikipedia':
bla bla
break;
case 'youtube':
$url = substr($str, $epos+1, $cpos-1-$epos);
$url = str_replace("/watch?v=","",$url);
$url = str_replace("www.","",$url);
$url = str_replace("http://","",$url);
$url = str_replace("/v/","",$url);
$url = str_replace("youtube.com","",$url);
$url = substr($url, 0, strpos("$url&", "&"));
$url = substr($url, 0, strpos("$url%", "%"));
$ostr .= '<object width="720" height="480"><param name="movie" value="http://www.youtube.com/v/'.$url.'"></param><embed src="http://www.youtube.com/v/'.$url.'&fs=1&hd=1&iv_load_policy=3&color1=0x999999&color2=0xF3F2E7" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="720" height="480"></embed></object>';
$epos = $cepos;
break;
and then after:
array(
'[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[sub]', '[/sub]', '[sup]', '[/sup]', '[del]', '[/del]',
'[code]', '[/code]', '[align=center]', '[align=left]', '[align=right]', '[/align]', '[list]', '[/list]',
'[notag]', '[/notag]', '[*]', '@', '://', '', '[pre]', '[/pre]','[hr]'
),
$fudml);
input
while (preg_match('!<object width="720" height="480"><param name="movie" value="(.*?)"></param><embed src="(.*?)" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="720" height="480"></embed></object>!is', $fudml)) {
$fudml = preg_replace('!<object width="720" height="480"><param name="movie" value="(.*?)"></param><embed src="(.*?)" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="720" height="480"></embed></object>!is', '[youtube]\1[/youtube]', $fudml);
}
Ginnunga Gaming
[Updated on: Sun, 30 May 2010 14:58] Report message to a moderator
|