Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
ConfigHelper.php
1<?php
2declare( strict_types = 1 );
3
5
19 public function getValidationExclusionFile() {
20 global $wgTranslateValidationExclusionFile;
21 return $wgTranslateValidationExclusionFile;
22 }
23
24 public function getTranslateAuthorExclusionList(): array {
25 global $wgTranslateAuthorExclusionList;
26 return $wgTranslateAuthorExclusionList;
27 }
28
29 public function getDisabledTargetLanguages(): array {
30 global $wgTranslateDisabledTargetLanguages;
31 return $wgTranslateDisabledTargetLanguages;
32 }
33
34 public function isAuthorExcluded( string $groupId, string $languageCode, string $username ): bool {
35 $hash = "$groupId;$languageCode;$username";
36 $authorExclusionList = $this->getTranslateAuthorExclusionList();
37 $excluded = false;
38
39 foreach ( $authorExclusionList as $rule ) {
40 [ $type, $regex ] = $rule;
41
42 if ( preg_match( $regex, $hash ) ) {
43 if ( $type === 'include' ) {
44 return false;
45 } else {
46 $excluded = true;
47 }
48 }
49 }
50
51 return $excluded;
52 }
53}
A helper class added to work with configuration values of the Translate Extension.
Essentially random collection of helper functions, similar to GlobalFunctions.php.
Definition Utilities.php:31