r97669 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97668‎ | r97669 | r97670 >
Date:21:46, 20 September 2011
Author:yaron
Status:deferred
Tags:
Comment:
Filter's name value is only saved to the XML if it's not empty; other small improvements
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_PageSchemas.php
@@ -14,7 +14,7 @@
1515 * from the Page Schemas extension.
1616 */
1717 public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) {
18 - $sdarray = array();
 18+ $sd_array = array();
1919 if ( $objectName != "semanticdrilldown_Filter" ) {
2020 return true;
2121 }
@@ -27,12 +27,12 @@
2828 foreach ( $value->children() as $val ) {
2929 $l_values[] = (string)$val;
3030 }
31 - $sdarray['Values'] = $l_values;
 31+ $sd_array['Values'] = $l_values;
3232 } else {
33 - $sdarray[$prop] = (string)$value;
 33+ $sd_array[$prop] = (string)$value;
3434 }
3535 }
36 - $object['sd'] = $sdarray;
 36+ $object['sd'] = $sd_array;
3737 return true;
3838 }
3939 }
@@ -57,7 +57,7 @@
5858 }
5959
6060 if ( array_key_exists( 'Name', $filter_array ) ) {
61 - $filterName = $filter_array['Name'];
 61+ $filterName = $filter_array['Name'];
6262 } else {
6363 $filterName = '';
6464 }
@@ -174,7 +174,9 @@
175175 if ( substr( $var, 0, 15 ) == 'sd_filter_name_' ) {
176176 $xml = '<semanticdrilldown_Filter>';
177177 $fieldNum = substr( $var, 15 );
178 - $xml .= '<Name>'.$val.'</Name>';
 178+ if ( !empty( $val ) ) {
 179+ $xml .= '<Name>' . $val . '</Name>';
 180+ }
179181 } elseif ( substr( $var, 0, 17 ) == 'sd_values_source_') {
180182 if ( $val == 'category' ) {
181183 $xml .= '<ValuesFromCategory>' . $request->getText('sd_category_name_' . $fieldNum) . '</ValuesFromCategory>';