diff --git a/core.php b/core.php index 9676138..8c1851a 100644 --- a/core.php +++ b/core.php @@ -228,7 +228,7 @@ function hide_email($str) return $hidden_email; } -//Work around an Opera + Syntastic bug where there is no margin at the left hand side if there isn't a query string when accessing a .php file +// Work around an Opera + Syntastic bug where there is no margin at the left hand side if there isn't a query string when accessing a .php file if(!isset($_GET["action"]) and !isset($_GET["page"])) { http_response_code(302); @@ -236,14 +236,14 @@ if(!isset($_GET["action"]) and !isset($_GET["page"])) exit(); } -//make sure that the action is set +// Make sure that the action is set if(!isset($_GET["action"])) $_GET["action"] = $settings->defaultaction; -//make sure that the page is set +// Make sure that the page is set if(!isset($_GET["page"]) or strlen($_GET["page"]) === 0) $_GET["page"] = $settings->defaultpage; -//redirect the user to the safe version of the path if they entered an unsafe character +// Redirect the user to the safe version of the path if they entered an unsafe character if(makepathsafe($_GET["page"]) !== $_GET["page"]) { http_response_code(301); @@ -376,12 +376,12 @@ class page_renderer else $result .= "\t\t\tBrowsing as Anonymous. Login. | \n"; - // loop over all the navigation links + // Loop over all the navigation links foreach($settings->navlinks as $item) { if(is_string($item)) { - //the item is a string + // The item is a string switch($item) { //keywords @@ -389,14 +389,14 @@ class page_renderer $result .= "\t\t\t
\n"; break; - //it isn't a keyword, so just output it directly + // It isn't a keyword, so just output it directly default: $result .= "\t\t\t$item\n"; } } else { - //output the item as a link to a url + // Output the item as a link to a url $result .= "\t\t\t$item[0]\n"; } } @@ -470,8 +470,8 @@ function human_time_since($time) // register themselves // // or new pages. // ////////////////////////// -$modules = []; // list that contains all the loaded modules -// function to register a module +$modules = []; // List that contains all the loaded modules +// Function to register a module function register_module($moduledata) { global $modules; @@ -480,7 +480,7 @@ function register_module($moduledata) $modules[] = $moduledata; } -// function to register an action handler +// Function to register an action handler $actions = new stdClass(); function add_action($action_name, $func) { @@ -506,12 +506,12 @@ function add_parser($parser_code) // %next_module% // -// execute each module's code +// Execute each module's code foreach($modules as $moduledata) { $moduledata["code"](); } -// make sure that the credits page exists +// Make sure that the credits page exists if(!isset($actions->credits)) { exit(page_renderer::render_main("Error - $settings->$sitename", "

No credits page detected. The credits page is a required module!

