Rev 106 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 106 | Rev 143 | ||
---|---|---|---|
Line 261... | Line 261... | ||
261 | $t = generateRandomString($length); |
261 | $t = generateRandomString($length); |
262 | } while (strpos($haystack, $t) !== false); |
262 | } while (strpos($haystack, $t) !== false); |
263 | return $t; |
263 | return $t; |
264 | } |
264 | } |
265 | 265 | ||
266 | function github_commit_count($user, $repo) { |
266 | function github_latest_commit($author, $repo) { |
267 | $cont = file_get_contents("https://github.com/$user/$repo"); |
267 | $cont = file_get_contents2("https://api.github.com/repos/$author/$repo/commits"); |
268 | if (preg_match('@<strong>(\\d+)</strong>\s*<span[^>]+aria-label="Commits on master"[^>]*>\s*commits\s*</span>@smU', $cont, $m)) { |
268 | if ($cont === false) return false; |
269 | return $m[1]; |
269 | $json = json_decode($cont, true); |
270 | } else { |
270 | if ($json === false) return false; |
271 | return "?"; |
271 | return $json[0]['sha'] ?? false; |
272 | } |
- | |
273 | } |
272 | } |