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

Enhance display of orphaned pages list

This commit is contained in:
Starbeamrainbowlabs 2018-04-26 23:51:41 +01:00
parent c6a3ce16df
commit be1fa80959
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 14 additions and 12 deletions

View file

@ -387,7 +387,7 @@ if($settings->css === "auto")
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */ /** The version of Pepperminty Wiki currently running. */
$version = "v0.16-dev"; $version = "v0.16-dev";
$commit = "0c00cf36316ba33f9acf4013e9ddee02ed4191d4"; $commit = "c6a3ce16df9886c0135bd8ed36efa3df7cc376a1";
/// Environment /// /// Environment ///
/** Holds information about the current request environment. */ /** Holds information about the current request environment. */
$env = new stdClass(); $env = new stdClass();
@ -7992,9 +7992,8 @@ register_module([
$result = new stdClass(); // completed, value, state $result = new stdClass(); // completed, value, state
$pages = []; $pages = [];
foreach($pageindex as $pagename => $pagedata) { foreach($pageindex as $pagename => $pagedata) {
if(!file_exists($env->storage_prefix . $pagedata->filename)) { if(!file_exists($env->storage_prefix . $pagedata->filename))
continue; continue;
}
$page_content = file_get_contents($env->storage_prefix . $pagedata->filename); $page_content = file_get_contents($env->storage_prefix . $pagedata->filename);
$page_links = PeppermintParsedown::extract_page_names($page_content); $page_links = PeppermintParsedown::extract_page_names($page_content);
@ -8037,9 +8036,8 @@ register_module([
$result = new stdClass(); // completed, value, state $result = new stdClass(); // completed, value, state
$pages = []; $pages = [];
foreach($pageindex as $pagename => $pagedata) { foreach($pageindex as $pagename => $pagedata) {
if(!file_exists($env->storage_prefix . $pagedata->filename)) { if(!file_exists($env->storage_prefix . $pagedata->filename))
continue; continue;
}
$page_content = file_get_contents($env->storage_prefix . $pagedata->filename); $page_content = file_get_contents($env->storage_prefix . $pagedata->filename);
$page_links = PeppermintParsedown::extract_page_names($page_content); $page_links = PeppermintParsedown::extract_page_names($page_content);
@ -8065,10 +8063,13 @@ register_module([
return $result; return $result;
}, },
"render" => function($stats_data) { "render" => function($stats_data) {
global $pageindex;
$result = "<h2>$stats_data->name</h2>\n"; $result = "<h2>$stats_data->name</h2>\n";
$result .= "<p><strong>Count:</strong> " . count($stats_data->value) . "</p>\n";
$result .= "<ul class='orphan-pages'>\n"; $result .= "<ul class='orphan-pages'>\n";
foreach($stats_data->value as $pagename) { foreach($stats_data->value as $pagename) {
$result .= "\t<li>$pagename</li>\n"; $pagename_display = !empty($pageindex->$pagename->redirect) && $pageindex->$pagename->redirect ? "<em>$pagename</em>" : $pagename;
$result .= "\t<li><a href='?page=" . rawurlencode($pagename) . "'>$pagename_display</a></li>\n";
} }
$result .= "</ul>\n"; $result .= "</ul>\n";
return $result; return $result;

View file

@ -266,7 +266,7 @@
"author": "Emanuil Rusev & Starbeamrainbowlabs", "author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.", "description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation, and also *requires* write access to the disk on first load.",
"id": "parser-parsedown", "id": "parser-parsedown",
"lastupdate": 1524781555, "lastupdate": 1524783071,
"optional": false "optional": false
} }
] ]

View file

@ -32,9 +32,8 @@ register_module([
$result = new stdClass(); // completed, value, state $result = new stdClass(); // completed, value, state
$pages = []; $pages = [];
foreach($pageindex as $pagename => $pagedata) { foreach($pageindex as $pagename => $pagedata) {
if(!file_exists($env->storage_prefix . $pagedata->filename)) { if(!file_exists($env->storage_prefix . $pagedata->filename))
continue; continue;
}
$page_content = file_get_contents($env->storage_prefix . $pagedata->filename); $page_content = file_get_contents($env->storage_prefix . $pagedata->filename);
$page_links = PeppermintParsedown::extract_page_names($page_content); $page_links = PeppermintParsedown::extract_page_names($page_content);
@ -77,9 +76,8 @@ register_module([
$result = new stdClass(); // completed, value, state $result = new stdClass(); // completed, value, state
$pages = []; $pages = [];
foreach($pageindex as $pagename => $pagedata) { foreach($pageindex as $pagename => $pagedata) {
if(!file_exists($env->storage_prefix . $pagedata->filename)) { if(!file_exists($env->storage_prefix . $pagedata->filename))
continue; continue;
}
$page_content = file_get_contents($env->storage_prefix . $pagedata->filename); $page_content = file_get_contents($env->storage_prefix . $pagedata->filename);
$page_links = PeppermintParsedown::extract_page_names($page_content); $page_links = PeppermintParsedown::extract_page_names($page_content);
@ -105,10 +103,13 @@ register_module([
return $result; return $result;
}, },
"render" => function($stats_data) { "render" => function($stats_data) {
global $pageindex;
$result = "<h2>$stats_data->name</h2>\n"; $result = "<h2>$stats_data->name</h2>\n";
$result .= "<p><strong>Count:</strong> " . count($stats_data->value) . "</p>\n";
$result .= "<ul class='orphan-pages'>\n"; $result .= "<ul class='orphan-pages'>\n";
foreach($stats_data->value as $pagename) { foreach($stats_data->value as $pagename) {
$result .= "\t<li>$pagename</li>\n"; $pagename_display = !empty($pageindex->$pagename->redirect) && $pageindex->$pagename->redirect ? "<em>$pagename</em>" : $pagename;
$result .= "\t<li><a href='?page=" . rawurlencode($pagename) . "'>$pagename_display</a></li>\n";
} }
$result .= "</ul>\n"; $result .= "</ul>\n";
return $result; return $result;