1
Peekay
How do I stop Xoops making a clickable link?
  • 2010/6/13 19:33

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Sometimes, it is nice to type

www.example.com

and have Xoops automatically make it a clickable link, like above!

However, is there a way to overide this feature?

In the module I am messing with, the textarea field is invoked with:

$example['description'] = $ts->displayTarea($desc011);


I just wondered if there was an alternative method where links were not generated automatically?

A thread is for life. Not just for Christmas.

2
Anonymous
Re: How do I stop Xoops making a clickable link?
  • 2010/6/13 19:50

  • Anonymous

  • Posts: 0

  • Since:


Try to edit class/module.textsanitizer.php file and comment these lines:

$patterns[] = "/(^|[^]_a-z0-9-="'\/])([a-z]+?):\/\/([{$valid_chars}]+[{$end_chars}])/ei";

$replacements[] = "'\\1<a href="\\2://\\3" title="\\2://\\3" rel="external">\\2://'.MyTextSanitizer::truncate( '\\3' ).'</a>'";

$patterns[] = "/(^|[^]_a-z0-9-="'\/:\.])www\.((([a-zA-Z0-9\-]*\.){1,}){1}([a-zA-Z]{2,6}){1})((\/([a-zA-Z0-9\-\._\?\,\'\/\\+&%\$#\=~])*)*)/ei";
$replacements[] = "'\\1<a href="http://www.\\2\\6" title="www.\\2\\6" rel="external">'.MyTextSanitizer::truncate( 'www.\\2\\6' ).'</a>'";


3
madDan
Re: How do I stop Xoops making a clickable link?
  • 2010/6/13 20:33

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


]www.example.com


what like that?


or something like the address would =www.example.com

Any high bit char defeats it without altering the code

4
Peekay
Re: How do I stop Xoops making a clickable link?
  • 2010/6/13 21:19

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx for the ideas guys.

I worked around it in the form script

$match = array('http://''https://''www');
$replace = array('http:// ''https:// ''www ');
$desc str_replace($match$replace$desc);

Just an extra space after each entry in the replace array stops the auto-link from kicking in.

If you cut-n-paste the link it won't work, but I'm trying to dissuade people from adding links anyway, so this'll do fine.

A thread is for life. Not just for Christmas.

5
madDan
Re: How do I stop Xoops making a clickable link?
  • 2010/6/14 10:31

  • madDan

  • Not too shy to talk

  • Posts: 105

  • Since: 2010/1/6 1


Does the link submit still work with this implemented?

ie you can type in an address and it just formats as text.

But if you use the editor link/URL submission tool the linkable address would still be there?

6
Peekay
Re: How do I stop Xoops making a clickable link?
  • 2010/6/14 11:56

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


To be honest madDan, I don't know. I am using a Xoops plain textarea field, not the Xoops DHTML editor. I want to restrict input to text only, no formatting, links, pictures etc.

The replace script works on the entire text submitted so if you use the DHTML editor I guess it would probably break the link submission tool.
A thread is for life. Not just for Christmas.

7
ghia
Re: How do I stop Xoops making a clickable link?
  • 2010/6/14 14:22

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See makeClickable() in /class/module.textsanitizer.php

Login

Who's Online

143 user(s) are online (83 user(s) are browsing Support Forums)


Members: 0


Guests: 143


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits