]> git.mxchange.org Git - friendica.git/commitdiff
fix code style
authorArt4 <art4@wlabs.de>
Mon, 28 Apr 2025 14:12:27 +0000 (14:12 +0000)
committerArt4 <art4@wlabs.de>
Mon, 28 Apr 2025 14:12:27 +0000 (14:12 +0000)
src/Model/Nodeinfo.php
src/Module/Statistics.php
src/Module/Stats.php
view/theme/vier/theme.php

index cdee561112fae96ac9b7b4b62ace12e9a17ff6c4..0d3a88ad8a354a929421eb8b347e57a2096a1b40 100644 (file)
@@ -10,7 +10,6 @@ namespace Friendica\Model;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Model\Item;
 use stdClass;
 
 /**
@@ -50,12 +49,12 @@ class Nodeinfo
 
                $logger->info('user statistics - done', $userStats);
 
-               $posts = DBA::count('post-thread', ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE NOT `deleted` AND `origin`)"]);
+               $posts    = DBA::count('post-thread', ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE NOT `deleted` AND `origin`)"]);
                $comments = DBA::count('post', ["NOT `deleted` AND `gravity` = ? AND `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)", Item::GRAVITY_COMMENT]);
                DI::keyValue()->set('nodeinfo_local_posts', $posts);
                DI::keyValue()->set('nodeinfo_local_comments', $comments);
 
-               $posts = DBA::count('post', ['deleted' => false, 'gravity' => Item::GRAVITY_COMMENT]);
+               $posts    = DBA::count('post', ['deleted' => false, 'gravity' => Item::GRAVITY_COMMENT]);
                $comments = DBA::count('post', ['deleted' => false, 'gravity' => Item::GRAVITY_COMMENT]);
                DI::keyValue()->set('nodeinfo_total_posts', $posts);
                DI::keyValue()->set('nodeinfo_total_comments', $comments);
@@ -72,15 +71,15 @@ class Nodeinfo
        {
                $config = DI::config();
 
-               $usage = new stdClass();
-               $usage->users = new stdClass;
+               $usage        = new stdClass();
+               $usage->users = new stdClass();
 
                if (!empty($config->get('system', 'nodeinfo'))) {
-                       $usage->users->total = intval(DI::keyValue()->get('nodeinfo_total_users'));
+                       $usage->users->total          = intval(DI::keyValue()->get('nodeinfo_total_users'));
                        $usage->users->activeHalfyear = intval(DI::keyValue()->get('nodeinfo_active_users_halfyear'));
-                       $usage->users->activeMonth = intval(DI::keyValue()->get('nodeinfo_active_users_monthly'));
-                       $usage->localPosts = intval(DI::keyValue()->get('nodeinfo_local_posts'));
-                       $usage->localComments = intval(DI::keyValue()->get('nodeinfo_local_comments'));
+                       $usage->users->activeMonth    = intval(DI::keyValue()->get('nodeinfo_active_users_monthly'));
+                       $usage->localPosts            = intval(DI::keyValue()->get('nodeinfo_local_posts'));
+                       $usage->localComments         = intval(DI::keyValue()->get('nodeinfo_local_comments'));
 
                        if ($version2) {
                                $usage->users->activeWeek = intval(DI::keyValue()->get('nodeinfo_active_users_weekly'));
@@ -105,14 +104,14 @@ class Nodeinfo
                ];
 
                if ($addonHelper->isAddonEnabled('bluesky')) {
-                       $services['inbound'][] = 'bluesky';
+                       $services['inbound'][]  = 'bluesky';
                        $services['outbound'][] = 'bluesky';
                }
                if ($addonHelper->isAddonEnabled('dwpost')) {
                        $services['outbound'][] = 'dreamwidth';
                }
                if ($addonHelper->isAddonEnabled('statusnet')) {
-                       $services['inbound'][] = 'gnusocial';
+                       $services['inbound'][]  = 'gnusocial';
                        $services['outbound'][] = 'gnusocial';
                }
                if ($addonHelper->isAddonEnabled('ijpost')) {
@@ -125,7 +124,7 @@ class Nodeinfo
                        $services['outbound'][] = 'livejournal';
                }
                if ($addonHelper->isAddonEnabled('pumpio')) {
-                       $services['inbound'][] = 'pumpio';
+                       $services['inbound'][]  = 'pumpio';
                        $services['outbound'][] = 'pumpio';
                }
 
index 4a35d55d129fcb76148dcad98f282e9e5e8438fd..6540730e011f394641afe405d9518dbe1867d18d 100644 (file)
@@ -53,8 +53,7 @@ class Statistics extends BaseModule
 
        protected function rawContent(array $request = [])
        {
-               $registration_open =
-                       Register::getPolicy() !== Register::CLOSED
+               $registration_open = Register::getPolicy() !== Register::CLOSED
                        && !$this->config->get('config', 'invitation_only');
 
                /// @todo mark the "service" addons and load them dynamically here
index e59696a889bf2d796d39f8adbc61be67ff55aee9..c8122177eb531a21b3252df2cbf4cc75fca38f07 100644 (file)
@@ -101,14 +101,14 @@ class Stats extends BaseModule
                                        'datetime'  => DateTimeFormat::utc($this->keyValue->get('last_worker_execution'), DateTimeFormat::JSON),
                                        'timestamp' => strtotime($this->keyValue->get('last_worker_execution')),
                                ],
-                               'jpm'           => [
+                               'jpm' => [
                                        1 => $this->dba->count('workerqueue', ["`done` AND `executed` > ?", DateTimeFormat::utc('now - 1 minute')]),
                                        3 => round($this->dba->count('workerqueue', ["`done` AND `executed` > ?", DateTimeFormat::utc('now - 3 minute')]) / 3),
                                        5 => round($this->dba->count('workerqueue', ["`done` AND `executed` > ?", DateTimeFormat::utc('now - 5 minute')]) / 5),
                                ],
-                               'active'        => [],
-                               'deferred'      => [],
-                               'total'         => [],
+                               'active'   => [],
+                               'deferred' => [],
+                               'total'    => [],
                        ],
                        'jetstream' => [
                                'drift'     => intval($this->keyValue->get('jetstream_drift')),
@@ -161,14 +161,14 @@ class Stats extends BaseModule
                                'closed' => $this->dba->count('report', ['status' => Report::STATUS_CLOSED]),
                        ],
                        'update' => [
-                               'available'             => Update::isAvailable(),
+                               'available'         => Update::isAvailable(),
                                'available_version' => Update::getAvailableVersion(),
                                'status'            => Update::getStatus(),
-                               'db_status'                     => DBStructure::getUpdateStatus(),
+                               'db_status'         => DBStructure::getUpdateStatus(),
                        ],
                        'server' => [
-                               'version'  => App::VERSION,
-                               'php'      => [
+                               'version' => App::VERSION,
+                               'php'     => [
                                        'version'             => phpversion(),
                                        'upload_max_filesize' => ini_get('upload_max_filesize'),
                                        'post_max_size'       => ini_get('post_max_size'),
@@ -181,11 +181,11 @@ class Stats extends BaseModule
                ];
 
                if ($this->addonHelper->isAddonEnabled('bluesky')) {
-                       $statistics['packets']['inbound'][Protocol::BLUESKY] = intval($this->keyValue->get('stats_packets_inbound_' . Protocol::BLUESKY) ?? 0);
+                       $statistics['packets']['inbound'][Protocol::BLUESKY]  = intval($this->keyValue->get('stats_packets_inbound_' . Protocol::BLUESKY) ?? 0);
                        $statistics['packets']['outbound'][Protocol::BLUESKY] = intval($this->keyValue->get('stats_packets_outbound_' . Protocol::BLUESKY) ?? 0);
                }
                if ($this->addonHelper->isAddonEnabled('tumblr')) {
-                       $statistics['packets']['inbound'][Protocol::TUMBLR] = intval($this->keyValue->get('stats_packets_inbound_' . Protocol::TUMBLR) ?? 0);
+                       $statistics['packets']['inbound'][Protocol::TUMBLR]  = intval($this->keyValue->get('stats_packets_inbound_' . Protocol::TUMBLR) ?? 0);
                        $statistics['packets']['outbound'][Protocol::TUMBLR] = intval($this->keyValue->get('stats_packets_outbound_' . Protocol::TUMBLR) ?? 0);
                }
 
@@ -218,7 +218,7 @@ class Stats extends BaseModule
 
                $jobs = $this->dba->p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` AND `retrial` = ? GROUP BY `priority`", 0);
                while ($entry = $this->dba->fetch($jobs)) {
-                       $running  = $this->dba->count('workerqueue-view', ['priority' => $entry['priority']]);
+                       $running = $this->dba->count('workerqueue-view', ['priority' => $entry['priority']]);
                        $statistics['worker']['active']['total'] += $running;
                        $statistics['worker']['active'][$entry['priority']] = $running;
                        $statistics['worker']['total']['total'] += $entry['entries'];
index dd178c87cec206a0b1f2ef18201ca15e1004f22d..c70f55ecc1f6a40608a3bb57f59ad073341a01d5 100644 (file)
@@ -92,7 +92,7 @@ EOT;
        // Hide the left menu bar
        /// @TODO maybe move this static array out where it should belong?
        if (empty(DI::page()['aside']) && in_array($args->get(0), ["community", "calendar", "help", "delegation", "notifications",
-                       "probe", "webfinger", "login", "invite", "credits"])) {
+               "probe", "webfinger", "login", "invite", "credits"])) {
                DI::page()['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
        }
 }
@@ -116,12 +116,12 @@ function get_vier_config($key, $default = false, $admin = false)
 
 function vier_community_info()
 {
-       $show_pages      = get_vier_config("show_pages", 1);
-       $show_profiles   = get_vier_config("show_profiles", 1);
-       $show_helpers    = get_vier_config("show_helpers", 1);
-       $show_services   = get_vier_config("show_services", 1);
-       $show_friends    = get_vier_config("show_friends", 1);
-       $show_lastusers  = get_vier_config("show_lastusers", 1);
+       $show_pages     = get_vier_config("show_pages", 1);
+       $show_profiles  = get_vier_config("show_profiles", 1);
+       $show_helpers   = get_vier_config("show_helpers", 1);
+       $show_services  = get_vier_config("show_services", 1);
+       $show_friends   = get_vier_config("show_friends", 1);
+       $show_lastusers = get_vier_config("show_lastusers", 1);
 
        // get_baseurl
        $aside['$url'] = $url = (string)DI::baseUrl();
@@ -137,10 +137,10 @@ function vier_community_info()
 
                        foreach ($contacts as $contact) {
                                $entry = Renderer::replaceMacros($tpl, [
-                                       '$id' => $contact['id'],
+                                       '$id'           => $contact['id'],
                                        '$profile_link' => 'contact/follow?url=' . urlencode($contact['url']),
-                                       '$photo' => Contact::getMicro($contact),
-                                       '$alt_text' => $contact['name'],
+                                       '$photo'        => Contact::getMicro($contact),
+                                       '$alt_text'     => $contact['name'],
                                ]);
                                $aside['$community_profiles_items'][] = $entry;
                        }
@@ -164,11 +164,11 @@ function vier_community_info()
 
                        foreach ($profiles as $profile) {
                                $profile_link = 'profile/' . ((strlen($profile['nickname'])) ? $profile['nickname'] : $profile['uid']);
-                               $entry = Renderer::replaceMacros($tpl, [
-                                       '$id' => $profile['id'],
+                               $entry        = Renderer::replaceMacros($tpl, [
+                                       '$id'           => $profile['id'],
                                        '$profile_link' => $profile_link,
-                                       '$photo' => DI::baseUrl()->remove($profile['thumb']),
-                                       '$alt_text' => $profile['name']]);
+                                       '$photo'        => DI::baseUrl()->remove($profile['thumb']),
+                                       '$alt_text'     => $profile['name']]);
                                $aside['$lastusers_items'][] = $entry;
                        }
                }
@@ -176,18 +176,18 @@ function vier_community_info()
 
        //right_aside FIND FRIENDS
        if ($show_friends && DI::userSession()->getLocalUserId()) {
-               $nv = [];
-               $nv['findpeople'] = DI::l10n()->t('Find People');
-               $nv['desc'] = DI::l10n()->t('Enter name or interest');
-               $nv['label'] = DI::l10n()->t('Connect/Follow');
-               $nv['hint'] = DI::l10n()->t('Examples: Robert Morgenstein, Fishing');
-               $nv['findthem'] = DI::l10n()->t('Find');
-               $nv['suggest'] = DI::l10n()->t('Friend Suggestions');
-               $nv['similar'] = DI::l10n()->t('Similar Interests');
-               $nv['random'] = DI::l10n()->t('Random Profile');
-               $nv['inv'] = DI::l10n()->t('Invite Friends');
-               $nv['directory'] = DI::l10n()->t('Global Directory');
-               $nv['global_dir'] = Search::getGlobalDirectory();
+               $nv                    = [];
+               $nv['findpeople']      = DI::l10n()->t('Find People');
+               $nv['desc']            = DI::l10n()->t('Enter name or interest');
+               $nv['label']           = DI::l10n()->t('Connect/Follow');
+               $nv['hint']            = DI::l10n()->t('Examples: Robert Morgenstein, Fishing');
+               $nv['findthem']        = DI::l10n()->t('Find');
+               $nv['suggest']         = DI::l10n()->t('Friend Suggestions');
+               $nv['similar']         = DI::l10n()->t('Similar Interests');
+               $nv['random']          = DI::l10n()->t('Random Profile');
+               $nv['inv']             = DI::l10n()->t('Invite Friends');
+               $nv['directory']       = DI::l10n()->t('Global Directory');
+               $nv['global_dir']      = Search::getGlobalDirectory();
                $nv['local_directory'] = DI::l10n()->t('Local Directory');
 
                $aside['$nv'] = $nv;
@@ -223,14 +223,14 @@ function vier_community_info()
                $tpl = Renderer::getMarkupTemplate('ch_helpers.tpl');
 
                if ($r) {
-                       $helpers = [];
+                       $helpers          = [];
                        $helpers['title'] = ["", DI::l10n()->t('Help'), "", ""];
 
                        $aside['$helpers_items'] = [];
 
                        foreach ($r as $rr) {
                                $entry = Renderer::replaceMacros($tpl, [
-                                       '$url' => $rr['url'],
+                                       '$url'   => $rr['url'],
                                        '$title' => $rr['name'],
                                ]);
                                $aside['$helpers_items'][] = $entry;
@@ -304,14 +304,14 @@ function vier_community_info()
                $tpl = Renderer::getMarkupTemplate('ch_connectors.tpl');
 
                if (DBA::isResult($r)) {
-                       $con_services = [];
-                       $con_services['title'] = ["", DI::l10n()->t('Connect Services'), "", ""];
+                       $con_services           = [];
+                       $con_services['title']  = ["", DI::l10n()->t('Connect Services'), "", ""];
                        $aside['$con_services'] = $con_services;
 
                        foreach ($r as $rr) {
                                $entry = Renderer::replaceMacros($tpl, [
-                                       '$url' => $url,
-                                       '$photo' => $rr['photo'],
+                                       '$url'      => $url,
+                                       '$photo'    => $rr['photo'],
                                        '$alt_text' => $rr['name'],
                                ]);
                                $aside['$connector_items'][] = $entry;
@@ -321,7 +321,7 @@ function vier_community_info()
        //end connectable services
 
        //print right_aside
-       $tpl = Renderer::getMarkupTemplate('communityhome.tpl');
+       $tpl                      = Renderer::getMarkupTemplate('communityhome.tpl');
        DI::page()['right_aside'] = Renderer::replaceMacros($tpl, $aside);
 }