本文整理匯總了PHP中Floxim\Floxim\System\Fx::lang方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fx::lang方法的具體用法?PHP Fx::lang怎麽用?PHP Fx::lang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::lang方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAuthForm
public function getAuthForm()
{
//$form = new \Floxim\Form\Form(array('id' => 'auth_form'));
$form = fx::data('floxim.form.form')->create();
$form->addFields(array('email' => array('label' => 'E-mail', 'validators' => 'email -l'), 'password' => array('type' => 'password', 'label' => fx::lang('Password')), 'remember' => array('type' => 'checkbox', 'label' => fx::lang('Remember me')), 'submit' => array('type' => 'submit', 'label' => fx::lang('Log in'))));
return $form;
}
示例2: validate
public function validate()
{
$fields = $this->getComponent()->getAllFields();
foreach ($fields as $f) {
if ($f['is_required'] && !$this[$f['keyword']]) {
$this->invalid($f['name'] . ': ' . fx::lang('This field is required'), $f['keyword']);
}
}
return parent::validate();
}
示例3: doRecoverForm
public function doRecoverForm()
{
//$form = new \Floxim\Form\Form();
$form = fx::data('floxim.form.form')->generate();
$form->addFields(array('email' => array('label' => 'E-mail', 'validators' => 'email -l', 'value' => $this->getParam('email')), 'submit' => array('type' => 'submit', 'label' => fx::lang('Send me new password'))));
if ($form->isSent() && !$form->hasErrors()) {
$user = fx::data('floxim.user.user')->getByLogin($form->email);
if (!$user) {
$form->addError(fx::lang('User not found'), 'email');
} else {
$password = $user->generatePassword();
$user['password'] = $password;
$user->save();
fx::data('session')->where('user_id', $user['id'])->delete();
$mailer = fx::mail();
$res = $mailer->to($form->email)->data('floxim.user.user', $user)->data('password', $password)->data('site', fx::env('site'))->template('user.password_recover')->send();
if ($res) {
$form->addMessage('New password is sent to ' . $form->email);
}
}
}
return array('form' => $form);
}