[WordPress] 外掛分享: Euro FxRef Currency Converter

前言介紹

  • 這款 WordPress 外掛「Euro FxRef Currency Converter」是 2012-09-30 上架。
  • 目前有 200 個安裝啟用數。
  • 上一次更新是 2024-03-29,距離現在已有 400 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.3 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.0 以上。
  • 有 6 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

joostdekeijzer |

外掛標籤

currency | converter | shortcode | currency converter | foreign exchange conversion |

內容簡介

透過 [currency] 短碼,您可以將一種貨幣轉換為另一種貨幣,轉換基於歐洲央行公佈的匯率(每天在 CET 下午 2:15 到下午 3:00 之間更新)。

您可以從任何支援的貨幣中更改貨幣。

[currency_legal] 短碼會輸出免責聲明文字以及連結到歐洲央行歐元匯率參考頁面。

這個外掛程式是基於 Xclamation 開發的外掛程式。

也可見於 https://github.com/joostdekeijzer/wp_eurofxref

短碼使用和範例
currency_legal 短碼

這個短碼會回傳字串 ‘* For informational purposes only. Exchange rates may vary. Based on ECB reference rates.’

位於前面的 ‘* ‘(和 [currency] 附加字串相同的字串)可以使用 ‘prepend’ 屬性進行更改。

例如: [currency_legal prepend='Please note: ']

legal_string 方法

這個免責聲明文字也可以在 PHP 中獲取

使用方法

參數

$prepend (字串)要在免責聲明文字前面追加的字串,預設為 ‘* ‘

返回值

(字串)免責聲明文字以 $prepend 字串為前置字串。

currency 短碼

from:貨幣代號(預設值:EUR)
to:貨幣代號(預設值:USD)
amount:從貨幣的數量(預設值:1)
iso:布林值(true 或 false,預設值 false),使用 ISO 貨幣格式
show_from:布林值(預設為 true),在輸出中顯示「從」數量
between:字串(預設為 ‘ / ’,在瀏覽器中顯示為
‘ / ‘),在從和到數量間顯示的字串。
append:字串(預設為 ‘ ‘,在瀏覽器中顯示為 ‘ ‘),轉換後
放置在文字之後的字串。* 參考免責聲明文字,請參閱 [currency_legal] 短碼。
round:布林值(預設為 true),四捨五入為整數。
round_append:字串(預設為 ‘=’),取代小數點。
to_style:CSS 格式文字(預設為
‘cursor:help;border-bottom:1px dotted gray;’),格式化「到」文本的樣式。

從非歐元貨幣轉換為非歐元貨幣的方式是透過歐元,例如計算 GBP 轉換成 USD 的匯率時,會計算 GBP -> EUR -> USD。

convert 方法

自從 v1.3 版本後,您可以在 PHP 中以靜態方式呼叫轉換器。

使用方法

參數

$amount (浮點數) 您要轉換的貨幣數量。
$from (字串) 貨幣代碼的數量所在,預設為 EUR。
$to (字串) 貨幣代碼所要轉換的數量,預設為 USD

返回值

(浮點數) 轉換後的值,如果其中任何貨幣代碼不可用,則返回 0(零)。

範例

