r50647 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50646‎ | r50647 | r50648 >
Date:21:26, 15 May 2009
Author:laner
Status:deferred
Tags:
Comment:
Removed support for helpers. Looks like the code that came from gadgets does this already.
Modified paths:
  • /trunk/extensions/Plotters/Plotters.i18n.php (modified) (history)
  • /trunk/extensions/Plotters/PlottersClass.php (modified) (history)
  • /trunk/extensions/Plotters/PlottersParser.php (modified) (history)
  • /trunk/extensions/Plotters/README (modified) (history)

Diff [purge]

Index: trunk/extensions/Plotters/PlottersParser.php
@@ -36,7 +36,7 @@
3737 // Parse arguments, set defaults, and do sanity checks
3838 $this->argumentArray = array ( "renderer" => "plotkit", "preprocessors" => array(), "preprocessorarguments" => array(),
3939 "script" => "", "scriptarguments" => array(), "datasep" => ",", "width" => "300", "height" => "300", "labels" => array(),
40 - "helpers" => array(), "name" => "plot", "tableclass" => "wikitable" );
 40+ "name" => "plot", "tableclass" => "wikitable" );
4141 if ( isset( $argv["renderer"] ) ) {
4242 //TODO: limit this to supported renderers
4343 $this->argumentArray["renderer"] = preg_replace( '/[^A-Z0-9]/i', '', $argv["renderer"] );
@@ -107,13 +107,6 @@
108108 $this->argumentArray["labels"][] = $label;
109109 }
110110 }
111 - if ( isset( $argv["helpers"] ) ) {
112 - // Sanitize scripts - alphanumerics only
113 - $this->argumentArray["helpers"] = explode( ',', $argv["helpers"] );
114 - foreach ( $this->argumentArray["helpers"] as &$helper ) {
115 - $helper = preg_replace( '/[^A-Z0-9]/i', '', $helper );
116 - }
117 - }
118111 if ( isset( $argv["name"] ) ) {
119112 // Sanitize names - alphanumerics only
120113 $this->argumentArray["name"] = preg_replace( '/[^A-Z0-9]/i', '', $argv["name"] );
Index: trunk/extensions/Plotters/Plotters.i18n.php
@@ -27,7 +27,6 @@
2828 'plotters-missing-arguments' => 'No arguments specified.',
2929 'plotters-excessively-long-scriptname' => 'The script name is too long. Please define a script that is less than 255 characters.',
3030 'plotters-excessively-long-preprocessorname' => 'The preprocessor name is too long. Please define a preprocessor that is less than 255 characters.',
31 - 'plotters-excessively-long-helpername' => 'The helper name is too long. Please define a helper that is less than 255 characters.',
3231 'plotters-excessively-long-name' => 'The plot name is too long. Please define a plot name that is less than 255 characters.',
3332 'plotters-excessively-long-tableclass' => 'The tableclass is too long. Please define a tableclass that is less than 255 characters.',
3433 'plotters-no-data' => 'No data was provided.',
@@ -87,7 +86,6 @@
8887 'plotters-missing-arguments' => 'Žedne argumenty pódane.',
8988 'plotters-excessively-long-scriptname' => 'Mě skripta jo pśedłujke. Pšosym definěruj skript, kótaryž ma mjenjej ako 255 znamuškow.',
9089 'plotters-excessively-long-preprocessorname' => 'Mě preprocesora jo pśedłujke. Pšosym definěruj preprocesor, kótaryž ma mjenjej ako 255 znamuškow.',
91 - 'plotters-excessively-long-helpername' => 'Mě pomocnika jo pśedłujke. Pšosym definěruj pomocnik, kótaryž ma mjenjej ako 255 znamuškow.',
9290 'plotters-no-data' => 'Žedne daty njejsu se pódali.',
9391 'plotters-invalid-renderer' => 'Njepłaśiwy kreslak jo se wubrał.',
9492 'plotters-errors' => '<b>Ploterowe zmólki:</b>',
@@ -108,7 +106,6 @@
109107 'plotters-missing-arguments' => "Aucun argument n'a été spécifié.",
110108 'plotters-excessively-long-scriptname' => 'Le nom du script est trop long. Veuillez définir un script qui a de moins de 255 caractères.',
111109 'plotters-excessively-long-preprocessorname' => 'Le nom du préprocesseur est trop long. Définissez un préprocesseur qui fait moins de 255 caractères.',
112 - 'plotters-excessively-long-helpername' => "Le nom de l'auxiliaire est trop long. Définissez un auxiliaire qui fait moins de 255 caractères.",
113110 'plotters-no-data' => 'Aucune donnée n’a été fournie.',
114111 'plotters-invalid-renderer' => 'Un moteur de rendu invalide a été sélectionné.',
115112 'plotters-errors' => '<b>Erreur(s) de traceurs:</b>',
@@ -128,7 +125,6 @@
129126 'plotters-missing-arguments' => 'Non foi especificado ningún argumento.',
130127 'plotters-excessively-long-scriptname' => 'O nome da escritura é moi longo. Por favor, defina unha escritura que sexa inferior a 255 caracteres.',
131128 'plotters-excessively-long-preprocessorname' => 'O nome do preprocesador é moi longo. Por favor, defina un preprocesador que sexa inferior a 255 caracteres.',
132 - 'plotters-excessively-long-helpername' => 'O nome do axudante é moi longo. Por favor, defina un axudante que sexa inferior a 255 caracteres.',
133129 'plotters-no-data' => 'Non se proporcionou ningún dato.',
134130 'plotters-invalid-renderer' => 'Seleccionouse un renderizador inválido.',
135131 'plotters-errors' => '<b>Erro(s) de plotters:</b>',
@@ -165,7 +161,6 @@
166162 'plotters-missing-arguments' => 'Žane argumenty podate.',
167163 'plotters-excessively-long-scriptname' => 'Mjeno skripta je předołhe. Prošu definuj skript, kotryž ma mjenje hač 255 znamješkow.',
168164 'plotters-excessively-long-preprocessorname' => 'Mjeno preprocesora je předołhe. Prošu definuj preprocesor, kotryž ma mjenje hač 255 znamješkow.',
169 - 'plotters-excessively-long-helpername' => 'Mjeno pomocnika je předołhe. Prošu definuj pomocnik, kotryž ma mjenje hač 255 znamješkow.',
170165 'plotters-no-data' => 'Žane daty njejsu so podali.',
171166 'plotters-invalid-renderer' => 'Njepłaćiwy rysowak je so wubrał.',
172167 'plotters-errors' => '<b>Ploterowe zmylki:</b>',
Index: trunk/extensions/Plotters/PlottersClass.php
@@ -52,17 +52,12 @@
5353 $errors .= wfMsg( "plotters-excessively-long-scriptname" ) . "<br />";
5454 }
5555
56 - // Check preprocessors and helpers
 56+ // Check preprocessors
