$ids = array_reverse($ids);
}
- self::setLinkHeader();
-
$return = self::list($ids, $total_count, $uid, $cursor, $count, $skip_status, $include_user_entities);
+ $this->response->setHeader(self::getLinkHeader());
+
$this->response->exit('lists', ['lists' => $return]);
}
}
}
} else {
$params = ['order' => ['cid' => true], 'limit' => $count];
-
+
$condition = ['relation-cid' => $cid, 'follows' => true];
$total_count = (int)DBA::count('contact-relation', $condition);
$ids = array_reverse($ids);
}
- self::setLinkHeader();
-
$return = self::list($ids, $total_count, $uid, $cursor, $count, $skip_status, $include_user_entities);
+ $this->response->setHeader(self::getLinkHeader());
+
$this->response->exit('lists', ['lists' => $return]);
}
}
namespace Friendica\Module\Api\Twitter\Friendships;
-use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Module\Api\Twitter\ContactEndpoint;
use Friendica\Module\BaseApi;
$return = self::ids($ids, $total_count, $cursor, $count, $stringify_ids);
- self::setLinkHeader();
+ $this->response->setHeader(self::getLinkHeader());
$this->response->exit('incoming', ['incoming' => $return]);
}
}
/**
- * Set the "link" header with "next" and "prev" links
- * @return void
+ * Get the "link" header with "next" and "prev" links
+ * @return string
*/
- protected static function setLinkHeader()
+ protected static function getLinkHeader(): string
{
if (empty(self::$boundaries)) {
- return;
+ return '';
}
$request = self::$request;
$prev = $command . '?' . http_build_query($prev_request);
$next = $command . '?' . http_build_query($next_request);
- header('Link: <' . $next . '>; rel="next", <' . $prev . '>; rel="prev"');
+ return 'Link: <' . $next . '>; rel="next", <' . $prev . '>; rel="prev"';
+ }
+
+ /**
+ * Set the "link" header with "next" and "prev" links
+ * @return void
+ */
+ protected static function setLinkHeader()
+ {
+ $header = self::getLinkHeader();
+ if (!empty($header)) {
+ header($header);
+ }
}
/**