Cambios en diseño

This commit is contained in:
2020-06-04 12:33:07 -04:00
parent 5c538f8e93
commit 7aa3546e0a
7 changed files with 26 additions and 4 deletions

View File

@ -13,7 +13,22 @@ class Nosotros {
'nosotros.json'
]);
$nosotros = json_decode(trim(file_get_contents($filename)));
$nosotros = $this->str_split_unicode($nosotros, strlen($nosotros) / 2, '-');
$min = 200;
$max_phrase = 50;
if (strlen($nosotros) > $min) {
$half = strlen($nosotros) / 2;
$pos = strpos($nosotros, '.', $half);
if ($pos > $half + $max_phrase) {
$pos = strrpos($nosotros, '.', -$half);
}
$nosotros = $this->str_split_unicode($nosotros, $pos, '-');
if (count($nosotros) > 2) {
$s1 = array_shift($nosotros);
$nosotros = [$s1, implode('', $nosotros)];
}
} else {
$nosotros = [$nosotros];
}
return $view->render($response, 'nosotros', compact('nosotros'));
}
protected function str_split_unicode($str, $l = 0) {