Physikerwelt has uploaded a new change for review. https://gerrit.wikimedia.org/r/109495
Change subject: Rename global variables that violate the naming convention ...................................................................... Rename global variables that violate the naming convention see http://www.mediawiki.org/wiki/Manual:Developing_extensions#Making_your_extension_user_configurable Change-Id: Ib70a9f7767890cc4618bc10c2610784f5b17e670 --- M Math.hooks.php M Math.php M MathLaTeXML.php M tests/MathLaTeXMLTest.php 4 files changed, 19 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/95/109495/1 diff --git a/Math.hooks.php b/Math.hooks.php index 3a3147a..8ec3db8 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -42,7 +42,7 @@ * @return string */ static function mathTagHook( $content, $attributes, $parser ) { - global $wgMathDisableTexFilter, $wgContLang, $wgUseMathJax; + global $wgMathDisableTexFilter, $wgContLang, $wgMathJax; if ( trim( $content ) === "" ) { // bug 8372 return ""; } @@ -61,7 +61,7 @@ } $renderedMath = $renderer->render(); - if ( $wgUseMathJax && $mode == MW_MATH_MATHJAX ) { + if ( $wgMathJax && $mode == MW_MATH_MATHJAX ) { $parser->getOutput()->addModules( array( 'ext.math.mathjax.enabler' ) ); } $renderer->writeCache(); @@ -93,12 +93,12 @@ * @return array of strings */ private static function getMathNames() { - global $wgUseMathJax, $wgUseLaTeXML; + global $wgMathJax, $wgUseLaTeXML; $names = array( MW_MATH_PNG => wfMessage( 'mw_math_png' )->escaped(), MW_MATH_SOURCE => wfMessage( 'mw_math_source' )->escaped(), ); - if ( $wgUseMathJax ) { + if ( $wgMathJax ) { $names[MW_MATH_MATHJAX] = wfMessage( 'mw_math_mathjax' )->escaped(); } if ( $wgUseLaTeXML ) { diff --git a/Math.php b/Math.php index 8a0cc3c..ff8c715 100644 --- a/Math.php +++ b/Math.php @@ -100,7 +100,7 @@ * * Not guaranteed to be stable at this time. */ -$wgUseMathJax = false; +$wgMathJax = false; /** * Use of LaTeXML for details see @@ -115,7 +115,7 @@ * servers in an array e.g $wgLaTeXMLUrl = array ( 'http://latexml.example.com/convert', * 'http://latexml2.example.com/convert'); */ -$wgLaTeXMLUrl = 'http://latexml.mathweb.org/convert'; +$wgMathLaTeXMLUrl = 'http://latexml.mathweb.org/convert'; /** * Allows to use LaTeXML as renderer for mathematical equation. @@ -126,12 +126,12 @@ * The timeout for the HTTP-Request sent to the LaTeXML to render an equation, * in seconds. */ -$wgLaTeXMLTimeout = 240; +$wgMathLaTeXMLTimeout = 240; /** * Setting for the LaTeXML renderer. * See http://dlmf.nist.gov/LaTeXML/manual/commands/latexmlpost.xhtml for details. */ -$wgDefaultLaTeXMLSetting = 'format=xhtml&whatsin=math&whatsout=math&pmml&cmml&nodefaultresources&preload=LaTeX.pool&preload=article.cls&preload=amsmath.sty&preload=amsthm.sty&preload=amstext.sty&preload=amssymb.sty&preload=eucal.sty&preload=[dvipsnames]xcolor.sty&preload=url.sty&preload=hyperref.sty&preload=[ids]latexml.sty&preload=texvc'; +$wgMathDefaultLaTeXMLSetting = 'format=xhtml&whatsin=math&whatsout=math&pmml&cmml&nodefaultresources&preload=LaTeX.pool&preload=article.cls&preload=amsmath.sty&preload=amsthm.sty&preload=amstext.sty&preload=amssymb.sty&preload=eucal.sty&preload=[dvipsnames]xcolor.sty&preload=url.sty&preload=hyperref.sty&preload=[ids]latexml.sty&preload=texvc'; /** * The link to the texvc executable */ diff --git a/MathLaTeXML.php b/MathLaTeXML.php index 14aea29..360a0df 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -39,11 +39,11 @@ * @return string */ public function getLaTeXMLSettings() { - global $wgDefaultLaTeXMLSetting; + global $wgMathDefaultLaTeXMLSetting; if ( $this->LaTeXMLSettings ) { return $this->LaTeXMLSettings; } else { - return $wgDefaultLaTeXMLSetting; + return $wgMathDefaultLaTeXMLSetting; } } @@ -118,12 +118,12 @@ * @return boolean success */ public function makeRequest( $host, $post, &$res, &$error = '', $httpRequestClass = 'MWHttpRequest' ) { - global $wgLaTeXMLTimeout; + global $wgMathLaTeXMLTimeout; wfProfileIn( __METHOD__ ); $error = ''; $res = null; - $options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgLaTeXMLTimeout ); + $options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgMathLaTeXMLTimeout ); $req = $httpRequestClass::factory( $host, $options ); $status = $req->execute(); if ( $status->isGood() ) { @@ -136,7 +136,7 @@ $res = false; wfDebugLog( "Math", "\nLaTeXML Timeout:" . var_export( array( 'post' => $post, 'host' => $host - , 'wgLaTeXMLTimeout' => $wgLaTeXMLTimeout ), true ) . "\n\n" ); + , 'wgLaTeXMLTimeout' => $wgMathLaTeXMLTimeout ), true ) . "\n\n" ); } else { // for any other unkonwn http error $errormsg = $status->getHtml(); @@ -166,11 +166,11 @@ * @return string */ private static function pickHost() { - global $wgLaTeXMLUrl; - if ( is_array( $wgLaTeXMLUrl ) ) { - $host = array_rand( $wgLaTeXMLUrl ); + global $wgMathLaTeXMLUrl; + if ( is_array( $wgMathLaTeXMLUrl ) ) { + $host = array_rand( $wgMathLaTeXMLUrl ); } else { - $host = $wgLaTeXMLUrl; + $host = $wgMathLaTeXMLUrl; } wfDebugLog( "Math", "picking host " . $host ); return $host; diff --git a/tests/MathLaTeXMLTest.php b/tests/MathLaTeXMLTest.php index a549977..4c103c7 100644 --- a/tests/MathLaTeXMLTest.php +++ b/tests/MathLaTeXMLTest.php @@ -125,8 +125,8 @@ * i.e. if the span element is generated right. */ public function testIntegration() { - global $wgLaTeXMLTimeout; - $wgLaTeXMLTimeout = 20; + global $wgMathLaTeXMLTimeout; + $wgMathLaTeXMLTimeout = 20; $renderer = MathRenderer::getRenderer( "a+b", array(), MW_MATH_LATEXML ); $real = $renderer->render( true ); $expected = '<span class="tex" dir="ltr" id="a_b"><math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.1.m1" class="ltx_Math" alttext="a+b" display="inline" xml:id="p1.1.m1.1" xref="p1.1.m1.1.cmml"> <semantics xml:id="p1.1.m1.1a" xref="p1.1.m1.1.cmml"> <mrow xml:id="p1.1.m1.1.4" xref="p1.1.m1.1.4.cmml"> <mi xml:id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">a</mi> <mo xml:id="p1.1.m1.1.2" xref="p1.1.m1.1.2.cmml">+</mo> <mi xml:id="p1.1.m1.1.3" xref="p1.1.m1.1.3.cmml">b</mi> </mrow> <annotation-xml encoding="MathML-Content" xml:id="p1.1.m1.1.cmml" xref="p1.1.m1.1"> <apply xml:id="p1.1.m1.1.4.cmml" xref="p1.1.m1.1.4"> <plus xml:id="p1.1.m1.1.2.cmml" xref="p1.1.m1.1.2"/> <ci xml:id="p1.1.m1.1.1.cmml" xref="p1.1.m1.1.1">a</ci> <ci xml:id="p1.1.m1.1.3.cmml" xref="p1.1.m1.1.3">b</ci> </apply> </annotation-xml> <annotation encoding="application/x-tex" xml:id="p1.1.m1.1b" xref="p1.1.m1.1.cmml">a+b</annotation> </semantics> </math></span>'; -- To view, visit https://gerrit.wikimedia.org/r/109495 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib70a9f7767890cc4618bc10c2610784f5b17e670 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits