friendica/src/Module/Itemsource.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2018-10-18 22:49:25 -04:00
<?php
namespace Friendica\Module;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
2018-10-18 22:49:25 -04:00
use Friendica\Model;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
*/
class Itemsource extends \Friendica\BaseModule
{
public static function content()
{
if (!is_site_admin()) {
return;
}
$a = self::getApp();
2019-05-01 14:16:21 -04:00
// @TODO: Replace with parameter from router
if (!empty($a->argv[1])) {
$guid = $a->argv[1];
}
$guid = defaults($_REQUEST['guid'], $guid);
2018-10-18 22:49:25 -04:00
$source = '';
$item_uri = '';
$item_id = '';
$terms = [];
if (!empty($guid)) {
$item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
2018-10-18 22:49:25 -04:00
$conversation = Model\Conversation::getByItemUri($item['uri']);
$item_id = $item['id'];
2018-10-18 22:49:25 -04:00
$item_uri = $item['uri'];
$source = $conversation['source'];
$terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
2018-10-18 22:49:25 -04:00
}
$tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
$o = Renderer::replaceMacros($tpl, [
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
2018-10-18 22:49:25 -04:00
'$source' => $source,
'$item_uri' => $item_uri,
'$item_id' => $item_id,
'$terms' => $terms,
2018-10-18 22:49:25 -04:00
]);
return $o;
}
}