patches for youtube's change in link and embed formats, please test
This commit is contained in:
parent
5f20925220
commit
0abf2f11c6
|
@ -94,7 +94,11 @@ function bbcode($Text,$preserve_nl = false) {
|
||||||
|
|
||||||
// Youtube extensions
|
// Youtube extensions
|
||||||
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
|
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
|
||||||
$Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
|
$Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
|
||||||
|
|
||||||
|
$Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<iframe width="425" height="349" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $Text);
|
||||||
|
|
||||||
|
// $Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
|
||||||
|
|
||||||
// oembed tag
|
// oembed tag
|
||||||
$Text = oembed_bbcode2html($Text);
|
$Text = oembed_bbcode2html($Text);
|
||||||
|
|
|
@ -354,6 +354,9 @@ function get_atom_elements($feed,$item) {
|
||||||
$res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $res['body']);
|
'[youtube]$1[/youtube]', $res['body']);
|
||||||
|
|
||||||
|
$res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/[A-Za-z0-9\-_=]+).+?</iframe>#s',
|
||||||
|
'[youtube]$1[/youtube]', $res['body']);
|
||||||
|
|
||||||
$res['body'] = oembed_html2bbcode($res['body']);
|
$res['body'] = oembed_html2bbcode($res['body']);
|
||||||
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
|
@ -521,6 +524,10 @@ function get_atom_elements($feed,$item) {
|
||||||
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $body);
|
'[youtube]$1[/youtube]', $body);
|
||||||
|
|
||||||
|
$res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/[A-Za-z0-9\-_=]+).+?</iframe>#s',
|
||||||
|
'[youtube]$1[/youtube]', $res['body']);
|
||||||
|
|
||||||
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
$config->set('Cache.DefinitionImpl', null);
|
$config->set('Cache.DefinitionImpl', null);
|
||||||
|
|
||||||
|
@ -560,6 +567,9 @@ function get_atom_elements($feed,$item) {
|
||||||
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $body);
|
'[youtube]$1[/youtube]', $body);
|
||||||
|
|
||||||
|
$res['body'] = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/[A-Za-z0-9\-_=]+).+?</iframe>#s',
|
||||||
|
'[youtube]$1[/youtube]', $res['body']);
|
||||||
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
$config->set('Cache.DefinitionImpl', null);
|
$config->set('Cache.DefinitionImpl', null);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ function update_network_content(&$a) {
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
|
||||||
|
|
||||||
echo str_replace("\t",' ',$text);
|
echo str_replace("\t",' ',$text);
|
||||||
|
|
|
@ -45,6 +45,8 @@ function update_profile_content(&$a) {
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||||
$text = preg_replace($pattern, $replace, $text);
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
|
* reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
|
||||||
|
|
Loading…
Reference in a new issue