@ 2017-12-03T07:46:33Z <?php
// Stub
class HTMLCheckField {}
/*
* This file is part of the MediaWiki extension BetaFeatures.
*
* BetaFeatures 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.
*
* BetaFeatures 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 BetaFeatures. If not, see <http://www.gnu.org/licenses/>.
*
* New HTML check field
*
* @file
* @ingroup Extensions
* @copyright 2013 Mark Holmquist and others; see AUTHORS
* @license GNU General Public License version 2 or later
*/
class NewHTMLCheckField extends HTMLCheckField {
/**
* @var boolean directive whether to include a label with the checkbox
*/
protected $includeLabel = true;
// Protected internal methods for getting the bits of the field
// Override these in subclasses (see HTMLFeatureField, e.g.)
/**
* @param string $value
* @param string $attr
* @return string
*/
protected function getCheckboxHTML( $value, $attr ) {
if ( !empty( $this->mParams['invert'] ) ) {
$value = !$value;
}
$out = $this->mParent->getOutput();
$out->addModules( 'ext.betaFeatures' );
$out->addModuleStyles( 'ext.betaFeatures.styles' );
$out->enableOOUI();
// TODO: Support $this->getTooltipAndAccessKey?
return Html::openElement( 'div', [ 'class' => 'mw-ui-feature-checkbox' ] ) .
new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => $this->mName,
'selected' => $value,
'value' => 1,
'classes' => $this->mClass ? [ $this->mClass ] : [],
'disabled' => isset( $this->mParams['disabled'] ) &&
$this->mParams['disabled'] === true,
] ),
[
'align' => 'inline',
'label' => $this->includeLabel ? $this->mLabel : '',
]
) .
Html::closeElement( 'div' );
}
/**
* @return string
*/
protected function getPostCheckboxLabelHTML() {
return Html::rawElement(
'label',
[ 'for' => $this->mID, 'class' => 'mw-ui-text-check-label' ],
$this->mLabel
);
}
/**
* @param string $value
* @param null $attr
* @return String
*/
public function getInputHTML( $value, $attr = null ) {
return $this->getCheckboxHTML( $value, $attr );
}
public function getInputOOUI( $value ) {
// Use the same output as for the HTML version, otherwise OOUIHTMLForm would use
// a plain checkbox, inherited from HTMLCheckField. This isn't actually a widget
// (just a HTML string) but that's okay, HTMLFormField::getOOUI() will handle it.
return $this->getInputHTML( $value );
}
protected function getFieldLayoutOOUI( $inputField, $config ) {
// Label is already included in the field's HTML, do not duplicate it
unset( $config['label'] );
return parent::getFieldLayoutOOUI( $inputField, $config );
}
}
/*
* This file is part of the MediaWiki extension BetaFeatures.
*
* BetaFeatures 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.
*
* BetaFeatures 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 BetaFeatures. If not, see <http://www.gnu.org/licenses/>.
*
* HTML feature field
*
* @file
* @ingroup Extensions
* @copyright 2013 Mark Holmquist and others; see AUTHORS
* @license GNU General Public License version 2 or later
*/
class HTMLFeatureField extends NewHTMLCheckField {
const OPTION_ENABLED = '1';
const OPTION_DISABLED = '0';
function __construct( $options ) {
// We need the new checkbox style to have a sane-looking field
$options['mw-ui'] = true;
parent::__construct( $options );
}
function getHeaderHTML( $value ) {
$html = Html::openElement( 'div', [
'class' => 'mw-ui-feature-header',
] );
$attrs = $this->getTooltipAndAccessKey();
$attrs['id'] = $this->mID;
$attrs['class'] = 'mw-ui-feature-toggle';
if ( isset( $this->mParams['disabled'] ) &&
$this->mParams['disabled'] === true ) {
$attrs['disabled'] = true;
}
$html .= Html::openElement( 'div', [
'class' => 'mw-ui-feature-title-contain',
] );
$html .= $this->getCheckboxHTML( $value, $attrs );
// Close -title-contain
$html .= Html::closeElement( 'div' );
if ( isset( $this->mParams['info-message'] ) ) {
$infoLink = $this->mParent->msg( $this->mParams['info-message'] )->escaped();
} else {
$infoLink = $this->mParams['info-link'];
}
if ( isset( $this->mParams['discussion-message'] ) ) {
$discussionLink = $this->mParent->msg( $this->mParams['discussion-message'] )->escaped();
} else {
$discussionLink = $this->mParams['discussion-link'];
}
$infoLinkClasses = [
'mw-ui-feature-info-links',
];
if ( isset( $infoLink ) || isset( $discussionLink ) ) {
$infoLinkClasses[] = 'filled';
}
$html .= Html::openElement( 'div', [
'class' => $infoLinkClasses,
] );
$out = $this->mParent->getOutput();
if ( isset( $infoLink ) ) {
$out->addModuleStyles( 'oojs-ui.styles.icons-content' );
$html .= Html::rawElement( 'a', [
'href' => $infoLink,
'class' => 'mw-ui-feature-info-link',
],
new OOUI\IconWidget( [
'icon' => 'article'
] ).
$this->mParent->msg( 'mw-ui-feature-info' )->escaped()
);
$html .= ' ';
}
if ( isset( $discussionLink ) ) {
$out->addModuleStyles( 'oojs-ui.styles.icons-alerts' );
$html .= Html::rawElement( 'a', [
'href' => $discussionLink,
'class' => 'mw-ui-feature-discussion-link',
],
new OOUI\IconWidget( [
'icon' => 'speechBubbles'
] ).
$this->mParent->msg( 'mw-ui-feature-discuss' )->escaped()
);
}
// mw-ui-feature-info-links
$html .= Html::closeElement( 'div' );
// Close -header
$html .= Html::closeElement( 'div' );
return $html;
}
function getMainHTML( $value ) {
$parent = $this->mParent;
$html = Html::openElement( 'div', [
'class' => 'mw-ui-feature-main',
] );
$html .= Html::openElement( 'div', [
'class' => 'mw-ui-feature-meta',
] );
if ( isset( $this->mParams['user-count'] ) ) {
$userCountMsg = 'mw-ui-feature-user-count';
if ( isset( $this->mParams['user-count-msg'] ) ) {
$userCountMsg = $this->mParams['user-count-msg'];
}
$html .= Html::rawElement(
'p',
[ 'class' => 'mw-ui-feature-user-count' ],
$parent->msg( $userCountMsg )->numParams( $this->mParams['user-count'] )->escaped()
);
$attrs['data-count'] = $this->mParams['user-count'];
}
if ( isset( $this->mParams['desc-message'] ) ) {
$html .= Html::rawElement(
'p',
[
'class' => 'mw-ui-feature-description',
],
$parent->msg( $this->mParams['desc-message'] )->parse() );
}
$html .= Html::openElement( 'ul', [
'class' => 'mw-ui-feature-requirements-list',
] );
if ( isset( $this->mParams['requirements'] ) ) {
if (
isset( $this->mParams['requirements']['javascript'] ) &&
$this->mParams['requirements']['javascript']
) {
$html .= Html::rawElement(
'li',
[ 'class' => 'mw-ui-feature-requirements-javascript' ],
$parent->msg( 'mw-ui-feature-requirements-javascript' )->escaped()
);
}
if ( isset( $this->mParams['requirements']['blacklist'] ) ) {
$html .= Html::openElement(
'li',
[ 'class' => 'mw-ui-feature-requirements-browser' ]
);
$browserCount = count( $this->mParams['requirements']['blacklist'] );
$html .= $parent->msg( 'mw-ui-feature-requirements-browser', $browserCount )->escaped();
$html .= Html::openElement( 'ul' );
foreach ( $this->mParams['requirements']['blacklist'] as $browser => $versions ) {
$browserString = $browser;
if ( $versions ) {
foreach ( $versions as $version ) {
$browserString .= ' ' . implode( ' ', $version );
}
}
$html .= Html::element(
'li',
[],
$browserString
);
}
$html .= Html::closeElement( 'ul' );
$html .= Html::closeElement( 'li' );
}
if (
isset( $this->mParams['requirements']['skin-not-supported'] ) &&
$this->mParams['requirements']['skin-not-supported'] === true
) {
$html .= Html::openElement(
'li',
[ 'class' => 'mw-ui-feature-requirements-skins' ]
);
$skinCount = count( $this->mParams['requirements']['skins'] );
$html .= $parent->msg( 'mw-ui-feature-requirements-skins', $skinCount )->escaped();
$html .= Html::openElement( 'ul' );
foreach ( $this->mParams['requirements']['skins'] as $skin ) {
$html .= Html::element(
'li',
[],
$parent->msg( "skinname-$skin" )->text()
);
}
$html .= Html::closeElement( 'ul' );
$html .= Html::closeElement( 'li' );
}
if ( isset( $this->mParams['requirements']['betafeatures-messages'] ) ) {
$html .= Html::openElement(
'li',
[ 'class' => 'mw-ui-feature-requirements-betafeatures' ]
);
$featureCount = count( $this->mParams['requirements']['betafeatures-messages'] );
$html .= $parent->msg( 'mw-ui-feature-requirements-betafeatures', $featureCount )->escaped();
$html .= Html::openElement( 'ul' );
foreach ( $this->mParams['requirements']['betafeatures-messages'] as $message ) {
$html .= Html::rawElement(
'li',
[],
$parent->msg( $message )->escaped()
);
}
$html .= Html::closeElement( 'ul' );
$html .= Html::closeElement( 'li' );
}
}
// mw-ui-feature-requirements-list
$html .= Html::closeElement( 'ul' );
// Close -meta
$html .= Html::closeElement( 'div' );
$html .= Html::openElement( 'div', [
'class' => 'mw-ui-feature-screenshot-contain',
] );
if ( isset( $this->mParams['screenshot'] ) ) {
$screenshot = $this->mParams['screenshot'];
// The screenshot parameter is either a string with a filename
// or an array that specifies a screenshot for each language,
// and default screenshots for rtl and ltr languages
if ( is_array( $screenshot ) ) {
$language = $this->mParent->getLanguage();
$langCode = $language->getCode();
if ( array_key_exists( $langCode, $screenshot ) ) {
$screenshot = $screenshot[$langCode];
} else {
$screenshot = $screenshot[$language->getDir()];
}
}
$html .= Html::element( 'img', [
'src' => $screenshot,
'class' => 'mw-ui-feature-screenshot',
] );
}
// Close -screenshot-contain
$html .= Html::closeElement( 'div' );
// Close -main
$html .= Html::closeElement( 'div' );
return $html;
}
function getInputHTML( $value ) {
$html = '';
$divClasses = [
'mw-ui-feature-field',
];
// Use 'cssclass' to populate this. Separate from 'class', of course.
if ( $this->mClass !== '' ) {
$divClasses[] = $this->mClass;
}
$html .= Html::openElement( 'div', [
'class' => implode( ' ', $divClasses ),
] );
$html .= Html::openElement( 'div', [
'class' => 'mw-ui-feature-contain',
] );
$html .= $this->getHeaderHTML( $value );
$html .= $this->getMainHTML( $value );
// mw-ui-feature-contain
$html .= Html::closeElement( 'div' );
// mw-ui-feature-field
$html .= Html::closeElement( 'div' );
return $html;
}
/**
* Override to use integers, so we don't lose the database rows on
* unset...
* @param WebRequest $request
* @return string
*/
function loadDataFromRequest( $request ) {
$res = parent::loadDataFromRequest( $request );
if ( $res === true ) {
return self::OPTION_ENABLED;
} elseif ( $res === false ) {
return self::OPTION_DISABLED;
} else {
// Dunno what happened, but I'm not gonna fight it.
return $res;
}
}
}
echo "No fatal error";
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 8.3.6 0.009 0.015 16.88 8.3.5 0.007 0.014 17.91 8.3.4 0.008 0.008 18.85 8.3.3 0.015 0.000 18.78 8.3.2 0.003 0.005 20.50 8.3.1 0.000 0.011 21.95 8.3.0 0.004 0.011 23.63 8.2.18 0.009 0.006 18.43 8.2.17 0.004 0.012 22.96 8.2.16 0.009 0.006 20.64 8.2.15 0.008 0.000 24.18 8.2.14 0.010 0.003 24.66 8.2.13 0.004 0.004 22.23 8.2.12 0.007 0.007 26.35 8.2.11 0.006 0.003 22.31 8.2.10 0.004 0.008 17.91 8.2.9 0.005 0.005 19.29 8.2.8 0.000 0.008 17.97 8.2.7 0.005 0.003 17.63 8.2.6 0.008 0.000 17.93 8.2.5 0.004 0.004 18.22 8.2.4 0.000 0.008 20.72 8.2.3 0.000 0.008 19.30 8.2.2 0.003 0.005 18.11 8.2.1 0.004 0.004 18.19 8.2.0 0.004 0.004 17.99 8.1.28 0.011 0.007 25.92 8.1.27 0.003 0.006 20.11 8.1.26 0.008 0.000 26.35 8.1.25 0.008 0.000 28.09 8.1.24 0.006 0.003 20.87 8.1.23 0.011 0.000 20.55 8.1.22 0.010 0.000 17.74 8.1.21 0.003 0.006 18.77 8.1.20 0.003 0.006 17.48 8.1.19 0.003 0.005 17.48 8.1.18 0.006 0.003 20.44 8.1.17 0.000 0.008 18.75 8.1.16 0.000 0.008 19.00 8.1.15 0.004 0.004 20.21 8.1.14 0.000 0.007 19.28 8.1.13 0.000 0.007 17.60 8.1.12 0.000 0.007 17.52 8.1.11 0.000 0.007 17.45 8.1.10 0.004 0.004 17.55 8.1.9 0.004 0.008 17.61 8.1.8 0.005 0.002 17.54 8.1.7 0.007 0.000 17.63 8.1.6 0.004 0.004 17.59 8.1.5 0.003 0.005 17.51 8.1.4 0.004 0.004 17.57 8.1.3 0.005 0.005 17.61 8.1.2 0.000 0.008 17.59 8.1.1 0.004 0.004 17.63 8.1.0 0.006 0.003 17.53 8.0.30 0.004 0.004 18.77 8.0.29 0.000 0.008 16.88 8.0.28 0.000 0.007 18.50 8.0.27 0.007 0.000 17.32 8.0.26 0.000 0.007 16.99 8.0.25 0.000 0.008 16.98 8.0.24 0.008 0.003 16.95 8.0.23 0.000 0.008 17.14 8.0.22 0.005 0.002 17.06 8.0.21 0.003 0.003 16.96 8.0.20 0.003 0.003 16.96 8.0.19 0.006 0.003 17.05 8.0.18 0.004 0.004 16.92 8.0.17 0.006 0.003 17.05 8.0.16 0.000 0.008 16.98 8.0.15 0.005 0.002 16.98 8.0.14 0.007 0.000 16.96 8.0.13 0.000 0.006 13.42 8.0.12 0.000 0.008 16.81 8.0.11 0.000 0.008 16.97 8.0.10 0.004 0.004 17.00 8.0.9 0.004 0.004 17.02 8.0.8 0.007 0.010 16.99 8.0.7 0.004 0.004 16.88 8.0.6 0.008 0.000 16.92 8.0.5 0.003 0.006 17.02 8.0.3 0.007 0.010 17.27 8.0.2 0.010 0.012 17.40 8.0.1 0.004 0.004 17.06 8.0.0 0.009 0.009 17.03 7.4.33 0.003 0.003 15.55 7.4.32 0.003 0.003 16.57 7.4.30 0.007 0.000 16.58 7.4.29 0.000 0.007 16.55 7.4.28 0.000 0.008 16.67 7.4.27 0.003 0.005 16.67 7.4.26 0.004 0.004 16.61 7.4.25 0.005 0.003 16.67 7.4.24 0.004 0.004 16.59 7.4.23 0.004 0.004 16.36 7.4.22 0.007 0.011 16.72 7.4.21 0.013 0.003 16.48 7.4.20 0.004 0.004 16.56 7.4.16 0.014 0.003 16.68 7.4.15 0.018 0.004 17.40 7.4.14 0.008 0.011 17.86 7.4.13 0.012 0.009 16.63 7.4.12 0.014 0.007 16.61 7.4.11 0.015 0.009 16.48 7.4.10 0.011 0.006 16.48 7.4.9 0.007 0.016 16.67 7.4.8 0.011 0.008 19.39 7.4.7 0.008 0.012 16.43 7.4.6 0.016 0.006 16.44 7.4.5 0.011 0.004 16.48 7.4.4 0.003 0.013 16.55 7.4.3 0.010 0.006 16.55 7.4.0 0.007 0.010 14.98 7.3.33 0.005 0.000 13.25 7.3.32 0.003 0.003 13.28 7.3.31 0.003 0.003 16.46 7.3.30 0.000 0.007 16.46 7.3.29 0.007 0.008 16.44 7.3.28 0.006 0.009 16.41 7.3.27 0.003 0.022 17.40 7.3.26 0.008 0.013 16.48 7.3.25 0.012 0.008 16.56 7.3.24 0.012 0.010 16.69 7.3.23 0.007 0.010 16.48 7.3.21 0.012 0.009 16.31 7.3.20 0.005 0.017 16.52 7.3.19 0.003 0.014 16.55 7.3.18 0.012 0.004 16.60 7.3.17 0.007 0.013 16.61 7.3.16 0.004 0.012 16.46 7.2.33 0.015 0.009 16.51 7.2.32 0.012 0.009 16.85 7.2.31 0.006 0.016 16.59 7.2.30 0.018 0.006 16.56 7.2.29 0.011 0.006 16.42 7.2.6 0.009 0.006 16.87 7.2.0 0.008 0.008 19.36 7.1.20 0.006 0.009 15.54 7.1.12 0.007 0.007 18.55 7.1.11 0.004 0.011 17.63 7.1.10 0.007 0.014 18.18 7.1.9 0.006 0.009 17.82 7.1.8 0.003 0.010 17.90 7.1.7 0.000 0.014 16.68 7.1.6 0.013 0.016 34.87 7.1.5 0.017 0.011 34.85 7.1.4 0.020 0.013 34.29 7.1.3 0.014 0.014 34.30 7.1.2 0.019 0.010 34.38 7.1.1 0.007 0.007 16.49 7.1.0 0.000 0.014 16.39
preferences:dark mode live preview
56.88 ms | 401 KiB | 5 Q