]> git.mxchange.org Git - friendica-addons.git/commitdiff
Code standards
authorfabrixxm <fabrix.xm@gmail.com>
Tue, 27 Apr 2021 18:52:20 +0000 (20:52 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Tue, 27 Apr 2021 19:07:18 +0000 (21:07 +0200)
opmlexport/opmlexport.php

index 0c53fec6c6f16ef61b5c7f0089d4eb4966087002..5714d83dc3f12d4dd8ed6f60315bebe5ab40bb9f 100644 (file)
@@ -14,15 +14,17 @@ use Friendica\Core\Logger;
 use Friendica\Network\HTTPException;
 use Friendica\Database\DBA;
 use Friendica\Core\Renderer;
+use Friendica\Core\Protocol;
+use Friendica\Model\Contact;
 
-function opmlexport_install() {
-    Hook::register("addon_settings",        __FILE__, "opmlexport_addon_settings");
-    Hook::register("addon_settings_post",   __FILE__, "opmlexport_addon_settings_post");
-    Logger::log("installed opmlexport Addon");
+function opmlexport_install()
+{
+    Hook::register('addon_settings',        __FILE__, 'opmlexport_addon_settings');
+    Hook::register('addon_settings_post',   __FILE__, 'opmlexport_addon_settings_post');
+    Logger::log('installed opmlexport Addon');
 }
 
 
-function opmlexport(App $a) {
     $stmt = DBA::p("SELECT *
             FROM `contact`
             WHERE `uid` = ?
@@ -34,21 +36,22 @@ function opmlexport(App $a) {
             [local_user(), "feed"]
     );
 
+function opmlexport(App $a)
+{
 
-    $xml = new \DOMDocument( "1.0", "utf-8" );
-    $opml = $xml->createElement("opml");
-    $head = $xml->createElement("head");
-    $body = $xml->createElement("body");
-    $outline = $xml->createElement("outline");
-    $outline->setAttribute("title", $a->user['username'] . "'s RSS/Atom contacts");
-    $outline->setAttribute("text", $a->user['username'] . "'s RSS/Atom contacts");
+    $xml = new \DOMDocument( '1.0', 'utf-8' );
+    $opml = $xml->createElement('opml');
+    $head = $xml->createElement('head');
+    $body = $xml->createElement('body');
+    $outline = $xml->createElement('outline');
+    $outline->setAttribute('title', $a->user['username'] . '\'s RSS/Atom contacts');
+    $outline->setAttribute('text', $a->user['username'] . '\'s RSS/Atom contacts');
 
     while ($c = DBA::fetch($stmt)) {
-        $entry = $xml->createElement("outline");
-        $entry->setAttribute("title",  $c["name"]);
-        $entry->setAttribute("text",   $c["name"]);
-        $entry->setAttribute("xmlUrl", $c["url"]);
-        // $entry->setAttribute("htmlUrl", $c[""]);
+        $entry = $xml->createElement('outline');
+        $entry->setAttribute('title',  $c['name']);
+        $entry->setAttribute('text',   $c['name']);
+        $entry->setAttribute('xmlUrl', $c['url']);
         $outline->appendChild($entry);
     }
     DBA::close($stmt);
@@ -57,33 +60,32 @@ function opmlexport(App $a) {
     $opml->appendChild($head);
     $opml->appendChild($body);
     $xml->appendChild($opml);
-    header("Content-Type: text/x-opml");
-    header("Content-Disposition: attachment; filename=feeds.opml");
+    header('Content-Type: text/x-opml');
+    header('Content-Disposition: attachment; filename=feeds.opml');
     $xml->formatOutput = true;
     echo $xml->saveXML();
     die();
 }
 
 
-function opmlexport_addon_settings(App $a, &$s) {
-        if (!local_user()) {
-                return;
-        }
+function opmlexport_addon_settings(App $a, &$s)
+{
+    if (!local_user()) {
+        return;
+    }
 
-        $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/opmlexport/');
-        $s .= Renderer::replaceMacros($t, [
-                '$title'   => DI::l10n()->t('OPML Export'),
-                '$submit'  => DI::l10n()->t('Export RSS/Atom contacts'),
-        ]);
+    $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/opmlexport/');
+    $s .= Renderer::replaceMacros($t, [
+        '$title'   => DI::l10n()->t('OPML Export'),
+        '$submit'  => DI::l10n()->t('Export RSS/Atom contacts'),
+    ]);
 }
 
 
 function opmlexport_addon_settings_post(App $a, &$b)
 {
-        if (!local_user() || empty($_POST['opmlexport-submit'])) {
-                return;
-        }
-       opmlexport($a);
+    if (!local_user() || empty($_POST['opmlexport-submit'])) {
+        return;
+    }
+    opmlexport($a);
 }
-
-