[ROUTES] Allow accept-header specification during router creation

Router:
- Fix calls to connect, most of them were misusing the function's params

URLMapper:
- Minor fixes
- Documentation
- Add support for accept-header specification

Plugins/*:
- Fix calls to connect
This commit is contained in:
brunoccast
2019-07-11 19:14:03 +01:00
committed by Diogo Cordeiro
parent 2032c7c1f7
commit 5c0a3102ff
48 changed files with 1023 additions and 871 deletions

View File

@@ -36,23 +36,25 @@ class DirectMessagePlugin extends Plugin
public function onRouterInitialized(URLMapper $m)
{
// web front-end actions
$m->connect('message/new', array('action' => 'newmessage'));
$m->connect('message/new?to=:to', array('action' => 'newmessage'), array('to' => Nickname::DISPLAY_FMT));
$m->connect('message/new', ['action' => 'newmessage']);
$m->connect('message/new?to=:to',
['action' => 'newmessage'],
['to' => Nickname::DISPLAY_FMT]);
$m->connect('message/:message',
array('action' => 'showmessage'),
array('message' => '[0-9]+'));
['action' => 'showmessage'],
['message' => '[0-9]+']);
// direct messages
$m->connect('api/direct_messages.:format',
array('action' => 'ApiDirectMessage',
'format' => '(xml|json|rss|atom)'));
['action' => 'ApiDirectMessage'],
['format' => '(xml|json|rss|atom)']);
$m->connect('api/direct_messages/sent.:format',
array('action' => 'ApiDirectMessage',
'format' => '(xml|json|rss|atom)',
'sent' => true));
['action' => 'ApiDirectMessage',
'sent' => true],
['format' => '(xml|json|rss|atom)']);
$m->connect('api/direct_messages/new.:format',
array('action' => 'ApiDirectMessageNew',
'format' => '(xml|json)'));
['action' => 'ApiDirectMessageNew'],
['format' => '(xml|json)']);
return true;
}