mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ParserFunctions
synced 2024-11-15 11:59:54 +00:00
Follow-up r81074 CR:
* Use autoloader for ConvertParser, and ExprParser which the code was cloned from * Fix PHP 5.1 compatibility, while there's no requirement for us to keep it, there's also no need to break it unnecessarily, and it's a really trivial fix in this case. * Tidy whitespace * Use ConvertDimension::getLocalisedName() for the dimensionmismatch error, as intended
This commit is contained in:
parent
65e9e69202
commit
7ec54c6cfc
10
Convert.php
10
Convert.php
|
@ -135,8 +135,8 @@ class ConvertParser {
|
|||
if( $this->targetUnit->dimension->value != $this->sourceUnit->dimension->value ){
|
||||
throw new ConvertError(
|
||||
'dimensionmismatch',
|
||||
$this->sourceUnit->dimension->getName(true),
|
||||
$this->targetUnit->dimension->getName(true)
|
||||
$this->sourceUnit->dimension->getLocalisedName(true),
|
||||
$this->targetUnit->dimension->getLocalisedName(true)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,8 @@ class ConvertParser {
|
|||
} else {
|
||||
# Need to round to a similar accuracy as the original value. To do that we
|
||||
# select the accuracy which will as closely as possible preserve the maximum
|
||||
# percentage error in the value. So 36ft = 36 ± 0.5 ft, so the uncertainty
|
||||
# is ±0.5/36 = ±1.4%. In metres this is 10.9728 ± 1.4%, or 10.9728 ± 0.154
|
||||
# percentage error in the value. So 36ft = 36 ± 0.5 ft, so the uncertainty
|
||||
# is ±0.5/36 = ±1.4%. In metres this is 10.9728 ± 1.4%, or 10.9728 ± 0.154
|
||||
# we take the stance of choosing the limit which is *more* precise than the
|
||||
# original value.
|
||||
|
||||
|
@ -698,7 +698,7 @@ class ConvertUnit {
|
|||
if( $link && !wfEmptyMsg( "$msg-link" ) ){
|
||||
$title = Title::newFromText( wfMsgForContentNoTrans( "$msg-link" ) );
|
||||
if( $title instanceof Title ){
|
||||
$msgText = "[[$title|$msgText]]";
|
||||
$msgText = "[[{$title->getFullText()}|$msgText]]";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ $magicWords['en'] = array(
|
|||
'rel2abs' => array( 0, 'rel2abs' ),
|
||||
'titleparts' => array( 0, 'titleparts' ),
|
||||
'convert' => array( 0, 'convert' ),
|
||||
'sourceunit' => array( 0, '#sourceunit' ),
|
||||
'targetunit' => array( 0, '#targetunit' ),
|
||||
'linkunit' => array( 0, '#linkunit' ),
|
||||
'decimalplaces' => array( 0, '#dp' ),
|
||||
'significantfigures' => array( 0, '#sf' ),
|
||||
'abbreviate' => array( 0, '#abbreviate' ),
|
||||
'sourceunit' => array( 0, '#sourceunit' ),
|
||||
'targetunit' => array( 0, '#targetunit' ),
|
||||
'linkunit' => array( 0, '#linkunit' ),
|
||||
'decimalplaces' => array( 0, '#dp' ),
|
||||
'significantfigures' => array( 0, '#sf' ),
|
||||
'abbreviate' => array( 0, '#abbreviate' ),
|
||||
'len' => array( 0, 'len' ),
|
||||
'pos' => array( 0, 'pos' ),
|
||||
'rpos' => array( 0, 'rpos' ),
|
||||
|
|
|
@ -41,6 +41,9 @@ $wgExtensionCredits['parserhook'][] = array(
|
|||
);
|
||||
|
||||
$wgAutoloadClasses['ExtParserFunctions'] = dirname( __FILE__ ) . '/ParserFunctions_body.php';
|
||||
$wgAutoloadClasses['ExprParser'] = dirname( __FILE__ ) . '/Expr.php';
|
||||
$wgAutoloadClasses['ConvertParser'] = dirname( __FILE__ ) . '/Convert.php';
|
||||
|
||||
$wgExtensionMessagesFiles['ParserFunctions'] = dirname( __FILE__ ) . '/ParserFunctions.i18n.php';
|
||||
$wgExtensionMessagesFiles['ParserFunctionsMagic'] = dirname( __FILE__ ) . '/ParserFunctions.i18n.magic.php';
|
||||
|
||||
|
|
|
@ -52,9 +52,6 @@ class ExtParserFunctions {
|
|||
*/
|
||||
function &getExprParser() {
|
||||
if ( !isset( $this->mExprParser ) ) {
|
||||
if ( !class_exists( 'ExprParser' ) ) {
|
||||
require( dirname( __FILE__ ) . '/Expr.php' );
|
||||
}
|
||||
$this->mExprParser = new ExprParser;
|
||||
}
|
||||
return $this->mExprParser;
|
||||
|
@ -518,9 +515,6 @@ class ExtParserFunctions {
|
|||
*/
|
||||
protected function &getConvertParser() {
|
||||
if ( !isset( $this->mConvertParser ) ) {
|
||||
if ( !class_exists( 'ConvertParser' ) ) {
|
||||
require( dirname( __FILE__ ) . '/Convert.php' );
|
||||
}
|
||||
$this->mConvertParser = new ConvertParser;
|
||||
}
|
||||
return $this->mConvertParser;
|
||||
|
|
Loading…
Reference in a new issue