Linux 软件免费装
Banner图

ASARI Calculators

开发者 asaricrm
更新时间 2026年10月4日 23:47
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

forms contact form 7 calculator spreadsheet formulas

下载

1.0.0 1.0.1

详情介绍:

ASARI Calculators adds a spreadsheet editor to WordPress and connects it to the Contact Form 7 forms you already use, so you do not need to rebuild them in a separate form builder. You model the calculation the way you would in a spreadsheet: values and formulas such as =ROUND(B2*B3,2) or =IF(B4>0,B2/B4,0) in a grid of cells, edited under ASARI Calculators in the admin menu. Then you bind cells to form fields by adding a class such as b2-edit to an input or b7-read to a result. Results update live as visitors type, are sent in the Contact Form 7 email, and follow Polish and English number formats. The plugin requires Contact Form 7. Until Contact Form 7 is installed and active, an admin notice is shown and calculators are not loaded on the site. Example calculator The Add example calculator button at the top of the ASARI Calculators screen creates a ready-made loan or lease instalment calculator (amount, annual interest rate, number of months → monthly instalment, total cost, total interest) together with its Contact Form 7 form. The calculator then shows the form shortcode to paste into a page, with a Copy button and a link to edit the form. Labels are created in the site language. The button is shown until the example calculator exists. Connecting a calculator to a form Mark the form with the calculator ID, in one of these ways: Then bind fields or text elements to cells with classes (in Contact Form 7 tags use the class: option, e.g. [number salary class:b3-edit]): Results update live while visitors fill in the form, and the calculator also recalculates when the page loads, immediately before the form is submitted and after Contact Form 7 resets the form. Formulas A cell starting with = is a formula. Supported syntax: Examples: =B1*2, =SUM(B1:B4), =ROUND(B1/12,2), =IF(B1>0,B1,0), =IF(B3>5000,"high","low"). Formulas are evaluated by the plugin's own parser; they cannot run JavaScript. A formula that cannot be parsed shows an empty value. Numbers in Polish and English Field values are read in both Polish and English formats: 1 000,50, 1.000,50 and 10,000.50 all work, a label such as Basic - 250 zł becomes 250, -5 zł becomes -5 and 1,67% becomes 1.67. Labels starting with Tak / Yes / True become 1, and Nie / Bez / No / False become 0. A single separator followed by three digits (1,234) follows the site language: on a Polish site 1,234 is 1.234 and 1.234 is 1234, on an English site the other way round. Number inputs are always read exactly. Results in text fields and elements use the site decimal point, e.g. 7147,39 on a Polish site; number inputs always get 7147.39. Use the asari_calculators_number_format filter to add a thousands separator, e.g. array( 'decimal' => ',', 'thousands' => ' ' ) for 7 147,39. The plugin includes a Polish translation (used on WordPress 6.8 and later); WordPress.org language packs take precedence when available.

安装:

  1. Install and activate Contact Form 7.
  2. Upload the asari-calculators folder to /wp-content/plugins/ or install the plugin from the Plugins screen, then activate it.
  3. Go to ASARI Calculators and click Add example calculator, or build your own calculator and save it.
  4. Mark a Contact Form 7 form with the calculator ID and add bN-edit / bN-read classes to its fields.

屏幕截图:

  • The Contact Form 7 form of the example: fields are bound to cells with `b2-edit` and `b7-read` classes inside the calculator wrapper.
  • The calculator on a page: results update as the visitor types and are sent with the form.
  • A second calculator with an `IF` formula that returns text, used to fill a read field.

常见问题:

Does the plugin load scripts on every page?

No. The frontend script and style load only on requests that render a marked Contact Form 7 form or contain a calculator marker in the page content, and only the calculators used there are printed into the page.

Can results be calculated only when the form is submitted?

Yes. Return false from the asari_calculators_live_recalculation filter; the calculator then recalculates only on page load and before submission.

What happens to my calculators when I delete the plugin?

Deleting the plugin from the Plugins screen removes all calculators (the asari_calculators_data option, on every site of a multisite network). Deactivating keeps them.

My calculator is inserted in a way the plugin does not detect.

Use the asari_calculators_enqueue_all_frontend_calculators filter (return true) to load all calculators, or asari_calculators_frontend_calculators to choose them for the current page.

更新日志:

1.0.1 1.0.0 0.1.0 – 0.1.3