Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
77 lines
1.7 KiB
PHP
77 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Widget;
|
|
|
|
use OOUI\Widget;
|
|
|
|
/**
|
|
* Expiry widget.
|
|
*
|
|
* Allows the user to toggle between a precise time or enter a relative time,
|
|
* regardless, the value comes in as a relative time.
|
|
*
|
|
* @copyright 2018 MediaWiki Widgets Team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
class ExpiryInputWidget extends Widget {
|
|
|
|
/**
|
|
* @var Widget
|
|
*/
|
|
protected $relativeInput;
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
protected $noDatePicker;
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
protected $required;
|
|
|
|
/**
|
|
* @param Widget $relativeInput
|
|
* @param array $options Configuration options
|
|
*/
|
|
public function __construct( Widget $relativeInput, array $options = [] ) {
|
|
$config = \RequestContext::getMain()->getConfig();
|
|
|
|
$options['noDatePicker'] = $config->get( 'ExpiryWidgetNoDatePicker' );
|
|
|
|
parent::__construct( $options );
|
|
|
|
$this->noDatePicker = $options['noDatePicker'];
|
|
$this->required = $options['required'] ?? false;
|
|
|
|
// Properties
|
|
$this->relativeInput = $relativeInput;
|
|
$this->relativeInput->addClasses( [ 'mw-widget-ExpiryWidget-relative' ] );
|
|
|
|
// Initialization
|
|
$classes = [
|
|
'mw-widget-ExpiryWidget',
|
|
];
|
|
if ( $options['noDatePicker'] === false ) {
|
|
$classes[] = 'mw-widget-ExpiryWidget-hasDatePicker';
|
|
}
|
|
$this
|
|
->addClasses( $classes )
|
|
->appendContent( $this->relativeInput );
|
|
}
|
|
|
|
protected function getJavaScriptClassName() {
|
|
return 'mw.widgets.ExpiryWidget';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getConfig( &$config ) {
|
|
$config['noDatePicker'] = $this->noDatePicker;
|
|
$config['required'] = $this->required;
|
|
$config['relativeInput'] = [];
|
|
$this->relativeInput->getConfig( $config['relativeInput'] );
|
|
return parent::getConfig( $config );
|
|
}
|
|
}
|