本文整理汇总了PHP中l10n::S方法的典型用法代码示例。如果您正苦于以下问题:PHP l10n::S方法的具体用法?PHP l10n::S怎么用?PHP l10n::S使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类l10n
的用法示例。
在下文中一共展示了l10n::S方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Fire
public function Fire()
{
if ($this->input->do == 'submit') {
$bug = new Bug($this->input->bug_id);
try {
$bug->FetchInto();
} catch (phalanx\data\ModelException $e) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND')));
return;
}
$body = trim($this->input->body);
if (empty($body)) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('COMMENT_MISSING_BODY')));
return;
}
$comment = new Comment();
$comment->bug_id = $bug_id;
$comment->post_user_id = Bugdar::$auth->current_user();
$comment->post_date = time();
$comment->body = $body;
$comment->Insert();
$this->comment_id = $comment->comment_id;
$search = new SearchEngine();
$search->IndexBug($bug);
EventPump::Pump()->PostEvent(new StandardSuccessEvent('view_bug/' . $bug_id, l10n::S('USER_REGISTER_SUCCESS')));
}
}
示例2: Fire
public function Fire()
{
if ($this->input->do == 'submit') {
if (!filter_var($this->input->email, FILTER_VALIDATE_EMAIL)) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('INVALID_EMAIL')));
return;
}
if (strlen($this->input->password) <= 4) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('PASSWORD_TOO_SHORT')));
return;
}
$stmt = Bugdar::$db->Prepare("SELECT COUNT(*) AS count FROM users WHERE email = ?");
$stmt->Execute(array($this->input->email));
if ($stmt->FetchObject()->count > 0) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('EMAIL_IN_USE')));
return;
}
$alias = preg_replace('/[^a-zA-Z0-9\\-_,\\. ]/', '', $this->input->alias);
$salt = phalanx\base\Random(10);
$user = new User();
$user->email = $this->input->email;
$user->alias = preg_replace('/[^a-zA-Z0-9\\-_,\\. ]/', '', $this->input->alias);
$user->password = sha1($this->input->password);
$user->usergroup_id = Usergroup::ROLE_REGISTERED;
$user->Insert();
$this->user_id = $user->user_id;
EventPump::Pump()->PostEvent(new StandardSuccessEvent('login', l10n::S('USER_REGISTER_SUCCESS')));
}
}
示例3: Fire
public function Fire()
{
$stmt = Bugdar::$db->Prepare("SELECT * FROM " . TABLE_PREFIX . "users WHERE user_id = :id OR alias = :id");
$stmt->Execute(array('id' => $this->input->_id));
if (!($this->user = $stmt->FetchObject())) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('INVALID_USER')));
}
}
示例4: Fire
public function Fire()
{
$bug = new Bug($this->input->_id);
try {
$bug->FetchInto();
} catch (\phalanx\data\ModelException $e) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND')));
return;
}
$this->bug = $bug;
$this->bug_reporter = $bug->FetchReporter();
$this->attributes = $bug->FetchAttributes();
$this->comments = $bug->FetchComments();
}
示例5: Fire
public function Fire()
{
if ($this->input->do == 'fire') {
$user = new User();
$user->set_condition('email = :email');
$user->email = $this->input->email;
try {
$user = $user->Fetch();
} catch (phalanx\data\ModelException $e) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('LOGIN_FAILED')));
return;
}
if ($user->password != md5(sha1($this->input->password) . $user->salt)) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('LOGIN_FAILED')));
return;
}
// We need to set _COOKIE values so that if the last_event requires
// authentication, we can return the correct state.
$expires = time() + 60 * 60 * 5;
$this->_SetCookie('bugdar_user', $user->user_id, $expires);
$this->_SetCookie('bugdar_pass', $user->authkey, $expires);
$last_event = NULL;
if ($this->input->last_event) {
$last_event = unserialize(base64_decode($this->input->last_event));
$class = $last_event[0];
$input = $last_event[1];
if (!class_exists($class)) {
$path = phalanx\base\CamelCaseToUnderscore($class);
$path = preg_replace('/_event$/', '', $path);
require_once BUGDAR_ROOT . "/events/{$path}.php";
}
$last_event = new $class($input);
}
$this->successful = TRUE;
EventPump::Pump()->PostEvent($last_event ?: new StandardSuccessEvent('home', l10n::S('LOGIN_SUCCESSFUL')));
return;
}
// Find the first non-UserLoginEvent that was processed. If the event
// hasn't been finished, then this event preempted it and we should
// store its data so that the user can return to what she was doing.
$events = EventPump::Pump()->GetAllEvents();
foreach ($events as $event) {
if (!$event instanceof $this && $event->state() != EventPump::EVENT_FINISHED) {
$this->last_event = base64_encode(serialize(array(get_class($event), $event->input)));
break;
}
}
}
示例6: Fire
public function Fire()
{
// If an ID was passed, try updating the record.
if ($this->input->_id) {
try {
$this->usergroup = new Usergroup($this->input->_id);
$this->usergroup->FetchInto();
} catch (\phalanx\data\ModelException $e) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('ERROR_INVALID_ID')));
return;
}
} else {
// Otherwise, create a new one.
$this->usergroup = new Usergroup();
}
if ($this->input->_method == 'POST') {
$title = \phalanx\data\Cleaner::HTML($this->input->title);
if (empty($title)) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent('The title field is required.'));
return;
}
$this->usergroup->title = $title;
if (!empty($this->input->display_title)) {
$this->usergroup->display_title = \phalanx\data\Cleaner::HTML($this->input->display_title);
}
$mask = 0;
foreach ($this->input->permissions as $name => $bit) {
$mask += $bit * Usergroup::$permissions[$name];
}
$this->usergroup->mask = $mask;
// Save the actual record.
if ($this->input->_id) {
$this->usergroup->Update();
} else {
$this->usergroup->Insert();
}
}
}
示例7: Fire
public function Fire()
{
$do_insert = $this->input->action == 'insert';
$do_update = $this->input->action == 'update';
if ($this->input->_method != 'POST') {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent('Request must be POSTed'));
return;
}
// Create an empty Model object if creating a new bug, or fetch the data of
// an existing bug to update.
if ($do_insert) {
$bug = new Bug();
} else {
if ($do_update) {
$bug = new Bug($this->input->bug_id);
try {
$bug->FetchInto();
} catch (\phalanx\data\ModelException $e) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND')));
return;
}
} else {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent('Invalid bug operation'));
return;
}
}
$this->action = $this->input->action;
$user = Bugdar::$auth->current_user();
$title = trim($this->input->title);
if (empty($title) && $do_insert) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_MISSING_TITLE')));
return;
}
Bugdar::$db->BeginTransaction();
$now = time();
if (!empty($title)) {
$bug->title = $title;
}
if ($do_insert) {
$bug->reporting_user_id = $user->user_id;
$bug->reporting_date = $now;
$bug->Insert();
} else {
if ($do_update) {
$bug->Update();
}
}
// Now set the bug_id output value, which will be set after a call to
// Insert(). Updated bugs will have this set from FetchInto().
$this->bug_id = $bug->bug_id;
// Add a comment if one is present.
$body = trim($this->input->comment_body);
if (!empty($body) || $do_insert) {
if ($do_insert && empty($body)) {
EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('COMMENT_MISSING_BODY')));
return;
}
$comment = new Comment();
$comment->bug_id = $this->bug_id;
$comment->post_user_id = $user->user_id;
$comment->post_date = $now;
$comment->body = $body;
$comment->Insert();
$this->comment_id = $comment->comment_id;
// Update the bug so it can find that first comment easiliy.
if ($do_insert) {
$bug = new Bug($bug->bug_id);
$bug->first_comment_id = $comment->comment_id;
$bug->Update();
$bug->FetchInto();
}
}
// Handle tags.
if (is_array($this->input->tags_new)) {
foreach ($this->input->tags_new as $tag) {
$bug->SetAttribute('', $tag);
}
}
if (is_array($this->input->tags_deleted)) {
foreach ($this->input->tags_deleted as $tag) {
$bug->RemoveAttribute($tag, TRUE);
}
}
// Create a map of all the set attributes.
$set_attributes = array();
if (is_array($this->input->attributes)) {
foreach ($this->input->attributes as $attr) {
// If this is an empty attribute, ignore it.
if (empty($attr['title']) || empty($attr['value'])) {
continue;
}
$set_attributes[$attr['title']] = $attr['value'];
}
// Get all potential attributes; this includes defined tags.
$attributes = Attribute::FetchGroup();
foreach ($attributes as $attr) {
// If the user is allowed to write to this attribute, update the
// value.
if ($attr->is_attribute() && $attr->CheckAccess($user, $bug) & Attribute::ACCESS_WRITE) {
// If there is no value for this attribute, then it was removed.
//.........这里部分代码省略.........
示例8: Fire
public function Fire()
{
Bugdar::$auth->Logout();
EventPump::Pump()->PostEvent(new StandardSuccessEvent('home', l10n::S('LOGOUT_SUCCESS')));
}