[wordpress插件] Open Currency Converter开放货币转换器

wordpress 插件 文章 2020-02-21 14:20 571 0 全屏看文

AI助手支持GPT4.0

评分
92
描述

If you have a wish to convert currencies “on the fly” within the text of a post or page then this is the plugin for you!

如果您希望在帖子或页面的文本中“即时”转换货币,那么这是适合您的插件!

It’s free to download, free to use and advert free – if you think you have to pay for something you’re doing it wrong!

它是免费下载,免费使用和免费发布的广告–如果您认为必须为做错的事情付费!

So, let’s say you run a UK based site and will refer to currencies in GBP.

因此,假设您经营一个英国网站,并将以英镑表示货币。

However, the majority of visitors are from the US, so you may have a wish to also show the dollar equivalent.

但是,大多数访问者来自美国,因此您可能希望也显示等价的美元。

Using this plugin you can do this without having to work out the conversion and then re-visit it in future to take into account conversion changes.

使用此插件,您无需进行转换就可以执行此操作,然后在将来重新访问它以考虑转换更改。

Key features include…

主要功能包括...

    • No need to update exchange rates yourself – data is fetched from an Open Source API
    • 无需自行更新汇率-数据是从开放源API获取的

    • Over 170 currencies supported
    • 支持超过170种货币

    • An easy to use shortcode for embedding directly into your posts and pages
    • 易于使用的简码直接嵌入到您的帖子和页面中

    • A PHP function for those people who wish to add features in their theme
    • 为那些希望在主题中添加功能的人提供的PHP函数

    • Results can be cached, reducing resources and improving response
    • 可以缓存结果,从而减少资源并提高响应速度

    • Template to allow you to control how results are output
    • 允许您控制结果输出方式的模板

    • Administration screen allowing you to define defaults and to view current exchange rates
    • “管理”屏幕可让您定义默认值并查看当前汇率

    • And much, much more!
    • 还有更多!

    Technical specification…

    技术规范...

      Please visit the Github page for the latest code development,

      请访问 Github页面,以获取最新的代码开发信息,

      planned enhancements and known issues.

      计划的增强功能和已知问题。

      Getting Started

      入门

      To add to your site simply use the [convert] shortcode.

      要添加到您的网站,只需使用 [convert] 简码。

      For example…

      例如……

      [convert number=49.99 from="gbp" to="usd"]

        [将数字= 49.99从=“ gbp”转换为=“ usd”]

      This would convert 49.99 GBP to USD.

      这会将49.99 GBP转换为USD。

      Getting Your App Key

      获取您的应用密钥

      Open Currency Converter gets its data from the Open Exchange Rates website (which is not associated with this plugin nor the developer).

      Open Currency Converter从Open Exchange Rates网站(与该插件或开发人员均未关联)获取其数据。

      This site requires an App Key to be specified for it to work.

      该网站需要指定一个应用程序密钥才能正常运行。

      This is to prevent over-use of the exchange system and to provide premium features for users who wish to pay for them.

      这是为了防止过度使用交换系统,并为希望付费的用户提供高级功能。

      Having a premium plan does not add any extra features to this plugin and is not a requirement.

      拥有高级计划不会为此插件添加任何额外功能,也不是必需的。

      To get your App Key sign up on the Open Exchange Rates site<

      要获取您的应用密钥,请在“开放汇率”网站上注册<

      /a>.

      / a>。

      Now head to your site’s admin and under “Setting” you should click on “Open Currency”.

      现在转到您网站的管理员,在“设置”下,您应点击“开放货币”。

      Enter the App Key into the appropriate field and Save the results.

      在适当的字段中输入应用密钥,然后保存结果。

      Disclaimer

      免责声明

      The exchange rate data is provided for free via the Open Source Exchange Rates project

      汇率数据是通过开放源汇率项目免费提供的

      .

      Its accuracy and availability are never guaranteed, and there’s no warranty provided.

      永远无法保证其准确性和可用性,并且不提供任何保修。

      The Options Screen

      选项屏幕

      Once the plugin is activated two new administration screens will be present.

      激活插件后,将出现两个新的管理屏幕。

        • Open Currency – This appears under “Settings” and allows you to specify default settings for any currency conversion
        • 打开货币 –在“设置”下显示,您可以为任何货币转换指定默认设置

        • Exchange Rates – Shown under the “Tools” menu, this displays the current exchange rates along with a list of all the valid exchange codes
        • 汇率 –显示在“工具”菜单下,显示当前汇率以及所有有效汇率的列表

        Before using this plugin it is highly recommended that you review the Options screen and change any values, as appropriate.

        在使用此插件之前,强烈建议您查看“选项”屏幕并根据需要更改任何值。

        You will also need to sign up for and enter an App Key before conversions will work.

        在进行转换之前,您还需要注册并输入应用密钥。

        Using the Shortcode

        使用简码

        The shortcode of ‘[convert]’ has the following parameters that you may specify…

        “ [convert]”的简码具有以下参数,您可以指定…

          • number – The number that you wish to convert from one currency to another.

          • 数字 –您希望从一种货币转换为另一种货币的数字。

            This is required

          • 这是必需的

          • from – The currency code that you wish to convert from (see the admin options for a list of valid codes).

          • 来自 –您希望从中转换的货币代码(有关有效代码列表,请参阅管理选项)。

            If you do not specify this value then the default from the options screen will be used

          • 如果您未指定此值,则将使用选项屏幕中的默认值

          • to – The currency code that you wish to convert to (see the admin options for a list of valid codes).

          • –您希望转换为的货币代码(有关有效代码列表,请参阅管理选项)。

            If you do not specify this value then the default from the options screen will be used.

          • 如果您未指定此值,则将使用选项屏幕中的默认值。

          • dp – How many decimal places the output should be.

          • dp –输出应保留的小数位数。

            This should be numeric or the word “match”.

            这应该是数字或单词“ match”。

            The latter is the default and will mean that the output will match the number of decimal places that the number was.

          • 后者是默认设置,表示输出将匹配 number 的小数位数。

          • template – See the later section, “Using Templates”, for further information
          • 模板 –有关详细信息,请参阅下一节“使用模板”

          Example of use are…

          使用示例是……

          [convert number=49.99 from="gbp" to="usd"]

            [将数字= 49.99从=“ gbp”转换为=“ usd”]

          This would convert 49.99 from UK pounds to US dollars and output the result to 2 decimal places.

          这会将49.99英镑从英镑转换为美元,并将结果输出到小数点后2位。

          [convert number=50 from="usd" to="gbp"]

            [将数字= 50从=“ usd”转换为=“ gbp”]

          This would convert 50 from US dollars to UK pounds and output the result without any decimal places.

          这会将50美元从美元转换为英镑,并输出结果,不带小数位。

          If the conversion can’t be done then an appropriate error message will be output instead.

          如果无法完成转换,则会输出相应的错误消息。

          If you wish to suppress these messages then you need to use a template (see the later section on this) – in this case no output will be generated in the case of an error.

          如果希望禁止显示这些消息,则需要使用模板(请参阅本章的后面部分)–在这种情况下,如果出现错误,将不会生成任何输出。

          Using Templates

          使用模板

          The template option allows you to specify other information to be output along with the conversion result.

          模板选项允许您指定其他信息以及转换结果一起输出。

          None of the template will be output if any error occurs, including any error messages, allowing you to suppress any conversion text in the case of a problem.

          如果发生任何错误(包括任何错误消息),则不会输出任何模板,从而使您可以在出现问题时取消任何转换文本。

          The template text must include %result% where you wish the output to appear.

          模板文本必须在您希望输出显示的位置包含%result%

          Here’s an example…

          这里有个例子……

          The retail price is $49.99[convert number=50 from=“use” to=“gap” template=" (approx.%result%) GBP”].

           零售价为$ 49.99 [将数字= 50从=“使用”转换为=“差距” template =“(%% result%)GBP”]。

          Normally, this would print a result such as…

          通常,这会打印诸如...的结果

          The retail price is $49.99 (approx. 79.11 GBP).

           零售价为$ 49.99(约79.11英镑)。

          However, if an error occurs then it will print as…

          但是,如果发生错误,它将显示为…

          The retail price is $49.99.

           零售价为$ 49.99。

          You may also include the template between opening and closing shortcode tags.

          您还可以在打开和关闭简码标签之间包含模板。

          For example…

          例如……

          The retail price is $49.99[convert number=50 from=“use” to=“gap”] (approx. %result% GBP)[/convert].

          Using the Function Call

           零售价为$ 49.99 [将数字= 50从=“使用”转换为=“差距”](大约%result%GBP)[/转换]。

          使用函数调用

          >

          >

          If you wish to perform a currency conversion within your theme, rather than within a post or page, then you can use a PHP function call.

          如果您希望在主题内而不是在帖子或页面内执行货币转换,则可以使用PHP函数调用。

          The function name is get_conversion and will return the result back.

          函数名称为 get_conversion ,它将返回结果。

            • All of the shortcode parameters are valid, except for the template which isn’t required
            • 除了不需要的模板之外,所有的简码参数均有效

            • The parameters are specified in any order and are separated with an ampersand
            • 可以按任意顺序指定参数,并用与号分隔

            • You should not add quotes around each parameter value, as you do with the shortcode
            • 您不应像对简码那样在每个参数值周围添加引号

            For example…

            例如……

              <?php echo get_conversion('number = 49.99&from = gbp&to = usd'); 

            ?>

            Global conversion variables

            ?>

            全局转换变量

            For the use of developers, 2 global variables have been added which, if assigned within your site code, will override the conversion codes.

            供开发人员使用,添加了2个全局变量,如果在您的站点代码中分配了这些全局变量,它们将覆盖转换代码。

            The variables are global_convert_from and global_convert_to.

            变量是 global_convert_from global_convert_to

            This is useful if, say, you have multiple versions of the site in different languages – you can then assign these global variables depending on which site is being viewed and all currency will be converted based upon these settings.

            如果您有不同语言版本的网站的多个版本,这将非常有用–然后您可以根据正在查看的网站分配这些全局变量,并根据这些设置转换所有货币。

            These will only override the options screen and not specific parameters specified with a shortcode or function call.

            这些将仅覆盖选项屏幕,而不覆盖通过短代码或函数调用指定的特定参数。

安装步骤

Open Currency Converter can be found and installed via the Plugin menu within WordPress administration (Plugins -> Add New).

可以通过WordPress管理中的“插件”菜单(插件->添加新文件)找到并安装Open Currency Converter。

Alternatively, it can be downloaded from WordPress.org and installed manually…

另外,也可以从WordPress.org下载并手动安装…

    1. Upload the entire artiss-currency-converter folder to your wp-content/plugins/ directory.
    2. 将整个 artiss-currency-converter 文件夹上传到您的 wp-content / plugins / 目录。

    3. Activate the plugin through the ‘Plugins’ menu in WordPress administration.
    4. 通过WordPress管理中的“插件”菜单激活插件。

    Voila!

    Voila!

    It’s ready to go.

    准备好了。

下载地址
https://downloads.wordpress.org/plugin/artiss-currency-converter.1.4.4.zip
-EOF-

AI助手支持GPT4.0