Index: import_export.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/import_export/import_export.module,v
retrieving revision 1.4
diff -u -r1.4 import_export.module
--- import_export.module	4 Sep 2005 23:10:46 -0000	1.4
+++ import_export.module	28 Mar 2006 04:35:08 -0000
@@ -8,33 +8,33 @@
 function import_export_menu($may_cache) {
   if ($may_cache) {
     $items[] = array('path' => 'import',
-              'title' => t('import/export'),
-              'callback' => 'import_export_page',
+      'title' => t('import/export'),
+      'callback' => 'import_export_page',
       'access' => user_access('access import_export'),
       'type' => MENU_NORMAL_ITEM);
-    $items[] = array('path' => 'import/cvs/export',
-              'title' => t('CVS export'),
-              'callback' => 'import_export_page_cvs_export',
+    $items[] = array('path' => 'import/csv/export',
+      'title' => t('CSV export'),
+      'callback' => 'import_export_page_csv_export',
       'access' => user_access('access import_export'),
       'type' => MENU_CALLBACK);
     $items[] = array('path' => 'import/xml',
-              'title' => t('XML import/export'),
-              'callback' => 'import_export_page_xml',
+      'title' => t('XML import/export'),
+      'callback' => 'import_export_page_xml',
       'access' => user_access('access import_export'),
       'type' => MENU_CALLBACK);
     $items[] = array('path' => 'import/xml/vocabulary',
-              'title' => t('XML export (vocabulary)'),
-              'callback' => 'import_export_page_xml_vocabulary',
+      'title' => t('XML export (vocabulary)'),
+      'callback' => 'import_export_page_xml_vocabulary',
       'access' => user_access('access import_export'),
       'type' => MENU_CALLBACK);
     $items[] = array('path' => 'import/xml/book',
-              'title' => t('XML export (book)'),
-              'callback' => 'import_export_page_xml_book',
+      'title' => t('XML export (book)'),
+      'callback' => 'import_export_page_xml_book',
       'access' => user_access('access import_export'),
       'type' => MENU_CALLBACK);
-    $items[] = array('path' => 'import/cvs/import',
-              'title' => t('CVS import'),
-              'callback' => 'import_export_page_cvs_import',
+    $items[] = array('path' => 'import/csv/import',
+      'title' => t('csv import'),
+      'callback' => 'import_export_page_csv_import',
       'access' => user_access('access import_export'),
       'type' => MENU_CALLBACK);
   }
@@ -61,19 +61,19 @@
 
 function import_export_page() {
 
-  $types = node_invoke_nodeapi($node/*dummy*/, 'import_export', 'types', IMPORT_EXPORT_CVS);
+  $types = node_invoke_nodeapi($node/*dummy*/, 'import_export', 'types', IMPORT_EXPORT_CSV);
   asort($types);
   if (count($types)) {
     $group = form_select(t('Node type'), 'node_type', -1,  $types, t('Node type to export'), 0, false, true);
     $group .= form_submit(t('Next'));
-    $group  = form($group, 'post', '?q=import/cvs/export');
-    $output .= form_group(t('CVS export'), $group);
+    $group  = form($group, 'post', '?q=import/csv/export');
+    $output .= form_group(t('CSV export'), $group);
 
-    $group  = l(t('Import from CVS file'), 'import/cvs/import');
-    $output .= form_group(t('CVS import'), $group);
+    $group  = l(t('Import from CSV file'), 'import/csv/import');
+    $output .= form_group(t('CSV import'), $group);
   }
   else {
-    $output .= t('CVS import/export not supported by any module').'<br /><br>';
+    $output .= t('CSV import/export not supported by any module').'<br /><br>';
   }
 
   if (module_exist('taxonomy')) {
@@ -145,14 +145,14 @@
 }
 
 /**
- * Implementation of CVS export page
+ * Implementation of CSV export page
  */
 
-function import_export_page_cvs_export() {
+function import_export_page_csv_export() {
   $output = '';
   $node = new StdClass();
   $node->type = $_POST['edit']['node_type'];
-  _import_export_prepare_fields($node, IMPORT_EXPORT_CVS);
+  _import_export_prepare_fields($node, IMPORT_EXPORT_CSV);
 
   $arr = array();
   foreach ($node->import_export_fields as $key=>$f) {
@@ -173,21 +173,21 @@
       }
     }
     $group .= form_select(t('Fields'), 'fields', $_POST['edit']['fields'], $arr, t('Fields to export'), 0, true, true);
-    Unset($arr);
-    $group .= form_textfield(t('Max.field length'), 'maxlen', $_POST['edit']['maxlen'], 5, 5, t('Max.length of a CVS field'));
+    unset($arr);
+    $group .= form_textfield(t('Max.field length'), 'maxlen', $_POST['edit']['maxlen'], 5, 5, t('Max.length of a CSV field'));
 
     $group .= form_hidden('node_type', $_POST['edit']['node_type']);
-    $group .= form_submit(t('Export'), 'op_cvs[export]');
-    $group .= form_submit(t('Friendly export'), 'op_cvs[friendly]');
+    $group .= form_submit(t('Export'), 'op_csv[export]');
+    $group .= form_submit(t('Friendly export'), 'op_csv[friendly]');
     $group  = form($group, 'post', 0);
     $output .= form_group('', $group);
 
   }
   $out = '';
-  if ($_POST['op_cvs'] && !Count($_POST['edit']['fields'])) {
+  if ($_POST['op_csv'] && !Count($_POST['edit']['fields'])) {
     $output .= t('No fields selected');
   }
-  else if ($_POST['op_cvs']) {
+  else if ($_POST['op_csv']) {
 
     foreach ($node->import_export_fields as $fid=>$fld) {
       if (!In_Array($fid, $_POST['edit']['fields'])) {
@@ -201,9 +201,9 @@
       $nodeids[] = $rec['nid'];
     }
 
-    $n = _import_export_prepare_cvs($nodeids, $node->import_export_fields, $_POST['edit']['maxlen'], $out);
-    Unset($nodeids);
-    Unset($node->import_export_fields);
+    $n = _import_export_prepare_csv($nodeids, $node->import_export_fields, $_POST['edit']['maxlen'], $out);
+    unset($nodeids);
+    unset($node->import_export_fields);
     $output .= "<pre>\n";
     if ($n >= 0) {
       $output .= sprintf(t('%d exported record(s)'), $n)."\n\n";
@@ -211,7 +211,7 @@
     $output .= "</pre>\n";
   }
 
-  _import_export_print($output, $out, $_POST['op_cvs']['friendly'], 'text/plain', 'export.txt');
+  _import_export_print($output, $out, $_POST['op_csv']['friendly'], 'text/plain', 'export.txt');
 }
 
 /**
@@ -241,7 +241,7 @@
   if ($_POST['op_file']['delete']) {
     if ($file) {
       file_delete($file->filepath);
-      Unset($file);
+      unset($file);
     }
   }
 
@@ -276,7 +276,7 @@
 
   if ($_POST['op_xml']['export']) {
     $nid = array();
-    $arr = Explode("\n", $_POST['edit']['xml_nid']);
+    $arr = explode("\n", $_POST['edit']['xml_nid']);
     foreach ($arr as $s) {
       if ((integer) $s > 0) {
         $nid[] = (integer) $s;
@@ -378,27 +378,27 @@
 }
 
 /**
- * Implementation of common CVS import page
+ * Implementation of common CSV import page
  */
 
-function import_export_page_cvs_import() {
+function import_export_page_csv_import() {
   $output = '';
 
-  $group  = form_textarea(t('CVS data'), 'cvs_data', $_POST['edit']['cvs_data'], 80, 10, t('CVS data to be imported, first raw is header containing field names (TAB/\'|\'..field delimiter, CR/LF..record delimiter, \':\'..array delimiter).'));
+  $group  = form_textarea(t('CSV data'), 'csv_data', $_POST['edit']['csv_data'], 80, 10, t('CSV data to be imported, first raw is header containing field names (TAB/\'|\'..field delimiter, CR/LF..record delimiter, \':\'..array delimiter).'));
   $group .= _import_export_form_radios_action();
-  $types = node_invoke_nodeapi($node, 'import_export', 'types', IMPORT_EXPORT_CVS);
+  $types = node_invoke_nodeapi($node, 'import_export', 'types', IMPORT_EXPORT_CSV);
   asort($types);
   $types = array_merge(array(''=>'<'.t('none').'>'), $types);
-  $group .= form_select(t('Node type'), 'def_type', $_POST['edit']['def_type'], $types, t('Default node type used unless specified in CVS field'), 0, false, true);
-  $group .= form_submit(t('Preview'), 'op_cvs[preview]');
-  $group .= form_submit(t('Process'), 'op_cvs[import]');
+  $group .= form_select(t('Node type'), 'def_type', $_POST['edit']['def_type'], $types, t('Default node type used unless specified in CSV field'), 0, false, true);
+  $group .= form_submit(t('Preview'), 'op_csv[preview]');
+  $group .= form_submit(t('Process'), 'op_csv[import]');
   $group  = form($group, 'post', 0);
 
   $output .= form_group(t('Import'), $group);
 
 
-  if ($_POST['op_cvs']) {
-    _import_export_parse_cvs($_POST['edit']['cvs_data'], $_POST['op_cvs']['preview'], _import_export_form_radio2text(), $_POST['edit']['def_type'], $out, $cnt, $cnt1);
+  if ($_POST['op_csv']) {
+    _import_export_parse_csv($_POST['edit']['csv_data'], $_POST['op_csv']['preview'], _import_export_form_radio2text(), $_POST['edit']['def_type'], $out, $cnt, $cnt1);
     $output .= "<pre>\n";
     $output .= sprintf(t('Processed %d of %d line(s)'), $cnt1, $cnt)."\n</pre><pre>\n".$out.'</pre>';
   }
@@ -406,10 +406,10 @@
   print theme('page', $output);
 }
 
-// CVS delimiter definitions
-define('CVS_FIELD_DELIM', '|');
-define('CVS_RECORD_DELIM', "\r\n");
-define('CVS_ARRAY_DELIM', ':');
+// CSV delimiter definitions
+define('CSV_FIELD_DELIM', '|');
+define('CSV_RECORD_DELIM', "\r\n");
+define('CSV_ARRAY_DELIM', ':');
 
 function _import_export_node2str(&$node, $fid, $fld, &$data) {
 
@@ -417,7 +417,7 @@
     $fid = $fld['node_property'];
   }
   eval('$data = $node->'.$fid.';');
-  return IsSet($data);
+  return isset($data);
 }
 
 function _import_export_str2node(&$node, $fid, $fld, $data) {
@@ -428,7 +428,7 @@
 }
 
 /**
- * Export node data in CVS format
+ * Export node data in CSV format
  * @param $node
  *   array od nids
  *
@@ -439,7 +439,7 @@
  *   max. length of exported fields, leave blank or null to unlimited length
  *
  * @param $output
- *   exported CVS data
+ *   exported CSV data
  *
  * @param field_delimiter
  *   char delimiting fields
@@ -448,7 +448,7 @@
  *   number of exported lines, -1..error
  */
 
-function _import_export_prepare_cvs($nodeids, $fields, $maxlen, &$output, $field_delimiter = CVS_FIELD_DELIM) {
+function _import_export_prepare_csv($nodeids, $fields, $maxlen, &$output, $field_delimiter = CSV_FIELD_DELIM) {
   $cnt = 0;
   $output = '';
   if (count($fields) == 0) {
@@ -462,7 +462,7 @@
       $arr[] = $fld['name'];
     }
   }
-  $output .= Implode($arr, $field_delimiter).CVS_RECORD_DELIM;
+  $output .= Implode($arr, $field_delimiter).CSV_RECORD_DELIM;
 
   foreach ($nodeids as $nodeid) {
     $node = _import_export_node_load($nodeid);
@@ -494,7 +494,7 @@
                   break;
               }
             }
-            $s = Implode($arr, CVS_ARRAY_DELIM);
+            $s = Implode($arr, CSV_ARRAY_DELIM);
           }
           break;
         default:
@@ -504,12 +504,12 @@
           }
           break;
       }
-      $f_arr[] = preg_replace(array('/\\'.CVS_FIELD_DELIM.'/', '/\\\\/', "/\r\n/", "/\r/", "/\n/"),
+      $f_arr[] = preg_replace(array('/\\'.CSV_FIELD_DELIM.'/', '/\\\\/', "/\r\n/", "/\r/", "/\n/"),
                               array(' ',                       '\\\\',   '\\n',    '',     '\\n'),
                               $s);
     }
-    $output .= Implode($f_arr, CVS_FIELD_DELIM).CVS_RECORD_DELIM;
-    Unset($f_arr);
+    $output .= Implode($f_arr, CSV_FIELD_DELIM).CSV_RECORD_DELIM;
+    unset($f_arr);
     $cnt++;
   }
   return $cnt;
@@ -566,8 +566,8 @@
 
 function _import_export_node_load_check($action, $nid, $def_type, &$type, &$node, $mand_arr, &$fixups, &$output) {
 
-  if (IsSet($node)) {
-    Unset($node->nid);
+  if (isset($node)) {
+    unset($node->nid);
   }
   if (!$nid && ($action == 'delete' || $action == 'update')) {
     $output .= t('skip');
@@ -612,7 +612,7 @@
   }
 
   if ($type!='' && $node->type!=$type) {
-    $output .= t('CVS/node type does not match');
+    $output .= t('CSV/node type does not match');
     return false;
   }
   $node->_taxonomy = array();
@@ -675,7 +675,7 @@
   }
   else {
     if ($node->_import_export_mandatory_fields['xparent']!='') {
-      if (IsSet($fixups[$node->_import_export_mandatory_fields['xparent']])) {
+      if (isset($fixups[$node->_import_export_mandatory_fields['xparent']])) {
         $node->parent = $fixups[$node->_import_export_mandatory_fields['xparent']];
       }
     }
@@ -705,7 +705,7 @@
             $fixups[(string) $node->_import_export_mandatory_fields['xnid']] = $node->nid;
           }
           if (module_exist('book') && $node->type!='book') {
-            if (IsSet($node->parent)) {
+            if (isset($node->parent)) {
               book_insert($node);
             }
           }
@@ -776,7 +776,7 @@
  */
 
 function _import_export_node_add_taxonomy(&$node, $vid, $tid, $name) {
-  if (!Is_Array($node->_taxonomy[(string) $vid])) {
+  if (!is_array($node->_taxonomy[(string) $vid])) {
     $node->_taxonomy[(string) $vid] = array();
   }
 
@@ -811,8 +811,8 @@
 /**
  * Load current node (if exists) and check if $action can be processed
  *
- * @param $cvs_data
- *   raw CVS data
+ * @param $csv_data
+ *   raw CSV data
  *
  * @param $preview
  *   do not save changes, only write log
@@ -827,23 +827,23 @@
  *   text process log
  *
  * @param $num_lines
- *   counter of CVS data lines
+ *   counter of CSV data lines
  *
  * @param $num_proc
  *   counter of processed records/lines
  */
 
-function _import_export_parse_cvs($cvs_data, $preview, $action, $def_type, &$output, &$num_lines, &$num_proc) {
+function _import_export_parse_csv($csv_data, $preview, $action, $def_type, &$output, &$num_lines, &$num_proc) {
   $output = '';
   if ($preview) {
     $output .= '*** '.t('Preview mode, no data has been affected')." ***\n\n";
   }
-  $cvs_data = preg_replace(array("/\t/",          "/\r/", "/\n\n/"),
-                           array(CVS_FIELD_DELIM, "\n", "\n"),
-                           $cvs_data);
-  $rows = Explode("\n", $cvs_data);
-  Unset($cvs_data);
-  $flds = Explode(CVS_FIELD_DELIM, $rows[0]);
+  $csv_data = preg_replace(array("/\t/",          "/\r/", "/\n\n/"),
+                           array(CSV_FIELD_DELIM, "\n", "\n"),
+                           $csv_data);
+  $rows = explode("\n", $csv_data);
+  unset($csv_data);
+  $flds = explode(CSV_FIELD_DELIM, $rows[0]);
 
   $mandatory_idx = array();
   $mandatory_import_fields = _import_export_get_mandatory_import_fields();
@@ -858,18 +858,18 @@
 
   $fixups = _import_export_node_init_fixup();
   $num_lines = $num_proc = 0;
-  $supported_types = node_invoke_nodeapi($node/*dummy*/, 'import_export', 'types', IMPORT_EXPORT_CVS);
+  $supported_types = node_invoke_nodeapi($node/*dummy*/, 'import_export', 'types', IMPORT_EXPORT_CSV);
 
   for ($i=1; $i<Count($rows); $i++) {
     if ($rows[$i] != '') {
       $num_lines++;
       $output .= sprintf('#%d: ', $num_lines);
-      $rec = Explode(CVS_FIELD_DELIM, $rows[$i]);
-      Unset($node);
+      $rec = explode(CSV_FIELD_DELIM, $rows[$i]);
+      unset($node);
 
       $mand_arr = array();
       foreach ($mandatory_import_fields as $f) {
-        if (IsSet($mandatory_idx[$f])) {
+        if (isset($mandatory_idx[$f])) {
           $mand_arr[$f] = $rec[$mandatory_idx[$f]];
         }
       }
@@ -889,7 +889,7 @@
         continue;
       }
 
-      _import_export_prepare_fields($node, IMPORT_EXPORT_CVS);
+      _import_export_prepare_fields($node, IMPORT_EXPORT_CSV);
 
       for ($j=0; $j<count($flds); $j++) {
         if ($flds[$j]=='nid' || $flds[$j] == 'type') {
@@ -900,7 +900,7 @@
             switch ($opt['type']) {
               case IMPORT_EXPORT_TERMS:
                 if (module_exist("taxonomy")) {
-                  $arr = Explode(':', $rec[$j]);
+                  $arr = explode(':', $rec[$j]);
                   $node->_taxonomy[(string) $opt['vid']] = array();
                   for ($k=0; $k<count($arr); $k++) {
                     _import_export_node_add_taxonomy($node, $opt['vid'], (integer) $arr[$k], $arr[$k]);
@@ -914,7 +914,7 @@
                    3. \n -> LF
                    4. | back to \
                  */
-                _import_export_str2node($node, $fld, $opt, 
+                _import_export_str2node($node, $fld, $opt,
                                      preg_replace(array('/\\\\/', '/\\r/', '/\\n/', '/\\|/'),
                                            array('|',      "\r",    "\n",    '\\'),
                                            $rec[$j]));
@@ -946,9 +946,9 @@
  */
 
 function _import_export_prepare_xml($nids, $levels) {
-  Unset($node);
+  unset($node);
   $level = 0;
-  if (Is_Array($levels)) {
+  if (is_array($levels)) {
     foreach ($levels as $l) {
       $level |= $l;
     }
@@ -969,10 +969,10 @@
     $elem = array();
     foreach ($node->import_export_fields as $fld=>$opt) {
       if ($opt['type'] == IMPORT_EXPORT_ATTR && $opt['order'] ) {
-         
+
         if ( _import_export_node2str($node, $fld, $opt, $data) &&
-            (!IsSet($opt['level']) || $opt['level'] & $level) ) {
-          $s = IsSet($opt['element'])?$opt['element']:'*';
+            (!isset($opt['level']) || $opt['level'] & $level) ) {
+          $s = isset($opt['element'])?$opt['element']:'*';
           $attr[$s][$opt['name']] = Trim($data);
           if ($opt['flags']) {
             $flags[$s][XML_ATTRIBUTES][$fld] = $opt['flags'];
@@ -982,7 +982,7 @@
       if ($opt['type'] == IMPORT_EXPORT_ELEMENT && $opt['order']) {
         if ( _import_export_node2str($node, $fld, $opt, $data) &&
              $opt['element']!='' && $opt['element']!=$fld  &&
-            (!IsSet($opt['level']) || $opt['level'] & $level) ) {
+            (!isset($opt['level']) || $opt['level'] & $level) ) {
           $elem[$opt['element']][$opt['name']] = array(array(XML_VALUE=>Trim($data)));
           if ($opt['flags']) {
             $elem[$opt['element']][XML_VALUE] = $opt['flags'];
@@ -991,23 +991,23 @@
       }
     }
 
-    if (Is_Array($attr['*'])) {
+    if (is_array($attr['*'])) {
       $no[XML_ATTRIBUTES] = $attr['*'];
     }
-    if (Is_Array($flags['*'])) {
+    if (is_array($flags['*'])) {
       $no[XML_FLAGS] = $flags['*'];
     }
 
     foreach ($node->import_export_fields as $fld=>$opt) {
       if (($opt['type']==IMPORT_EXPORT_ELEMENT || $opt['type']==IMPORT_EXPORT_FAKE) &&
            $opt['order'] &&
-          (!IsSet($opt['element']) || $opt['element']==$fld) &&
-          (!IsSet($opt['level']) || $opt['level'] & $level) ) {
+          (!isset($opt['element']) || $opt['element']==$fld) &&
+          (!isset($opt['level']) || $opt['level'] & $level) ) {
         $e = array();
-        if (Is_Array($attr[$fld])) {
+        if (is_array($attr[$fld])) {
           $e[XML_ATTRIBUTES] = $attr[$fld];
         }
-        if (Is_Array($flags[$fld])) {
+        if (is_array($flags[$fld])) {
           $e[XML_FLAGS] = $flags[$fld];
         }
         if (_import_export_node2str($node, $fld, $opt, $data)) {
@@ -1021,7 +1021,7 @@
             $e[XML_FLAGS][XML_VALUE] = $opt['flags'];
           }
         }
-        if (Is_Array($elem[$fld])) {
+        if (is_array($elem[$fld])) {
           $e = array_merge($e, $elem[$fld]);
         }
         if (count($e)) {
@@ -1029,14 +1029,14 @@
         }
       }
     }
-    Unset($attr);
-    Unset($flags);
+    unset($attr);
+    unset($flags);
 
     $vocs = array();
     foreach ($node->import_export_fields as $fld=>$opt) {
       if ($opt['type'] == IMPORT_EXPORT_TERMS &&
           $opt['order'] &&
-          (!IsSet($opt['level']) || $opt['level'] & $level) ) {
+          (!isset($opt['level']) || $opt['level'] & $level) ) {
         $vo = array();
         $vo[XML_ATTRIBUTES] = array('vid'=>$opt['vid']);
         $vo['name'] = array(array(XML_VALUE=>$opt['name']));
@@ -1087,7 +1087,7 @@
  *   text process log
  *
  * @param $num_lines
- *   counter of CVS records
+ *   counter of CSV records
  *
  * @param $num_proc
  *   counter of processed records
@@ -1110,10 +1110,10 @@
   fclose($handle);
 
   $root = xml_decode_xml($data);
-  Unset($data);
+  unset($data);
   $mandatory_import_fields = _import_export_get_mandatory_import_fields();
 
-  if (Is_Array($root) && Is_Array($root['nodes']) && Is_Array($root['nodes'][0])) {
+  if (is_array($root) && is_array($root['nodes']) && is_array($root['nodes'][0])) {
     $fixups = _import_export_node_init_fixup();
     $nodes = $root['nodes'][0]['node'];
     foreach ($nodes as $no) {
@@ -1121,7 +1121,7 @@
 
       $mand_arr = array();
       foreach ($mandatory_import_fields as $f) {
-        if (IsSet($no[XML_ATTRIBUTES][$f])) {
+        if (isset($no[XML_ATTRIBUTES][$f])) {
           $mand_arr[$f] = $no[XML_ATTRIBUTES][$f];
         }
       }
@@ -1129,13 +1129,13 @@
       if ($action == 'load') {
         continue;
       }
-      Unset($node);
+      unset($node);
 
       if (!_import_export_node_load_check($action, $mand_arr['nid'], '', $mand_arr['type'], $node, $mand_arr, $fixups, $output)) {
         $output .= ' '. sprintf(t('nodeid %d'), $node->nid)."\n";
         continue;
       }
-      Unset($mand_arr);
+      unset($mand_arr);
       if ($action == 'delete') {
         _import_export_node_save($node, $preview, $action, $output, $fixups, $num_proc);
         continue;
@@ -1146,8 +1146,8 @@
         if ($fld == 'nid' || $fld == 'type') {
           continue;
         }
-        if (IsSet($opt['element'])) {
-          if (!IsSet($node->import_export_fields[$opt['element']])) {
+        if (isset($opt['element'])) {
+          if (!isset($node->import_export_fields[$opt['element']])) {
             continue;
           }
           $s = $node->import_export_fields[$opt['element']]['name'];
@@ -1156,15 +1156,15 @@
         else {
           $elem = $no;
         }
-        if (Is_Array($elem)) {
+        if (is_array($elem)) {
           switch ($opt['type']) {
             case IMPORT_EXPORT_ATTR:
-              if (IsSet($elem[XML_ATTRIBUTES][$opt['name']])) {
+              if (isset($elem[XML_ATTRIBUTES][$opt['name']])) {
                 _import_export_str2node($node, $fld, $opt, $elem[XML_ATTRIBUTES][$opt['name']]);
               }
               break;
             case IMPORT_EXPORT_ELEMENT:
-              if (IsSet($elem[$opt['name']][0][XML_VALUE])) {
+              if (isset($elem[$opt['name']][0][XML_VALUE])) {
                 _import_export_str2node($node, $fld, $opt, $elem[$opt['name']][0][XML_VALUE]);
               }
               break;
@@ -1173,11 +1173,11 @@
       }
 
       $vocs= $no['vocabularies'][0]['vocabulary'];
-      if (Is_Array($vocs) && module_exist('taxonomy')) {
+      if (is_array($vocs) && module_exist('taxonomy')) {
         foreach ($vocs as $voc) {
           if ($voc[XML_ATTRIBUTES]['vid']) {
             $node->_taxonomy[(string) $voc[XML_ATTRIBUTES]['vid']] = array();
-            if (Is_Array($voc['terms'][0]['term'])) {
+            if (is_array($voc['terms'][0]['term'])) {
               foreach ($voc['terms'][0]['term'] as $term) {
                 if ($term[XML_ATTRIBUTES]['tid'] > 0) {
                   _import_export_node_add_taxonomy($node, $voc[XML_ATTRIBUTES]['vid'], (integer) $term[XML_ATTRIBUTES]['tid'], '');
@@ -1203,13 +1203,13 @@
 define ('IMPORT_EXPORT_TERMS', 3);    // taxonomy terms
 define ('IMPORT_EXPORT_FAKE', 4);     // <ELEM><subelem attr="data">data</subelem></ELEM>
 
-// CVS taxonomy export format
+// CSV taxonomy export format
 define ('IMPORT_EXPORT_TERM_FORMAT_ID', 0);      // id1:id2
 define ('IMPORT_EXPORT_TERM_FORMAT_NAME', 1);    // name1:name2
 define ('IMPORT_EXPORT_TERM_FORMAT_ID_NAME', 2); // id1=name1:id2=name2
 
 // $kind of import/export
-define ('IMPORT_EXPORT_CVS', 1);
+define ('IMPORT_EXPORT_CSV', 1);
 define ('IMPORT_EXPORT_XML', 2);
 
 // $level, defines group of fields for XML export
@@ -1244,7 +1244,7 @@
 
 function _import_export_prepare_fields(&$node, $kind) {
   $default_fields = array(
-    'nid'=> array('type'=>IMPORT_EXPORT_ATTR /*'kind'=>IMPORT_EXPORT_CVS|IMPORT_EXPORT_XML*/),
+    'nid'=> array('type'=>IMPORT_EXPORT_ATTR /*'kind'=>IMPORT_EXPORT_CSV|IMPORT_EXPORT_XML*/),
     'type'=>array('type'=>IMPORT_EXPORT_ATTR),
     'parent'=>array('type'=>IMPORT_EXPORT_ATTR, 'flags'=>XML_FLAGS_REMOVE_EMPTY),  // 'parent', 'weight' outline field defined by book
     'weight'=>array('type'=>IMPORT_EXPORT_ATTR),
@@ -1271,7 +1271,7 @@
   if (module_exist("taxonomy")) {
     foreach (taxonomy_get_vocabularies($node->type) as $vid => $voc) {
       $node->import_export_fields[(string) $vid] = array('type'=>IMPORT_EXPORT_TERMS, 'vid'=>$vid, 'caption'=>$voc->name .' *', 'level'=>IMPORT_EXPORT_TAXONOMY, 'order'=>$n++);
-      $node->import_export_fields[(string) $vid]['name'] = (($kind & IMPORT_EXPORT_CVS)?'*':'').$voc->name;
+      $node->import_export_fields[(string) $vid]['name'] = (($kind & IMPORT_EXPORT_CSV)?'*':'').$voc->name;
     }
   }
   node_invoke_nodeapi($node, 'import_export', 'fields', $kind);
@@ -1285,7 +1285,7 @@
  *   node object
  *
  * @param $kind
- *   IMPORT_EXPORT_XML/CVS
+ *   IMPORT_EXPORT_XML/CSV
  *
  * @param $default_fields
  *   array of definitions, see exported data and definition in _import_export_prepare_fields()
@@ -1303,13 +1303,13 @@
   }
 
   foreach ($default_fields as $fld=>$opt) {
-    if ($kind == IMPORT_EXPORT_CVS && $opt['type'] == IMPORT_EXPORT_FAKE) {
+    if ($kind == IMPORT_EXPORT_CSV && $opt['type'] == IMPORT_EXPORT_FAKE) {
       continue;
     }
-    if (!IsSet($opt['kind']) || $opt['kind'] & $kind) {
+    if (!isset($opt['kind']) || $opt['kind'] & $kind) {
       $node->import_export_fields[$fld] = array('name'=>($opt['name']?$opt['name']:$fld), 'caption'=>$fld, 'type'=>$opt['type'], 'flags'=>$opt['flags'], 'level'=>$opt['level'], 'order'=>$n++, 'node_property'=>$opt['node_property']);
       if ($kind == IMPORT_EXPORT_XML) {
-        if (IsSet($opt['element'])) {
+        if (isset($opt['element'])) {
           $node->import_export_fields[$fld]['element'] = $opt['element'];
         }
       }
@@ -1324,10 +1324,10 @@
 
 function _import_export_print($output, $rawout, $raw, $content_type, $filename) {
   if ($raw) {
-    Header("Content-Type: $content_type");
-    Header("Encoding: UTF-8");
-    Header(sprintf("Content-Length: %d", StrLen($rawout)));
-    Header("Content-Disposition: attachment; filename=$filename");
+    header("Content-Type: $content_type");
+    header("Encoding: UTF-8");
+    header(sprintf("Content-Length: %d", StrLen($rawout)));
+    header("Content-Disposition: attachment; filename=$filename");
     print $rawout;
   }
   else {
@@ -1366,23 +1366,23 @@
             import_export_add_fields($node, $arg2, $default_fields[$node->type]);
           } else if (module_exist('flexinode') && strpos($node->type, 'flexinode-')===0) {
             $ctype_id = substr($node->type, 10);
-	    if ($ctype_id>0) {
+            if ($ctype_id>0) {
               $n = 1;
               foreach ($node->import_export_fields as $fld=>$opt) {
-              if ($opt['order'] > $n && $opt['order'] < IMPORT_EXPORT_ORDER_RANGE) {
-                $n = $opt['order'];
+                if ($opt['order'] > $n && $opt['order'] < IMPORT_EXPORT_ORDER_RANGE) {
+                  $n = $opt['order'];
                 }
               }
               $ct = flexinode_load_content_type($ctype_id);
               foreach ($ct->fields as $field) {
-              // this should be implemented into flexi_node_*.inc API!!! 
+              // this should be implemented into flexi_node_*.inc API!!!
                 switch ($field->field_type) {
                   case 'email':
                   case 'number':
                   case 'url':
                   case 'checkbox':
                   case 'file':
-                  case 'select':	
+                  case 'select':
                   case 'datetime':
                   case 'textfield':
                     $ty = IMPORT_EXPORT_ATTR;
@@ -1390,12 +1390,12 @@
                   default:
                     $ty = IMPORT_EXPORT_ELEMENT;
                     break;
-                }   
+                }
                 // may not work always - here I expect simple property 'flexi_node_'.$field->field_id in node
                 $node->import_export_fields['flexinode_'.$field->field_id] = array('name'=>$field->label, 'caption'=>$field->label, 'type'=>$ty, 'flags'=>XML_FLAGS_REMOVE_EMPTY, 'level'=>IMPORT_EXPORT_PUBLIC2, 'order'=>$n++);
               }
             }
-	  }
+          }
           return;
         case 'types':
           $res = array();
@@ -1403,12 +1403,12 @@
             if (module_exist($type))
               $res[$type] = $type;
           }
-	  if (module_exist('flexinode')) {
+          if (module_exist('flexinode')) {
             $fx = flexinode_content_types();
             foreach ($fx as $fid=>$f) {
               $res['flexinode-'.$fid] = $f->name;
             }
-	  }
+          }
           return $res;
       }
       return;
