3 * Skin file for the fallback skin.
5 * The structure is copied from the example skin (mediawiki/skins/Example).
12 * SkinTemplate class for the fallback skin
14 class SkinFallback
extends SkinTemplate
{
15 var $skinname = 'fallback', $template = 'SkinFallbackTemplate';
18 * Add CSS via ResourceLoader
20 * @param $out OutputPage
22 function setupSkinUserCss( OutputPage
$out ) {
23 parent
::setupSkinUserCss( $out );
24 $out->addModuleStyles( 'mediawiki.skinning.interface' );
29 * BaseTemplate class for the fallback skin
31 class SkinFallbackTemplate
extends BaseTemplate
{
35 private function findInstalledSkins() {
36 global $wgStyleDirectory;
38 // Get all subdirectories which might contains skins
39 $possibleSkins = scandir( $wgStyleDirectory );
40 $possibleSkins = array_filter( $possibleSkins, function ( $maybeDir ) {
41 global $wgStyleDirectory;
42 return $maybeDir !== '.' && $maybeDir !== '..' && is_dir( "$wgStyleDirectory/$maybeDir" );
45 // Only keep the ones that contain a .php file with the same name inside
46 $possibleSkins = array_filter( $possibleSkins, function ( $skinDir ) {
47 global $wgStyleDirectory;
48 return is_file( "$wgStyleDirectory/$skinDir/$skinDir.php" );
51 return $possibleSkins;
55 * Inform the user why they are seeing this skin.
59 private function buildHelpfulInformationMessage() {
60 global $wgDefaultSkin, $wgValidSkinNames;
62 $installedSkins = $this->findInstalledSkins();
63 $enabledSkins = $wgValidSkinNames;
64 $enabledSkins = array_change_key_case( $enabledSkins, CASE_LOWER
);
66 if ( $installedSkins ) {
67 $skinsInstalledText = array();
68 $skinsInstalledSnippet = array();
70 foreach ( $installedSkins as $skin ) {
71 $normalizedKey = strtolower( $skin );
72 $isEnabled = array_key_exists( $normalizedKey, $enabledSkins );
74 $skinsInstalledText[] = $this->getMsg( 'default-skin-not-found-row-enabled' )
75 ->params( $normalizedKey, $skin )->plain();
77 $skinsInstalledText[] = $this->getMsg( 'default-skin-not-found-row-disabled' )
78 ->params( $normalizedKey, $skin )->plain();
79 $skinsInstalledSnippet[] = "require_once \"\$IP/skins/$skin/$skin.php\";";
83 return $this->getMsg( 'default-skin-not-found' )->params(
85 implode( "\n", $skinsInstalledText ),
86 implode( "\n", $skinsInstalledSnippet )
89 return $this->getMsg( 'default-skin-not-found-no-skins' )->params(
96 * Outputs the entire contents of the page. No navigation (other than search box), just the big
97 * warning message and page content.
99 public function execute() {
100 $this->html( 'headelement' ) ?
>
102 <div
class="warningbox">
103 <?php
echo $this->buildHelpfulInformationMessage() ?
>
106 <form action
="<?php $this->text( 'wgScript' ) ?>">
107 <input type
="hidden" name
="title" value
="<?php $this->text( 'searchtitle' ) ?>" />
108 <h3
><label
for="searchInput"><?php
$this->msg( 'search' ) ?
></label
></h3
>
109 <?php
echo $this->makeSearchInput( array( "id" => "searchInput" ) ) ?
>
110 <?php
echo $this->makeSearchButton( 'go' ) ?
>
113 <div
class="mw-body" role
="main">
114 <h1
class="firstHeading">
115 <span dir
="auto"><?php
$this->html( 'title' ) ?
></span
>
118 <div
class="mw-body-content">
119 <?php
$this->html( 'bodytext' ) ?
>
120 <?php
$this->html( 'catlinks' ) ?
>
124 <?php
$this->printTrail() ?
>