r45318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45317‎ | r45318 | r45319 >
Date:15:40, 2 January 2009
Author:yaron
Status:deferred
Tags:
Comment:
Helper functions moved into SDUtils class
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_AppliedFilter.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/includes/SD_Filter.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/includes/SD_FilterValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_AppliedFilter.php
@@ -21,11 +21,11 @@
2222 $af->search_term = str_replace('_', ' ', $search_term);
2323 if ($lower_date != null) {
2424 $af->lower_date = $lower_date;
25 - $af->lower_date_string = sdfMonthToString($lower_date['month']) . " " . $lower_date['day'] . ", " . $lower_date['year'];
 25+ $af->lower_date_string = SDUtils::monthToString($lower_date['month']) . " " . $lower_date['day'] . ", " . $lower_date['year'];
2626 }
2727 if ($upper_date != null) {
2828 $af->upper_date = $upper_date;
29 - $af->upper_date_string = sdfMonthToString($upper_date['month']) . " " . $upper_date['day'] . ", " . $upper_date['year'];
 29+ $af->upper_date_string = SDUtils::monthToString($upper_date['month']) . " " . $upper_date['day'] . ", " . $upper_date['year'];
3030 }
3131 if (! is_array($values)) {
3232 $values = array($values);
@@ -148,7 +148,7 @@
149149 $res = $dbr->query($sql);
150150 while ($row = $dbr->fetchRow($res)) {
151151 if ($this->filter->time_period == wfMsg('sd_filter_month'))
152 - $value_string = sdfMonthToString($row[1]) . " " . $row[0];
 152+ $value_string = SDUtils::monthToString($row[1]) . " " . $row[0];
153153 else
154154 // why is trim() necessary here???
155155 $value_string = str_replace('_', ' ', trim($row[0]));
@@ -194,7 +194,7 @@
195195 $res = $dbr->query($sql);
196196 while ($row = $dbr->fetchRow($res)) {
197197 if ($this->filter->time_period == wfMsg('sd_filter_month'))
198 - $value_string = sdfMonthToString($row[1]) . " " . $row[0];
 198+ $value_string = SDUtils::monthToString($row[1]) . " " . $row[0];
199199 else
200200 // why is trim() necessary here???
201201 $value_string = str_replace('_', ' ', trim($row[0]));
Index: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php
@@ -20,7 +20,7 @@
2121 function load($filter_name) {
2222 $f = new SDFilter();
2323 $f->name = $filter_name;
24 - $properties_used = sdfGetValuesForProperty($filter_name, SD_NS_FILTER, '_SD_CP', SD_SP_COVERS_PROPERTY, SMW_NS_PROPERTY);
 24+ $properties_used = SDUtils::getValuesForProperty($filter_name, SD_NS_FILTER, '_SD_CP', SD_SP_COVERS_PROPERTY, SMW_NS_PROPERTY);
2525 if (count($properties_used) > 0) {
2626 $f->property = $properties_used[0];
2727 }
@@ -43,21 +43,21 @@
4444 }
4545 }
4646 }
47 - $categories = sdfGetValuesForProperty($filter_name, SD_NS_FILTER, '_SD_VC', SD_SP_GETS_VALUES_FROM_CATEGORY, NS_CATEGORY);
48 - $time_periods = sdfGetValuesForProperty($filter_name, SD_NS_FILTER, '_SD_TP', SD_SP_USES_TIME_PERIOD, null);
 47+ $categories = SDUtils::getValuesForProperty($filter_name, SD_NS_FILTER, '_SD_VC', SD_SP_GETS_VALUES_FROM_CATEGORY, NS_CATEGORY);
 48+ $time_periods = SDUtils::getValuesForProperty($filter_name, SD_NS_FILTER, '_SD_TP', SD_SP_USES_TIME_PERIOD, null);
4949 if (count($categories) > 0) {
5050 $f->category = $categories[0];
51 - $f->allowed_values = sdfGetCategoryChildren($f->category, false, 5);
 51+ $f->allowed_values = SDUtils::getCategoryChildren($f->category, false, 5);
5252 } elseif (count($time_periods) > 0) {
5353 $f->time_period = $time_periods[0];
5454 $f->allowed_values = array();
5555 } elseif ($f->is_boolean) {
5656 $f->allowed_values = array('0', '1');
5757 } else {
58 - $values = sdfGetValuesForProperty($filter_name, SD_NS_FILTER, '_SD_V', SD_SP_HAS_VALUE, null);
 58+ $values = SDUtils::getValuesForProperty($filter_name, SD_NS_FILTER, '_SD_V', SD_SP_HAS_VALUE, null);
5959 $f->allowed_values = $values;
6060 }
61 - $input_types = sdfGetValuesForProperty($filter_name, SD_NS_FILTER, '_SD_IT', SD_SP_HAS_INPUT_TYPE, null);
 61+ $input_types = SDUtils::getValuesForProperty($filter_name, SD_NS_FILTER, '_SD_IT', SD_SP_HAS_INPUT_TYPE, null);
6262 if (count($input_types) > 0) {
6363 $f->input_type = $input_types[0];
6464 }
@@ -115,7 +115,7 @@
116116 while ($row = $dbr->fetchRow($res)) {
117117 if ($this->time_period == wfMsg('sd_filter_month')) {
118118 global $sdgMonthValues;
119 - $date_string = sdfMonthToString($row[1]) . " " . $row[0];
 119+ $date_string = SDUtils::monthToString($row[1]) . " " . $row[0];
120120 $possible_dates[$date_string] = $row[2];
121121 } else {
122122 $date_string = $row[0];
Index: trunk/extensions/SemanticDrilldown/includes/SD_FilterValue.php
@@ -28,7 +28,7 @@
2929 if ($filter_time_period != null) {
3030 if ($filter_time_period == wfMsg('sd_filter_month')) {
3131 list($month_str, $year) = explode(' ', $fv->text);
32 - $fv->month = sdfStringToMonth($month_str);
 32+ $fv->month = SDUtils::stringToMonth($month_str);
3333 $fv->year = $year;
3434 } else {
3535 $fv->year = $fv->text;

Status & tagging log