From: Hypolite Petovan Date: Fri, 26 Jan 2018 12:30:06 +0000 (-0500) Subject: Add Temporal::utc() shorthand to Temporal::convert() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cbc89d147d763cd57095ab22d6b068a68404c8ab;p=friendica-addons.git Add Temporal::utc() shorthand to Temporal::convert() --- diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index fa6c0e39..a65be286 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -520,12 +520,12 @@ function fromgplus_fetch($a, $uid) { if (function_exists("share_header")) $post .= share_header($item->object->actor->displayName, $item->object->actor->url, $item->object->actor->image->url, "", - Temporal::convert($item->object->published),$item->object->url); + Temporal::utc($item->object->published),$item->object->url); else $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). "' profile='".$item->object->actor->url. "' avatar='".$item->object->actor->image->url. - "' posted='".Temporal::convert($item->object->published). + "' posted='".Temporal::utc($item->object->published). "' link='".$item->object->url."']"; $post .= fromgplus_html2bbcode($item->object->content); diff --git a/public_server/public_server.php b/public_server/public_server.php index 23777654..29cf0f60 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -39,7 +39,7 @@ function public_server_register_account($a,$b) { return; $r = q("UPDATE user set account_expires_on = '%s', expire = %d where uid = %d", - dbesc(Temporal::convert('now +' . $days . ' days')), + dbesc(Temporal::utc('now +' . $days . ' days')), intval($days_posts), intval($uid) ); @@ -87,7 +87,7 @@ function public_server_cron($a,$b) { if(count($r)) { foreach($r as $rr) q("update user set account_expires_on = '%s' where uid = %d", - dbesc(Temporal::convert('now +' . '6 days')), + dbesc(Temporal::utc('now +' . '6 days')), intval($rr['uid']) ); } @@ -100,7 +100,7 @@ function public_server_cron($a,$b) { if(count($r)) { foreach($r as $rr) q("update user set account_expires_on = '%s' where uid = %d", - dbesc(Temporal::convert('now +' . '6 days')), + dbesc(Temporal::utc('now +' . '6 days')), intval($rr['uid']) ); } @@ -138,7 +138,7 @@ function public_server_login($a,$b) { if(! $days) return; $r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'", - dbesc(Temporal::convert('now +' . $days . ' days')), + dbesc(Temporal::utc('now +' . $days . ' days')), local_user() ); } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index afdd3455..45dd5749 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1211,11 +1211,11 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet if ($post->object->displayName != "") $postarray['title'] = $post->object->displayName; - $postarray['created'] = Temporal::convert($post->published); + $postarray['created'] = Temporal::utc($post->published); if (isset($post->updated)) - $postarray['edited'] = Temporal::convert($post->updated); + $postarray['edited'] = Temporal::utc($post->updated); elseif (isset($post->received)) - $postarray['edited'] = Temporal::convert($post->received); + $postarray['edited'] = Temporal::utc($post->received); else $postarray['edited'] = $postarray['created']; @@ -1230,7 +1230,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet $postarray['body'] = share_header($share_author, $post->object->author->url, $post->object->author->image->url, "", - Temporal::convert($post->object->created), + Temporal::utc($post->object->created), $post->links->self->href). $postarray['body']."[/share]"; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index ee0a6dab..ae54e2fd 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -983,7 +983,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) } else { // update profile photos once every two weeks as we have no notification of when they change. //$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false); - $update_photo = ($r[0]['avatar-date'] < Temporal::convert('now -12 hours')); + $update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours')); // check that we have all the photos, this has been known to fail on occasion if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) { @@ -1197,8 +1197,8 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray['body'] = $converted["body"]; $postarray['tag'] = $converted["tags"]; - $postarray['created'] = Temporal::convert($content->created_at); - $postarray['edited'] = Temporal::convert($content->created_at); + $postarray['created'] = Temporal::utc($content->created_at); + $postarray['edited'] = Temporal::utc($content->created_at); if (is_string($content->place->name)) { $postarray["location"] = $content->place->name; diff --git a/twitter/twitter.php b/twitter/twitter.php index cc12e8de..0bffa4eb 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1070,7 +1070,7 @@ function twitter_fetch_contact($uid, $contact, $create_user) } else { // update profile photos once every two weeks as we have no notification of when they change. //$update_photo = (($r[0]['avatar-date'] < Temporal::convert('now -2 days', '', '', )) ? true : false); - $update_photo = ($r[0]['avatar-date'] < Temporal::convert('now -12 hours')); + $update_photo = ($r[0]['avatar-date'] < Temporal::utc('now -12 hours')); // check that we have all the photos, this has been known to fail on occasion if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) { @@ -1490,8 +1490,8 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis $converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture); $postarray['body'] = $converted["body"]; $postarray['tag'] = $converted["tags"]; - $postarray['created'] = Temporal::convert($post->created_at); - $postarray['edited'] = Temporal::convert($post->created_at); + $postarray['created'] = Temporal::utc($post->created_at); + $postarray['edited'] = Temporal::utc($post->created_at); $statustext = $converted["plain"];