Move L10n::t() calls to DI::l10n()->t() calls

This commit is contained in:
nupplaPhil 2020-01-18 20:52:34 +01:00
parent af88c2daa3
commit 5dfee31108
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
175 changed files with 2841 additions and 2841 deletions

View file

@ -1207,7 +1207,7 @@ class Contact
if (empty($contact['uid']) || ($contact['uid'] != $uid)) {
if ($uid == 0) {
$profile_link = self::magicLink($contact['url']);
$menu = ['profile' => [L10n::t('View Profile'), $profile_link, true]];
$menu = ['profile' => [DI::l10n()->t('View Profile'), $profile_link, true]];
return $menu;
}
@ -1269,30 +1269,30 @@ class Contact
*/
if (empty($contact['uid'])) {
$menu = [
'profile' => [L10n::t('View Profile') , $profile_link , true],
'network' => [L10n::t('Network Posts') , $posts_link , false],
'edit' => [L10n::t('View Contact') , $contact_url , false],
'follow' => [L10n::t('Connect/Follow'), $follow_link , true],
'unfollow'=> [L10n::t('UnFollow') , $unfollow_link, true],
'profile' => [DI::l10n()->t('View Profile') , $profile_link , true],
'network' => [DI::l10n()->t('Network Posts') , $posts_link , false],
'edit' => [DI::l10n()->t('View Contact') , $contact_url , false],
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link , true],
'unfollow'=> [DI::l10n()->t('UnFollow') , $unfollow_link, true],
];
} else {
$menu = [
'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],
'follow' => [L10n::t('Connect/Follow'), $follow_link , true],
'unfollow'=> [L10n::t('UnFollow') , $unfollow_link , true],
'status' => [DI::l10n()->t('View Status') , $status_link , true],
'profile' => [DI::l10n()->t('View Profile') , $profile_link , true],
'photos' => [DI::l10n()->t('View Photos') , $photos_link , true],
'network' => [DI::l10n()->t('Network Posts') , $posts_link , false],
'edit' => [DI::l10n()->t('View Contact') , $contact_url , false],
'drop' => [DI::l10n()->t('Drop Contact') , $contact_drop_link, false],
'pm' => [DI::l10n()->t('Send PM') , $pm_url , false],
'poke' => [DI::l10n()->t('Poke') , $poke_link , false],
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link , true],
'unfollow'=> [DI::l10n()->t('UnFollow') , $unfollow_link , true],
];
if (!empty($contact['pending'])) {
$intro = DBA::selectFirst('intro', ['id'], ['contact-id' => $contact['id']]);
if (DBA::isResult($intro)) {
$menu['follow'] = [L10n::t('Approve'), 'notifications/intros/' . $intro['id'], true];
$menu['follow'] = [DI::l10n()->t('Approve'), 'notifications/intros/' . $intro['id'], true];
}
}
}
@ -1851,15 +1851,15 @@ class Contact
switch ($type) {
case self::TYPE_ORGANISATION:
$account_type = L10n::t("Organisation");
$account_type = DI::l10n()->t("Organisation");
break;
case self::TYPE_NEWS:
$account_type = L10n::t('News');
$account_type = DI::l10n()->t('News');
break;
case self::TYPE_COMMUNITY:
$account_type = L10n::t("Forum");
$account_type = DI::l10n()->t("Forum");
break;
default:
@ -2264,17 +2264,17 @@ class Contact
$url = str_replace('/#!/', '/', $url);
if (!Network::isUrlAllowed($url)) {
$result['message'] = L10n::t('Disallowed profile URL.');
$result['message'] = DI::l10n()->t('Disallowed profile URL.');
return $result;
}
if (Network::isUrlBlocked($url)) {
$result['message'] = L10n::t('Blocked domain');
$result['message'] = DI::l10n()->t('Blocked domain');
return $result;
}
if (!$url) {
$result['message'] = L10n::t('Connect URL missing.');
$result['message'] = DI::l10n()->t('Connect URL missing.');
return $result;
}
@ -2283,7 +2283,7 @@ class Contact
Hook::callAll('follow', $arr);
if (empty($arr)) {
$result['message'] = L10n::t('The contact could not be added. Please check the relevant network credentials in your Settings -> Social Networks page.');
$result['message'] = DI::l10n()->t('The contact could not be added. Please check the relevant network credentials in your Settings -> Social Networks page.');
return $result;
}
@ -2324,8 +2324,8 @@ class Contact
// NOTREACHED
}
} elseif (Config::get('system', 'dfrn_only') && ($ret['network'] != Protocol::DFRN)) {
$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;
$result['message'] = DI::l10n()->t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
return $result;
}
@ -2336,30 +2336,30 @@ class Contact
// do we have enough information?
if (empty($ret['name']) || empty($ret['poll']) || (empty($ret['url']) && empty($ret['addr']))) {
$result['message'] .= L10n::t('The profile address specified does not provide adequate information.') . EOL;
$result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . EOL;
if (empty($ret['poll'])) {
$result['message'] .= L10n::t('No compatible communication protocols or feeds were discovered.') . EOL;
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
}
if (empty($ret['name'])) {
$result['message'] .= L10n::t('An author or name was not found.') . EOL;
$result['message'] .= DI::l10n()->t('An author or name was not found.') . EOL;
}
if (empty($ret['url'])) {
$result['message'] .= L10n::t('No browser URL could be matched to this address.') . EOL;
$result['message'] .= DI::l10n()->t('No browser URL could be matched to this address.') . EOL;
}
if (strpos($url, '@') !== false) {
$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;
$result['message'] .= DI::l10n()->t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
$result['message'] .= DI::l10n()->t('Use mailto: in front of address to force email check.') . EOL;
}
return $result;
}
if ($protocol === Protocol::OSTATUS && Config::get('system', 'ostatus_disabled')) {
$result['message'] .= L10n::t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
$result['message'] .= DI::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'] .= L10n::t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
}
$writeable = ((($protocol === Protocol::OSTATUS) && ($ret['notify'])) ? 1 : 0);
@ -2420,7 +2420,7 @@ class Contact
$contact = DBA::selectFirst('contact', [], ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
if (!DBA::isResult($contact)) {
$result['message'] .= L10n::t('Unable to retrieve contact information.') . EOL;
$result['message'] .= DI::l10n()->t('Unable to retrieve contact information.') . EOL;
return $result;
}
@ -2641,7 +2641,7 @@ class Contact
'to_email' => $user['email'],
'uid' => $user['uid'],
'link' => DI::baseUrl() . '/notifications/intro',
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : DI::l10n()->t('[Name Withheld]')),
'source_link' => $contact_record['url'],
'source_photo' => $contact_record['photo'],
'verb' => ($sharing ? Activity::FRIEND : Activity::FOLLOW),

