Index: trunk/extensions/SemanticDrilldown/includes/SD_GlobalFunctions.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | if (!defined('MEDIAWIKI')) die(); |
10 | 10 | |
11 | | -define('SD_VERSION','0.3.8'); |
| 11 | +define('SD_VERSION','0.3.9'); |
12 | 12 | |
13 | 13 | // constants for special properties |
14 | 14 | define('SD_SP_HAS_FILTER', 1); |
— | — | @@ -510,6 +510,27 @@ |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
| 514 | +function sdfBooleanToString($bool_value) { |
| 515 | + $words_field_name = ($bool_value == true) ? 'smw_true_words' : 'smw_false_words'; |
| 516 | + $words_array = explode(',', wfMsgForContent($words_field_name)); |
| 517 | + // go with the value in the array that tends to be "yes" or "no" - |
| 518 | + // for SMW 0.7 it's the 2nd word, and for SMW 1.0 it's the 3rd |
| 519 | + $smw_version = SMW_VERSION; |
| 520 | + if ($smw_version{0} == '0') |
| 521 | + $index_of_word = 1; |
| 522 | + else |
| 523 | + $index_of_word = 2; |
| 524 | + // capitalize first letter of word |
| 525 | + if (count($words_array) > $index_of_word) { |
| 526 | + $string_value = ucwords($words_array[$index_of_word]); |
| 527 | + } elseif (count($words_array) == 0) { |
| 528 | + $string_value = $bool_value; // a safe value if no words are found |
| 529 | + } else { |
| 530 | + $string_value = ucwords($words_array[0]); |
| 531 | + } |
| 532 | + return $string_value; |
| 533 | +} |
| 534 | + |
514 | 535 | /** |
515 | 536 | * Prints the mini-form contained at the bottom of various pages, that |
516 | 537 | * allows pages to spoof a normal edit page, that can preview, save, |