Jump to content
kixe

Quotes in Summary of Module Info

Recommended Posts

Qotes (single or double) in the summary (Array Element of ModuleInfo)  will be displayed '&quote;' or ''' which means the output of the html-source is: '&quote;' or '''.

Didn't check the cause.

Maybe better to avoid the use of quotes in the summary respectively in translations (.json).

Share this post


Link to post
Share on other sites

The case would no doubt be entity encoding. It sounds like maybe double entity encoding? I did just try adding quotes to the summary for Helloworld.module, and am not seeing double entity encoding though. 

Share this post


Link to post
Share on other sites

Yes there must be one htmlspecialchars too much. Cannot find the second one, maybe until rendering the table as a form value?
If I take away the first one it works.

ProcessModule.module
Line 128:

$summary = empty($info['summary']) ? '' : htmlspecialchars($info['summary']);
 

Line 182:

$form->attr('value', $out); //call of modules > InputfieldForm/ InputfieldWrapper
 

Share this post


Link to post
Share on other sites

I got it:
I made the summary in my modules translatable like:
'summary' => __('Here comes the text'),

This function does a second entity encoding.
 

Is it useful to edit the following line in ProcessModule.module to prevent from double encoding?

Line 128:

            $summary = empty($info['summary']) ? '' : htmlspecialchars(htmlspecialchars_decode($info['summary']));

 

Share this post


Link to post
Share on other sites

Okay that makes sense. We entity encode everything coming from the translation functions for security. I believe that htmlspecialchars/htmlentities have a boolean argument that when 'true' can tell it to not double-encode. But for a quick solution in your case, you could update that line in your module to this (below), and I'll update the ProcessModule to have that boolean argument. 

'summary' => html_entity_decode(__('Here comes the text')), 
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Cyber-mano
      Hi everybody,
      First time for me here to ask an help. So I apologize in advance for any section mistakes or forum rules not respected.
      I'm a newbie in PW, only 1 year working on it.
      I have a page with Date/Time pickers and they work perfectly, but I should have those in Italian (for safe editors that aren't so good with English).
      So I followed the translation suggestions founded in some old posts.
      Once setted the correct URL, the DatePicker are displayed in the right language, but I have an error on page saving: it seems that the field doesn't register the date/time change from the older language. The same problem occurs if I create a new page, not only changing the old ones.
      May I have missed something?
      Thanks a lot in advance.
       
    • By K4mil
      Hello
      I've recently run into a trouble with translatable strings in my template files. Shortly speaking translatable strings show up properly in language panel, I can create and save translations, everything looks just fine in backend. The problem is that the only outputed value is the hardcoded one. It's definitely not a problem with template code itself because this happened even on simple test template with a  translatable string alone. 
      There are no errors, I don't see anything special in logs. I just recently moved site from my local server to my ftp. There were some issues with paths in language files, but I have fixed it. It's the newest dev version of PW. I really don't have idea where to look, I'm fighting with this second day, and slowly loosing my nerves.
    • By alexcapes
      Hi,
      I have an issue when using the SmartyPants Typographer text formatter.
      If the text has an HTML tag (such as italics) straight after the quotation mark, it reverses it. 
      So for example:

      This only seems to occur when an HTML tag is placed at the beginning. 
      Does anyone know how this could be corrected? 
    • By Orkun
      Hi Guys
      I have a problem with the Code Internationalization (Site Translation Files) in Processwire. I am using the method Ryan is describing in this topic and also the normal way of translating files. The weird behaviors are that translations are just gone after a change in the main translation file called _strings (uses Ryan method). Or some other weird behavior was, that the english translation of the _strings file were somehow ported inside the german _strings file. I really don't know what could cause this. Have ever witnessed something like that? 
      I have made some thoughts about this whole Code Internalization thing in ProcessWire and I am thinking to go another way (don't get me wrong, it's perfect for small to mid projects but in my opinion it is just a overkill for big projects), because at the beginning the strings we needed to translate were splitted up in many files which produced many site translation files to translate per language. It was just to much and confusing for the customer (and also for me), so that we needed another approach. So I tried Ryans method with one central translation files. The problem with this one is that it also gets confusing since it is a very big amount of strings to translate and also the problems described above. So for know I will try to make approach to store the strings in Pages. All translations of a string would be stored side by side. I know that this is probably more complex behind the scenes but it is far easier for the customer (especially with ListerPro). And I also like the idea of having the translations inside the DB instead in form of Files.
      What are your thoughts about it? Have ever done something like that?
      Greetings
      Orkun
    • By heldercervantes
      I've had this happen before, but now I got this problem again and I'm wondering what it's about.
      I use the basic <?= __('Contacte-nos') ?> method for adding translatable text to templates. Some of these are not appearing on the form when I edit the file's translations in PW.
      Take this line of code:
      <?= __('1 ou +7 pessoas?') ?> <a href="#" class="contactsMenu"><?= __('Contacte-nos') ?></a> The first string "1 ou +7 pessoas?" appears when I edit the translations, but the second one doesn't. Eventually I figured out I can only have one of these per line of code. Adding a line break somewhere somewhere between them was enough to make both translations show up in the form.
      Problem solved, but curiosity remains. What is the reason for this?
×
×
  • Create New...