Finish t() for src

Update t() calls in src folder
This commit is contained in:
Adam Magness 2018-01-22 09:54:13 -05:00
parent 407b2397cb
commit 07d306aa37
19 changed files with 392 additions and 384 deletions

View file

@ -7,6 +7,7 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -491,7 +492,7 @@ class Contact extends BaseObject
if ($contact['uid'] != $uid) {
if ($uid == 0) {
$profile_link = Profile::zrl($contact['url']);
$menu = ['profile' => [t('View Profile'), $profile_link, true]];
$menu = ['profile' => [L10n::t('View Profile'), $profile_link, true]];
return $menu;
}
@ -504,8 +505,8 @@ class Contact extends BaseObject
$profile_link = Profile::zrl($contact['url']);
$connlnk = 'follow/?url=' . $contact['url'];
$menu = [
'profile' => [t('View Profile'), $profile_link, true],
'follow' => [t('Connect/Follow'), $connlnk, true]
'profile' => [L10n::t('View Profile'), $profile_link, true],
'follow' => [L10n::t('Connect/Follow'), $connlnk, true]
];
return $menu;
@ -548,14 +549,14 @@ class Contact extends BaseObject
* "name" => [ "Label", "link", (bool)Should the link opened in a new tab? ]
*/
$menu = [
'status' => [t("View Status") , $status_link , true],
'profile' => [t("View Profile") , $profile_link , true],
'photos' => [t("View Photos") , $photos_link , true],
'network' => [t("Network Posts"), $posts_link , false],
'edit' => [t("View Contact") , $contact_url , false],
'drop' => [t("Drop Contact") , $contact_drop_link, false],
'pm' => [t("Send PM") , $pm_url , false],
'poke' => [t("Poke") , $poke_link , false],
'status' => [L10n::t("View Status") , $status_link , true],
'profile' => [L10n::t("View Profile") , $profile_link , true],
'photos' => [L10n::t("View Photos") , $photos_link , true],
'network' => [L10n::t("Network Posts"), $posts_link , false],
'edit' => [L10n::t("View Contact") , $contact_url , false],
'drop' => [L10n::t("Drop Contact") , $contact_drop_link, false],
'pm' => [L10n::t("Send PM") , $pm_url , false],
'poke' => [L10n::t("Poke") , $poke_link , false],
];
$args = ['contact' => $contact, 'menu' => &$menu];
@ -956,13 +957,13 @@ class Contact extends BaseObject
switch ($type) {
case ACCOUNT_TYPE_ORGANISATION:
$account_type = t("Organisation");
$account_type = L10n::t("Organisation");
break;
case ACCOUNT_TYPE_NEWS:
$account_type = t('News');
$account_type = L10n::t('News');
break;
case ACCOUNT_TYPE_COMMUNITY:
$account_type = t("Forum");
$account_type = L10n::t("Forum");
break;
default:
$account_type = "";
@ -1131,17 +1132,17 @@ class Contact extends BaseObject
$url = str_replace('/#!/', '/', $url);
if (!allowed_url($url)) {
$result['message'] = t('Disallowed profile URL.');
$result['message'] = L10n::t('Disallowed profile URL.');
return $result;
}
if (blocked_url($url)) {
$result['message'] = t('Blocked domain');
$result['message'] = L10n::t('Blocked domain');
return $result;
}
if (!$url) {
$result['message'] = t('Connect URL missing.');
$result['message'] = L10n::t('Connect URL missing.');
return $result;
}
@ -1173,8 +1174,8 @@ class Contact extends BaseObject
// NOTREACHED
}
} elseif (Config::get('system', 'dfrn_only')) {
$result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
$result['message'] = L10n::t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] != L10n::t('No compatible communication protocols or feeds were discovered.') . EOL;
return $result;
}
@ -1186,30 +1187,30 @@ class Contact extends BaseObject
// do we have enough information?
if (!((x($ret, 'name')) && (x($ret, 'poll')) && ((x($ret, 'url')) || (x($ret, 'addr'))))) {
$result['message'] .= t('The profile address specified does not provide adequate information.') . EOL;
$result['message'] .= L10n::t('The profile address specified does not provide adequate information.') . EOL;
if (!x($ret, 'poll')) {
$result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL;
$result['message'] .= L10n::t('No compatible communication protocols or feeds were discovered.') . EOL;
}
if (!x($ret, 'name')) {
$result['message'] .= t('An author or name was not found.') . EOL;
$result['message'] .= L10n::t('An author or name was not found.') . EOL;
}
if (!x($ret, 'url')) {
$result['message'] .= t('No browser URL could be matched to this address.') . EOL;
$result['message'] .= L10n::t('No browser URL could be matched to this address.') . EOL;
}
if (strpos($url, '@') !== false) {
$result['message'] .= t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
$result['message'] .= t('Use mailto: in front of address to force email check.') . EOL;
$result['message'] .= L10n::t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
$result['message'] .= L10n::t('Use mailto: in front of address to force email check.') . EOL;
}
return $result;
}
if ($ret['network'] === NETWORK_OSTATUS && Config::get('system', 'ostatus_disabled')) {
$result['message'] .= t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$result['message'] .= L10n::t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$ret['notify'] = '';
}
if (!$ret['notify']) {
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
$result['message'] .= L10n::t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
}
$writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
@ -1279,7 +1280,7 @@ class Contact extends BaseObject
$contact = dba::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
if (!DBM::is_result($contact)) {
$result['message'] .= t('Unable to retrieve contact information.') . EOL;
$result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
return $result;
}

