1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Rename rchange functions. Fixes #74.

This commit is contained in:
Starbeamrainbowlabs 2016-06-08 17:41:30 +01:00
parent 78a3a866dd
commit d1320aa467
6 changed files with 25 additions and 25 deletions

View file

@ -846,7 +846,7 @@ if (!function_exists('getallheaders')) {
* @param int $timestamp The timestamp to render. * @param int $timestamp The timestamp to render.
* @return string HTML representing the given timestamp. * @return string HTML representing the given timestamp.
*/ */
function render_rchange_timestamp($timestamp) function render_timestamp($timestamp)
{ {
return "<time class='cursor-query' title='" . date("l jS \of F Y \a\\t h:ia T", $timestamp) . "'>" . human_time_since($timestamp) . "</time>"; return "<time class='cursor-query' title='" . date("l jS \of F Y \a\\t h:ia T", $timestamp) . "'>" . human_time_since($timestamp) . "</time>";
} }
@ -855,7 +855,7 @@ function render_rchange_timestamp($timestamp)
* @param object $rchange The recent change to render as a page name * @param object $rchange The recent change to render as a page name
* @return string HTML representing the name of the given page. * @return string HTML representing the name of the given page.
*/ */
function render_rchange_pagename($rchange) function render_pagename($rchange)
{ {
global $pageindex; global $pageindex;
$pageDisplayName = $rchange->page; $pageDisplayName = $rchange->page;
@ -869,7 +869,7 @@ function render_rchange_pagename($rchange)
* @param string $editorName The name of the editor to render. * @param string $editorName The name of the editor to render.
* @return string HTML representing the given editor's name. * @return string HTML representing the given editor's name.
*/ */
function render_rchange_editor($editorName) function render_editor($editorName)
{ {
return "<span class='editor'>&#9998; $editorName</span>"; return "<span class='editor'>&#9998; $editorName</span>";
} }
@ -1811,7 +1811,7 @@ register_module([
$size_display_class .= " significant"; $size_display_class .= " significant";
$size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize); $size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize);
$content .= "<li><a href='?page=" . rawurlencode($env->page) . "&revision=$revisionData->rid'>#$revisionData->rid</a> " . render_rchange_editor($revisionData->editor) . " " . render_rchange_timestamp($revisionData->timestamp) . " <span class='cursor-query $size_display_class' title='$size_title_display'>($size_display)</span>"; $content .= "<li><a href='?page=" . rawurlencode($env->page) . "&revision=$revisionData->rid'>#$revisionData->rid</a> " . render_editor($revisionData->editor) . " " . render_timestamp($revisionData->timestamp) . " <span class='cursor-query $size_display_class' title='$size_title_display'>($size_display)</span>";
} }
} }
else else
@ -2018,15 +2018,15 @@ function render_recent_changes($recent_changes)
end($rchange_results); end($rchange_results);
$rchange_last = $recent_changes[key($rchange_results)]; $rchange_last = $recent_changes[key($rchange_results)];
$pageDisplayHtml = render_rchange_pagename($rchange_first); $pageDisplayHtml = render_pagename($rchange_first);
$timeDisplayHtml = render_rchange_timestamp($rchange_first->timestamp); $timeDisplayHtml = render_timestamp($rchange_first->timestamp);
$users = []; $users = [];
foreach($rchange_results as $key => $rchange_result) foreach($rchange_results as $key => $rchange_result)
{ {
if(!in_array($recent_changes[$key]->user, $users)) if(!in_array($recent_changes[$key]->user, $users))
$users[] = $recent_changes[$key]->user; $users[] = $recent_changes[$key]->user;
} }
$userDisplayHtml = render_rchange_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: COllect up and render a list of participating users // TODO: COllect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
@ -2047,9 +2047,9 @@ function render_recent_changes($recent_changes)
function render_recent_change($rchange) function render_recent_change($rchange)
{ {
$pageDisplayHtml = render_rchange_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_rchange_editor($rchange->user); $editorDisplayHtml = render_editor($rchange->user);
$timeDisplayHtml = render_rchange_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$result = ""; $result = "";
$resultClasses = []; $resultClasses = [];
@ -4454,7 +4454,7 @@ register_module([
else else
{ {
$content .= "<h1>Revision #$revisionNumber of $env->page</h1>\n"; $content .= "<h1>Revision #$revisionNumber of $env->page</h1>\n";
$content .= "<p class='revision-note'><em>(Revision created by $revisionData->editor " . render_rchange_timestamp($revisionData->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n"; $content .= "<p class='revision-note'><em>(Revision created by $revisionData->editor " . render_timestamp($revisionData->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
} }
// Add an extra message if the requester was redirected from another page // Add an extra message if the requester was redirected from another page

View file

@ -419,7 +419,7 @@ if (!function_exists('getallheaders')) {
* @param int $timestamp The timestamp to render. * @param int $timestamp The timestamp to render.
* @return string HTML representing the given timestamp. * @return string HTML representing the given timestamp.
*/ */
function render_rchange_timestamp($timestamp) function render_timestamp($timestamp)
{ {
return "<time class='cursor-query' title='" . date("l jS \of F Y \a\\t h:ia T", $timestamp) . "'>" . human_time_since($timestamp) . "</time>"; return "<time class='cursor-query' title='" . date("l jS \of F Y \a\\t h:ia T", $timestamp) . "'>" . human_time_since($timestamp) . "</time>";
} }
@ -428,7 +428,7 @@ function render_rchange_timestamp($timestamp)
* @param object $rchange The recent change to render as a page name * @param object $rchange The recent change to render as a page name
* @return string HTML representing the name of the given page. * @return string HTML representing the name of the given page.
*/ */
function render_rchange_pagename($rchange) function render_pagename($rchange)
{ {
global $pageindex; global $pageindex;
$pageDisplayName = $rchange->page; $pageDisplayName = $rchange->page;
@ -442,7 +442,7 @@ function render_rchange_pagename($rchange)
* @param string $editorName The name of the editor to render. * @param string $editorName The name of the editor to render.
* @return string HTML representing the given editor's name. * @return string HTML representing the given editor's name.
*/ */
function render_rchange_editor($editorName) function render_editor($editorName)
{ {
return "<span class='editor'>&#9998; $editorName</span>"; return "<span class='editor'>&#9998; $editorName</span>";
} }

View file

@ -41,7 +41,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds the ability to keep unlimited page history, limited only by your disk space. Note that this doesn't store file history (yet). Currently depends on feature-recent-changes for rendering of the history page.", "description": "Adds the ability to keep unlimited page history, limited only by your disk space. Note that this doesn't store file history (yet). Currently depends on feature-recent-changes for rendering of the history page.",
"id": "feature-history", "id": "feature-history",
"lastupdate": 1465067778, "lastupdate": 1465404004,
"optional": false "optional": false
}, },
{ {
@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.", "description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes", "id": "feature-recent-changes",
"lastupdate": 1465231242, "lastupdate": 1465404004,
"optional": false "optional": false
}, },
{ {
@ -185,7 +185,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You really should include this one.", "description": "Allows you to view pages. You really should include this one.",
"id": "page-view", "id": "page-view",
"lastupdate": 1465067673, "lastupdate": 1465403982,
"optional": false "optional": false
}, },
{ {

View file

@ -35,7 +35,7 @@ register_module([
$size_display_class .= " significant"; $size_display_class .= " significant";
$size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize); $size_title_display = human_filesize($revisionData->newsize - $revisionData->sizediff) . " -> " . human_filesize($revisionData->newsize);
$content .= "<li><a href='?page=" . rawurlencode($env->page) . "&revision=$revisionData->rid'>#$revisionData->rid</a> " . render_rchange_editor($revisionData->editor) . " " . render_rchange_timestamp($revisionData->timestamp) . " <span class='cursor-query $size_display_class' title='$size_title_display'>($size_display)</span>"; $content .= "<li><a href='?page=" . rawurlencode($env->page) . "&revision=$revisionData->rid'>#$revisionData->rid</a> " . render_editor($revisionData->editor) . " " . render_timestamp($revisionData->timestamp) . " <span class='cursor-query $size_display_class' title='$size_title_display'>($size_display)</span>";
} }
} }
else else

View file

@ -152,15 +152,15 @@ function render_recent_changes($recent_changes)
end($rchange_results); end($rchange_results);
$rchange_last = $recent_changes[key($rchange_results)]; $rchange_last = $recent_changes[key($rchange_results)];
$pageDisplayHtml = render_rchange_pagename($rchange_first); $pageDisplayHtml = render_pagename($rchange_first);
$timeDisplayHtml = render_rchange_timestamp($rchange_first->timestamp); $timeDisplayHtml = render_timestamp($rchange_first->timestamp);
$users = []; $users = [];
foreach($rchange_results as $key => $rchange_result) foreach($rchange_results as $key => $rchange_result)
{ {
if(!in_array($recent_changes[$key]->user, $users)) if(!in_array($recent_changes[$key]->user, $users))
$users[] = $recent_changes[$key]->user; $users[] = $recent_changes[$key]->user;
} }
$userDisplayHtml = render_rchange_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: COllect up and render a list of participating users // TODO: COllect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
@ -181,9 +181,9 @@ function render_recent_changes($recent_changes)
function render_recent_change($rchange) function render_recent_change($rchange)
{ {
$pageDisplayHtml = render_rchange_pagename($rchange); $pageDisplayHtml = render_pagename($rchange);
$editorDisplayHtml = render_rchange_editor($rchange->user); $editorDisplayHtml = render_editor($rchange->user);
$timeDisplayHtml = render_rchange_timestamp($rchange->timestamp); $timeDisplayHtml = render_timestamp($rchange->timestamp);
$result = ""; $result = "";
$resultClasses = []; $resultClasses = [];

View file

@ -79,7 +79,7 @@ register_module([
else else
{ {
$content .= "<h1>Revision #$revisionNumber of $env->page</h1>\n"; $content .= "<h1>Revision #$revisionNumber of $env->page</h1>\n";
$content .= "<p class='revision-note'><em>(Revision created by $revisionData->editor " . render_rchange_timestamp($revisionData->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n"; $content .= "<p class='revision-note'><em>(Revision created by $revisionData->editor " . render_timestamp($revisionData->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
} }
// Add an extra message if the requester was redirected from another page // Add an extra message if the requester was redirected from another page