123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- if (!defined('STATUSNET')) { exit(1); }
- class SlicedFavoritesPlugin extends Plugin
- {
- const PLUGIN_VERSION = '2.0.0';
-
- public $slices = array();
-
- public function onRouterInitialized(URLMapper $m)
- {
- $m->connect('favorited/:slice',
- ['action' => 'favoritedslice'],
- ['slice' => '[a-zA-Z0-9]+']);
- return true;
- }
-
- function onArgsInitialize($args)
- {
- if (array_key_exists('action', $args)) {
- $action = trim($args['action']);
- if ($action == 'favorited') {
- common_redirect(common_local_url('favoritedslice', array('slice' => 'default')));
- exit(0);
- }
- }
- return true;
- }
- function onSlicedFavoritesGetSettings($slice, &$data)
- {
- if (isset($this->slices[$slice])) {
- $data = $this->slices[$slice];
- return false;
- }
- return true;
- }
-
- public function onPluginVersion(array &$versions): bool
- {
- $url = GNUSOCIAL_ENGINE_REPO_URL . 'tree/master/plugins/SlicedFavorites';
- $versions[] = array('name' => 'SlicedFavorites',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Brion Vibber',
- 'homepage' => $url,
- 'rawdescription' =>
-
- _m('Shows timelines of popular notices for defined subsets of users.'));
- return true;
- }
- }
|