• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug Inconsistent use of double quotes in HTML links

AndyB

Well-known member
#1
XenForo has always used a single quote in HTML links.

Example:

Code:
[URL='https://www.google.com/']Google[/URL]
The inconsistency comes with the newly introduced feature called "Convert URLs to Page Titles". This feature creates HTML links using double quotes:

Code:
[URL="https://www.google.com/"]Google[/URL]
Please change the following XenForo code:

XenForo/BbCode/Formatter/BbCode/Autolink.php

Line# 261 and 282

PHP:
$tag = '[URL="' . $link['url'] . '"]' . $linkTitle . '[/URL]';
change to:

PHP:
$tag = "[URL='" . $link['url'] . "']" . $linkTitle . "[/URL]";
Thank you.
 

Chris D

XenForo developer
Staff member
#3
XF supports either syntax for URLs and both are valid.

Regardless as to whether we change this, or not, you should assume that the software or users of the software may, at times, use syntax that isn't always consistent, as long as it is valid to do so. With that in mind, if you're reporting this because it causes a problem with one of your add-ons, you should be ensuring your code can cope with either syntax.