jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/362245 )
Change subject: build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
......................................................................
build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
Fix remaining phpcs issues:
- Add explict var visibility
- Fixed global
- Break long lines
Change-Id: I96abf88279f1ed97e4e1d8b5fdb4ee26452f18c0
---
M GeoGebra.body.php
M GeoGebra.php
M composer.json
M phpcs.xml
4 files changed, 45 insertions(+), 38 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/GeoGebra.body.php b/GeoGebra.body.php
index 898a5d7..4996606 100644
--- a/GeoGebra.body.php
+++ b/GeoGebra.body.php
@@ -1,61 +1,69 @@
<?php
-class ExtGeoGebra{
+class ExtGeoGebra {
- static $divs = [];
+ private static $divs = [];
public static function geogebraTag( $input, $args, $parser ) {
-
- global $wgGeoGebraTechnology;
$CRLF = "\r\n";
if ( !isset( $args['width'] ) || !isset( $args['height'] ) ||
- ( !isset( $args['id'] ) && !isset( $args['filename'] )
&& !isset( $args['ggbbase64'] ) ) ){
+ ( !isset( $args['id'] ) && !isset( $args['filename'] )
&& !isset( $args['ggbbase64'] ) )
+ ) {
$error_message = wfMessage(
'geogebra-missing-parameter' )->escaped();
return wfMessage( 'geogebra-error' )->rawParams(
$error_message )->parseAsBlock() . $CRLF;
}
$parameters = '';
$shortKeyMap = [
- 'id'=>'material_id',
- 'border' => 'borderColor',
- 'rc'=>'enableRightClick',
- 'ai'=>'showAlgebraInput',
- 'sdz'=>'enableShiftDragZoom',
- 'smb'=>'showMenuBar',
- 'stb'=>'showToolBar',
- 'stbh'=>'showToolBarHelp',
- 'showtoolbar'=>'showToolBar',
- 'enableRightClick'=>'enableRightClick'
+ 'id' => 'material_id',
+ 'border' => 'borderColor',
+ 'rc' => 'enableRightClick',
+ 'ai' => 'showAlgebraInput',
+ 'sdz' => 'enableShiftDragZoom',
+ 'smb' => 'showMenuBar',
+ 'stb' => 'showToolBar',
+ 'stbh' => 'showToolBarHelp',
+ 'showtoolbar' => 'showToolBar',
+ 'enableRightClick' => 'enableRightClick'
];
- foreach ( $args as $key => $value ){
- if ( $key == "filename" ){
- $ggbFile = wfLocalFile( $value );
- if ( !( $ggbFile->exists() ) ) {
- return wfMessage(
'geogebra-file-not-found' )->rawParams( $ggbBinary )->escaped();
- } else {
- $fc = file_get_contents(
$ggbFile->getLocalRefPath() );
- $parameters .=
',ggbBase64:"'.base64_encode( $fc ).'"';
- }
+ foreach ( $args as $key => $value ) {
+ if ( $key == "filename" ) {
+ $ggbFile = wfLocalFile( $value );
+ if ( !( $ggbFile->exists() ) ) {
+ return wfMessage(
'geogebra-file-not-found' )
+ ->rawParams( $ggbBinary
)->escaped();
+ } else {
+ $fc = file_get_contents(
$ggbFile->getLocalRefPath() );
+ $parameters .= ',ggbBase64:"' .
base64_encode( $fc ) . '"';
+ }
continue;
}
- $shortKey = isset( $shortKeyMap[$key] ) ?
$shortKeyMap[$key] : htmlspecialchars( strip_tags( $key ) );
- $parameters .= ','.$shortKey . ':"' . htmlspecialchars(
strip_tags( $value ) ) . '"';
+ $shortKey = isset( $shortKeyMap[$key] )
+ ? $shortKeyMap[$key]
+ : htmlspecialchars( strip_tags( $key ) );
+ $parameters .= ',' . $shortKey . ':"' .
htmlspecialchars( strip_tags( $value ) ) . '"';
}
$div = md5( rand() );
self::$divs[] = $div;
- $iframe = '<script> if(!window.ggbParams){window.ggbParams
={};}; window.ggbParams["'.$div.'"] = {'.substr( $parameters, 1 ).'}; </script>
'.$CRLF
- ."<div id=\"ggbContainer$div\"></div>";
+ $iframe = '<script> if(!window.ggbParams){window.ggbParams
={};}; window.ggbParams["' .
+ $div . '"] = {' . substr( $parameters, 1 ) . '};
</script> ' . $CRLF .
+ "<div id=\"ggbContainer$div\"></div>";
return $iframe;
}
static function injectJS( $out ) {
+ global $wgGeoGebraTechnology;
- $technology = isset( $wgGeoGebraTechnology ) ?
htmlspecialchars( strip_tags( $wgGeoGebraTechnology ) ) : "preferhtml5";
- $deployGGBUrl = isset( $wgGeoGebraDeployURL ) ?
htmlspecialchars( strip_tags( $wgGeoGebraDeployURL ) ) :
"//tube-beta.geogebra.org/scripts/deployggb.js";
+ $technology = isset( $wgGeoGebraTechnology )
+ ? htmlspecialchars( strip_tags( $wgGeoGebraTechnology )
)
+ : "preferhtml5";
+ $deployGGBUrl = isset( $wgGeoGebraDeployURL )
+ ? htmlspecialchars( strip_tags( $wgGeoGebraDeployURL ) )
+ : "//tube-beta.geogebra.org/scripts/deployggb.js";
if ( !count( self::$divs ) ) {
return true;
@@ -63,9 +71,10 @@
global $wgJsMimeType;
$out->addScript( "<script type='$wgJsMimeType'
src='$deployGGBUrl'></script>\n" );
- $scriptBody = "for(var key in window.ggbParams){
- var c=window.ggbParams[key];
- new
GGBApplet(c,'',{'is3D':!!c['is3D'],'AV':!!c['gui']}).inject('ggbContainer'+key,c['at']?c['at']:'$technology');}\n";
+ $scriptBody = "for(var key in window.ggbParams){\n" .
+ "var c=window.ggbParams[key];\n" .
+ "new
GGBApplet(c,'',{'is3D':!!c['is3D'],'AV':!!c['gui']})" .
+
".inject('ggbContainer'+key,c['at']?c['at']:'$technology');}\n";
$out->addScript( "<script
type='$wgJsMimeType'>$scriptBody</script>\n" );
return true;
diff --git a/GeoGebra.php b/GeoGebra.php
index 9fcd1f0..7dc0f4e 100644
--- a/GeoGebra.php
+++ b/GeoGebra.php
@@ -22,7 +22,7 @@
$wgHooks['BeforePageDisplay'][] = 'ExtGeoGebra::injectJS';
/**
- * @param $parser Parser
+ * @param Parser $parser
* @return bool
*/
function wfGeoGebraInit( $parser ) {
diff --git a/composer.json b/composer.json
index e3e4a41..338e8c2 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
- "mediawiki/mediawiki-codesniffer": "0.7.2",
+ "mediawiki/mediawiki-codesniffer": "0.9.0",
"jakub-onderka/php-console-highlighter": "0.3.2"
},
"scripts": {
diff --git a/phpcs.xml b/phpcs.xml
index c34bc41..45d5824 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,9 +1,7 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
- <exclude name="Generic.Files.LineLength"/>
- <exclude
name="MediaWiki.VariableAnalysis.UnusedGlobalVariables"/>
- <exclude name="PSR2.Classes.PropertyDeclaration.ScopeMissing"/>
+ <exclude name="MediaWiki.Commenting.FunctionComment"/>
</rule>
<file>.</file>
<arg name="extensions" value="php,php5,inc"/>
--
To view, visit https://gerrit.wikimedia.org/r/362245
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I96abf88279f1ed97e4e1d8b5fdb4ee26452f18c0
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GeoGebra
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits