mirror of
https://github.com/friendica/friendica
synced 2025-04-25 07:50:10 +00:00
Renamed Diagnostic to Debug and deleted ItemSource (already defined)
This commit is contained in:
parent
48bba87abe
commit
492d7abe92
8 changed files with 21 additions and 77 deletions
53
src/Module/Debug/Feed.php
Normal file
53
src/Module/Debug/Feed.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module\Debug;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model;
|
||||
use Friendica\Protocol;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
/**
|
||||
* Tests a given feed of a contact
|
||||
*/
|
||||
class Feed extends BaseModule
|
||||
{
|
||||
public static function init()
|
||||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
self::getApp()->internalRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
public static function content()
|
||||
{
|
||||
$result = [];
|
||||
if (!empty($_REQUEST['url'])) {
|
||||
$url = $_REQUEST['url'];
|
||||
|
||||
$importer = Model\User::getById(local_user());
|
||||
|
||||
$contact_id = Model\Contact::getIdForURL($url, local_user(), true);
|
||||
$contact = Model\Contact::getById($contact_id);
|
||||
|
||||
$xml = Network::fetchUrl($contact['poll']);
|
||||
|
||||
$dummy = null;
|
||||
$import_result = Protocol\Feed::import($xml, $importer, $contact, $dummy, true);
|
||||
|
||||
$result = [
|
||||
'input' => $xml,
|
||||
'output' => var_export($import_result, true),
|
||||
];
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('feedtest.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
|
||||
'$result' => $result
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue