Skip to content

Commit

Permalink
Release 2.6.1 (#681)
Browse files Browse the repository at this point in the history
* version bumps

* version bump and changelog

* Images cleanup (#676)

* old image removal

* remove old logo flare from "first form" modal

* another image removal

* update "first form" modal with new images

* remove reliance on meta data and instead rely on POST data for lists being used. (#680)

* remove reliance on meta data and instead rely on POST data for lists being used.

* add phpcs ignores for nonce things

* Update social icons in plugin list (#678)

* remove google plus which does not exist, remove twitter which does not seem to be working any more.

* re-add twitter as X, rename variables, add escaping to our site link value

* Fix/cc 434 optin js reveal (#679)

* fix optin display while also converting away from jQuery dependency

* build copies

* handle change events

* build files

* finish up changelog
  • Loading branch information
tw2113 authored Sep 3, 2024
1 parent 2b3a9c6 commit 504d0a8
Show file tree
Hide file tree
Showing 27 changed files with 93 additions and 52 deletions.
Binary file removed assets/images/add-forms.png
Binary file not shown.
Binary file removed assets/images/builder.png
Binary file not shown.
Binary file removed assets/images/cc-login-connect.png
Binary file not shown.
Binary file removed assets/images/cc-modal-bg.png
Binary file not shown.
Binary file removed assets/images/cc-modal-logo.png
Binary file not shown.
Binary file removed assets/images/coffee-hero.jpg
Binary file not shown.
Binary file removed assets/images/constant-contact-logo.png
Binary file not shown.
Binary file removed assets/images/contacts.png
Binary file not shown.
8 changes: 8 additions & 0 deletions assets/images/createAccount.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/form-display.png
Binary file not shown.
Binary file removed assets/images/icon.jpg
Binary file not shown.
9 changes: 9 additions & 0 deletions assets/images/login.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/question-mail-connect.png
Binary file not shown.
Binary file removed assets/images/reporting.png
Binary file not shown.
Binary file removed assets/images/stay-connected.png
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/js/ctct-plugin-admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/ctct-plugin-admin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/ctct-plugin-admin.min.js.map

Large diffs are not rendered by default.

78 changes: 49 additions & 29 deletions assets/js/ctct-plugin-admin/optins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
window.CTCT_OptIns = {};

( function( window, $, app ) {
( function( window, app ) {

/**
* @constructor
Expand All @@ -20,12 +20,12 @@ window.CTCT_OptIns = {};
* @since 1.0.0
*/
app.cache = () => {
app.$c = {
optinNoConn: $( '#cmb2-metabox-ctct_1_optin_metabox #_ctct_opt_in_not_connected' ),
list: $( '#cmb2-metabox-ctct_0_list_metabox [name="_ctct_list[]"]' ),
title: $( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id-email-optin-title' ),
optin: $( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in' ),
instruct: $( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in-instructions' )
app.cache = {
optinNoConn: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox #_ctct_opt_in_not_connected' ),
list: document.querySelectorAll('#cmb2-metabox-ctct_0_list_metabox .attached-posts-wrap .attached li'),
title: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id-email-optin-title' ),
optin: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in' ),
instruct: document.querySelectorAll( '#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in-instructions' )
};
};

Expand All @@ -38,27 +38,32 @@ window.CTCT_OptIns = {};
app.bindEvents = () => {

// Only fire show/hide if we have the normal checkbox.
if ( app.$c.optinNoConn.length ) {
if ( app.cache.optinNoConn.length ) {

// Fire once to get our loaded state set up.
app.toggleNoConnectionFields();

// Bind to fire when needed.
app.$c.optinNoConn.change( () => {
app.toggleNoConnectionFields();
} );
Array.from(app.cache.optinNoConn).forEach((item) => {
item.addEventListener('change', () => {
app.toggleNoConnectionFields();
});
});
}

// Only fire show/hide if we have the normal checkbox.
if ( app.$c.list.length ) {
if ( app.cache.list.length ) {

// Fire once to get our loaded state set up.
app.toggleConnectionFields();

// Bind to fire when needed.
app.$c.list.change( () => {
app.toggleConnectionFields();
} );
Array.from(app.cache.list).forEach((item) => {
item.addEventListener('change', () => {
app.toggleConnectionFields();
});
})

}
};

Expand All @@ -69,11 +74,14 @@ window.CTCT_OptIns = {};
* @since 1.0.0
*/
app.toggleNoConnectionFields = () => {

if ( app.$c.optinNoConn.prop( 'checked' ) ) {
app.$c.instruct.slideDown();
if ( app.cache.optinNoConn.checked ) {
Array.from(app.cache.instruct).forEach((item) => {
item.style.display = 'block';
});
} else {
app.$c.instruct.slideUp();
Array.from(app.cache.instruct).forEach((item) => {
item.style.display = 'none';
});
}
};

Expand All @@ -86,17 +94,29 @@ window.CTCT_OptIns = {};
app.toggleConnectionFields = () => {

// If checked, show them, else hide it.
if ( '' !== app.$c.list.val() ) {
app.$c.title.slideDown();
app.$c.optin.slideDown();
app.$c.instruct.slideDown();
if ( 0 <= app.cache.list.length ) {
Array.from(app.cache.title).forEach((item) => {
item.style.display = 'block';
});
Array.from(app.cache.optin).forEach((item) => {
item.style.display = 'block';
});
Array.from(app.cache.instruct).forEach((item) => {
item.style.display = 'block';
});
//app.cache.instruct.slideDown();
} else {
app.$c.title.slideUp();
app.$c.optin.slideUp();
app.$c.instruct.slideUp();
Array.from(app.cache.title).forEach((item) => {
item.style.display = 'none';
});
Array.from(app.cache.optin).forEach((item) => {
item.style.display = 'none';
});
Array.from(app.cache.instruct).forEach((item) => {
item.style.display = 'none';
});
}
};

$( app.init );

} ( window, jQuery, window.CTCT_OptIns ) );
app.init();
} ( window, window.CTCT_OptIns ) );
4 changes: 2 additions & 2 deletions constant-contact-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Constant Contact Forms for WordPress
* Plugin URI: https://www.constantcontact.com
* Description: Be a better marketer. All it takes is Constant Contact email marketing.
* Version: 2.6.0
* Version: 2.6.1
* Author: Constant Contact
* Author URI: https://www.constantcontact.com/index?pn=miwordpress
* Requires PHP: 7.4
Expand Down Expand Up @@ -76,7 +76,7 @@ class Constant_Contact {
* @since 1.0.0
* @var string
*/
const VERSION = '2.6.0';
const VERSION = '2.6.1';

/**
* URL of plugin directory.
Expand Down
7 changes: 3 additions & 4 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public function add_social_links( $links ) {
return $links;
}

$twitter_cta = esc_html__( 'Check out the official WordPress plugin from @constantcontact:', 'constant-contact-forms' );
$x_cta = esc_html__( 'Check out the official WordPress plugin from @constantcontact:', 'constant-contact-forms' );

$add_links[] = $this->get_admin_link( esc_html__( 'About', 'constant-contact-forms' ), 'about' );
$add_links[] = $this->get_admin_link( esc_html__( 'License', 'constant-contact-forms' ), 'license' );
Expand All @@ -520,12 +520,11 @@ public function add_social_links( $links ) {
*
* @param string $value Social URL base.
*/
$site_link = apply_filters( 'constant_contact_social_base_url', 'https://constantcontact.com/' );
$site_link = esc_url( apply_filters( 'constant_contact_social_base_url', 'https://constantcontact.com/' ) );

$social_share = esc_html__( 'Spread the word!', 'constant-contact-forms' );
$add_links[] = '<a title="' . $social_share . '" href="https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode( $site_link ) . '" target="_blank" rel="noopener noreferrer" class="dashicons-before dashicons-facebook"></a>';
$add_links[] = '<a title="' . $social_share . '" href="https://twitter.com/home?status=' . $twitter_cta . ' ' . $site_link . '" target="_blank" rel="noopener noreferrer" class="dashicons-before dashicons-twitter"></a>';
$add_links[] = '<a title="' . $social_share . '" href="https://plus.google.com/share?url=' . rawurlencode( $site_link ) . '" target="_blank" rel="noopener noreferrer" class="dashicons-before dashicons-googleplus"></a>';
$add_links[] = '<a title="' . $social_share . '" href="https://x.com/intent/post?text=' . $x_cta . ' ' . $site_link . '" target="_blank" rel="noopener noreferrer"><img src="' . esc_url( constant_contact()->url ) . '/assets/images/logo-black.png" alt="' . esc_attr__( 'X logo', 'constant-contact-forms' ) . '" style="height:16px;width:16px;float:none;"></a>';

/**
* Filters the final custom social links.
Expand Down
10 changes: 2 additions & 8 deletions includes/class-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function output_not_connected_modal( $post_id = 0 ) {
<?php // Empty alt tag OK; decorative image. ?>
<img
class="ctct-modal-flare"
src="<?php echo esc_url_raw( $this->plugin->url . 'assets/images/question-mail.png' ); ?>"
src="<?php echo esc_url_raw( $this->plugin->url . 'assets/images/createAccount.svg' ); ?>"
alt=""
/>
<h3><?php esc_attr_e( 'Try email marketing.', 'constant-contact-forms' ); ?></h3>
Expand All @@ -331,19 +331,13 @@ class="ctct-modal-flare"
</p>
<a href="<?php echo esc_url_raw( constant_contact()->api->get_signup_link() ); ?>" target="_blank" rel="noopener noreferrer" class="button button-orange" title="<?php esc_attr_e( 'Try Us Free', 'constant-contact-forms' ); ?>"><?php esc_html_e( 'Try Us Free', 'constant-contact-forms' ); ?></a><br/>

<?php // Empty alt tag OK; decorative image. ?>
<img
class="flare"
src="<?php echo esc_url_raw( $this->plugin->url . 'assets/images/cc-modal-logo.png' ); ?>"
alt=""
/>
</div>
<div class="ctct-modal-right">

<?php // Empty alt tag OK; decorative image. ?>
<img
class="ctct-modal-flare"
src="<?php echo esc_url_raw( $this->plugin->url . 'assets/images/cc-login.png' ); ?>"
src="<?php echo esc_url_raw( $this->plugin->url . 'assets/images/login.svg' ); ?>"
alt=""
/>
<h3><?php esc_attr_e( 'Connect my account.', 'constant-contact-forms' ); ?></h3>
Expand Down
11 changes: 8 additions & 3 deletions includes/class-mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,15 @@ public function mail( $destination_email, $content, $submission_details, $was_fo

$content_title = '<p><strong>' . esc_html__( 'Form title: ', 'constant-contact-forms' ) . '</strong>' . get_the_title( $submission_details['form_id'] ) . '<br/>';

$list_ids = get_post_meta( (int) $submission_details['form_id'], '_ctct_list', true );
if ( ! is_array( $list_ids ) ) {
$list_ids = [ $list_ids ];
if ( ! empty( $_POST ) && is_array( $_POST ) ) { //phpcs:ignore
foreach( $_POST as $key => $value ) { //phpcs:ignore
if ( false !== strpos( $key, 'lists' ) ) {
$list_ids = array_map( 'sanitize_text_field', array_values( $value ) );
break;
}
}
}

foreach ( $list_ids as $list_id ) {
$list_info = constant_contact()->api->cc()->get_list( $list_id );
if ( ! empty( $list_info ) && isset( $list_info['name'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "constant-contact-forms",
"version": "2.6.0",
"version": "2.6.1",
"description": "",
"main": "build/index.js",
"engines": {
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: constantcontact, webdevstudios, tw2113, znowebdev, ggwicz, ra
Tags: constant contact, constant contact official, marketing, newsletter, contacts
Requires at least: 5.2.0
Tested up to: 6.5.4
Stable tag: 2.6.0
Stable tag: 2.6.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Requires PHP: 7.4
Expand Down Expand Up @@ -49,6 +49,12 @@ Development of Constant Contact Forms plugin occurs on [GitHub](https://github.c

== Changelog ==

= 2.6.1 =
* Fixed: Issues around opt-in option display that were introduced with version 2.6.0.
* Fixed: Issues regarding lists display in admin emails after user signup.
* Updated: Removed unused images and changed some.
* Updated: Social sharing icons in plugin list page.

= 2.6.0 =
* Updated: Amended the list selection process for a given form. Should not break existing forms, and now you can make use of drag-n-drop to order the list selection when offering multiple lists.
* Updated: reworked the underpinning of the Constant Contact block to be more in line with modern WordPress coding patterns, including block.json based. Should not break existing forms.
Expand Down
2 changes: 1 addition & 1 deletion src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "constant-contact/single-contact-form",
"version": "2.6.0",
"version": "2.6.1",
"title": "Constant Contact: Single Form",
"category": "widgets",
"icon": "index-card",
Expand Down

0 comments on commit 504d0a8

Please sign in to comment.