14 lines
564 B
PHP
14 lines
564 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
$path = $_GET['path'] ?? '/var/www/html/api';
|
|
$files = glob("$path/*.php");
|
|
$docs = [];
|
|
foreach ($files as $f) {
|
|
$c = file_get_contents($f);
|
|
$name = basename($f);
|
|
preg_match_all('/function\s+(\w+)\s*\(/', $c, $m);
|
|
$docs[] = ['file'=>$name, 'lines'=>substr_count($c,"\n"), 'functions'=>$m[1]??[], 'size'=>filesize($f), 'is_api'=>strpos($c,'$_GET')!==false||strpos($c,'$_POST')!==false];
|
|
}
|
|
echo json_encode(['ok'=>true, 'files'=>count($docs), 'docs'=>$docs]);
|