function get_css_class_for_page($type) { $array = ['nid', 'token']; $paths = Request::route(); $path = $paths->uri(); $cssClass = implode(' ', explode('/', $path)); foreach ($array as $value) { if (preg_match('/(\\W|^)({' . $value . '})(\\W|$)/', $path)) { $path = str_replace($value, $paths->parameters()[$value], $path); } } $path = clean_character($path); $cssClass = clean_character($cssClass, 'page'); return $cssClass . ' ' . $type . '-' . $path; }
function clean_unicode($dirty) { mb_internal_encoding("UTF-8"); $s = ""; for ($i = 0; $i < mb_strlen($dirty); $i++) { $c = mb_substr($dirty, $i, 1); if (clean_character($c)) { $s .= $c; } } return $s; }