Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions lib/config/hubConfig.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
class hubConfig extends waAppConfig
{

protected $_routes;

public function onInit()
{
$wa = wa();
Expand All @@ -12,6 +14,41 @@ public function onInit()
$this->maybeArchiveTopics();
}
}

public function getRouting($route = array(), $dispatch = true)
{
if ($this->_routes === null || $dispatch) {
$routes = parent::getRouting($route);
/**
* Extend routing via plugin routes
* @event routing
* @param array $routes
* @return array routes collected for every plugin
*/
$result = wa()->event(array($this->application, 'routing'), $routes);
$all_plugins_routes = array();
foreach ($result as $plugin_id => $routing_rules) {
if ($routing_rules) {
$plugin = str_replace('-plugin', '', $plugin_id);
foreach ($routing_rules as $url => &$route) {
if (!is_array($route)) {
list($route_ar['module'], $route_ar['action']) = explode('/', $route);
$route = $route_ar;
}
$route['plugin'] = $plugin;
$all_plugins_routes[$url] = $route;
}
unset($route);
}
}
$routes = array_merge($all_plugins_routes, $routes);
if ($dispatch) {
return $routes;
}
$this->_routes = $routes;
}
return $this->_routes;
}

/**
* Return timestamp of last user activity in previous user session.
Expand Down