[FacebookBridge] Fix permalink issue (#1358)
Facebook has changed their strategy regarding permalinks, which now include lots of unnecessary target data. Fortunately it also contains the unique story id which we can utilize as URI.
This commit is contained in:
parent
375831f516
commit
df9f7eb778
1 changed files with 9 additions and 2 deletions
|
@ -701,8 +701,15 @@ EOD;
|
||||||
|
|
||||||
$uri = $post->find('abbr')[0]->parent()->getAttribute('href');
|
$uri = $post->find('abbr')[0]->parent()->getAttribute('href');
|
||||||
|
|
||||||
if (false !== strpos($uri, '?')) {
|
// Extract fbid and patch link
|
||||||
$uri = substr($uri, 0, strpos($uri, '?'));
|
if (strpos($uri, '?') !== false) {
|
||||||
|
$query = substr($uri, strpos($uri, '?') + 1);
|
||||||
|
parse_str($query, $query_params);
|
||||||
|
if (isset($query_params['story_fbid'])) {
|
||||||
|
$uri = self::URI . $query_params['story_fbid'];
|
||||||
|
} else {
|
||||||
|
$uri = substr($uri, 0, strpos($uri, '?'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Build and add final item
|
//Build and add final item
|
||||||
|
|
Loading…
Reference in a new issue