# Generates CSS of mediawiki.ui and mediawiki.ui.button using ResourceLoader, then applies it to the
# KSS style guide
$(eval KSS_RL_TMP := $(shell mktemp /tmp/tmp.XXXXXXXXXX))
- @curl -sG "${MEDIAWIKI_LOAD_URL}?modules=mediawiki.legacy.shared|mediawiki.legacy.commonPrint|mediawiki.ui|mediawiki.ui.button&only=styles" > $(KSS_RL_TMP)
+ @curl -sG "${MEDIAWIKI_LOAD_URL}?modules=mediawiki.ui.input|mediawiki.legacy.shared|mediawiki.legacy.commonPrint|mediawiki.ui|mediawiki.ui.button&only=styles" > $(KSS_RL_TMP)
@node_modules/.bin/kss-node ../../resources/src/mediawiki.ui static/ --css $(KSS_RL_TMP) -t styleguide-template
@rm $(KSS_RL_TMP)
'MWNamespace' => 'includes/MWNamespace.php',
'OutputPage' => 'includes/OutputPage.php',
'Pager' => 'includes/Pager.php',
- 'PasswordError' => 'includes/User.php',
'PathRouter' => 'includes/PathRouter.php',
'PathRouterPatternReplacer' => 'includes/PathRouter.php',
'PhpHttpRequest' => 'includes/HttpFunctions.php',
'MWOldPassword' => 'includes/password/MWOldPassword.php',
'ParameterizedPassword' => 'includes/password/ParameterizedPassword.php',
'Password' => 'includes/password/Password.php',
+ 'PasswordError' => 'includes/password/PasswordError.php',
'PasswordFactory' => 'includes/password/PasswordFactory.php',
'Pbkdf2Password' => 'includes/password/Pbkdf2Password.php',
'EncryptedPassword' => 'includes/password/EncryptedPassword.php',
*/
$wgInvalidPasswordReset = true;
-/*
+/**
* Default password type to use when hashing user passwords
*
* @since 1.24
*/
define( 'EDIT_TOKEN_SUFFIX', '+\\' );
-/**
- * Thrown by User::setPassword() on error.
- * @ingroup Exception
- */
-class PasswordError extends MWException {
- // NOP
-}
-
/**
* The User object encapsulates all of the user-specific settings (user_id,
* name, rights, password, email address, options, last login time). Client
* @param bool|string $salt Optional salt, may be random or the user ID.
* If unspecified or false, will generate one automatically
* @return string Password hash
- * @deprecated since 1.23, use Password class
+ * @deprecated since 1.24, use Password class
*/
public static function crypt( $password, $salt = false ) {
- wfDeprecated( __METHOD__, '1.23' );
+ wfDeprecated( __METHOD__, '1.24' );
$hash = self::getPasswordFactory()->newFromPlaintext( $password );
return $hash->toString();
}
* @param string|bool $userId User ID for old-style password salt
*
* @return bool
- * @deprecated since 1.23, use Password class
+ * @deprecated since 1.24, use Password class
*/
public static function comparePasswords( $hash, $password, $userId = false ) {
- wfDeprecated( __METHOD__, '1.23' );
+ wfDeprecated( __METHOD__, '1.24' );
// Check for *really* old password hashes that don't even have a type
// The old hash format was just an md5 hex hash, with no type information
* A Bcrypt-hashed password
*
* This is a computationally complex password hash for use in modern applications.
- * The number of rounds can be configured by $wgPasswordCost.
+ * The number of rounds can be configured by $wgPasswordConfig['bcrypt']['cost'].
*
* @since 1.24
*/
--- /dev/null
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Show an error when any operation involving passwords fails to run.
+ *
+ * @ingroup Exception
+ */
+class PasswordError extends MWException {
+ // NOP
+}
/**
* The default PasswordHash type
*
-*@var string
+ * @var string
* @see PasswordFactory::setDefaultType
*/
private $default = '';
$out = $this->getOutput();
$out->allowClickjacking();
$out->addModuleStyles( array(
- 'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button'
+ 'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button',
+ 'mediawiki.ui.input',
) );
// Strip underscores from title parameter; most of the time we'll want
'id' => $this->profile === 'advanced' ? 'powerSearchText' : 'searchText',
'size' => '50',
'autofocus',
- 'class' => 'mw-ui-input',
+ 'class' => 'mw-ui-input mw-ui-input-inline',
) ) . "\n";
$out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
$out .= Xml::submitButton(
$out->addModuleStyles( array(
'mediawiki.ui',
'mediawiki.ui.button',
+ 'mediawiki.ui.input',
'mediawiki.special.userlogin.common.styles'
) );
$out->addModules( array(
</label>
<?php
echo Html::input( 'wpName', $this->data['name'], 'text', array(
- 'class' => 'mw-input loginText',
+ 'class' => 'mw-ui-input loginText',
'id' => 'wpName2',
'tabindex' => '1',
'size' => '20',
<label for='wpPassword2'><?php $this->msg( 'userlogin-yourpassword' ); ?></label>
<?php
echo Html::input( 'wpPassword', null, 'password', array(
- 'class' => 'mw-input loginPassword',
+ 'class' => 'mw-ui-input loginPassword',
'id' => 'wpPassword2',
'tabindex' => '3',
'size' => '20',
?>
<div class="mw-ui-vform-field" id="mw-user-domain-section">
<label for="wpDomain"><?php $this->msg( 'yourdomainname' ); ?></label>
- <div class="mw-input">
+ <div>
<?php echo $select->getHTML(); ?>
</div>
</div>
<label for='wpRetype'><?php $this->msg( 'createacct-yourpasswordagain' ); ?></label>
<?php
echo Html::input( 'wpRetype', null, 'password', array(
- 'class' => 'mw-input loginPassword',
+ 'class' => 'mw-ui-input loginPassword',
'id' => 'wpRetype',
'tabindex' => '5',
'size' => '20',
</label>
<?php
echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
- 'class' => 'mw-input loginText',
+ 'class' => 'mw-ui-input loginText',
'id' => 'wpEmail',
'tabindex' => '6',
'size' => '20',
<?php if ( $this->data['userealname'] ) { ?>
<div class="mw-ui-vform-field">
<label for='wpRealName'><?php $this->msg( 'createacct-realname' ); ?></label>
- <input type='text' class='mw-input loginText' name="wpRealName" id="wpRealName"
+ <input type='text' class='mw-ui-input loginText' name="wpRealName" id="wpRealName"
tabindex="7"
value="<?php $this->text( 'realname' ); ?>" size='20' />
<div class="prefsectiontip">
<div class="mw-ui-vform-field">
<label for='wpReason'><?php $this->msg( 'createacct-reason' ); ?></label>
<?php echo Html::input( 'wpReason', $this->data['reason'], 'text', array(
- 'class' => 'mw-input loginText',
+ 'class' => 'mw-ui-input loginText',
'id' => 'wpReason',
'tabindex' => '8',
'size' => '20',
<?php } ?>
<input
type="<?php echo htmlspecialchars( $inputItem['type'] ); ?>"
- class="mw-input"
+ class="mw-ui-input"
name="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
tabindex="<?php echo $tabIndex++; ?>"
value="<?php echo htmlspecialchars( $inputItem['value'] ); ?>"
<?php
$extraAttrs = array();
echo Html::input( 'wpName', $this->data['name'], 'text', array(
- 'class' => 'loginText',
+ 'class' => 'loginText mw-ui-input',
'id' => 'wpName1',
'tabindex' => '1',
'size' => '20',
</label>
<?php
echo Html::input( 'wpPassword', null, 'password', array(
- 'class' => 'loginPassword',
+ 'class' => 'loginPassword mw-ui-input',
'id' => 'wpPassword1',
'tabindex' => '2',
'size' => '20',
'position' => 'top',
'targets' => array( 'desktop', 'mobile' ),
),
+ 'mediawiki.ui.input' => array(
+ 'styles' => array(
+ 'resources/src/mediawiki.ui/components/inputs.less',
+ ),
+ 'position' => 'top',
+ 'targets' => array( 'desktop', 'mobile' ),
+ ),
/* es5-shim */
'es5-shim' => array(
// ----------------------------------------------------------------------------
// Form styling mixins
// ----------------------------------------------------------------------------
-
-// Font is not included.
-.agora-field-styling() {
-
- border: 1px solid @colorFieldBorder;
-
- &:focus {
- // Styling focus of native checkboxes etc on Mac is almost impossible.
- &:not([type=checkbox]):not([type=radio]) {
- outline: 0; // Removes OS field focus
- }
-
- box-shadow: lighten(@colorProgressive, 6%) 0 0 5px;
-
- border-color: lighten(@colorProgressive, 6%);
- }
-
- color: @colorText;
- padding: 0.35em 0.5em 0.35em 0.5em;
-
- // Ensure that buttons and inputs are nicely aligned when they have differing heights
- vertical-align: middle;
-}
-
.agora-label-styling() {
font-size: 0.9em;
color: @colorText;
// VForm
//
// Style a compact vertical stacked form ("VForm") and the elements in divs
-// within it. See button section on guidance of how and when to use mw-ui-constructive.
+// within it. See button and inputs section on guidance of how and when to use them.
//
// Markup:
// <form class="mw-ui-vform">
// <div class="mw-ui-vform-field">This is a form example.</div>
// <div class="mw-ui-vform-field">
// <label>Username </label>
-// <input value="input">
+// <input class="mw-ui-input" value="input">
// </div>
// <div class="mw-ui-vform-field">
// <button class="mw-ui-button mw-ui-constructive">Button in vform</button>
width: @defaultFormWidth;
// MW currently doesn't use the type attribute everywhere on inputs.
- input,
select,
.mw-ui-button {
display: block;
width: 100%;
}
- // We exclude buttons because they'll generally use mw-ui-button.
- // Otherwise, we'll unintentionally override that.
- input:not([type=button]):not([type=submit]):not([type=file]) {
- .agora-field-styling(); // mixins/forms.less
- }
-
// Give dropdown lists the same spacing as input fields for consistency.
// Values taken from .agora-field-styling() in mixins/form.less
select {
margin: 0 0 15px;
padding: 0;
width: 100%;
-
- input {
- font-size: 1em;
- line-height: 1.4;
- }
-}
-
-// Apply mw-ui-input to individual input fields to style them.
-// You generally don't need to use this class if <input> is within an Agora
-// form container such as mw-ui-vform
-.mw-ui-input {
- .agora-field-styling(); // mixins/forms.less
- font-size: 1em;
- line-height: 1.4em;
}
// Apply mw-ui-label to individual elements to style them.
--- /dev/null
+// Inputs
+
+@import "mediawiki.mixins";
+@import "mediawiki.ui/variables";
+@import "mediawiki.ui/mixins";
+
+// Placeholder text styling helper
+.field-placeholder-styling() {
+ font-style: italic;
+ font-weight: normal;
+}
+// Inputs
+//
+// When using an input or textarea apply the mw-ui-input class.
+//
+// Styleguide 1.
+
+// mw-ui-input
+//
+// Style an input using MediaWiki UI.
+// Currently in draft status and subject to change.
+// When focused a progressive highlight appears to the left of the field.
+//
+// Markup:
+// <input value="input" class="mw-ui-input" value="input">
+// <textarea class="mw-ui-input">textarea</textarea>
+//
+// Styleguide 1.1.
+.mw-ui-input {
+ // turn off default input styling for input[type="search"] fields
+ -webkit-appearance: none;
+ border: 1px solid @colorFieldBorder;
+ .box-sizing(border-box);
+ width: 100%;
+ padding: .3em .3em .3em .6em;
+ display: block;
+ // Override user agent stylesheet properties. Instead use parent element.
+ color: inherit;
+ font-family: inherit;
+ font-size: inherit;
+ line-height: inherit;
+ .transition(~"border linear .2s, box-shadow linear .2s");
+
+ // Placeholder text styling must be set individually for each browser @winter
+ &::-webkit-input-placeholder { // webkit
+ .field-placeholder-styling;
+ }
+ &::-moz-placeholder { // FF 4-18
+ .field-placeholder-styling;
+ }
+ &:-moz-placeholder { // FF >= 19
+ .field-placeholder-styling;
+ }
+ &:-ms-input-placeholder { // IE >= 10
+ .field-placeholder-styling;
+ }
+
+ &:focus {
+ box-shadow: inset .45em 0 0 #5088f7;
+ border-color: @colorGrayDark;
+ // Remove focus glow on input[type="search"]
+ outline: 0;
+ }
+}
+
+textarea.mw-ui-input {
+ min-height: 8em;
+}
+
+// mw-ui-input-inline
+//
+// Use mw-ui-input-inline with mw-ui-input in cases where you want a button to line up with the input.
+//
+// Markup:
+// <input value="input" class="mw-ui-input mw-ui-input-inline" value="input">
+// <button class="mw-ui-button mw-ui-constructive">go</button>
+//
+// Styleguide 1.2.
+.mw-ui-input-inline {
+ display: inline-block;
+ width: auto;
+}
+
+// mw-ui-input-large
+//
+// Use mw-ui-input-large with mw-ui-input in cases where there are multiple inputs on a screen and you
+// want to draw more attention to one instance. For example add topic / reply to post forms.
+// Currently in draft status and subject to change. When used on an input, the text is styled
+// in a large font. When used alongside another mw-ui-input large they are pushed together to seem like
+// one contiguous input.
+//
+// Markup:
+// <input value="input" class="mw-ui-input mw-ui-input-large" value="input">
+// <textarea class="mw-ui-input mw-ui-input-large">textarea</textarea>
+//
+// Styleguide 1.3.
+.mw-ui-input-large {
+ margin-top: 0;
+ margin-bottom: 0;
+ & + .mw-ui-input-large {
+ border-top-width: 0;
+ }
+}
+
+input.mw-ui-input-large {
+ font-size: 1.75em;
+ font-weight: bold;
+ line-height: 1.25em;
+}
*/
/**
- * @since 1.23
+ * @since 1.24
*/
abstract class MediaWikiPasswordTestCase extends MediaWikiTestCase {
/**
--- /dev/null
+<?php
+/**
+ * @group GlobalFunctions
+ * @covers ::wfWikiID
+ */
+class WfWikiId extends MediaWikiTestCase {
+
+ public function testReturnsProperDbName() {
+ $this->setMwGlobals( 'wgDBname', 'known_db_name' );
+ $this->assertEquals('known_db_name', wfWikiID() );
+ }
+
+ public function testHonorsDatabasePrefix() {
+ $this->setMwGlobals( array(
+ 'wgDBname' => 'known_db_name',
+ 'wgDBprefix' => 'prefix',
+ ));
+ # Note: prefix is actually a suffix in wfWikiID()
+ $this->assertEquals('known_db_name-prefix', wfWikiID() );
+ }
+
+}
$site->setLinkPath( "http://spamzz.test/testing/" );
$sites[] = $site;
- foreach ( array( 'en', 'de', 'nl', 'sv', 'sr', 'no', 'nn' ) as $langCode ) {
+ /**
+ * Add at least one right-to-left language (current RTL languages in MediaWiki core are:
+ * aeb, ar, arc, arz, azb, bcc, bqi, ckb, dv, en_rtl, fa, glk, he, khw, kk_arab, kk_cn,
+ * ks_arab, ku_arab, lrc, mzn, pnb, ps, sd, ug_arab, ur, yi).
+ */
+ $languageCodes = array(
+ 'de',
+ 'en',
+ 'fa', //right-to-left
+ 'nl',
+ 'nn',
+ 'no',
+ 'sr',
+ 'sv',
+ );
+ foreach ( $languageCodes as $langCode ) {
$site = new MediaWikiSite();
$site->setGlobalId( $langCode . 'wiki' );
$site->setGroup( 'wikipedia' );