当前位置: 首页>>代码示例>>PHP>>正文


PHP flexicontent_html::arrayTrim方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:import.php


注:本文中的flexicontent_html::arrayTrim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。