[currency amount="875" from="EUR" to="GBP"]
將成為 「€ 875,= / £ 697.= *」
[currency amount="875" from="GBP"

原文外掛簡介

Using the [currency] shortcode you can convert one currency to another. The conversion is based on the rates published by the ECB. You can change from and to any of the supported currencies.
The [currency_legal] shortcode outputs a disclaimer text and a link to the ECB eurofxref page.
Important!
ECB advices against using their rates for transaction purposes. From their site: “The reference rates are published for information purposes only. Using the rates for transaction purposes is strongly discouraged.”
The reference rates are usually updated by ECB at around 16:00 CET every working day, except on TARGET closing days.
Go to the ECB site for more information and disclaimers.
Also note that conversion from non-Euro to non-Euro is done through the Euro, so GBP to USD is calculated as GBP → EUR → USD (converted 2 times).
This plugin is based on a plugin by Xclamation.
Also see wp_eurofxref on GitHub where development takes place.
Shortcode usage & examples
currency_legal shortcode
This shortcode returns the string ‘* For informational purposes only. Exchange rates may vary. Based on ECB reference rates.’
The prepended ‘* ‘ (the same string as the [currency] append string) can be changed using the ‘prepend’ attribute.
For example: [currency_legal prepend='Please note: ']
If you want to change the default prepent string for your whole site you can use the default shortcode_atts_currency_legal filter.
See the shortcode_atts_{$shortcode} reference for more information about this.
currency shortcode
Attributes:

from: currency code (default: EUR)
to: currency code (default: USD)
amount: number of “from” currency (default: 1)
iso: boolean (default false); use ISO currency formatting.”€ 1″ would become “1 EUR” in ISO notation.
show_from: boolean (default true); show from amount in output
between: string (default ‘ / ’ which is displayed as ‘ / ‘ in the browser); string between from and to amounts
append: string (default ‘ ‘ which is displayed as ‘ ‘ in the browser); string put after conversion. The * references the disclaimer text, see [currency_legal] shortcode.
round: boolean (default true); Round numbers to whole units.
round_append: string (default ‘=’); replaces decimals
no_from_show_rate: boolean (default true); when from amount is hidden in the output the “to” text gets a tooltip that displays the exchange rate. The element with this tooltip is styled with the to_style css string below. Set the no_from_show_rate option to false to disable the and tooltip.
to_style: css string (default ‘cursor:help;border-bottom:1px dotted gray;’); styling of “to” text wrapper.

If you want to change the defaults for your whole site you can use the default shortcode_atts_currency filter. See the shortcode_atts_{$shortcode} reference for more information about this.
Examples

[currency amount="875" from="EUR" to="GBP"]
becomes “€ 875,= / £ 697.= *”
[currency amount="875" from="GBP" to="USD" iso=true between=" converts to " append="" round_append=""]
becomes “875 GBP converts to 1,418 USD”
[currency amount="875" from="GBP" to="USD" show_from=false round=false]
becomes “$ 1,130.15 *”

Static method usage & examples
`legal_string` method
The legal string can also be retrieved in PHP
Usage

Parameters

$prepend (string) The string to prepend the legal text with, default ‘* ‘

Return Value
(string) Legal text prepended with $prepend string.
`convert` method
Since v1.3, you can call the convertor staticly from PHP in your code.
Usage

Parameters

$amount (float) The amount of currency you want to convert.
$from (string) The currency code the amount is in, default EUR.
$to (string) The currency code the amount must be converted to, default USD

Return Value
(float) the converted value or 0 (zero) if any of the currency code’s are not available.
Examples


will return the raw numeric (float) value without formatting: 6.01877256317689468545495401485823094844818115234375

Currently available currencies

AUD – Australian dollar ($)
BGN – Bulgarian lev (лв.)
BRL – Brasilian real (R$)
CAD – Canadian dollar ($)
CHF – Swiss franc (CHF)
CNY – Chinese yuan (¥)
CZK – Czech koruna (Kč)
DKK – Danish krone (kr.)
EUR – Euro (€)
GBP – Pound sterling (£)
HKD – Hong Kong dollar ($)
HUF – Hungarian forint (Ft)
IDR – Indonesian rupiah (Rp)
ILS – Israeli new sheqel (₪)
INR – Indian rupee (₹)
ISK – Icelandic króna (kr.)
JPY – Japanese yen (¥)
KRW – South Korean won (₩)
MXN – Mexican peso ($)
MYR – Malaysian ringgit (RM)
NOK – Norwegian krone (kr)
NZD – New Zealand dollar ($)
PHP – Philippine peso (₱)
PLN – Polish złoty (zł)
RON – Romanian leu (lei)
SEK – Swedish krona (kr)
SGD – Singapore dollar ($)
THB – Thai baht (฿)
TRY – Turkish lira (₺)
USD – United States (US) dollar ($)
ZAR – South African rand (R)

LTL and LVL are not published any more at least since 2-jan-2020.
RUB is not published since 1-jun-2022 and HRK since 2-jan-2023.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Euro FxRef Currency Converter」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 2.0 | 1.2.1 | 1.4.1 | 1.4.2 | 1.5.2 | 2.0.1 | 2.0.2 | trunk |

延伸相關外掛(你可能也想知道)

  • Currency Converter Calculator 》❤️‍ 是一款魔法實時且使用方便、帶有精美 UI 的小工具。 包括 195+ 個世界貨幣和熱門加密貨幣。, 📌 關於, 簡單而強大的實時貨幣轉換器小工具,適用於您的網...。
  • Currency Converter 》貨幣計算機,可在幣種之間轉換金額。大小、顏色和版面設定可自訂。, , 選擇計算機的預設幣種, 超過 200 種貨幣可供選擇, 選擇顯示格式,可調整寬度和標題顏色...。
  • Smart Currency Converter 》輸入金額,並查看兌換率!, , 在您的網站中加入 Smart Currency Converter 外掛, 可選擇超過 70 種貨幣, 可以從您的外掛設置中更改預設貨幣, 快速、簡單、精...。

文章
Filter
Apply Filters
Mastodon