{php} /** * Timeline item for public user pages. * Variables: $post, $siteConfig */ $cid = $post['cid']; $ptptext = renderArticleEmojis(cleanArticleHtml($post['ptptext'] ?? '')); $ptpimag = $post['ptpimag'] ?? ''; $ptpvideo = $post['ptpvideo'] ?? ''; $ptpmusic = $post['ptpmusic'] ?? ''; $ptplx = $post['ptplx'] ?? 'only'; $ptpdw = $post['ptpdw'] ?? ''; $ptptime = $post['ptptime'] ?? ''; $ptpys = isFlag($post['ptpys'] ?? 1, 1); $ptpaud = isFlag($post['ptpaud'] ?? 1, 1); $isLongArticle = $ptplx === 'article'; $articleTitle = trim((string)($post['article_title'] ?? '')); $articleCover = assetUrl($post['article_cover'] ?? '/assets/img/thumbnailbg.svg'); if ($articleTitle === '') { $articleTitle = strCut(strip_tags($post['ptptext'] ?? ''), 30, ''); } $showAuditLock = !empty($showAuditLock); $appendFms = $appendFms ?? true; $time = strtotime($ptptime) ?: time(); $givenDate = date('Y-m-d', $time); if (date('Ymd') === date('Ymd', $time)) { $dayLabel = '今天'; $monthLabel = ''; } elseif (date('Ymd', strtotime('-1 day')) === date('Ymd', $time)) { $dayLabel = '昨天'; $monthLabel = ''; } else { $dayLabel = date('d', $time); $monthLabel = date('m', $time) . '月'; } if ($ptpys === 0) { $lockIcon = ''; } elseif ($showAuditLock && $ptpaud === 0) { $lockIcon = ''; } elseif ($showAuditLock && $ptpaud === -2) { $lockIcon = ''; } elseif ($showAuditLock && strtotime($ptptime) > time()) { $lockIcon = ''; } else { $lockIcon = ''; } $detailUrl = '/view/' . $cid; $dateStyle = $siteConfig['shougbsx'] ?? ''; $videoParts = explode('|', $ptpvideo); $videoUrl = assetUrl($videoParts[0] ?? ''); $videoCover = assetUrl($videoParts[1] ?? ''); $videoAutoplay = isFlag($siteConfig['videoauplay'] ?? 0) === 1 ? 'autoplay' : ''; $videoPlayIcon = isFlag($siteConfig['videoauplay'] ?? 0) === 0 ? '' : ''; $images = []; if ($ptpimag !== '') { $images = array_values(array_filter(explode('(+@+)', $ptpimag), function ($value) { return trim((string)$value) !== ''; })); } $imageCount = count($images); {/php}
{$dayLabel|raw} {$monthLabel|raw}
{$ptpdw}
{if condition="$isLongArticle"}
{$lockIcon|raw}
{elseif condition="$ptplx === 'music' && !is_numeric($ptpmusic)" /} {php} $mus = explode('|', $ptpmusic); $musicCover = !empty($mus[3]) ? assetUrl($mus[3]) : '/assets/img/musicba.jpg'; $musicTitle = $ptptext === '' ? '' : '
' . $ptptext . '
'; {/php}
{$lockIcon|raw} {$musicTitle|raw}
{$mus.1|default=''}

{$mus.2|default=''}

{else/}
{if condition="$ptplx === 'img'"} {php}$gridStyle = $imageCount === 1 ? 'grid-template-columns: 1fr;grid-template-rows: 1fr;' : '';{/php}
{php} foreach (array_slice($images, 0, 4) as $index => $image) { $imageUrl = thumbUrl(assetUrl($image)); $itemStyle = ''; if ($imageCount === 2) { $itemStyle = 'grid-row: 1 / 3;'; } elseif ($imageCount === 3 && $index === 0) { $itemStyle = 'grid-row: 1 / 3;'; } echo '
'; } {/php} {$lockIcon|raw}
{$ptptext|raw}

共{$imageCount}张

{elseif condition="$ptplx === 'video'" /}
{php}$isBilibili = stripos($videoUrl, 'player.bilibili.com') !== false;{/php} {if condition="$isBilibili"}
{$videoPlayIcon|raw} BiliBili {else/} {$videoPlayIcon|raw} MP4 {/if} {$lockIcon|raw}
{$ptptext|raw}
{else/}
{$ptptext|raw}
{$lockIcon|raw}
{/if}
{/if}