本文整理汇总了PHP中sfForm::getTaintedValues方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::getTaintedValues方法的具体用法?PHP sfForm::getTaintedValues怎么用?PHP sfForm::getTaintedValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfForm
的用法示例。
在下文中一共展示了sfForm::getTaintedValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$auth_key = $this->getUser()->getApiAuthKey();
// Update existing item.
$values = $form->getTaintedValues();
$user_id = $form->getValue('id') ? $form->getValue('id') : $this->getUser()->getApiUserId();
unset($values['_csrf_token'], $values['is_active'], $values['password'], $values['password_again'], $values['groups_list'], $values['permissions_list'], $values['is_validated'], $values['reddit_validation_key'], $values['is_authorized'], $values['email_authorization_key'], $values['authorized_at'], $values['is_super_admin'], $values['algorithm'], $values['id'], $values['salt'], $values['last_login']);
if ($form->getValue('password')) {
$values['password'] = $form->getValue('password');
}
$user_data = Api::getInstance()->get('user/' . $user_id);
$user = ApiDoctrine::createObject('sfGuardUser', $user_data['body']);
$user_values = $user->toArray();
foreach ($values as $key => $value) {
if ($value == $user_values[$key]) {
unset($values[$key]);
}
}
if (array_key_exists('id', $values)) {
unset($values['id']);
}
$id = $this->getUser()->getApiUserId();
$result = Api::getInstance()->setUser($auth_key)->put('user/' . $id, $values);
$success = $this->checkHttpCode($result, 'put', 'user/' . $id, json_encode($values));
if ($success) {
$this->getUser()->setFlash('notice', 'Profile was edited successfully.');
}
$this->redirect('profile');
}
}
示例2: makeErrorMess
/**
* Make error messge
*
* Display incoming data and errors list
*
* @param sfForm $form
* @param string $message
*/
protected function makeErrorMess(sfForm $form, $message)
{
return sprintf("%s\n\nErrors: %s\n\nInput:\n%s", $message, $form->getErrorSchema(), var_export($form->getTaintedValues(), true));
}