From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- vendor/oojs/oojs-ui/php/Element.php | 48 +++++++- vendor/oojs/oojs-ui/php/HtmlSnippet.php | 2 +- vendor/oojs/oojs-ui/php/Tag.php | 20 ++-- vendor/oojs/oojs-ui/php/Theme.php | 26 +++- vendor/oojs/oojs-ui/php/Widget.php | 10 ++ vendor/oojs/oojs-ui/php/elements/ButtonElement.php | 102 ---------------- .../oojs/oojs-ui/php/elements/FlaggedElement.php | 133 --------------------- vendor/oojs/oojs-ui/php/elements/GroupElement.php | 129 -------------------- vendor/oojs/oojs-ui/php/elements/IconElement.php | 76 ------------ .../oojs/oojs-ui/php/elements/IndicatorElement.php | 78 ------------ vendor/oojs/oojs-ui/php/elements/LabelElement.php | 77 ------------ .../oojs-ui/php/elements/TabIndexedElement.php | 88 -------------- vendor/oojs/oojs-ui/php/elements/TitledElement.php | 74 ------------ .../oojs/oojs-ui/php/layouts/ActionFieldLayout.php | 55 +++++++++ vendor/oojs/oojs-ui/php/layouts/FieldLayout.php | 73 ++++++++++- vendor/oojs/oojs-ui/php/layouts/FormLayout.php | 2 +- .../oojs/oojs-ui/php/layouts/HorizontalLayout.php | 27 +++++ .../oojs/oojs-ui/php/mixins/AccessKeyedElement.php | 76 ++++++++++++ vendor/oojs/oojs-ui/php/mixins/ButtonElement.php | 69 +++++++++++ vendor/oojs/oojs-ui/php/mixins/FlaggedElement.php | 133 +++++++++++++++++++++ vendor/oojs/oojs-ui/php/mixins/GroupElement.php | 129 ++++++++++++++++++++ vendor/oojs/oojs-ui/php/mixins/IconElement.php | 76 ++++++++++++ .../oojs/oojs-ui/php/mixins/IndicatorElement.php | 78 ++++++++++++ vendor/oojs/oojs-ui/php/mixins/LabelElement.php | 77 ++++++++++++ .../oojs/oojs-ui/php/mixins/TabIndexedElement.php | 88 ++++++++++++++ vendor/oojs/oojs-ui/php/mixins/TitledElement.php | 74 ++++++++++++ .../oojs/oojs-ui/php/widgets/ButtonInputWidget.php | 14 ++- vendor/oojs/oojs-ui/php/widgets/ButtonWidget.php | 2 + .../oojs-ui/php/widgets/CheckboxInputWidget.php | 2 + .../oojs-ui/php/widgets/DropdownInputWidget.php | 11 +- vendor/oojs/oojs-ui/php/widgets/IconWidget.php | 2 +- .../oojs/oojs-ui/php/widgets/IndicatorWidget.php | 2 +- vendor/oojs/oojs-ui/php/widgets/InputWidget.php | 10 +- vendor/oojs/oojs-ui/php/widgets/LabelWidget.php | 2 +- .../oojs/oojs-ui/php/widgets/RadioInputWidget.php | 2 + .../oojs-ui/php/widgets/RadioSelectInputWidget.php | 127 ++++++++++++++++++++ .../oojs/oojs-ui/php/widgets/TextInputWidget.php | 63 +++++++++- 37 files changed, 1262 insertions(+), 795 deletions(-) delete mode 100644 vendor/oojs/oojs-ui/php/elements/ButtonElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/FlaggedElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/GroupElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/IconElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/IndicatorElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/LabelElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/TabIndexedElement.php delete mode 100644 vendor/oojs/oojs-ui/php/elements/TitledElement.php create mode 100644 vendor/oojs/oojs-ui/php/layouts/ActionFieldLayout.php create mode 100644 vendor/oojs/oojs-ui/php/layouts/HorizontalLayout.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/AccessKeyedElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/ButtonElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/FlaggedElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/GroupElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/IconElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/IndicatorElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/LabelElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/TabIndexedElement.php create mode 100644 vendor/oojs/oojs-ui/php/mixins/TitledElement.php create mode 100644 vendor/oojs/oojs-ui/php/widgets/RadioSelectInputWidget.php (limited to 'vendor/oojs/oojs-ui/php') diff --git a/vendor/oojs/oojs-ui/php/Element.php b/vendor/oojs/oojs-ui/php/Element.php index eaa8c825..a7bd683a 100644 --- a/vendor/oojs/oojs-ui/php/Element.php +++ b/vendor/oojs/oojs-ui/php/Element.php @@ -9,7 +9,7 @@ namespace OOUI; */ class Element extends Tag { - /* Static properties */ + /* Static Properties */ /** * HTML tag name. @@ -29,7 +29,7 @@ class Element extends Tag { */ public static $defaultDir = 'ltr'; - /* Members */ + /* Properties */ /** * Element data. @@ -38,10 +38,18 @@ class Element extends Tag { */ protected $data = null; + /** + * CSS classes explicitly configured for this element (as opposed to #$classes, which contains all + * classes for this element). + * + * @var string[] + */ + protected $ownClasses = array(); + /** * Mixins. * - * @var array List mixed in objects. + * @var ElementMixin[] List mixed in objects. */ protected $mixins = array(); @@ -69,7 +77,8 @@ class Element extends Tag { $this->setData( $config['data'] ); } if ( isset( $config['classes'] ) && is_array( $config['classes'] ) ) { - $this->addClasses( $config['classes'] ); + $this->ownClasses = $config['classes']; + $this->addClasses( $this->ownClasses ); } if ( isset( $config['id'] ) ) { $this->setAttributes( array( 'id' => $config['id'] ) ); @@ -121,7 +130,7 @@ class Element extends Tag { * @return Tag|null Target property or null if not found */ public function __get( $name ) { - // Search mixins for methods + // Search mixins for the property foreach ( $this->mixins as $mixin ) { if ( isset( $mixin::$targetPropertyName ) && $mixin::$targetPropertyName === $name ) { return $mixin->target; @@ -132,6 +141,22 @@ class Element extends Tag { return null; } + /** + * Check for existence of a mixed-in target property. + * + * @param string $name Property name + * @return bool Whether property exists + */ + public function __isset( $name ) { + // Search mixins for the property + foreach ( $this->mixins as $mixin ) { + if ( isset( $mixin::$targetPropertyName ) && $mixin::$targetPropertyName === $name ) { + return true; + } + } + return false; + } + /** * Get the HTML tag name. * @@ -220,6 +245,9 @@ class Element extends Tag { if ( $this->data !== null ) { $config['data'] = $this->data; } + if ( $this->ownClasses !== array() ) { + $config['classes'] = $this->ownClasses; + } return $config; } @@ -247,10 +275,18 @@ class Element extends Tag { }; array_walk_recursive( $config, $replaceElements ); // Set '_' last to ensure that subclasses can't accidentally step on it. - $config['_'] = preg_replace( '/^OOUI\\\\/', '', get_class( $this ) ); + $config['_'] = $this->getJavaScriptClassName(); return $config; } + /** + * The class name of the JavaScript version of this widget + * @return string + */ + protected function getJavaScriptClassName() { + return str_replace( 'OOUI\\', 'OO.ui.', get_class( $this ) ); + } + protected function getGeneratedAttributes() { $attributesArray = parent::getGeneratedAttributes(); // Add `data-ooui` attribute from serialized config array. diff --git a/vendor/oojs/oojs-ui/php/HtmlSnippet.php b/vendor/oojs/oojs-ui/php/HtmlSnippet.php index e0889fca..adde8286 100644 --- a/vendor/oojs/oojs-ui/php/HtmlSnippet.php +++ b/vendor/oojs/oojs-ui/php/HtmlSnippet.php @@ -7,7 +7,7 @@ namespace OOUI; */ class HtmlSnippet { - /* Members */ + /* Properties */ /** * HTML snippet this instance represents. diff --git a/vendor/oojs/oojs-ui/php/Tag.php b/vendor/oojs/oojs-ui/php/Tag.php index da8c2bfa..e5fa9df6 100644 --- a/vendor/oojs/oojs-ui/php/Tag.php +++ b/vendor/oojs/oojs-ui/php/Tag.php @@ -4,7 +4,7 @@ namespace OOUI; class Tag { - /* Members */ + /* Properties */ /** * Tag name for this instance. @@ -296,23 +296,27 @@ class Tag { // reasons to ever use 'javascript:' URLs anyway. $protocolWhitelist = array( // Sourced from MediaWiki's $wgUrlProtocols + // Keep in sync with OO.ui.isSafeUrl 'bitcoin', 'ftp', 'ftps', 'geo', 'git', 'gopher', 'http', 'https', 'irc', 'ircs', 'magnet', 'mailto', 'mms', 'news', 'nntp', 'redis', 'sftp', 'sip', 'sips', 'sms', 'ssh', 'svn', 'tel', 'telnet', 'urn', 'worldwind', 'xmpp', + '(protocol-relative)', '(relative)', ); // Protocol-relative URLs are handled really badly by parse_url() if ( substr( $value, 0, 2 ) === '//' ) { - $url = "http:$value"; + $scheme = '(protocol-relative)'; } else { - $url = $value; + // Must suppress warnings when the value is not a valid URL. parse_url() returns false then. + \MediaWiki\suppressWarnings(); + $scheme = parse_url( $value, PHP_URL_SCHEME ); + \MediaWiki\restoreWarnings(); + if ( $scheme === null || ( !$scheme && substr( $value, 0, 1 ) === '/' ) ) { + $scheme = '(relative)'; + } } - // Must suppress warnings when the value is not a valid URL. parse_url() returns false then. - // @codingStandardsIgnoreStart - $scheme = @parse_url( $url, PHP_URL_SCHEME ); - // @codingStandardsIgnoreEnd - if ( !( $scheme === null || in_array( strtolower( $scheme ), $protocolWhitelist ) ) ) { + if ( !in_array( strtolower( $scheme ), $protocolWhitelist ) ) { throw new Exception( "Potentially unsafe '$key' attribute value. " . "Scheme: '$scheme'; value: '$value'." ); } diff --git a/vendor/oojs/oojs-ui/php/Theme.php b/vendor/oojs/oojs-ui/php/Theme.php index d36b6d82..7f8eea36 100644 --- a/vendor/oojs/oojs-ui/php/Theme.php +++ b/vendor/oojs/oojs-ui/php/Theme.php @@ -7,18 +7,25 @@ namespace OOUI; * * @abstract */ -class Theme { +abstract class Theme { - /* Members */ + /* Properties */ private static $singleton; /* Static Methods */ - public static function setSingleton( Theme $theme ) { + /** + * @param Theme|null $theme + */ + public static function setSingleton( Theme $theme = null ) { self::$singleton = $theme; } + /** + * @return Theme + * @throws Exception + */ public static function singleton() { if ( !self::$singleton ) { throw new Exception( __METHOD__ . ' was called with no singleton theme set.' ); @@ -51,8 +58,15 @@ class Theme { public function updateElementClasses( Element $element ) { $classes = $this->getElementClasses( $element ); - $element - ->removeClasses( $classes['off'] ) - ->addClasses( $classes['on'] ); + if ( isset( $element->icon ) ) { + $element->icon + ->removeClasses( $classes['off'] ) + ->addClasses( $classes['on'] ); + } + if ( isset( $element->indicator ) ) { + $element->indicator + ->removeClasses( $classes['off'] ) + ->addClasses( $classes['on'] ); + } } } diff --git a/vendor/oojs/oojs-ui/php/Widget.php b/vendor/oojs/oojs-ui/php/Widget.php index 04152aa5..7828a82e 100644 --- a/vendor/oojs/oojs-ui/php/Widget.php +++ b/vendor/oojs/oojs-ui/php/Widget.php @@ -9,6 +9,16 @@ namespace OOUI; */ class Widget extends Element { + /* Static Properties */ + + /** + * Whether this widget will behave reasonably when wrapped in a HTML `