-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_paths2.php
37 lines (29 loc) · 892 Bytes
/
read_paths2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
## usage
isset($GLOBALS['file_tree_name']) ? $pathfile = $GLOBALS['file_tree_name'] : $pathfile = getcwd().'paths.csv';
if (!file_exists($pathfile)) {
echo "i have not file paths";
die;
}
$data['arPaths']=array();
require_once('treefrompaths.php');
require_once('functions.php');
$tree=new TreeFromPaths($data);
echo '<ul class="dhtmlgoodies_tree" id="dhtmlgoodies_tree">';
foreach (file($pathfile) as $line_mb){
$encode_from=mb_detect_encoding($line_mb);
if (!$encode_from){
$encode_from='UTF-16LE';
}
$line=mb_convert_encoding($line_mb,'UTF-8',$encode_from);
$row=explode(',',$line);
foreach ($row as $key=>&$value){
$value = preg_replace('/"(.*)"/','${1}',$value);
$value = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $value);
}
if (isset($row[0]) && count(explode('\\',$row[0]))>1) {
echo $tree->single_row($row,true);
}
}
echo '</ul>';
?>