-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
41 lines (35 loc) · 1 KB
/
index.php
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
<?php
require_once "VisitorBadge.php";
/**
* Mendapatkan username dan repository
*/
$user = [
"username" => isset($_GET["username"]) ? $_GET["username"] : "",
"repo" => isset($_GET["repo"]) ? $_GET["repo"] : "",
"token" => isset($_GET["token"]) ? $_GET["token"] : "",
];
/**
* Mengatur custom_options badge
*/
$options = [
"label" => isset($_GET["label"]) ? $_GET["label"] : "default",
"color" => isset($_GET["color"]) ? $_GET["color"] : "default",
"style" => isset($_GET["style"]) ? $_GET["style"] : "default",
"logo" => isset($_GET["logo"]) ? $_GET["logo"] : "default",
"contentType" => isset($_GET["contentType"]) ? $_GET["contentType"] : "default",
];
/**
* Instansiasi VisitorBadge
*/
$file_path = "src/data/visitor.json";
$vbadge = new FI\Badge\VisitorBadge($file_path);
/**
* Mengatur username dan repository
*/
$vbadge->setUsername($user["username"]);
$vbadge->setRepository($user["repo"]);
$vbadge->githubVisitor($user["token"]);
/**
* Menapilkan hasil
*/
echo $vbadge->output($options);