Пример #1
0
 /**
  * Create a WPSC_Currency object
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @param 	string	$code			this currency's code, like "USD" for a U.S.A dollar, or "EUR" for a euro
  * @param 	string	$symbol			the text symbol for this currency, like "$"
  * @param 	string	$symbol_html    the HTML representation of the symbol, like "$"
  * @param 	string	$name           the currency name, like "US Dollar" or "Euro"
  *
  * @return void
  */
 public function __construct($code, $symbol = null, $symbol_html = null, $name = null)
 {
     // if all parameters are specified we are trying to make a new currency object
     if (!empty($code) && ($symbol != null || $symbol_html != null || $name != null)) {
         // Create a new currency object
         $this->code = $code;
         $this->symbol = $symbol;
         $this->symbol_html = $symbol_html;
         $this->name = $name;
     } else {
         // if only code is specified the constructor is typing to get the information about an existing currency
         $wpsc_currency = WPSC_Countries::get_currency($code);
         $this->code = $wpsc_currency->code;
         $this->symbol = $wpsc_currency->symbol;
         $this->symbol_html = $wpsc_currency->symbol_html;
         $this->name = $wpsc_currency->name;
     }
 }