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);
|
||||
if($oembed instanceof File_oembed) {
|
||||
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
|
||||
if($oembed->provider == 'Twitter' && strstr($oembed_html, '<div>—')) {
|
||||
$oembed_html = substr($oembed_html,0,strpos($oembed_html, '<div>—')); // remove user data from twitter oembed html (we have it in )
|
||||
$twitter_username = substr($oembed->html,strpos($oembed->html, '<div>—')+12);
|
||||
error_log('$oembed_html: '.$oembed_html);
|
||||
if($oembed->provider == 'Twitter' && strstr($oembed_html, '>— '.$oembed->author_name)) {
|
||||
$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, 0,strpos($twitter_username,')'));
|
||||
$oembed->title = $twitter_username;
|
||||
|
|
Loading…
Reference in New Issue
Block a user