diff --git a/bridges/FB2Bridge.php b/bridges/FB2Bridge.php index 7187c2c6..8607cf50 100644 --- a/bridges/FB2Bridge.php +++ b/bridges/FB2Bridge.php @@ -97,8 +97,14 @@ EOD; $item = array(); - $item['uri'] = 'http://touch.facebook.com' - . $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'); + preg_match('/publish_time\\\":([0-9]+),/', $content->getAttribute('data-store', 0), $match); + if(isset($match[1])) + $timestamp = $match[1]; + else + $timestamp = 0; + + $item['uri'] = html_entity_decode('http://touch.facebook.com' + . $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES); if($content->find('header', 0) !== null) { $content->find('header', 0)->innertext = ''; @@ -135,7 +141,7 @@ EOD; // "smile emoticon" back to ASCII emoticons eg ":)" $content = preg_replace_callback('/([^ <>]+) ([^<>]+)<\/u><\/i>/i', $unescape_fb_emote, $content); - $item['content'] = $content; + $item['content'] = html_entity_decode($content, ENT_QUOTES); $title = $author; if (strlen($title) > 24) @@ -144,10 +150,12 @@ EOD; if (strlen($title) > 64) $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...'; - $item['title'] = $title; - $item['author'] = $author; + $item['title'] = html_entity_decode($title, ENT_QUOTES); + $item['author'] = html_entity_decode($author, ENT_QUOTES); + $item['timestamp'] = html_entity_decode($timestamp, ENT_QUOTES); - array_push($this->items, $item); + if($item['timestamp'] != 0) + array_push($this->items, $item); } } @@ -194,7 +202,7 @@ EOD; // /div>","replaceifexists $regex = '/\\"html\\":(\".+\/div>"),"replace/'; preg_match($regex, $pageContent, $result); - return str_get_html(html_entity_decode(json_decode($result[1]))); + return str_get_html(json_decode($result[1])); }