* added option to 'verbose' concatenate a list of items to class Lang
 * added option to strip tags from a string to class Markdown
 * fixed several instances of wrong categories on pages
 * actually display world state conditions for zone music
 * some typos all over the place
This commit is contained in:
Sarjuuk
2017-04-22 00:59:34 +02:00
parent 959d0ace0b
commit 6377a9e659
20 changed files with 149 additions and 53 deletions

View File

@@ -90,6 +90,29 @@ class Lang
return self::vspf($var, $vspfArgs);
}
public static function concat($args, $useAnd = true, $callback = null)
{
$b = '';
$i = 0;
$n = count($args);
foreach ($args as $k => $arg)
{
if (is_callable($callback))
$b .= $callback($arg, $k);
else
$b .= $arg;
if ($n > 1 && $i < ($n - 2))
$b .= ', ';
else if ($n > 1 && $i == $n - 2)
$b .= Lang::main($useAnd ? 'and' : 'or');
$i++;
}
return $b;
}
public static function sort($prop, $group, $method = SORT_NATURAL)
{