Mercurial > hg > fapweb
changeset 558:09a11dd385c7
Add new function stStrChopPad() that replaces stStrChop(), but stStrChop()
works differently now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 22 Dec 2013 08:03:51 +0200 |
parents | 2de6e0ecb3fa |
children | 67c6bde8d265 |
files | msite.inc.php msitegen.inc.php |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/msite.inc.php Sat Dec 21 08:10:29 2013 +0200 +++ b/msite.inc.php Sun Dec 22 08:03:51 2013 +0200 @@ -515,8 +515,8 @@ else $out .= " -''-"; - $name = stStrChop(stStrKludge($entry["name"]), 30); - $author = stStrChop($showAuthors ? stStrKludge($entry["author"]) : "-", 30); + $name = stStrChopPad(stStrKludge($entry["name"]), 30); + $author = stStrChopPad($showAuthors ? stStrKludge($entry["author"]) : "-", 30); $out .= sprintf(" %s by %s (%d pts)\n", $html ? chentities($name) : $name,
--- a/msitegen.inc.php Sat Dec 21 08:10:29 2013 +0200 +++ b/msitegen.inc.php Sun Dec 22 08:03:51 2013 +0200 @@ -641,11 +641,13 @@ function stStrChop($str, $len) { - if (strlen($str) > $len) - $s = substr($str, 0, $len - 3)."..."; - else - $s = $str; - return sprintf("%-".$len."s", $s); + return (strlen($str) > $len) ? substr($str, 0, $len - 3)."..." : $str; +} + + +function stStrChopPad($str, $len) +{ + return sprintf("%-".$len."s", stStrChop($str, $len)); }