From f6af90fa328bcf7e731917f011b3e20fefeace1c Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 5 May 2019 18:15:39 +0200 Subject: [PATCH] Create XML output for RSD with XML::fromArray() --- src/Module/ReallySimpleDiscovery.php | 42 +++++++++++++++++++++++++--- view/templates/rsd.tpl | 15 ---------- 2 files changed, 38 insertions(+), 19 deletions(-) delete mode 100644 view/templates/rsd.tpl diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php index 4c14d3c837..515285dbfc 100644 --- a/src/Module/ReallySimpleDiscovery.php +++ b/src/Module/ReallySimpleDiscovery.php @@ -3,7 +3,7 @@ namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Core\Renderer; +use Friendica\Util\XML; /** * Prints the rsd.xml @@ -13,9 +13,43 @@ class ReallySimpleDiscovery extends BaseModule { public static function rawContent() { - header ('Content-Type: text/xml'); - $tpl = Renderer::getMarkupTemplate('rsd.tpl'); - echo Renderer::replaceMacros($tpl); + header('Content-Type: text/xml'); + + $app = self::getApp(); + $xml = null; + echo XML::fromArray([ + 'rsd' => [ + '@attributes' => [ + 'version' => '1.0', + 'xmlns' => 'http://archipelago.phrasewise.com/rsd', + ], + 'service' => [ + 'engineName' => 'Friendica', + 'engineLink' => 'http://friendica.com', + 'apis' => [ + 'api' => [ + '@attributes' => [ + 'name' => 'Twitter', + 'preferred' => 'true', + 'apiLink' => $app->getBaseURL(), + 'blogID' => '', + ], + 'settings' => [ + 'docs' => [ + 'http://status.net/wiki/TwitterCompatibleAPI', + ], + 'setting' => [ + '@attributes' => [ + 'name' => 'OAuth', + ], + 'false', + ], + ], + ] + ], + ], + ], + ], $xml); exit(); } } diff --git a/view/templates/rsd.tpl b/view/templates/rsd.tpl deleted file mode 100644 index c194e8f26b..0000000000 --- a/view/templates/rsd.tpl +++ /dev/null @@ -1,15 +0,0 @@ - - - - Friendica - http://friendica.com/ - - - - http://status.net/wiki/TwitterCompatibleAPI - false - - - - - -- 2.39.5