In detail: PRO-Version 3.4.5

PRO-Version 3.4.5 comes with several new features, requested by users all over the world:

1. Add data to the URL by an extra shortcode-parameter “urladdparam”.
You can define an URL in the plugins templatemanager. If at a page this URL must be extended you can use the shortcode-parameter “urladdparam”.
Example: [jsoncontentimporterpro urladdparam=”?lets=go” id=3]
Then “?lets=go” will be added to the URL defined in template 3. So you can work with a template-url and twig code and can specify this a bit at the wordpress-page.


2. Use 3rd party shortcodes in the “urladdparam”-parameter of the shortcode.
Example: Some WordPress-Installations use the “s2Member Framework” as membership plugin.
To access member-data this plugin provides shortcodes like [s2Get user_field=user_email] which gives the E-Mailadress of a logged in user.
If you need to use the E-Mailadress in the url of the jsoncontentimporterpro-Shortcode you can do it this way:
[jsoncontentimporterpro url=http://wptest.kux.de/extra/json/t165.json urladdparam=”?mail=#BRO#s2Get user_field=user_email#BRC#”]…[/jsoncontentimporterpro]
Hereby: “%22” stands for a quotation mark, “&” will be replaced by “&” and “#BRO#” / “#BRC#” stand for [ / ]


3. Use CURLOPT as you like
When you check the access to your API-URL the best way is to do it with CURL: Then you can set many CURL-options as the way of authentication, the header etc.. Before Version 3.4.5 this was possible in some ways, but now in all ways.
To do this, you can set up the shortcode-parameter “curloptions”.
Example:
[jsoncontentimporterpro url=… method=curlget curloptions=”CURLOPT_HTTPAUTH=CURLAUTH_BASIC;CURLOPT_TIMEOUT=30;CURLOPT_HTTPHEADER=a:b##c:d”]…[/jsoncontentimporterpro]

The “CURLOPT_…” must be separated by “;”. Then “CURLOPT_…=value” sets an option. “value” there can be a number or a constant like “CURLAUTH_DIGEST”.
Example: “CURLOPT_TIMEOUT=30” sets the timeout to 30 seconds. “CURLOPT_HTTPAUTH=CURLAUTH_BASIC” sets basic auth.
If a “CURLOPT_…” needs an array-input you can do it like this (separate array-items by “##”): “CURLOPT_HTTPHEADER=a:b##c:d”


4. Handle Array-Form-Input
When you set up a form for searching data you might need connected-checkboxes like “<input type=checkbox name=val[]> color1 <input type=checkbox name=val[]> color2”

The form send this GET-data to page and vias “urlparam” this can be passed to the API. Before 3.4.5 the type of GET-imput can’t be handled. Now this can be done this way:
[jsoncontentimporterpro url=… urlparam=”test#model%5B%5D” parser=twig]test={{urlparam.test}}, modell-checkbox.1: {{urlparam.modell.1}}, {{urlparam.modell.2}}…[/jsoncontentimporterpro]
Here the GET-parameter “test” and “modell[]” are passed to the API.
To the returning API-JSON the GET-parameter are added like to the array “urlparam” like this: field “test” and modell as “array” with the number of items: {“1″:”x”,”2″:””}}. If the checkbox is checked the value is “x”, otherwise “”.


5. Custom Field: Key and value added to JSON
When you set up the url for [jsoncontentimporterpro url=…] you can add the value of a Custom Filed of that page to the URL like this: url=”http://….?a=<cf_nameOfCustomField>&b=something”.
The Plugin will extract “nameOfCustomField” out of “<cf_nameOfCustomField>”, get the value of the Custom Filed and insert it into the URL.
This worked before Version 3.4.5, but now the JSON availabe for twig contains the value of the Custom Field in the array “cfp”. So twig has access to it by {{cfp.nameOfCustomField}}.