]> git.mxchange.org Git - friendica.git/blobdiff - mod/group.php
Docs: add a note on adding `use` on theme.php
[friendica.git] / mod / group.php
index ce091db8cd0e339eb2387a5d1d3138a7bfe9fe11..870025074c91b34b220c8d51ec1c5e8b5a39efee 100644 (file)
@@ -7,6 +7,7 @@
 
 use Friendica\App;
 use Friendica\Core\Config;
+use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -22,7 +23,7 @@ function group_init(App $a) {
 function group_post(App $a) {
 
        if (! local_user()) {
-               notice(t('Permission denied.') . EOL);
+               notice(L10n::t('Permission denied.') . EOL);
                return;
        }
 
@@ -32,13 +33,13 @@ function group_post(App $a) {
                $name = notags(trim($_POST['groupname']));
                $r = Group::create(local_user(), $name);
                if ($r) {
-                       info(t('Group created.') . EOL);
+                       info(L10n::t('Group created.') . EOL);
                        $r = Group::getIdByName(local_user(), $name);
                        if ($r) {
                                goaway(System::baseUrl() . '/group/' . $r);
                        }
                } else {
-                       notice(t('Could not create group.') . EOL);
+                       notice(L10n::t('Could not create group.') . EOL);
                }
                goaway(System::baseUrl() . '/group');
                return; // NOTREACHED
@@ -52,7 +53,7 @@ function group_post(App $a) {
                        intval(local_user())
                );
                if (! DBM::is_result($r)) {
-                       notice(t('Group not found.') . EOL);
+                       notice(L10n::t('Group not found.') . EOL);
                        goaway(System::baseUrl() . '/contacts');
                        return; // NOTREACHED
                }
@@ -66,7 +67,7 @@ function group_post(App $a) {
                        );
 
                        if ($r) {
-                               info(t('Group name changed.') . EOL);
+                               info(L10n::t('Group name changed.') . EOL);
                        }
                }
 
@@ -79,7 +80,7 @@ function group_content(App $a) {
        $change = false;
 
        if (! local_user()) {
-               notice(t('Permission denied') . EOL);
+               notice(L10n::t('Permission denied') . EOL);
                return;
        }
 
@@ -93,13 +94,13 @@ function group_content(App $a) {
        $tpl = get_markup_template('group_edit.tpl');
 
        $context = [
-                       '$submit' => t('Save Group'),
+                       '$submit' => L10n::t('Save Group'),
        ];
 
        if (($a->argc == 2) && ($a->argv[1] === 'new')) {
                return replace_macros($tpl, $context + [
-                       '$title' => t('Create a group of contacts/friends.'),
-                       '$gname' => ['groupname', t('Group Name: '), '', ''],
+                       '$title' => L10n::t('Create a group of contacts/friends.'),
+                       '$gname' => ['groupname', L10n::t('Group Name: '), '', ''],
                        '$gid' => 'new',
                        '$form_security_token' => get_form_security_token("group_edit"),
                ]);
@@ -123,9 +124,9 @@ function group_content(App $a) {
                        }
 
                        if ($result) {
-                               info(t('Group removed.') . EOL);
+                               info(L10n::t('Group removed.') . EOL);
                        } else {
-                               notice(t('Unable to remove group.') . EOL);
+                               notice(L10n::t('Unable to remove group.') . EOL);
                        }
                }
                goaway(System::baseUrl() . '/group');
@@ -145,7 +146,6 @@ function group_content(App $a) {
        }
 
        if (($a->argc > 1) && (intval($a->argv[1]))) {
-               require_once 'include/acl_selectors.php';
                require_once 'mod/contacts.php';
 
                $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
@@ -154,7 +154,7 @@ function group_content(App $a) {
                );
 
                if (! DBM::is_result($r)) {
-                       notice(t('Group not found.') . EOL);
+                       notice(L10n::t('Group not found.') . EOL);
                        goaway(System::baseUrl() . '/contacts');
                }
 
@@ -189,18 +189,18 @@ function group_content(App $a) {
                $drop_tpl = get_markup_template('group_drop.tpl');
                $drop_txt = replace_macros($drop_tpl, [
                        '$id' => $group['id'],
-                       '$delete' => t('Delete Group'),
+                       '$delete' => L10n::t('Delete Group'),
                        '$form_security_token' => get_form_security_token("group_drop"),
                ]);
 
 
                $context = $context + [
-                       '$title' => t('Group Editor'),
-                       '$gname' => ['groupname', t('Group Name: '), $group['name'], ''],
+                       '$title' => L10n::t('Group Editor'),
+                       '$gname' => ['groupname', L10n::t('Group Name: '), $group['name'], ''],
                        '$gid' => $group['id'],
                        '$drop' => $drop_txt,
                        '$form_security_token' => get_form_security_token('group_edit'),
-                       '$edit_name' => t('Edit Group Name')
+                       '$edit_name' => L10n::t('Edit Group Name')
                ];
 
        }
@@ -210,10 +210,10 @@ function group_content(App $a) {
        }
 
        $groupeditor = [
-               'label_members' => t('Members'),
+               'label_members' => L10n::t('Members'),
                'members' => [],
-               'label_contacts' => t('All Contacts'),
-               'group_is_empty' => t('Group is empty'),
+               'label_contacts' => L10n::t('All Contacts'),
+               'group_is_empty' => L10n::t('Group is empty'),
                'contacts' => [],
        ];
 
@@ -226,7 +226,7 @@ function group_content(App $a) {
                        $entry['label'] = 'members';
                        $entry['photo_menu'] = '';
                        $entry['change_member'] = [
-                               'title'     => t("Remove Contact"),
+                               'title'     => L10n::t("Remove Contact"),
                                'gid'       => $group['id'],
                                'cid'       => $member['id'],
                                'sec_token' => $sec_token
@@ -250,7 +250,7 @@ function group_content(App $a) {
                                $entry['label'] = 'contacts';
                                $entry['photo_menu'] = '';
                                $entry['change_member'] = [
-                                       'title'     => t("Add Contact"),
+                                       'title'     => L10n::t("Add Contact"),
                                        'gid'       => $group['id'],
                                        'cid'       => $member['id'],
                                        'sec_token' => $sec_token
@@ -262,7 +262,7 @@ function group_content(App $a) {
        }
 
        $context['$groupeditor'] = $groupeditor;
-       $context['$desc'] = t('Click on a contact to add or remove.');
+       $context['$desc'] = L10n::t('Click on a contact to add or remove.');
 
        // If there are to many contacts we could provide an alternative view mode
        $total = count($groupeditor['members']) + count($groupeditor['contacts']);