Commit 2d4bc42f authored by Thomas's avatar Thomas
Browse files

fix an issue with main Mastodon URL

parent 224151b7
...@@ -97,7 +97,8 @@ class CollectMastodonData { ...@@ -97,7 +97,8 @@ class CollectMastodonData {
if (isset($searchResult['html']['statuses'])) { if (isset($searchResult['html']['statuses'])) {
foreach ($searchResult['html']['statuses'] as $status) { foreach ($searchResult['html']['statuses'] as $status) {
if ($status['in_reply_to_id'] === null) { if ($status['in_reply_to_id'] === null) {
$result[] = $status['id']; $result['id'][] = $status['id'];
$result['url'][] = $status['url'];
} }
} }
} }
......
...@@ -744,7 +744,6 @@ class Mastodon_api { ...@@ -744,7 +744,6 @@ class Mastodon_api {
*/ */
public function search ($parameters) { public function search ($parameters) {
$response = $this->_get('/api/v1/search',$parameters); $response = $this->_get('/api/v1/search',$parameters);
return $response; return $response;
} }
......
...@@ -118,6 +118,11 @@ class Mastalab_comments_Public { ...@@ -118,6 +118,11 @@ class Mastalab_comments_Public {
} }
/**
* Add a div at the end of the article when defined in settings
*
* @since 1.0.9
*/
public function mastalab_comments_add_to_footer(){ public function mastalab_comments_add_to_footer(){
$fullcontent = get_the_content(); $fullcontent = get_the_content();
if(is_page() || is_single()) { if(is_page() || is_single()) {
...@@ -229,7 +234,6 @@ class Mastalab_comments_Public { ...@@ -229,7 +234,6 @@ class Mastalab_comments_Public {
*/ */
public function prefix_ajax_mastalab_comments_getcomment(){ public function prefix_ajax_mastalab_comments_getcomment(){
@define('ROOTPATH', __DIR__); @define('ROOTPATH', __DIR__);
require_once(ROOTPATH.'/../Class/CollectMastodonData.php'); require_once(ROOTPATH.'/../Class/CollectMastodonData.php');
...@@ -272,14 +276,18 @@ class Mastalab_comments_Public { ...@@ -272,14 +276,18 @@ class Mastalab_comments_Public {
$needRefresh = true; $needRefresh = true;
} }
if ($needRefresh) { if ($needRefresh) {
$ids = $collector->findToots($search); $data = $collector->findToots($search);
$result['stats']['root'] = isset($ids[0]) ? $ids[0] : 0; $inc = 0;
foreach ($ids as $id) { foreach ($data['id'] as $id) {
$result['stats']['root'] = $id;
// get comments // get comments
$collector->getComments($id, $result); $collector->getComments($id, $result);
// get statistics (likes, replies, boosts,...) // get statistics (likes, replies, boosts,...)
$collector->getStatistics($id, $result); $collector->getStatistics($id, $result);
$result['stats']['replies'] = count($result['comments']); $result['stats']['replies'] = count($result['comments']);
$result['stats']['url'] = $data['url'][$inc];
$inc++;
} }
$dateInsert = new DateTime(); $dateInsert = new DateTime();
//Cache the status //Cache the status
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment