本文整理汇总了PHP中iaUtil::safeHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUtil::safeHTML方法的具体用法?PHP iaUtil::safeHTML怎么用?PHP iaUtil::safeHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaUtil
的用法示例。
在下文中一共展示了iaUtil::safeHTML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsePost
//.........这里部分代码省略.........
$iaCore->factory('util');
iaUtil::loadUTF8Functions('validation', 'bad');
foreach ($activeFields as $fieldName => $field) {
isset($data[$fieldName]) || ($data[$fieldName] = '');
// Check the UTF-8 is well formed
if (!is_array($data[$fieldName]) && !utf8_is_valid($data[$fieldName])) {
$data[$fieldName] = utf8_bad_replace($data[$fieldName]);
}
if ($field['extra_actions']) {
if (false === eval($field['extra_actions'])) {
continue;
// make possible to stop further processing of this field by returning FALSE
}
}
if (in_array($field['type'], array(self::TEXT, self::TEXTAREA, self::NUMBER, self::RADIO, self::CHECKBOX, self::COMBO))) {
if ($field['required']) {
if ($field['required_checks']) {
eval($field['required_checks']);
}
if (empty($data[$fieldName])) {
$error = true;
$messages[] = in_array($field['type'], array(self::RADIO, self::CHECKBOX, self::COMBO)) ? iaLanguage::getf('field_is_not_selected', array('field' => iaLanguage::get('field_' . $fieldName))) : iaLanguage::getf('field_is_empty', array('field' => iaLanguage::get('field_' . $fieldName)));
$invalidFields[] = $fieldName;
}
}
switch ($field['type']) {
case self::NUMBER:
$item[$fieldName] = (double) str_replace(' ', '', $data[$fieldName]);
break;
case self::TEXT:
$item[$fieldName] = iaSanitize::tags($data[$fieldName]);
break;
case self::TEXTAREA:
$item[$fieldName] = $field['use_editor'] ? iaUtil::safeHTML($data[$fieldName]) : iaSanitize::tags($data[$fieldName]);
break;
default:
$item[$fieldName] = is_array($data[$fieldName]) ? implode(',', $data[$fieldName]) : $data[$fieldName];
}
} elseif (self::DATE == $field['type']) {
if ($field['required'] && $field['required_checks']) {
eval($field['required_checks']);
} elseif ($field['required'] && empty($data[$fieldName])) {
$error = true;
$messages[] = iaLanguage::getf('field_is_empty', array('field' => iaLanguage::get('field_' . $fieldName)));
$invalidFields[] = $fieldName;
}
$data[$fieldName] = trim($data[$fieldName]);
if (empty($data[$fieldName])) {
$item[$fieldName] = $field['allow_null'] ? null : '';
} else {
if (strpos($data[$fieldName], ' ') === false) {
$date = $data[$fieldName];
$time = false;
} else {
list($date, $time) = explode(' ', $data[$fieldName]);
}
// FIXME: fucking shit
$array = explode('-', $date);
$year = (int) $array[0];
$month = max(1, (int) $array[1]);
$day = max(1, (int) $array[2]);
$year = strlen($year) == 4 ? $year : 2000;
$month = strlen($month) < 2 ? '0' . $month : $month;
$day = strlen($day) < 2 ? '0' . $day : $day;
$item[$fieldName] = $year . '-' . $month . '-' . $day;
if ($field['timepicker'] && $time) {