- function onStartShowTagProfileForm($action, $profile)
- {
- $action->elementStart('form', array('method' => 'post',
- 'id' => 'form_tag_user',
- 'class' => 'form_settings',
- 'name' => 'tagprofile',
- 'action' => common_local_url('tagprofile', array('id' => @$profile->id))));
-
- $action->elementStart('fieldset');
- // TRANS: Fieldset legend.
- $action->element('legend', null, _m('List remote profile'));
- $action->hidden('token', common_session_token());
-
- $user = common_current_user();
-
- $action->elementStart('ul', 'form_data');
- $action->elementStart('li');
-
- // TRANS: Field label.
- $action->input('uri', _m('LABEL','Remote profile'), $action->trimmed('uri'),
- // TRANS: Field title.
- _m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname.'));
- $action->elementEnd('li');
- $action->elementEnd('ul');
- // TRANS: Button text to fetch remote profile.
- $action->submit('fetch', _m('BUTTON','Fetch'));
- $action->elementEnd('fieldset');
- $action->elementEnd('form');
- }
-
- function onStartTagProfileAction($action, $profile)
- {
- $err = null;
- $uri = $action->trimmed('uri');
-
- if (!$profile && $uri) {
- try {
- if (Validate::email($uri)) {
- $oprofile = Ostatus_profile::ensureWebfinger($uri);
- } else if (Validate::uri($uri)) {
- $oprofile = Ostatus_profile::ensureProfileURL($uri);
- } else {
- // TRANS: Exception in OStatus when invalid URI was entered.
- throw new Exception(_m('Invalid URI.'));
- }
-
- // redirect to the new profile.
- common_redirect(common_local_url('tagprofile', array('id' => $oprofile->profile_id)), 303);
-
- } catch (Exception $e) {
- // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
- // TRANS: and example.net, as these are official standard domain names for use in examples.
- $err = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
- }
-
- $action->showForm($err);
- return false;
- }
- return true;
- }
-