From 39461919d02ecafb1c49549c851f77503b927be4 Mon Sep 17 00:00:00 2001 From: Dat Date: Wed, 30 Jul 2025 02:19:58 +0200 Subject: [PATCH 1/2] Add complaint link between 'about' and 'disclaimers' --- .../wbstack/src/Settings/LocalSettings.php | 33 +++++++++++++++++++ dist/wbstack/src/Settings/LocalSettings.php | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/dist-persist/wbstack/src/Settings/LocalSettings.php b/dist-persist/wbstack/src/Settings/LocalSettings.php index 799e0fdba..0487ba094 100644 --- a/dist-persist/wbstack/src/Settings/LocalSettings.php +++ b/dist-persist/wbstack/src/Settings/LocalSettings.php @@ -218,6 +218,39 @@ ], ]; +// https://www.mediawiki.org/wiki/Manual:Footer +// add the link to the report illegal content page +$wgHooks['SkinAddFooterLinks'][] = function ( $skin, $key, &$footerLinks ) { + if ( $key === 'places' ) { + $aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about' + if ($aboutIndex === false) { + $footerLinks['report'] = Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ); + } else { + $footerLinks = array_slice($footerLinks, 0, $aboutIndex + 1, true) + + [ + 'report' => Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ) + ] + + array_slice($footerLinks, $aboutIndex + 1, null, true); + } + } +}; + // Custom CSS styling $styles = []; if ( version_compare( MW_VERSION, '1.43', '<' ) ) { diff --git a/dist/wbstack/src/Settings/LocalSettings.php b/dist/wbstack/src/Settings/LocalSettings.php index 799e0fdba..0487ba094 100644 --- a/dist/wbstack/src/Settings/LocalSettings.php +++ b/dist/wbstack/src/Settings/LocalSettings.php @@ -218,6 +218,39 @@ ], ]; +// https://www.mediawiki.org/wiki/Manual:Footer +// add the link to the report illegal content page +$wgHooks['SkinAddFooterLinks'][] = function ( $skin, $key, &$footerLinks ) { + if ( $key === 'places' ) { + $aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about' + if ($aboutIndex === false) { + $footerLinks['report'] = Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ); + } else { + $footerLinks = array_slice($footerLinks, 0, $aboutIndex + 1, true) + + [ + 'report' => Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ) + ] + + array_slice($footerLinks, $aboutIndex + 1, null, true); + } + } +}; + // Custom CSS styling $styles = []; if ( version_compare( MW_VERSION, '1.43', '<' ) ) { From 40a72effb46d5e8ae0cc496a8c95f1e8131265a9 Mon Sep 17 00:00:00 2001 From: Dat Date: Mon, 4 Aug 2025 00:28:49 +0200 Subject: [PATCH 2/2] Remove condition, looping through the footer array --- .../wbstack/src/Settings/LocalSettings.php | 42 +++++++------------ dist/wbstack/src/Settings/LocalSettings.php | 42 +++++++------------ 2 files changed, 32 insertions(+), 52 deletions(-) diff --git a/dist-persist/wbstack/src/Settings/LocalSettings.php b/dist-persist/wbstack/src/Settings/LocalSettings.php index 0487ba094..5cde6ccf6 100644 --- a/dist-persist/wbstack/src/Settings/LocalSettings.php +++ b/dist-persist/wbstack/src/Settings/LocalSettings.php @@ -220,34 +220,24 @@ // https://www.mediawiki.org/wiki/Manual:Footer // add the link to the report illegal content page -$wgHooks['SkinAddFooterLinks'][] = function ( $skin, $key, &$footerLinks ) { +$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) { if ( $key === 'places' ) { - $aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about' - if ($aboutIndex === false) { - $footerLinks['report'] = Html::element( - 'a', - [ - 'href' => 'https://wikibase.cloud/complaint', - 'target' => '_blank', - 'rel' => 'noopener noreferrer' - ], - 'Report illegal content' - ); - } else { - $footerLinks = array_slice($footerLinks, 0, $aboutIndex + 1, true) - + [ - 'report' => Html::element( - 'a', - [ - 'href' => 'https://wikibase.cloud/complaint', - 'target' => '_blank', - 'rel' => 'noopener noreferrer' - ], - 'Report illegal content' - ) - ] - + array_slice($footerLinks, $aboutIndex + 1, null, true); + $newFooterLinks = []; + foreach ( $footerlinks as $k => $v ) { + $newFooterLinks[$k] = $v; + if ( $k === 'about' ) { + $newFooterLinks['report'] = Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ); + } } + $footerlinks = $newFooterLinks; } }; diff --git a/dist/wbstack/src/Settings/LocalSettings.php b/dist/wbstack/src/Settings/LocalSettings.php index 0487ba094..5cde6ccf6 100644 --- a/dist/wbstack/src/Settings/LocalSettings.php +++ b/dist/wbstack/src/Settings/LocalSettings.php @@ -220,34 +220,24 @@ // https://www.mediawiki.org/wiki/Manual:Footer // add the link to the report illegal content page -$wgHooks['SkinAddFooterLinks'][] = function ( $skin, $key, &$footerLinks ) { +$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) { if ( $key === 'places' ) { - $aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about' - if ($aboutIndex === false) { - $footerLinks['report'] = Html::element( - 'a', - [ - 'href' => 'https://wikibase.cloud/complaint', - 'target' => '_blank', - 'rel' => 'noopener noreferrer' - ], - 'Report illegal content' - ); - } else { - $footerLinks = array_slice($footerLinks, 0, $aboutIndex + 1, true) - + [ - 'report' => Html::element( - 'a', - [ - 'href' => 'https://wikibase.cloud/complaint', - 'target' => '_blank', - 'rel' => 'noopener noreferrer' - ], - 'Report illegal content' - ) - ] - + array_slice($footerLinks, $aboutIndex + 1, null, true); + $newFooterLinks = []; + foreach ( $footerlinks as $k => $v ) { + $newFooterLinks[$k] = $v; + if ( $k === 'about' ) { + $newFooterLinks['report'] = Html::element( + 'a', + [ + 'href' => 'https://wikibase.cloud/complaint', + 'target' => '_blank', + 'rel' => 'noopener noreferrer' + ], + 'Report illegal content' + ); + } } + $footerlinks = $newFooterLinks; } };