Перейти к содержанию
UTM.SPACE community

Лидеры

Популярный контент

Показан контент с высокой репутацией 03/04/14 во всех областях

  1. В папке models создать файл agroprombank.class.php <?php /** * @author Darang * @date 10-Feb-2013 * @copyright (c)2010-2013 JExt.biz */ // no direct access defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * exchange rates of Agroprombank */ class currency_data_agroprombank extends currency_data { function __construct() { parent::__construct (); $this->url = "http://www.agroprombank.com/xmlinformer.php?type=official&date="; $this->bank_name = "Агропромбанк"; $this->bank_url = "http://www.agroprombank.com"; $this->currency_name = ""; $this->date_format = 'Y-m-d'; } function get_array($xml, $day = '', $replace_currency_array) { // Handle no data received error if (! isset ( $xml->document->course)) { $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 $rates ['date'] = $xml->document->course[0]->attributes ( 'date' ); $data = $xml->document->course[0]->currency; foreach ( $data as $dt ) { $code = $dt->attributes ( 'code' ); // Store data for selected by user currencies only, if they are set if (empty ( $this->currencies ) || in_array ( $code, $this->currencies )) { //$rates ['currency'] [$code] ['numcode'] = $dt->ID [0]->data (); // num code $rates ['currency'] [$code] ['scale'] = 1; // units // Set currency name (array with replacement rules will be searched for the ISO code) $rates ['currency'] [$code] ['name'] = parent::replace_currency_name ( $code, $code, $replace_currency_array ); $rates ['currency'] [$code] ['rate'] = $dt->data (); // exchange rate } } // 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; } /** * Returns URL for receiving XML data file * * @param string Date * @return string URL */ public function getUrl($date = "") { if (strlen ( $date ) > 1) { $url = $this->url . $date; } else { $url = $this->url.date($this->date_format,time()); } //print_r($url); return $url; } } в mod_jextcurrency.xml в секцию source_class добавить <option value="agroprombank">Агропромбанк</option>
    1 балл
×
×
  • Создать...