mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:05:16 +02:00
Refactor datetime_convert into Temporal::convert
- Changed parameter order to save space - Refactor select_timezone into Temporal::getTimezoneSelect - Refactor field_timezone into Temporal::getTimezoneField
This commit is contained in:
parent
d478ef6c6d
commit
dc366bf1f7
62 changed files with 512 additions and 432 deletions
14
mod/ping.php
14
mod/ping.php
|
@ -2,17 +2,19 @@
|
|||
/**
|
||||
* @file include/ping.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
|
@ -223,8 +225,8 @@ function ping_init(App $a)
|
|||
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0
|
||||
ORDER BY `start` ASC ",
|
||||
intval(local_user()),
|
||||
dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')),
|
||||
dbesc(datetime_convert('UTC', 'UTC', 'now'))
|
||||
dbesc(Temporal::convert('now + 7 days')),
|
||||
dbesc(Temporal::convert('now'))
|
||||
);
|
||||
if (DBM::is_result($ev)) {
|
||||
Cache::set($cachekey, $ev, CACHE_HOUR);
|
||||
|
@ -235,7 +237,7 @@ function ping_init(App $a)
|
|||
$all_events = count($ev);
|
||||
|
||||
if ($all_events) {
|
||||
$str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d');
|
||||
$str_now = Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d');
|
||||
foreach ($ev as $x) {
|
||||
$bd = false;
|
||||
if ($x['type'] === 'birthday') {
|
||||
|
@ -244,7 +246,7 @@ function ping_init(App $a)
|
|||
} else {
|
||||
$events ++;
|
||||
}
|
||||
if (datetime_convert('UTC', ((intval($x['adjust'])) ? $a->timezone : 'UTC'), $x['start'], 'Y-m-d') === $str_now) {
|
||||
if (Temporal::convert($x['start'], ((intval($x['adjust'])) ? $a->timezone : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
|
||||
$all_events_today ++;
|
||||
if ($bd) {
|
||||
$birthdays_today ++;
|
||||
|
@ -360,7 +362,7 @@ function ping_init(App $a)
|
|||
$notif['photo'] = proxy_url($notif['photo'], false, PROXY_SIZE_MICRO);
|
||||
}
|
||||
|
||||
$local_time = datetime_convert('UTC', date_default_timezone_get(), $notif['date']);
|
||||
$local_time = Temporal::convert($notif['date'], date_default_timezone_get());
|
||||
|
||||
$notifications[] = [
|
||||
'id' => $notif['id'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue