mirror of
https://github.com/friendica/friendica
synced 2025-04-26 12:30:11 +00:00
Replace remaining functions in include/datetime by Temporal methods
- Fix uses statements
This commit is contained in:
parent
d0c9e7939c
commit
cea80c78e4
20 changed files with 60 additions and 48 deletions
|
@ -21,6 +21,7 @@ use Friendica\Model\Item;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/enotify.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -1648,13 +1649,13 @@ function admin_page_users(App $a)
|
|||
L10n::t('Automatic Friend Account')
|
||||
];
|
||||
$e['page-flags'] = $accounts[$e['page-flags']];
|
||||
$e['register_date'] = relative_date($e['register_date']);
|
||||
$e['login_date'] = relative_date($e['login_date']);
|
||||
$e['lastitem_date'] = relative_date($e['lastitem_date']);
|
||||
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
||||
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
||||
$e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
|
||||
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
|
||||
$e['is_admin'] = in_array($e['email'], $adminlist);
|
||||
$e['is_deletable'] = (intval($e['uid']) != local_user());
|
||||
$e['deleted'] = ($e['account_removed'] ? relative_date($e['account_expires_on']) : False);
|
||||
$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
|
||||
return $e;
|
||||
};
|
||||
$users = array_map($_setup_users, $users);
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/event.php';
|
||||
|
||||
|
@ -188,7 +189,7 @@ function cal_content(App $a)
|
|||
$prevyear --;
|
||||
}
|
||||
|
||||
$dim = get_dim($y, $m);
|
||||
$dim = Temporal::getDaysInMonth($y, $m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
|
@ -274,7 +275,7 @@ function cal_content(App $a)
|
|||
'$view' => L10n::t('View'),
|
||||
'$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", L10n::t('Previous'), '', ''],
|
||||
'$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", L10n::t('Next'), '', ''],
|
||||
'$calendar' => cal($y, $m, $links, ' eventcal'),
|
||||
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
|
||||
'$events' => $events,
|
||||
"today" => L10n::t("today"),
|
||||
"month" => L10n::t("month"),
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -310,7 +311,7 @@ function events_content(App $a) {
|
|||
$prevyear --;
|
||||
}
|
||||
|
||||
$dim = get_dim($y, $m);
|
||||
$dim = Temporal::getDaysInMonth($y, $m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
|
@ -395,7 +396,7 @@ function events_content(App $a) {
|
|||
'$new_event' => [System::baseUrl() . '/events/new', L10n::t('Create New Event'), '', ''],
|
||||
'$previous' => [System::baseUrl() . '/events/$prevyear/$prevmonth', L10n::t('Previous'), '', ''],
|
||||
'$next' => [System::baseUrl() . '/events/$nextyear/$nextmonth', L10n::t('Next'), '', ''],
|
||||
'$calendar' => cal($y, $m, $links, ' eventcal'),
|
||||
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
|
||||
|
||||
'$events' => $events,
|
||||
|
||||
|
@ -510,11 +511,11 @@ function events_content(App $a) {
|
|||
'$title' => L10n::t('Event details'),
|
||||
'$desc' => L10n::t('Starting date and Title are required.'),
|
||||
'$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
|
||||
'$s_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), L10n::t('Event Starts:'), 'start_text', true, true, '', '', true),
|
||||
'$s_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), L10n::t('Event Starts:'), 'start_text', true, true, '', '', true),
|
||||
'$n_text' => L10n::t('Finish date/time is not known or not relevant'),
|
||||
'$n_checked' => $n_checked,
|
||||
'$f_text' => L10n::t('Event Finishes:'),
|
||||
'$f_dsel' => datetimesel(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), L10n::t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
|
||||
'$f_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), L10n::t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
|
||||
'$a_text' => L10n::t('Adjust for viewer timezone'),
|
||||
'$a_checked' => $a_checked,
|
||||
'$d_text' => L10n::t('Description:'),
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
require_once 'include/conversation.php';
|
||||
|
@ -398,7 +399,7 @@ function message_content(App $a)
|
|||
'delete' => L10n::t('Delete message'),
|
||||
'to_name' => $to_name_e,
|
||||
'date' => DateTimeFormat::local($message['created'], 'D, d M Y - g:i A'),
|
||||
'ago' => relative_date($message['created']),
|
||||
'ago' => Temporal::getRelativeDate($message['created']),
|
||||
];
|
||||
|
||||
$seen = $message['seen'];
|
||||
|
@ -499,7 +500,7 @@ function render_messages(array $msg, $t)
|
|||
'$body' => $body_e,
|
||||
'$to_name' => $to_name_e,
|
||||
'$date' => DateTimeFormat::local($rr['mailcreated'], L10n::t('D, d M Y - g:i A')),
|
||||
'$ago' => relative_date($rr['mailcreated']),
|
||||
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
|
||||
'$seen' => $rr['mailseen'],
|
||||
'$count' => L10n::tt('%d message', '%d messages', $rr['count']),
|
||||
]);
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
/**
|
||||
* @file mod/notify.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function notify_init(App $a)
|
||||
{
|
||||
|
@ -68,7 +70,7 @@ function notify_content(App $a)
|
|||
'$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_when' => relative_date($it['date'])
|
||||
'$item_when' => Temporal::getRelativeDate($it['date'])
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -22,6 +22,7 @@ use Friendica\Object\Image;
|
|||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
@ -1622,7 +1623,7 @@ function photos_content(App $a)
|
|||
'$sparkle' => $sparkle,
|
||||
'$title' => $title_e,
|
||||
'$body' => $body_e,
|
||||
'$ago' => relative_date($item['created']),
|
||||
'$ago' => Temporal::getRelativeDate($item['created']),
|
||||
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
|
||||
'$drop' => $drop,
|
||||
'$comment' => $comment
|
||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -370,7 +371,7 @@ function ping_init(App $a)
|
|||
'name' => $notif['name'],
|
||||
'url' => $notif['url'],
|
||||
'photo' => $notif['photo'],
|
||||
'date' => relative_date($notif['date']),
|
||||
'date' => Temporal::getRelativeDate($notif['date']),
|
||||
'message' => $notif['message'],
|
||||
'seen' => $notif['seen'],
|
||||
'timestamp' => strtotime($local_time)
|
||||
|
|
|
@ -15,10 +15,11 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function profiles_init(App $a) {
|
||||
|
||||
|
@ -714,14 +715,14 @@ function profiles_content(App $a) {
|
|||
'$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . L10n::t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
|
||||
'$name' => ['name', L10n::t('Your Full Name:'), $r[0]['name']],
|
||||
'$pdesc' => ['pdesc', L10n::t('Title/Description:'), $r[0]['pdesc']],
|
||||
'$dob' => dob($r[0]['dob']),
|
||||
'$dob' => Temporal::getDateofBirthField($r[0]['dob']),
|
||||
'$hide_friends' => $hide_friends,
|
||||
'$address' => ['address', L10n::t('Street Address:'), $r[0]['address']],
|
||||
'$locality' => ['locality', L10n::t('Locality/City:'), $r[0]['locality']],
|
||||
'$region' => ['region', L10n::t('Region/State:'), $r[0]['region']],
|
||||
'$postal_code' => ['postal_code', L10n::t('Postal/Zip Code:'), $r[0]['postal-code']],
|
||||
'$country_name' => ['country_name', L10n::t('Country:'), $r[0]['country-name']],
|
||||
'$age' => ((intval($r[0]['dob'])) ? '(' . L10n::t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
|
||||
'$age' => ((intval($r[0]['dob'])) ? '(' . L10n::t('Age: ') . Temporal::getAgeByTimezone($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
|
||||
'$gender' => ContactSelector::gender($r[0]['gender']),
|
||||
'$marital' => ContactSelector::maritalStatus($r[0]['marital']),
|
||||
'$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue