Skip to content

Commit 5ad14e5

Browse files
committed
Refactor packet index tags
1 parent 84e8c47 commit 5ad14e5

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

src/templates/Packet/Index.phtml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,32 @@ require('./header.inc.phtml'); ?>
8484
if ($research) require('./InResearch.inc.phtml');
8585
if (!$published) require('./Draft.inc.phtml');
8686
$tpl_packet_flags = ob_get_clean();
87-
if (!empty($tpl_packet_flags)) $tpl_packet_flags = ' ' . $tpl_packet_flags; ?>
88-
<tr>
89-
<td><strong><a href="<?=$packet->getURI()?>"><?=filter_var($packet->getLabel(), FILTER_SANITIZE_FULL_SPECIAL_CHARS)?></a></strong><?=$tpl_packet_flags?><br/><span class="text-muted"><?=$brief?></span></td>
90-
<td><? if ($user) { ?><a href="<? echo $user_url; ?>"><img class="avatar" src="<? echo $avatar_url; ?>"/>&nbsp;<? echo filter_var($user->getName(), FILTER_SANITIZE_STRING); ?></a><? } else { ?>Anonymous<? } ?></td>
91-
</tr>
92-
<? } ?>
87+
if (!empty($tpl_packet_flags)) $tpl_packet_flags = ' ' . $tpl_packet_flags;
88+
89+
echo '<tr>';
90+
printf('<td><strong><a href="%s">%s</a></strong>%s<br/><span class="text-muted">%s</span></td>',
91+
$packet->getURI(),
92+
filter_var($packet->getLabel(), FILTER_SANITIZE_FULL_SPECIAL_CHARS),
93+
$tpl_packet_flags,
94+
$brief
95+
);
96+
printf('<td>%s</td>', (
97+
$user ? sprintf('<a href="%s"><img class="mr-2 rounded" src="%s">%s</a>',
98+
$user_url, $avatar_url, filter_var($user->getName(), FILTER_SANITIZE_STRING)
99+
) : 'Anonymous')
100+
);
101+
echo '</tr>';
102+
} ?>
93103
</tbody></table>
94-
</section>
95-
<section>
96-
<p>These packets are also available as constants in
104+
<p>These packets are also available as constants in
97105
<? $q = getenv('QUERY_STRING'); if (!empty($q)) { $q = '?' . $q; } ?>
98-
<a href="<? echo Common::relativeUrlToAbsolute('/packet/index.cpp' . $q); ?>">C++</a>,
99-
<a href="<? echo Common::relativeUrlToAbsolute('/packet/index.java' . $q); ?>">Java</a>,
100-
<a href="<? echo Common::relativeUrlToAbsolute('/packet/index.json' . $q); ?>">JSON</a>,
101-
<a href="<? echo Common::relativeUrlToAbsolute('/packet/index.php' . $q); ?>">PHP</a>, and
102-
<a href="<? echo Common::relativeUrlToAbsolute('/packet/index.vb' . $q); ?>">VB6</a>.
103-
</p>
104-
</section>
105-
</article>
106+
<a href="<?=Common::relativeUrlToAbsolute('/packet/index.cpp' . $q)?>">C++</a>,
107+
<a href="<?=Common::relativeUrlToAbsolute('/packet/index.java' . $q)?>">Java</a>,
108+
<a href="<?=Common::relativeUrlToAbsolute('/packet/index.json' . $q)?>">JSON</a>,
109+
<a href="<?=Common::relativeUrlToAbsolute('/packet/index.php' . $q)?>">PHP</a>, and
110+
<a href="<?=Common::relativeUrlToAbsolute('/packet/index.vb' . $q)?>">VB6</a>.
111+
</p>
112+
</div>
106113
<? ob_start(); ?>
107114
<script type="text/javascript">
108115
$(document).ready(function(){

0 commit comments

Comments
 (0)