50 $this->config = $config;
51 $this->language =
$lang;
52 $this->engineMappings = $mappings;
53 $this->hookRunner =
new HookRunner( $hookContainer );
71 foreach ( $this->language->getNamespaces() as $ns => $name ) {
77 $this->hookRunner->onSearchableNamespaces( $arr );
91 if ( $user->getOption(
'searchNs' . $ns ) ) {
105 return array_keys( $this->config->get(
'NamespacesToBeSearchedDefault' ),
true );
115 $alternatives = $this->config->get(
'SearchTypeAlternatives' ) ?: [];
116 array_unshift( $alternatives, $this->config->get(
'SearchType' ) );
118 return $alternatives;
127 return $this->config->get(
'SearchType' );
151 return $this->engineMappings;
162 $formatted = array_map( [ $this->language,
'getFormattedNsText' ], $namespaces );
163 foreach ( $formatted as $key => $ns ) {
164 if ( empty( $ns ) ) {
165 $formatted[$key] =
wfMessage(
'blanknamespace' )->text();
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Configuration handling class for SearchEngine.
array $engineMappings
Search Engine Mappings.
getConfig()
Retrieve original config.
getSearchTypes()
Return the search engines we support.
getSearchType()
Return the search engine configured in $wgSearchType, etc.
__construct(Config $config, Language $lang, HookContainer $hookContainer, array $mappings)
Config $config
Config object from which the settings will be derived.
getSearchMappings()
Returns the mappings between canonical search name and underlying PHP class.
searchableNamespaces()
Make a list of searchable namespaces and their canonical names.
namespacesAsText( $namespaces)
Get a list of namespace names useful for showing in tooltips and preferences.
userNamespaces( $user)
Extract default namespaces to search from the given user's settings, returning a list of index number...
Language $language
Current language.
defaultNamespaces()
An array of namespaces indexes to be searched by default.
Interface for configuration instances.
if(!isset( $args[0])) $lang