Skip to content

Commit 739e1f5

Browse files
haszihaszi
and
haszi
authored
Add last modification info and contributor list (#977)
Co-authored-by: haszi <haszika80@gmail.com>
1 parent fbe5898 commit 739e1f5

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

include/shared-manual.inc

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,28 @@ function manual_footer($setup): void {
380380
}
381381
}
382382

383+
$lastUpdate = '';
384+
if (isset($setup["history"]['modified']) && $setup["history"]['modified'] !== "") {
385+
$modifiedDateTime = date_create($setup["history"]['modified']);
386+
if ($modifiedDateTime !== false) {
387+
$lastUpdate .= "Last updated on " . date_format($modifiedDateTime,"M d, Y (H:i T)");
388+
$lastUpdate .= (isset($setup["history"]['contributors'][0]) ? " by " . $setup["history"]['contributors'][0] : "") . ".";
389+
}
390+
}
391+
392+
$contributors = '';
393+
if (isset($setup["history"]['contributors']) && count($setup["history"]['contributors']) > 0) {
394+
$contributors = '<a href="?contributors">All contributors.</a>';
395+
}
396+
383397
echo <<<CONTRIBUTE
384398
<div class="contribute">
385399
<h3 class="title">Improve This Page</h3>
400+
<div>
401+
$lastUpdate $contributors
402+
</div>
386403
<div class="edit-bug">
387-
<a href="https://github.com/php/doc-base/blob/master/README.md" title="This will take you to our contribution guidelines on GitHub." target="_blank" rel="noopener noreferrer">Learn how improve this page</a>
404+
<a href="https://github.com/php/doc-base/blob/master/README.md" title="This will take you to our contribution guidelines on GitHub." target="_blank" rel="noopener noreferrer">Learn How To Improve This Page</a>
388405
389406
<a href="{$edit_url}">Submit a Pull Request</a>
390407
@@ -421,3 +438,25 @@ function relTime(DateTime $date) {
421438
}
422439
return $out;
423440
}
441+
442+
function contributors($setup) {
443+
if (!isset($_GET["contributors"])
444+
|| !isset($setup["history"]["contributors"])
445+
|| count($setup["history"]["contributors"]) < 1) {
446+
return;
447+
}
448+
449+
$contributorList = "<li>" . implode("</li><li>", $setup["history"]["contributors"]) . "</li>";
450+
451+
echo <<<CONTRIBUTORS
452+
<div class="book">
453+
<h1 class="title">Output Buffering Control</h1>
454+
The following have authored commits that contributed to this page:
455+
<ul>
456+
$contributorList
457+
</ul>
458+
</div>
459+
CONTRIBUTORS;
460+
manual_footer($setup);
461+
exit;
462+
}

0 commit comments

Comments
 (0)