Skip to content

Commit

Permalink
v1.3.0 (#29)
Browse files Browse the repository at this point in the history
* Fix deploy task

* Add npmrc

* Update travis config

* Support banners and youtube in readme, add video

* Use hqdefault for video thumbnail

* GoLF Automated checkin by kchien (2/21/2017 4:30:02 PM)

* Update cssmin package ver

* Fix makepot task

* Update POT

* Update mo

* Bump tested up to 4.8

* Bump tested up to

* Switch wp_nonce to _wpnonce. Fix failing check_admin_referer when action === 'refresh'

* Update devDependencies

* set dist: precise for 5.2

* set dist: precise for 5.2

* Temporarily disable PHP 5.2. See travis-ci/travis-ci#8072

* Update dev dependencies. Re-grunt

* Update changelog with 1.2.1 changes

* Change Text Domain to Match WordPress.org Plugin Slug (#26)

* update text domain for interested translators on translation.wordpress.org to work on plugin strings.

* change text domain to match plugin slug in comments

* fixing according to travis ci warnings

only the i18n warnings.

* more fixes based on travis ci output

* fixing other warnings

* one more warning

* renamed language files to match text domain

https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#loading-text-domain

* Add GDPR Support (#28)

* Add support for GDPR fields.

* Update gruntfile and npm dependencies

* Add comment for tos_link

* Resolve PHPCS warnings. Update phpcs.ruleset.xml.

* Remove test filter

* Add xmllint addon to travis build config

* Double check for method before calling it. Update checkbox field value to match disply text.

* Update gem-form-fields test to asset invalid_field_type returns empty.

* Readd vendor dir to PHPCS exclusion

* Add test for tos_link

* Add test for tracking_option

* Remove chrome from travis addons

* Remove print

* Add spacing for phpcs warnings

* Add required checkboxes to error checking

* Update update-pot grunt task. Regenerate translations after i18n function updates and updated i18n comments

* Update read for 1.3.0 release
  • Loading branch information
Evan Herman committed Jun 25, 2018
1 parent 62b4ebe commit edb0f11
Show file tree
Hide file tree
Showing 78 changed files with 4,946 additions and 4,541 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=trunk WP_MULTISITE=0

addons:
apt:
packages:
# Needed for `xmllint`.
- libxml2-utils

matrix:
fast_finish: true
exclude:
Expand Down
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = function( grunt ) {
include: [ 'godaddy-email-marketing.php', 'includes/.+\.php' ],
mainFile: 'godaddy-email-marketing.php',
potComments: 'Copyright (c) {year} GoDaddy Operating Company, LLC. All Rights Reserved.',
potFilename: 'godaddy-email-marketing.pot',
potFilename: 'godaddy-email-marketing-sign-up-forms.pot',
potHeaders: {
'x-poedit-keywordslist': true
},
Expand Down Expand Up @@ -185,7 +185,7 @@ module.exports = function( grunt ) {
tasks: [ 'imagemin' ]
},
js: {
files: [ '**/*.js', '!**/*.min.js' ],
files: [ 'js/**/*.js', '!js/**/*.min.js' ],
tasks: [ 'jshint', 'uglify' ]
},
readme: {
Expand Down
43 changes: 23 additions & 20 deletions godaddy-email-marketing.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Author URI: https://gem.godaddy.com/
* License: GPL-2.0
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: godaddy-email-marketing
* Text Domain: godaddy-email-marketing-sign-up-forms
* Domain Path: /languages
*
* This plugin, like WordPress, is licensed under the GPL.
Expand Down Expand Up @@ -76,14 +76,14 @@ public static function instance() {
*/
private function setup_actions() {
add_action( 'plugins_loaded', array( $this, 'i18n' ) );
add_action( 'init', array( $this, 'init' ) );
add_action( 'widgets_init', array( $this, 'register_widget' ) );
add_action( 'init', array( $this, 'register_shortcode' ), 20 );
add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );
add_action( 'init', array( $this, 'init' ) );
add_action( 'widgets_init', array( $this, 'register_widget' ) );
add_action( 'init', array( $this, 'register_shortcode' ), 20 );
add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );

add_filter( 'plugin_action_links_' . self::$basename, array( $this, 'action_links' ), 10 );

register_activation_hook( __FILE__, array( $this, 'activate' ) );
register_activation_hook( __FILE__, array( $this, 'activate' ) );
register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
}

Expand Down Expand Up @@ -111,7 +111,7 @@ private function setup_constants() {
or define( 'GEM_VERSION', '1.2.1' );

// Set up the base name.
isset( self::$basename ) || self::$basename = plugin_basename( __FILE__ );
self::$basename = isset( self::$basename ) ? self::$basename : plugin_basename( __FILE__ );
}

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ private function requirements() {
* Load translations.
*/
public function i18n() {
load_plugin_textdomain( 'godaddy-email-marketing', false, basename( dirname( self::$basename ) ) . '/languages' );
load_plugin_textdomain( 'godaddy-email-marketing-sign-up-forms', false, basename( dirname( self::$basename ) ) . '/languages' );
}

/**
Expand Down Expand Up @@ -198,11 +198,12 @@ public function enqueue() {

// Help strings.
wp_localize_script( 'gem-main', 'GEM', array(
'thankyou' => __( 'Thank you for signing up!', 'godaddy-email-marketing' ),
'thankyou_suppressed' => __( 'Thank you for signing up! Please check your email to confirm your subscription.', 'godaddy-email-marketing' ),
'oops' => __( 'Oops! There was a problem. Please try again.', 'godaddy-email-marketing' ),
'email' => __( 'Please enter a valid email address.', 'godaddy-email-marketing' ),
'required' => _x( '%s is a required field.', 'Name of required field', 'godaddy-email-marketing' ),
'thankyou' => __( 'Thank you for signing up!', 'godaddy-email-marketing-sign-up-forms' ),
'thankyou_suppressed' => __( 'Thank you for signing up! Please check your email to confirm your subscription.', 'godaddy-email-marketing-sign-up-forms' ),
'oops' => __( 'Oops! There was a problem. Please try again.', 'godaddy-email-marketing-sign-up-forms' ),
'email' => __( 'Please enter a valid email address.', 'godaddy-email-marketing-sign-up-forms' ),
/* translators: %s: Name of required field */
'required' => __( '%s is a required field.', 'godaddy-email-marketing-sign-up-forms' ),
) );
}

Expand All @@ -216,7 +217,7 @@ public function enqueue() {
public function action_links( $actions ) {
return array_merge(
array(
'settings' => sprintf( '<a href="%s">%s</a>', menu_page_url( 'gem-settings', false ), __( 'Settings', 'godaddy-email-marketing' ) ),
'settings' => sprintf( '<a href="%s">%s</a>', menu_page_url( 'gem-settings', false ), __( 'Settings', 'godaddy-email-marketing-sign-up-forms' ) ),
),
$actions
);
Expand Down Expand Up @@ -246,8 +247,9 @@ public function action_admin_notices() {
<p>
<?php
printf(
__( 'Your website has a superpower: Email marketing. %1$s.', 'godaddy-email-marketing' ),
'<a href="' . admin_url( 'options-general.php?page=gem-settings' ) . '">' . __( 'Learn More', 'godaddy-email-marketing' ) . '</a>'
/* translators: %1$s: Link to plugin settings page with text 'Learn More'. */
__( 'Your website has a superpower: Email marketing. %1$s.', 'godaddy-email-marketing-sign-up-forms' ),
'<a href="' . admin_url( 'options-general.php?page=gem-settings' ) . '">' . __( 'Learn More', 'godaddy-email-marketing-sign-up-forms' ) . '</a>'
);
?>
</p>
Expand All @@ -264,16 +266,17 @@ public function action_admin_notices() {
return;
}

$version = get_option( 'gem-version' );
$version = get_option( 'gem-version' );
$settings = get_option( 'gem-settings' );

if ( ! $version && ( empty( $settings['username'] ) || empty( $settings['api-key'] ) ) ) {
update_option( 'gem-version', GEM_VERSION ); ?>
update_option( 'gem-version', GEM_VERSION );
?>

<div class="updated fade">
<p>
<strong><?php esc_html_e( 'GoDaddy Email Marketing is almost ready.', 'godaddy-email-marketing' ); ?></strong> <?php esc_html_e( 'You must enter your username &amp; API key for it to work.', 'godaddy-email-marketing' ); ?> &nbsp;
<a class="button" href="<?php menu_page_url( 'gem-settings' ); ?>"><?php esc_html_e( "Let's do it!", 'godaddy-email-marketing' ); ?></a>
<strong><?php esc_html_e( 'GoDaddy Email Marketing is almost ready.', 'godaddy-email-marketing-sign-up-forms' ); ?></strong> <?php esc_html_e( 'You must enter your username &amp; API key for it to work.', 'godaddy-email-marketing-sign-up-forms' ); ?> &nbsp;
<a class="button" href="<?php menu_page_url( 'gem-settings' ); ?>"><?php esc_html_e( "Let's do it!", 'godaddy-email-marketing-sign-up-forms' ); ?></a>
</p>
</div>

Expand Down
35 changes: 18 additions & 17 deletions includes/class-dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public static function add_default_form() {

// Prepare the URL that includes our credentials.
$response = wp_remote_post( self::get_api_base_url( 'api/v3/signupForms' ), array(
'method' => 'POST',
'method' => 'POST',
'timeout' => 10,
'body' => array(
'username' => $username,
'api_key' => $api_key,
'name' => 'Signup Form',
'integration' => 'WordPress',
'hidden' => false,
'body' => array(
'username' => $username,
'api_key' => $api_key,
'name' => 'Signup Form',
'integration' => 'WordPress',
'hidden' => false,
'subscriberListName' => 'WordPress',
),
) );
Expand All @@ -114,8 +114,8 @@ public static function get_forms() {
if ( ! $username ) {
return false;
}

if ( false === ( $data = get_transient( 'gem-' . $username . '-lists' ) ) ) {
$data = get_transient( 'gem-' . $username . '-lists' );
if ( false === $data ) {
$data = self::fetch_forms();
}

Expand All @@ -129,7 +129,8 @@ public static function get_forms() {
* @return false|object The form fields JSON object or false.
*/
public static function get_fields( $form_id ) {
if ( false === ( $data = get_transient( 'gem-form-' . $form_id ) ) ) {
$data = get_transient( 'gem-form-' . $form_id );
if ( false === $data ) {

// Fields are not cached. fetch and cache.
$response = wp_remote_get( self::get_method_url( 'fields', array(
Expand Down Expand Up @@ -160,9 +161,9 @@ public static function get_user_level() {
if ( ! $username ) {
return false;
}

if ( false === ( $data = get_transient( 'gem-' . $username . '-account' ) ) ) {
$data = false;
$data = get_transient( 'gem-' . $username . '-account' );
if ( false === $data ) {
$data = false;
$request = wp_remote_get( self::get_method_url( 'account' ) );

// If the request has failed for whatever reason.
Expand Down Expand Up @@ -219,20 +220,20 @@ public static function get_api_base_url( $path = '' ) {
public static function get_method_url( $method, $params = array(), $auth = false ) {
$auth = $auth ? $auth : array(
'username' => GEM_Settings_Controls::get_option( 'username' ),
'api_key' => GEM_Settings_Controls::get_option( 'api-key' ),
'api_key' => GEM_Settings_Controls::get_option( 'api-key' ),
);

$path = '';

switch ( $method ) {

case 'forms' :
case 'forms':
$path = add_query_arg( $auth, 'signups.json' );
break;
case 'fields' :
case 'fields':
$path = add_query_arg( $auth, 'signups/' . $params['id'] . '.json' );
break;
case 'account' :
case 'account':
$path = add_query_arg( $auth, 'user/account_status' );
break;
}
Expand Down
18 changes: 9 additions & 9 deletions includes/class-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class GEM_Shortcode {
* @return string|void
*/
public function render( $atts ) {
extract( shortcode_atts( array(
$atts = shortcode_atts( array(
'id' => false,
), $atts ) );
), $atts );

if ( ! $id ) {
if ( ! $atts['id'] ) {
return;
}

return gem_form( $id, false );
return gem_form( $atts['id'], false );
}

/**
Expand All @@ -47,12 +47,12 @@ public function shortcode_ui() {
reset( $options );

$args = array(
'label' => esc_html__( 'GoDaddy Email Marketing', 'godaddy-email-marketing' ),
'label' => esc_html__( 'GoDaddy Email Marketing', 'godaddy-email-marketing-sign-up-forms' ),
'listItemImage' => 'dashicons-feedback',
'attrs' => array(
'attrs' => array(
array(
'label' => esc_html__( 'Signup Forms', 'godaddy-email-marketing' ),
'description' => esc_html__( 'Choose one of the available forms.', 'godaddy-email-marketing' ),
'label' => esc_html__( 'Signup Forms', 'godaddy-email-marketing-sign-up-forms' ),
'description' => esc_html__( 'Choose one of the available forms.', 'godaddy-email-marketing-sign-up-forms' ),
'attr' => 'id',
'encode' => false,
'type' => 'select',
Expand Down Expand Up @@ -81,7 +81,7 @@ public function shortcode_ui() {
function gem_form( $id, $echo = true ) {
if ( class_exists( 'GEM_Form_Renderer', false ) ) {
$renderer = new GEM_Form_Renderer();
$form = $renderer->process( $id, false );
$form = $renderer->process( $id, false );

if ( ! $echo ) {
return $form;
Expand Down
Loading

0 comments on commit edb0f11

Please sign in to comment.