r94965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94964‎ | r94965 | r94966 >
Date:23:29, 18 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
rem compat code for tagcloud format
Modified paths:
  • /trunk/extensions/SemanticResultFormats/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticResultFormats/TagCloud/SRF_TagCloud.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/TagCloud/SRF_TagCloud.php
@@ -33,60 +33,6 @@
3434 }
3535
3636 /**
37 - * This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects.
38 - *
39 - * (non-PHPdoc)
40 - * @see SMWResultPrinter::readParameters()
41 - *
42 - * @deprecated
43 - */
44 - protected function readParameters( $params, $outputmode ) {
45 - parent::readParameters( $params, $outputmode );
46 -
47 - if ( !array_key_exists( 'includesubject', $params ) || !in_array( $params['includesubject'], array( 'yes', 'no' ) ) ) {
48 - $params['includesubject'] = 'no';
49 - }
50 -
51 - $this->includeName = $params['includesubject'] == 'yes';
52 -
53 - if ( !array_key_exists( 'increase', $params ) || !in_array( $params['increase'], array( 'linear', 'log' ) ) ) {
54 - $params['increase'] = 'log';
55 - }
56 -
57 - $this->sizeMode = $params['increase'];
58 -
59 - if ( !array_key_exists( 'tagorder', $params ) || !in_array( $params['tagorder'], array( 'alphabetical', 'asc', 'desc', 'random', 'unchanged' ) ) ) {
60 - $params['tagorder'] = 'alphabetical';
61 - }
62 -
63 - $this->tagOrder = $params['tagorder'];
64 -
65 - if ( !array_key_exists( 'mincount', $params ) || !ctype_digit( (string)$params['mincount'] ) ) {
66 - $params['mincount'] = 1;
67 - }
68 -
69 - $this->minCount = $params['mincount'];
70 -
71 - if ( !array_key_exists( 'maxtags', $params ) || !ctype_digit( (string)$params['maxtags'] ) ) {
72 - $params['maxtags'] = 1000;
73 - }
74 -
75 - $this->maxTags = $params['maxtags'];
76 -
77 - if ( !array_key_exists( 'minsize', $params ) || !ctype_digit( (string)$params['minsize'] ) ) {
78 - $params['minsize'] = 77;
79 - }
80 -
81 - $this->minTagSize = $params['minsize'];
82 -
83 - if ( !array_key_exists( 'maxsize', $params ) || !ctype_digit( (string)$params['maxsize'] ) ) {
84 - $params['maxsize'] = 242;
85 - }
86 -
87 - $this->maxSize = $params['maxsize'];
88 - }
89 -
90 - /**
9137 * @see SMWResultPrinter::handleParameters
9238 *
9339 * @since 1.6
@@ -296,48 +242,35 @@
297243 public function getParameters() {
298244 $params = parent::getParameters();
299245
300 - if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) {
301 - $params['includesubject'] = new Parameter( 'includesubject', Parameter::TYPE_BOOLEAN );
302 - $params['includesubject']->setMessage( 'srf_paramdesc_includesubject' );
303 - $params['includesubject']->setDefault( false );
304 -
305 - $params['increase'] = new Parameter( 'increase' );
306 - $params['increase']->setMessage( 'srf_paramdesc_increase' );
307 - $params['increase']->addCriteria( new CriterionInArray( 'linear', 'log' ) );
308 - $params['increase']->setDefault( 'log' );
309 -
310 - $params['tagorder'] = new Parameter( 'tagorder' );
311 - $params['tagorder']->setMessage( 'srf_paramdesc_tagorder' );
312 - $params['tagorder']->addCriteria( new CriterionInArray( 'alphabetical', 'asc', 'desc', 'random', 'unchanged' ) );
313 - $params['tagorder']->setDefault( 'alphabetical' );
314 -
315 - $params['mincount'] = new Parameter( 'mincount', Parameter::TYPE_INTEGER );
316 - $params['mincount']->setMessage( 'srf_paramdesc_mincount' );
317 - $params['mincount']->setDefault( 1 );
318 -
319 - $params['maxtags'] = new Parameter( 'maxtags', Parameter::TYPE_INTEGER );
320 - $params['maxtags']->setMessage( 'srf_paramdesc_maxtags' );
321 - $params['maxtags']->setDefault( 1000 );
 246+ $params['includesubject'] = new Parameter( 'includesubject', Parameter::TYPE_BOOLEAN );
 247+ $params['includesubject']->setMessage( 'srf_paramdesc_includesubject' );
 248+ $params['includesubject']->setDefault( false );
 249+
 250+ $params['increase'] = new Parameter( 'increase' );
 251+ $params['increase']->setMessage( 'srf_paramdesc_increase' );
 252+ $params['increase']->addCriteria( new CriterionInArray( 'linear', 'log' ) );
 253+ $params['increase']->setDefault( 'log' );
 254+
 255+ $params['tagorder'] = new Parameter( 'tagorder' );
 256+ $params['tagorder']->setMessage( 'srf_paramdesc_tagorder' );
 257+ $params['tagorder']->addCriteria( new CriterionInArray( 'alphabetical', 'asc', 'desc', 'random', 'unchanged' ) );
 258+ $params['tagorder']->setDefault( 'alphabetical' );
 259+
 260+ $params['mincount'] = new Parameter( 'mincount', Parameter::TYPE_INTEGER );
 261+ $params['mincount']->setMessage( 'srf_paramdesc_mincount' );
 262+ $params['mincount']->setDefault( 1 );
 263+
 264+ $params['maxtags'] = new Parameter( 'maxtags', Parameter::TYPE_INTEGER );
 265+ $params['maxtags']->setMessage( 'srf_paramdesc_maxtags' );
 266+ $params['maxtags']->setDefault( 1000 );
322267
323 - $params['minsize'] = new Parameter( 'minsize', Parameter::TYPE_INTEGER );
324 - $params['minsize']->setMessage( 'srf_paramdesc_minsize' );
325 - $params['minsize']->setDefault( 77 );
 268+ $params['minsize'] = new Parameter( 'minsize', Parameter::TYPE_INTEGER );
 269+ $params['minsize']->setMessage( 'srf_paramdesc_minsize' );
 270+ $params['minsize']->setDefault( 77 );
326271
327 - $params['maxsize'] = new Parameter( 'maxsize', Parameter::TYPE_INTEGER );
328 - $params['maxsize']->setMessage( 'srf_paramdesc_maxsize' );
329 - $params['maxsize']->setDefault( 242 );
330 - }
331 - else {
332 - // This if for b/c with SMW 1.5.x; SMW 1.6 directly accepts Parameter objects.
333 - $params[] = array( 'name' => 'includesubject', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_includesubject' ), 'values' => array( 'yes', 'no' ) );
334 - $params[] = array( 'name' => 'increase', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_increase' ), 'values' => array( 'linear', 'log' ) );
335 - $params[] = array( 'name' => 'tagorder', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_tagorder' ), 'values' => array( 'alphabetical', 'asc', 'desc', 'random', 'unchanged' ) );
336 -
337 - $params[] = array( 'name' => 'mincount', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_mincount' ) );
338 - $params[] = array( 'name' => 'maxtags', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_maxtags' ) );
339 - $params[] = array( 'name' => 'minsize', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_minsize' ) );
340 - $params[] = array( 'name' => 'maxsize', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_maxsize' ) );
341 - }
 272+ $params['maxsize'] = new Parameter( 'maxsize', Parameter::TYPE_INTEGER );
 273+ $params['maxsize']->setMessage( 'srf_paramdesc_maxsize' );
 274+ $params['maxsize']->setDefault( 242 );
342275
343276 return $params;
344277 }
Index: trunk/extensions/SemanticResultFormats/RELEASE-NOTES
@@ -6,7 +6,8 @@
77
88 * Fixed rendering bug in the tagcloud format occuring for inline queries.
99 * Fixed jqPlotBar and jqPlotPie rendering on Special:Ask and other special pages.
10 -Cleaned up the jqPlotBar format somewhat.
 10+* Cleaned up the jqPlotBar format somewhat.
 11+* Dropped compatibility with SMW < 1.6 for the TagCloud format.
1112
1213 == SRF 1.6 ==
1314