mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
page_renderer: reeduce indenting a bit
This commit is contained in:
parent
5b670f5981
commit
0ac2f24b5f
2 changed files with 99 additions and 115 deletions
|
@ -409,7 +409,7 @@ if($settings->sessionprefix == "auto")
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
/** The version of Pepperminty Wiki currently running. */
|
||||
$version = "v0.18-dev";
|
||||
$commit = "1765f410e6b899d17f7885217235dd3653ba80f6";
|
||||
$commit = "5b670f59812ff1341195ad1be8eadcd3014b795f";
|
||||
/// Environment ///
|
||||
/** Holds information about the current request environment. */
|
||||
$env = new stdClass();
|
||||
|
@ -1859,10 +1859,13 @@ class page_renderer
|
|||
$result = "<nav class='$class'>\n";
|
||||
|
||||
// Loop over all the navigation links
|
||||
foreach($nav_links as $item)
|
||||
{
|
||||
if(is_string($item))
|
||||
{
|
||||
foreach($nav_links as $item) {
|
||||
if(!is_string($item)) {
|
||||
// Output the item as a link to a url
|
||||
$result .= "<span><a href='" . str_replace("{page}", rawurlencode($env->page), $item[1]) . "'>$item[0]</a></span>";
|
||||
continue;
|
||||
}
|
||||
|
||||
// The item is a string
|
||||
switch($item)
|
||||
{
|
||||
|
@ -1905,12 +1908,6 @@ class page_renderer
|
|||
$result .= "<span>$item</span>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output the item as a link to a url
|
||||
$result .= "<span><a href='" . str_replace("{page}", rawurlencode($env->page), $item[1]) . "'>$item[0]</a></span>";
|
||||
}
|
||||
}
|
||||
|
||||
$result .= "</nav>";
|
||||
return $result;
|
||||
|
@ -1921,8 +1918,7 @@ class page_renderer
|
|||
* @param string $name The username to render.
|
||||
* @return string The username rendered in HTML.
|
||||
*/
|
||||
public static function render_username($name)
|
||||
{
|
||||
public static function render_username($name) {
|
||||
global $settings;
|
||||
$result = "";
|
||||
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>";
|
||||
|
@ -1943,20 +1939,16 @@ class page_renderer
|
|||
* @package core
|
||||
* @return string The search box datalist as HTML.
|
||||
*/
|
||||
public static function generate_all_pages_datalist()
|
||||
{
|
||||
public static function generate_all_pages_datalist() {
|
||||
global $settings, $pageindex;
|
||||
$arrayPageIndex = get_object_vars($pageindex);
|
||||
ksort($arrayPageIndex);
|
||||
$result = "<datalist id='allpages'>\n";
|
||||
|
||||
// If dynamic page sugggestions are enabled, then we should send a loading message instead.
|
||||
if($settings->dynamic_page_suggestion_count > 0)
|
||||
{
|
||||
if($settings->dynamic_page_suggestion_count > 0) {
|
||||
$result .= "<option value='Loading suggestions...' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
foreach($arrayPageIndex as $pagename => $pagedetails)
|
||||
{
|
||||
$escapedPageName = str_replace('"', '"', $pagename);
|
||||
|
|
30
core.php
30
core.php
|
@ -1460,10 +1460,13 @@ class page_renderer
|
|||
$result = "<nav class='$class'>\n";
|
||||
|
||||
// Loop over all the navigation links
|
||||
foreach($nav_links as $item)
|
||||
{
|
||||
if(is_string($item))
|
||||
{
|
||||
foreach($nav_links as $item) {
|
||||
if(!is_string($item)) {
|
||||
// Output the item as a link to a url
|
||||
$result .= "<span><a href='" . str_replace("{page}", rawurlencode($env->page), $item[1]) . "'>$item[0]</a></span>";
|
||||
continue;
|
||||
}
|
||||
|
||||
// The item is a string
|
||||
switch($item)
|
||||
{
|
||||
|
@ -1506,12 +1509,6 @@ class page_renderer
|
|||
$result .= "<span>$item</span>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output the item as a link to a url
|
||||
$result .= "<span><a href='" . str_replace("{page}", rawurlencode($env->page), $item[1]) . "'>$item[0]</a></span>";
|
||||
}
|
||||
}
|
||||
|
||||
$result .= "</nav>";
|
||||
return $result;
|
||||
|
@ -1522,8 +1519,7 @@ class page_renderer
|
|||
* @param string $name The username to render.
|
||||
* @return string The username rendered in HTML.
|
||||
*/
|
||||
public static function render_username($name)
|
||||
{
|
||||
public static function render_username($name) {
|
||||
global $settings;
|
||||
$result = "";
|
||||
$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>";
|
||||
|
@ -1544,20 +1540,16 @@ class page_renderer
|
|||
* @package core
|
||||
* @return string The search box datalist as HTML.
|
||||
*/
|
||||
public static function generate_all_pages_datalist()
|
||||
{
|
||||
public static function generate_all_pages_datalist() {
|
||||
global $settings, $pageindex;
|
||||
$arrayPageIndex = get_object_vars($pageindex);
|
||||
ksort($arrayPageIndex);
|
||||
$result = "<datalist id='allpages'>\n";
|
||||
|
||||
// If dynamic page sugggestions are enabled, then we should send a loading message instead.
|
||||
if($settings->dynamic_page_suggestion_count > 0)
|
||||
{
|
||||
if($settings->dynamic_page_suggestion_count > 0) {
|
||||
$result .= "<option value='Loading suggestions...' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
foreach($arrayPageIndex as $pagename => $pagedetails)
|
||||
{
|
||||
$escapedPageName = str_replace('"', '"', $pagename);
|
||||
|
|
Loading…
Reference in a new issue