function prettyText($str, $typography = true) { static $endPunct = array('.', ',', '!', '?'); $str = $typography ? typography($str) : S::capitalize(trim($str)); if ($str === '') { return $str; } in_array(S::last($str), $endPunct) or $str .= '.'; return $str; }
static function prettyOther(array $attrs) { foreach ($attrs as $name => &$value) { switch ($name) { case 'title': case 'maker': $value = typography($value); break; case 'country': $value = S::capitalize(trim($value)); break; case 'desc': $value = prettyText($value); break; } } return $attrs; }