Skip to content

Commit

Permalink
Merge staging into master (official v6.1.3 release)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Herman committed Jul 26, 2016
1 parent 3450a6d commit 75f6d6b
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 49 deletions.
20 changes: 20 additions & 0 deletions admin/class-yikes-inc-easy-mailchimp-extender-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,8 @@ function yikes_mc_validate_api_key( $input ) {
$body = json_decode( wp_remote_retrieve_body( $api_key_response ), true );
if( isset( $body['msg'] ) && $body['msg'] == "Everything's Chimpy!" ) {
update_option( 'yikes-mc-api-validation' , 'valid_api_key' );
// Clear the API key transient data
$this->delete_yikes_mailchimp_transients();
}
} else {
require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
Expand Down Expand Up @@ -3012,4 +3014,22 @@ public function generate_edit_forms_upsell_ad() {
echo wp_kses_post( $ad_content );
}

/***
* Helper function to clear out transients stored by this plugin
*
* Mainly used when the API key is altered, changed or removed.
* @since 6.1.3
*/
public function delete_yikes_mailchimp_transients() {
/* Clear All Transient Data */
// Delete list data transient data
delete_transient( 'yikes-easy-mailchimp-list-data' );
// Delete list account data transient data
delete_transient( 'yikes-easy-mailchimp-account-data' );
// Delete profile data transient data
delete_transient( 'yikes-easy-mailchimp-profile-data' );
// Delete account activity transient data
delete_transient( 'yikes-easy-mailchimp-account-activity' );
}

}
2 changes: 1 addition & 1 deletion admin/partials/menu/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
} else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) {
?>
<div class="error">
<p><?php _e( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
<p><?php echo esc_attr( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
</div>
<?php
}
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": "yikes-inc-easy-mailchimp-extender",
"version": "6.1.2",
"version": "6.1.3",
"description": "Easy MailChimp opt-in forms for your site.",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 0 additions & 7 deletions public/class-yikes-inc-easy-mailchimp-extender-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ class Yikes_Inc_Easy_Mailchimp_Extender_Public {
public function __construct( $yikes_inc_easy_mailchimp_extender, $version ) {
$this->yikes_inc_easy_mailchimp_extender = $yikes_inc_easy_mailchimp_extender;
$this->version = $version;
/**
* Define version of this plugin
* @since 6.0.0
*/
if ( ! defined( 'YIKES_MC_VERSION' ) ) {
define( 'YIKES_MC_VERSION' , $version );
}
/*
* Include our helper functions
* @since 6.0.3.4
Expand Down
3 changes: 1 addition & 2 deletions public/css/yikes-inc-easy-mailchimp-extender-public.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

81 changes: 46 additions & 35 deletions public/partials/shortcodes/process_form_shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,39 @@ function renderReCaptchaCallback() {
if( ! $form_inline ) {
$form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false;
}

/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
if( is_user_logged_in() ) {
if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
$edit_form_link = '<span class="edit-link">';
$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
$edit_form_link .= '</span>';
$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
} else {
$edit_form_link = '';
}
}

// ensure there is an 'email' field the user can fill out
// or else MailChimp throws errors at you
// extract our array keys
if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
$array_keys = array_keys( $form_settings['fields'] );
// check for EMAIL in that array
if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
}
} else {
$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
if( is_user_logged_in() ) {
if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
return $error . $edit_form_link;
}
} else {
return $error;
}
}

if( $form_inline ) {
$field_width = (float) ( 100 / $field_count );
$submit_button_width = (float) ( 20 / $field_count );
Expand Down Expand Up @@ -268,39 +301,6 @@ function renderReCaptchaCallback() {

<section id="yikes-mailchimp-container-<?php echo $form_id; ?>" class="yikes-mailchimp-container yikes-mailchimp-container-<?php echo $form_id; ?> <?php echo apply_filters( 'yikes-mailchimp-form-container-class', '', $form_id ); ?>">
<?php

/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
if( is_user_logged_in() ) {
if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
$edit_form_link = '<span class="edit-link">';
$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
$edit_form_link .= '</span>';
$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
} else {
$edit_form_link = '';
}
}

// ensure there is an 'email' field the user can fill out
// or else MailChimp throws errors at you
// extract our array keys
if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
$array_keys = array_keys( $form_settings['fields'] );
// check for EMAIL in that array
if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
}
} else {
$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
if( is_user_logged_in() ) {
if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
return $error . $edit_form_link;
}
} else {
return $error;
}
}

/*
* pre-form action hooks
* check readme for usage examples
Expand Down Expand Up @@ -361,6 +361,10 @@ function renderReCaptchaCallback() {
<form id="<?php echo sanitize_title( $form_settings['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_settings['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">

<?php
// Set a default constant for hidden fields
$hidden_label_count = 0;

// Loop over our form fields
foreach( $form_settings['fields'] as $field ) {
// input array
$field_array = array();
Expand Down Expand Up @@ -427,7 +431,8 @@ function renderReCaptchaCallback() {
}

if( isset( $field['hide-label'] ) ) {
if( $field['hide-label'] == 1 ) {
if( absint( $field['hide-label'] ) === 1 ) {
$hidden_label_count++;
$custom_classes[] = 'field-no-label';
}
}
Expand Down Expand Up @@ -1167,7 +1172,13 @@ function checkCountry( e ) {
<!-- Submit Button -->
<?php
if( $form_inline ) {
echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="empty-label">&nbsp;</span>';
$submit_button_label_classes = array( 'empty-label' );
// If the number of fields, is equal to the hidden label count, add our class
// eg: All field labels are set to hidden.
if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
$submit_button_label_classes[] = 'labels-hidden';
}
echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
}
// display the image or text based button
if( $submit_button_type == 'text' ) {
Expand Down
15 changes: 14 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://yikesplugins.com/?utm_source=wp_plugin_repo&utm_medium=dona
Tags: MailChimp, MailChimp forms, MailChimp lists, opt-in forms, sign up form, MailChimp, email, forms, mailing lists, marketing, newsletter, sign up
Requires at least: 4.0
Tested up to: 4.5
Stable tag: 6.1.2
Stable tag: 6.1.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -235,6 +235,12 @@ Below you'll find a complete list of the hooks and filters available in Easy For

== Changelog ==

= Easy Forms for MailChimp 6.1.3 - July 26th, 2016 =
* Minor security patch - Thanks goes to the Wordfence Research Team for locating and disclosing the issue.
* Cleared API/Account transient data when API key has changed.
* Refactored our shortcode function to abort early, when no fields are present (inline or not).
* Added `labels-hidden` class to the submit button `<span></span>` element so we can better style inline forms when <strong>all</strong> labels are hidden.

= Easy Forms for MailChimp 6.1.2 - July 21st, 2016 =
* Fixed incorrect date format on date picker for birthday fields (Front end).
* Ensure that hidden fields don't become visible when forms are submitted (.fadeTo() bug)
Expand Down Expand Up @@ -651,6 +657,13 @@ We have added brand new functionality, allowing users to easily customize forms

== Upgrade Notice ==

= Easy Forms for MailChimp 6.1.3 - July 26th, 2016 =

* Minor security patch - Thanks goes to the Wordfence Research Team for locating and disclosing the issue.
* Cleared API/Account transient data when API key has changed.
* Refactored our shortcode function to abort early, when no fields are present (inline or not).
* Added `labels-hidden` class to the submit button `<span></span>` element so we can better style inline forms when <strong>all</strong> labels are hidden.

= Easy Forms for MailChimp 6.1.2 - July 21st, 2016 =

* Fixed incorrect date format on date picker for birthday fields (Front end).
Expand Down
12 changes: 11 additions & 1 deletion yikes-inc-easy-mailchimp-extender.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Easy Forms for MailChimp by YIKES
* Plugin URI: http://www.yikesinc.com/services/yikes-inc-easy-mailchimp-extender/
* Description: YIKES Easy Forms for MailChimp links your site to MailChimp and allows you to generate and display mailing list opt-in forms anywhere on your site with ease.
* Version: 6.1.2
* Version: 6.1.3
* Author: YIKES
* Author URI: http://www.yikesinc.com/
* License: GPL-3.0+
Expand Down Expand Up @@ -36,6 +36,16 @@
die;
}

/**
* Define version constant
*
* @since 6.1.3
* @return void
*/
if ( ! defined( 'YIKES_MC_VERSION' ) ) {
define( 'YIKES_MC_VERSION' , '6.1.3' );
}

/**
* Define path constant to our plugin directory.
*
Expand Down

0 comments on commit 75f6d6b

Please sign in to comment.