r93556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93555‎ | r93556 | r93557 >
Date:19:21, 30 July 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
function getXMLTextForPS
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php
@@ -35,7 +35,42 @@
3636 }
3737 return true;
3838 }
39 -
 39+ public static function getXMLTextForPS( $wgRequest, &$text_extensions ){
 40+ $Xmltext = "";
 41+ $templateNum = -1;
 42+ $Xmltext .= '<Filter>';
 43+ foreach ( $wgRequest->getValues() as $var => $val ) {
 44+ if(substr($var,0,15) == 'sd_filter_name_'){
 45+ $templateNum = substr($var,15,1);
 46+ $Xmltext .= '<Label>'.$val.'</Label>';
 47+ }else if(substr($var,0,17) == 'sd_values_source_'){
 48+ if ( $val == 'category' ) {
 49+ $Xmltext .= '<ValuesFromCategory>'.$wgRequest->getText('sd_category_name_'.$templateNum).'</ValuesFromCategory>';
 50+ }else if ( $val == 'dates' ) {
 51+ $Xmltext .= '<TimePeriod>'.$wgRequest->getText('sd_time_period_'.$templateNum).'</TimePeriod>';
 52+ }else if ( $val == 'manual' ) {
 53+ $filter_mannual_values_str = $wgRequest->getText('sd_filter_values_'.$templateNum);
 54+ // replace the comma substitution character that has no chance of
 55+ // being included in the values list - namely, the ASCII beep
 56+ $listSeparator = ',';
 57+ $filter_mannual_values_str = str_replace( "\\$listSeparator", "\a", $filter_mannual_values_str );
 58+ $filter_mannual_values_array = explode( $listSeparator, $filter_mannual_values_str );
 59+ $Xmltext .= '<Values>';
 60+ foreach ( $filter_mannual_values_array as $i => $value ) {
 61+ // replace beep back with comma, trim
 62+ $value = str_replace( "\a", $listSeparator, trim( $value ) );
 63+ $Xmltext .= '<Value>'.$value.'</Value>';
 64+ }
 65+ $Xmltext .= '</Values>';
 66+ }
 67+ }else if( substr($var,0,14) == 'sd_input_type_'){
 68+ $Xmltext .= '<InputType>'.$val.'</InputType>';
 69+ }
 70+ }
 71+ $Xmltext .= '</Filter>';
 72+ $text_extensions['sd'] = $Xmltext;
 73+ return true;
 74+ }
4075 public static function getHtmlTextForPS( &$js_extensions ,&$text_extensions ) {
4176 global $wgContLang;
4277