Revert "Merge tag 'v2.10.6'"
This reverts commit122ea4ab9e
, reversing changes made toc54a11e250
.
This commit is contained in:
@@ -6,10 +6,9 @@ namespace Shimmie2;
|
||||
|
||||
class HelpPageListBuildingEvent extends Event
|
||||
{
|
||||
/** @var array<string,string> */
|
||||
public array $pages = [];
|
||||
|
||||
public function add_page(string $key, string $name): void
|
||||
public function add_page(string $key, string $name)
|
||||
{
|
||||
$this->pages[$key] = $name;
|
||||
}
|
||||
@@ -18,7 +17,6 @@ class HelpPageListBuildingEvent extends Event
|
||||
class HelpPageBuildingEvent extends Event
|
||||
{
|
||||
public string $key;
|
||||
/** @var array<int,Block> */
|
||||
public array $blocks = [];
|
||||
|
||||
public function __construct(string $key)
|
||||
@@ -27,12 +25,12 @@ class HelpPageBuildingEvent extends Event
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
public function add_block(Block $block, int $position = 50): void
|
||||
public function add_block(Block $block, int $position = 50)
|
||||
{
|
||||
while (array_key_exists($position, $this->blocks)) {
|
||||
$position++;
|
||||
if (!array_key_exists("$position", $this->blocks)) {
|
||||
$this->blocks["$position"] = [];
|
||||
}
|
||||
$this->blocks[$position] = $block;
|
||||
$this->blocks["$position"][] = $block;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +40,7 @@ class HelpPages extends Extension
|
||||
protected Themelet $theme;
|
||||
public const SEARCH = "search";
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event): void
|
||||
public function onPageRequest(PageRequestEvent $event)
|
||||
{
|
||||
global $page;
|
||||
|
||||
@@ -65,43 +63,46 @@ class HelpPages extends Extension
|
||||
$this->theme->display_help_page($title);
|
||||
|
||||
$hpbe = send_event(new HelpPageBuildingEvent($name));
|
||||
ksort($hpbe->blocks);
|
||||
foreach ($hpbe->blocks as $block) {
|
||||
$page->add_block($block);
|
||||
asort($hpbe->blocks);
|
||||
|
||||
foreach ($hpbe->blocks as $key=>$value) {
|
||||
foreach ($value as $block) {
|
||||
$page->add_block($block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onHelpPageListBuilding(HelpPageListBuildingEvent $event): void
|
||||
public function onHelpPageListBuilding(HelpPageListBuildingEvent $event)
|
||||
{
|
||||
$event->add_page("search", "Searching");
|
||||
$event->add_page("licenses", "Licenses");
|
||||
}
|
||||
|
||||
public function onPageNavBuilding(PageNavBuildingEvent $event): void
|
||||
public function onPageNavBuilding(PageNavBuildingEvent $event)
|
||||
{
|
||||
$event->add_nav_link("help", new Link('help'), "Help");
|
||||
}
|
||||
|
||||
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event): void
|
||||
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event)
|
||||
{
|
||||
if ($event->parent == "help") {
|
||||
if ($event->parent=="help") {
|
||||
$pages = send_event(new HelpPageListBuildingEvent())->pages;
|
||||
foreach ($pages as $key => $value) {
|
||||
foreach ($pages as $key=>$value) {
|
||||
$event->add_nav_link("help_".$key, new Link('help/'.$key), $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onUserBlockBuilding(UserBlockBuildingEvent $event): void
|
||||
public function onUserBlockBuilding(UserBlockBuildingEvent $event)
|
||||
{
|
||||
$event->add_link("Help", make_link("help"));
|
||||
}
|
||||
|
||||
public function onHelpPageBuilding(HelpPageBuildingEvent $event): void
|
||||
public function onHelpPageBuilding(HelpPageBuildingEvent $event)
|
||||
{
|
||||
if ($event->key == "licenses") {
|
||||
if ($event->key=="licenses") {
|
||||
$block = new Block("Software Licenses");
|
||||
$block->body = "The code in Shimmie is contributed by numerous authors under multiple licenses. For reference, these licenses are listed below. The base software is in general licensed under the GPLv2 license.";
|
||||
$event->add_block($block);
|
||||
|
Reference in New Issue
Block a user