summaryrefslogtreecommitdiff
path: root/classes/article.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/article.php')
-rwxr-xr-xclasses/article.php34
1 files changed, 28 insertions, 6 deletions
diff --git a/classes/article.php b/classes/article.php
index 609ddeebe..63469ccd2 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -239,8 +239,7 @@ class Article extends Handler_Protected {
print json_encode(["id" => (int)$id, "tags" => $this->_get_tags($id)]);
}
-
- /*function completeTags() {
+ function completeTags(): void {
$search = clean($_REQUEST["search"]);
$sth = $this->pdo->prepare("SELECT DISTINCT tag_name FROM ttrss_tags
@@ -250,12 +249,14 @@ class Article extends Handler_Protected {
$sth->execute([$_SESSION['uid'], "$search%"]);
- print "<ul>";
+ $results = [];
+
while ($line = $sth->fetch()) {
- print "<li>" . $line["tag_name"] . "</li>";
+ array_push($results, $line["tag_name"]);
}
- print "</ul>";
- }*/
+
+ print json_encode($results);
+ }
function assigntolabel(): void {
$this->_label_ops(true);
@@ -297,6 +298,8 @@ class Article extends Handler_Protected {
* @return array{'formatted': string, 'entries': array<int, array<string, mixed>>}
*/
static function _format_enclosures(int $id, bool $always_display_enclosures, string $article_content, bool $hide_images = false): array {
+ $scope = Tracer::start(__METHOD__);
+
$enclosures = self::_get_enclosures($id);
$enclosures_formatted = "";
@@ -323,6 +326,7 @@ class Article extends Handler_Protected {
$enclosures_formatted, $enclosures, $id, $always_display_enclosures, $article_content, $hide_images);
if (!empty($enclosures_formatted)) {
+ $scope->close();
return [
'formatted' => $enclosures_formatted,
'entries' => []
@@ -366,6 +370,7 @@ class Article extends Handler_Protected {
}
}
+ $scope->close();
return $rv;
}
@@ -373,6 +378,7 @@ class Article extends Handler_Protected {
* @return array<int, string>
*/
static function _get_tags(int $id, int $owner_uid = 0, ?string $tag_cache = null): array {
+ $scope = Tracer::start(__METHOD__);
$a_id = $id;
@@ -421,6 +427,7 @@ class Article extends Handler_Protected {
$sth->execute([$tags_str, $id, $owner_uid]);
}
+ $scope->close();
return $tags;
}
@@ -515,6 +522,8 @@ class Article extends Handler_Protected {
* @return array<int, array<int, int|string>>
*/
static function _get_labels(int $id, ?int $owner_uid = null): array {
+ $scope = Tracer::start(__METHOD__, []);
+
$rv = array();
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@@ -560,6 +569,8 @@ class Article extends Handler_Protected {
else
Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
+ $scope->close();
+
return $rv;
}
@@ -570,6 +581,7 @@ class Article extends Handler_Protected {
* @return array<int, Article::ARTICLE_KIND_*|string>
*/
static function _get_image(array $enclosures, string $content, string $site_url, array $headline) {
+ $scope = Tracer::start(__METHOD__);
$article_image = "";
$article_stream = "";
@@ -648,6 +660,8 @@ class Article extends Handler_Protected {
if ($article_stream && $cache->exists(sha1($article_stream)))
$article_stream = $cache->get_url(sha1($article_stream));
+ $scope->close();
+
return [$article_image, $article_stream, $article_kind];
}
@@ -661,6 +675,8 @@ class Article extends Handler_Protected {
if (count($article_ids) == 0)
return [];
+ $scope = Tracer::start(__METHOD__);
+
$entries = ORM::for_table('ttrss_entries')
->table_alias('e')
->join('ttrss_user_entries', ['ref_id', '=', 'id'], 'ue')
@@ -680,6 +696,8 @@ class Article extends Handler_Protected {
}
}
+ $scope->close();
+
return array_unique($rv);
}
@@ -691,6 +709,8 @@ class Article extends Handler_Protected {
if (count($article_ids) == 0)
return [];
+ $scope = Tracer::start(__METHOD__);
+
$entries = ORM::for_table('ttrss_entries')
->table_alias('e')
->join('ttrss_user_entries', ['ref_id', '=', 'id'], 'ue')
@@ -703,6 +723,8 @@ class Article extends Handler_Protected {
array_push($rv, $entry->feed_id);
}
+ $scope->close();
+
return array_unique($rv);
}
}