X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FDirectory%2FDirectoryPlugin.php;h=7ac0f9326588684d1dc61b9d383f7db513f7251c;hb=c94d9994d898eddf654121ac45d455891954e830;hp=5979bb0e806107cd49d59d6696d20389fac53730;hpb=e2914189f3d7f11b16c4b4e16106da251433c028;p=quix0rs-gnu-social.git diff --git a/plugins/Directory/DirectoryPlugin.php b/plugins/Directory/DirectoryPlugin.php index 5979bb0e80..7ac0f93265 100644 --- a/plugins/Directory/DirectoryPlugin.php +++ b/plugins/Directory/DirectoryPlugin.php @@ -69,56 +69,50 @@ class DirectoryPlugin extends Plugin } /** - * Load related modules when needed + * Map URLs to actions * - * @param string $cls Name of the class to be loaded + * @param URLMapper $m path-to-action mapper * * @return boolean hook value; true means continue processing, * false means stop. */ - function onAutoload($cls) + public function onRouterInitialized(URLMapper $m) { - // common_debug("class = $cls"); - $dir = dirname(__FILE__); + $m->connect( + 'directory/users/:filter/sort_by/:sort/reverse/:reverse', + array('action' => 'userdirectory'), + array('filter' => '[0-9a-zA-Z]|(0-9)'), + array('sort' => '[a-z]+'), + array('reverse' => '[0-9]') + ); - switch ($cls) - { - case 'UserdirectoryAction': - case 'GroupdirectoryAction': - include_once $dir - . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; - return false; - case 'AlphaNav': - include_once $dir - . '/lib/' . strtolower($cls) . '.php'; - return false; - case 'SortableSubscriptionList': - case 'SortableGroupList': - include_once $dir - . '/lib/' . strtolower($cls) . '.php'; - return false; - default: - return true; - } - } + $m->connect( + 'directory/users/:filter/sort_by/:sort', + array('action' => 'userdirectory'), + array('filter' => '[0-9a-zA-Z]|(0-9)'), + array('sort' => '[a-z]+') + ); - /** - * Map URLs to actions - * - * @param Net_URL_Mapper $m path-to-action mapper - * - * @return boolean hook value; true means continue processing, - * false means stop. - */ - function onRouterInitialized($m) - { $m->connect( 'directory/users/:filter', array('action' => 'userdirectory'), array('filter' => '[0-9a-zA-Z]|(0-9)') ); + + $m->connect( + 'directory/users/sort_by/:sort/reverse/:reverse', + array('action' => 'userdirectory'), + array('sort' => '[a-z]+'), + array('reverse' => '[0-9]') + ); + + $m->connect( + 'directory/users/sort_by/:sort', + array('action' => 'userdirectory'), + array('sort' => '[a-z]+') + ); $m->connect( 'directory/users', @@ -136,6 +130,12 @@ class DirectoryPlugin extends Plugin array('action' => 'groupdirectory') ); + $m->connect( + 'groups/all', + array('action' => 'groupdirectory') + ); + + return true; } @@ -188,7 +188,7 @@ class DirectoryPlugin extends Plugin * * @return boolean hook flag */ - function onEndShowStatusNetStyles($action) + public function onEndShowStylesheets(Action $action) { if (in_array( $action->trimmed('action'), @@ -255,7 +255,7 @@ class DirectoryPlugin extends Plugin { $versions[] = array( 'name' => 'Directory', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Zach Copley', 'homepage' => 'http://status.net/wiki/Plugin:Directory', // TRANS: Plugin description.