Browse Source

Fix separation dot ASCII character and shorten article dates

pull/1379/head
Timothée Jaussoin 11 months ago
parent
commit
a6df3d0d67
  1. 13
      app/Helpers/DateHelper.php
  2. 4
      app/Widgets/Blog/blog.tpl
  3. 2
      app/Widgets/Chat/_chat_header.tpl
  4. 2
      app/Widgets/Chat/_chat_jingle_end.tpl
  5. 2
      app/Widgets/Chats/_chats_item.tpl
  6. 2
      app/Widgets/CommunitiesServer/_communitiesserver_ticket.tpl
  7. 2
      app/Widgets/CommunityData/_communitydata.tpl
  8. 2
      app/Widgets/CommunityData/_communitydata_card.tpl
  9. 4
      app/Widgets/CommunityHeader/_communityheader.tpl
  10. 2
      app/Widgets/ContactActions/_contactactions_drawer.tpl
  11. 2
      app/Widgets/ContactHeader/_contactheader.tpl
  12. 4
      app/Widgets/EmojisConfig/_emojisconfig.tpl
  13. 14
      app/Widgets/Post/_post.tpl
  14. 12
      app/Widgets/Post/_post_card.tpl
  15. 10
      app/Widgets/Post/_post_ticket.tpl
  16. 2
      app/Widgets/Publish/_publish_images.tpl
  17. 2
      app/Widgets/RoomsExplore/_roomsexplore_global.tpl
  18. 2
      app/Widgets/RoomsExplore/_roomsexplore_local.tpl
  19. 2
      app/Widgets/Search/_search_results.tpl

13
app/Helpers/DateHelper.php