")); diff --git a/index.php b/index.php index 8ddd7fa..7abd049 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,8 @@ $start_time = time(true); * Code by @Starbeamrainbowlabs * Slimdown - by Johnny Broadway from https://gist.github.com/jbroadway/2836900 * Bug reports: - * #1 - Incorrect closing tag - nibreh + * #2 - Incorrect closing tag - nibreh + * #8 - Rogue tag - nibreh */ // Initialises a new object to store your wiki's settings in. Please don't touch this. $settings = new stdClass(); @@ -382,7 +383,7 @@ function hide_email($str) return $hidden_email; } -//Work around an Opera + Syntastic bug where there is no margin at the left hand side if there isn't a query string when accessing a .php file +// Work around an Opera + Syntastic bug where there is no margin at the left hand side if there isn't a query string when accessing a .php file if(!isset($_GET["action"]) and !isset($_GET["page"])) { http_response_code(302); @@ -390,14 +391,14 @@ if(!isset($_GET["action"]) and !isset($_GET["page"])) exit(); } -//make sure that the action is set +// Make sure that the action is set if(!isset($_GET["action"])) $_GET["action"] = $settings->defaultaction; -//make sure that the page is set +// Make sure that the page is set if(!isset($_GET["page"]) or strlen($_GET["page"]) === 0) $_GET["page"] = $settings->defaultpage; -//redirect the user to the safe version of the path if they entered an unsafe character +// Redirect the user to the safe version of the path if they entered an unsafe character if(makepathsafe($_GET["page"]) !== $_GET["page"]) { http_response_code(301); @@ -530,12 +531,12 @@ class page_renderer else $result .= "\t\t\tBrowsing as Anonymous. Login. | \n"; - // loop over all the navigation links + // Loop over all the navigation links foreach($settings->navlinks as $item) { if(is_string($item)) { - //the item is a string + // The item is a string switch($item) { //keywords @@ -543,14 +544,14 @@ class page_renderer $result .= "\t\t\t
\n"; break; - //it isn't a keyword, so just output it directly + // It isn't a keyword, so just output it directly default: $result .= "\t\t\t$item\n"; } } else { - //output the item as a link to a url + // Output the item as a link to a url $result .= "\t\t\t$item[0]\n"; } } @@ -624,8 +625,8 @@ function human_time_since($time) // register themselves // // or new pages. // ////////////////////////// -$modules = []; // list that contains all the loaded modules -// function to register a module +$modules = []; // List that contains all the loaded modules +// Function to register a module function register_module($moduledata) { global $modules; @@ -634,7 +635,7 @@ function register_module($moduledata) $modules[] = $moduledata; } -// function to register an action handler +// Function to register an action handler $actions = new stdClass(); function add_action($action_name, $func) { @@ -685,21 +686,59 @@ register_module([ register_module([ "name" => "Credits", - "version" => "0.5", + "version" => "0.6", "author" => "Starbeamrainbowlabs", "description" => "Adds the credits page. You *must* have this module :D", "id" => "page-credits", "code" => function() { add_action("credits", function() { - global $settings, $version; + global $settings, $version, $pageindex, $modules; + + + $credits = [ + "Code" => [ + "author" => "Starbeamrainbowlabs", + "author_url" => "https://starbeamrmainbowlabs.com/", + "thing_url" => "https://github.com/sbrl/Pepprminty-Wiki" + ], + "Slightly modified version of Slimdown" => [ + "author" => "Johnny Broadway", + "author_url" => "https://github.com/jbroadway", + "thing_url" => "https://gist.github.com/jbroadway/2836900" + ], + "Default Favicon" => [ + "author" => "bluefrog23", + "author_url" => "https://openclipart.org/user-detail/bluefrog23/", + "thing_url" => "https://openclipart.org/detail/19571/peppermint-candy-by-bluefrog23" + ], + "Bug Reports" => [ + "author" => "nibreh", + "author_url" => "https://github.com/nibreh/", + "thing_url" => "" + ] + ]; + $credits_html = "
    \n"; + foreach($credits as $thing => $author_details) + { + $credits_html .= "
  • "; + $credits_html .= "$thing by "; + $credits_html .= "" . $author_details["author"] . ""; + $credits_html .= "
  • \n"; + } + $credits_html .= "
"; $title = "Credits - $settings->sitename"; $content = "

$settings->sitename credits

-

$settings->sitename is powered by Pepperminty Wiki - an entire wiki packed inside a single file, which was built by Starbeamrainbowlabs, and can be found on github (contributors will ablso be listed here in the future).

-

A slightly modified version of slimdown is used to parse text source into HTML. Slimdown is by Johnny Broadway, which can be found on github.

-

The default favicon is from Open Clipart by bluefrog23, and can be found here.

-

Administrators can update $settings->sitename here: Update $settings->sitename.

-

$settings->sitename is currently running on Pepperminty Wiki $version

"; +

$settings->sitename is powered by Pepperminty Wiki - an entire wiki packed inside a single file, which was built by Starbeamrainbowlabs, and can be found on github (contributors will ablso be listed here in the future).

+

Main Credits

+ $credits_html +

Site status

+ + + + + +
Site name:$settings->sitename (Update - Administrators only)
Pepperminty Wiki version:$version
Number of pages:" . count(get_object_vars($pageindex)) . "
Number of modules:" . count($modules) . "
"; exit(page_renderer::render_main($title, $content)); }); } @@ -1406,12 +1445,12 @@ class Slimdown { // %next_module% // -// execute each module's code +// Execute each module's code foreach($modules as $moduledata) { $moduledata["code"](); } -// make sure that the credits page exists +// Make sure that the credits page exists if(!isset($actions->credits)) { exit(page_renderer::render_main("Error - $settings->$sitename", "