View file

@ -31,7 +31,7 @@ class Event
return '';
}
$bd_format = L10n::t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
$bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
$event_start = L10n::getDay(
!empty($event['adjust']) ?
@ -58,14 +58,14 @@ class Event
$o .= "<div>" . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . "</div>";
}
$o .= "<h4>" . L10n::t('Starts:') . "</h4><p>" . $event_start . "</p>";
$o .= "<h4>" . DI::l10n()->t('Starts:') . "</h4><p>" . $event_start . "</p>";
if (!$event['nofinish']) {
$o .= "<h4>" . L10n::t('Finishes:') . "</h4><p>" . $event_end . "</p>";
$o .= "<h4>" . DI::l10n()->t('Finishes:') . "</h4><p>" . $event_end . "</p>";
}
if (!empty($event['location'])) {
$o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "</p>";
$o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "</p>";
}
return $o;
@ -75,13 +75,13 @@ class Event
$o .= '<div class="summary event-summary">' . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . '</div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . L10n::t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
$o .= '<div class="event-start"><span class="event-label">' . DI::l10n()->t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
. '" >' . $event_start
. '</span></div>' . "\r\n";
if (!$event['nofinish']) {
$o .= '<div class="event-end" ><span class="event-label">' . L10n::t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
$o .= '<div class="event-end" ><span class="event-label">' . DI::l10n()->t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
. DateTimeFormat::utc($event['finish'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
. '" >' . $event_end
. '</span></div>' . "\r\n";
@ -92,7 +92,7 @@ class Event
}
if (!empty($event['location'])) {
$o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span>&nbsp;<span class="location">'
$o .= '<div class="event-location"><span class="event-label">' . DI::l10n()->t('Location:') . '</span>&nbsp;<span class="location">'
. BBCode::convert(Strings::escapeHtml($event['location']), false, $simple)
. '</span></div>' . "\r\n";
@ -382,59 +382,59 @@ class Event
$i18n = [
"firstDay" => $firstDay,
"allday" => L10n::t("all-day"),
"allday" => DI::l10n()->t("all-day"),
"Sun" => L10n::t("Sun"),
"Mon" => L10n::t("Mon"),
"Tue" => L10n::t("Tue"),
"Wed" => L10n::t("Wed"),
"Thu" => L10n::t("Thu"),
"Fri" => L10n::t("Fri"),
"Sat" => L10n::t("Sat"),
"Sun" => DI::l10n()->t("Sun"),
"Mon" => DI::l10n()->t("Mon"),
"Tue" => DI::l10n()->t("Tue"),
"Wed" => DI::l10n()->t("Wed"),
"Thu" => DI::l10n()->t("Thu"),
"Fri" => DI::l10n()->t("Fri"),
"Sat" => DI::l10n()->t("Sat"),
"Sunday" => L10n::t("Sunday"),
"Monday" => L10n::t("Monday"),
"Tuesday" => L10n::t("Tuesday"),
"Wednesday" => L10n::t("Wednesday"),
"Thursday" => L10n::t("Thursday"),
"Friday" => L10n::t("Friday"),
"Saturday" => L10n::t("Saturday"),
"Sunday" => DI::l10n()->t("Sunday"),
"Monday" => DI::l10n()->t("Monday"),
"Tuesday" => DI::l10n()->t("Tuesday"),
"Wednesday" => DI::l10n()->t("Wednesday"),
"Thursday" => DI::l10n()->t("Thursday"),
"Friday" => DI::l10n()->t("Friday"),
"Saturday" => DI::l10n()->t("Saturday"),
"Jan" => L10n::t("Jan"),
"Feb" => L10n::t("Feb"),
"Mar" => L10n::t("Mar"),
"Apr" => L10n::t("Apr"),
"May" => L10n::t("May"),
"Jun" => L10n::t("Jun"),
"Jul" => L10n::t("Jul"),
"Aug" => L10n::t("Aug"),
"Sep" => L10n::t("Sept"),
"Oct" => L10n::t("Oct"),
"Nov" => L10n::t("Nov"),
"Dec" => L10n::t("Dec"),
"Jan" => DI::l10n()->t("Jan"),
"Feb" => DI::l10n()->t("Feb"),
"Mar" => DI::l10n()->t("Mar"),
"Apr" => DI::l10n()->t("Apr"),
"May" => DI::l10n()->t("May"),
"Jun" => DI::l10n()->t("Jun"),
"Jul" => DI::l10n()->t("Jul"),
"Aug" => DI::l10n()->t("Aug"),
"Sep" => DI::l10n()->t("Sept"),
"Oct" => DI::l10n()->t("Oct"),
"Nov" => DI::l10n()->t("Nov"),
"Dec" => DI::l10n()->t("Dec"),
"January" => L10n::t("January"),
"February" => L10n::t("February"),
"March" => L10n::t("March"),
"April" => L10n::t("April"),
"June" => L10n::t("June"),
"July" => L10n::t("July"),
"August" => L10n::t("August"),
"September" => L10n::t("September"),
"October" => L10n::t("October"),
"November" => L10n::t("November"),
"December" => L10n::t("December"),
"January" => DI::l10n()->t("January"),
"February" => DI::l10n()->t("February"),
"March" => DI::l10n()->t("March"),
"April" => DI::l10n()->t("April"),
"June" => DI::l10n()->t("June"),
"July" => DI::l10n()->t("July"),
"August" => DI::l10n()->t("August"),
"September" => DI::l10n()->t("September"),
"October" => DI::l10n()->t("October"),
"November" => DI::l10n()->t("November"),
"December" => DI::l10n()->t("December"),
"today" => L10n::t("today"),
"month" => L10n::t("month"),
"week" => L10n::t("week"),
"day" => L10n::t("day"),
"today" => DI::l10n()->t("today"),
"month" => DI::l10n()->t("month"),
"week" => DI::l10n()->t("week"),
"day" => DI::l10n()->t("day"),
"noevent" => L10n::t("No events to display"),
"noevent" => DI::l10n()->t("No events to display"),
"dtstart_label" => L10n::t("Starts:"),
"dtend_label" => L10n::t("Finishes:"),
"location_label" => L10n::t("Location:")
"dtstart_label" => DI::l10n()->t("Starts:"),
"dtend_label" => DI::l10n()->t("Finishes:"),
"location_label" => DI::l10n()->t("Location:")
];
return $i18n;
@ -558,7 +558,7 @@ class Event
$event_list = [];
$last_date = '';
$fmt = L10n::t('l, F j');
$fmt = DI::l10n()->t('l, F j');
foreach ($event_result as $event) {
$item = Item::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]);
if (!DBA::isResult($item)) {
@ -589,9 +589,9 @@ class Event
$copy = null;
$drop = null;
if (local_user() && local_user() == $event['uid'] && $event['type'] == 'event') {
$edit = !$event['cid'] ? [DI::baseUrl() . '/events/event/' . $event['id'], L10n::t('Edit event') , '', ''] : null;
$copy = !$event['cid'] ? [DI::baseUrl() . '/events/copy/' . $event['id'] , L10n::t('Duplicate event'), '', ''] : null;
$drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , L10n::t('Delete event') , '', ''];
$edit = !$event['cid'] ? [DI::baseUrl() . '/events/event/' . $event['id'], DI::l10n()->t('Edit event') , '', ''] : null;
$copy = !$event['cid'] ? [DI::baseUrl() . '/events/copy/' . $event['id'] , DI::l10n()->t('Duplicate event'), '', ''] : null;
$drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , DI::l10n()->t('Delete event') , '', ''];
}
$title = BBCode::convert(Strings::escapeHtml($event['summary']));
@ -623,7 +623,7 @@ class Event
'is_first' => $is_first,
'item' => $event,
'html' => $html,
'plink' => [$event['plink'], L10n::t('link to source'), '', ''],
'plink' => [$event['plink'], DI::l10n()->t('link to source'), '', ''],
];
}
@ -844,9 +844,9 @@ class Event
$finish = false;
// Set the different time formats.
$dformat = L10n::t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM.
$dformat_short = L10n::t('D g:i A'); // Fri 8:01 AM.
$tformat = L10n::t('g:i A'); // 8:01 AM.
$dformat = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8:01 AM.
$dformat_short = DI::l10n()->t('D g:i A'); // Fri 8:01 AM.
$tformat = DI::l10n()->t('g:i A'); // 8:01 AM.
// Convert the time to different formats.
$dtstart_dt = L10n::getDay(
@ -912,11 +912,11 @@ class Event
$return = Renderer::replaceMacros($tpl, [
'$id' => $item['event-id'],
'$title' => BBCode::convert($item['event-summary']),
'$dtstart_label' => L10n::t('Starts:'),
'$dtstart_label' => DI::l10n()->t('Starts:'),
'$dtstart_title' => $dtstart_title,
'$dtstart_dt' => $dtstart_dt,
'$finish' => $finish,
'$dtend_label' => L10n::t('Finishes:'),
'$dtend_label' => DI::l10n()->t('Finishes:'),
'$dtend_title' => $dtend_title,
'$dtend_dt' => $dtend_dt,
'$month_short' => $month_short,
@ -930,10 +930,10 @@ class Event
'$author_link' => $profile_link,
'$author_avatar' => $item['author-avatar'],
'$description' => BBCode::convert($item['event-desc']),
'$location_label' => L10n::t('Location:'),
'$show_map_label' => L10n::t('Show map'),
'$hide_map_label' => L10n::t('Hide map'),
'$map_btn_label' => L10n::t('Show map'),
'$location_label' => DI::l10n()->t('Location:'),
'$show_map_label' => DI::l10n()->t('Show map'),
'$hide_map_label' => DI::l10n()->t('Hide map'),
'$map_btn_label' => DI::l10n()->t('Show map'),
'$location' => $location
]);
@ -1024,8 +1024,8 @@ class Event
'cid' => $contact['id'],
'start' => DateTimeFormat::utc($birthday),
'finish' => DateTimeFormat::utc($birthday . ' + 1 day '),
'summary' => L10n::t('%s\'s birthday', $contact['name']),
'desc' => L10n::t('Happy Birthday %s', ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'),
'summary' => DI::l10n()->t('%s\'s birthday', $contact['name']),
'desc' => DI::l10n()->t('Happy Birthday %s', ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'),
'type' => 'birthday',
'adjust' => 0
];

View file

@ -262,7 +262,7 @@ class FileTag
DI::pConfig()->set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
}
info(L10n::t('Item filed'));
info(DI::l10n()->t('Item filed'));
}
return true;

