Bugfix: Don't throw warnings if interwiki links aren't configured

This commit is contained in:
Starbeamrainbowlabs 2019-01-24 23:47:43 +00:00
parent c40d1a1016
commit 91a9c44b8f
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 22 additions and 18 deletions

View File

@ -409,7 +409,7 @@ if($settings->sessionprefix == "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.18-dev";
$commit = "524efcc43d6e7612a326855b10c7dfe8a2c745e1";
$commit = "c40d1a1016eb1c981a1d549fa40a15686ac807f9";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -3568,8 +3568,9 @@ register_module([
$env->interwiki_index = json_decode(file_get_contents($paths->interwiki_index));
}
// TODO: Fill this in
$doc_help = <<<HELP_BLOCK
$doc_help = "<p>$settings->sitename doesn't currently support interwiki links, but if you'd like it to, please contact $settings->admindetails_name ($settings->sitename's administrator) through their contact details at the bottom of every page and point them at <a href='https://starbeamrainbowlabs.com/labs/peppermint/_docpress/06.5-Interwiki-Links.html'>the documentation on how to set it up</a>. It's really easy, and they can always <a href='https://github.com/sbrl/Pepperminty-Wiki/issues/new'>open an issue</a> if they get stuck :-)</p>\n";
if(!empty($env->interwiki_index)) {
$doc_help = <<<HELP_BLOCK
<p>$settings->sitename supports inter-wiki links. Such a link sends the user elsewhere on the internet. By prefixing a page name with a prefix, the convenience of the internal link syntax described above can be exploited to send users elsewhere without having to type out full urls! Here are few examples (note that these prefixes are only examples, and probably aren't available on $settings->sitename - check the list below for supported prefixes):</p>
<pre><code>[[another_wiki:Apples]]
@ -3580,11 +3581,12 @@ register_module([
<p>Note that unlike normal internal links, the page name is case-sensitive and can't be case-corrected automatically. The wikis supported by $settings->sitename are as follows:</p>
HELP_BLOCK;
$doc_help .= "<table><tr><th>Name</th><th>Prefix</th>\n";
foreach($env->interwiki_index as $interwiki_def)
$doc_help .= "<tr><td>$interwiki_def->name</td><td><code>$interwiki_def->prefix</code></td></tr>\n";
$doc_help .= "</table>";
$doc_help .= "<table><tr><th>Name</th><th>Prefix</th>\n";
foreach($env->interwiki_index as $interwiki_def)
$doc_help .= "<tr><td>$interwiki_def->name</td><td><code>$interwiki_def->prefix</code></td></tr>\n";
$doc_help .= "</table>";
}
add_help_section("22-interwiki-links", "Interwiki Links", $doc_help);
}

View File

@ -86,7 +86,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds interwiki link support. Set the interwiki_index_location setting at an index file to activate support.",
"id": "feature-interwiki-links",
"lastupdate": 1546726332,
"lastupdate": 1548373606,
"optional": false
},
{
@ -95,7 +95,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes",
"lastupdate": 1548364500,
"lastupdate": 1548364510,
"optional": false
},
{
@ -212,7 +212,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds a page that lists all the pages in the index along with their metadata.",
"id": "page-list",
"lastupdate": 1518645476,
"lastupdate": 1548364613,
"optional": false
},
{

View File

@ -16,8 +16,9 @@ register_module([
$env->interwiki_index = json_decode(file_get_contents($paths->interwiki_index));
}
// TODO: Fill this in
$doc_help = <<<HELP_BLOCK
$doc_help = "<p>$settings->sitename doesn't currently support interwiki links, but if you'd like it to, please contact $settings->admindetails_name ($settings->sitename's administrator) through their contact details at the bottom of every page and point them at <a href='https://starbeamrainbowlabs.com/labs/peppermint/_docpress/06.5-Interwiki-Links.html'>the documentation on how to set it up</a>. It's really easy, and they can always <a href='https://github.com/sbrl/Pepperminty-Wiki/issues/new'>open an issue</a> if they get stuck :-)</p>\n";
if(!empty($env->interwiki_index)) {
$doc_help = <<<HELP_BLOCK
<p>$settings->sitename supports inter-wiki links. Such a link sends the user elsewhere on the internet. By prefixing a page name with a prefix, the convenience of the internal link syntax described above can be exploited to send users elsewhere without having to type out full urls! Here are few examples (note that these prefixes are only examples, and probably aren't available on $settings->sitename - check the list below for supported prefixes):</p>
<pre><code>[[another_wiki:Apples]]
@ -28,11 +29,12 @@ register_module([
<p>Note that unlike normal internal links, the page name is case-sensitive and can't be case-corrected automatically. The wikis supported by $settings->sitename are as follows:</p>
HELP_BLOCK;
$doc_help .= "<table><tr><th>Name</th><th>Prefix</th>\n";
foreach($env->interwiki_index as $interwiki_def)
$doc_help .= "<tr><td>$interwiki_def->name</td><td><code>$interwiki_def->prefix</code></td></tr>\n";
$doc_help .= "</table>";
$doc_help .= "<table><tr><th>Name</th><th>Prefix</th>\n";
foreach($env->interwiki_index as $interwiki_def)
$doc_help .= "<tr><td>$interwiki_def->name</td><td><code>$interwiki_def->prefix</code></td></tr>\n";
$doc_help .= "</table>";
}
add_help_section("22-interwiki-links", "Interwiki Links", $doc_help);
}