Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5976103
SiteAdminHelperModule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
SiteAdminHelperModule.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace
MediaWiki\Extension\WikimediaMessages
;
use
MediaWiki\ResourceLoader\Context
;
use
MediaWiki\ResourceLoader\FileModule
;
use
MediaWiki\ResourceLoader\FilePath
;
/**
* This style module aids Wikimedia projects in helping them make their content
* friendly for mobile devices and friendly to night mode.
*
* While helpful for projects which do not have the capacity to update the many templates
* and site scripts and styles on their projects, we recognize that projects where there
* are lots of admins, may prefer to opt out of some of these styles.
*
* It can be configured using the configuration variable $wgWikimediaStylesFeatures
* by site admins
*
* It works similar to the ResourceLoader//SkinModule.
*
* @ingroup ResourceLoader
* @internal
*/
class
SiteAdminHelperModule
extends
FileModule
{
/**
* Every skin should define which features it would like to reuse for core inside a
* ResourceLoader module that has set the class to SkinModule.
* For a feature to be valid it must be listed here along with the associated resources
*
* The following features are available.
* Admins can opt out by using MediaWiki:wikimedia-styles-exclude.
*/
private
const
FEATURE_FILES
=
[
'ambox'
=>
[
'ambox.less'
],
'infobox'
=>
[
'infobox.less'
],
'hatnote'
=>
[
'hatnote.less'
],
'theme-night'
=>
[
'theme-night.less'
],
'theme-night-mainpage'
=>
[
'theme-night-mainpage.less'
],
'theme-night-portal'
=>
[
'theme-night-portal.less'
],
];
/**
* Get styles defined in the module definition, plus any enabled feature styles.
*
* @param Context $context
* @return string[][]
*/
public
function
getStyleFiles
(
Context
$context
)
{
$config
=
$this
->
getConfig
();
$excludeFeatures
=
explode
(
'|'
,
$context
->
msg
(
'wikimedia-styles-exclude'
)->
inContentLanguage
()
);
$featureFilePaths
=
[];
foreach
(
self
::
FEATURE_FILES
as
$feature
=>
$featureFiles
)
{
if
(
!
in_array
(
$feature
,
$excludeFeatures
)
)
{
foreach
(
$featureFiles
as
$filepath
)
{
$featureFilePaths
[
'all'
][]
=
new
FilePath
(
$filepath
);
}
}
}
return
$featureFilePaths
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 18:51 (1 d, 13 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b4/b4/b18d1a829b137834a11b4258f521
Default Alt Text
SiteAdminHelperModule.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment