123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ActivityVerbModule extends Module
- {
- const MODULE_VERSION = '2.0.0';
- public function onRouterInitialized(URLMapper $m)
- {
- $unsupported = ['delete', 'share'];
- foreach ($unsupported as $idx => $verb) {
- $unsupported[$idx] = "(?!{$verb})";
- }
-
-
-
- $verb_regexp = implode("", $unsupported) . '[a-z]+';
- $m->connect('notice/:id/:verb',
- ['action' => 'activityverb'],
- ['id' => '[0-9]+',
- 'verb' => $verb_regexp]);
- $m->connect('activity/:id/:verb',
- ['action' => 'activityverb'],
- ['id' => '[0-9]+',
- 'verb' => $verb_regexp]);
- }
- public function onModuleVersion(array &$versions): bool
- {
- $versions[] = array('name' => 'Activity Verb',
- 'version' => self::MODULE_VERSION,
- 'author' => 'Mikael Nordfeldth',
- 'homepage' => 'https://www.gnu.org/software/social/',
- 'rawdescription' =>
-
- _m('Adds more standardized verb handling for activities.'));
- return true;
- }
- }
|