XF 1.5 How to implement the link proxy in addons?

Stuart Wright

Well-known member
I'd like the link proxy to be implemented within our editorial system. Is it simply a case of using xen:link ?

Chris D

XenForo developer
Staff member
It only applies to external links using the URL BB code.

You can actually manually create the links in HTML, they look like this:
<a href="https://www.avforums.com" target="_blank" class="externalLink ProxyLink" data-proxy-href="proxy.php?link=https%3A%2F%2Fwww.avforums.com&amp;hash=24f573fe00977240c5098a2388329935" rel="nofollow">AVForums.com</a>

The key things here are the href of the link is obviously whatever the original link is, a class of "ProxyLink" and a data-proxy-href attribute containing the proxy URL -- this is potentially the complicated bit.
$hash = hash_hmac('md5', $url,
   XenForo_Application::getConfig()->globalSalt . XenForo_Application::getOptions()->imageLinkProxyKey
return 'proxy.php?' . $proxyType . '=' . urlencode($url) . '&hash=' . $hash;
That's how that's generated in PHP ($proxyType would be 'link' for proxied links).

Chris D

XenForo developer
Staff member
I'm actually unsure how that would help.

Stuart's Editorial system is mostly an external system. It doesn't use the BB code formatter to output content. I suspect it is written in HTML in the editorial system, hence my comment about manually creating them in HTML.