From cd535851012fc4e96b8e073f3d252ce7fa2844b1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 21 Feb 2019 21:37:23 -0500 Subject: [PATCH] Improve /itemsource display - Add Item Id - Add Item Terms --- src/Module/Itemsource.php | 16 ++++++++++--- view/templates/debug/itemsource.tpl | 37 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php index 9e62a568c..12ce04f95 100644 --- a/src/Module/Itemsource.php +++ b/src/Module/Itemsource.php @@ -2,9 +2,12 @@ namespace Friendica\Module; +use Friendica\Content\Text\HTML; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Model; +use Friendica\Protocol\ActivityPub\Processor; +use Friendica\Protocol\Diaspora; /** * @author Hypolite Petovan @@ -27,20 +30,27 @@ class Itemsource extends \Friendica\BaseModule $source = ''; $item_uri = ''; + $item_id = ''; + $terms = []; if (!empty($guid)) { - $item = Model\Item::selectFirst([], ['guid' => $guid]); + $item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]); $conversation = Model\Conversation::getByItemUri($item['uri']); + $guid = $item['guid']; + $item_id = $item['id']; $item_uri = $item['uri']; $source = $conversation['source']; + $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]); } $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl'); $o = Renderer::replaceMacros($tpl, [ - '$guid' => ['guid', L10n::t('Item Guid'), defaults($_REQUEST, 'guid', ''), ''], + '$guid' => ['guid', L10n::t('Item Guid'), $guid, ''], '$source' => $source, - '$item_uri' => $item_uri + '$item_uri' => $item_uri, + '$item_id' => $item_id, + '$terms' => $terms, ]); return $o; diff --git a/view/templates/debug/itemsource.tpl b/view/templates/debug/itemsource.tpl index 377409ebf..0d925b3c8 100644 --- a/view/templates/debug/itemsource.tpl +++ b/view/templates/debug/itemsource.tpl @@ -10,6 +10,14 @@ {{if $source}}
+
+
+

Item Id

+
+
+ {{$item_id}} +
+

Item URI

@@ -18,6 +26,35 @@ {{$item_uri}}
+
+
+

Terms

+
+
+ + + + + + + {{foreach $terms as $term}} + + + + + + {{/foreach}} +
TypeTermURL
+ {{if $term.type == 1}}Tag{{/if}} + {{if $term.type == 2}}Mention{{/if}} + {{if $term.type == 8}}Implicit Mention{{/if}} + + {{$term.term}} + + {{$term.url}} +
+
+

Source