ExcelToJson.php
[Pman.Core] / ExcelToJson.php
index 25b298b..4a42a50 100644 (file)
@@ -51,10 +51,10 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         $cols = false;
         $header = false;
         $rows = array();
-        $ret = array();
+        $extra = array();
         
         while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
-            if(!array_filter($n)){
+            if(!strlen(trim(implode('', $n)))){ // blank line;
                 if ($header) {
                     continue;
                 }
@@ -63,7 +63,7 @@ class Pman_Core_ExcelToJson extends Pman_Roo
             }
             
             if(!$header){
-               $ret[preg_replace(array('/\s/', '/\:/'), '', $n[0])] = $n[1];
+               $extra[preg_replace(array('/\s/', '/\:/'), '', $n[0])] = $n[1];
                continue;
             }
             
@@ -89,6 +89,9 @@ class Pman_Core_ExcelToJson extends Pman_Roo
         }
         fclose($fh);
         
-        return array('extra' => $ret, 'data' => $rows);;
+        $ret = array('extra' => $extra, 'data' => $rows);
+        echo 'about to return?';print_R($ret);exit;
+        
+        return array('extra' => $extra, 'data' => $rows);;
     }
 }
\ No newline at end of file