Problems with HTML tag attributes and Glossary / Dictionary Page / FAQ Module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
nonty
Forum Members
Forum Members
Posts: 20
Joined: Fri Aug 25, 2006 9:21 am
Location: Denmark

Problems with HTML tag attributes and Glossary / Dictionary Page / FAQ Module

Post by nonty »

Hi all,

I wish to use the "Activate all Terms on site?" option of the Glossary / Dictionary Page / FAQ Module. As I have a rather small site with only cacheable pages, the bad performance of the option is not an issue.

Unfortunately the current implementation of this option will try to add links in too many places of a page, most notably it will not ignore attribute values of HTML tags.

Consider if TERM is a defined term in the model and the page in question contains the following:

It is also possible to use TERM as an replacement (read more)...

In this case both instances of "TERM" will get linkified resulting in:

It is also possible to use TERM as an replacement (TERM?">read more)...

which is clearly not valid HTML.

I have tried with different regular expressions (involving negative prefixes and like), but none have worked properly until now.

I believe I can see a way out using preg_replace_callback, but before I go into this I want to hear if anybody else have seen this problem and (hopefully) solved it. Alternative modules could be an option too.

/tonny
cmsms is just a necessary hoppy. Eclipse is my work.
Steppenwolf
Forum Members
Forum Members
Posts: 19
Joined: Fri Dec 01, 2006 11:22 am
Location: Germany

Re: Problems with HTML tag attributes and Glossary / Dictionary Page / FAQ Modul

Post by Steppenwolf »

Hi tonny,

here is a workaround (works only with western latin (ISO-8859-1) characters):

In the file Glossary.module.php, function CreateTermLink() replace the two occurrences of

addslashes(strip_tags($def))
with

htmlentities(substr(utf8_decode(strip_tags($def)),0,512))


I guess, this is not a perfect fix, but it works on my site.

Eberhard
nonty
Forum Members
Forum Members
Posts: 20
Joined: Fri Aug 25, 2006 9:21 am
Location: Denmark

Re: Problems with HTML tag attributes and Glossary / Dictionary Page / FAQ Modul

Post by nonty »

Thanks for the tip. I will look into this when I get some time... /tonny
cmsms is just a necessary hoppy. Eclipse is my work.
Post Reply

Return to “Modules/Add-Ons”