Debian Codegraph @

includes/widget/UsersMultiselectWidget.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Widget;
4
5 /**
6 * Widget to select multiple users.
7 *
8 * @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt
9 * @license MIT
10 */
11 class UsersMultiselectWidget extends TagMultiselectWidget {
12 /** @var bool */
13 protected $ipAllowed;
14
15 /** @var bool */
16 protected $ipRangeAllowed;
17
18 /** @var array */
19 protected $ipRangeLimits;
20
21 /** @var bool */
22 protected $excludeNamed;
23
24 /** @var bool */
25 protected $excludeTemp;
26
27 /**
28 * @param array $config Configuration options
29 * - bool $config['ipAllowed'] Accept valid IP addresses
30 * - bool $config['ipRangeAllowed'] Accept valid IP ranges
31 * - array $config['ipRangeLimits'] Maximum allowed IP range sizes
32 * - bool $config['excludeNamed'] Exclude named accounts
33 * - bool $config['excludeTemp'] Exclude temporary accounts
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 }