本文整理汇总了PHP中flexicontent_html::arrayTrim方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::arrayTrim方法的具体用法?PHP flexicontent_html::arrayTrim怎么用?PHP flexicontent_html::arrayTrim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::arrayTrim方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsevalues
function parsevalues(&$conf, &$parse_log, &$task)
{
$colcount = count($conf['columns']);
$conf['contents_parsed'] = array();
foreach ($conf['contents'] as $lineno => $fields) {
if (count($fields) > $colcount) {
$msg = "Redundadant columns at record row " . $lineno . ", Found # columns: " . count($fields) . " > expected: " . $colcount;
JLog::add($msg);
if ($task == 'testcsv') {
$parse_log .= $msg;
}
}
// Handle each field of the item
//$conf['contents_parsed'][$lineno] = array();
// Prepare request variable used by the item's Model
$data = array();
foreach ($fields as $col_no => $field_data) {
if ($col_no >= $colcount) {
break;
}
$fieldname = $conf['columns'][$col_no];
if (isset($conf['core_props'][$fieldname])) {
$field_values = trim($field_data);
} else {
// Split multi-value field
$vals = strlen($field_data) ? preg_split("/[\\s]*" . $conf['mval_separator'] . "[\\s]*/", $field_data) : array();
$vals = flexicontent_html::arrayTrim($vals);
// Handle each value of the field
$field_values = array();
foreach ($vals as $i => $val) {
// Split multiple property fields
$props = strlen($val) ? preg_split("/[\\s]*" . $conf['mprop_separator'] . "[\\s]*/", $val) : array();
$props = flexicontent_html::arrayTrim($props);
unset($prop_arr);
// Handle each property of the value
foreach ($props as $j => $prop) {
if (preg_match('/\\[-(.*)-\\]=(.*)/', $prop, $matches)) {
$prop_arr[$matches[1]] = $matches[2];
}
}
$field_values[] = isset($prop_arr) ? $prop_arr : $val;
}
}
//$conf['contents_parsed'][$lineno][$fieldname] = $field_values;
// Assign array of field values to the item data row
if ($fieldname == 'id') {
if ($conf['id_col']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'title' || $fieldname == 'text' || $fieldname == 'alias') {
$data[$fieldname] = $field_values;
} else {
if ($fieldname == 'language') {
if (!$conf['language']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'state') {
if (!strlen($conf['state'])) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'access') {
if ($conf['access'] === 0) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'catid') {
if ($conf['maincat_col']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'cid') {
if ($conf['seccats_col']) {
$data[$fieldname] = preg_split("/[\\s]*,[\\s]*/", $field_values);
}
} else {
if ($fieldname == 'tags_names' || $fieldname == 'tags_raw') {
$data[$fieldname] = $field_values;
// *** TODO more during insertion ... check tags exist and create missing
} else {
if ($fieldname == 'created') {
if ($conf['created_col']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'created_by') {
if ($conf['created_by_col']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'modified') {
if ($conf['modified_col']) {
$data[$fieldname] = $field_values;
}
} else {
if ($fieldname == 'modified_by') {
if ($conf['modified_by_col']) {
$data[$fieldname] = $field_values;
//.........这里部分代码省略.........