本文整理汇总了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();
}