Author: haszi (haszi)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2024-04-20T17:40:32+01:00

Commit: 
https://github.com/php/web-php/commit/739e1f575e9f247eb131ab7f90d1e7cca281d635
Raw diff: 
https://github.com/php/web-php/commit/739e1f575e9f247eb131ab7f90d1e7cca281d635.diff

Add last modification info and contributor list (#977)

Co-authored-by: haszi <haszik...@gmail.com>

Changed paths:
  M  include/shared-manual.inc


Diff:

diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 8bf4552a64..3162728108 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -380,11 +380,28 @@ function manual_footer($setup): void {
         }
     }
 
+    $lastUpdate = '';
+    if (isset($setup["history"]['modified']) && $setup["history"]['modified'] 
!== "") {
+        $modifiedDateTime = date_create($setup["history"]['modified']);
+        if ($modifiedDateTime !== false) {
+            $lastUpdate .= "Last updated on " . 
date_format($modifiedDateTime,"M d, Y (H:i T)");
+            $lastUpdate .= (isset($setup["history"]['contributors'][0]) ? " by 
" . $setup["history"]['contributors'][0] : "") . ".";
+        }
+    }
+
+    $contributors = '';
+    if (isset($setup["history"]['contributors']) && 
count($setup["history"]['contributors']) > 0) {
+        $contributors = '<a href="?contributors">All contributors.</a>';
+    }
+
     echo <<<CONTRIBUTE
     <div class="contribute">
       <h3 class="title">Improve This Page</h3>
+      <div>
+        $lastUpdate $contributors
+      </div>
       <div class="edit-bug">
-        <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>
+        <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>
         •
         <a href="{$edit_url}">Submit a Pull Request</a>
         •
@@ -421,3 +438,25 @@ function relTime(DateTime $date) {
     }
     return $out;
 }
+
+function contributors($setup) {
+    if (!isset($_GET["contributors"])
+        || !isset($setup["history"]["contributors"])
+        || count($setup["history"]["contributors"]) < 1) {
+        return;
+    }
+
+    $contributorList = "<li>" . implode("</li><li>", 
$setup["history"]["contributors"]) . "</li>";
+
+    echo <<<CONTRIBUTORS
+<div class="book">
+  <h1 class="title">Output Buffering Control</h1>
+  The following have authored commits that contributed to this page:
+  <ul>
+   $contributorList
+  </ul>
+</div>
+CONTRIBUTORS;
+    manual_footer($setup);
+    exit;
+}

Reply via email to