Mercurial > hg > fapweb
changeset 135:eecac02579c4
Move stChop() to site module and rename it to stStrChop().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 22 Oct 2013 21:55:12 +0300 |
parents | 3ed09527e348 |
children | aeebfedb5709 |
files | msite.inc.php results.inc.php |
diffstat | 2 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/msite.inc.php Tue Oct 22 21:50:02 2013 +0300 +++ b/msite.inc.php Tue Oct 22 21:55:12 2013 +0300 @@ -540,4 +540,17 @@ return stChkSetting("allowRegister") && ($maxAttendeesHard <= 0 || $numAttendees < $maxAttendeesHard); } + + +function stStrChop($str, $len) +{ + if (strlen($str) > $len) + $s = substr($str, 0, $len - 3)."..."; + else + $s = $str; + return sprintf("%-".$len."s", $s); +} + + + ?> \ No newline at end of file
--- a/results.inc.php Tue Oct 22 21:50:02 2013 +0300 +++ b/results.inc.php Tue Oct 22 21:55:12 2013 +0300 @@ -3,15 +3,6 @@ $showResults = stGetSetting("showResults"); $showAuthors = stGetSetting("showResAuthors"); -function stChop($str, $len) -{ - if (strlen($str) > $len) - $s = substr($str, 0, $len - 3)."..."; - else - $s = $str; - return sprintf("%-".$len."s", $s); -} - echo "<h1>Results</h1>\n"; @@ -84,8 +75,8 @@ $prev = $entry["votesum"]; printf(" %s by %s (%d pts)\n", - chentities(stChop($entry["name"], 30)), - chentities(stChop($showAuthors ? $entry["author"] : "-", 30)), + chentities(stStrChop($entry["name"], 30)), + chentities(stStrChop($showAuthors ? $entry["author"] : "-", 30)), $entry["votesum"]); }