function parseRepoXML() { $url = "https://api.github.com/repos/bitDubai/fermat/contents/FermatManifest.xml"; $data = askGitHub($url); $data = $data["content"]; $data = str_replace('', '\\n', $data); $data = base64_decode($data); $data = simplexml_load_string($data); return $data; }
function main() { //echo $_REQUEST["url"]; $contentUrl = "https://api.github.com/repos/bitDubai/fermat/contents/" . $_REQUEST["url"]; //echo $contentUrl; $contentData = askGitHub($contentUrl); /*if (in_array("message", $contentData)) { echo "found message in array"; if (strcmp($contentData["message"], "Not Found") == 0) { echo false; } else { echo true; } } else { echo "not found message in array"; }*/ //echo var_dump($contentData); $output = gzencode(json_encode($contentData)); //header('Content-Encoding: gzip'); //header('Content-Length: '.strlen($gzipoutput)); echo gzdecode($output); }
function lookForAuthor($element) { $author = null; global $authorCache; $userUrl = "https://api.github.com/users/"; if (!$element->authors) { return null; } foreach ($element->authors->children() as $actual) { if (strval($actual['scope']) === 'implementation') { if ($author == null || $author['percentage'] < (int) strval($actual['percentage'])) { $author = array('name' => strval($actual['name']), 'percentage' => (int) strval($actual['percentage'])); $cache = search('name', $author['name'], $authorCache); if ($cache === null) { $userData = askGitHub($userUrl . $author['name']); $pictureUrl = strval($userData["avatar_url"]); $realName = strval($userData['name']); $mail = strval($userData['email']); array_push($authorCache, array('name' => $author['name'], 'img' => $pictureUrl, 'realName' => $realName, 'email' => $mail)); } else { $pictureUrl = $cache['img']; $realName = $cache['realName']; $mail = $cache['email']; } $author['picture'] = $pictureUrl; $author['realName'] = $realName; $author['email'] = $mail; } } } return $author; }