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
33 function onPluginVersion(&$versions)
35 $versions[] = array('name' => 'ExtendedProfile',
36 'version' => STATUSNET_VERSION,
37 'author' => 'Brion Vibber',
38 'homepage' => 'http://status.net/wiki/Plugin:ExtendedProfile',
40 _m('UI extensions for additional profile fields.'));
48 * Loads our classes if they're requested.
50 * @param string $cls Class requested
52 * @return boolean hook return
54 function onAutoload($cls)
56 $lower = strtolower($cls);
59 case 'extendedprofile':
60 case 'extendedprofilewidget':
61 case 'profiledetailaction':
62 case 'profiledetailsettingsaction':
63 require_once dirname(__FILE__) . '/' . $lower . '.php';
71 * Add paths to the router table
73 * Hook for RouterInitialized event.
75 * @param Net_URL_Mapper $m URL mapper
77 * @return boolean hook return
79 function onStartInitializeRouter($m)
81 $m->connect(':nickname/detail',
82 array('action' => 'profiledetail'),
83 array('nickname' => Nickname::DISPLAY_FMT));
84 $m->connect('settings/profile/detail',
85 array('action' => 'profiledetailsettings'));
90 function onEndAccountSettingsProfileMenuItem($widget, $menu)
92 // TRANS: Link title attribute in user account settings menu.
93 $title = _('Change additional profile settings');
94 // TRANS: Link description in user account settings menu.
95 $widget->showMenuItem('profiledetailsettings',_m('Details'),$title);
99 function onEndProfilePageProfileElements(HTMLOutputter $out, Profile $profile) {
100 $user = User::staticGet('id', $profile->id);
102 $url = common_local_url('profiledetail', array('nickname' => $user->nickname));
103 $out->element('a', array('href' => $url), _m('More details...'));