View file

@ -2,7 +2,6 @@
/**
* @file src/Model/Group.php
*/
namespace Friendica\Model;
use Friendica\Core\L10n;
@ -327,7 +326,7 @@ class Group extends BaseObject
logger('groups: ' . print_r($display_groups, true));
if ($label == '') {
$label = t('Default privacy group for new contacts');
$label = L10n::t('Default privacy group for new contacts');
}
$o = replace_macros(get_markup_template('group_selection.tpl'), [
@ -360,7 +359,7 @@ class Group extends BaseObject
$display_groups = [
[
'text' => t('Everybody'),
'text' => L10n::t('Everybody'),
'id' => 0,
'selected' => (($group_id == 0) ? 'group-selected' : ''),
'href' => $every,
@ -380,7 +379,7 @@ class Group extends BaseObject
if ($editmode == 'full') {
$groupedit = [
'href' => 'group/' . $group['id'],
'title' => t('edit'),
'title' => L10n::t('edit'),
];
} else {
$groupedit = null;
@ -399,16 +398,16 @@ class Group extends BaseObject
$tpl = get_markup_template('group_side.tpl');
$o = replace_macros($tpl, [
'$add' => t('add'),
'$title' => t('Groups'),
'$add' => L10n::t('add'),
'$title' => L10n::t('Groups'),
'$groups' => $display_groups,
'newgroup' => $editmode == 'extended' || $editmode == 'full' ? 1 : '',
'grouppage' => 'group/',
'$edittext' => t('Edit group'),
'$ungrouped' => $every === 'contacts' ? t('Contacts not in any group') : '',
'$createtext' => t('Create a new group'),
'$creategroup' => t('Group Name: '),
'$editgroupstext' => t('Edit groups'),
'$edittext' => L10n::t('Edit group'),
'$ungrouped' => $every === 'contacts' ? L10n::t('Contacts not in any group') : '',
'$createtext' => L10n::t('Create a new group'),
'$creategroup' => L10n::t('Group Name: '),
'$editgroupstext' => L10n::t('Edit groups'),
'$form_security_token' => get_form_security_token('group_edit'),
]);

View file

@ -5,6 +5,7 @@
namespace Friendica\Model;
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -35,7 +36,7 @@ class Mail
}
if (!strlen($subject)) {
$subject = t('[no subject]');
$subject = L10n::t('[no subject]');
}
$me = dba::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
@ -168,7 +169,7 @@ class Mail
}
if (!strlen($subject)) {
$subject = t('[no subject]');
$subject = L10n::t('[no subject]');
}
$guid = get_guid(32);

View file

@ -2,7 +2,6 @@
/**
* @file src/Model/Profile.php
*/
namespace Friendica\Model;
use Friendica\App;
@ -163,7 +162,7 @@ class Profile
$a->page['aside'] .= replace_macros(
get_markup_template('profile_edlink.tpl'),
[
'$editprofile' => t('Edit profile'),
'$editprofile' => L10n::t('Edit profile'),
'$profid' => $a->profile['id']
]
);
@ -292,7 +291,7 @@ class Profile
// don't show connect link to yourself
$connect = $profile['uid'] != local_user() ? t('Connect') : false;
$connect = $profile['uid'] != local_user() ? L10n::t('Connect') : false;
// don't show connect link to authenticated visitors either
if (remote_user() && count($_SESSION['remote'])) {
@ -331,13 +330,13 @@ class Profile
}
if ($connect && ($profile['network'] == NETWORK_DFRN) && !isset($remoteconnect)) {
$subscribe_feed = t('Atom feed');
$subscribe_feed = L10n::t('Atom feed');
} else {
$subscribe_feed = false;
}
if (remote_user() || (self::getMyURL() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) {
$wallmessage = t('Message');
$wallmessage = L10n::t('Message');
$wallmessage_link = 'wallmessage/' . $profile['nickname'];
if (remote_user()) {
@ -367,15 +366,15 @@ class Profile
// show edit profile to yourself
if (!$is_contact && $profile['uid'] == local_user() && Feature::isEnabled(local_user(), 'multi_profiles')) {
$profile['edit'] = [System::baseUrl() . '/profiles', t('Profiles'), '', t('Manage/edit profiles')];
$profile['edit'] = [System::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')];
$r = q(
"SELECT * FROM `profile` WHERE `uid` = %d",
local_user()
);
$profile['menu'] = [
'chg_photo' => t('Change profile photo'),
'cr_new' => t('Create New Profile'),
'chg_photo' => L10n::t('Change profile photo'),
'cr_new' => L10n::t('Create New Profile'),
'entries' => [],
];
@ -384,19 +383,19 @@ class Profile
$profile['menu']['entries'][] = [
'photo' => $rr['thumb'],
'id' => $rr['id'],
'alt' => t('Profile Image'),
'alt' => L10n::t('Profile Image'),
'profile_name' => $rr['profile-name'],
'isdefault' => $rr['is-default'],
'visibile_to_everybody' => t('visible to everybody'),
'edit_visibility' => t('Edit visibility'),
'visibile_to_everybody' => L10n::t('visible to everybody'),
'edit_visibility' => L10n::t('Edit visibility'),
];
}
}
}
if (!$is_contact && $profile['uid'] == local_user() && !Feature::isEnabled(local_user(), 'multi_profiles')) {
$profile['edit'] = [System::baseUrl() . '/profiles/' . $profile['id'], t('Edit profile'), '', t('Edit profile')];
$profile['edit'] = [System::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
$profile['menu'] = [
'chg_photo' => t('Change profile photo'),
'chg_photo' => L10n::t('Change profile photo'),
'cr_new' => null,
'entries' => [],
];
@ -412,14 +411,14 @@ class Profile
|| x($profile, 'postal-code')
|| x($profile, 'country-name')
) {
$location = t('Location:');
$location = L10n::t('Location:');
}
$gender = x($profile, 'gender') ? t('Gender:') : false;
$marital = x($profile, 'marital') ? t('Status:') : false;
$homepage = x($profile, 'homepage') ? t('Homepage:') : false;
$about = x($profile, 'about') ? t('About:') : false;
$xmpp = x($profile, 'xmpp') ? t('XMPP:') : false;
$gender = x($profile, 'gender') ? L10n::t('Gender:') : false;
$marital = x($profile, 'marital') ? L10n::t('Status:') : false;
$homepage = x($profile, 'homepage') ? L10n::t('Homepage:') : false;
$about = x($profile, 'about') ? L10n::t('About:') : false;
$xmpp = x($profile, 'xmpp') ? L10n::t('XMPP:') : false;
if ((x($profile, 'hidewall') || $block) && !local_user() && !remote_user()) {
$location = $gender = $marital = $homepage = $about = false;
@ -513,7 +512,7 @@ class Profile
'$marital' => $marital,
'$homepage' => $homepage,
'$about' => $about,
'$network' => t('Network:'),
'$network' => L10n::t('Network:'),
'$contacts' => $contacts,
'$updated' => $updated,
'$diaspora' => $diaspora,
@ -543,8 +542,8 @@ class Profile
* return $o;
*/
$bd_format = t('g A l F d'); // 8 AM Friday January 18
$bd_short = t('F d');
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
$bd_short = L10n::t('F d');
$cachekey = 'get_birthdays:' . local_user();
$r = Cache::get($cachekey);
@ -599,7 +598,7 @@ class Profile
$rr['link'] = $url;
$rr['title'] = $rr['name'];
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
$rr['startime'] = null;
$rr['today'] = $today;
}
@ -610,8 +609,8 @@ class Profile
'$baseurl' => System::baseUrl(),
'$classtoday' => $classtoday,
'$count' => $total,
'$event_reminders' => t('Birthday Reminders'),
'$event_title' => t('Birthdays this week:'),
'$event_reminders' => L10n::t('Birthday Reminders'),
'$event_title' => L10n::t('Birthdays this week:'),
'$events' => $r,
'$lbr' => '{', // raw brackets mess up if/endif macro processing
'$rbr' => '}'
@ -635,7 +634,7 @@ class Profile
* return $o;
*/
$bd_format = t('g A l F d'); // 8 AM Friday January 18
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
$classtoday = '';
$s = dba::p(
@ -670,7 +669,7 @@ class Profile
$description = substr(strip_tags(bbcode($rr['desc'])), 0, 32) . '... ';
if (!$description) {
$description = t('[No description]');
$description = L10n::t('[No description]');
}
$strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start']);
@ -683,7 +682,7 @@ class Profile
$rr['title'] = $title;
$rr['description'] = $description;
$rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
$rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
$rr['startime'] = $strt;
$rr['today'] = $today;
@ -697,8 +696,8 @@ class Profile
'$baseurl' => System::baseUrl(),
'$classtoday' => $classtoday,
'$count' => count($r),
'$event_reminders' => t('Event Reminders'),
'$event_title' => t('Events this week:'),
'$event_reminders' => L10n::t('Event Reminders'),
'$event_title' => L10n::t('Events this week:'),
'$events' => $r,
]);
}
@ -710,7 +709,7 @@ class Profile
$o .= replace_macros(
get_markup_template('section_title.tpl'),
['$title' => t('Profile')]
['$title' => L10n::t('Profile')]
);
if ($a->profile['name']) {
@ -718,32 +717,32 @@ class Profile
$profile = [];
$profile['fullname'] = [t('Full Name:'), $a->profile['name']];
$profile['fullname'] = [L10n::t('Full Name:'), $a->profile['name']];
if ($a->profile['gender']) {
$profile['gender'] = [t('Gender:'), $a->profile['gender']];
$profile['gender'] = [L10n::t('Gender:'), $a->profile['gender']];
}
if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');
$year_bd_format = L10n::t('j F, Y');
$short_bd_format = L10n::t('j F');
$val = intval($a->profile['dob']) ?
day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format))
: day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
$profile['birthday'] = [t('Birthday:'), $val];
$profile['birthday'] = [L10n::t('Birthday:'), $val];
}
if (!empty($a->profile['dob'])
&& $a->profile['dob'] > '0001-01-01'
&& $age = age($a->profile['dob'], $a->profile['timezone'], '')
) {
$profile['age'] = [t('Age:'), $age];
$profile['age'] = [L10n::t('Age:'), $age];
}
if ($a->profile['marital']) {
$profile['marital'] = [t('Status:'), $a->profile['marital']];
$profile['marital'] = [L10n::t('Status:'), $a->profile['marital']];
}
/// @TODO Maybe use x() here, plus below?
@ -752,94 +751,94 @@ class Profile
}
if (strlen($a->profile['howlong']) && $a->profile['howlong'] >= NULL_DATE) {
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
$profile['howlong'] = relative_date($a->profile['howlong'], L10n::t('for %1$d %2$s'));
}
if ($a->profile['sexual']) {
$profile['sexual'] = [t('Sexual Preference:'), $a->profile['sexual']];
$profile['sexual'] = [L10n::t('Sexual Preference:'), $a->profile['sexual']];
}
if ($a->profile['homepage']) {
$profile['homepage'] = [t('Homepage:'), linkify($a->profile['homepage'])];
$profile['homepage'] = [L10n::t('Homepage:'), linkify($a->profile['homepage'])];
}
if ($a->profile['hometown']) {
$profile['hometown'] = [t('Hometown:'), linkify($a->profile['hometown'])];
$profile['hometown'] = [L10n::t('Hometown:'), linkify($a->profile['hometown'])];
}
if ($a->profile['pub_keywords']) {
$profile['pub_keywords'] = [t('Tags:'), $a->profile['pub_keywords']];
$profile['pub_keywords'] = [L10n::t('Tags:'), $a->profile['pub_keywords']];
}
if ($a->profile['politic']) {
$profile['politic'] = [t('Political Views:'), $a->profile['politic']];
$profile['politic'] = [L10n::t('Political Views:'), $a->profile['politic']];
}
if ($a->profile['religion']) {
$profile['religion'] = [t('Religion:'), $a->profile['religion']];
$profile['religion'] = [L10n::t('Religion:'), $a->profile['religion']];
}
if ($txt = prepare_text($a->profile['about'])) {
$profile['about'] = [t('About:'), $txt];
$profile['about'] = [L10n::t('About:'), $txt];
}
if ($txt = prepare_text($a->profile['interest'])) {
$profile['interest'] = [t('Hobbies/Interests:'), $txt];
$profile['interest'] = [L10n::t('Hobbies/Interests:'), $txt];
}
if ($txt = prepare_text($a->profile['likes'])) {
$profile['likes'] = [t('Likes:'), $txt];
$profile['likes'] = [L10n::t('Likes:'), $txt];
}
if ($txt = prepare_text($a->profile['dislikes'])) {
$profile['dislikes'] = [t('Dislikes:'), $txt];
$profile['dislikes'] = [L10n::t('Dislikes:'), $txt];
}
if ($txt = prepare_text($a->profile['contact'])) {
$profile['contact'] = [t('Contact information and Social Networks:'), $txt];
$profile['contact'] = [L10n::t('Contact information and Social Networks:'), $txt];
}
if ($txt = prepare_text($a->profile['music'])) {
$profile['music'] = [t('Musical interests:'), $txt];
$profile['music'] = [L10n::t('Musical interests:'), $txt];
}
if ($txt = prepare_text($a->profile['book'])) {
$profile['book'] = [t('Books, literature:'), $txt];
$profile['book'] = [L10n::t('Books, literature:'), $txt];
}
if ($txt = prepare_text($a->profile['tv'])) {
$profile['tv'] = [t('Television:'), $txt];
$profile['tv'] = [L10n::t('Television:'), $txt];
}
if ($txt = prepare_text($a->profile['film'])) {
$profile['film'] = [t('Film/dance/culture/entertainment:'), $txt];
$profile['film'] = [L10n::t('Film/dance/culture/entertainment:'), $txt];
}
if ($txt = prepare_text($a->profile['romance'])) {
$profile['romance'] = [t('Love/Romance:'), $txt];
$profile['romance'] = [L10n::t('Love/Romance:'), $txt];
}
if ($txt = prepare_text($a->profile['work'])) {
$profile['work'] = [t('Work/employment:'), $txt];
$profile['work'] = [L10n::t('Work/employment:'), $txt];
}
if ($txt = prepare_text($a->profile['education'])) {
$profile['education'] = [t('School/education:'), $txt];
$profile['education'] = [L10n::t('School/education:'), $txt];
}
//show subcribed forum if it is enabled in the usersettings
if (Feature::isEnabled($uid, 'forumlist_profile')) {
$profile['forumlist'] = [t('Forums:'), ForumManager::profileAdvanced($uid)];
$profile['forumlist'] = [L10n::t('Forums:'), ForumManager::profileAdvanced($uid)];
}
if ($a->profile['uid'] == local_user()) {
$profile['edit'] = [System::baseUrl() . '/profiles/' . $a->profile['id'], t('Edit profile'), '', t('Edit profile')];
$profile['edit'] = [System::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
}
return replace_macros($tpl, [
'$title' => t('Profile'),
'$basic' => t('Basic'),
'$advanced' => t('Advanced'),
'$title' => L10n::t('Profile'),
'$basic' => L10n::t('Basic'),
'$advanced' => L10n::t('Advanced'),
'$profile' => $profile
]);
}
@ -862,34 +861,34 @@ class Profile
$tabs = [
[
'label' => t('Status'),
'label' => L10n::t('Status'),
'url' => $url,
'sel' => !$tab && $a->argv[0] == 'profile' ? 'active' : '',
'title' => t('Status Messages and Posts'),
'title' => L10n::t('Status Messages and Posts'),
'id' => 'status-tab',
'accesskey' => 'm',
],
[
'label' => t('Profile'),
'label' => L10n::t('Profile'),
'url' => $url . '/?tab=profile',
'sel' => $tab == 'profile' ? 'active' : '',
'title' => t('Profile Details'),
'title' => L10n::t('Profile Details'),
'id' => 'profile-tab',
'accesskey' => 'r',
],
[
'label' => t('Photos'),
'label' => L10n::t('Photos'),
'url' => System::baseUrl() . '/photos/' . $nickname,
'sel' => !$tab && $a->argv[0] == 'photos' ? 'active' : '',
'title' => t('Photo Albums'),
'title' => L10n::t('Photo Albums'),
'id' => 'photo-tab',
'accesskey' => 'h',
],
[
'label' => t('Videos'),
'label' => L10n::t('Videos'),
'url' => System::baseUrl() . '/videos/' . $nickname,
'sel' => !$tab && $a->argv[0] == 'videos' ? 'active' : '',
'title' => t('Videos'),
'title' => L10n::t('Videos'),
'id' => 'video-tab',
'accesskey' => 'v',
],
@ -898,10 +897,10 @@ class Profile
// the calendar link for the full featured events calendar
if ($is_owner && $a->theme_events_in_profile) {
$tabs[] = [
'label' => t('Events'),
'label' => L10n::t('Events'),
'url' => System::baseUrl() . '/events',
'sel' => !$tab && $a->argv[0] == 'events' ? 'active' : '',
'title' => t('Events and Calendar'),
'title' => L10n::t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
];
@ -909,10 +908,10 @@ class Profile
// with the public events of the calendar owner
} elseif (!$is_owner) {
$tabs[] = [
'label' => t('Events'),
'label' => L10n::t('Events'),
'url' => System::baseUrl() . '/cal/' . $nickname,
'sel' => !$tab && $a->argv[0] == 'cal' ? 'active' : '',
'title' => t('Events and Calendar'),
'title' => L10n::t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
];
@ -920,10 +919,10 @@ class Profile
if ($is_owner) {
$tabs[] = [
'label' => t('Personal Notes'),
'label' => L10n::t('Personal Notes'),
'url' => System::baseUrl() . '/notes',
'sel' => !$tab && $a->argv[0] == 'notes' ? 'active' : '',
'title' => t('Only You Can See This'),
'title' => L10n::t('Only You Can See This'),
'id' => 'notes-tab',
'accesskey' => 't',
];
@ -931,10 +930,10 @@ class Profile
if ((!$is_owner) && ((count($a->profile)) || (!$a->profile['hide-friends']))) {
$tabs[] = [
'label' => t('Contacts'),
'label' => L10n::t('Contacts'),
'url' => System::baseUrl() . '/viewcontacts/' . $nickname,
'sel' => !$tab && $a->argv[0] == 'viewcontacts' ? 'active' : '',
'title' => t('Contacts'),
'title' => L10n::t('Contacts'),
'id' => 'viewcontacts-tab',
'accesskey' => 'k',
];

View file

@ -1,15 +1,14 @@
<?php
/**
* @file src/Model/User.php
* @brief This file includes the User class with user related database functions
*/
namespace Friendica\Model;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -266,25 +265,25 @@ class User
$netpublish = strlen(Config::get('system', 'directory')) ? $publish : 0;
if ($password1 != $confirm) {
throw new Exception(t('Passwords do not match. Password unchanged.'));
throw new Exception(L10n::t('Passwords do not match. Password unchanged.'));
} elseif ($password1 != '') {
$password = $password1;
}
if ($using_invites) {
if (!$invite_id) {
throw new Exception(t('An invitation is required.'));
throw new Exception(L10n::t('An invitation is required.'));
}
if (!dba::exists('register', ['hash' => $invite_id])) {
throw new Exception(t('Invitation could not be verified.'));
throw new Exception(L10n::t('Invitation could not be verified.'));
}
}
if (!x($username) || !x($email) || !x($nickname)) {
if ($openid_url) {
if (!validate_url($openid_url)) {
throw new Exception(t('Invalid OpenID url'));
throw new Exception(L10n::t('Invalid OpenID url'));
}
$_SESSION['register'] = 1;
$_SESSION['openid'] = $openid_url;
@ -297,13 +296,13 @@ class User
try {
$authurl = $openid->authUrl();
} catch (Exception $e) {
throw new Exception(t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . EOL . EOL . t('The error message was:') . $e->getMessage(), 0, $e);
throw new Exception(L10n::t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . EOL . EOL . L10n::t('The error message was:') . $e->getMessage(), 0, $e);
}
goaway($authurl);
// NOTREACHED
}
throw new Exception(t('Please enter the required information.'));
throw new Exception(L10n::t('Please enter the required information.'));
}
if (!validate_url($openid_url)) {
@ -316,10 +315,10 @@ class User
$username = preg_replace('/ +/', ' ', $username);
if (mb_strlen($username) > 48) {
throw new Exception(t('Please use a shorter name.'));
throw new Exception(L10n::t('Please use a shorter name.'));
}
if (mb_strlen($username) < 3) {
throw new Exception(t('Name too short.'));
throw new Exception(L10n::t('Name too short.'));
}
// So now we are just looking for a space in the full name.
@ -327,20 +326,20 @@ class User
if (!$loose_reg) {
$username = mb_convert_case($username, MB_CASE_TITLE, 'UTF-8');
if (!strpos($username, ' ')) {
throw new Exception(t("That doesn't appear to be your full \x28First Last\x29 name."));
throw new Exception(L10n::t("That doesn't appear to be your full \x28First Last\x29 name."));
}
}
if (!allowed_email($email)) {
throw new Exception(t('Your email domain is not among those allowed on this site.'));
throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
}
if (!valid_email($email) || !validate_email($email)) {
throw new Exception(t('Not a valid email address.'));
throw new Exception(L10n::t('Not a valid email address.'));
}
if (dba::exists('user', ['email' => $email])) {
throw new Exception(t('Cannot use that email.'));
throw new Exception(L10n::t('Cannot use that email.'));
}
// Disallow somebody creating an account using openid that uses the admin email address,
@ -348,21 +347,21 @@ class User
if (x($a->config, 'admin_email') && strlen($openid_url)) {
$adminlist = explode(',', str_replace(' ', '', strtolower($a->config['admin_email'])));
if (in_array(strtolower($email), $adminlist)) {
throw new Exception(t('Cannot use that email.'));
throw new Exception(L10n::t('Cannot use that email.'));
}
}
$nickname = $data['nickname'] = strtolower($nickname);
if (!preg_match('/^[a-z0-9][a-z0-9\_]*$/', $nickname)) {
throw new Exception(t('Your "nickname" can only contain "a-z", "0-9" and "_".'));
throw new Exception(L10n::t('Your "nickname" can only contain "a-z", "0-9" and "_".'));
}
// Check existing and deleted accounts for this nickname.
if (dba::exists('user', ['nickname' => $nickname])
|| dba::exists('userd', ['username' => $nickname])
) {
throw new Exception(t('Nickname is already registered. Please choose another.'));
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
}
$new_password = strlen($password) ? $password : User::generateNewPassword();
@ -372,7 +371,7 @@ class User
$keys = Crypto::newKeypair(4096);
if ($keys === false) {
throw new Exception(t('SERIOUS ERROR: Generation of security keys failed.'));
throw new Exception(L10n::t('SERIOUS ERROR: Generation of security keys failed.'));
}
$prvkey = $keys['prvkey'];
@ -405,11 +404,11 @@ class User
$uid = dba::lastInsertId();
$user = dba::selectFirst('user', [], ['uid' => $uid]);
} else {
throw new Exception(t('An error occurred during registration. Please try again.'));
throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
}
if (!$uid) {
throw new Exception(t('An error occurred during registration. Please try again.'));
throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
}
// if somebody clicked submit twice very quickly, they could end up with two accounts
@ -418,7 +417,7 @@ class User
if ($user_count > 1) {
dba::delete('user', ['uid' => $uid]);
throw new Exception(t('Nickname is already registered. Please choose another.'));
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
}
$insert_result = dba::insert('profile', [
@ -429,28 +428,28 @@ class User
'publish' => $publish,
'is-default' => 1,
'net-publish' => $netpublish,
'profile-name' => t('default')
'profile-name' => L10n::t('default')
]);
if (!$insert_result) {
dba::delete('user', ['uid' => $uid]);
throw new Exception(t('An error occurred creating your default profile. Please try again.'));
throw new Exception(L10n::t('An error occurred creating your default profile. Please try again.'));
}
// Create the self contact
if (!Contact::createSelfFromUserId($uid)) {
dba::delete('user', ['uid' => $uid]);
throw new Exception(t('An error occurred creating your self contact. Please try again.'));
throw new Exception(L10n::t('An error occurred creating your self contact. Please try again.'));
}
// Create a group with no members. This allows somebody to use it
// right away as a default group for new contacts.
$def_gid = Group::create($uid, t('Friends'));
$def_gid = Group::create($uid, L10n::t('Friends'));
if (!$def_gid) {
dba::delete('user', ['uid' => $uid]);
throw new Exception(t('An error occurred creating your default contact group. Please try again.'));
throw new Exception(L10n::t('An error occurred creating your default contact group. Please try again.'));
}
$fields = ['def_gid' => $def_gid];
@ -480,7 +479,7 @@ class User
$hash = photo_new_resource();
$r = Photo::store($Image, $uid, 0, $hash, $filename, t('Profile Photos'), 4);
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 4);
if ($r === false) {
$photo_failure = true;
@ -488,7 +487,7 @@ class User
$Image->scaleDown(80);
$r = Photo::store($Image, $uid, 0, $hash, $filename, t('Profile Photos'), 5);
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 5);
if ($r === false) {
$photo_failure = true;
@ -496,7 +495,7 @@ class User
$Image->scaleDown(48);
$r = Photo::store($Image, $uid, 0, $hash, $filename, t('Profile Photos'), 6);
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 6);
if ($r === false) {
$photo_failure = true;
@ -524,7 +523,7 @@ class User
*/
public static function sendRegisterPendingEmail($email, $sitename, $username)
{
$body = deindent(t('
$body = deindent(L10n::t('
Dear %1$s,
Thank you for registering at %2$s. Your account is pending for approval by the administrator.
'));
@ -534,7 +533,7 @@ class User
return notification([
'type' => SYSTEM_EMAIL,
'to_email' => $email,
'subject'=> sprintf( t('Registration at %s'), $sitename),
'subject'=> sprintf(L10n::t('Registration at %s'), $sitename),
'body' => $body]);
}
@ -552,11 +551,11 @@ class User
*/
public static function sendRegisterOpenEmail($email, $sitename, $siteurl, $username, $password)
{
$preamble = deindent(t('
$preamble = deindent(L10n::t('
Dear %1$s,
Thank you for registering at %2$s. Your account has been created.
'));
$body = deindent(t('
$body = deindent(L10n::t('
The login details are as follows:
Site Location: %3$s
Login Name: %1$s
@ -588,7 +587,7 @@ class User
return notification([
'type' => SYSTEM_EMAIL,
'to_email' => $email,
'subject'=> sprintf( t('Registration details for %s'), $sitename),
'subject'=> sprintf(L10n::t('Registration details for %s'), $sitename),
'preamble'=> $preamble,
'body' => $body]);
}