3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2011, StatusNet, Inc.
6 * Adds a user directory
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * @author Zach Copely <zach@status.net>
26 * @copyright 2011 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET')) {
36 * Directory plugin main class
40 * @author Zach Copley <zach@status.net>
41 * @copyright 2011 StatusNet, Inc.
42 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
43 * @link http://status.net/
45 class DirectoryPlugin extends Plugin
51 * Initializer for this plugin
53 * @return boolean hook value; true means continue processing,
62 * Cleanup for this plugin.
64 * @return boolean hook value; true means continue processing,
73 * Load related modules when needed
75 * @param string $cls Name of the class to be loaded
77 * @return boolean hook value; true means continue processing,
80 function onAutoload($cls)
82 // common_debug("class = $cls");
84 $dir = dirname(__FILE__);
88 case 'UserdirectoryAction':
90 . '/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
94 . '/lib/' . strtolower($cls) . '.php';
96 case 'SortableSubscriptionList':
98 . '/lib/' . strtolower($cls) . '.php';
106 * Map URLs to actions
108 * @param Net_URL_Mapper $m path-to-action mapper
110 * @return boolean hook value; true means continue processing,
113 function onRouterInitialized($m)
117 array('action' => 'userdirectory'),
118 array('filter' => 'all')
122 'directory/users/:filter',
123 array('action' => 'userdirectory'),
124 array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)')
131 * Link in a styelsheet for the onboarding actions
133 * @param Action $action Action being shown
135 * @return boolean hook flag
137 function onEndShowStatusNetStyles($action)
140 $action->trimmed('action'),
141 array('userdirectory'))
143 $action->cssLink($this->path('css/directory.css'));
150 * Modify the public local nav to add a link to the user directory
152 * @param Action $action The current action handler. Use this to
155 * @return boolean hook value; true means continue processing,
160 function onEndPublicGroupNav($nav)
162 // XXX: Maybe this should go under search instead?
164 $actionName = $nav->action->trimmed('action');
167 common_local_url('userdirectory'),
170 $actionName == 'userdirectory',
180 function onPluginVersion(&$versions)
183 'name' => 'Directory',
184 'version' => STATUSNET_VERSION,
185 'author' => 'Zach Copley',
186 'homepage' => 'http://status.net/wiki/Plugin:Directory',
187 'rawdescription' => _m('Add a user directory.')