本文整理汇总了PHP中input::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP input::instance方法的具体用法?PHP input::instance怎么用?PHP input::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类input
的用法示例。
在下文中一共展示了input::instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preValidate
public function preValidate(Doctrine_Event $event)
{
$user = input::instance()->post('user', array());
$record =& $event->getInvoker();
$errorStack = $this->getErrorStack();
$validation = Bluebox_Controller::$validation;
if (!isset($user['username']) and isset($user['email_address'])) {
$record['username'] = $user['email_address'];
}
if (!empty($user['create_password'])) {
$record['password'] = $user['create_password'];
}
if (Router::$method == 'create') {
if (empty($user['create_password'])) {
$validation->add_error('user[create_password]', 'Please provide a password');
$errorStack->add('password', 'notblank');
}
if (empty($user['confirm_password'])) {
$validation->add_error('user[confirm_password]', 'Please confirm your password');
$errorStack->add('password', 'noconfirm');
}
if ($user['confirm_password'] !== $user['create_password']) {
$validation->add_error('user[confirm_password]', 'Password does not match');
$errorStack->add('password', 'nomatch');
}
} else {
if (!empty($user['create_password'])) {
if (empty($user['confirm_password'])) {
$validation->add_error('user[confirm_password]', 'Please confirm your password');
$errorStack->add('password', 'noconfirm');
}
if ($user['confirm_password'] !== $user['create_password']) {
$validation->add_error('user[confirm_password]', 'Password does not match');
$errorStack->add('password', 'nomatch');
}
}
}
$enforce = Kohana::config('core.pwd_complexity');
if (empty($enforce) || empty($user['create_password'])) {
return TRUE;
}
// at least one digit
if (!preg_match('/[0-9]{1,}/', $user['create_password'])) {
$validation->add_error('user[create_password]', 'Password must contain digits and letters');
$errorStack->add('password', 'nocomplexity');
}
// at least one character
if (!preg_match('/[A-Za-z]{1,}/', $user['create_password'])) {
$validation->add_error('user[create_password]', 'Password must contain digits and letters');
$errorStack->add('password', 'nocomplexity');
}
}
示例2: remove_from_query_string
public static function remove_from_query_string($param)
{
$parameters = input::instance()->get();
unset($parameters[$param]);
return url::base() . url::current() . '?' . http_build_query($parameters);
}