3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2011, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET')) {
25 * Extra profile bio-like fields
27 * @package ExtendedProfilePlugin
28 * @maintainer Brion Vibber <brion@status.net>
30 class ExtendedProfilePlugin extends Plugin
32 function onPluginVersion(&$versions)
35 'name' => 'ExtendedProfile',
36 'version' => STATUSNET_VERSION,
37 'author' => 'Brion Vibber, Samantha Doherty, Zach Copley',
38 'homepage' => 'http://status.net/wiki/Plugin:ExtendedProfile',
39 // TRANS: Plugin description.
40 'rawdescription' => _m('UI extensions for additional profile fields.')
49 * Loads our classes if they're requested.
51 * @param string $cls Class requested
53 * @return boolean hook return
55 function onAutoload($cls)
57 $dir = dirname(__FILE__);
59 switch (strtolower($cls))
61 case 'profiledetailaction':
62 case 'profiledetailsettingsaction':
63 case 'userautocompleteaction':
64 include_once $dir . '/actions/'
65 . strtolower(mb_substr($cls, 0, -6)) . '.php';
67 break; // Safety first!
68 case 'extendedprofile':
69 case 'extendedprofilewidget':
70 include_once $dir . '/lib/' . strtolower($cls) . '.php';
73 case 'profile_detail':
74 include_once $dir . '/classes/' . ucfirst($cls) . '.php';
83 * Add paths to the router table
85 * Hook for RouterInitialized event.
87 * @param Net_URL_Mapper $m URL mapper
89 * @return boolean hook return
91 function onStartInitializeRouter($m)
95 array('action' => 'profiledetail'),
96 array('nickname' => Nickname::DISPLAY_FMT)
99 '/settings/profile/finduser',
100 array('action' => 'Userautocomplete')
103 'settings/profile/detail',
104 array('action' => 'profiledetailsettings')
110 function onCheckSchema()
112 $schema = Schema::get();
113 $schema->ensureTable('profile_detail', Profile_detail::schemaDef());
118 function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) {
119 $user = User::staticGet('id', $profile->id);
121 $url = common_local_url('profiledetail', array('nickname' => $user->nickname));
122 // TRANS: Link text on user profile page leading to extended profile page.
123 $out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));