]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Profile.php
Update function names and calls
[friendica.git] / src / Model / Profile.php
index bdc64a8ac24c7d97b92c76c78b8a121c073c5dcb..3522bab8efc4bb5385a9a9e06ac550c38ae79b3b 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Protocol\Diaspora;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\Temporal;
 use dba;
@@ -258,7 +259,7 @@ class Profile
         * @param int $block
         * @param boolean $show_connect Show connect link
         *
-        * @return HTML string suitable for sidebar inclusion
+        * @return string HTML sidebar module
         *
         * @note Returns empty string if passed $profile is wrong type or not populated
         *
@@ -556,8 +557,8 @@ class Profile
                                WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
                                ORDER BY `start` ASC ",
                                local_user(),
-                               Temporal::convert('now + 6 days'),
-                               Temporal::utcNow()
+                               DateTimeFormat::utc('now + 6 days'),
+                               DateTimeFormat::utcNow()
                        );
                        if (DBM::is_result($s)) {
                                $r = dba::inArray($s);
@@ -600,7 +601,7 @@ class Profile
 
                                        $rr['link'] = $url;
                                        $rr['title'] = $rr['name'];
-                                       $rr['date'] = day_translate(Temporal::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
+                                       $rr['date'] = day_translate(DateTimeFormat::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
                                        $rr['startime'] = null;
                                        $rr['today'] = $today;
                                }
@@ -644,8 +645,8 @@ class Profile
                        WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
                        ORDER BY `start` ASC ",
                        local_user(),
-                       Temporal::convert('now + 7 days'),
-                       Temporal::convert('now - 1 days')
+                       DateTimeFormat::utc('now + 7 days'),
+                       DateTimeFormat::utc('now - 1 days')
                );
 
                $r = [];
@@ -658,8 +659,8 @@ class Profile
                                        $total ++;
                                }
 
-                               $strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
-                               if ($strt === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
+                               $strt = DateTimeFormat::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
+                               if ($strt === DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) {
                                        $istoday = true;
                                }
 
@@ -674,17 +675,17 @@ class Profile
                                        $description = L10n::t('[No description]');
                                }
 
-                               $strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC');
+                               $strt = DateTimeFormat::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC');
 
-                               if (substr($strt, 0, 10) < Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
+                               if (substr($strt, 0, 10) < DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) {
                                        continue;
                                }
 
-                               $today = ((substr($strt, 0, 10) === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) ? true : false);
+                               $today = ((substr($strt, 0, 10) === DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) ? true : false);
 
                                $rr['title'] = $title;
                                $rr['description'] = $description;
-                               $rr['date'] = day_translate(Temporal::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
+                               $rr['date'] = day_translate(DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
                                $rr['startime'] = $strt;
                                $rr['today'] = $today;
 
@@ -729,16 +730,18 @@ class Profile
                                $year_bd_format = L10n::t('j F, Y');
                                $short_bd_format = L10n::t('j F');
 
-                               $val = intval($a->profile['dob']) ?
-                                       day_translate(Temporal::convert($a->profile['dob'] . ' 00:00 +00:00', 'UTC', 'UTC', $year_bd_format))
-                                       : day_translate(Temporal::convert('2001-' . substr($a->profile['dob'], 'UTC', 'UTC', 5) . ' 00:00 +00:00', $short_bd_format));
+                               $val = day_translate(
+                                       intval($a->profile['dob']) ?
+                                               DateTimeFormat::utc($a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)
+                                               : DateTimeFormat::utc('2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)
+                               );
 
                                $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'], '')
+                               && $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'], '')
                        ) {
                                $profile['age'] = [L10n::t('Age:'), $age];
                        }
@@ -753,7 +756,7 @@ class Profile
                        }
 
                        if (strlen($a->profile['howlong']) && $a->profile['howlong'] >= NULL_DATE) {
-                               $profile['howlong'] = relative_date($a->profile['howlong'], L10n::t('for %1$d %2$s'));
+                               $profile['howlong'] = Temporal::getRelativeDate($a->profile['howlong'], L10n::t('for %1$d %2$s'));
                        }
 
                        if ($a->profile['sexual']) {