--- /dev/null
+<?php
+namespace wcf\system\request;
+
+/**
+ * Default interface for route controllers.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.request
+ * @category Community Framework
+ */
+interface IRouteController {
+ /**
+ * Returns the object id.
+ *
+ * @return integer
+ */
+ public function getID();
+
+ /**
+ * Returns the object title.
+ *
+ * @return string
+ */
+ public function getTitle();
+}
// build route
if ($controller !== null) {
+ // handle object
+ if (isset($parameters['object']) && $parameters['object'] instanceof \wcf\system\request\IRouteController) {
+ $parameters['id'] = $parameters['object']->getID();
+
+ // remove illegal characters
+ $parameters['title'] = preg_replace('/[\x0-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/', '-', $parameters['object']->getTitle());
+
+ unset($parameters['object']);
+ }
+
$parameters['controller'] = $controller;
$routeURL = RouteHandler::getInstance()->buildRoute($parameters);
if (!$isRaw && !empty($url)) {
continue;
}
- $link .= $components[$component] . '/';
+ // handle built-in SEO
+ if ($component === 'id' && isset($components['title'])) {
+ $link .= $components[$component] . '-' . $components['title'] . '/';
+ unset($components['title']);
+ }
+ else {
+ $link .= $components[$component] . '/';
+ }
unset($components[$component]);
}
}