<?php
namespace wcf\data\page\menu\item;
use wcf\data\ProcessibleDatabaseObject;
-use wcf\system\application\ApplicationHandler;
use wcf\system\menu\page\DefaultPageMenuItemProvider;
use wcf\system\menu\ITreeMenuItem;
use wcf\system\request\LinkHandler;
+use wcf\system\Regex;
use wcf\system\WCF;
/**
* @see wcf\system\menu\ITreeMenuItem::getLink()
*/
public function getLink() {
- $abbreviation = ApplicationHandler::getInstance()->getAbbreviation($this->packageID);
-
- $parameters = array();
- if ($abbreviation) {
- $parameters['application'] = $abbreviation;
+ // external link
+ if ($this->menuItemController === null) {
+ return WCF::getLanguage()->get($this->menuItemLink);
}
- return LinkHandler::getInstance()->getLink(null, $parameters, WCF::getLanguage()->get($this->menuItemLink));
+ // resolve application and controller
+ $parts = explode('\\', $this->menuItemController);
+ $abbreviation = array_shift($parts);
+ $controller = array_pop($parts);
+
+ // drop controller suffix
+ $controller = Regex::compile('(Action|Form|Page)$')->replace($controller, '');
+
+ return LinkHandler::getInstance()->getLink($controller, array('application' => $abbreviation), WCF::getLanguage()->get($this->menuItemLink));
}
/**
$conditions->add("menu_item.menuItemID IN (?)", array($itemIDs));
$conditions->add("menu_item.isDisabled = ?", array(0));
- $sql = "SELECT menuItemID, menuItem, parentMenuItem, menuItemLink,
- permissions, options, menuPosition, className
+ $sql = "SELECT *
FROM wcf".WCF_N."_page_menu_item menu_item
".$conditions."
ORDER BY showOrder ASC";