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

XF 1.5 How to implement the link proxy in addons?

Discussion in 'Styling and Customization Questions' started by Stuart Wright, Feb 5, 2016.

Tags:
  1. Stuart Wright

    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 ?
     
  2. Chris D

    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:
    Code:
    <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.
    PHP:
    $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).
     
    JulianD likes this.
  3. Stuart Wright

    Stuart Wright Well-Known Member

    Thanks, Chris. I'll pass this along to our coder John to implement in the editorial system.
     
  4. SneakyDave

    SneakyDave Well-Known Member

    The Comprehensive URL Parser addon uses it, and I think you have a copy of that Stuart.
     
  5. Chris D

    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.
     
    SneakyDave likes this.
  6. SneakyDave

    SneakyDave Well-Known Member

    That'll teach me to read the whole thread next time. (y)
     
    Chris D likes this.
  7. Stuart Wright

    Stuart Wright Well-Known Member

    Thanks though, Dave :)
     
    SneakyDave likes this.

Share This Page