]> git.mxchange.org Git - friendica.git/blob - src/Module/Itemsource.php
Merge pull request #6784 from nupplaphil/task/image_to_model
[friendica.git] / src / Module / Itemsource.php
1 <?php
2
3 namespace Friendica\Module;
4
5 use Friendica\Content\Text\HTML;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\Model;
9 use Friendica\Protocol\ActivityPub\Processor;
10 use Friendica\Protocol\Diaspora;
11
12 /**
13  * @author Hypolite Petovan <mrpetovan@gmail.com>
14  */
15 class Itemsource extends \Friendica\BaseModule
16 {
17         public static function content()
18         {
19                 if (!is_site_admin()) {
20                         return;
21                 }
22
23                 $a = self::getApp();
24
25                 if (!empty($a->argv[1])) {
26                         $guid = $a->argv[1];
27                 }
28
29                 $guid = defaults($_REQUEST['guid'], $guid);
30
31                 $source = '';
32                 $item_uri = '';
33                 $item_id = '';
34                 $terms = [];
35                 if (!empty($guid)) {
36                         $item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
37
38                         $conversation = Model\Conversation::getByItemUri($item['uri']);
39
40                         $item_id = $item['id'];
41                         $item_uri = $item['uri'];
42                         $source = $conversation['source'];
43                         $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
44                 }
45
46                 $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
47                 $o = Renderer::replaceMacros($tpl, [
48                         '$guid'          => ['guid', L10n::t('Item Guid'), $guid, ''],
49                         '$source'        => $source,
50                         '$item_uri'      => $item_uri,
51                         '$item_id'       => $item_id,
52                         '$terms'         => $terms,
53                 ]);
54
55                 return $o;
56         }
57 }