Forums / Bug Reports / [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

[Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

Locked

Views: 3,515

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
22 Feb 2010, 8:31 PM
#1
grafcaps_com avatar

grafcaps_com

New Zenner

Join Date:
Aug 2008
Location:
The Midwest
Posts:
11
Plugin Contributions:
0

[Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

Working with Zen-Cart version 1.3.8a fresh installation or upgrade from 1.3.7.

For the EZ-Pages editor as well as the define pages editor, I've found that if I type a URL that has entities such as "&" or "•" in it, I can type it in and save the changes and everything works great. However, when I go to edit that page in plain text, when I pull up the code, the entities appear as the characters themselves, such as "&" and "•", instead of "&" and "•". The result is that when you update your pages, you will eventually end up with a bunch of validation errors. Trust me, it will happen. Validation matters very much to me, and I hate the nuisance of find/replace every time I edit a page. Quite simply put, it's wrong.

I've corrected the problem on my own installations of Zen-Cart by doing the following:

Line 440 of /admin/ezpages.php, change "$ezInfo->pages_html_text" to htmlspecialchars($ezInfo->pages_html_text)

Line 197 of /admin/define_pages_editor.php, add a line of code that says: $file_contents = htmlspecialchars($file_contents); I'm not sure why you can't just add it to the existing "zen_draw_textarea_field" function parameters, but it doesn't work that way for me. I had to run htmlspecialchars on the $file_contents variable before calling the function for whatever reason.

I would recommend making these changes standard in any future releases of Zen-Cart. I would also recommend doing something similar for any other pages which employ the plain-text editor.

Thanks,
Ben
grafcaps.com et. al.

Ben Harold
GrafCaps

22 Feb 2010, 9:05 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

This is largely due to inadequacies in the HTMLArea editor.

FCK and TinyMCE eliminate a lot of these sorts of problems.

20 years a Zencart User

22 Feb 2010, 9:22 PM
#3
grafcaps_com avatar

grafcaps_com

New Zenner

Join Date:
Aug 2008
Location:
The Midwest
Posts:
11
Plugin Contributions:
0

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

schoolboy:

This is largely due to inadequacies in the HTMLArea editor.

FCK and TinyMCE eliminate a lot of these sorts of problems.

If you read my post thoroughly, you'll realize that this has ABSOLUTELY NOTHING to do with HTMLarea, TinyMCE or FCKeditor or CKeditor or whatever you want to call it. This is specifically an issue dealing with the "Plain Text" HTML editor, which isn't really an HTML editor at all, but simply a textarea HTML element with the contents of the page in question dumped inside the text node.

Now, the HTMLarea editor ALSO strips the HTML entities out of your code. It does some other interesting/questionable things too, such as rewriting your JavaScript and re-ordering the parameters in your HTML elements. However, I have failed to find a workaround for this issue in HTMLarea. If you would like to accomplish something beyond meaningless conjecture, schoolboy, you might want to look into a solution to this issue. Personally, I never use the WYSIWYG editors, so I couldn't care less.

Ben Harold
GrafCaps

22 Feb 2010, 9:25 PM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

Nor could you care less about manners, apparently.

22 Feb 2010, 9:40 PM
#5
grafcaps_com avatar

grafcaps_com

New Zenner

Join Date:
Aug 2008
Location:
The Midwest
Posts:
11
Plugin Contributions:
0

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

stevesh:

Nor could you care less about manners, apparently.

I don't see what manners have to do with the bug in question, nor do I see what one-line responses of any sort have to contribute to this discussion. If you actually write code and have something to add that will help to resolve the issue at hand, please share your thoughts. If all you're doing is opining on the quality of a particular editor or taking offense to my curt, yet appropriate response, Judith Martin style, perhaps you are liable to rebuke. Just a thought...

Ben Harold
GrafCaps

22 Feb 2010, 9:52 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

Manners have everything to do with decorum in this, and other forums. schoolboy has been around here a while, and while he's good, he's not infallible. It's possible he didn't read your original post completely, or misunderstood your point.

A decent human being would have replied to his post with something like, "I don't think you understood my post - [add further explanation here]". Compare that with your reply.

Your response was anything but appropriate, and while I'm no Judith Martin, I know a lack of common courtesy when I see it.

22 Feb 2010, 10:14 PM
#7
grafcaps_com avatar

grafcaps_com

New Zenner

Join Date:
Aug 2008
Location:
The Midwest
Posts:
11
Plugin Contributions:
0

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

stevesh:

Manners have everything to do with decorum in this, and other forums. schoolboy has been around here a while, and while he's good, he's not infallible. It's possible he didn't read your original post completely, or misunderstood your point.

A decent human being would have replied to his post with something like, "I don't think you understood my post - [add further explanation here]". Compare that with your reply.

Your response was anything but appropriate, and while I'm no Judith Martin, I know a lack of common courtesy when I see it.

In that case, many many apologies to you, stevesh, for the horrible disservice that you perceive schoolboy has suffered in your witness. Your eyes have suffered in the light of such injustice that it must be hard to carry on from day to day. Are you affected by PTSD? I'm sure that schoolboy will never recover from such a harsh verbal offensive, as evidenced by his apparent inability to respond (more likely complete apathy) with such bold conviction as you have. At any rate, thank you so much for your help. You've been most illuminating.

Please share more of your thoughts on morality and other topical matters (particularly as they relate to my character) as soon as you have the chance. I can't wait to hear them. In the prestigious words of our generation's greatest voice, the esteemed Maddox: "nobody cares."

Ben Harold
GrafCaps

23 Feb 2010, 12:21 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: [Done v1.3.9a] HTML Entities and the Plain Text Editor for Define Pages and EZPages

You could have just said "I didn't mean to be offensive" or the like, and defused the situation. Replying to a (relatively mild) reprimand from a regular with a flame is not reasonable conduct in any forum.
Some people do care about civil discourse.

Meanwhile, your OP gives good insight into an annoying "feature" of the plaintext editor.