From 06ebae4afac3489b5d44d028e774d69884a91fde Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 29 Dec 2016 13:40:40 +0100 Subject: [PATCH] Fixed handling for external links in menu.tpl --- com.woltlab.wcf/templates/__menu.tpl | 2 +- .../files/lib/data/menu/item/MenuItem.class.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/com.woltlab.wcf/templates/__menu.tpl b/com.woltlab.wcf/templates/__menu.tpl index bc8e7b5897..86c0d13f73 100644 --- a/com.woltlab.wcf/templates/__menu.tpl +++ b/com.woltlab.wcf/templates/__menu.tpl @@ -2,7 +2,7 @@
    {foreach from=$menuItemNodeList item=menuItemNode}
  1. - + isExternalLink()}{if EXTERNAL_LINK_REL_NOFOLLOW} rel="nofollow"{/if}{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}{/if}> {lang}{$menuItemNode->title}{/lang} {if $menuItemNode->getOutstandingItems() > 0} {#$menuItemNode->getOutstandingItems()} diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php index 860f957b6a..7ecfeee0f9 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php @@ -3,6 +3,7 @@ namespace wcf\data\menu\item; use wcf\data\page\Page; use wcf\data\page\PageCache; use wcf\data\DatabaseObject; +use wcf\system\application\ApplicationHandler; use wcf\system\exception\ImplementationException; use wcf\system\page\handler\ILookupPageHandler; use wcf\system\page\handler\IMenuPageHandler; @@ -136,6 +137,15 @@ class MenuItem extends DatabaseObject { return 0; } + /** + * Returns true if this item is an external link. + * + * @return boolean + */ + public function isExternalLink() { + return ($this->externalURL ? !ApplicationHandler::getInstance()->isInternalURL($this->externalURL) : false); + } + /** * Returns the page handler for this item. * -- 2.20.1