No credits page detected. The credits page is a required module!

")); diff --git a/module_index.json b/module_index.json index 56f9954..9ddd71e 100644 --- a/module_index.json +++ b/module_index.json @@ -9,11 +9,11 @@ }, { "name": "Credits", - "version": "0.5", + "version": "0.6", "author": "Starbeamrainbowlabs", "description": "Adds the credits page. You *must* have this module :D", "id": "page-credits", - "lastupdate": 1432497591 + "lastupdate": 1436886691 }, { "name": "Page deleter", diff --git a/modules/page-credits.php b/modules/page-credits.php index bc7f09d..85b809b 100644 --- a/modules/page-credits.php +++ b/modules/page-credits.php @@ -1,21 +1,59 @@ "Credits", - "version" => "0.5", + "version" => "0.6", "author" => "Starbeamrainbowlabs", "description" => "Adds the credits page. You *must* have this module :D", "id" => "page-credits", "code" => function() { add_action("credits", function() { - global $settings, $version; + global $settings, $version, $pageindex, $modules; + + + $credits = [ + "Code" => [ + "author" => "Starbeamrainbowlabs", + "author_url" => "https://starbeamrmainbowlabs.com/", + "thing_url" => "https://github.com/sbrl/Pepprminty-Wiki" + ], + "Slightly modified version of Slimdown" => [ + "author" => "Johnny Broadway", + "author_url" => "https://github.com/jbroadway", + "thing_url" => "https://gist.github.com/jbroadway/2836900" + ], + "Default Favicon" => [ + "author" => "bluefrog23", + "author_url" => "https://openclipart.org/user-detail/bluefrog23/", + "thing_url" => "https://openclipart.org/detail/19571/peppermint-candy-by-bluefrog23" + ], + "Bug Reports" => [ + "author" => "nibreh", + "author_url" => "https://github.com/nibreh/", + "thing_url" => "" + ] + ]; + $credits_html = "
    \n"; + foreach($credits as $thing => $author_details) + { + $credits_html .= "
  • "; + $credits_html .= "$thing by "; + $credits_html .= "" . $author_details["author"] . ""; + $credits_html .= "
  • \n"; + } + $credits_html .= "
"; $title = "Credits - $settings->sitename"; $content = "

$settings->sitename credits

-

$settings->sitename is powered by Pepperminty Wiki - an entire wiki packed inside a single file, which was built by Starbeamrainbowlabs, and can be found on github (contributors will ablso be listed here in the future).

-

A slightly modified version of slimdown is used to parse text source into HTML. Slimdown is by Johnny Broadway, which can be found on github.

-

The default favicon is from Open Clipart by bluefrog23, and can be found here.

-

Administrators can update $settings->sitename here: Update $settings->sitename.

-

$settings->sitename is currently running on Pepperminty Wiki $version

"; +

$settings->sitename is powered by Pepperminty Wiki - an entire wiki packed inside a single file, which was built by Starbeamrainbowlabs, and can be found on github (contributors will ablso be listed here in the future).

+

Main Credits

+ $credits_html +

Site status

+ + + + + +
Site name:$settings->sitename (Update - Administrators only)
Pepperminty Wiki version:$version
Number of pages:" . count(get_object_vars($pageindex)) . "
Number of modules:" . count($modules) . "
"; exit(page_renderer::render_main($title, $content)); }); } diff --git a/settings.fragment.php b/settings.fragment.php index b185eae..3c9ce48 100644 --- a/settings.fragment.php +++ b/settings.fragment.php @@ -9,7 +9,8 @@ * Code by @Starbeamrainbowlabs * Slimdown - by Johnny Broadway from https://gist.github.com/jbroadway/2836900 * Bug reports: - * #1 - Incorrect closing tag - nibreh + * #2 - Incorrect closing tag - nibreh + * #8 - Rogue tag - nibreh */ // Initialises a new object to store your wiki's settings in. Please don't touch this. $settings = new stdClass();