Advertise recent changes alternate formats

This commit is contained in:
Starbeamrainbowlabs 2019-01-24 21:15:23 +00:00
parent 524efcc43d
commit 14a7040646
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 13 additions and 4 deletions

View File

@ -409,7 +409,7 @@ if($settings->sessionprefix == "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.18-dev";
$commit = "bed21da43690f586e36b1e754431ac3be3682fc2";
$commit = "524efcc43d6e7612a326855b10c7dfe8a2c745e1";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -3745,7 +3745,11 @@ register_module([
else // No changes yet :(
$content .= "<p><em>None yet! Try making a few changes and then check back here.</em></p>\n";
exit(page_renderer::render("Recent Changes - $settings->sitename", $content));
$header_extra = "\t<link rel=\"alternate\" type=\"application/atom+xml\" href=\"?action=recent-changes&amp;format=atom\" />
<link rel=\"alternate\" type=\"text/csv\" href=\"?action=recent-changes&amp;format=csv\" />
<link rel=\"alternate\" type=\"application/json\" href=\"?action=recent-changes&amp;format=json\" />";
exit(str_replace("</head>", "$header_extra\n\t</head>", page_renderer::render("Recent Changes - $settings->sitename", $content)));
break;
case "json":
$result = json_encode($recent_changes);
@ -4023,6 +4027,7 @@ function render_recent_change($rchange)
*/
function render_recent_change_atom($recent_changes) {
global $version, $settings;
// See http://www.atomenabled.org/developers/syndication/#sampleFeed for easy-to-read Atom 1.0 docs
$full_url_stem = full_url();
$full_url_stem = substr($full_url_stem, 0, strpos($full_url_stem, "?"));

View File

@ -95,7 +95,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes",
"lastupdate": 1548363014,
"lastupdate": 1548364500,
"optional": false
},
{

View File

@ -59,7 +59,11 @@ register_module([
else // No changes yet :(
$content .= "<p><em>None yet! Try making a few changes and then check back here.</em></p>\n";
exit(page_renderer::render("Recent Changes - $settings->sitename", $content));
$header_extra = "\t<link rel=\"alternate\" type=\"application/atom+xml\" href=\"?action=recent-changes&amp;format=atom\" />
<link rel=\"alternate\" type=\"text/csv\" href=\"?action=recent-changes&amp;format=csv\" />
<link rel=\"alternate\" type=\"application/json\" href=\"?action=recent-changes&amp;format=json\" />";
exit(str_replace("</head>", "$header_extra\n\t</head>", page_renderer::render("Recent Changes - $settings->sitename", $content)));
break;
case "json":
$result = json_encode($recent_changes);