Skip to content
Snippets Groups Projects
Commit 92ffa3ce authored by Balazs Janos Tatar's avatar Balazs Janos Tatar
Browse files

Issue #170254 by mcdruid, tatarbj: Improvements for text handling.

parent a0868126
No related branches found
Tags 8.x-1.0-alpha7
No related merge requests found
......@@ -149,7 +149,6 @@ function template_preprocess_easy_breadcrumb(&$variables) {
$variables['list_type'] = 'http://data-vocabulary.org/Breadcrumb';
}
foreach ($breadcrumbs as $i => $breadcrumb) {
$content = decode_entities($breadcrumb['content']);
if (isset($breadcrumb['url'])) {
$variables['breadcrumb'][$i] = '<span itemprop="title">';
......@@ -158,7 +157,7 @@ function template_preprocess_easy_breadcrumb(&$variables) {
if (isset($parsed_url['query'])) {
parse_str($parsed_url['query'], $parsed_query);
}
$variables['breadcrumb'][$i] .= l($content, $parsed_url['path'], array(
$variables['breadcrumb'][$i] .= l($breadcrumb['content'], $parsed_url['path'], array(
'attributes' => array('class' => $breadcrumb['class']),
'query' => $parsed_query,
'html' => (!empty($breadcrumb['html'])) ? $breadcrumb['html'] : FALSE,
......@@ -168,7 +167,7 @@ function template_preprocess_easy_breadcrumb(&$variables) {
}
else {
$class = implode(' ', $breadcrumb['class']);
$variables['breadcrumb'][$i] = '<span class="' . $class . '" itemprop="title">' . check_plain($content) . '</span>';
$variables['breadcrumb'][$i] = '<span class="' . $class . '" itemprop="title">' . $breadcrumb['content'] . '</span>';
}
}
$variables['segments_quantity'] = isset($variables['breadcrumb']) ? count($variables['breadcrumb']) : 0;
......@@ -382,6 +381,9 @@ function _easy_breadcrumb_obtain_page_title($page_text) {
* the generated breadcrumb item.
*/
function _easy_breadcrumb_build_item($item_title, array $item_classes, $item_url, $as_link = TRUE) {
if (variable_get(EasyBreadcrumbConstants::DB_VAR_HTML_TAGS, TRUE)) {
$item_title = filter_xss($item_title);
}
if (variable_get(EasyBreadcrumbConstants::DB_VAR_TRUNCATOR_MODE, FALSE)) {
$item_title = truncate_utf8(
$item_title,
......@@ -516,8 +518,10 @@ function _easy_breadcrumb_obtain_segment_title($normal_path, $valid_path, $segme
* normalized title.
*/
function _easy_breadcrumb_normalize_text($raw_text) {
// Filter the raw text against XSS.
$normalized_text = check_url($raw_text);
// Transforms '-hello--world_javascript-' on 'hello world javascript'.
$normalized_text = str_replace(array('-', '_'), ' ', $raw_text);
$normalized_text = str_replace(array('-', '_'), ' ', $normalized_text);
$normalized_text = trim($normalized_text);
$normalized_text = preg_replace('/\s{2,}/', ' ', $normalized_text);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment