better parsing of twitter's oembed data
This commit is contained in:
parent
2994d86045
commit
ded4c6aceb
|
@ -519,9 +519,10 @@ class QvitterPlugin extends Plugin {
|
||||||
$oembed = File_oembed::getKV('file_id',$attachment->id);
|
$oembed = File_oembed::getKV('file_id',$attachment->id);
|
||||||
if($oembed instanceof File_oembed) {
|
if($oembed instanceof File_oembed) {
|
||||||
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
|
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
|
||||||
if($oembed->provider == 'Twitter' && strstr($oembed_html, '<div>—')) {
|
error_log('$oembed_html: '.$oembed_html);
|
||||||
$oembed_html = substr($oembed_html,0,strpos($oembed_html, '<div>—')); // remove user data from twitter oembed html (we have it in )
|
if($oembed->provider == 'Twitter' && strstr($oembed_html, '>— '.$oembed->author_name)) {
|
||||||
$twitter_username = substr($oembed->html,strpos($oembed->html, '<div>—')+12);
|
$oembed_html = substr($oembed_html,0,strpos($oembed_html, '>— '.$oembed->author_name)+1); // remove user data from twitter oembed html (we have it in )
|
||||||
|
$twitter_username = substr($oembed->html,strpos($oembed->html, '>— '.$oembed->author_name)+strlen('>— '.$oembed->author_name));
|
||||||
$twitter_username = substr($twitter_username, strpos($twitter_username,'(@')+1);
|
$twitter_username = substr($twitter_username, strpos($twitter_username,'(@')+1);
|
||||||
$twitter_username = substr($twitter_username, 0,strpos($twitter_username,')'));
|
$twitter_username = substr($twitter_username, 0,strpos($twitter_username,')'));
|
||||||
$oembed->title = $twitter_username;
|
$oembed->title = $twitter_username;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user