jDiction Forum

English => General Questions => Topic started by: Finarfin on June 11, 2013, 02:50:31 pm

Title: w3c validation
Post by: Finarfin on June 11, 2013, 02:50:31 pm
Error:

<a href='http://localhost/index.php/fr/news?view=article&id=836' target='_self' class='lang fr-FR'>

Possible solution:

Mod_lenguage/helper.php, line 211:

return array($link, $menuitem->title);

becomes

return array(htmlspecialchars($link), $menuitem->title);
Title: Re: w3c validation
Post by: Harald Leithner on June 11, 2013, 02:56:45 pm
Wrong way, or better wrong position.

But it should already be escaped with htmlspecialchars...

in mod_jdlanguage/tmpl/default.php
we have a row with
Code: [Select]
<a href='<?php echo JRoute::_($language->link); ?>' target='_self'...
And JRoute::_() is escaping with htmlspecialchars... did you use the default.php as template?
Title: Re: w3c validation
Post by: Finarfin on June 11, 2013, 09:16:02 pm
Really strange.

- Default.php
<a href='<?php echo JRoute::_($language->link); ?>' target='_self' class='lang <?php echo $language->lang_code; ?><?php echo ($language->active ? ' active' : ''); ?>'

With htmlspecialchars on helper.php

<a href='http://localhost/index.php/en/news?view=article&amp;id=836' target='_self' class='lang en-GB'
    ><img src="/media/com_jdiction/images/flags/en.png" alt="English (UK) - News"></a>

- Without

<a href='http://localhost/index.php/en/news?view=article&id=836' target='_self' class='lang en-GB'
    ><img src="/media/com_jdiction/images/flags/en.png" alt="English (UK) - News"></a>

Joomla 2.5.8

Its really a small detail to worry too much, but is kind of strange

Ok, I think I get it, here (http://api.joomla.org/Joomla-Platform/JRoute.html)  says: "boolean $xhtml: Replace & by &amp; for XML compilance" but... the default behaviour is to xhmtl= true. Even forcing it, jroute stills don´t behave properly.... really strange. Ok, I explain the "problem" here (https://github.com/joomla/joomla-cms/issues/1270), when you have "&" and "index.php" on your url, it doesn´t htmlentity, don´t know if is a mistake or a design decision.

I´ll let you know