Skip to content

Commit

Permalink
Merge pull request #14 from mailchimp/update/dotorg-standards
Browse files Browse the repository at this point in the history
Update/dotorg standards
  • Loading branch information
jeffpaul authored May 31, 2024
2 parents 2a3a535 + ca97b86 commit afd2d98
Show file tree
Hide file tree
Showing 12 changed files with 546 additions and 103 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
339 changes: 339 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Mailchimp List Subscribe Form ===

> Add a Mailchimp signup form widget to your WordPress site.
[![Support Level](https://img.shields.io/badge/support-active-green.svg?label=Support)](#support-level) [![GPL-2.0-or-later License](https://img.shields.io/github/license/mailchimp/wordpress?label=License)](https://github.com/mailchimp/wordpress/blob/develop/LICENSE.md) ![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/mailchimp?label=Version) ![WordPress Minimum](https://img.shields.io/wordpress/plugin/wp-version/mailchimp?label=WordPress%20minimum) ![PHP Minimum](https://img.shields.io/wordpress/plugin/required-php/mailchimp?label=PHP%20minimum) ![WordPress Tested Up To](https://img.shields.io/wordpress/plugin/tested/mailchimp?label=WordPress)

## Overview

Use the Mailchimp List Subscribe plugin to quickly add a Mailchimp signup form widget to your WordPress 2.8 or higher site.

![An example Signup Form Widget](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-5.jpg?raw=true)

After installation, you’ll log in with your API key, select your Mailchimp list, choose merge fields and groups, and add the widget to your site. Typically, installation and setup will take about 5-10 minutes, and absolutely everything can be done via the WordPress Setting GUI, with no file editing at all.

![Configuring your Signup Form display format (optional)](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-3.jpg?raw=true)

WordPress.com compatibility is limited to Business tier users only. [How to add a signup form if you have a WordPress.com site](https://mailchimp.com/help/ways-to-add-a-signup-form-in-wordpress/).

![Configuring extra fields on your Signup Form (optional)](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-4.jpg?raw=true)

## Installation

This section describes how to install the plugin and get started using it.

### Version 2.8+

1. Unzip our archive and upload the entire mailchimp directory to your `/wp-content/plugins/ directory`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Navigate to **Settings** click **Mailchimp Setup**.
4. Enter your Mailchimp API Key and let the plugin verify it.
5. Select the list where you want to send new Mailchimp subscribers.
6. Optional: turn **MonkeyRewards** on or off.
7. Optional: Turn **Merge Fields** and **Groups** on or off. Navigate to **Appearance**, and click **Widgets**. Drag the Mailchimp Widget into one of your Widget Areas.

![Selecting your Mailchimp list](https://github.com/mailchimp/wordpress/blob/develop/.wordpress-org/screenshot-2.jpg?raw=true)

### Advanced

If you have a custom coded sidebar or bells and whistles that prevent enabling widgets through the WordPress GUI, complete these steps instead.

WordPress v2.8 or higher:
` [mailchimpsf_form] `

If you are adding it inside a php code block, pop this in:

` mailchimpSF_signup_form(); `

Or, if you are dropping it in between a bunch of HTML, use this:

`<?php mailchimpSF_signup_form(); ?>`

Where ever you want it to show up.

## Upgrading

If you are upgrading to version 1.2.1 and you used the widget in your sidebar previously, all you need to do is drag the `Mailchimp Widget` back into the sidebar, visit the Mailchimp settings page (which will have maintained your prior settings), click the "Update List" button, and you're done!

## Internationalization (i18n)

Currently we have the plugin configured so it can be translated and the following languages supported:

* bg_BG - Bulgarian in Bulgaria (thanks to [SiteGround](http://www.siteground.com/wordpress-hosting.htm) for contributing)
* cs_CZ - Czech in the Czech Republic (thanks to [Peter Kahoun](http://kahi.cz/) for contributing)
* da_DK - Danish in Denmark (thanks to Jan Lund for contributing)
* de_DE - German in Germany (thanks to Michael Jaekel for contributing)
* el_GR - Modern Greek in Greece (thanks to Ιωάννης Δημοφέρλιας (John Dimoferlias) for contributing)
* en_US - English in the U.S.
* es_CL - Spanish in Chile (thanks to Tomás Nader for contributing)
* es_ES - Spanish in Spain (thanks to [Claudia Mansilla](http://cricava.com/) for contributing)
* et_ET - Estonian in Estonia (thanks to [Helen Urbanik](http://www.motomaania.ee/) for contributing)
* fr_FR - French in France (thanks to [Maxime Toulliou](http://www.maximetoulliou.com/) for contributing)
* he_IL - Hebrew in Israel (thanks to [שגיב בית](http://www.sagive.co.il) for contributing)
* hu_HU - Hungarian in Hungary (thanks to Okostobi for contributing)
* it_IT - Italian in Italy (thanks to [Stefan Des](http://www.stefandes.com) for contributing)
* ko_KR - Korean (thanks to 백선기 (SK Baek) for contributing)
* nb_NO - Norwegian (thanks to [Alexander Roterud aka Defrag](http://www.tigerpews.com) for contributing)
* nl_BE - Dutch (thanks to [Filip Stas](http://suddenelfilio.net/) for contributing)
* pt_BR - Portuguese in Brazil (thanks to Maria Manoela Porto for contributing)
* pt_PT - Portuguese in Portugal (thanks to [Tiago Faria](http://xroot.org) for contributing)
* ro_RO - Romanian in Romania (thanks to Alexandru Armin Roșu for contributing)
* ru_RU - Russian in the Russian Federation (thanks to [Илья](http://fatcow.com) for contributing)
* sv_SE - Swedish in Sweden (thanks to [Sebastian Johnsson](http://www.agiley.se/) for contributing)
* tr_TR - Turkish in Turkey (thanks to [Hakan E.](http://kazancexpert.com/) for contributing)

If your language is not listed above, feel free to create a translation. Here are the basic steps:

1. Copy "mailchimp_i18n-en_US.po" to "mailchimp_i18n-LANG_COUNTRY.po" - fill in LANG and COUNTRY with whatever you use for WPLANG in wp-config.php
2. Grab a translation editor. [POedit](http://www.poedit.net/) works for us
3. Translate each line - if you need some context, open up mailchimp.php and search for the line number or text
4. [Fork](http://help.github.com/fork-a-repo/) the [repository on github](https://github.com/mailchimp/wordpress)
5. [Clone](http://help.github.com/remotes/#clone) the _develop_ branch
6. Add the appropriately named files to the /po/ directory and edit the /readme.txt to include how you'd like to be attributed
7. Make a [pull request](http://help.github.com/send-pull-requests/)

## Support Level

**Active:** Mailchimp is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
4 changes: 2 additions & 2 deletions lib/mailchimp/mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function get($endpoint, $count = 10, $fields = array())
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.1',
'user-agent' => 'MailChimp WordPress Plugin/' . get_bloginfo('url'),
'user-agent' => 'Mailchimp WordPress Plugin/' . get_bloginfo('url'),
'headers' => array("Authorization" => 'apikey ' . $this->key)
);

Expand All @@ -67,7 +67,7 @@ public function post($endpoint, $body, $method = 'POST') {
'timeout' => 5,
'redirection' => 5,
'httpversion' => '1.1',
'user-agent' => 'MailChimp WordPress Plugin/' . get_bloginfo( 'url' ),
'user-agent' => 'Mailchimp WordPress Plugin/' . get_bloginfo( 'url' ),
'headers' => array("Authorization" => 'apikey ' . $this->key),
'body' => json_encode($body)
);
Expand Down
38 changes: 21 additions & 17 deletions mailchimp.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?php
/*
Plugin Name: MailChimp
Plugin URI: http://www.mailchimp.com/plugins/mailchimp-wordpress-plugin/
Description: The MailChimp plugin allows you to quickly and easily add a signup form for your MailChimp list.
Version: 1.5.8
Author: MailChimp
Author URI: https://mailchimp.com/
* Plugin Name: Mailchimp
* Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/
* Description: Add a Mailchimp signup form widget to your WordPress site.
* Version: 1.5.8
* Requires at least: 2.8
* Requires PHP: 5.6
* Author: Mailchimp
* Author URI: https://mailchimp.com/
* License: GPL-2.0-or-later
* License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
*/
/* Copyright 2008-2012 MailChimp.com (email : [email protected])
/* Copyright 2008-2012 Mailchimp.com (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -33,7 +37,7 @@
// Define our location constants, both MCSF_DIR and MCSF_URL
mailchimpSF_where_am_i();

// Get our MailChimp API class in scope
// Get our Mailchimp API class in scope
if (!class_exists('MailChimp_API')) {
$path = plugin_dir_path(__FILE__);
require_once($path . 'lib/mailchimp/mailchimp.php');
Expand Down Expand Up @@ -73,7 +77,7 @@ function mailchimpSF_plugin_init() {


/**
* Add the settings link to the MailChimp plugin row
* Add the settings link to the Mailchimp plugin row
*
* @param array $links - Links for the plugin
* @return array - Links
Expand Down Expand Up @@ -124,7 +128,7 @@ function mailchimpSF_load_resources() {


/**
* Loads resources for the MailChimp admin page
* Loads resources for the Mailchimp admin page
*
* @return void
*/
Expand Down Expand Up @@ -177,7 +181,7 @@ function mailchimpSF_main_css() {
*/
function mailchimpSF_add_pages(){
// Add settings page for users who can edit plugins
add_options_page( __( 'MailChimp Setup', 'mailchimp_i18n' ), __( 'MailChimp Setup', 'mailchimp_i18n' ), MCSF_CAP_THRESHOLD, 'mailchimpSF_options', 'mailchimpSF_setup_page');
add_options_page( __( 'Mailchimp Setup', 'mailchimp_i18n' ), __( 'Mailchimp Setup', 'mailchimp_i18n' ), MCSF_CAP_THRESHOLD, 'mailchimpSF_options', 'mailchimpSF_setup_page');
}
add_action('admin_menu', 'mailchimpSF_add_pages');

Expand Down Expand Up @@ -264,7 +268,7 @@ function mailchimpSF_migrate_sopresto() {
'timeout' => 500,
'redirection' => 5,
'httpversion' => '1.0',
'user-agent' => 'MailChimp WordPress Plugin/' . get_bloginfo( 'url' ),
'user-agent' => 'Mailchimp WordPress Plugin/' . get_bloginfo( 'url' ),
'body' => $body
);

Expand Down Expand Up @@ -317,7 +321,7 @@ function mailchimpSF_auth_nonce_salt() {
}

/**
* Creates new MailChimp API v3 object
* Creates new Mailchimp API v3 object
*
* @return MailChimp_API | false
*/
Expand Down Expand Up @@ -355,7 +359,7 @@ function mailchimpSF_needs_upgrade() {
}

/**
* Deletes all mailchimp options
* Deletes all Mailchimp options
**/
function mailchimpSF_delete_setup() {
$options = array('mc_user_id', 'mc_sopresto_user', 'mc_sopresto_public_key', 'mc_sopresto_secret_key', 'mc_rewards', 'mc_use_javascript', 'mc_use_datepicker', 'mc_use_unsub_link', 'mc_list_id', 'mc_list_name', 'mc_interest_groups', 'mc_merge_vars');
Expand Down Expand Up @@ -477,11 +481,11 @@ function mailchimpSF_save_general_form_settings() {
/* NUKE the CSS! */
if(isset($_POST['mc_nuke_all_styles'])) {
update_option('mc_nuke_all_styles', true);
$msg = '<p class="success_msg">'.__('MailChimp CSS turned Off!', 'mailchimp_i18n').'</p>';
$msg = '<p class="success_msg">'.__('Mailchimp CSS turned Off!', 'mailchimp_i18n').'</p>';
mailchimpSF_global_msg($msg);
}elseif (get_option('mc_nuke_all_styles') !== false) {
update_option('mc_nuke_all_styles', false);
$msg = '<p class="success_msg">'.__('MailChimp CSS turned On!', 'mailchimp_i18n').'</p>';
$msg = '<p class="success_msg">'.__('Mailchimp CSS turned On!', 'mailchimp_i18n').'</p>';
mailchimpSF_global_msg($msg);
}

Expand Down Expand Up @@ -627,7 +631,7 @@ function mailchimpSF_change_list_if_necessary() {
count($mv)
).' '.
__('from your list').' "'.$list_name.'"<br/><br/>'.
__('Now you should either Turn On the MailChimp Widget or change your options below, then turn it on.', 'mailchimp_i18n').'</p>';
__('Now you should either Turn On the Mailchimp Widget or change your options below, then turn it on.', 'mailchimp_i18n').'</p>';
mailchimpSF_global_msg($msg);
}
}
Expand Down
12 changes: 6 additions & 6 deletions mailchimp_widget.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Displays a MailChimp Signup Form
* Displays a Mailchimp Signup Form
**/
function mailchimpSF_signup_form($args = array()) {
extract($args);
Expand All @@ -13,7 +13,7 @@ function mailchimpSF_signup_form($args = array()) {
echo $before_widget;
?>
<div class="mc_error_msg">
<?php echo __('Sorry, there was a problem loading your MailChimp details. Please navigate to <strong>Settings</strong> and click <strong>MailChimp Setup</strong> to try again.', 'mailchimp_i18n'); ?>
<?php echo __('Sorry, there was a problem loading your Mailchimp details. Please navigate to <strong>Settings</strong> and click <strong>Mailchimp Setup</strong> to try again.', 'mailchimp_i18n'); ?>
</div>
<?php
echo $after_widget;
Expand Down Expand Up @@ -249,7 +249,7 @@ function mailchimpSF_signup_form($args = array()) {
?>
<br/>
<div id="mc_display_rewards" align="center">
<?php esc_html_e('powered by', 'mailchimp_i18n'); ?> <a href="<?php echo esc_url('http://www.mailchimp.com/affiliates/?aid='.$user['account_id'].'&amp;afl=1'); ?>">MailChimp</a>!
<?php esc_html_e('powered by', 'mailchimp_i18n'); ?> <a href="<?php echo esc_url('http://www.mailchimp.com/affiliates/?aid='.$user['account_id'].'&amp;afl=1'); ?>">Mailchimp</a>!
</div><!-- /mc_display_rewards -->
<?php
}
Expand Down Expand Up @@ -467,16 +467,16 @@ function mailchimp_form_field($var, $num_fields) {
}

/**
* MailChimp Subscribe Box widget class
* Mailchimp Subscribe Box widget class
*/

class mailchimpSF_Widget extends WP_Widget {

function __construct() {
$widget_ops = array(
'description' => __('Displays a MailChimp Subscribe box', 'mailchimp_i18n')
'description' => __('Displays a Mailchimp Subscribe box', 'mailchimp_i18n')
);
parent::__construct('mailchimpSF_widget', __('MailChimp Widget', 'mailchimp_i18n'), $widget_ops);
parent::__construct('mailchimpSF_widget', __('Mailchimp Widget', 'mailchimp_i18n'), $widget_ops);
}
function widget( $args, $instance ) {
if (!is_array($instance)) {
Expand Down
Loading

0 comments on commit afd2d98

Please sign in to comment.