@ -6,9 +6,9 @@
function getTimezoneOffset(): int
{
return (new DateTimeZone(defined('TIMEZONE')
? TIMEZONE
: date_default_timezone_get())
)->getOffset(new DateTime('now', new DateTimeZone('UTC')));
? TIMEZONE
: date_default_timezone_get())
)->getOffset(new DateTime('now', new DateTimeZone('UTC')));
}
/**
@ -19,14 +19,13 @@ function getTimezoneOffset(): int
*/
function prepareDate(string $datetime = '', bool $hours = true, bool $compact = false, bool $dateOnly = false): string
{
$time = strtotime($datetime);
$time = $time !== false ? $time : time();
$t = $time + getTimezoneOffset();
$date = '';
$reldays = -(time() - $t - (time() % 86400)) / 86400;
$reldays = - (time() - $t - (time() % 86400)) / 86400;
// if $reldays is within a week
if (-7 < $reldays && $reldays <= 2) {
@ -41,10 +40,10 @@ function prepareDate(string $datetime = '', bool $hours = true, bool $compact =
}
} else {
if (!$compact) {
$date .= __('day.'.strtolower(date('l', $t))) . ', ';
$date .= __('day.' . strtolower(date('l', $t))) . ', ';
}
$date .= date('j', $t).' '.__('month.'.strtolower(date('F', $t)));
$date .= date('j', $t) . ' ' . __('month.' . strtolower(date('F', $t)));
// Over 6 months
if (abs($reldays) > 182) {

4
app/Widgets/Blog/blog.tpl

@ -98,12 +98,12 @@
{if="$item != null"}
{if="$item->description"}
<p title="{$item->description|stripTags}" class="line">
<i class="material-symbols">people</i> {$c->__('communitydata.sub', $item->occupants)} ·
<i class="material-symbols">people</i> {$c->__('communitydata.sub', $item->occupants)}
{$item->description|stripTags}
</p>
{else}
<p>
<i class="material-symbols">people</i> {$c->__('communitydata.sub', $item->occupants)} ·
<i class="material-symbols">people</i> {$c->__('communitydata.sub', $item->occupants)}
{$item->server}
</p>
{/if}

2
app/Widgets/Chat/_chat_header.tpl

@ -34,7 +34,7 @@
{if="$conference && $conference->info && $conference->info->related"}
{$related = $conference->info->related}
<span
title="{$c->__('page.communities')} · {$related->name}"
title="{$c->__('page.communities')} {$related->name}"
onclick="MovimUtils.reload('{$c->route('community', [$related->server, $related->node])}')"
class="control icon bubble active small">
<img src="{$related->getPicture(\Movim\ImageSize::M)}"/>

2
app/Widgets/Chat/_chat_jingle_end.tpl

@ -1 +1 @@
<i class="material-symbols icon red">call_end</i> {$c->__('chat.jingle_end')}{if="$diff"} · {if="$diff->h > 0"}{$c->__('chat.jingle_hours', $diff->h, $diff->i)}{elseif="$diff->i > 0"}{$c->__('chat.jingle_minutes', $diff->i, $diff->s)}{else}{$c->__('chat.jingle_seconds', $diff->s)}{/if}{/if}
<i class="material-symbols icon red">call_end</i> {$c->__('chat.jingle_end')}{if="$diff"} {if="$diff->h > 0"}{$c->__('chat.jingle_hours', $diff->h, $diff->i)}{elseif="$diff->i > 0"}{$c->__('chat.jingle_minutes', $diff->i, $diff->s)}{else}{$c->__('chat.jingle_seconds', $diff->s)}{/if}{/if}

2
app/Widgets/Chats/_chats_item.tpl

@ -13,7 +13,7 @@
{/if}
{/if}
"
title="{$contact->jid}{if="isset($message)"} · {$message->published|prepareDate}{/if}">
title="{$contact->jid}{if="isset($message)"} {$message->published|prepareDate}{/if}">
<span class="primary icon bubble
{if="$roster && $roster->presence"}status {$roster->presence->presencekey}{/if}
{if="$contact->locationDistance"} location{/if}

2
app/Widgets/CommunitiesServer/_communitiesserver_ticket.tpl

@ -30,7 +30,7 @@
<a href="#">{$community->node}</a>
{if="$community->isGallery()"}
<i class="material-symbols">grid_view</i>
·
{/if}
{if="$community->occupants > 0"}
<span title="{$c->__('communitydata.sub', $community->occupants)}">

2
app/Widgets/CommunityData/_communitydata.tpl

@ -25,7 +25,7 @@
{if="$related->occupants > 0"}
<span title="{$c->__('communitydata.sub', $related->occupants)}">
{$related->occupants} <i class="material-symbols">people</i> ·
{$related->occupants} <i class="material-symbols">people</i>
</span>
{/if}
{if="$related->description"}

2
app/Widgets/CommunityData/_communitydata_card.tpl

@ -35,7 +35,7 @@
<br />
<i class="material-symbols icon-text">article</i>
{$c->__('communitydata.num', $num)}
·
<i class="material-symbols icon-text">people</i>
{$c->__('communitydata.sub', $info->occupants)}

4
app/Widgets/CommunityHeader/_communityheader.tpl

@ -50,9 +50,9 @@
<i class="material-symbols">article</i> {$num}
{/if}
{if="$info != null"}
· <i class="material-symbols">people</i> {$info->occupants}
<i class="material-symbols">people</i> {$info->occupants}
{if="$info->description"}
· {$info->description|strip_tags}
{$info->description|strip_tags}
{/if}
{else}
{$server}

2
app/Widgets/ContactActions/_contactactions_drawer.tpl

@ -48,7 +48,7 @@
</p>
<p class="line">
{if="$roster && $roster->name && $roster->name != $contact->truename"}
{$roster->name} ·
{$roster->name}
{/if}
{$contact->id}
</p>

2
app/Widgets/ContactHeader/_contactheader.tpl

@ -52,7 +52,7 @@
</p>
<p class="line active" onclick="ContactActions_ajaxGetDrawer('{$contact->id|echapJS}')">
{if="$roster && $roster->name && $roster->name != $contact->truename"}
{$roster->name} ·
{$roster->name}
{/if}
{$contact->id}
</p>

4
app/Widgets/EmojisConfig/_emojisconfig.tpl

@ -27,11 +27,11 @@
{$value->description}
{/if}
{if="$value->homepage"}
·
<a href="{$value->homepage}" target="_blank">{$c->__('general.website')}</a>
{/if}
{if="$value->license"}
·
{$value->license}
{/if}
</p>

14
app/Widgets/Post/_post.tpl

@ -98,7 +98,7 @@
{else}
<p></p>
{/if}
<p>
<p title="{$post->published|prepareDate}">
{if="$contact"}
{if="!$public"}
{if="!$post->isMicroblog()"}
@ -109,9 +109,9 @@
<a href="#" onclick="if (typeof Post_ajaxGetContact == 'function') { Post_ajaxGetContact('{$contact->jid}'); } else { Group_ajaxGetContact('{$contact->jid}'); } ">
{/if}
{$contact->truename}
{if="!$public"}</a>{/if} ·
{if="!$public"}</a>{/if}
{elseif="$post->aname"}
{$post->aname} ·
{$post->aname}
{/if}
{if="!$post->isMicroblog()"}
{if="!$public"}
@ -123,20 +123,20 @@
<a href="#" onclick="MovimUtils.reload('{$c->route('community', [$post->server, $post->node])}')">
{/if}
{$post->node}
{if="!$public"}</a>{/if} ·
{if="!$public"}</a>{/if}
{/if}
{$post->published|prepareDate}
{$post->published|prepareDate:true,true}
{if="$post->isEdited()"}
<i class="material-symbols" title="{$post->updated|prepareDate}">
edit
</i>
{/if}
{if="$post->contentcleaned && readTime($post->contentcleaned)"}
· {$post->contentcleaned|readTime}
{$post->contentcleaned|readTime}
{/if}
{$count = $post->user_views_count}
{if="$count > 2"}
· {$count} <i class="material-symbols">visibility</i>
{$count} <i class="material-symbols">visibility</i>
{/if}
</p>
{if="$post->isBrief()"}

12
app/Widgets/Post/_post_card.tpl

@ -38,7 +38,7 @@
<p></p>
{/if}
<p>
<p title="{$post->published|prepareDate}">
{if="$post->aid"}
{if="!$post->isMicroblog() && $post->contact"}
<span class="icon bubble tiny">
@ -52,7 +52,7 @@
{/if}
>
{$post->truename}
</a> ·
</a>
{/if}
{if="!$post->isMicroblog()"}
@ -65,9 +65,9 @@
{/if} /
<a href="#" onclick="MovimUtils.reload('{$c->route('community', [$post->server, $post->node])}')">
{$post->node}
</a> ·
</a>
{/if}
{$post->published|prepareDate}
{$post->published|prepareDate:true,true}
{if="$post->isEdited()"}
<i class="material-symbols" title="{$post->updated|prepareDate}">
edit
@ -80,11 +80,11 @@
</i>
{/if}
{if="$post->contentcleaned && readTime($post->contentcleaned)"}
· {$post->contentcleaned|readTime}
{$post->contentcleaned|readTime}
{/if}
{$count = $post->user_views_count}
{if="$count > 2"}
· {$count} <i class="material-symbols">visibility</i>
{$count} <i class="material-symbols">visibility</i>
{/if}
</p>
{if="$post->isBrief()"}

10
app/Widgets/Post/_post_ticket.tpl

@ -70,7 +70,7 @@
title="{$post->server} / {$post->node}"
href="#"
onclick="MovimUtils.reload('{$c->route('community', [$post->server, $post->node])}')">
{if="$post->contact"}·{/if}
{if="$post->contact"}{/if}
{$post->node}
</a>
{/if}
@ -78,16 +78,16 @@
<span class="info" title="{$post->published|prepareDate}">
{$count = $post->pictures->count()}
{if="$count > 1"}
{$count} <i class="material-symbols">collections</i> ·
{$count} <i class="material-symbols">collections</i>
{/if}
{if="$post->embed"}
<i class="material-symbols">movie</i> ·
<i class="material-symbols">movie</i>
{/if}
{$count = $post->user_views_count}
{if="$count > 2"}
{$count} <i class="material-symbols">visibility</i> ·
{$count} <i class="material-symbols">visibility</i>
{/if}
{$count = $post->likes->count()}
@ -97,7 +97,7 @@
{$count = $post->comments->count()}
{if="$count > 0"}
{$count} <i class="material-symbols">chat_bubble_outline</i> ·
{$count} <i class="material-symbols">chat_bubble_outline</i>
{/if}
{$post->published|prepareDate:true,true}

2
app/Widgets/Publish/_publish_images.tpl

@ -7,7 +7,7 @@
onclick="Publish_ajaxHttpSetImageNumber({$embed->draft_id}, {$embed->id}, {$key+1})">
<i class="material-symbols">photo</i>
<span>
{$value.width} × {$value.height} · {$value.size|humanSize:0}
{$value.width} × {$value.height} {$value.size|humanSize:0}
</span>
</li>
{/loop}

2
app/Widgets/RoomsExplore/_roomsexplore_global.tpl

@ -37,7 +37,7 @@
{$value.occupants} <i class="material-symbols">people</i>
</span>
{/if}
{if="$value.occupants > 0 && !empty($value.description)"} · {/if}
{if="$value.occupants > 0 && !empty($value.description)"} {/if}
{$value.description}
</p>
</div>

2
app/Widgets/RoomsExplore/_roomsexplore_local.tpl

@ -38,7 +38,7 @@
{$value->occupants} <i class="material-symbols">people</i>
</span>
{/if}
{if="$value->occupants > 0 && !empty($value->description)"} · {/if}
{if="$value->occupants > 0 && !empty($value->description)"} {/if}
{$value->description ?? ''}
</p>
</div>

2
app/Widgets/Search/_search_results.tpl

@ -42,7 +42,7 @@
<p class="line">
{if="$value->isGallery()"}
<i class="material-symbols">grid_view</i>
·
{/if}
{$value->server} / {$value->node}
</p>

Loading…
Cancel
Save