5757 foreach ( $this->argumentArray["preprocessors"] as $preprocessor ) {
5858 if ( strlen( $preprocessor ) > 255 ) {
5959 $errors .= wfMsg( "plotters-excessively-long-preprocessorname" ) . "<br />";
6060 }
6161 }
62 - foreach ( $this->argumentArray["helpers"] as $helper ) {
63 - if ( strlen( $helper ) > 255 ) {
64 - $errors .= wfMsg( "plotters-excessively-long-helpername" ) . "<br />";
65 - }
66 - }
6762
6863 if ( strlen( $this->argumentArray["name"] ) > 255 ) {
6964 $errors .= wfMsg( "plotters-excessively-long-name" ) . "<br />";
@@ -99,15 +94,11 @@
10095 $renderer = "mplotter-" . $this->argumentArray["renderer"];
10196 $this->parser->mOutput->$renderer = true;
10297
103 - // Add preprocessor and helper tags
 98+ // Add preprocessor tags
10499 foreach ( $this->argumentArray["preprocessors"] as $preprocessor ) {
105100 $preprocessor = "mplotter-" . $preprocessor;
106101 $this->parser->mOutput->$preprocessor = true;
107102 }
108 - foreach ( $this->argumentArray["helpers"] as $helper ) {
109 - $helper = "mplotter-" . $helper;
110 - $this->parser->mOutput->$helper = true;
111 - }
112103
113104 $script = "mplotter-" . $this->argumentArray["script"];
114105 $this->parser->mOutput->$script = true;
Index: trunk/extensions/Plotters/README
@@ -1,6 +1,6 @@
22 This extension allows users to create client side graphs (like pie, bar, etc) from data using javascript. The javascript is created by sysops in the MediaWiki namespace. Adding new scripts works like the Gadgets extension (as this extension borrows heavily from Gadgets).
33
4 -Preprocessing scripts, plotting scripts, and helpers are available, and the javascript function for each should be defined as follows:
 4+Preprocessing scripts, and plotting scripts are available, and the javascript function for each should be defined as follows:
55
66 /* For preprocessing scripts */
77 function plotter_<functionname>_process( name, data, labels, arguments ) {
@@ -28,12 +28,6 @@
2929 plotter.render();
3030 }
3131
32 -/* For helpers - this is javascript that is loaded, but not called
33 - by the plugin; they are for use in functions called by the plugin */
34 -function plotter_<functionname>( <anything_you_want> ) {
35 - /* ... */
36 -}
37 -
3832 You can use these in a parser function like so:
3933
4034 {{#plot:
@@ -41,7 +35,6 @@
4236 |scriptarguments=arg1,arg2,...
4337 |preprocessors=<preprocessorname1>,<preprocessorname2>,...
4438 |preprocessorarguments=<preprocessor1argument1>,<preprocessor1argument2>,...:preprocessor2argument1>,<preprocessor2argument2>,...:...,...
45 -|helpers=<helpername1>,<helpername2>,...
4639 |labels=label1,label2
4740 |data=1,2
4841 2,4}}
@@ -71,6 +64,6 @@
7265
7366 The data separator can be changed using the datasep argument; the default is datasep=,
7467
75 -script, preprocessors, helpers, name, and tableclass arguments are alphanumeric only, and are limited to 255 characters per script/preprocessor/etc.
 68+script, preprocessors, name, and tableclass arguments are alphanumeric only, and are limited to 255 characters per script/preprocessor/etc.
7669
7770 This code is alpha quality right now; many features may not work.

Status & tagging log