Debian Codegraph @

skins/MinervaNeue/includes/Skins/FeaturesHelper.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Minerva\Skins;
4
5 use MediaWiki\Request\WebRequest;
6 use MediaWiki\Skins\Vector\ConfigHelper;
7 use MediaWiki\Title\Title;
8
9 class FeaturesHelper {
10
11 /**
12 * Per the $options configuration (for use with $wgMinervaNightModeOptions)
13 * determine whether Night Mode should be disabled on the page.
14 * For the main page: Check the value of $options['exclude']['mainpage']
15 * Night Mode is disabled if:
16 * 1) The current namespace is listed in array $options['exclude']['namespaces']
17 * OR
18 * 2) A query string parameter matches one of the regex patterns in $exclusions['querystring'].
19 * OR
20 * 3) The canonical title matches one of the titles in $options['exclude']['pagetitles']
21 * For this functionality to work the Vector skin MUST be installed.
22 *
23 * @param array $options
24 * @param WebRequest $request
25 * @param Title|null $title
26 *
27 * @return bool
28 * @internal only for use inside tests.
29 */
30 public function shouldDisableNightMode( array $options, WebRequest $request, ?Title $title = null ): bool {
31 return class_exists( ConfigHelper::class ) ?
32 ConfigHelper::shouldDisable( $options, $request, $title ) :
33 false;
34 }
35 }