View file

@ -73,7 +73,7 @@ class Group
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
if (DBA::isResult($group) && $group['deleted']) {
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
notice(L10n::t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
}
return true;
}
@ -422,7 +422,7 @@ class Group
Logger::info('Got groups', $display_groups);
if ($label == '') {
$label = L10n::t('Default privacy group for new contacts');
$label = DI::l10n()->t('Default privacy group for new contacts');
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('group_selection.tpl'), [
@ -454,7 +454,7 @@ class Group
$display_groups = [
[
'text' => L10n::t('Everybody'),
'text' => DI::l10n()->t('Everybody'),
'id' => 0,
'selected' => (($group_id === 'everyone') ? 'group-selected' : ''),
'href' => $every,
@ -473,7 +473,7 @@ class Group
if ($editmode == 'full') {
$groupedit = [
'href' => 'group/' . $group['id'],
'title' => L10n::t('edit'),
'title' => DI::l10n()->t('edit'),
];
} else {
$groupedit = null;
@ -498,17 +498,17 @@ class Group
$tpl = Renderer::getMarkupTemplate('group_side.tpl');
$o = Renderer::replaceMacros($tpl, [
'$add' => L10n::t('add'),
'$title' => L10n::t('Groups'),
'$add' => DI::l10n()->t('add'),
'$title' => DI::l10n()->t('Groups'),
'$groups' => $display_groups,
'newgroup' => $editmode == 'extended' || $editmode == 'full' ? 1 : '',
'grouppage' => 'group/',
'$edittext' => L10n::t('Edit group'),
'$ungrouped' => $every === 'contact' ? L10n::t('Contacts not in any group') : '',
'$edittext' => DI::l10n()->t('Edit group'),
'$ungrouped' => $every === 'contact' ? DI::l10n()->t('Contacts not in any group') : '',
'$ungrouped_selected' => (($group_id === 'none') ? 'group-selected' : ''),
'$createtext' => L10n::t('Create a new group'),
'$creategroup' => L10n::t('Group Name: '),
'$editgroupstext' => L10n::t('Edit groups'),
'$createtext' => DI::l10n()->t('Create a new group'),
'$creategroup' => DI::l10n()->t('Group Name: '),
'$editgroupstext' => DI::l10n()->t('Edit groups'),
'$form_security_token' => BaseModule::getFormSecurityToken('group_edit'),
]);

View file

@ -3388,16 +3388,16 @@ class Item
public static function postType($item)
{
if (!empty($item['event-id'])) {
return L10n::t('event');
return DI::l10n()->t('event');
} elseif (!empty($item['resource-id'])) {
return L10n::t('photo');
return DI::l10n()->t('photo');
} elseif (!empty($item['verb']) && $item['verb'] !== Activity::POST) {
return L10n::t('activity');
return DI::l10n()->t('activity');
} elseif ($item['id'] != $item['parent']) {
return L10n::t('comment');
return DI::l10n()->t('comment');
}
return L10n::t('post');
return DI::l10n()->t('post');
}
/**
@ -3520,7 +3520,7 @@ class Item
$filter_reasons = [];
if (!$is_preview && public_contact() != $item['author-id']) {
if (!empty($item['content-warning']) && (!local_user() || !DI::pConfig()->get(local_user(), 'system', 'disable_cw', false))) {
$filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
$filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']);
}
$hook_data = [
@ -3580,7 +3580,7 @@ class Item
$as .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
'$video' => [
'id' => $id,
'title' => L10n::t('View Video'),
'title' => DI::l10n()->t('View Video'),
'src' => $the_url,
'mime' => $mime,
],
@ -3597,7 +3597,7 @@ class Item
}
$title = Strings::escapeHtml(trim(($mtch[4] ?? '') ?: $mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . L10n::t('bytes');
$title .= ' ' . $mtch[2] . ' ' . DI::l10n()->t('bytes');
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
@ -3644,20 +3644,20 @@ class Item
$ret = [
'href' => "display/" . $item['guid'],
'orig' => "display/" . $item['guid'],
'title' => L10n::t('View on separate page'),
'orig_title' => L10n::t('view on separate page'),
'title' => DI::l10n()->t('View on separate page'),
'orig_title' => DI::l10n()->t('view on separate page'),
];
if (!empty($item['plink'])) {
$ret["href"] = DI::baseUrl()->remove($item['plink']);
$ret["title"] = L10n::t('link to source');
$ret["title"] = DI::l10n()->t('link to source');
}
} elseif (!empty($item['plink']) && ($item['private'] != 1)) {
$ret = [
'href' => $item['plink'],
'orig' => $item['plink'],
'title' => L10n::t('link to source'),
'title' => DI::l10n()->t('link to source'),
];
} else {
$ret = [];

View file

@ -112,7 +112,7 @@ class Mail
}
if (!strlen($subject)) {
$subject = L10n::t('[no subject]');
$subject = DI::l10n()->t('[no subject]');
}
$me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
@ -247,7 +247,7 @@ class Mail
}
if (!strlen($subject)) {
$subject = L10n::t('[no subject]');
$subject = DI::l10n()->t('[no subject]');
}
$guid = System::createUUID();

View file

@ -551,7 +551,7 @@ class Photo
GROUP BY `album` ORDER BY `created` DESC",
intval($uid),
DBA::escape("Contact Photos"),
DBA::escape(L10n::t("Contact Photos"))
DBA::escape(DI::l10n()->t("Contact Photos"))
);
} else {
// This query doesn't do the count and is much faster
@ -560,7 +560,7 @@ class Photo
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra",
intval($uid),
DBA::escape("Contact Photos"),
DBA::escape(L10n::t("Contact Photos"))
DBA::escape(DI::l10n()->t("Contact Photos"))
);
}
DI::cache()->set($key, $albums, Duration::DAY);

View file

@ -206,7 +206,7 @@ class Profile
DI::page()['aside'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('profile_edlink.tpl'),
[
'$editprofile' => L10n::t('Edit profile'),
'$editprofile' => DI::l10n()->t('Edit profile'),
'$profid' => $a->profile['id']
]
);
@ -391,15 +391,15 @@ class Profile
// show edit profile to yourself
if (!$is_contact && $local_user_is_self) {
if (Feature::isEnabled(local_user(), 'multi_profiles')) {
$profile['edit'] = [DI::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')];
$profile['edit'] = [DI::baseUrl() . '/profiles', DI::l10n()->t('Profiles'), '', DI::l10n()->t('Manage/edit profiles')];
$r = q(
"SELECT * FROM `profile` WHERE `uid` = %d",
local_user()
);
$profile['menu'] = [
'chg_photo' => L10n::t('Change profile photo'),
'cr_new' => L10n::t('Create New Profile'),
'chg_photo' => DI::l10n()->t('Change profile photo'),
'cr_new' => DI::l10n()->t('Create New Profile'),
'entries' => [],
];
@ -408,18 +408,18 @@ class Profile
$profile['menu']['entries'][] = [
'photo' => $rr['thumb'],
'id' => $rr['id'],
'alt' => L10n::t('Profile Image'),
'alt' => DI::l10n()->t('Profile Image'),
'profile_name' => $rr['profile-name'],
'isdefault' => $rr['is-default'],
'visibile_to_everybody' => L10n::t('visible to everybody'),
'edit_visibility' => L10n::t('Edit visibility'),
'visibile_to_everybody' => DI::l10n()->t('visible to everybody'),
'edit_visibility' => DI::l10n()->t('Edit visibility'),
];
}
}
} else {
$profile['edit'] = [DI::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
$profile['edit'] = [DI::baseUrl() . '/profiles/' . $profile['id'], DI::l10n()->t('Edit profile'), '', DI::l10n()->t('Edit profile')];
$profile['menu'] = [
'chg_photo' => L10n::t('Change profile photo'),
'chg_photo' => DI::l10n()->t('Change profile photo'),
'cr_new' => null,
'entries' => [],
];
@ -436,14 +436,14 @@ class Profile
|| !empty($profile['postal-code'])
|| !empty($profile['country-name'])
) {
$location = L10n::t('Location:');
$location = DI::l10n()->t('Location:');
}
$gender = !empty($profile['gender']) ? L10n::t('Gender:') : false;
$marital = !empty($profile['marital']) ? L10n::t('Status:') : false;
$homepage = !empty($profile['homepage']) ? L10n::t('Homepage:') : false;
$about = !empty($profile['about']) ? L10n::t('About:') : false;
$xmpp = !empty($profile['xmpp']) ? L10n::t('XMPP:') : false;
$gender = !empty($profile['gender']) ? DI::l10n()->t('Gender:') : false;
$marital = !empty($profile['marital']) ? DI::l10n()->t('Status:') : false;
$homepage = !empty($profile['homepage']) ? DI::l10n()->t('Homepage:') : false;
$about = !empty($profile['about']) ? DI::l10n()->t('About:') : false;
$xmpp = !empty($profile['xmpp']) ? DI::l10n()->t('XMPP:') : false;
if ((!empty($profile['hidewall']) || $block) && !Session::isAuthenticated()) {
$location = $gender = $marital = $homepage = $about = false;
@ -516,11 +516,11 @@ class Profile
}
if (isset($p['gender'])) {
$p['gender'] = L10n::t($p['gender']);
$p['gender'] = DI::l10n()->t($p['gender']);
}
if (isset($p['marital'])) {
$p['marital'] = L10n::t($p['marital']);
$p['marital'] = DI::l10n()->t($p['marital']);
}
if (isset($p['photo'])) {
@ -533,13 +533,13 @@ class Profile
$o .= Renderer::replaceMacros($tpl, [
'$profile' => $p,
'$xmpp' => $xmpp,
'$follow' => L10n::t('Follow'),
'$follow' => DI::l10n()->t('Follow'),
'$follow_link' => $follow_link,
'$unfollow' => L10n::t('Unfollow'),
'$unfollow' => DI::l10n()->t('Unfollow'),
'$unfollow_link' => $unfollow_link,
'$subscribe_feed' => L10n::t('Atom feed'),
'$subscribe_feed' => DI::l10n()->t('Atom feed'),
'$subscribe_feed_link' => $subscribe_feed_link,
'$wallmessage' => L10n::t('Message'),
'$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link,
'$account_type' => $account_type,
'$location' => $location,
@ -547,7 +547,7 @@ class Profile
'$marital' => $marital,
'$homepage' => $homepage,
'$about' => $about,
'$network' => L10n::t('Network:'),
'$network' => DI::l10n()->t('Network:'),
'$contacts' => $contact_count,
'$updated' => $updated,
'$diaspora' => $diaspora,
@ -577,8 +577,8 @@ class Profile
* return $o;
*/
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
$bd_short = L10n::t('F d');
$bd_format = DI::l10n()->t('g A l F d'); // 8 AM Friday January 18
$bd_short = DI::l10n()->t('F d');
$cachekey = 'get_birthdays:' . local_user();
$r = DI::cache()->get($cachekey);
@ -640,7 +640,7 @@ class Profile
$rr['link'] = Contact::magicLink($rr['url']);
$rr['title'] = $rr['name'];
$rr['date'] = L10n::getDay(DateTimeFormat::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
$rr['date'] = L10n::getDay(DateTimeFormat::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
$rr['startime'] = null;
$rr['today'] = $today;
}
@ -650,8 +650,8 @@ class Profile
return Renderer::replaceMacros($tpl, [
'$classtoday' => $classtoday,
'$count' => $total,
'$event_reminders' => L10n::t('Birthday Reminders'),
'$event_title' => L10n::t('Birthdays this week:'),
'$event_reminders' => DI::l10n()->t('Birthday Reminders'),
'$event_title' => DI::l10n()->t('Birthdays this week:'),
'$events' => $r,
'$lbr' => '{', // raw brackets mess up if/endif macro processing
'$rbr' => '}'
@ -674,7 +674,7 @@ class Profile
* return $o;
*/
$bd_format = L10n::t('g A l F d'); // 8 AM Friday January 18
$bd_format = DI::l10n()->t('g A l F d'); // 8 AM Friday January 18
$classtoday = '';
$condition = ["`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?",
@ -712,7 +712,7 @@ class Profile
$description = substr(strip_tags(BBCode::convert($rr['desc'])), 0, 32) . '... ';
if (!$description) {
$description = L10n::t('[No description]');
$description = DI::l10n()->t('[No description]');
}
$strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC');
@ -725,7 +725,7 @@ class Profile
$rr['title'] = $title;
$rr['description'] = $description;
$rr['date'] = L10n::getDay(DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
$rr['date'] = L10n::getDay(DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
$rr['startime'] = $strt;
$rr['today'] = $today;
@ -738,8 +738,8 @@ class Profile
return Renderer::replaceMacros($tpl, [
'$classtoday' => $classtoday,
'$count' => count($r),
'$event_reminders' => L10n::t('Event Reminders'),
'$event_title' => L10n::t('Upcoming events the next 7 days:'),
'$event_reminders' => DI::l10n()->t('Event Reminders'),
'$event_title' => DI::l10n()->t('Upcoming events the next 7 days:'),
'$events' => $r,
]);
}
@ -753,19 +753,19 @@ class Profile
$profile = [];
$profile['fullname'] = [L10n::t('Full Name:'), $a->profile['name']];
$profile['fullname'] = [DI::l10n()->t('Full Name:'), $a->profile['name']];
if (Feature::isEnabled($uid, 'profile_membersince')) {
$profile['membersince'] = [L10n::t('Member since:'), DateTimeFormat::local($a->profile['register_date'])];
$profile['membersince'] = [DI::l10n()->t('Member since:'), DateTimeFormat::local($a->profile['register_date'])];
}
if ($a->profile['gender']) {
$profile['gender'] = [L10n::t('Gender:'), L10n::t($a->profile['gender'])];
$profile['gender'] = [DI::l10n()->t('Gender:'), DI::l10n()->t($a->profile['gender'])];
}
if (!empty($a->profile['dob']) && $a->profile['dob'] > DBA::NULL_DATE) {
$year_bd_format = L10n::t('j F, Y');
$short_bd_format = L10n::t('j F');
$year_bd_format = DI::l10n()->t('j F, Y');
$short_bd_format = DI::l10n()->t('j F');
$val = L10n::getDay(
intval($a->profile['dob']) ?
@ -773,18 +773,18 @@ class Profile
: DateTimeFormat::utc('2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)
);
$profile['birthday'] = [L10n::t('Birthday:'), $val];
$profile['birthday'] = [DI::l10n()->t('Birthday:'), $val];
}
if (!empty($a->profile['dob'])
&& $a->profile['dob'] > DBA::NULL_DATE
&& $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'], '')
) {
$profile['age'] = [L10n::t('Age:'), $age];
$profile['age'] = [DI::l10n()->t('Age:'), $age];
}
if ($a->profile['marital']) {
$profile['marital'] = [L10n::t('Status:'), L10n::t($a->profile['marital'])];
$profile['marital'] = [DI::l10n()->t('Status:'), DI::l10n()->t($a->profile['marital'])];
}
/// @TODO Maybe use x() here, plus below?
@ -793,94 +793,94 @@ class Profile
}
if (strlen($a->profile['howlong']) && $a->profile['howlong'] > DBA::NULL_DATETIME) {
$profile['howlong'] = Temporal::getRelativeDate($a->profile['howlong'], L10n::t('for %1$d %2$s'));
$profile['howlong'] = Temporal::getRelativeDate($a->profile['howlong'], DI::l10n()->t('for %1$d %2$s'));
}
if ($a->profile['sexual']) {
$profile['sexual'] = [L10n::t('Sexual Preference:'), L10n::t($a->profile['sexual'])];
$profile['sexual'] = [DI::l10n()->t('Sexual Preference:'), DI::l10n()->t($a->profile['sexual'])];
}
if ($a->profile['homepage']) {
$profile['homepage'] = [L10n::t('Homepage:'), HTML::toLink($a->profile['homepage'])];
$profile['homepage'] = [DI::l10n()->t('Homepage:'), HTML::toLink($a->profile['homepage'])];
}
if ($a->profile['hometown']) {
$profile['hometown'] = [L10n::t('Hometown:'), HTML::toLink($a->profile['hometown'])];
$profile['hometown'] = [DI::l10n()->t('Hometown:'), HTML::toLink($a->profile['hometown'])];
}
if ($a->profile['pub_keywords']) {
$profile['pub_keywords'] = [L10n::t('Tags:'), $a->profile['pub_keywords']];
$profile['pub_keywords'] = [DI::l10n()->t('Tags:'), $a->profile['pub_keywords']];
}
if ($a->profile['politic']) {
$profile['politic'] = [L10n::t('Political Views:'), $a->profile['politic']];
$profile['politic'] = [DI::l10n()->t('Political Views:'), $a->profile['politic']];
}
if ($a->profile['religion']) {
$profile['religion'] = [L10n::t('Religion:'), $a->profile['religion']];
$profile['religion'] = [DI::l10n()->t('Religion:'), $a->profile['religion']];
}
if ($txt = BBCode::convert($a->profile['about'])) {
$profile['about'] = [L10n::t('About:'), $txt];
$profile['about'] = [DI::l10n()->t('About:'), $txt];
}
if ($txt = BBCode::convert($a->profile['interest'])) {
$profile['interest'] = [L10n::t('Hobbies/Interests:'), $txt];
$profile['interest'] = [DI::l10n()->t('Hobbies/Interests:'), $txt];
}
if ($txt = BBCode::convert($a->profile['likes'])) {
$profile['likes'] = [L10n::t('Likes:'), $txt];
$profile['likes'] = [DI::l10n()->t('Likes:'), $txt];
}
if ($txt = BBCode::convert($a->profile['dislikes'])) {
$profile['dislikes'] = [L10n::t('Dislikes:'), $txt];
$profile['dislikes'] = [DI::l10n()->t('Dislikes:'), $txt];
}
if ($txt = BBCode::convert($a->profile['contact'])) {
$profile['contact'] = [L10n::t('Contact information and Social Networks:'), $txt];
$profile['contact'] = [DI::l10n()->t('Contact information and Social Networks:'), $txt];
}
if ($txt = BBCode::convert($a->profile['music'])) {
$profile['music'] = [L10n::t('Musical interests:'), $txt];
$profile['music'] = [DI::l10n()->t('Musical interests:'), $txt];
}
if ($txt = BBCode::convert($a->profile['book'])) {
$profile['book'] = [L10n::t('Books, literature:'), $txt];
$profile['book'] = [DI::l10n()->t('Books, literature:'), $txt];
}
if ($txt = BBCode::convert($a->profile['tv'])) {
$profile['tv'] = [L10n::t('Television:'), $txt];
$profile['tv'] = [DI::l10n()->t('Television:'), $txt];
}
if ($txt = BBCode::convert($a->profile['film'])) {
$profile['film'] = [L10n::t('Film/dance/culture/entertainment:'), $txt];
$profile['film'] = [DI::l10n()->t('Film/dance/culture/entertainment:'), $txt];
}
if ($txt = BBCode::convert($a->profile['romance'])) {
$profile['romance'] = [L10n::t('Love/Romance:'), $txt];
$profile['romance'] = [DI::l10n()->t('Love/Romance:'), $txt];
}
if ($txt = BBCode::convert($a->profile['work'])) {
$profile['work'] = [L10n::t('Work/employment:'), $txt];
$profile['work'] = [DI::l10n()->t('Work/employment:'), $txt];
}
if ($txt = BBCode::convert($a->profile['education'])) {
$profile['education'] = [L10n::t('School/education:'), $txt];
$profile['education'] = [DI::l10n()->t('School/education:'), $txt];
}
//show subcribed forum if it is enabled in the usersettings
if (Feature::isEnabled($uid, 'forumlist_profile')) {
$profile['forumlist'] = [L10n::t('Forums:'), ForumManager::profileAdvanced($uid)];
$profile['forumlist'] = [DI::l10n()->t('Forums:'), ForumManager::profileAdvanced($uid)];
}
if ($a->profile['uid'] == local_user()) {
$profile['edit'] = [DI::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
$profile['edit'] = [DI::baseUrl() . '/profiles/' . $a->profile['id'], DI::l10n()->t('Edit profile'), '', DI::l10n()->t('Edit profile')];
}
return Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Profile'),
'$basic' => L10n::t('Basic'),
'$advanced' => L10n::t('Advanced'),
'$title' => DI::l10n()->t('Profile'),
'$basic' => DI::l10n()->t('Basic'),
'$advanced' => DI::l10n()->t('Advanced'),
'$profile' => $profile
]);
}
@ -906,34 +906,34 @@ class Profile
$tabs = [
[
'label' => L10n::t('Status'),
'label' => DI::l10n()->t('Status'),
'url' => $baseProfileUrl,
'sel' => !$current ? 'active' : '',
'title' => L10n::t('Status Messages and Posts'),
'title' => DI::l10n()->t('Status Messages and Posts'),
'id' => 'status-tab',
'accesskey' => 'm',
],
[
'label' => L10n::t('Profile'),
'label' => DI::l10n()->t('Profile'),
'url' => $baseProfileUrl . '/?tab=profile',
'sel' => $current == 'profile' ? 'active' : '',
'title' => L10n::t('Profile Details'),
'title' => DI::l10n()->t('Profile Details'),
'id' => 'profile-tab',
'accesskey' => 'r',
],
[
'label' => L10n::t('Photos'),
'label' => DI::l10n()->t('Photos'),
'url' => DI::baseUrl() . '/photos/' . $nickname,
'sel' => $current == 'photos' ? 'active' : '',
'title' => L10n::t('Photo Albums'),
'title' => DI::l10n()->t('Photo Albums'),
'id' => 'photo-tab',
'accesskey' => 'h',
],
[
'label' => L10n::t('Videos'),
'label' => DI::l10n()->t('Videos'),
'url' => DI::baseUrl() . '/videos/' . $nickname,
'sel' => $current == 'videos' ? 'active' : '',
'title' => L10n::t('Videos'),
'title' => DI::l10n()->t('Videos'),
'id' => 'video-tab',
'accesskey' => 'v',
],
@ -942,10 +942,10 @@ class Profile
// the calendar link for the full featured events calendar
if ($is_owner && $a->theme_events_in_profile) {
$tabs[] = [
'label' => L10n::t('Events'),
'label' => DI::l10n()->t('Events'),
'url' => DI::baseUrl() . '/events',
'sel' => $current == 'events' ? 'active' : '',
'title' => L10n::t('Events and Calendar'),
'title' => DI::l10n()->t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
];
@ -953,10 +953,10 @@ class Profile
// with the public events of the calendar owner
} elseif (!$is_owner) {
$tabs[] = [
'label' => L10n::t('Events'),
'label' => DI::l10n()->t('Events'),
'url' => DI::baseUrl() . '/cal/' . $nickname,
'sel' => $current == 'cal' ? 'active' : '',
'title' => L10n::t('Events and Calendar'),
'title' => DI::l10n()->t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
];
@ -964,10 +964,10 @@ class Profile
if ($is_owner) {
$tabs[] = [
'label' => L10n::t('Personal Notes'),
'label' => DI::l10n()->t('Personal Notes'),
'url' => DI::baseUrl() . '/notes',
'sel' => $current == 'notes' ? 'active' : '',
'title' => L10n::t('Only You Can See This'),
'title' => DI::l10n()->t('Only You Can See This'),
'id' => 'notes-tab',
'accesskey' => 't',
];
@ -975,20 +975,20 @@ class Profile
if (!empty($_SESSION['new_member']) && $is_owner) {
$tabs[] = [
'label' => L10n::t('Tips for New Members'),
'label' => DI::l10n()->t('Tips for New Members'),
'url' => DI::baseUrl() . '/newmember',
'sel' => false,
'title' => L10n::t('Tips for New Members'),
'title' => DI::l10n()->t('Tips for New Members'),
'id' => 'newmember-tab',
];
}
if ($is_owner || empty($a->profile['hide-friends'])) {
$tabs[] = [
'label' => L10n::t('Contacts'),
'label' => DI::l10n()->t('Contacts'),
'url' => $baseProfileUrl . '/contacts',
'sel' => $current == 'contacts' ? 'active' : '',
'title' => L10n::t('Contacts'),
'title' => DI::l10n()->t('Contacts'),
'id' => 'viewcontacts-tab',
'accesskey' => 'k',
];
@ -1171,7 +1171,7 @@ class Profile
$a->contact = $arr['visitor'];
info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG);
}

View file

@ -354,7 +354,7 @@ class User
return $user['uid'];
}
throw new Exception(L10n::t('Login failed'));
throw new Exception(DI::l10n()->t('Login failed'));
}
/**
@ -386,7 +386,7 @@ class User
|| !isset($user['password'])
|| !isset($user['legacy_password'])
) {
throw new Exception(L10n::t('Not enough information to authenticate'));
throw new Exception(DI::l10n()->t('Not enough information to authenticate'));
}
} elseif (is_int($user_info) || is_string($user_info)) {
if (is_int($user_info)) {
@ -412,7 +412,7 @@ class User
}
if (!DBA::isResult($user)) {
throw new Exception(L10n::t('User not found'));
throw new Exception(DI::l10n()->t('User not found'));
}
}
@ -480,7 +480,7 @@ class User
public static function hashPassword($password)
{
if (!trim($password)) {
throw new Exception(L10n::t('Password can\'t be empty'));
throw new Exception(DI::l10n()->t('Password can\'t be empty'));
}
return password_hash($password, PASSWORD_DEFAULT);
@ -499,17 +499,17 @@ class User
$password = trim($password);
if (empty($password)) {
throw new Exception(L10n::t('Empty passwords are not allowed.'));
throw new Exception(DI::l10n()->t('Empty passwords are not allowed.'));
}
if (!Config::get('system', 'disable_password_exposed', false) && self::isPasswordExposed($password)) {
throw new Exception(L10n::t('The new password has been exposed in a public data dump, please choose another.'));
throw new Exception(DI::l10n()->t('The new password has been exposed in a public data dump, please choose another.'));
}
$allowed_characters = '!"#$%&\'()*+,-./;<=>?@[\]^_`{|}~';
if (!preg_match('/^[a-z0-9' . preg_quote($allowed_characters, '/') . ']+$/i', $password)) {
throw new Exception(L10n::t('The password can\'t contain accentuated letters, white spaces or colons (:)'));
throw new Exception(DI::l10n()->t('The password can\'t contain accentuated letters, white spaces or colons (:)'));
}
return self::updatePasswordHashed($uid, self::hashPassword($password));
@ -608,18 +608,18 @@ class User
$netpublish = $publish && Config::get('system', 'directory');
if ($password1 != $confirm) {
throw new Exception(L10n::t('Passwords do not match. Password unchanged.'));
throw new Exception(DI::l10n()->t('Passwords do not match. Password unchanged.'));
} elseif ($password1 != '') {
$password = $password1;
}
if ($using_invites) {
if (!$invite_id) {
throw new Exception(L10n::t('An invitation is required.'));
throw new Exception(DI::l10n()->t('An invitation is required.'));
}
if (!Register::existsByHash($invite_id)) {
throw new Exception(L10n::t('Invitation could not be verified.'));
throw new Exception(DI::l10n()->t('Invitation could not be verified.'));
}
}
@ -627,7 +627,7 @@ class User
if (empty($username) || empty($email) || empty($nickname)) {
if ($openid_url) {
if (!Network::isUrlValid($openid_url)) {
throw new Exception(L10n::t('Invalid OpenID url'));
throw new Exception(DI::l10n()->t('Invalid OpenID url'));
}
$_SESSION['register'] = 1;
$_SESSION['openid'] = $openid_url;
@ -640,13 +640,13 @@ class User
try {
$authurl = $openid->authUrl();
} catch (Exception $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);
throw new Exception(DI::l10n()->t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . EOL . EOL . DI::l10n()->t('The error message was:') . $e->getMessage(), 0, $e);
}
System::externalRedirect($authurl);
// NOTREACHED
}
throw new Exception(L10n::t('Please enter the required information.'));
throw new Exception(DI::l10n()->t('Please enter the required information.'));
}
if (!Network::isUrlValid($openid_url)) {
@ -660,7 +660,7 @@ class User
$username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48))));
if ($username_min_length > $username_max_length) {
Logger::log(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING);
Logger::log(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING);
$tmp = $username_min_length;
$username_min_length = $username_max_length;
$username_max_length = $tmp;
@ -679,23 +679,23 @@ class User
if (!$loose_reg) {
$username = mb_convert_case($username, MB_CASE_TITLE, 'UTF-8');
if (strpos($username, ' ') === false) {
throw new Exception(L10n::t("That doesn't appear to be your full (First Last) name."));
throw new Exception(DI::l10n()->t("That doesn't appear to be your full (First Last) name."));
}
}
if (!Network::isEmailDomainAllowed($email)) {
throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
throw new Exception(DI::l10n()->t('Your email domain is not among those allowed on this site.'));
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || !Network::isEmailDomainValid($email)) {
throw new Exception(L10n::t('Not a valid email address.'));
throw new Exception(DI::l10n()->t('Not a valid email address.'));
}
if (self::isNicknameBlocked($nickname)) {
throw new Exception(L10n::t('The nickname was blocked from registration by the nodes admin.'));
throw new Exception(DI::l10n()->t('The nickname was blocked from registration by the nodes admin.'));
}
if (Config::get('system', 'block_extended_register', false) && DBA::exists('user', ['email' => $email])) {
throw new Exception(L10n::t('Cannot use that email.'));
throw new Exception(DI::l10n()->t('Cannot use that email.'));
}
// Disallow somebody creating an account using openid that uses the admin email address,
@ -703,14 +703,14 @@ class User
if (Config::get('config', 'admin_email') && strlen($openid_url)) {
$adminlist = explode(',', str_replace(' ', '', strtolower(Config::get('config', 'admin_email'))));
if (in_array(strtolower($email), $adminlist)) {
throw new Exception(L10n::t('Cannot use that email.'));
throw new Exception(DI::l10n()->t('Cannot use that email.'));
}
}
$nickname = $data['nickname'] = strtolower($nickname);
if (!preg_match('/^[a-z0-9][a-z0-9\_]*$/', $nickname)) {
throw new Exception(L10n::t('Your nickname can only contain a-z, 0-9 and _.'));
throw new Exception(DI::l10n()->t('Your nickname can only contain a-z, 0-9 and _.'));
}
// Check existing and deleted accounts for this nickname.
@ -718,7 +718,7 @@ class User
DBA::exists('user', ['nickname' => $nickname])
|| DBA::exists('userd', ['username' => $nickname])
) {
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
throw new Exception(DI::l10n()->t('Nickname is already registered. Please choose another.'));
}
$new_password = strlen($password) ? $password : User::generateNewPassword();
@ -728,7 +728,7 @@ class User
$keys = Crypto::newKeypair(4096);
if ($keys === false) {
throw new Exception(L10n::t('SERIOUS ERROR: Generation of security keys failed.'));
throw new Exception(DI::l10n()->t('SERIOUS ERROR: Generation of security keys failed.'));
}
$prvkey = $keys['prvkey'];
@ -762,11 +762,11 @@ class User
$uid = DBA::lastInsertId();
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
} else {
throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
throw new Exception(DI::l10n()->t('An error occurred during registration. Please try again.'));
}
if (!$uid) {
throw new Exception(L10n::t('An error occurred during registration. Please try again.'));
throw new Exception(DI::l10n()->t('An error occurred during registration. Please try again.'));
}
// if somebody clicked submit twice very quickly, they could end up with two accounts
@ -775,7 +775,7 @@ class User
if ($user_count > 1) {
DBA::delete('user', ['uid' => $uid]);
throw new Exception(L10n::t('Nickname is already registered. Please choose another.'));
throw new Exception(DI::l10n()->t('Nickname is already registered. Please choose another.'));
}
$insert_result = DBA::insert('profile', [
@ -786,28 +786,28 @@ class User
'publish' => $publish,
'is-default' => 1,
'net-publish' => $netpublish,
'profile-name' => L10n::t('default')
'profile-name' => DI::l10n()->t('default')
]);
if (!$insert_result) {
DBA::delete('user', ['uid' => $uid]);
throw new Exception(L10n::t('An error occurred creating your default profile. Please try again.'));
throw new Exception(DI::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(L10n::t('An error occurred creating your self contact. Please try again.'));
throw new Exception(DI::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, L10n::t('Friends'));
$def_gid = Group::create($uid, DI::l10n()->t('Friends'));
if (!$def_gid) {
DBA::delete('user', ['uid' => $uid]);
throw new Exception(L10n::t('An error occurred creating your default contact group. Please try again.'));
throw new Exception(DI::l10n()->t('An error occurred creating your default contact group. Please try again.'));
}
$fields = ['def_gid' => $def_gid];
@ -837,7 +837,7 @@ class User
$resource_id = Photo::newResource();
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 4);
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 4);
if ($r === false) {
$photo_failure = true;
@ -845,7 +845,7 @@ class User
$Image->scaleDown(80);
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 5);
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 5);
if ($r === false) {
$photo_failure = true;
@ -853,7 +853,7 @@ class User
$Image->scaleDown(48);
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 6);
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 6);
if ($r === false) {
$photo_failure = true;
@ -883,7 +883,7 @@ class User
*/
public static function sendRegisterPendingEmail($user, $sitename, $siteurl, $password)
{
$body = Strings::deindent(L10n::t(
$body = Strings::deindent(DI::l10n()->t(
'
Dear %1$s,
Thank you for registering at %2$s. Your account is pending for approval by the administrator.
@ -905,7 +905,7 @@ class User
'type' => SYSTEM_EMAIL,
'uid' => $user['uid'],
'to_email' => $user['email'],
'subject' => L10n::t('Registration at %s', $sitename),
'subject' => DI::l10n()->t('Registration at %s', $sitename),
'body' => $body
]);
}
@ -973,7 +973,7 @@ class User
'language' => $user['language'],
'type' => SYSTEM_EMAIL,
'to_email' => $user['email'],
'subject' => L10n::t('Registration details for %s', $sitename),
'subject' => DI::l10n()->t('Registration details for %s', $sitename),
'preamble' => $preamble,
'body' => $body
]);