Showing contributors using GitHub API in Credits, if CURL is enabled.

This commit is contained in:
Kuzirashi 2014-05-16 18:24:07 +02:00
parent 7ead2b1bdd
commit ebaa3ab10d

View File

@ -5,9 +5,53 @@
<h2>Developers:</h2> <h2>Developers:</h2>
<p>Main: <a href="http://otland.net/members/znote.5993/">Znote</a>. <p>Main: <a href="http://otland.net/members/znote.5993/">Znote</a>.
<?php
if(!function_exists('curl_version')) { // If CURL isn't enabled show default version.
?>
<br>Contributor: <a href="https://github.com/Kuzirashi">Kuzirashi</a>. <br>Contributor: <a href="https://github.com/Kuzirashi">Kuzirashi</a>.
<br>Contributor: <a href="https://github.com/ninjalulz">ninjalulz</a>. <br>Contributor: <a href="https://github.com/ninjalulz">ninjalulz</a>.
<br>Contributor: <a href="https://github.com/att3">att3</a>. <br>Contributor: <a href="https://github.com/att3">att3</a>.
<?php } else { // CURL enabled.
echo '<br />
Contributors:';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.github.com/repos/Znote/ZnoteAAC/contributors');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'ZnoteAAC'); // GitHub requires user agent header.
$contributors = json_decode(curl_exec($curl), true); // Sorted by contributions.
$CONTRIBUTORS_PER_ROW = 7;
$i = 0;
$first_container = true;
$div_closed = true;
foreach($contributors as $contributor)
{
if($contributor['login'] != 'Znote') { // Exclude Znote as he is mentioned above as main developer.
$new_div = ctype_digit((String)($i / $CONTRIBUTORS_PER_ROW));
if($new_div) {
if(!$first_container)
echo '</div>';
echo '<div class="contributors">';
$div_closed = false;
$first_container = false;
}
echo '<div class="contributor">
<a href="' . $contributor['html_url'] . '">
<img src="' . $contributor['avatar_url'] . 'size=80" /><br/>
<span>' . $contributor['login'] . '</span>
</a>
</div>';
$i++;
}
}
if(!$div_closed)
echo '</div>';
} ?>
</p> </p>
<h3>Thanks to: (in no particular order)</h3> <h3>Thanks to: (in no particular order)</h3>
@ -18,7 +62,20 @@
<br><a href="http://otland.net/members/evan.40401/">Evan</a>, <a href="http://otland.net/members/gremlee.12075/">Gremlee</a> - Researching TFS 0.3, constructive feedback, suggestion and participation. <br><a href="http://otland.net/members/evan.40401/">Evan</a>, <a href="http://otland.net/members/gremlee.12075/">Gremlee</a> - Researching TFS 0.3, constructive feedback, suggestion and participation.
<br><a href="http://otland.net/members/att3.98289/">ATT3</a> - Reporting and fixing bugs, TFS 1.0 research. <br><a href="http://otland.net/members/att3.98289/">ATT3</a> - Reporting and fixing bugs, TFS 1.0 research.
<br><a href="http://otland.net/members/mark.1/">Mark</a> - Old repository, TFS distributions which this AAC works against. <br><a href="http://otland.net/members/mark.1/">Mark</a> - Old repository, TFS distributions which this AAC works against.
<br><a href="https://github.com/tedbro">Tedbro</a>, <a href="https://github.com/exura">Exura</a>, <a href="https://github.com/PrinterLUA">PrinterLUA</a> - Reporting bugs <br><a href="https://github.com/tedbro">Tedbro</a>, <a href="https://github.com/exura">Exura</a>, <a href="https://github.com/PrinterLUA">PrinterLUA</a> - Reporting bugs.
</p> </p>
<style>
.contributors {
margin-top: 10px;
padding: 5px;
border: 1px solid rgb(184, 184, 184);
display: inline-flex;
width: 100%;
}
.contributor {
padding: 10px;
text-align: center;
}
</style>
<?php include 'layout/overall/footer.php'; ?> <?php include 'layout/overall/footer.php'; ?>