Skip to content

Commit

Permalink
Merge branch 'develop' into feat/admin-style
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Jun 17, 2024
2 parents a4c7af7 + 1abf779 commit 684b96b
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 51 deletions.
Binary file added .wordpress-org/banner-1544x500.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 added .wordpress-org/banner-772x250.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 added .wordpress-org/icon-128x128.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 added .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions .wordpress-org/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ This section describes how to install the plugin and get started using it.
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.
6. 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)

Expand Down
33 changes: 16 additions & 17 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/

// Version constant for easy CSS refreshes
define( 'MCSF_VER', '1.5.8' );
define( 'MCSF_VER', '1.6.0' );

// What's our permission (capability) threshold
define( 'MCSF_CAP_THRESHOLD', 'manage_options' );
Expand All @@ -54,6 +54,9 @@
// includes the backwards compatibility functions
require_once 'mailchimp_compat.php';

// Upgrade routines.
require_once 'mailchimp_upgrade.php';

/**
* Do the following plugin setup steps here
*
Expand Down Expand Up @@ -137,13 +140,19 @@ function mailchimp_sf_load_resources() {
/**
* Loads resources for the Mailchimp admin page
*
* @param string $hook_suffix The current admin page.
* @return void
*/
function mc_admin_page_load_resources() {
function mailchimp_admin_page_scripts( $hook_suffix ) {
if ( 'toplevel_page_mailchimp_sf_options' !== $hook_suffix ) {
return;
}

wp_enqueue_style( 'mailchimp_sf_admin_css', MCSF_URL . 'css/admin.css', array(), true );
wp_enqueue_script( 'showMe', MCSF_URL . 'js/hidecss.js', array( 'jquery' ), MCSF_VER, true );
}

add_action( 'load-settings_page_mailchimp_sf_options', 'mc_admin_page_load_resources' );
add_action( 'admin_enqueue_scripts', 'mailchimp_admin_page_scripts', 10, 1 );


/**
Expand Down Expand Up @@ -193,12 +202,13 @@ function mailchimp_sf_main_css() {
*/
function mailchimp_sf_add_pages() {
// Add settings page for users who can edit plugins
add_options_page(
__( 'Mailchimp Setup', 'mailchimp_i18n' ),
add_menu_page(
__( 'Mailchimp Setup', 'mailchimp_i18n' ),
__( 'Mailchimp', 'mailchimp_i18n' ),
MCSF_CAP_THRESHOLD,
'mailchimp_sf_options',
'mailchimp_sf_setup_page'
'mailchimp_sf_setup_page',
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PGcgZmlsbD0iI2E3YWFhZCIgY2xpcC1wYXRoPSJ1cmwoI2EpIj48cGF0aCBkPSJNNzEuOTcyIDQ3LjQ0OWMuOTk0IDAgMS44LTEuNTE2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0uMDY5LS4wODctMy45MzUtLjE2LTUuNTk1LS4wNTMtMS4yLS4xNTYtMy4wNzMtLjczNy00LjkxOC0uNjkyLTIuNDk3LTEuOS00LjY4My0zLjQwNi02LjA4IDQuMTU4LTQuMzEgNi43NTItOS4wNTcgNi43NDYtMTMuMTMtLjAxMi03LjgzMS05LjYzLTEwLjItMjEuNDgyLTUuMjkzbC0yLjUxMiAxLjA2NmMtLjAxLS4wMS00LjU0LTQuNDU0LTQuNjA4LTQuNTE0QzM5LjQwNS00Ljg1Ny0yLjg0NyA0Mi4xMDggMTAuNjYyIDUzLjUxNGwyLjk1MiAyLjVjLS43NjYgMS45ODUtMS4wNjcgNC4yNTctLjgyIDYuNzAxLjMxNSAzLjE0IDEuOTM0IDYuMTQ5IDQuNTU5IDguNDc0IDIuNDkxIDIuMjA4IDUuNzY3IDMuNjA1IDguOTQ2IDMuNjAyIDUuMjU3IDEyLjExNCAxNy4yNjggMTkuNTQ2IDMxLjM1MSAxOS45NjQgMTUuMTA3LjQ0OSAyNy43ODgtNi42NCAzMy4xMDItMTkuMzczLjM0OC0uODk0IDEuODIzLTQuOTIgMS44MjMtOC40NzUgMC0zLjU3My0yLjAyLTUuMDUzLTMuMzA2LTUuMDUzWiIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImEiPjxwYXRoIGQ9Ik04IDVoODQuNjZ2ODkuODNIOHoiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4='
);
}
add_action( 'admin_menu', 'mailchimp_sf_add_pages' );
Expand Down Expand Up @@ -413,7 +423,6 @@ function mailchimp_sf_delete_setup() {
'mc_sopresto_user',
'mc_sopresto_public_key',
'mc_sopresto_secret_key',
'mc_rewards',
'mc_use_javascript',
'mc_use_datepicker',
'mc_use_unsub_link',
Expand Down Expand Up @@ -500,15 +509,6 @@ function mailchimp_sf_set_form_defaults( $list_name = '' ) {
function mailchimp_sf_save_general_form_settings() {

// IF NOT DEV MODE
if ( isset( $_POST['mc_rewards'] ) ) {
update_option( 'mc_rewards', 'on' );
$msg = '<p class="success_msg">' . __( 'Monkey Rewards turned On!', 'mailchimp_i18n' ) . '</p>';
mailchimp_sf_global_msg( $msg );
} elseif ( get_option( 'mc_rewards' ) !== 'off' ) {
update_option( 'mc_rewards', 'off' );
$msg = '<p class="success_msg">' . __( 'Monkey Rewards turned Off!', 'mailchimp_i18n' ) . '</p>';
mailchimp_sf_global_msg( $msg );
}
if ( isset( $_POST['mc_use_javascript'] ) ) {
update_option( 'mc_use_javascript', 'on' );
$msg = '<p class="success_msg">' . __( 'Fancy Javascript submission turned On!', 'mailchimp_i18n' ) . '</p>';
Expand Down Expand Up @@ -789,7 +789,6 @@ function mailchimp_sf_get_interest_categories( $list_id, $new_list ) {
*/
function mailchimp_sf_setup_page() {
$path = plugin_dir_path( __FILE__ );
wp_enqueue_script( 'showMe', MCSF_URL . 'js/hidecss.js', array( 'jquery' ), MCSF_VER, true );
require_once $path . '/views/setup_page.php';
}

Expand Down
38 changes: 38 additions & 0 deletions mailchimp_upgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Upgrade routines.
*
* @package Mailchimp
*/

/**
* Check plugin version.
*
* @since 1.6.0
* @return void
*/
function mailchimp_version_check() {
$db_option = get_option( 'mc_version' );

if ( MCSF_VER === $db_option ) {
return;
}

if ( false === $db_option || version_compare( '1.6.0', $db_option, '>' ) ) {
mailchimp_update_1_6_0();
}

update_option( 'mc_version', MCSF_VER );
}

add_action( 'plugins_loaded', 'mailchimp_version_check' );

/**
* Version 1.6.0 update routine
* - Remove MonkeyRewards checkbox option
*
* @return void
*/
function mailchimp_update_1_6_0() {
delete_option( 'mc_rewards' );
}
8 changes: 0 additions & 8 deletions mailchimp_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,6 @@ function mailchimp_sf_signup_form( $args = array() ) {
</div><!-- /mc_unsub_link -->
<?php
}
if ( $user && get_option( 'mc_rewards' ) === 'on' ) {
?>
<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>!
</div><!-- /mc_display_rewards -->
<?php
}
?>

</div><!-- /mc_form_inside -->
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ This section describes how to install the plugin and get started using it.
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.
6. 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.

= Advanced =

Expand Down Expand Up @@ -101,6 +100,7 @@ If your language is not listed above, feel free to create a translation. Here ar
= 1.6.0 =
* Deprecated function `mailchimpSF_signup_form`. Function `mailchimp_sf_signup_form` should be used instead.
* Bumps minimum PHP version to 7.0
* Removes MonkeyRewards feature.

= 1.5.8 =
* Fix PHP warning for merge tags.
Expand Down
1 change: 0 additions & 1 deletion views/css/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#mc-indicates-required {
width:100%;
}
#mc_display_rewards {}
.mc_interests_header {
font-weight:bold;
}
Expand Down
21 changes: 0 additions & 21 deletions views/setup_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,27 +308,6 @@

<table class="widefat mc-widefat">
<tr><th colspan="2">List Options</th></tr>
<tr valign="top">
<th scope="row"><?php esc_html_e( 'MonkeyRewards', 'mailchimp_i18n' ); ?>?</th>
<td><input name="mc_rewards" type="checkbox"<?php if ( get_option( 'mc_rewards' ) === 'on' || get_option( 'mc_rewards' ) === '' ) { echo ' checked="checked"'; } ?> id="mc_rewards" class="code" />
<em><label for="mc_rewards">
<?php
echo wp_kses(
__(
'We\'ll add a "powered by Mailchimp" link to your form that will help you earn <a href="http://kb.mailchimp.com/accounts/account-setup/monkeyrewards-credits" target="_blank">MonkeyRewards</a>. You can turn it off at any time.',
'mailchimp_i18n'
),
[
'a' => [
'href',
'target',
],
]
);
?>
</label></em>
</td>
</tr>

<tr valign="top">
<th scope="row"><?php esc_html_e( 'Use JavaScript Support?', 'mailchimp_i18n' ); ?></th>
Expand Down

0 comments on commit 684b96b

Please sign in to comment.