Index: branches/5.2.x/units/helpers/bank_lv_currency_rates.php =================================================================== diff -u -N -r15141 -r15166 --- branches/5.2.x/units/helpers/bank_lv_currency_rates.php (.../bank_lv_currency_rates.php) (revision 15141) +++ branches/5.2.x/units/helpers/bank_lv_currency_rates.php (.../bank_lv_currency_rates.php) (revision 15166) @@ -1,65 +1,65 @@ -RateSource = 'http://www.bank.lv/ValutuKursi/XML/xml.cfm'; - - parent::__construct(); - } - - function GetRatesData() - { - $xml_parser = xml_parser_create(); - - $curl_helper = $this->Application->recallObject('CurlHelper'); - /* @var $curl_helper kCurlHelper */ - - $xml = $curl_helper->Send($this->RateSource); - - xml_parse_into_struct($xml_parser, $xml, $struct, $index); - $data_res = Array(); - $currency = ''; - foreach($struct as $element) - { - switch($element['tag']) - { - case 'ID': - $currency = $element['value']; - $data_res[$currency]['ID'] = $currency; - $data_res[$currency]['TARGET'] = 'LVL'; - break; - case 'UNITS': - $data_res[$currency]['UNITS'] = $element['value']; - break; - case 'RATE': - $data_res[$currency]['RATE'] = $element['value']; - break; - default: - } - } - - if(!$data_res['LVL']) - { - $data_res['LVL']['ID'] = 'LVL'; - $data_res['LVL']['UNITS'] = 1; - $data_res['LVL']['TARGET'] = 'LVL'; - $data_res['LVL']['RATE'] = 1; - } - $this->ExchangeRates = $data_res; - } -} +RateSource = 'http://www.bank.lv/ValutuKursi/XML/xml.cfm'; + + parent::__construct(); + } + + function GetRatesData() + { + $xml_parser = xml_parser_create(); + + $curl_helper = $this->Application->recallObject('CurlHelper'); + /* @var $curl_helper kCurlHelper */ + + $xml = $curl_helper->Send($this->RateSource); + + xml_parse_into_struct($xml_parser, $xml, $struct, $index); + $data_res = Array(); + $currency = ''; + foreach($struct as $element) + { + switch($element['tag']) + { + case 'ID': + $currency = $element['value']; + $data_res[$currency]['ID'] = $currency; + $data_res[$currency]['TARGET'] = 'LVL'; + break; + case 'UNITS': + $data_res[$currency]['UNITS'] = $element['value']; + break; + case 'RATE': + $data_res[$currency]['RATE'] = $element['value']; + break; + default: + } + } + + if(!$data_res['LVL']) + { + $data_res['LVL']['ID'] = 'LVL'; + $data_res['LVL']['UNITS'] = 1; + $data_res['LVL']['TARGET'] = 'LVL'; + $data_res['LVL']['RATE'] = 1; + } + $this->ExchangeRates = $data_res; + } +}