{"id":27950,"date":"2014-02-23T03:08:29","date_gmt":"2014-02-23T03:08:29","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/forms-3rd-party-xpost\/"},"modified":"2018-07-17T04:03:28","modified_gmt":"2018-07-17T04:03:28","slug":"forms-3rd-party-xpost","status":"publish","type":"plugin","link":"https:\/\/scn.wordpress.org\/plugins\/forms-3rd-party-xpost\/","author":7795090,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.4.3","stable_tag":"trunk","tested":"4.9.29","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Forms-3rdparty Xml Post","header_author":"zaus, leadlogic","header_description":"","assets_banners_color":"","last_updated":"2018-07-17 04:03:28","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/drzaus.com\/donate","header_plugin_uri":"https:\/\/github.com\/zaus\/forms-3rdparty-xpost","header_author_uri":"http:\/\/drzaus.com","rating":5,"author_block_rating":0,"active_installs":200,"downloads":8099,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.3.2":"<ul>\n<li>fixed a bug in root parsing for already xml, please let me know if it breaks your usage<\/li>\n<\/ul>","1.3":"<ul>\n<li>no longer prefixes standalone numerical indexes with <code>n<\/code><\/li>\n<li>instead will repeat the &#039;parent&#039; element -- so a mapping of <code>item\/%i\/sub%i<\/code> could make ``<\/li>\n<\/ul>","1.2":"<ul>\n<li>no longer requires that you escape backslashes in the wrapper if providing XML (i.e. it starts with &lt;) -- breaks backwards compatibility<\/li>\n<\/ul>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1","0.2","0.4.3","0.5","1.0","1.3","1.4"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[5445,358,1152,361,1655],"plugin_category":[42,49],"plugin_contributors":[80258],"plugin_business_model":[],"class_list":["post-27950","plugin","type-plugin","status-publish","hentry","plugin_tags-cf7","plugin_tags-contact-form","plugin_tags-contact-form-7","plugin_tags-form","plugin_tags-gravity-forms","plugin_category-contact-forms","plugin_category-maps-and-location","plugin_contributors-zaus","plugin_committers-zaus"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/forms-3rd-party-xpost.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Converts external submission from <a href=\"http:\/\/wordpress.org\/plugins\/forms-3rdparty-integration\/\">Forms: 3rdparty Integration<\/a> plugin to an XML or JSON post; optionally can add custom headers (to allow SOAP submissions) or transform\/combine separate fields into nested values.<\/p>\n\n<p>This plugin can turn the 3rdparty mappings into XML elements, so that each form post will be the value (or attribute) of an XML element.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Unzip, upload plugin folder to your plugins directory (<code>\/wp-content\/plugins\/<\/code>)<\/li>\n<li>Make sure <a href=\"http:\/\/wordpress.org\/extend\/plugins\/contact-form-7\/\" title=\"Contact Form 7\">Contact Form 7<\/a> or <a href=\"http:\/\/www.gravityforms.com\/\" title=\"Gravity Forms\">Gravity Forms<\/a> is installed<\/li>\n<li>Make sure <a href=\"http:\/\/wordpress.org\/plugins\/forms-3rdparty-integration\/\">Forms: 3rdparty Integration<\/a> is installed<\/li>\n<li>Activate plugin<\/li>\n<li>Go to new admin subpage <em>\"3rdparty Services\"<\/em> under the CF7 \"Contact\" menu or Gravity Forms \"Forms\" menu and configure services + field mapping.<\/li>\n<li>Configure the new \"Xml Post\" section to choose which services send as xml and\/or determine special headers (given as a url querystring).<\/li>\n<li>Nest fields by separating nodes with <code>\/<\/code>, and indicate attributes with <code>@<\/code>.  Numeric indexes by themselves will result in repetition of the parent element (ex. <code>item\/%i\/sub<\/code> could make <code>&lt;item&gt;&lt;sub \/&gt;&lt;\/item&gt;&lt;item&gt;&lt;sub \/&gt;&lt;\/item&gt;<\/code>).<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><ol>\n<li>Unzip, upload plugin folder to your plugins directory (<code>\/wp-content\/plugins\/<\/code>)<\/li>\n<li>Make sure <a href=\"http:\/\/wordpress.org\/extend\/plugins\/contact-form-7\/\" title=\"Contact Form 7\">Contact Form 7<\/a> or <a href=\"http:\/\/www.gravityforms.com\/\" title=\"Gravity Forms\">Gravity Forms<\/a> is installed<\/li>\n<li>Make sure <a href=\"http:\/\/wordpress.org\/plugins\/forms-3rdparty-integration\/\">Forms: 3rdparty Integration<\/a> is installed<\/li>\n<li>Activate plugin<\/li>\n<li>Go to new admin subpage <em>\"3rdparty Services\"<\/em> under the CF7 \"Contact\" menu or Gravity Forms \"Forms\" menu and configure services + field mapping.<\/li>\n<li>Configure the new \"Xml Post\" section to choose which services send as xml and\/or determine special headers (given as a url querystring).<\/li>\n<li>Nest fields by separating nodes with <code>\/<\/code>, and indicate attributes with <code>@<\/code>.  Numeric indexes by themselves will result in repetition of the parent element (ex. <code>item\/%i\/sub<\/code> could make <code>&lt;item&gt;&lt;sub \/&gt;&lt;\/item&gt;&lt;item&gt;&lt;sub \/&gt;&lt;\/item&gt;<\/code>).<\/li>\n<\/ol><\/dd>\n<dt>I need help<\/dt>\n<dd><p>Submit an issue to the <a href=\"https:\/\/github.com\/zaus\/forms-3rdparty-xpost\/issues\" title=\"GitHub issue tracker\">GitHub issue tracker<\/a> in addition to \/ instead of the WP Support Forums.<\/p><\/dd>\n<dt>How do I add \/ configure a service?<\/dt>\n<dd><p>See \"base plugin\" <a href=\"http:\/\/wordpress.org\/plugins\/forms-3rdparty-integration\/\">Forms: 3rdparty Integration<\/a>.<\/p><\/dd>\n<dt>How do I set headers<\/dt>\n<dd><p>Provide the list of headers as though they were a URL querystring, so that<\/p>\n\n<blockquote>\n  <p>Content-Type: something\n  X-Special-Header: something-else<\/p>\n<\/blockquote>\n\n<p>would be given as<\/p>\n\n<blockquote>\n  <p><code>Content-Type=something&amp;X-Special-Header=something-else<\/code><\/p>\n<\/blockquote>\n\n<p>You may also use shortcodes such as <code>base64<\/code> in the header.<\/p><\/dd>\n<dt>How do I nest elements?<\/dt>\n<dd><p>Separate element names within the same 3rdparty field mapping using <code>\/<\/code>, so that in order to make:<\/p>\n\n<pre><code>&lt;credentials type=\"123\"&gt;\n    &lt;user&gt;xyz&lt;\/user&gt;\n    &lt;pass&gt;abc&lt;\/pass&gt;\n&lt;\/credentials&gt;\n<\/code><\/pre>\n\n<p>you would use <code>credentials\/@type<\/code>, <code>credentials\/user<\/code> and <code>credentials\/pass<\/code>, respectively.<\/p>\n\n<p><strong>Note:<\/strong> You may nest and wrap elements even if not transforming into XML; they will be submitted as multi-dimensional arrays like:<\/p>\n\n<pre><code>credentials[@type]=123&amp;credentials[user]=xyz&amp;credentials[pass]=abc\n<\/code><\/pre><\/dd>\n<dt>How do I repeat elements?<\/dt>\n<dd><p>As of v1.3, if there is a standalone numerical index it will cause repetition of the \"parent\" element.<\/p>\n\n<p>ex) If the post is:<\/p>\n\n<pre><code>item =&gt; array (\n        0 =&gt; value1,\n        1 =&gt; value2,\n        2 =&gt; value3\n    )\n<\/code><\/pre>\n\n<p>it will result in<\/p>\n\n<pre><code>&lt;item&gt;value1&lt;\/item&gt;\n&lt;item&gt;value2&lt;\/item&gt;\n&lt;item&gt;value3&lt;\/item&gt;\n<\/code><\/pre>\n\n<p>You can accomplish this with the Forms-3rdparty separator <code>[%]<\/code> to place your index appropriately.<\/p><\/dd>\n<dt>How do I set xml prolog attributes?<\/dt>\n<dd><p>Just enter the entire root xml in the field, a la http:\/\/stackoverflow.com\/questions\/5992268\/simplexml-how-to-correctly-set-encoding-and-xmins<\/p><\/dd>\n<dt>How do I autoclose\/not autoclose empty values?<\/dt>\n<dd><p>To produce <code>&lt;SomeTag \/&gt;<\/code>, make sure the \"Autoclose\" option is enabled.\nTo produce <code>&lt;SomeTag&gt;&lt;\/SomeTag&gt;<\/code>, make sure the \"Autoclose\" option is unchecked.<\/p><\/dd>\n<dt>How do I completely customize the xml\/wrappers\/transform?<\/dt>\n<dd><p>Use the 'Mask' format, which allows you to specify the result exactly as you want via string replacement (<code>sprintf<\/code>), or the 'Replace'\/'Advanced Replace' format which will replace string tokens (<code>{{3rdparty}}<\/code>).  Useful for complex XML.<\/p>\n\n<ul>\n<li>The 'Root Element' field will now be treated as a string-replacement mask (a la <code>sprintf<\/code> for \"Mask\" or <code>str_replace<\/code> for \"Replace\"), so make sure to include the post body with the appropriate placeholder(s) (<code>%s<\/code> for \"Mask\", <code>{{3rdparty_Fields}}<\/code> for \"Replace\").<\/li>\n<li>For 'Mask' format, each '3rd-Party Field' will also be treated the same, using <code>%s<\/code> to indicate where the submission value should go.<\/li>\n<li>For 'Replace' format, repeating fields are not handled -- it essentially looks for instances of each \"3rd-Party Field\" column and replaces it with the corresponding input value.<\/li>\n<li>For 'Advanced Replace' format, it works the same except that repeating fields are handled in one of two ways:\n\n<ul>\n<li>Providing the shortcode <code>[xpost-loop on=\"repeatingFieldKey\" times=\"a number\"]loop content[\/xpost-loop]<\/code> will repeat the <code>loop content<\/code> either <em>times<\/em> or for each key in the array <em>repeatingFieldKey<\/em> (which is your 3rdparty mapped field)<\/li>\n<li>otherwise it will suffix each repeating field key with its index and look for that as a placeholder (e.g. <code>myfield1<\/code>, <code>myfield2<\/code>, etc)<\/li>\n<\/ul><\/li>\n<\/ul><\/dd>\n<dt>How do I use the Advanced Replace format?<\/dt>\n<dd><p>For the given mapping:<\/p>\n\n<pre><code>Source                  3rdparty\n------                  --------\ninput_1                 name\ninput_2                 phone\ninput_3.1               files\\%i\\name\ninput_3.2               files\\%i\\name\ninput_3.3               files\\%i\\name\ninput_4.1               files\\%i\\content\ninput_4.2               files\\%i\\content\ninput_4.3               files\\%i\\content\ninput_5.1               files\\%i\\mime\ninput_5.2               files\\%i\\mime\ninput_5.3               files\\%i\\mime\n<\/code><\/pre>\n\n<p>Normally the <code>input_3.*<\/code> fields would get grouped together, as would the <code>input_4.*<\/code> fields.  Using separator <code>[%]<\/code>, it will create a nested list like:<\/p>\n\n<pre><code>array(\n    'files' =&gt; array(\n        0 =&gt; array(\n            'name' =&gt; 'value of input_3.1',\n            'mime' =&gt; 'value of input_5.1',\n            'content' =&gt; 'value of input_4.1' ),\n        1 =&gt; array(\n            'name' =&gt; 'value of input_3.2',\n            'mime' =&gt; 'value of input_5.2',\n            'content' =&gt; 'value of input_4.2' ),\n        2 =&gt; array(\n            'name' =&gt; 'value of input_3.3',\n            'mime' =&gt; 'value of input_5.2',\n            'content' =&gt; 'value of input_4.3' ),\n))\n<\/code><\/pre>\n\n<p>With Advanced Replacement, you could set the \"Root Elements\" field to something like the following (which mimics a normal form upload):<\/p>\n\n<pre><code>--multipartboundaryPE6azq\nContent-Disposition: form-data; name=\"myNameField\"\n\n{{name}}\n--multipartboundaryPE6azq\nContent-Disposition: form-data; name=\"myPhoneField\"\n\n{{phone}}\n[xpost-loop on=\"files\"]--multipartboundaryPE6azq\nContent-Disposition: form-data; name=\"myUploadFiles\"; filename=\"{{name}}\"\nContent-Type: {{mime}}\n\n{{content}}\n[\/xpost-loop]\n<\/code><\/pre>\n\n<p>Note the use of the shortcode <code>xpost-loop<\/code> which will repeat for each of the elements in the nested <code>files<\/code> array, replacing the placeholders accordingly.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.4.3<\/h4>\n\n<ul>\n<li>added new \"Advanced Replace\" format which behaves the same as the existing mustache-style replacement but with <code>xpost-loop<\/code> shortcode<\/li>\n<li>fix: cloning row clears textarea field too<\/li>\n<\/ul>\n\n<h4>1.4.2<\/h4>\n\n<ul>\n<li>wrapper field is textarea for easier format usage<\/li>\n<\/ul>\n\n<h4>1.4.1<\/h4>\n\n<ul>\n<li>fix constructor warning for PHP7<\/li>\n<\/ul>\n\n<h4>1.4<\/h4>\n\n<ul>\n<li>new string replacement format using mustache-style token placeholders <code>{{3rdparty}}<\/code><\/li>\n<\/ul>\n\n<h4>1.3.3<\/h4>\n\n<ul>\n<li>actually fix #24 parsing xml in root<\/li>\n<\/ul>\n\n<h4>1.3.2<\/h4>\n\n<ul>\n<li>fix: bug parsing existing xml root<\/li>\n<li>allow shortcodes in root<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>removed somewhat useless numerical index prefixing (n0, n1, nEtc)<\/li>\n<li>replaced with element repetition instead<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>ignores xml root when considering escaped backslashes (compatibility break -- please update your setting accordingly)<\/li>\n<li>'mask' format -- greater flexibility and control over field\/wrapper<\/li>\n<li>shortcodes in header; base64 shortcode<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>autoclose option<\/li>\n<li>decided it was good enough to be v1<\/li>\n<\/ul>\n\n<h4>0.5<\/h4>\n\n<ul>\n<li>Added <code>multipart\/form-data<\/code> and 'url' formatting per GitHub issue #6 https:\/\/github.com\/zaus\/forms-3rdparty-xpost\/issues\/6<\/li>\n<li>Added xml prolog\/root workaround per GitHub issue #8 https:\/\/github.com\/zaus\/forms-3rdparty-xpost\/issues\/8\n\n<ul>\n<li>Can now enter actual xml as root element for finer customization<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>0.4.2<\/h4>\n\n<p>Can post body as json instead<\/p>\n\n<h4>0.4<\/h4>\n\n<p>Fixed GitHub issue #3 https:\/\/github.com\/zaus\/forms-3rdparty-xpost\/issues\/3:<\/p>\n\n<ul>\n<li>each plugin setting is only applied to that specific service if it has a value<\/li>\n<li>removed default <code>post<\/code> wrapper unless sending as xml (and if you send XML you should specify a wrapper)<\/li>\n<\/ul>\n\n<h4>0.3<\/h4>\n\n<p>Can nest regular post fields even when not submitting XML.<\/p>\n\n<h4>0.2<\/h4>\n\n<ul>\n<li>Element nesting, attributes<\/li>\n<li>reworked \"xmlify\" using recursive <code>SimpleXMLElement<\/code><\/li>\n<\/ul>\n\n<h4>0.1<\/h4>\n\n<p>Base version - xml and header transformation<\/p>","raw_excerpt":"Converts submission from Forms 3rdparty Integration to xml\/json, add headers, or nest fields.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/27950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=27950"}],"author":[{"embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/zaus"}],"wp:attachment":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=27950"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=27950"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=27950"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=27950"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=27950"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=27950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}