Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:grapher-php [2020/10/30 20:14] babdev:grapher-php [2020/11/01 15:59] (current) bab
Line 419: Line 419:
         $pages =& $data['pages'];         $pages =& $data['pages'];
         $media =& $data['media'];         $media =& $data['media'];
- $root_name = $data['namespaces'];       + $root_name = array_values($pages)[0]["ns"];   
         $output = '{         $output = '{
    "root": "'. $root_name .'",    "root": "'. $root_name .'",
Line 433: Line 434:
             $output .= '"name" : "'. $title .'",'."\n";             $output .= '"name" : "'. $title .'",'."\n";
             $output .= '"value" : "'. $item['size'] .'",'."\n";             $output .= '"value" : "'. $item['size'] .'",'."\n";
-            $output .= '"type" : "'. substr($item['ns'],4) .'",'."\n"; +            $output .= '"type" : "'. substr($item['ns'],4) .'"'."\n"; 
-            if (!empty( $page['media'][0]))+            if (!empty( $item['media'][0]))
             {             {
- $path = explode (":", $page['media'][0]);+ $path = explode (":", $item['media'][0]);
  $file = count($path );  $file = count($path );
  $folder="";  $folder="";
- for($i=0 ; $< $file-1 ; $i++)+ for($n=0 ; $< $file-1 ; $n++)
  {  {
- $folder = $folder . $path[$i] . "/";+ $folder = $folder . $path[$n] . "/";
  }  }
- $output .= '"img" : "'. DOKU_INC. "data/media/" . $folder . "300x300-" . $path[$file-1] .'"'."\n";+ $output .= ',"img" : "'. DOKU_INC. "data/media/" . $folder . "300x300-" . $path[$file-1] .'"'."\n";
  }  }
            // $output .= '"has_conflict" : "'.$id.'"'."\n";            // $output .= '"has_conflict" : "'.$id.'"'."\n";
            // $output .= '"description" : "'.$id.'"'."\n";            // $output .= '"description" : "'.$id.'"'."\n";
             $output .= "}\n";             $output .= "}\n";
-            if ($i < count($pages)) $output .= ',';+            if ($i <count($pages)-1) $output .= ',';
                  
         }         }
Line 471: Line 472:
  
         }         }
-         +       
-        foreach($pages as $id => $page) { +
- for($n=0;$n<count($page['links']);$n++) +
-+
- fwrite($fh,   \"page-". $id ."\" -> \"page-". $page['links'][$n] ."\" [color=navy;label=\"". $page['linklabel'][$n] ."\"];\n"); +
-+
-        }+
                  
         $output .= " ] }";         $output .= " ] }";
Line 488: Line 483:
 $grapher = new Grapher(); $grapher = new Grapher();
 $grapher->run(); $grapher->run();
 +
  
  
  
 </file> </file>
  • dev/grapher-php.1604088860.txt.gz
  • Last modified: 2020/10/30 20:14
  • by bab