Plugin Directory

Changeset 2413440


Ignore:
Timestamp:
11/05/2020 05:35:29 PM (4 years ago)
Author:
activecampaign
Message:

Release 8.1.0

Location:
activecampaign-subscription-forms/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • activecampaign-subscription-forms/trunk/README.md

    r2378752 r2413440  
    25254. Choose which subscription forms to cache locally, any optional sub-settings for each, then hit Update again.
    26265. Use `[activecampaign form=ID]` shortcode to display a form anywhere on your site where shortcode syntax is supported.
    27 6. Embed multiple forms onto a single page!
    28 7. Enable site tracking to have page visits tracked to ActiveCampaign.
     276. Add optional shortcode parameters `css=1` or `css=0` to override the plugin setting's "Use ActiveCampaign's form CSS" value.
     287. Embed multiple forms onto a single page!
     298. Enable site tracking to have page visits tracked to ActiveCampaign.
    2930
    3031## Frequently Asked Questions
     
    7273## Changelog
    7374
     75### 8.1.0
     76* Improvements to Gutenberg Editor experience, including live preview of Form embeds
     77* Background color bug fix
     78* Shortcode support for optional 'css' and 'static' attributes that default to plugin settings
     79* Avoiding global namespace conflicts of on-demand chunks bug fix
     80
    7481### 8.0.3
    7582* Pluggable bug fix
  • activecampaign-subscription-forms/trunk/activecampaign.php

    r2380663 r2413440  
    55Description: Allows you to add ActiveCampaign contact forms to any post, page, or sidebar. Also allows you to embed <a href="http://www.activecampaign.com/help/site-event-tracking/" target="_blank">ActiveCampaign site tracking</a> code in your pages. To get started, please activate the plugin and add your <a href="http://www.activecampaign.com/help/using-the-api/" target="_blank">API credentials</a> in the <a href="options-general.php?page=activecampaign">plugin settings</a>.
    66Author: ActiveCampaign
    7 Version: 8.0.3
     7Version: 8.1.0
    88Author URI: http://www.activecampaign.com
    99*/
     
    5151## version 8.0.2: Security fix to address CSRF vulnerability, general fix to address browser warning for invalid cookie attribute
    5252## version 8.0.3: Pluggable bug fix
     53## version 8.1.0: Improvements to Gutenberg Editor experience, including live preview of Form embeds. Background color bug fix. Shortcode support for optional 'css' and 'static' attributes that default to plugin settings. Avoiding global namespace conflicts of on-demand chunks bug fix.
    5354
    5455define("ACTIVECAMPAIGN_URL", "");
     
    6465 * @param  array   form      The individual form metadata (that we obtained from the forms/getforms API call).
    6566 * @param  boolean static    Set to true so the "floating" forms don't float. Typically this is done for the admin section only.
     67 * @param  boolean nostyles  Manual override value for nostyles URL Param. Used in shortcode eval to bypass plugin setting.
     68 * @param  boolean preview   Manual value for preview URL Param.
    6669 * @return string            The raw source code that will render the form in the browser.
    6770 */
    68 function activecampaign_form_source($settings, $form, $static = false) {
     71function activecampaign_form_source($settings, $form, $static = false, $nostyles = null, $preview = false) {
    6972    $source = "";
    7073    if (isset($form["version"]) && $form["version"] == 2) {
     
    7275            $source .= "<div class='_form_" . $form["id"] . "'></div>";
    7376        }
    74         // Set to activehosted.com domain by default.
    75         $domain = $settings["account_view"]["account"];
    76         $source .= "<script type='text/javascript' src='";
    77         $source .= sprintf("https://%s/f/embed.php?", $domain);
    78         if ($static) {
    79             $source .= "static=1&";
    80         }
    81         $source .= sprintf("id=%d&%s", $form["id"], strtoupper(uniqid()));
    82         if (!isset($settings["css"][$form["id"]]) || !$settings["css"][$form["id"]]) {
    83             $source .= "&nostyles=1";
    84         }
    85         $source .= "'></script>";
     77        $source .= "<script type='text/javascript' src='".activecampaign_form_script_src($settings, $form, $static, $nostyles, $preview)."'></script>";
    8678    } else {
    8779        // Version 1 forms.
    8880    }
    8981    return $source;
     82}
     83/**
     84 * Get the script src attribute value for the form's embed.
     85 * This is used in shortcode rendering as well as block editor initialization.
     86 *
     87 * @param  array   settings  The saved ActiveCampaign settings (from the WordPress admin section).
     88 * @param  array   form      The individual form metadata (that we obtained from the forms/getforms API call).
     89 * @param  boolean static    Set to true so the "floating" forms don't float. Typically this is done for the admin section only.
     90 * @param  boolean nostyles  Manual override value for nostyles URL Param. Used in shortcode eval to bypass plugin setting.
     91 * @param  boolean preview   Manual value for preview URL Param.
     92 * @return string            The URL-Encoded src for the rendered script tag
     93 */
     94function activecampaign_form_script_src($settings, $form, $static = false, $nostyles = null, $preview = false){
     95    // Set to activehosted.com domain by default.
     96    $domain = $settings["account_view"]["account"];
     97    $source = sprintf("https://%s/f/embed.php?", $domain);
     98
     99    // Always passing params for JS eval in block editor
     100    $source .= ($static)? "static=1&" : "static=0&";
     101
     102    $source .= sprintf("id=%d&%s", $form["id"], strtoupper(uniqid()));
     103
     104    $source .= (
     105        (isset($nostyles) && $nostyles === true)
     106        || (!isset($nostyles) && (!isset($settings["css"][$form["id"]]) || !$settings["css"][$form["id"]]))
     107    )? "&nostyles=1" : "&nostyles=0";
     108
     109    $source .= ($preview)? "&preview=1" : "&preview=0";
     110
     111    return $source;
    90112}
    91113
     
    95117    if ($settings) {
    96118        if (isset($settings["forms"]) && $settings["forms"]) {
    97             if (isset($args) && isset($args["form"])) {
     119            if (isset($args) && isset($args["form"]) && isset($settings["forms"][$args["form"]])) {
    98120                $form_id = $args["form"];
    99121                $form = $settings["forms"][$form_id];
    100                 $form_source = activecampaign_form_source($settings, $form);
    101                 return $form_source;
     122
     123                $static = false;
     124                if(isset($args["static"]) && ($args["static"] === 1 || $args["static"] === '1' || $args["static"] === 'true')){
     125                    $static = true;
     126                }
     127
     128                $preview = false;
     129                if(isset($args["preview"]) && ($args["preview"] === 1 || $args["preview"] === '1' || $args["preview"] === 'true')){
     130                    $preview = true;
     131                }
     132
     133                // Use null default for undefined settings fallback
     134                $nostyles = null;
     135                if(isset($args["css"])){
     136                    if($args["css"] === 1 || $args["css"] === '1' || $args["css"] === 'true'){
     137                        $nostyles = false;
     138                    }
     139                    else if($args["css"] === 0 || $args["css"] === '0' || $args["css"] === 'false'){
     140                        $nostyles = true;
     141                    }
     142                }
     143
     144                return activecampaign_form_source($settings, $form, $static, $nostyles, $preview);
    102145            }
    103146        }
     147        // Returning un-filtered tag for block editor eval
     148        return "[activecampaign]";
    104149    }
    105150    else {
     
    362407                            <div style="display: none;">
    363408                                <input type="radio" name="syim[<?php echo $form["id"]; ?>]" id="activecampaign_form_swim_<?php echo $form["id"]; ?>" value="swim" <?php echo $settings_swim_checked; ?> onchange="swim_toggle(<?php echo $form["id"]; ?>, this.checked);" />
    364                                 <label for="activecampaign_form_swim_<?php echo $form["id"]; ?>" style="">Add Subscriber</label>
     409                                <label for="activecampaign_form_swim_<?php echo $form["id"]; ?>" style=""><?php echo __("Add Subscriber", "menu-activecampaign"); ?></label>
    365410                                <br />
    366411                                <input type="radio" name="syim[<?php echo $form["id"]; ?>]" id="activecampaign_form_sync_<?php echo $form["id"]; ?>" value="sync" <?php echo $settings_sync_checked; ?> onchange="sync_toggle(<?php echo $form["id"]; ?>, this.checked);" />
    367                                 <label for="activecampaign_form_sync_<?php echo $form["id"]; ?>" style="">Sync Subscriber</label>
     412                                <label for="activecampaign_form_sync_<?php echo $form["id"]; ?>" style=""><?php echo __("Sync Subscriber", "menu-activecampaign"); ?></label>
    368413                                <br />
    369414                                <br />
     
    371416                            <?php if (!isset($form["version"]) || $form["version"] != 2): ?>
    372417                            <input type="checkbox" name="ajax[<?php echo $form["id"]; ?>]" id="activecampaign_form_ajax_<?php echo $form["id"]; ?>" value="1" <?php echo $settings_ajax_checked; ?> onchange="ajax_toggle(<?php echo $form["id"]; ?>, this.checked);" />
    373                             <label for="activecampaign_form_ajax_<?php echo $form["id"]; ?>" style="">Submit form without refreshing page</label>
     418                            <label for="activecampaign_form_ajax_<?php echo $form["id"]; ?>" style=""><?php echo __("Submit form without refreshing page", "menu-activecampaign"); ?></label>
    374419                            <br />
    375420                            <?php endif; ?>
    376421                            <input type="checkbox" name="css[<?php echo $form["id"]; ?>]" id="activecampaign_form_css_<?php echo $form["id"]; ?>" value="1" <?php echo $settings_css_checked; ?> />
    377                             <label for="activecampaign_form_css_<?php echo $form["id"]; ?>" style="">Keep original form CSS</label>
     422                            <label for="activecampaign_form_css_<?php echo $form["id"]; ?>" style=""><?php echo __("Use ActiveCampaign's form CSS", "menu-activecampaign"); ?></label>
    378423                        </div>
    379424
  • activecampaign-subscription-forms/trunk/readme.txt

    r2378752 r2413440  
    33Tags: activecampaign, active campaign, email-marketing, newsletter, marketing-automation, subscribe, forms, emails, automation, live-chat, customer-messaging, customer-experience-automation
    44Requires at least: 2.0
    5 Tested up to: 5.4.2
     5Tested up to: 5.5.1
    66Stable tag: trunk
    77
     
    42424. Choose which subscription forms to cache locally, any optional sub-settings for each, then hit Update again.
    43435. Use `[activecampaign form=ID]` shortcode to display a form anywhere on your site where shortcode syntax is supported.
    44 6. Embed multiple forms onto a single page!
    45 7. Enable site tracking to have page visits tracked to ActiveCampaign.
     446. Add optional shortcode parameters `css=1` or `css=0` to override the plugin setting's "Use ActiveCampaign's form CSS" value.
     457. Embed multiple forms onto a single page!
     468. Enable site tracking to have page visits tracked to ActiveCampaign.
    4647
    4748== Frequently Asked Questions ==
     
    8889
    8990== Changelog ==
     91= 8.1.0 =
     92* Improvements to Gutenberg Editor experience, including live preview of Form embeds
     93* Background color bug fix
     94* Shortcode support for optional 'css' and 'static' attributes that default to plugin settings
     95* Avoiding global namespace conflicts of on-demand chunks bug fix
     96
    9097= 8.0.3 =
    9198* Pluggable bug fix
Note: See TracChangeset for help on using the changeset viewer.