X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FWebInstallerOptions.php;h=07378ab32e3cac965dabd26c91d56e5df9bece63;hp=0c01b6457b0b6990c213fb6f2dd085e77df67617;hb=e7720b8f8e09287384ddee271641d1b1721318bb;hpb=2379efaad6bddc93e7f08ca42f017890169b44e4 diff --git a/includes/installer/WebInstallerOptions.php b/includes/installer/WebInstallerOptions.php index 0c01b6457b..07378ab32e 100644 --- a/includes/installer/WebInstallerOptions.php +++ b/includes/installer/WebInstallerOptions.php @@ -107,7 +107,7 @@ class WebInstallerOptions extends WebInstallerPage { $skins = $this->parent->findExtensions( 'skins' ); $skinHtml = $this->getFieldsetStart( 'config-skins' ); - $skinNames = array_map( 'strtolower', $skins ); + $skinNames = array_map( 'strtolower', array_keys( $skins ) ); $chosenSkinName = $this->getVar( 'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) ); if ( $skins ) { @@ -118,12 +118,17 @@ class WebInstallerOptions extends WebInstallerPage { 'value' => $chosenSkinName, ] ); - foreach ( $skins as $skin ) { + foreach ( $skins as $skin => $info ) { + if ( isset( $info['screenshots'] ) ) { + $screenshotText = $this->makeScreenshotsLink( $skin, $info['screenshots'] ); + } else { + $screenshotText = htmlspecialchars( $skin ); + } $skinHtml .= '
' . $this->parent->getCheckBox( [ 'var' => "skin-$skin", - 'rawtext' => $skin, + 'rawtext' => $screenshotText, 'value' => $this->getVar( "skin-$skin", true ), // all found skins enabled by default ] ) . '
' . $radioButtons[strtolower( $skin )] . '
' . @@ -144,7 +149,7 @@ class WebInstallerOptions extends WebInstallerPage { if ( $extensions ) { $extHtml = $this->getFieldsetStart( 'config-extensions' ); - foreach ( $extensions as $ext ) { + foreach ( $extensions as $ext => $info ) { $extHtml .= $this->parent->getCheckBox( [ 'var' => "ext-$ext", 'rawtext' => $ext, @@ -246,6 +251,31 @@ class WebInstallerOptions extends WebInstallerPage { return null; } + private function makeScreenshotsLink( $name, $screenshots ) { + global $wgLang; + if ( count( $screenshots ) > 1 ) { + $links = []; + $counter = 1; + foreach ( $screenshots as $shot ) { + $links[] = Html::element( + 'a', + [ 'href' => $shot ], + $wgLang->formatNum( $counter++ ) + ); + } + return wfMessage( 'config-skins-screenshots' ) + ->rawParams( $name, $wgLang->commaList( $links ) ) + ->escaped(); + } else { + $link = Html::element( + 'a', + [ 'href' => $screenshots[0] ], + wfMessage( 'config-screenshot' )->text() + ); + return wfMessage( 'config-skins-screenshot', $name )->rawParams( $link )->escaped(); + } + } + /** * @return string */ @@ -345,7 +375,7 @@ class WebInstallerOptions extends WebInstallerPage { * @return bool */ public function submitSkins() { - $skins = $this->parent->findExtensions( 'skins' ); + $skins = array_keys( $this->parent->findExtensions( 'skins' ) ); $this->parent->setVar( '_Skins', $skins ); if ( $skins ) { @@ -398,7 +428,7 @@ class WebInstallerOptions extends WebInstallerPage { $this->setVar( 'wgRightsIcon', '' ); } - $skinsAvailable = $this->parent->findExtensions( 'skins' ); + $skinsAvailable = array_keys( $this->parent->findExtensions( 'skins' ) ); $skinsToInstall = []; foreach ( $skinsAvailable as $skin ) { $this->parent->setVarsFromRequest( [ "skin-$skin" ] ); @@ -419,7 +449,7 @@ class WebInstallerOptions extends WebInstallerPage { $retVal = false; } - $extsAvailable = $this->parent->findExtensions(); + $extsAvailable = array_keys( $this->parent->findExtensions() ); $extsToInstall = []; foreach ( $extsAvailable as $ext ) { $this->parent->setVarsFromRequest( [ "ext-$ext" ] );