From a09f29fbcf35cbcb01fcf272d25e76cea6651778 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Sat, 4 Jul 2020 02:31:15 -0400 Subject: [PATCH 1/6] Add clearfix to avoid overlap with bottom elements --- resources/mixins.less | 28 +++++++++++++++++++ .../skins.citizen.styles/common/content.less | 1 + 2 files changed, 29 insertions(+) diff --git a/resources/mixins.less b/resources/mixins.less index 65d756df..c8111348 100644 --- a/resources/mixins.less +++ b/resources/mixins.less @@ -155,3 +155,31 @@ box-shadow: 0 19px 38px rgba( 0, 0, 0, 0.075 ), 0 15px 12px rgba( 0, 0, 0, 0.055 ); // Dialogs } } + +// Borrowed from Mediawiki core 1.35 +// β€œClearfix Reloaded” Mixin +// The mixin is used on a container with floating children. +// Margin collapsing is a feature, not a bug, hence relying on `display: block` as default. +// With `.mixin-clearfix( @collapse: false; );` you call it to let `margin`s not collapse. +// See https://www.cssmojo.com/the-very-latest-clearfix-reloaded/ +// In future we might replace the `&:after` pseudo-element with +// `display: flow-root;` altogether. +// Support: Firefox 3.5+, Safari 4+, Chrome, Opera 15+, IE 8+ +.mixin-clearfix( @collapse: true ) { + &:after { + clear: both; + // Margin collapsing as feature. Apply it. + & when ( @collapse ) { + content: ''; + display: block; + } + } + // Margin collapsing as bug. Prevent it. + & when not ( @collapse ) { + &:before, + &:after { + content: ''; + display: table; + } + } +} diff --git a/resources/skins.citizen.styles/common/content.less b/resources/skins.citizen.styles/common/content.less index 603ea63a..339ade65 100644 --- a/resources/skins.citizen.styles/common/content.less +++ b/resources/skins.citizen.styles/common/content.less @@ -144,6 +144,7 @@ position: relative; .content-center; z-index: 0; + .mixin-clearfix(); p { overflow-wrap: break-word; From 8703b7bd7ce36f5d6e38a7af56cb34014bb89754 Mon Sep 17 00:00:00 2001 From: Hannes Kruse Date: Sun, 5 Jul 2020 14:33:01 +0200 Subject: [PATCH 2/6] Fix some typos Signed-off-by: Hannes Kruse --- README.md | 176 +++++++++++++++++++++++++++--------------------------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index dcde1865..048701ab 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,88 @@ -# Citizen -![](https://github.com/StarCitizenTools/mediawiki-skins-Citizen/workflows/MediaWiki%20CI/badge.svg) - -Citizen is a responsive skin for [MediaWiki](https://www.mediawiki.org) built by the [Star Citizen Wiki](https://starcitizen.tools) team. Although it is specifically built for the Star Citizen Wiki, the skin should be able to run on any Mediawiki installation that is 1.31 or higher. Due to resource constraints, we might not be able to provide full support for setups that are vastly different than us, but please feel free to submit patches or bug report! - -Live demo can be seen at the [Star Citizen Wiki](https://starcitizen.tools), more avaliable [here](https://wikiapiary.com/wiki/Skin:Citizen). - -## Notable features -* **Fully responsive skin**: Responsive and able to adapt to different screen sizes. πŸ“±πŸ’»πŸ–₯️ -* **Persistent ToC**: Access ToC anywhere in the article. ***Tracking require JS.*** πŸ”πŸ“– -* **Rich search suggestions**: More helpful search suggestions with images and descriptions. ***Require JS.*** πŸ”πŸ‘€ -* **Lazyload images**: Improve load time of your wiki and avoid unnessecary image downloads. ***Require JS.*** πŸš€ -* **Native light/dark mode support**: Respect OS and app configuration for light and dark mode. β˜€οΈπŸŒ™ -* **Webapp manifest**: Give a more app-like experience when user add your wiki to their home screen. πŸ“± -* **HTTP security response headers**: Enhance the security of your wiki from HTTP response headers. πŸ”’πŸ”‘ - -## Installation -1. [Download](https://github.com/StarCitizenTools/mediawiki-skins-Citizen/archive/master.zip) place the file(s) in a directory called `Citizen` in your `skins/` folder. -2. Add the following code at the bottom of your LocalSettings.php: -```php -wfLoadSkin( 'Citizen' ); -``` -3. **βœ”οΈDone** - Navigate to Special:Version on your wiki to verify that the skin is successfully installed. - -## Configurations -**The skin works out of the box without any configurations.** -The config flags allow more customization on the specific features in the skin. - -Note that: -* By default all security-related features are turned off to ensure maximum compatiability. -* If you have a lot of users that does not use javascript, it is recommended to turn off image lazyload as it requires javascript to display images properly. - -### Search suggestions -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableSearch` | Enable or disable rich search suggestions |`true` - enable; `false` - disable | `true` -`$wgCitizenSearchDescriptionSource` | Source of description text on search suggestions | `wikidata` - Use description provided by [WikibaseLib](Extension:WikibaseLib) or [ShortDescription](https://www.mediawiki.org/wiki/Extension:ShortDescription); `textextracts` - Use description provided by [TextExtracts](https://www.mediawiki.org/wiki/Extension:TextExtracts); `pagedescription` - Use description provided by [Description2](https://www.mediawiki.org/wiki/Extension:Description2) or any other extension that sets the `description` page property | `textextracts` -`$wgCitizenMaxSearchResults` | Max number of search suggestions | Integer > 0 | `6` - -### Image lazyload -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableLazyload` | Enable or disable image lazyloading | `true` - enable; `false` - disable | `true` -`$wgCitizenThumbnailSize` | Thumbnail size in pixels to use for lazy-loading placeholder | Integer > 0 | `10` - -### Security-related -#### Content Security Policy (CSP) -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableCSP` | Enable or disable [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy), as an alternative to [`$wgCSPHeader`](https://www.mediawiki.org/wiki/Manual:$wgCSPHeader) in Mediawiki 1.32+ | `true` - enable; `false` - disable | `false` -`$wgCitizenEnableCSPReportMode` | Enable or disable [CSP report only mode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only), overrides `$wgCitizenEnableCSP` | `true` - enable; `false` - disable | `false` -`$wgCitizenCSPDirective` | The string of yourr CSP directive | See the [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) page | - -#### HTTP Strict Transport Security (HSTS) -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableHSTS` | Enable or disable [HTTP Strict Transport Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security) | `true` - enable; `false` - disable | `false` -`$wgCitizenHSTSMaxAge` | Time in second that the browser should remember that a site is only to be accessed using HTTPS | Integer > 0 | `300` -`$wgCitizenHSTSIncludeSubdomains` | Apply HSTS to all of the site's subdomains | `true` - enable; `false` - disable | `false` -`$wgCitizenHSTSPreload` | Enable or disable [HSTS preload](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security#Preloading_Strict_Transport_Security) | `true` - enable; `false` - disable | `false` - -#### Other security headers -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableDenyXFrameOptions` | Enable or disable the deny [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) header | `true` - enable; `false` - disable | `false` -`$wgCitizenEnableXXSSProtection` | Enable or disable the [X-XSS-Protection header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection) | `true` - enable; `false` - disable | `false` -`$wgCitizenEnableStrictReferrerPolicy` | Enable or disable `strict-origin-when-cross-origin` [referrer policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy) header, should be used in conjunction with [`$wgReferrerPolicy`](https://www.mediawiki.org/wiki/Manual:$wgReferrerPolicy) as that only outputs the meta tags | `true` - enable; `false` - disable | `false` -`$wgCitizenEnableFeaturePolicy` | Enable or disable [Feature Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy) | `true` - enable; `false` - disable | `false` -`$wgCitizenFeaturePolicyDirective` | The string of your Feature Policy directive | See the [Feature Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy) page | - -### Webapp manifest -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenEnableManifest` | Enable or disable [web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) | `true` - enable; `false` - disable | `true` -`$wgCitizenManifestThemeColor` | [Theme color](https://developer.mozilla.org/en-US/docs/Web/Manifest/theme_color) of the web app manifest | Hex color code | `#11151d` -`$wgCitizenManifestBackgroundColor` | [Background color](https://developer.mozilla.org/en-US/docs/Web/Manifest/background_color) of the web app manifest | Hex color code | `#fff` - -### Miscellaneous -Name | Description | Values | Default -:--- | :--- | :--- | :--- -`$wgCitizenShowPageTools` | The condition of page tools visibility | `true` - always visible; `login` - visible to logged-in users; `permission` - visible to users with the right permissions | `true` -`$wgCitizenEnablePreconnect` | Enable or disable [preconnect to required origin](https://web.dev/uses-rel-preconnect/) | `true` - enable; `false` - disable | `false` -`$wgCitizenPreconnectURL` | The URL for preconnect to required origin | URL | -`$wgCitizenThemeColor` | The color defined in the `theme-color` meta tag | Hex color code | `#11151d` - -## Requirements -* [MediaWiki](https://www.mediawiki.org) 1.31 or later - +# Citizen +![](https://github.com/StarCitizenTools/mediawiki-skins-Citizen/workflows/MediaWiki%20CI/badge.svg) + +Citizen is a responsive skin for [MediaWiki](https://www.mediawiki.org) built by the [Star Citizen Wiki](https://starcitizen.tools) team. Although it is specifically built for the Star Citizen Wiki, the skin should be able to run on any Mediawiki installation that is 1.31 or higher. Due to resource constraints, we might not be able to provide full support for setups that are vastly different than us, but please feel free to submit patches or bug report! + +Live demo can be seen at the [Star Citizen Wiki](https://starcitizen.tools), more avaliable [here](https://wikiapiary.com/wiki/Skin:Citizen). + +## Notable features +* **Fully responsive skin**: Responsive and able to adapt to different screen sizes. πŸ“±πŸ’»πŸ–₯️ +* **Persistent ToC**: Access ToC anywhere in the article. ***Tracking require JS.*** πŸ”πŸ“– +* **Rich search suggestions**: More helpful search suggestions with images and descriptions. ***Require JS.*** πŸ”πŸ‘€ +* **Lazyload images**: Improve load time of your wiki and avoid unnecessary image downloads. ***Require JS.*** πŸš€ +* **Native light/dark mode support**: Respect OS and app configuration for light and dark mode. β˜€οΈπŸŒ™ +* **Webapp manifest**: Give a more app-like experience when user add your wiki to their home screen. πŸ“± +* **HTTP security response headers**: Enhance the security of your wiki from HTTP response headers. πŸ”’πŸ”‘ + +## Installation +1. [Download](https://github.com/StarCitizenTools/mediawiki-skins-Citizen/archive/master.zip) place the file(s) in a directory called `Citizen` in your `skins/` folder. +2. Add the following code at the bottom of your LocalSettings.php: +```php +wfLoadSkin( 'Citizen' ); +``` +3. **βœ”οΈDone** - Navigate to Special:Version on your wiki to verify that the skin is successfully installed. + +## Configurations +**The skin works out of the box without any configurations.** +The config flags allow more customization on the specific features in the skin. + +Note that: +* By default, all security-related features are turned off to ensure maximum compatibility. +* If you have a lot of users that do not use javascript, it is recommended to turn off lazyloading of images as it requires javascript to display images properly. + +### Search suggestions +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableSearch` | Enable or disable rich search suggestions |`true` - enable; `false` - disable | `true` +`$wgCitizenSearchDescriptionSource` | Source of description text on search suggestions | `wikidata` - Use description provided by [WikibaseLib](Extension:WikibaseLib) or [ShortDescription](https://www.mediawiki.org/wiki/Extension:ShortDescription); `textextracts` - Use description provided by [TextExtracts](https://www.mediawiki.org/wiki/Extension:TextExtracts); `pagedescription` - Use description provided by [Description2](https://www.mediawiki.org/wiki/Extension:Description2) or any other extension that sets the `description` page property | `textextracts` +`$wgCitizenMaxSearchResults` | Max number of search suggestions | Integer > 0 | `6` + +### Image lazyload +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableLazyload` | Enable or disable image lazyloading | `true` - enable; `false` - disable | `true` +`$wgCitizenThumbnailSize` | Thumbnail size in pixels to use for lazy-loading placeholder | Integer > 0 | `10` + +### Security-related +#### Content Security Policy (CSP) +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableCSP` | Enable or disable [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy), as an alternative to [`$wgCSPHeader`](https://www.mediawiki.org/wiki/Manual:$wgCSPHeader) in Mediawiki 1.32+ | `true` - enable; `false` - disable | `false` +`$wgCitizenEnableCSPReportMode` | Enable or disable [CSP report only mode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only), overrides `$wgCitizenEnableCSP` | `true` - enable; `false` - disable | `false` +`$wgCitizenCSPDirective` | The string of yourr CSP directive | See the [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) page | + +#### HTTP Strict Transport Security (HSTS) +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableHSTS` | Enable or disable [HTTP Strict Transport Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security) | `true` - enable; `false` - disable | `false` +`$wgCitizenHSTSMaxAge` | Time in second that the browser should remember that a site is only to be accessed using HTTPS | Integer > 0 | `300` +`$wgCitizenHSTSIncludeSubdomains` | Apply HSTS to all of the site's subdomains | `true` - enable; `false` - disable | `false` +`$wgCitizenHSTSPreload` | Enable or disable [HSTS preload](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security#Preloading_Strict_Transport_Security) | `true` - enable; `false` - disable | `false` + +#### Other security headers +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableDenyXFrameOptions` | Enable or disable the deny [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) header | `true` - enable; `false` - disable | `false` +`$wgCitizenEnableXXSSProtection` | Enable or disable the [X-XSS-Protection header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection) | `true` - enable; `false` - disable | `false` +`$wgCitizenEnableStrictReferrerPolicy` | Enable or disable `strict-origin-when-cross-origin` [referrer policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy) header, should be used in conjunction with [`$wgReferrerPolicy`](https://www.mediawiki.org/wiki/Manual:$wgReferrerPolicy) as that only outputs the meta tags | `true` - enable; `false` - disable | `false` +`$wgCitizenEnableFeaturePolicy` | Enable or disable [Feature Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy) | `true` - enable; `false` - disable | `false` +`$wgCitizenFeaturePolicyDirective` | The string of your Feature Policy directive | See the [Feature Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy) page | + +### Webapp manifest +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenEnableManifest` | Enable or disable [web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) | `true` - enable; `false` - disable | `true` +`$wgCitizenManifestThemeColor` | [Theme color](https://developer.mozilla.org/en-US/docs/Web/Manifest/theme_color) of the web app manifest | Hex color code | `#11151d` +`$wgCitizenManifestBackgroundColor` | [Background color](https://developer.mozilla.org/en-US/docs/Web/Manifest/background_color) of the web app manifest | Hex color code | `#fff` + +### Miscellaneous +Name | Description | Values | Default +:--- | :--- | :--- | :--- +`$wgCitizenShowPageTools` | The condition of page tools visibility | `true` - always visible; `login` - visible to logged-in users; `permission` - visible to users with the right permissions | `true` +`$wgCitizenEnablePreconnect` | Enable or disable [preconnect to required origin](https://web.dev/uses-rel-preconnect/) | `true` - enable; `false` - disable | `false` +`$wgCitizenPreconnectURL` | The URL for preconnect to required origin | URL | +`$wgCitizenThemeColor` | The color defined in the `theme-color` meta tag | Hex color code | `#11151d` + +## Requirements +* [MediaWiki](https://www.mediawiki.org) 1.31 or later + From 8df68d6393f4cb132b582e6803ce25479e668cab Mon Sep 17 00:00:00 2001 From: Hannes Kruse Date: Sun, 5 Jul 2020 14:36:31 +0200 Subject: [PATCH 3/6] Use getHttpRequestFactory instead of deprecated MWHttpRequest MWHttpRequest was deprecated in 1.34, getHttpRequestFactory was introduced in 1.31 Signed-off-by: Hannes Kruse --- includes/api/ApiWebappManifest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiWebappManifest.php b/includes/api/ApiWebappManifest.php index 4b4d5b70..933d46c0 100644 --- a/includes/api/ApiWebappManifest.php +++ b/includes/api/ApiWebappManifest.php @@ -27,7 +27,7 @@ use ApiFormatJson; use ApiResult; use ConfigException; use Exception; -use MWHttpRequest; +use MediaWiki\MediaWikiServices; use Title; /** @@ -83,7 +83,9 @@ class ApiWebappManifest extends ApiBase { return; } - $request = MWHttpRequest::factory( $appleTouchIconUrl ); + $request = MediaWikiServices::getInstance() + ->getHttpRequestFactory() + ->create( $appleTouchIconUrl ); $request->execute(); $appleTouchIconContent = $request->getContent(); From 1550ee865885eb049eab7a5c1a819627097a2c30 Mon Sep 17 00:00:00 2001 From: Hannes Kruse Date: Sun, 5 Jul 2020 14:37:06 +0200 Subject: [PATCH 4/6] Default lazyloading to true on ConfigException Signed-off-by: Hannes Kruse --- includes/CitizenHooks.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/CitizenHooks.php b/includes/CitizenHooks.php index 4b2e76c7..5b09cbc1 100644 --- a/includes/CitizenHooks.php +++ b/includes/CitizenHooks.php @@ -84,6 +84,7 @@ class CitizenHooks { } catch ( ConfigException $e ) { wfLogWarning( sprintf( 'Could not get config for "$wgThumbnailSize". Defaulting to "10". %s', $e->getMessage() ) ); + $lazyloadEnabled = true; $thumbSize = 10; } From 557c8577c1a252711cfc80ae404d18ed9fe4665e Mon Sep 17 00:00:00 2001 From: Hannes Kruse Date: Sun, 5 Jul 2020 14:37:44 +0200 Subject: [PATCH 5/6] Update PHPDoc and make some comparisons strict Signed-off-by: Hannes Kruse --- includes/CitizenTemplate.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/includes/CitizenTemplate.php b/includes/CitizenTemplate.php index 74043b2b..e1691794 100644 --- a/includes/CitizenTemplate.php +++ b/includes/CitizenTemplate.php @@ -37,6 +37,7 @@ class CitizenTemplate extends BaseTemplate { /** * Outputs the entire contents of the page + * @throws MWException */ public function execute() { // Naming conventions for Mustache parameters: @@ -128,6 +129,8 @@ class CitizenTemplate extends BaseTemplate { * Render the navigation drawer * Based on Vector (be3843e) * @return array + * @throws MWException + * @throws Exception */ private function buildDrawer() : array { $skin = $this->getSkin(); @@ -156,7 +159,7 @@ class CitizenTemplate extends BaseTemplate { // The language portal will be added provided either // languages exist or there is a value in html-after-portal // for example to show the add language wikidata link (T252800) - if ( count( $languages ) || $portal['html-after-portal'] ) { + if ( $portal['html-after-portal'] || count( $languages ) ) { $props[] = $portal; } break; @@ -220,9 +223,10 @@ class CitizenTemplate extends BaseTemplate { * TODO: Use standardize classes and IDs * TODO: Rebuild icon function based on Desktop Improvement Project * @return array + * @throws MWException */ private function buildLogo() : array { - $props = [ + return [ 'msg-sitetitle' => $this->getMsg( 'sitetitle' )->text(), 'html-mainpage-attributes' => Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [ @@ -230,14 +234,13 @@ class CitizenTemplate extends BaseTemplate { ] ), ]; - return $props; } /** * Echo notification badges and ULS button * @return array */ - private function getExtratools() { + private function getExtratools(): array { $personalTools = $this->getPersonalTools(); // Create the Echo badges and ULS @@ -264,6 +267,7 @@ class CitizenTemplate extends BaseTemplate { * Render the search box * TODO: Use standardized classes and IDs * @return array + * @throws MWException */ private function buildSearchbox() : array { $config = $this->config; @@ -271,7 +275,7 @@ class CitizenTemplate extends BaseTemplate { $toggleMsg = $this->getMsg( 'citizen-search-toggle' )->text(); $accessKey = Linker::accesskey( 'search' ); - $props = [ + return [ 'msg-citizen-search-toggle' => $toggleMsg, 'msg-citizen-search-toggle-shortcut' => $toggleMsg . ' [alt-shift-' . $accessKey . ']', 'form-action' => $config->get( 'Script' ), @@ -281,7 +285,6 @@ class CitizenTemplate extends BaseTemplate { 'html-random-href' => Skin::makeSpecialUrl( 'Randompage' ), 'msg-random' => $this->getMsg( 'Randompage' )->text(), ]; - return $props; } /** @@ -292,9 +295,9 @@ class CitizenTemplate extends BaseTemplate { * * 'login': only visible if logged in (string) * * 'permission-*': only visible if user has permission * e.g. permission-edit = only visible if user can edit pages - * @return string html + * @return array html */ - protected function buildPageTools() { + protected function buildPageTools(): array { $config = $this->config; $skin = $this->getSkin(); $condition = $config->get( 'CitizenShowPageTools' ); @@ -341,7 +344,7 @@ class CitizenTemplate extends BaseTemplate { /** * Render page-related links at the bottom - * @return string html + * @return array html */ private function buildPageLinks() : array { $contentNavigation = $this->data['content_navigation']; @@ -357,12 +360,10 @@ class CitizenTemplate extends BaseTemplate { $variantshtml[ 'label-class' ] .= 'screen-reader-text'; } - $props = [ + return [ 'data-namespaces' => $namespaceshtml, 'data-variants' => $variantshtml, ]; - - return $props; } /** @@ -373,11 +374,9 @@ class CitizenTemplate extends BaseTemplate { $lastMod = null; $footerLinks = $this->getFooterLinks(); - if ( isset( $footerLinks['info'] ) ) { - if ( in_array( 'lastmod', $footerLinks['info'] ) ) { - $key = array_search( 'lastmod', $footerLinks['info'] ); - $lastMod = $this->get( $footerLinks['info'][$key], '' ); - } + if ( isset( $footerLinks['info'] ) && in_array( 'lastmod', $footerLinks['info'], true ) ) { + $key = array_search( 'lastmod', $footerLinks['info'], true ); + $lastMod = $this->get( $footerLinks['info'][$key], '' ); } return $lastMod; @@ -502,7 +501,7 @@ class CitizenTemplate extends BaseTemplate { $props['html-after-portal'] = $this->getAfterPortlet( $label ); // Mark the portal as empty if it has no content - $class = ( count( $urls ) == 0 && !$props['html-after-portal'] ) + $class = ( count( $urls ) === 0 && !$props['html-after-portal'] ) ? ' mw-portal-empty' : ''; $props['class'] = $class; return $props; From 1dd3f0316e4ddd8c616139201c0366ec6b0a2d24 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Sun, 5 Jul 2020 15:22:19 -0400 Subject: [PATCH 6/6] Bumped version --- skin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skin.json b/skin.json index e201da0e..c4e99572 100644 --- a/skin.json +++ b/skin.json @@ -1,7 +1,7 @@ { "name": "Citizen", "namemsg": "skinname-citizen", - "version": "0.9.3", + "version": "0.9.4", "author": [ "[https://www.mediawiki.org/wiki/User:Alistair3149 Alistair3149]", "[https://www.mediawiki.org/wiki/User:Octfx Octfx]"