jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Author Topic: w3c validation  (Read 6594 times)

Finarfin

  • Full Member
  • ***
  • Posts: 119
    • View Profile
w3c validation
« 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);
Logged

Harald Leithner

  • Administrator
  • Hero Member
  • *****
  • Posts: 1684
    • View Profile
Re: w3c validation
« Reply #1 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?
Logged
Joomla! 5.0 Release Manager
Vote at JED

Finarfin

  • Full Member
  • ***
  • Posts: 119
    • View Profile
Re: w3c validation
« Reply #2 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
Logged