Blocks

Recommended Blocks

Skrill Payment Button
Type: js
Categories: Payment
Plugins related: Generic
Skrill email or ID
Price amount
Currency
URL to return after payment
URL to return after cancelled payment
Product name
Language
Exchange Rates with Free Currency Converter API
Type: js
Categories: Exchange Rate,Payment
Plugins related: Generic

The block reads the exchange rates from the Currency Converter API website

Enter the API Key

The block includes the currencyconverter operation whose parameter is a plain object with the following properties:

  • from: a three letters currency code. For example: USD (required)
  • to: a three letters currency code. For example: GBP (required)
  • field: a valid jQuery selector of an input tag for assigning the exchange rate. For example, if you are using the calculated fields form plugin, and you want to assign the exchange rate to the fieldname1 field, the selector would be: [id*="fieldname1_"] (optional)
  • callback: a function that will receive as parameter the corresponding exchange rate. For example: function(rate){alert(rate);} (optional)

Example:

currencyconverter({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});

A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:

(function(){
currencyconverter({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:

(function(){
currencyconverter({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

Prevent framing
Type: js
Categories: Security
Plugins related: Generic

This will insert a block to find out if the page is embedded as a frame to other site and will prevent that by redirecting to the correct page without framing.

Message if framing detected:

Address Field
Type: html
Categories: Form Tools
Plugins related: wpcf7

"Address Field" inserts an autocomplete address field integrated to Google Places.

Address Field
Field type Required field
Name
Id attribute
Class attribute
Google api key
If you have no an api key, visit the Google Console, and generate one to your website's domain.
Restrict the address to the countries
It is possible select a maximum of 5 countries.
Ad Blocker Alert
Type: js
Categories: Security
Plugins related: Generic

"Ad Blocker Alert" displays a pop-up window if there is an Ad Blocker active in the browser, and limit the access to the page's content.

Ad Blocker Alert

Message to display:

Words Counter
Type: js
Categories: Text Tools
Plugins related: Generic

"Words Counter" inserts a javascript block with the wordsCounter routine:

wordsCounter(text);

  • text: Text to check.

Example:

wordsCounter("Lorem ipsum");

Output: 2

Pie Chart
Type: js
Categories: Charts
Plugins related: Generic

"Pie Chart" inserts a javascript block with the setPieChartBlock routine to generate pie chart into a canvas tag with the values passed as parameters:

setPieChartBlock(canvasId, values);

Pie Chart
  • canvasId: the routine requires you insert a <canvas id="canvasId"></canvas> tag in your webpage where display the chart. The id of the canvas tag should be passed as the first parameter of the routine.
  • values: array of values to display in the chart. For example: [10,5,100].

    To display a label associated to the values, the elements in the array must be objects with the structure: {label: <text here>, value: <number here>}
    For example: [{label: 'First item', value: 10},{label: 'Second item', value: 5},{label: 'Third item', value: 100}]

    To specify the colors of bars, define the colors code as part of the object (if no colors are defined, the plugin will use the default colors).
    For example: [{label: 'First item', value: 10, color: '#FF0000'},{label: 'Second item', value: 5, color: '#00FF00'},{label: 'Third item', value: 100, color: '#0000FF'}]

Example:

setPieChartBlock('canvasId', [{label: 'First item', value: 10, color: '#FF0000'},{label: 'Second item', value: 5, color: '#00FF00'},{label: 'Third item', value: 100, color: '#0000FF'}]);

Bubble Chart
Type: js
Categories: Charts
Plugins related: Generic

"Bubble Chart" inserts a javascript block with the setBubbleChartBlock routine to generate a bubble chart into a canvas tag with the values passed as parameters:

setBubbleChartBlock(canvasId, values);

Bubble Chart
  • canvasId: the routine requires you insert a <canvas id="canvasId"></canvas> tag in your webpage where display the chart. The id of the canvas tag should be passed as the first parameter of the routine.
  • values: array of values to display in the chart. For example: [10,5,100].

    To display a label associated to the values, the elements in the array must be objects with the structure: {label: <text here>, value: <number here>}
    For example: [{label: 'First item', value: 10},{label: 'Second item', value: 5},{label: 'Third item', value: 100}]

    To specify the color of points, pass an object as the third parameter of the "setBubbleChartBlock" function, with the color attribute (if no color is defined, the plugin will use a color by default).
    For example:
    setBubbleChartBlock('canvasId', [{label: 'First item', value: 10},{label: 'Second item', value: 5},{label: 'Third item', value: 100}],{color: '#FF0000'});
Javascript Unserializer for serialized PHP Objects
Type: js
Categories: Tools
Plugins related: Generic

The "Javascript Unserializer" inserts a javascript block with the unserialize routine:

unserialize(phptext);

  • phptext: Serialized PHP Object.

Examples:

unserialize('O:8:"stdClass":2:{s:5:"attr1";s:15:"First Attribute";s:5:"attr2";s:16:"Second Attribute";}');

Output would be a javascript object with the structure:

{attr1:"First Attribute", attr2:"Second Attribute"}

Line Chart
Type: js
Categories: Charts
Plugins related: Generic

"Line Chart" inserts a javascript block with the setLineChartBlock routine to generate line chart into a canvas tag with the values passed as parameters:

setLineChartBlock(canvasId, data, config);

Line Chart
  • canvasId: the routine requires you insert a <canvas id="canvasId"></canvas> tag in your webpage where display the chart. The id of the canvas tag should be passed as the first parameter of the routine.
  • data: array of datasets with the information to display in the chart. For example:

      [
        {
          'dataset': 'First Dataset',
          'color' : 'red',
          'values' : {
            'label a': 10,
            'label b': 15,
          'label c': 30
          }
        },
        {
          'dataset': 'Second Dataset',
          'color' : 'blue',
          'values' : {
            'label a': 40,
            'label b': 20,
            'label c': 5
          }
        }
      ]
  • config: object tha allows to define the chart title. For example:

    {'title': 'Line Chart'}

Example:

setLineChartBlock('canvasId', [{'dataset': 'First Dataset','color': 'red','values': {'label a': 10,'label b': 15,'label c': 30}},{'dataset': 'Second Dataset','color': 'blue','values': {'label a': 40,'label b': 20,'label c': 5}}],{'title': 'Line Chart'});

View All