admin Опубликовано 15 октября, 2011 Жалоба Поделиться Опубликовано 15 октября, 2011 Narodowy Bank PolskiВ папке models создать файл nbp.class.php (Create a file nbp.class.php in the folder models.)<?php/*** @author stankiewiczpl.opole at gmail.com 12-Oct-2011*/// no direct accessdefined('_JEXEC') or die('Restricted access');/*** Euro foreign exchange reference rates by the National Bank of Poland*/class currency_data_nbp extends currency_data{ function __construct() { parent::__construct(); // $this->before_flag = FALSE; // differences b/w rates are taken from the same XML source $this->url = "http://www.nbp.pl/kursy/xml/LastA.xml"; // last day rates $this->bank_name = "Narodowy Bank Polski"; $this->bank_url = "http://www.nbp.pl/"; $this->currency_name = "PLN"; } function get_array($xml, $day = '', $replace_currency_array) { // Handle no data received error if (!isset ($xml->document->pozycja)) { $error ['error'] = 1; return $error; } // Save currencies' rates in an associative array indexed by currency 3 char code $rates = array(); // array to store currencies exchange rates $data = $xml->document->pozycja; $rates ['date'] = $xml->document->data_publikacji [0]->data(); foreach ($data as $dt) { $code = $dt->kod_waluty [0]->data(); // Store data for selected by user currencies only, if they are set if (empty ($this->currencies) || in_array($code, $this->currencies)) { $rates ['currency'] [$code] ['scale'] = $dt->przelicznik [0]->data(); // units $rates ['currency'] [$code] ['name'] = parent::replace_currency_name($dt->nazwa_waluty [0]->data(), $code, $replace_currency_array); $rates ['currency'] [$code] ['rate'] = str_replace(',', '.', $dt->kurs_sredni [0]->data()); } } // Save additional info (only one time) if ($day == 'today' || $this->before_flag == FALSE) { $rates['info'] = array( "bank_name" => $this->bank_name, "bank_url" => $this->bank_url, "currency_name" => $this->currency_name); } return $rates; } public function getUrl($date = "") { if (strlen($date) > 1) { $file = file_get_contents('http://nbp.pl/Kursy/xml/dir.txt'); //list filenames of last days rates preg_match_all('/^(a.+)/mi', $file, $pregs); $count = count($pregs[1]) - 2; $filename = $pregs[1][$count]; $xml_source = substr($filename, 0, -1); $url = 'http://nbp.pl/Kursy/xml/' . $xml_source . '.xml'; //before last day rates } else { $url = $this->url; } return $url; }} в mod_jextcurrency.xml в секцию source_class добавить (add code to section source_class in mod_jextcurrency.xml)<option value="nbp">MOD_JEXTCURRENCY_SOURCE_OPTION_NBP</option> Цитата Ссылка на комментарий Поделиться на другие сайты More sharing options...
Misiek Опубликовано 30 октября, 2013 Жалоба Поделиться Опубликовано 30 октября, 2013 Hi Admin!First of all thank you very much for your module, it is amazing! I was using it on Joomla 2.5 and was very impressed, every thing was working absolutely fine. I changed my joomla to 3.x and found on forum module working with this version of Joomla but unfortunatelly code above doesn't work with J3.x.I tried to contact author but mailbox doesn't exists.Is there any chance to get your extension working with polish bank stated above? Can you please have a look on code above and make changes to make it work?Pretty please ! Kind regards, Emil. Цитата Ссылка на комментарий Поделиться на другие сайты More sharing options...
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.
Примечание: Ваш пост будет проверен модератором, прежде чем станет видимым.