本文整理汇总了PHP中_m函数的典型用法代码示例。如果您正苦于以下问题:PHP _m函数的具体用法?PHP _m怎么用?PHP _m使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_m函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Show the menu
*
* @return void
*/
function show()
{
$user = common_current_user();
if (empty($user)) {
throw new ServerException('Cannot show personal group navigation without a current user.');
}
$user_profile = $user->getProfile();
$nickname = $user->nickname;
$name = $user_profile->getBestName();
$action = $this->actionName;
$mine = $this->action->arg('nickname') == $nickname;
// @fixme kinda vague
$this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartPersonalGroupNav', array($this))) {
$this->out->menuItem(common_local_url('all', array('nickname' => $nickname)), _m('MENU', 'Home'), sprintf(_('%s and friends'), $name), $mine && $action == 'all', 'nav_timeline_personal');
$this->out->menuItem(common_local_url('showstream', array('nickname' => $nickname)), _m('MENU', 'Profile'), _('Your profile'), $mine && $action == 'showstream', 'nav_profile');
$this->out->menuItem(common_local_url('replies', array('nickname' => $nickname)), _m('MENU', 'Replies'), sprintf(_('Replies to %s'), $name), $mine && $action == 'replies', 'nav_timeline_replies');
$this->out->menuItem(common_local_url('showfavorites', array('nickname' => $nickname)), _m('MENU', 'Favorites'), sprintf(_('%s\'s favorite notices'), $user_profile ? $name : _m('FIXME', 'User')), $mine && $action == 'showfavorites', 'nav_timeline_favorites');
$cur = common_current_user();
if ($cur && $cur->id == $user->id && !common_config('singleuser', 'enabled')) {
$this->out->menuItem(common_local_url('inbox', array('nickname' => $nickname)), _m('MENU', 'Messages'), _('Your incoming messages'), $mine && $action == 'inbox');
}
Event::handle('EndPersonalGroupNav', array($this));
}
$this->out->elementEnd('ul');
}
示例2: formData
/**
* Data elements of the form
*
* @return void
*/
function formData()
{
$this->out->hidden('subaction', 'authverify');
$this->out->elementStart('fieldset');
$this->out->elementStart('p');
// TRANS: Form instructions.
$this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
$this->out->elementEnd('p');
// iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
/*
$this->out->element('iframe', array('id' => 'yammer-oauth',
'src' => $this->runner->getAuthUrl()));
*/
// yeah, it ignores the callback_url
// soo... crappy link. :(
$this->out->elementStart('p', array('class' => 'magiclink'));
$this->out->element('a', array('href' => $this->runner->getAuthUrl(), 'target' => '_blank'), _m('Open Yammer authentication window'));
$this->out->elementEnd('p');
// TRANS: Form instructions.
$this->out->element('p', array(), _m('Copy the verification code you are given below:'));
$this->out->elementStart('ul', array('class' => 'form_data'));
$this->out->elementStart('li');
// TRANS: Field label.
$this->out->input('verify_token', _m('Verification code:'));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
// TRANS: Button text for saving Yammer authorisation data and starting Yammer import.
$this->out->submit('submit', _m('BUTTON', 'Continue'), 'submit', null, _m('Save the verification code and begin import.'));
$this->out->elementEnd('fieldset');
}
示例3: show
/**
* Show the menu
*
* @return void
*/
function show()
{
$cur = common_current_user();
$action = $this->action->trimmed('action');
$this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartSubGroupNav', array($this))) {
$this->out->menuItem(common_local_url('showstream', array('nickname' => $this->user->nickname)), _m('MENU', 'Profile'), empty($profile) ? $this->user->nickname : $profile->getBestName(), $action == 'showstream', 'nav_profile');
$this->out->menuItem(common_local_url('subscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscriptions'), sprintf(_('People %s subscribes to.'), $this->user->nickname), $action == 'subscriptions', 'nav_subscriptions');
$this->out->menuItem(common_local_url('subscribers', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscribers'), sprintf(_('People subscribed to %s.'), $this->user->nickname), $action == 'subscribers', 'nav_subscribers');
if ($cur && $cur->id == $this->user->id) {
// Possibly site admins should be able to get in here too
$pending = $this->countPendingSubs();
if ($pending || $cur->subscribe_policy == User::SUBSCRIBE_POLICY_MODERATE) {
$this->out->menuItem(common_local_url('subqueue', array('nickname' => $this->user->nickname)), sprintf(_m('MENU', 'Pending (%d)'), $pending), sprintf(_('Approve pending subscription requests.'), $this->user->nickname), $action == 'subqueueaction', 'nav_subscribers');
}
}
$this->out->menuItem(common_local_url('usergroups', array('nickname' => $this->user->nickname)), _m('MENU', 'Groups'), sprintf(_('Groups %s is a member of.'), $this->user->nickname), $action == 'usergroups', 'nav_usergroups');
$this->out->menuItem(common_local_url('peopletagsubscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Lists'), sprintf(_('List subscriptions by %s.'), $this->user->nickname), in_array($action, array('peopletagsbyuser', 'peopletagsubscriptions', 'peopletagsforuser')), 'nav_timeline_peopletags');
if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
$this->out->menuItem(common_local_url('invite'), _m('MENU', 'Invite'), sprintf(_('Invite friends and colleagues to join you on %s.'), common_config('site', 'name')), $action == 'invite', 'nav_invite');
}
Event::handle('EndSubGroupNav', array($this));
}
$this->out->elementEnd('ul');
}
示例4: prepare
function prepare($args)
{
parent::prepare($args);
$this->uri = $this->trimmed('uri');
$this->uri = Discovery::normalize($this->uri);
if (Discovery::isWebfinger($this->uri)) {
$parts = explode('@', substr(urldecode($this->uri), 5));
if (count($parts) == 2) {
list($nick, $domain) = $parts;
// @fixme confirm the domain too
// @fixme if domain checking is added, ensure that it will not
// cause problems with sites that have changed domains!
$nick = common_canonical_nickname($nick);
$this->user = User::staticGet('nickname', $nick);
}
} else {
$this->user = User::staticGet('uri', $this->uri);
if (empty($this->user)) {
// try and get it by profile url
$profile = Profile::staticGet('profileurl', $this->uri);
if (!empty($profile)) {
$this->user = User::staticGet('id', $profile->id);
}
}
}
if (!$this->user) {
$this->clientError(_m('No such user.'), 404);
return false;
}
return true;
}
示例5: showContent
function showContent()
{
$tags = $this->getTags();
if (!$tags) {
// TRANS: Content displayed in a tag cloud section if there are no tags.
$this->out->element('p', null, _m('NOTAGS', 'None'));
return false;
}
$cnt = 0;
$tw = array();
$sum = 0;
while ($tags->fetch() && ++$cnt <= TAGS_PER_SECTION) {
$tw[$tags->tag] = $tags->weight;
$sum += $tags->weight;
}
if ($cnt == 0) {
// TRANS: Content displayed in a tag cloud section if there are no tags.
$this->out->element('p', null, _m('NOTAGS', 'None'));
return false;
}
ksort($tw);
$this->out->elementStart('ul', 'tags xoxo tag-cloud');
foreach ($tw as $tag => $weight) {
$this->showTag($tag, $weight, $sum == 0 ? 0 : $weight / $sum);
}
$this->out->elementEnd('ul');
return $cnt > TAGS_PER_SECTION;
}
示例6: getKeyPair
public function getKeyPair($signer_uri)
{
$disco = new Discovery();
try {
$xrd = $disco->lookup($signer_uri);
} catch (Exception $e) {
return false;
}
if ($xrd->links) {
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
$keypair = false;
$parts = explode(',', $link['href']);
if (count($parts) == 2) {
$keypair = $parts[1];
} else {
// Backwards compatibility check for separator bug in 0.9.0
$parts = explode(';', $link['href']);
if (count($parts) == 2) {
$keypair = $parts[1];
}
}
if ($keypair) {
return $keypair;
}
}
}
// TRANS: Exception.
throw new Exception(_m('Unable to locate signer public key.'));
}
示例7: formData
/**
* Data elements of the form
*
* @return void
*/
function formData()
{
$this->out->hidden('subaction', 'apikey');
$this->out->elementStart('fieldset');
$this->out->elementStart('p');
// TRANS: Explanation of what needs to be done to connect to a Yammer network.
$this->out->text(_m('Before we can connect to your Yammer network, ' . 'you will need to register the importer as an ' . 'application authorized to pull data on your behalf. ' . 'This registration will work only for your own network. ' . 'Follow this link to register the app at Yammer; ' . 'you will be prompted to log in if necessary:'));
$this->out->elementEnd('p');
$this->out->elementStart('p', array('class' => 'magiclink'));
$this->out->element('a', array('href' => 'https://www.yammer.com/client_applications/new', 'target' => '_blank'), _m('Open Yammer application registration form'));
$this->out->elementEnd('p');
// TRANS: Instructions.
$this->out->element('p', array(), _m('Copy the consumer key and secret you are given into the form below:'));
$this->out->elementStart('ul', array('class' => 'form_data'));
$this->out->elementStart('li');
// TRANS: Field label for a Yammer consumer key.
$this->out->input('consumer_key', _m('Consumer key:'), common_config('yammer', 'consumer_key'));
$this->out->elementEnd('li');
$this->out->elementStart('li');
// TRANS: Field label for a Yammer consumer secret.
$this->out->input('consumer_secret', _m('Consumer secret:'), common_config('yammer', 'consumer_secret'));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
// TRANS: Button text for saving a Yammer API registration.
$this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, _m('Save the entered consumer key and consumer secret.'));
$this->out->elementEnd('fieldset');
}
示例8: handle
function handle($channel)
{
$cur = $this->user;
$all = new SearchSub();
$all->profile_id = $cur->id;
$all->find();
if ($all->N == 0) {
// TRANS: Error text shown a user tries to disable all a search subscriptions with track off command, but has none.
$channel->error($cur, _m('You are not tracking any searches.'));
return;
}
$profile = $cur->getProfile();
while ($all->fetch()) {
try {
SearchSub::cancel($profile, $all->search);
} catch (Exception $e) {
// TRANS: Message given having failed to cancel one of the search subs with 'track off' command.
// TRANS: %s is the search for which the subscription removal failed.
$channel->error($cur, sprintf(_m('Error disabling search subscription for query "%s".'), $all->search));
return;
}
}
// TRANS: Message given having disabled all search subscriptions with 'track off'.
$channel->output($cur, _m('Disabled all your search subscriptions.'));
}
示例9: doModel
function doModel()
{
switch ($this->action) {
case 'latestsearches':
//calling the comments settings view
$this->doView('settings/searches.php');
break;
case 'latestsearches_post':
// updating comment
osc_csrf_check();
if (Params::getParam('save_latest_searches') == 'on') {
osc_set_preference('save_latest_searches', 1);
} else {
osc_set_preference('save_latest_searches', 0);
}
if (Params::getParam('customPurge') == '') {
osc_add_flash_error_message(_m('Custom number could not be left empty'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
} else {
osc_set_preference('purge_latest_searches', Params::getParam('customPurge'));
osc_add_flash_ok_message(_m('Last search settings have been updated'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
}
break;
}
}
示例10: error
function error($from, $msg)
{
$this->log(LOG_INFO, "Error: {$from} {$msg}");
$headers['To'] = $from;
$headers['Subject'] = _m('Error');
return mail_send(array($from), $headers, $msg);
}
示例11: show
/**
* Show the menu
*
* @return void
*/
function show()
{
$this->actionName = $this->action->trimmed('action');
$this->action->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartPublicGroupNav', array($this))) {
if (!common_config('singleuser', 'enabled')) {
// TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('public'), _m('MENU', 'Public'), _('Public timeline'), $this->actionName == 'public', 'nav_timeline_public');
}
// TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('groups'), _m('MENU', 'Groups'), _('User groups'), $this->actionName == 'groups', 'nav_groups');
if (!common_config('performance', 'high')) {
// TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('publictagcloud'), _m('MENU', 'Recent tags'), _('Recent tags'), $this->actionName == 'publictagcloud', 'nav_recent-tags');
}
if (count(common_config('nickname', 'featured')) > 0) {
// TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('featured'), _m('MENU', 'Featured'), _('Featured users'), $this->actionName == 'featured', 'nav_featured');
}
if (!common_config('singleuser', 'enabled')) {
// TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('favorited'), _m('MENU', 'Popular'), _('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited');
}
Event::handle('EndPublicGroupNav', array($this));
}
$this->action->elementEnd('ul');
}
示例12: show
function show()
{
$user = common_current_user();
$this->action->elementStart('ul', array('id' => 'nav_local_default'));
if (Event::handle('StartDefaultLocalNav', array($this, $user))) {
if (!empty($user)) {
$pn = new PersonalGroupNav($this->action);
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU', 'Home'), $pn);
}
$bn = new PublicGroupNav($this->action);
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU', 'Public'), $bn);
if (!empty($user)) {
$sn = new GroupsNav($this->action, $user);
if ($sn->haveGroups()) {
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU', 'Groups'), $sn);
}
}
if (!empty($user)) {
$sn = new ListsNav($this->action, $user->getProfile());
if ($sn->hasLists()) {
// TRANS: Menu item in default local navigation panel.
$this->submenu(_m('MENU', 'Lists'), $sn);
}
}
Event::handle('EndDefaultLocalNav', array($this, $user));
}
$this->action->elementEnd('ul');
}
示例13: handle
/**
* Class handler.
*
* @param array $args query arguments
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$profile = AnonymousFavePlugin::getAnonProfile();
if (empty($profile) || $_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error.
$this->clientError(_m('Could not favor notice! Please make sure your browser has cookies enabled.'));
}
$id = $this->trimmed('notice');
$notice = Notice::getKV($id);
$token = $this->checkSessionToken();
// Throws exception
$stored = Fave::addNew($profile, $notice);
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title.
$this->element('title', null, _m('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');
$disfavor = new AnonDisFavorForm($this, $notice);
$disfavor->show();
$this->elementEnd('body');
$this->endHTML();
} else {
$this->returnToPrevious();
}
}
示例14: prepare
function prepare($args)
{
parent::prepare($args);
$nickname_arg = $this->arg('nickname');
$nickname = Nickname::normalize($nickname_arg);
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
if ($this->arg('page') && $this->arg('page') != 1) {
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url($this->trimmed('action'), $args), 301);
}
$this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when referring to a non-existing user.
$this->clientError(_m('No such user.'), 404);
}
$this->profile = $this->user->getProfile();
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_m('User has no profile.'));
}
$page = $this->trimmed('page');
if (!empty($page) && Validate::number($page)) {
$this->page = $page + 0;
} else {
$this->page = 1;
}
$this->notices = empty($this->tag) ? $this->user->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) : $this->user->getTaggedNotices($this->tag, ($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
return true;
}
示例15: handle
/**
* Handle input, produce output
*
* Switches based on GET or POST method. On GET, shows a form
* for posting a notice. On POST, saves the results of that form.
*
* Results may be a full page, or just a single notice list item,
* depending on whether AJAX was requested.
*
* @param array $args $_REQUEST contents
*
* @return void
*/
function handle($args)
{
if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user.
$this->clientError(_('Not logged in.'));
} else {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// check for this before token since all POST and FILES data
// is losts when size is exceeded
if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) {
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
}
parent::handle($args);
$user = common_current_user();
$group = User_group::staticGet('id', $this->trimmed('groupid'));
$taskid = $this->trimmed('taskid');
try {
$this->saveNewNotice();
Task::completeTask($user->id, $taskid);
} catch (Exception $e) {
$this->ajaxErrorMsg($e->getMessage(), $taskid, $group);
return;
}
}
}
}