本文整理匯總了PHP中app::strip_tags方法的典型用法代碼示例。如果您正苦於以下問題:PHP app::strip_tags方法的具體用法?PHP app::strip_tags怎麽用?PHP app::strip_tags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app
的用法示例。
在下文中一共展示了app::strip_tags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setValues
public static function setValues($fields, $bind_id, $bind_type, $sf_user, $request)
{
$extra_fields = ExtraFieldsList::getFieldsByType($bind_type, $sf_user, false, array('all' => true));
foreach ($extra_fields as $ef) {
//escape view only fields
if (in_array($sf_user->getAttribute('users_group_id'), explode(',', $ef['view_only_access']))) {
continue;
}
if (isset($fields[$ef['id']])) {
$v = $fields[$ef['id']];
} else {
$v = '';
}
$v = app::strip_tags($v);
if ($ef['type'] == 'file') {
$files = $request->getFiles();
if ($extra_fields_files_delete = $request->getParameter('extra_fields_files_delete')) {
if (isset($extra_fields_files_delete[$ef['id']])) {
if ($a = Doctrine_Core::getTable('Attachments')->find($extra_fields_files_delete[$ef['id']])) {
if (is_file($file_path = sfConfig::get('sf_upload_dir') . '/attachments/' . $a->getFile())) {
unlink($file_path);
}
$a->delete();
}
}
}
if ($extra_fields_files = $request->getParameter('extra_fields_files')) {
if (isset($extra_fields_files[$ef['id']])) {
$v = $extra_fields_files[$ef['id']];
}
}
if (strlen($files['extra_fields'][$ef['id']]['name']) > 0) {
if ($v > 0) {
if ($a = Doctrine_Core::getTable('Attachments')->find($v)) {
if (is_file($file_path = sfConfig::get('sf_upload_dir') . '/attachments/' . $a->getFile())) {
unlink($file_path);
}
$a->delete();
}
}
$file = $files['extra_fields'][$ef['id']];
$filename = rand(111111, 999999) . '-' . $file['name'];
move_uploaded_file($file['tmp_name'], sfConfig::get('sf_upload_dir') . '/attachments/' . $filename);
$a = new Attachments();
$a->setFile($filename);
$a->setBindType('extra_fields');
$a->setBindId($ef['id']);
$a->save();
$v = $a->getId();
}
} elseif ($ef['type'] == 'date_dropdown') {
$v = implode('-', $v);
} elseif ($ef['type'] == 'date_range') {
$v = implode('|', $v);
} elseif ($ef['type'] == 'checkbox' and is_array($v)) {
$v = implode("\n", $v);
} elseif (is_array($v)) {
$v = implode(',', $v);
}
$f = Doctrine_Core::getTable('ExtraFieldsList')->createQuery()->addWhere('bind_id=?', $bind_id)->addWhere('extra_fields_id=?', $ef['id'])->fetchOne();
if ($f) {
$f->setValue($v);
$f->save();
} else {
$f = new ExtraFieldsList();
$f->setBindId($bind_id);
$f->setExtraFieldsId($ef['id']);
$f->setValue($v);
$f->save();
}
}
}
示例2: updateObject
/**
* Updates the values of the object with the cleaned up values.
*
* @param array $values An array of values
*
* @return mixed The current updated object
*/
public function updateObject($values = null)
{
if (null === $values) {
$values = $this->values;
}
$values = $this->processValues($values);
//strip tags
foreach ($values as $k => $v) {
$values[$k] = app::strip_tags($v);
}
$this->doUpdateObject($values);
// embedded forms
$this->updateObjectEmbeddedForms($values);
return $this->getObject();
}