diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2016-01-08 13:42:19 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2016-01-08 13:42:19 +0100 |
commit | 0be3d16305d6a86411ecf81f1f869474d52d58d9 (patch) | |
tree | ddde78aab04063f0af84b1433b88108b59d9b211 | |
parent | d680be57bd3461978c300fbcb304b846ee24b717 (diff) | |
download | replicant_website-0be3d16305d6a86411ecf81f1f869474d52d58d9.zip replicant_website-0be3d16305d6a86411ecf81f1f869474d52d58d9.tar.gz replicant_website-0be3d16305d6a86411ecf81f1f869474d52d58d9.tar.bz2 |
index: Multiple git commits view
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | index.php | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -79,23 +79,31 @@ if ($feed->error() || !$feed_init) { $count = 1; foreach ($feed->get_items() as $item) { - preg_match("/\/replicant\/([^\/]*)\/commit/", $item->get_permalink(), $repo); + preg_match("/git\.replicant\.us\/replicant\/([^\/]*)\//", $item->get_permalink(), $repo); if ($repo == null) continue; - preg_match("/(.*)\/commit/", $item->get_permalink(), $repo_link); - if ($repo_link == null) - continue; + $repo_link = "https://git.replicant.us/replicant/".$repo[1]; preg_match("/pushed to project branch ([^ ]*) /", $item->get_title(), $branch); if ($branch == null) continue; - preg_match("/<blockquote><p>(.*)<\/p>/", $item->get_content(), $commit); - if ($commit == null) + $commits_contents = preg_grep("/<blockquote><p>/", explode("\n", $item->get_content())); + if ($commits_contents == null) continue; - print("\t\t\t\t\t<li class=\"list-group-item\"><a href=\"".$repo_link[1]."/\">".$repo[1]."</a> (<strong>".$branch[1]."</strong>):<br /><ul><li><a href=\"".$item->get_permalink()."\">".$commit[1]."</a></li></ul><small>Pushed on <strong>".$item->get_date("j F Y")."</strong> by <strong>".$item->get_author()->get_name()."</strong></small></li>\n"); + print("\t\t\t\t\t<li class=\"list-group-item\"><a href=\"".$repo_link."/\">".$repo[1]."</a> (<strong>".$branch[1]."</strong>):<br /><ul>"); + + foreach ($commits_contents as $commit_content) { + preg_match("/<blockquote><p>(.*)<\/p>/", $commit_content, $commit); + if ($commit == null) + continue; + + print("<li><a href=\"".$item->get_permalink()."\">".$commit[1]."</a></li>"); + } + + print("</ul><small>Pushed on <strong>".$item->get_date("j F Y")."</strong> by <strong>".$item->get_author()->get_name()."</strong></small></li>\n"); if ($count++ >= 8) break; |