From 3ec7722453515a68f6010b113d9637edc64ef0cd Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 18 Jun 2017 12:00:40 +0100 Subject: [PATCH] Initial avatar display! More coming soon, including a button on the user preferences page to the upload page :P --- Changelog.md | 5 +++++ build/index.php | 9 ++++++++- core.php | 6 +++++- peppermint.guiconfig.json | 2 ++ theme_default.css | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 0d6d9aa..1fc512a 100755 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,11 @@ - Initial open search support! - After visiting your wiki once, you'll be able to press `` when typing the path to your wiki to perform a search. - It'll only work if your wiki is at the top-level of a domain (subdomains are ok). This is a restriction of the protocol, not Pepperminty Wiki! + - Avatars! + - Gravatar is used if a user hasn't uploaded an avatar yet + - An identicon is rendered if a user hasn't specified an email address or uploaded a gravatar yet either + - Added `avatars_show` and `avatars_size` settings to control the displaying & size of rendered avatars. + - Added the `avatar` action, which 307 redirects to the appropriate avatar image ### Changed - Updated MathJax CDN link, as cdn.mathjax.org is being retired ([source](https://www.mathjax.org/cdn-shutting-down/)). diff --git a/build/index.php b/build/index.php index cf4a5b9..9cf71cc 100644 --- a/build/index.php +++ b/build/index.php @@ -155,6 +155,8 @@ $guiConfig = <<<'GUICONFIG' }}, "min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1}, "max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048}, + "avatars_show": {"type": "checkbox", "description": "Whether or not to show avatars requires the 'user-preferences' and 'upload' modules, though uploads themselvess can be turned off so long as all avatars have already been uploaded - it's only the 'preview' action that's actually used.", "default": true}, + "avatars_size": {"type": "number", "description": "The image size to render avatars at. Does not affect the size they're stored at - only the inline rendered size (e.g. on the recent changes page etc.)", "default": 32}, "search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200}, "search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10}, "search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3}, @@ -250,6 +252,7 @@ audio, video, img { max-width: 100%; } figure:not(.preview) { display: inline-block; } figure:not(.preview) > :first-child { display: block; } figcaption { text-align: center; } +.avatar { vertical-align: middle; } .printable { padding: 2rem; } @@ -1560,9 +1563,13 @@ class page_renderer { global $settings; $result = ""; + $result .= ""; + if($settings->avatars_show) + $result .= " "; if(in_array($name, $settings->admins)) $result .= $settings->admindisplaychar; - $result .= "" . htmlentities($name) . ""; + $result .= htmlentities($name); + $result .= ""; return $result; } diff --git a/core.php b/core.php index 352f99e..4efd15f 100644 --- a/core.php +++ b/core.php @@ -1214,9 +1214,13 @@ class page_renderer { global $settings; $result = ""; + $result .= ""; + if($settings->avatars_show) + $result .= " "; if(in_array($name, $settings->admins)) $result .= $settings->admindisplaychar; - $result .= "" . htmlentities($name) . ""; + $result .= htmlentities($name); + $result .= ""; return $result; } diff --git a/peppermint.guiconfig.json b/peppermint.guiconfig.json index 55eafdd..1264eaf 100644 --- a/peppermint.guiconfig.json +++ b/peppermint.guiconfig.json @@ -133,6 +133,8 @@ }}, "min_preview_size": {"type": "number", "description": "The minimum allowed size of generated preview images in pixels.", "default": 1}, "max_preview_size": {"type": "number", "description": "The maximum allowed size of generated preview images in pixels.", "default": 2048}, + "avatars_show": {"type": "checkbox", "description": "Whether or not to show avatars requires the 'user-preferences' and 'upload' modules, though uploads themselvess can be turned off so long as all avatars have already been uploaded - it's only the 'preview' action that's actually used.", "default": true}, + "avatars_size": {"type": "number", "description": "The image size to render avatars at. Does not affect the size they're stored at - only the inline rendered size (e.g. on the recent changes page etc.)", "default": 32}, "search_characters_context": {"type": "number", "description": "The number of characters that should be displayed either side of a matching term in the context below each search result.", "default": 200}, "search_title_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's title.", "default": 10}, "search_tags_matches_weighting": {"type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3}, diff --git a/theme_default.css b/theme_default.css index 8758fde..48a7f6a 100644 --- a/theme_default.css +++ b/theme_default.css @@ -41,6 +41,7 @@ audio, video, img { max-width: 100%; } figure:not(.preview) { display: inline-block; } figure:not(.preview) > :first-child { display: block; } figcaption { text-align: center; } +.avatar { vertical-align: middle; } .printable { padding: 2rem; }