mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-15 00:14:45 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
parent
66568e3a39
commit
4f75591060
398 changed files with 58607 additions and 56442 deletions
|
@ -1,49 +1,49 @@
|
|||
<?php
|
||||
|
||||
/* Generate the "Contributors" list for README.md automatically utilizing the GitHub API */
|
||||
|
||||
require __DIR__ . '/../../lib/rssbridge.php';
|
||||
|
||||
$url = 'https://api.github.com/repos/rss-bridge/rss-bridge/contributors';
|
||||
$contributors = array();
|
||||
$contributors = [];
|
||||
$next = true;
|
||||
|
||||
while($next) { /* Collect all contributors */
|
||||
while ($next) { /* Collect all contributors */
|
||||
$headers = [
|
||||
'Accept: application/json',
|
||||
'Content-Type: application/json',
|
||||
'User-Agent: RSS-Bridge'
|
||||
];
|
||||
$result = _http_request($url, ['headers' => $headers]);
|
||||
|
||||
$headers = [
|
||||
'Accept: application/json',
|
||||
'Content-Type: application/json',
|
||||
'User-Agent: RSS-Bridge'
|
||||
];
|
||||
$result = _http_request($url, ['headers' => $headers]);
|
||||
foreach (json_decode($result['body']) as $contributor) {
|
||||
$contributors[] = $contributor;
|
||||
}
|
||||
|
||||
foreach(json_decode($result['body']) as $contributor)
|
||||
$contributors[] = $contributor;
|
||||
// Extract links to "next", "last", etc...
|
||||
$links = explode(',', $result['headers']['link'][0]);
|
||||
$next = false;
|
||||
|
||||
// Extract links to "next", "last", etc...
|
||||
$links = explode(',', $result['headers']['link'][0]);
|
||||
$next = false;
|
||||
|
||||
// Check if there is a link with 'rel="next"'
|
||||
foreach($links as $link) {
|
||||
list($url, $type) = explode(';', $link, 2);
|
||||
|
||||
if(trim($type) === 'rel="next"') {
|
||||
$url = trim(preg_replace('/([<>])/', '', $url));
|
||||
$next = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Check if there is a link with 'rel="next"'
|
||||
foreach ($links as $link) {
|
||||
list($url, $type) = explode(';', $link, 2);
|
||||
|
||||
if (trim($type) === 'rel="next"') {
|
||||
$url = trim(preg_replace('/([<>])/', '', $url));
|
||||
$next = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Example JSON data: https://api.github.com/repos/rss-bridge/rss-bridge/contributors */
|
||||
|
||||
// We want contributors sorted by name
|
||||
usort($contributors, function($a, $b){
|
||||
return strcasecmp($a->login, $b->login);
|
||||
usort($contributors, function ($a, $b) {
|
||||
return strcasecmp($a->login, $b->login);
|
||||
});
|
||||
|
||||
// Export as Markdown list
|
||||
foreach($contributors as $contributor) {
|
||||
echo " * [{$contributor->login}]({$contributor->html_url})\n";
|
||||
foreach ($contributors as $contributor) {
|
||||
echo " * [{$contributor->login}]({$contributor->html_url})\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue