]> git.mxchange.org Git - friendica.git/commitdiff
Move mod/rsd_xml to src/Module/ReallySimpleDiscovery
authorPhilipp Holzer <admin@philipp.info>
Sat, 4 May 2019 19:37:32 +0000 (21:37 +0200)
committerPhilipp Holzer <admin@philipp.info>
Sat, 4 May 2019 19:37:32 +0000 (21:37 +0200)
mod/rsd_xml.php [deleted file]
src/App/Router.php
src/Module/ReallySimpleDiscovery.php [new file with mode: 0644]
view/templates/rsd.tpl [new file with mode: 0644]

diff --git a/mod/rsd_xml.php b/mod/rsd_xml.php
deleted file mode 100644 (file)
index 84dedd6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-use Friendica\App;
-use Friendica\Core\System;
-
-function rsd_xml_content(App $a)
-{
-       header ("Content-Type: text/xml");
-       echo '<?xml version="1.0" encoding="UTF-8"?>
-<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
-  <service>
-    <engineName>Friendica</engineName>
-    <engineLink>http://friendica.com/</engineLink>
-    <apis>
-      <api name="Twitter" preferred="true" apiLink="'.System::baseUrl().'/api/" blogID="">
-        <settings>
-          <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
-          <setting name="OAuth">false</setting>
-        </settings>
-      </api>
-    </apis>
-  </service>
-</rsd>';
-
-       exit();
-}
index d35977dde15ad35b3e95c4694364af0d906de566..3dc45fcfa1c7e3522fb56eb30645a66497fd645d 100644 (file)
@@ -161,6 +161,7 @@ class Router
                        $collector->addRoute(['GET'], '/{sub1}/{sub2}/{url}'               , Module\Proxy::class);
                });
                $this->routeCollector->addRoute(['GET', 'POST'], '/register',            Module\Register::class);
+               $this->routeCollector->addRoute(['GET'],         '/rsd.xml',             Module\ReallySimpleDiscovery::class);
                $this->routeCollector->addRoute(['GET'],         '/statistics.json',     Module\Statistics::class);
                $this->routeCollector->addRoute(['GET'],         '/tos',                 Module\Tos::class);
                $this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\WebFinger::class);
diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php
new file mode 100644 (file)
index 0000000..388a652
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Core\Renderer;
+
+/**
+ * Prints the rsd.xml
+ * @see http://danielberlinger.github.io/rsd/
+ */
+class ReallySimpleDiscovery extends BaseModule
+{
+       public static function rawContent()
+       {
+               header ("Content-Type: text/xml");
+               $tpl = Renderer::getMarkupTemplate('rsd.tpl');
+               echo Renderer::replaceMacros($tpl, []);
+               exit();
+       }
+}
diff --git a/view/templates/rsd.tpl b/view/templates/rsd.tpl
new file mode 100644 (file)
index 0000000..c194e8f
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
+       <service>
+               <engineName>Friendica</engineName>
+               <engineLink>http://friendica.com/</engineLink>
+               <apis>
+                       <api name="Twitter" preferred="true" apiLink="{{$baseurl}}/api/" blogID="">
+                               <settings>
+                                       <docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
+                                       <setting name="OAuth">false</setting>
+                               </settings>
+                       </api>
+               </apis>
+       </service>
+</rsd>