"Page list", "version" => "0.9", "author" => "Starbeamrainbowlabs", "description" => "Adds a page that lists all the pages in the index along with their metadata.", "id" => "page-list", "code" => function() { global $settings; /* * ██ ██ ███████ ████████ * ██ ██ ██ ██ * ██ ██ ███████ ██ * ██ ██ ██ ██ * ███████ ██ ███████ ██ */ add_action("list", function() { global $pageindex, $settings; $title = "All Pages"; $content = "

$title on $settings->sitename

"; $sorted_pageindex = get_object_vars($pageindex); ksort($sorted_pageindex, SORT_NATURAL); $content .= generate_page_list(array_keys($sorted_pageindex)); exit(page_renderer::render_main("$title - $settings->sitename", $content)); }); /* * ██ ██ ███████ ████████ ████████ █████ ██████ ███████ * ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██ ██ ███████ ██ █████ ██ ███████ ██ ███ ███████ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ███████ ██ ███████ ██ ██ ██ ██ ██████ ███████ */ add_action("list-tags", function() { global $pageindex, $settings; if(!isset($_GET["tag"])) { // Render a list of all tags $all_tags = []; foreach($pageindex as $entry) { if(!isset($entry->tags)) continue; foreach($entry->tags as $tag) { if(!in_array($tag, $all_tags)) $all_tags[] = $tag; } } $content = "

All tags

\n"; exit(page_renderer::render("All tags - $settings->sitename", $content)); } $tag = $_GET["tag"]; $sorted_pageindex = get_object_vars($pageindex); ksort($sorted_pageindex, SORT_NATURAL); $pagelist = []; foreach($pageindex as $pagename => $pagedetails) { if(empty($pagedetails->tags)) continue; if(in_array($tag, $pagedetails->tags)) $pagelist[] = $pagename; } $content = "

$tag

\n"; $content .= generate_page_list($pagelist); $content .= "

(All tags)

\n"; exit(page_renderer::render("$tag - Page List - $settings->sitename", $content)); }); add_help_section("30-all-pages-tags", "Listing pages and tags", "

All the pages and tags on $settings->sitename are listed on a pair of pages to aid navigation. The list of all pages on $settings->sitename can be found by clicking "All Pages" on the top bar. The list of all the tags currently in use can be found by clicking "All Tags" in the "More..." menu in the top right.

Each tag on either page can be clicked, and leads to a list of all pages that possess that particular tag.

Redirect pages are shown in italics. A page's last known editor is also shown next to each entry on a list of pages, along with the last known size (which should correct, unless it was changed outside of $settings->sitename) and the time since the last modification (hovering over this will show the exact time that the last modification was made in a tooltip).

"); } ]); function generate_page_list($pagelist) { global $pageindex; // ✎ ✎ 🕒 🕒 $result = "\n"; return $result; } ?>