]> git.mxchange.org Git - friendica.git/blobdiff - mod/community.php
Merge pull request #4328 from tobiasd/20180125-msg
[friendica.git] / mod / community.php
index 64a86f07ed3556a5187a83eb2ae25e4b82f173f1..7598f96ec507db7a6451aaf6d60ae6124f8946f6 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Nav;
 use Friendica\Core\Config;
+use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 
@@ -21,7 +22,7 @@ function community_content(App $a, $update = 0)
        $o = '';
 
        if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
-               notice(t('Public access denied.') . EOL);
+               notice(L10n::t('Public access denied.') . EOL);
                return;
        }
 
@@ -30,7 +31,7 @@ function community_content(App $a, $update = 0)
        if ($a->argc > 1) {
                $content = $a->argv[1];
        } else {
-               if (!empty(Config::get('system','singleuser'))) {
+               if (!empty(Config::get('system', 'singleuser'))) {
                        // On single user systems only the global page does make sense
                        $content = 'global';
                } else {
@@ -40,7 +41,7 @@ function community_content(App $a, $update = 0)
        }
 
        if (!in_array($content, ['local', 'global'])) {
-               notice(t('Community option not available.') . EOL);
+               notice(L10n::t('Community option not available.') . EOL);
                return;
        }
 
@@ -57,7 +58,7 @@ function community_content(App $a, $update = 0)
                }
 
                if (!$available) {
-                       notice(t('Not available.') . EOL);
+                       notice(L10n::t('Not available.') . EOL);
                        return;
                }
        }
@@ -69,36 +70,36 @@ function community_content(App $a, $update = 0)
        if (!$update) {
                $tabs = [];
 
-               if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system','singleuser'))) {
-                       $tabs[] = array(
-                               'label' => t('Community'),
+               if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system', 'singleuser'))) {
+                       $tabs[] = [
+                               'label' => L10n::t('Community'),
                                'url' => 'community/local',
                                'sel' => $content == 'local' ? 'active' : '',
-                               'title' => t('Posts from local users on this server'),
+                               'title' => L10n::t('Posts from local users on this server'),
                                'id' => 'community-local-tab',
                                'accesskey' => 'l'
-                       );
+                       ];
                }
 
                if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
-                       $tabs[] = array(
-                               'label' => t('Global Timeline'),
+                       $tabs[] = [
+                               'label' => L10n::t('Global Timeline'),
                                'url' => 'community/global',
                                'sel' => $content == 'global' ? 'active' : '',
-                               'title' => t('Posts from users of the federated network'),
+                               'title' => L10n::t('Posts from users of the federated network'),
                                'id' => 'community-global-tab',
                                'accesskey' => 'g'
-                       );
+                       ];
                }
 
                $tab_tpl = get_markup_template('common_tabs.tpl');
-               $o .= replace_macros($tab_tpl, array('$tabs' => $tabs));
+               $o .= replace_macros($tab_tpl, ['$tabs' => $tabs]);
 
                Nav::setSelected('community');
 
                // We need the editor here to be able to reshare an item.
                if (local_user()) {
-                       $x = array(
+                       $x = [
                                'is_owner' => true,
                                'allow_location' => $a->user['allow_location'],
                                'default_location' => $a->user['default-location'],
@@ -108,7 +109,7 @@ function community_content(App $a, $update = 0)
                                'bang' => '',
                                'visitor' => 'block',
                                'profile_uid' => local_user(),
-                       );
+                       ];
                        $o .= status_editor($a, $x, 0, true);
                }
        }
@@ -134,7 +135,7 @@ function community_content(App $a, $update = 0)
        $r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
 
        if (!DBM::is_result($r)) {
-               info(t('No results.') . EOL);
+               info(L10n::t('No results.') . EOL);
                return $o;
        }
 
@@ -144,7 +145,7 @@ function community_content(App $a, $update = 0)
                $count = 1;
                $previousauthor = "";
                $numposts = 0;
-               $s = array();
+               $s = [];
 
                do {
                        foreach ($r as $item) {
@@ -174,12 +175,12 @@ function community_content(App $a, $update = 0)
        }
 
        $t = get_markup_template("community.tpl");
-       return replace_macros($t, array(
+       return replace_macros($t, [
                '$content' => $o,
                '$header' => '',
                '$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'),
-               '$global_community_hint' => t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
-       ));
+               '$global_community_hint' => L10n::t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
+       ]);
 }
 
 function community_getitems($start, $itemspage, $content)
@@ -207,5 +208,5 @@ function community_getitems($start, $itemspage, $content)
        }
 
        // Should never happen
-       return array();
+       return [];
 }