This repository was archived by the owner on May 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php
2- include 'utils.php ' ;
2+ include_once 'utils.php ' ;
33$ dark = isset ($ _GET ['theme ' ]) && $ _GET ['theme ' ] === 'dark ' ;
44
55$ header = $ dark ? "#fff " : "#434d58 " ;
Original file line number Diff line number Diff line change 66$ repo = get ('repo ' , 'code-statistic ' );
77
88$ stats = fetch ("repo/ $ username/ $ repo " );
9- echo $ stats ->color ;
9+ if (!$ stats ) {
10+ include 'error.php ' ;
11+ exit ;
12+ }
1013$ header = $ dark ? "#fff " : "#434d58 " ;
1114$ background = $ dark ? "#000 " : "#fffefe " ;
1215
16+ $ bar = count ($ stats ->languages );
17+ echo $ bar ;
1318ob_start ('compress ' );
1419?>
1520<% const left = Math.ceil(langs.length / 2); const height = 215 + (left > 4 ? (left - 4) * 20 : 0) %>
Original file line number Diff line number Diff line change 11<?php
2- header ('Content-Type: image/svg+xml ' );
2+ // header('Content-Type: image/svg+xml');
33header ('Cache-Control: no-cache ' );
44
55function compress ($ buffer )
@@ -19,8 +19,9 @@ function fetch($uri)
1919 );
2020
2121 $ context = stream_context_create ($ opts );
22- $ response = file_get_contents ("http://localhost:8080/api/ " . $ uri , false , $ context );
23- return json_decode ($ response );
22+ $ response = @file_get_contents ("http://localhost:8080/api/ " . $ uri , false , $ context );
23+ $ ok = $ response !== false ;
24+ return $ ok ? json_decode ($ response , true ) : null ;
2425}
2526
2627function get ($ param , $ default = null )
You can’t perform that action at this time.
0 commit comments