Forums | Mahara Community

Support /
Way to turn off automatic linking of URLs


Teresa Brady's profile picture
Posts: 33

03 October 2014, 13:26

Hi,

Is there a way to turn off automatic linking of URLs in text boxes?

The action of the unlink button in the text-editor is ignored when a text box is saved.

I ask because we have had students who wish to use a URL as a reference, but not have it as a live link, because the original link is now broken.

Kind regards,

Teresa

Robert Lyon's profile picture
Posts: 773

03 October 2014, 14:48

Hi Teresa,

The problem seems to stem at the point of saving the entered text - something searches thru and makes anything it sees as being of the shape of a url into an actual url.

Currently the only option you have is to make the url look less like one.

eg: place a space between the http:// and the rest of the url - or drop the http:// bit altogether, so have:

URL: mysite.com/view/view.php?id=1

rather than

http://mysite.com/view/view.php?id=1

Cheers

Robert

Teresa Brady's profile picture
Posts: 33

03 October 2014, 15:49

OK, thought so.

Thanks for that Robert.

Cheers,

Teresa

Aaron Wells's profile picture
Posts: 896

07 October 2014, 18:33

To expand on what Robert said (and get a bit technical), it's the clean_html() function. This is a function that Mahara uses to filter user-entered HTML in order to make sure it's secure and valid. And while it's doing that, it also locates any URLs in the text, and it turns them into clickable links.

If you really want to disable this behavior, you can hack your site. In htdocs/lib/web.php, locate the function "clean_html", and then comment out the line that reads "$config->set('AutoFormat.Linkify', true);"

Cheers,

Aaron

Teresa Brady's profile picture
Posts: 33

09 October 2014, 0:55

Cool - thanks for that Aaron,

Cheers,

Teresa

anonymous profile picture
Account deleted
Posts: 1

17 October 2014, 4:44

Thanks Robert for such a short answer.I was expecting for some technical one but this is Great.

6 results