mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Add method scope visibility
Change-Id: I6b8e90017c9862fc082b216d44bebab34f3a6095
This commit is contained in:
parent
1d6dc9fead
commit
d37698535a
|
@ -6,7 +6,6 @@
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||||
<exclude name="Squiz.Scope.MethodScope.Missing" />
|
|
||||||
</rule>
|
</rule>
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
<arg name="extensions" value="php,php5,inc" />
|
<arg name="extensions" value="php,php5,inc" />
|
||||||
|
|
|
@ -151,7 +151,7 @@ class MathHooks {
|
||||||
/**
|
/**
|
||||||
* Set up $wgMathPath and $wgMathDirectory globals if they're not already set.
|
* Set up $wgMathPath and $wgMathDirectory globals if they're not already set.
|
||||||
*/
|
*/
|
||||||
static function setup() {
|
public static function setup() {
|
||||||
global $wgMathPath, $wgMathDirectory,
|
global $wgMathPath, $wgMathDirectory,
|
||||||
$wgUploadPath, $wgUploadDirectory;
|
$wgUploadPath, $wgUploadDirectory;
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class MathHooks {
|
||||||
* @param Parser $parser instance of Parser
|
* @param Parser $parser instance of Parser
|
||||||
* @return bool true
|
* @return bool true
|
||||||
*/
|
*/
|
||||||
static function onParserFirstCallInit( $parser ) {
|
public static function onParserFirstCallInit( $parser ) {
|
||||||
$parser->setHook( 'math', [ self::class, 'mathTagHook' ] );
|
$parser->setHook( 'math', [ self::class, 'mathTagHook' ] );
|
||||||
// @deprecated the ce tag is deprecated in favour of chem cf. T153606
|
// @deprecated the ce tag is deprecated in favour of chem cf. T153606
|
||||||
$parser->setHook( 'ce', [ self::class, 'chemTagHook' ] );
|
$parser->setHook( 'ce', [ self::class, 'chemTagHook' ] );
|
||||||
|
@ -187,7 +187,7 @@ class MathHooks {
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
static function mathTagHook( $content, $attributes, $parser ) {
|
public static function mathTagHook( $content, $attributes, $parser ) {
|
||||||
static $n = 1;
|
static $n = 1;
|
||||||
if ( trim( $content ) === '' ) { // bug 8372 https://phabricator.wikimedia.org/rSVN18870
|
if ( trim( $content ) === '' ) { // bug 8372 https://phabricator.wikimedia.org/rSVN18870
|
||||||
return '';
|
return '';
|
||||||
|
@ -258,7 +258,7 @@ class MathHooks {
|
||||||
* @param array &$defaultPreferences Preferences array
|
* @param array &$defaultPreferences Preferences array
|
||||||
* @return bool true
|
* @return bool true
|
||||||
*/
|
*/
|
||||||
static function onGetPreferences( $user, &$defaultPreferences ) {
|
public static function onGetPreferences( $user, &$defaultPreferences ) {
|
||||||
global $wgDefaultUserOptions;
|
global $wgDefaultUserOptions;
|
||||||
$defaultPreferences['math'] = [
|
$defaultPreferences['math'] = [
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
|
@ -300,7 +300,7 @@ class MathHooks {
|
||||||
* @param Maintenance $maint
|
* @param Maintenance $maint
|
||||||
* @return bool hook return code
|
* @return bool hook return code
|
||||||
*/
|
*/
|
||||||
static function onMaintenanceRefreshLinksInit( $maint ) {
|
public static function onMaintenanceRefreshLinksInit( $maint ) {
|
||||||
global $wgUser;
|
global $wgUser;
|
||||||
|
|
||||||
# Don't generate TeX PNGs (the lack of a sensible current directory causes errors anyway)
|
# Don't generate TeX PNGs (the lack of a sensible current directory causes errors anyway)
|
||||||
|
@ -316,7 +316,7 @@ class MathHooks {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function onLoadExtensionSchemaUpdates( $updater = null ) {
|
public static function onLoadExtensionSchemaUpdates( $updater = null ) {
|
||||||
$type = $updater->getDB()->getType();
|
$type = $updater->getDB()->getType();
|
||||||
|
|
||||||
if ( in_array( 'latexml', MathRenderer::getValidModes() ) ) {
|
if ( in_array( 'latexml', MathRenderer::getValidModes() ) ) {
|
||||||
|
@ -354,7 +354,7 @@ class MathHooks {
|
||||||
* @param array &$tables
|
* @param array &$tables
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function onParserTestTables( &$tables ) {
|
public static function onParserTestTables( &$tables ) {
|
||||||
$tables[] = 'math';
|
$tables[] = 'math';
|
||||||
$tables[] = 'mathlatexml';
|
$tables[] = 'mathlatexml';
|
||||||
return true;
|
return true;
|
||||||
|
@ -388,7 +388,7 @@ class MathHooks {
|
||||||
/**
|
/**
|
||||||
* @param string &$toolbar HTML
|
* @param string &$toolbar HTML
|
||||||
*/
|
*/
|
||||||
static function onEditPageBeforeEditToolbar( &$toolbar ) {
|
public static function onEditPageBeforeEditToolbar( &$toolbar ) {
|
||||||
global $wgOut;
|
global $wgOut;
|
||||||
$wgOut->addModules( [ 'ext.math.editbutton.enabler' ] );
|
$wgOut->addModules( [ 'ext.math.editbutton.enabler' ] );
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ class MathHooks {
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static function chemTagHook( $content, $attributes, $parser ) {
|
public static function chemTagHook( $content, $attributes, $parser ) {
|
||||||
$attributes['chem'] = true;
|
$attributes['chem'] = true;
|
||||||
return self::mathTagHook( '\ce{' . $content . '}', $attributes, $parser );
|
return self::mathTagHook( '\ce{' . $content . '}', $attributes, $parser );
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,7 +524,7 @@ abstract class MathRenderer {
|
||||||
* Checks if there is an explicit user request to rerender the math-tag.
|
* Checks if there is an explicit user request to rerender the math-tag.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isPurge() {
|
public function isPurge() {
|
||||||
if ( $this->purge ) {
|
if ( $this->purge ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -544,12 +544,12 @@ abstract class MathRenderer {
|
||||||
* use a cached version.
|
* use a cached version.
|
||||||
* @param bool $purge
|
* @param bool $purge
|
||||||
*/
|
*/
|
||||||
function setPurge( $purge = true ) {
|
public function setPurge( $purge = true ) {
|
||||||
$this->changed = true;
|
$this->changed = true;
|
||||||
$this->purge = $purge;
|
$this->purge = $purge;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLastError() {
|
public function getLastError() {
|
||||||
return $this->lastError;
|
return $this->lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MathSource extends MathRenderer {
|
||||||
* @param string $tex
|
* @param string $tex
|
||||||
* @param array $params
|
* @param array $params
|
||||||
*/
|
*/
|
||||||
function __construct( $tex = '', $params = [] ) {
|
public function __construct( $tex = '', $params = [] ) {
|
||||||
parent::__construct( $tex, $params );
|
parent::__construct( $tex, $params );
|
||||||
$this->setMode( 'source' );
|
$this->setMode( 'source' );
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class MathSource extends MathRenderer {
|
||||||
*
|
*
|
||||||
* @return string span tag with TeX
|
* @return string span tag with TeX
|
||||||
*/
|
*/
|
||||||
function getHtmlOutput() {
|
public function getHtmlOutput() {
|
||||||
# No need to render or parse anything more!
|
# No need to render or parse anything more!
|
||||||
# New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
|
# New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
|
||||||
if ( $this->getMathStyle() == 'display' ) {
|
if ( $this->getMathStyle() == 'display' ) {
|
||||||
|
@ -63,7 +63,7 @@ class MathSource extends MathRenderer {
|
||||||
* No rendering required in plain text mode
|
* No rendering required in plain text mode
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function render() {
|
public function render() {
|
||||||
// assume unchanged to avoid unnecessary database access
|
// assume unchanged to avoid unnecessary database access
|
||||||
$this->changed = false;
|
$this->changed = false;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -9,7 +9,7 @@ class SpecialMathShowImage extends SpecialPage {
|
||||||
private $renderer = null;
|
private $renderer = null;
|
||||||
private $mode = 'mathml';
|
private $mode = 'mathml';
|
||||||
|
|
||||||
function __construct() {
|
public function __construct() {
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
'MathShowImage',
|
'MathShowImage',
|
||||||
'', // Don't restrict
|
'', // Don't restrict
|
||||||
|
@ -21,7 +21,7 @@ class SpecialMathShowImage extends SpecialPage {
|
||||||
* Sets headers - this should be called from the execute() method of all derived classes!
|
* Sets headers - this should be called from the execute() method of all derived classes!
|
||||||
* @param bool $success
|
* @param bool $success
|
||||||
*/
|
*/
|
||||||
function setHeaders( $success = true ) {
|
public function setHeaders( $success = true ) {
|
||||||
$out = $this->getOutput();
|
$out = $this->getOutput();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$out->setArticleBodyOnly( true );
|
$out->setArticleBodyOnly( true );
|
||||||
|
@ -41,7 +41,7 @@ class SpecialMathShowImage extends SpecialPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function execute( $par ) {
|
public function execute( $par ) {
|
||||||
global $wgMathEnableExperimentalInputFormats, $wgMathoidCli;
|
global $wgMathEnableExperimentalInputFormats, $wgMathoidCli;
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$hash = $request->getText( 'hash', '' );
|
$hash = $request->getText( 'hash', '' );
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SpecialMathStatus extends SpecialPage {
|
||||||
* @throws MWException
|
* @throws MWException
|
||||||
* @throws PermissionsError
|
* @throws PermissionsError
|
||||||
*/
|
*/
|
||||||
function execute( $query ) {
|
public function execute( $query ) {
|
||||||
$this->setHeaders();
|
$this->setHeaders();
|
||||||
if ( ! ( $this->getUser()->isAllowed( 'purge' ) ) ) {
|
if ( ! ( $this->getUser()->isAllowed( 'purge' ) ) ) {
|
||||||
// The effect of loading this page is comparable to purge a page.
|
// The effect of loading this page is comparable to purge a page.
|
||||||
|
|
|
@ -268,11 +268,11 @@ class MathMLHttpRequestTester {
|
||||||
*/
|
*/
|
||||||
class MathMLTestStatus {
|
class MathMLTestStatus {
|
||||||
|
|
||||||
static function isGood() {
|
public static function isGood() {
|
||||||
return MathMathMLTest::$good;
|
return MathMathMLTest::$good;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function hasMessage( $s ) {
|
public static function hasMessage( $s ) {
|
||||||
if ( $s == 'http-timed-out' ) {
|
if ( $s == 'http-timed-out' ) {
|
||||||
return MathMathMLTest::$timeout;
|
return MathMathMLTest::$timeout;
|
||||||
} else {
|
} else {
|
||||||
|
@ -280,11 +280,11 @@ class MathMLTestStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getHtml() {
|
public static function getHtml() {
|
||||||
return MathMathMLTest::$html;
|
return MathMathMLTest::$html;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getWikiText() {
|
public static function getWikiText() {
|
||||||
return MathMathMLTest::$html;
|
return MathMathMLTest::$html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue