Support for &<text>; character encoding in page title, bread crumbs

Project:ProjectPier
Version:0.8.0.3
Component:Code
Category:support request
Priority:normal
Assigned:phpfreak
Status:patch - code needs review
Description

While working on the German translation I replaced unreadable characters in my webeditor with their HTML encoding (e.g. ü). I noticed that the & got translated to & in certain places (bread crumbs, page titles). Turns out the clean function was used to clean these values. The function clean supports the numeric variant for HTML character encodig &1234; but not the text version: ü. I did not want to change the function clean. I also wanted to be able to use the non-numeric character encoding in the language files. So I fixed the code. Here are the fixes:

In

application/layouts/dashboard.php
application/layouts/project_website.php

remove

clean( ... )

from

echo flash_get('success')
echo flash_get('error')
echo clean($tabbed_navigation_item->getTitle()
echo clean($bread_crumb->getTitle()

Works except for page title. Yet page title did not have a clean call:

echo $page_action->getTitle())

Turns out the clean was done when setting the page title.

In

application/helpers/page.php

change

function set_page_title($value) {
PageDescription::instance()->setTitle(clean($value));
}

to

function set_page_title($value) {
PageDescription::instance()->setTitle($value);
}

Done.

Warning: You are now responsible to translate <, > and & yourself in language files, but you have complete control now.

#1

Correction:

While working on the German translation I replaced unreadable characters in my webeditor with their HTML encoding (e.g. unreadable ΓΌ became  &uuml; ). I noticed that the & got translated to &amp; in certain places

There is also another issue. Any text inputted with <, > or &that is shown in the page title is not corrected now. I guess that is why the clean function was there in the set_page_title function.

Another, simpler solution would be to remove the line that converts to &amp; in function clean.