本文整理汇总了PHP中thebuggenie\core\framework\Context::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getMessage方法的具体用法?PHP Context::getMessage怎么用?PHP Context::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_url
?>
<?php
}
?>
<form accept-charset="<?php
echo \thebuggenie\core\framework\Context::getI18n()->getCharset();
?>
" action="<?php
echo make_url('login');
?>
" method="post" id="login_form" onsubmit="TBG.Main.Login.login('<?php
echo make_url('login');
?>
'); return false;">
<?php
if (!\thebuggenie\core\framework\Context::hasMessage('login_force_redirect') || \thebuggenie\core\framework\Context::getMessage('login_force_redirect') !== true) {
?>
<input type="hidden" id="tbg3_referer" name="tbg3_referer" value="<?php
echo $referer;
?>
" />
<?php
} else {
?>
<input type="hidden" id="return_to" name="return_to" value="<?php
echo $referer;
?>
" />
<?php
}
?>
示例2: runMyAccount
/**
* "My account" page
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runMyAccount(framework\Request $request)
{
$this->forward403unless($this->getUser()->hasPageAccess('account'));
$categories = \thebuggenie\core\entities\Category::getAll();
$projects = [];
$project_subscription_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS;
$category_subscription_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS_CATEGORY;
$category_notification_key = \thebuggenie\core\framework\Settings::SETTINGS_USER_NOTIFY_NEW_ISSUES_MY_PROJECTS_CATEGORY;
$subscriptionssettings = framework\Settings::getSubscriptionsSettings();
$notificationsettings = framework\Settings::getNotificationSettings();
$selected_project_subscriptions = [];
$selected_category_subscriptions = [];
$selected_category_notifications = [];
$this->all_projects_subscription = $this->getUser()->getNotificationSetting($project_subscription_key, false)->isOn();
foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
if ($project->hasAccess()) {
$projects[$project_id] = $project;
if ($this->getUser()->getNotificationSetting($project_subscription_key . '_' . $project_id, false)->isOn()) {
$selected_project_subscriptions[] = $project_id;
}
}
}
foreach ($categories as $category_id => $category) {
if ($this->getUser()->getNotificationSetting($category_subscription_key . '_' . $category_id, false)->isOn()) {
$selected_category_subscriptions[] = $category_id;
}
if ($this->getUser()->getNotificationSetting($category_notification_key . '_' . $category_id, false)->isOn()) {
$selected_category_notifications[] = $category_id;
}
}
$this->selected_project_subscriptions = $this->all_projects_subscription ? [] : $selected_project_subscriptions;
$this->projects = $projects;
$this->selected_category_subscriptions = $selected_category_subscriptions;
$this->selected_category_notifications = $selected_category_notifications;
$this->categories = $categories;
$this->subscriptionssettings = $subscriptionssettings;
$this->notificationsettings = $notificationsettings;
$this->has_autopassword = framework\Context::hasMessage('auto_password');
if ($this->has_autopassword) {
$this->autopassword = framework\Context::getMessage('auto_password');
}
if ($request->isPost() && $request->hasParameter('mode')) {
switch ($request['mode']) {
case 'information':
if (!$request['buddyname'] || !$request['email']) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Please fill out all the required fields')));
}
$this->getUser()->setBuddyname($request['buddyname']);
$this->getUser()->setRealname($request['realname']);
$this->getUser()->setHomepage($request['homepage']);
$this->getUser()->setEmailPrivate((bool) $request['email_private']);
$this->getUser()->setUsesGravatar((bool) $request['use_gravatar']);
$this->getUser()->setTimezone($request->getRawParameter('timezone'));
$this->getUser()->setLanguage($request['profile_language']);
if ($this->getUser()->getEmail() != $request['email']) {
if (\thebuggenie\core\framework\Event::createNew('core', 'changeEmail', $this->getUser(), array('email' => $request['email']))->triggerUntilProcessed()->isProcessed() == false) {
$this->getUser()->setEmail($request['email']);
}
}
$this->getUser()->save();
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile information saved')));
break;
case 'settings':
$this->getUser()->setPreferredWikiSyntax($request['syntax_articles']);
$this->getUser()->setPreferredIssuesSyntax($request['syntax_issues']);
$this->getUser()->setPreferredCommentsSyntax($request['syntax_comments']);
$this->getUser()->setKeyboardNavigationEnabled($request['enable_keyboard_navigation']);
$this->getUser()->save();
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile settings saved')));
break;
case 'notificationsettings':
$this->getUser()->setDesktopNotificationsNewTabEnabled($request['enable_desktop_notifications_new_tab']);
foreach ($subscriptionssettings as $setting => $description) {
if ($setting == framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS_CATEGORY) {
foreach ($categories as $category_id => $category) {
if ($request->hasParameter('core_' . $setting . '_' . $category_id)) {
$this->getUser()->setNotificationSetting($setting . '_' . $category_id, true)->save();
} else {
$this->getUser()->setNotificationSetting($setting . '_' . $category_id, false)->save();
}
}
} elseif ($setting == framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS) {
if ($request->hasParameter('core_' . $setting . '_all')) {
$this->getUser()->setNotificationSetting($setting, true)->save();
foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
$this->getUser()->setNotificationSetting($setting . '_' . $project_id, false)->save();
}
} else {
$this->getUser()->setNotificationSetting($setting, false)->save();
foreach (\thebuggenie\core\entities\Project::getAll() as $project_id => $project) {
if ($request->hasParameter('core_' . $setting . '_' . $project_id)) {
$this->getUser()->setNotificationSetting($setting . '_' . $project_id, true)->save();
} else {
$this->getUser()->setNotificationSetting($setting . '_' . $project_id, false)->save();
//.........这里部分代码省略.........
示例3: componentLogin
public function componentLogin()
{
$this->selected_tab = isset($this->section) ? $this->section : 'login';
$this->options = $this->getParameterHolder();
if (framework\Context::hasMessage('login_referer')) {
$this->referer = htmlentities(framework\Context::getMessage('login_referer'), ENT_COMPAT, framework\Context::getI18n()->getCharset());
} elseif (array_key_exists('HTTP_REFERER', $_SERVER)) {
$this->referer = htmlentities($_SERVER['HTTP_REFERER'], ENT_COMPAT, framework\Context::getI18n()->getCharset());
} else {
$this->referer = framework\Context::getRouting()->generate('dashboard');
}
try {
$this->loginintro = null;
$this->registrationintro = null;
$this->loginintro = \thebuggenie\modules\publish\entities\tables\Articles::getTable()->getArticleByName('LoginIntro');
$this->registrationintro = \thebuggenie\modules\publish\entities\tables\Articles::getTable()->getArticleByName('RegistrationIntro');
} catch (\Exception $e) {
}
if (framework\Settings::isLoginRequired()) {
framework\Context::getResponse()->deleteCookie('tbg3_username');
framework\Context::getResponse()->deleteCookie('tbg3_password');
$this->error = framework\Context::geti18n()->__('You need to log in to access this site');
} elseif (!framework\Context::getUser()->isAuthenticated()) {
$this->error = framework\Context::geti18n()->__('Please log in');
} else {
//$this->error = framework\Context::geti18n()->__('Please log in');
}
}
示例4: runMyAccount
/**
* "My account" page
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runMyAccount(framework\Request $request)
{
$this->forward403unless($this->getUser()->hasPageAccess('account'));
$notificationsettings = array();
$i18n = $this->getI18n();
$notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES] = $i18n->__('Automatically subscribe to issues I get involved in');
$notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ARTICLES] = $i18n->__('Automatically subscribe to article I get involved in');
$notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new issues that are created in my project(s)');
$notificationsettings[framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ARTICLES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new articles that are created in my project(s)');
$this->notificationsettings = $notificationsettings;
$this->has_autopassword = framework\Context::hasMessage('auto_password');
if ($this->has_autopassword) {
$this->autopassword = framework\Context::getMessage('auto_password');
}
if ($request->isPost() && $request->hasParameter('mode')) {
switch ($request['mode']) {
case 'information':
if (!$request['buddyname'] || !$request['email']) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Please fill out all the required fields')));
}
$this->getUser()->setBuddyname($request['buddyname']);
$this->getUser()->setRealname($request['realname']);
$this->getUser()->setHomepage($request['homepage']);
$this->getUser()->setEmailPrivate((bool) $request['email_private']);
$this->getUser()->setUsesGravatar((bool) $request['use_gravatar']);
$this->getUser()->setTimezone($request->getRawParameter('timezone'));
$this->getUser()->setLanguage($request['profile_language']);
if ($this->getUser()->getEmail() != $request['email']) {
if (\thebuggenie\core\framework\Event::createNew('core', 'changeEmail', $this->getUser(), array('email' => $request['email']))->triggerUntilProcessed()->isProcessed() == false) {
$this->getUser()->setEmail($request['email']);
}
}
$this->getUser()->save();
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile information saved')));
break;
case 'settings':
$this->getUser()->setPreferredWikiSyntax($request['syntax_articles']);
$this->getUser()->setPreferredIssuesSyntax($request['syntax_issues']);
$this->getUser()->setPreferredCommentsSyntax($request['syntax_comments']);
$this->getUser()->setKeyboardNavigationEnabled($request['enable_keyboard_navigation']);
foreach ($notificationsettings as $setting => $description) {
if ($request->hasParameter('core_' . $setting)) {
$this->getUser()->setNotificationSetting($setting, true)->save();
} else {
$this->getUser()->setNotificationSetting($setting, false)->save();
}
}
\thebuggenie\core\framework\Event::createNew('core', 'mainActions::myAccount::saveNotificationSettings')->trigger(compact('request'));
$this->getUser()->save();
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Profile settings saved')));
break;
case 'module':
foreach (framework\Context::getModules() as $module_name => $module) {
if ($request['target_module'] == $module_name && $module->hasAccountSettings()) {
if ($module->postAccountSettings($request)) {
return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Settings saved')));
} else {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('An error occured')));
}
}
}
break;
}
}
$this->rnd_no = rand();
$this->languages = framework\I18n::getLanguages();
$this->timezones = framework\I18n::getTimezones();
$this->error = framework\Context::getMessageAndClear('error');
$this->username_chosen = framework\Context::getMessageAndClear('username_chosen');
$this->openid_used = framework\Context::getMessageAndClear('openid_used');
$this->rsskey_generated = framework\Context::getMessageAndClear('rsskey_generated');
$this->selected_tab = 'profile';
if ($this->rsskey_generated) {
$this->selected_tab = 'security';
}
}