| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Widget; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class UsersMultiselectWidget extends TagMultiselectWidget { |
| 12 |
|
| 13 |
protected $ipAllowed; |
| 14 |
|
| 15 |
|
| 16 |
protected $ipRangeAllowed; |
| 17 |
|
| 18 |
|
| 19 |
protected $ipRangeLimits; |
| 20 |
|
| 21 |
|
| 22 |
protected $excludeNamed; |
| 23 |
|
| 24 |
|
| 25 |
protected $excludeTemp; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public function __construct( array $config = [] ) { |
| 36 |
parent::__construct( $config ); |
| 37 |
|
| 38 |
if ( isset( $config['ipAllowed'] ) ) { |
| 39 |
$this->ipAllowed = $config['ipAllowed']; |
| 40 |
} |
| 41 |
|
| 42 |
if ( isset( $config['ipRangeAllowed'] ) ) { |
| 43 |
$this->ipRangeAllowed = $config['ipRangeAllowed']; |
| 44 |
} |
| 45 |
|
| 46 |
if ( isset( $config['ipRangeLimits'] ) ) { |
| 47 |
$this->ipRangeLimits = $config['ipRangeLimits']; |
| 48 |
} |
| 49 |
|
| 50 |
if ( isset( $config['excludeNamed'] ) ) { |
| 51 |
$this->excludeNamed = $config['excludeNamed']; |
| 52 |
} |
| 53 |
|
| 54 |
if ( isset( $config['excludeTemp'] ) ) { |
| 55 |
$this->excludeTemp = $config['excludeTemp']; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
protected function getJavaScriptClassName() { |
| 60 |
return 'mw.widgets.UsersMultiselectWidget'; |
| 61 |
} |
| 62 |
|
| 63 |
public function getConfig( &$config ) { |
| 64 |
if ( $this->ipAllowed !== null ) { |
| 65 |
$config['ipAllowed'] = $this->ipAllowed; |
| 66 |
} |
| 67 |
|
| 68 |
if ( $this->ipRangeAllowed !== null ) { |
| 69 |
$config['ipRangeAllowed'] = $this->ipRangeAllowed; |
| 70 |
} |
| 71 |
|
| 72 |
if ( $this->ipRangeLimits !== null ) { |
| 73 |
$config['ipRangeLimits'] = $this->ipRangeLimits; |
| 74 |
} |
| 75 |
|
| 76 |
if ( $this->excludeNamed !== null ) { |
| 77 |
$config['excludeNamed'] = $this->excludeNamed; |
| 78 |
} |
| 79 |
|
| 80 |
if ( $this->excludeTemp !== null ) { |
| 81 |
$config['excludeTemp'] = $this->excludeTemp; |
| 82 |
} |
| 83 |
|
| 84 |
return parent::getConfig( $config ); |
| 85 |
} |
| 86 |
|
| 87 |
} |