blob: 4ff54876a73b054851c5f03a955ffec65caba6ff (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
require_once "./apis.php";
$api = new API();
$data = [
"github" => []
];
// ------------------------------------
// GitHub
$events = json_decode($api->GitHub("users/Minteck/events"), true);
$last = null;
foreach ($events as $event) {
if ($event["type"] === "PushEvent") {
$last = $event;
break;
}
}
$data["github"]["project"] = $last["repo"]["name"];
$data["github"]["sha"] = substr($last["payload"]["commits"][0]["sha"], 0, 7);
$data["github"]["message"] = $last["payload"]["commits"][0]["message"];
// ------------------------------------
// Reddit
$posts = json_decode($api->Reddit("user/Minteck"), true)["data"]["children"];
$last = null;
foreach ($posts as $post) {
if (!$post["pinned"]) {
$last = $post["data"];
break;
}
}
$data["reddit"]["sub"] = $last["subreddit"];
$data["reddit"]["title"] = $last["title"];
$data["reddit"]["score"] = $last["score"];
// ------------------------------------
// Neutron Releases
$neutron = json_decode($api->GitHub("repos/Minteck-Projects/Neutron-Core/releases"), true);
file_put_contents("./neutron.json", json_encode($neutron, JSON_PRETTY_PRINT));
$neutron = json_decode($api->GitHub("repos/Minteck-Projects/Neutron-Core/tags"), true);
file_put_contents("./neutron2.json", json_encode($neutron, JSON_PRETTY_PRINT));
// ------------------------------------
// Dump
file_put_contents("./stats.json", json_encode($data, JSON_PRETTY_PRINT));
|