first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
defined( 'ABSPATH' ) or exit;
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<style type="text/css" scoped>
h4{ margin-bottom: 2px; }
h4 + p { margin-top: 0; }
</style>
<h1 class="page-title">Mailchimp for WordPress: Add-on plugins</h1>
<div class="medium-margin" style="font-size: 120%">
<h2><span style="color: #c44;">Mailchimp for WordPress Premium</span>, take your newsletter to the next level!</h2>
<ul class="ul-square">
<li><strong>Better forms</strong> &mdash; unlimited, AJAX powered forms with detailed statistics.</li>
<li><strong>E-Commerce integration</strong> &mdash; tightly integrate your WooCommerce store with Mailchimp.</li>
<li><strong>Form designer</strong> &mdash; make your forms look pretty without having to know or write a single line of CSS.</li>
<li><strong>Append form to posts</strong> &mdash; automatically add a certain form to all posts (in a certain category)</li>
<li><strong>Priority support</strong> &mdash; gain access to our 24/7 support team.</li>
</ul>
<p>
<a href="https://www.mc4wp.com/pricing/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=extensions-page" class="button" style="background: #c44; border: #c44; color: white; padding: 6px 12px; height: auto; font-weight: bold;">Buy Mailchimp for WordPress Premium</a> &nbsp;
<a href="https://www.mc4wp.com/premium-features/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=extensions-page"><span style="text-decoration: none; vertical-align: middle; margin-right: 6px;" class="dashicons dashicons-info"> </span>More information</a>
</p>
<p><em>Comes with <a href="https://www.mc4wp.com/refund-policy/">our 30-day no questions asked money back guarantee</a>.</em>
</div>
<hr />
<div class="medium-margin">
<p>The following (free) add-on plugins are available for Mailchimp for WordPress.</p>
<div>
<h4><a href="https://wordpress.org/plugins/mailchimp-top-bar/">Mailchimp Top Bar</a></h4>
<p>Adds a sign-up bar to the top or bottom of your site. A sure fire way to grow your lists.</p>
</div>
<div>
<h4><a href="https://wordpress.org/plugins/mc4wp-activity/">Mailchimp Activity</a></h4>
<p>Adds an overview of Mailchimp list metrics to your WordPress dashboard.</p>
</div>
<div>
<h4><a href="https://wordpress.org/plugins/mc4wp-wpml/">WPML Integration</a></h4>
<p>Improved Mailchimp integration for multilingual sites using WPML.</p>
</div>
<div>
<h4><a href="https://wordpress.org/plugins/boxzilla/">Boxzilla Pop-ups</a></h4>
<p>Pop-ups for your sign-up forms.</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,105 @@
<?php
defined( 'ABSPATH' ) or exit;
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<p class="breadcrumbs">
<span class="prefix"><?php echo esc_html__( 'You are here: ', 'mailchimp-for-wp' ); ?></span>
<span class="current-crumb"><strong>Mailchimp for WordPress</strong></span>
</p>
<div class="row">
<!-- Main Content -->
<div class="main-content col col-4">
<h1 class="page-title">
Mailchimp for WordPress: <?php echo esc_html__( 'API Settings', 'mailchimp-for-wp' ); ?>
</h1>
<h2 style="display: none;"></h2>
<?php
settings_errors();
$this->messages->show();
?>
<form action="<?php echo admin_url( 'options.php' ); ?>" method="post">
<?php settings_fields( 'mc4wp_settings' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php echo esc_html__( 'Status', 'mailchimp-for-wp' ); ?>
</th>
<td>
<?php
if ( $connected ) {
?>
<span class="status positive"><?php echo esc_html__( 'CONNECTED', 'mailchimp-for-wp' ); ?></span>
<?php
} else {
?>
<span class="status neutral"><?php echo esc_html__( 'NOT CONNECTED', 'mailchimp-for-wp' ); ?></span>
<?php
}
?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="mailchimp_api_key"><?php echo esc_html__( 'API Key', 'mailchimp-for-wp' ); ?></label></th>
<td>
<input type="text" class="widefat" placeholder="<?php echo esc_html__( 'Your Mailchimp API key', 'mailchimp-for-wp' ); ?>" id="mailchimp_api_key" name="mc4wp[api_key]" value="<?php echo esc_attr( $obfuscated_api_key ); ?>" <?php echo defined( 'MC4WP_API_KEY' ) ? 'readonly="readonly"' : ''; ?> />
<p class="help">
<?php echo esc_html__( 'The API key for connecting with your Mailchimp account.', 'mailchimp-for-wp' ); ?>
<a target="_blank" href="https://admin.mailchimp.com/account/api"><?php echo esc_html__( 'Get your API key here.', 'mailchimp-for-wp' ); ?></a>
</p>
<?php
if ( defined( 'MC4WP_API_KEY' ) ) {
echo '<p class="help">', wp_kses( __( 'You defined your Mailchimp API key using the <code>MC4WP_API_KEY</code> constant.', 'mailchimp-for-wp' ), array( 'code' => array() ) ), '</p>';
}
?>
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
<?php
/**
* Runs right after general settings are outputted in admin.
*
* @since 3.0
* @ignore
*/
do_action( 'mc4wp_admin_after_general_settings' );
if ( ! empty( $opts['api_key'] ) ) {
echo '<hr />';
include __DIR__ . '/parts/lists-overview.php';
}
include __DIR__ . '/parts/admin-footer.php';
?>
</div>
<!-- Sidebar -->
<div class="sidebar col col-2">
<?php include __DIR__ . '/parts/admin-sidebar.php'; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,207 @@
<?php
defined( 'ABSPATH' ) or exit;
/** @var MC4WP_Debug_Log $log */
/** @var MC4WP_Debug_Log_Reader $log_reader */
/**
* @ignore
* @param array $opts
*/
function _mc4wp_usage_tracking_setting( $opts ) {
?>
<div class="medium-margin" >
<h3><?php echo esc_html__( 'Miscellaneous settings', 'mailchimp-for-wp' ); ?></h3>
<table class="form-table">
<tr>
<th><?php echo esc_html__( 'Usage Tracking', 'mailchimp-for-wp' ); ?></th>
<td>
<label>
<input type="radio" name="mc4wp[allow_usage_tracking]" value="1" <?php checked( $opts['allow_usage_tracking'], 1 ); ?> />
<?php echo esc_html__( 'Yes', 'mailchimp-for-wp' ); ?>
</label> &nbsp;
<label>
<input type="radio" name="mc4wp[allow_usage_tracking]" value="0" <?php checked( $opts['allow_usage_tracking'], 0 ); ?> />
<?php echo esc_html__( 'No', 'mailchimp-for-wp' ); ?>
</label>
<p class="help">
<?php echo esc_html__( 'Allow us to anonymously track how this plugin is used to help us make it better fit your needs.', 'mailchimp-for-wp' ); ?>
<a href="https://www.mc4wp.com/kb/what-is-usage-tracking/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=settings-page" target="_blank">
<?php echo esc_html__( 'This is what we track.', 'mailchimp-for-wp' ); ?>
</a>
</p>
</td>
</tr>
<tr>
<th><?php echo esc_html__( 'Logging', 'mailchimp-for-wp' ); ?></th>
<td>
<select name="mc4wp[debug_log_level]">
<option value="warning" <?php selected( 'warning', $opts['debug_log_level'] ); ?>><?php echo esc_html__( 'Errors & warnings only', 'mailchimp-for-wp' ); ?></option>
<option value="debug" <?php selected( 'debug', $opts['debug_log_level'] ); ?>><?php echo esc_html__( 'Everything', 'mailchimp-for-wp' ); ?></option>
</select>
<p class="help">
<?php echo sprintf( wp_kses( __( 'Determines what events should be written to <a href="%s">the debug log</a> (see below).', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), 'https://www.mc4wp.com/kb/how-to-enable-log-debugging/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=settings-page' ); ?>
</p>
</td>
</tr>
</table>
</div>
<?php
}
add_action( 'mc4wp_admin_other_settings', '_mc4wp_usage_tracking_setting', 70 );
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<p class="breadcrumbs">
<span class="prefix"><?php echo esc_html__( 'You are here: ', 'mailchimp-for-wp' ); ?></span>
<a href="<?php echo admin_url( 'admin.php?page=mailchimp-for-wp' ); ?>">Mailchimp for WordPress</a> &rsaquo;
<span class="current-crumb"><strong><?php echo esc_html__( 'Other Settings', 'mailchimp-for-wp' ); ?></strong></span>
</p>
<div class="row">
<!-- Main Content -->
<div class="main-content col col-4">
<h1 class="page-title">
<?php echo esc_html__( 'Other Settings', 'mailchimp-for-wp' ); ?>
</h1>
<h2 style="display: none;"></h2>
<?php settings_errors(); ?>
<?php
/**
* @ignore
*/
do_action( 'mc4wp_admin_before_other_settings', $opts );
?>
<!-- Settings -->
<form action="<?php echo admin_url( 'options.php' ); ?>" method="post">
<?php settings_fields( 'mc4wp_settings' ); ?>
<?php
/**
* @ignore
*/
do_action( 'mc4wp_admin_other_settings', $opts );
?>
<div style="margin-top: -20px;"><?php submit_button(); ?></div>
</form>
<!-- Debug Log -->
<div class="medium-margin">
<h3><?php echo esc_html__( 'Debug Log', 'mailchimp-for-wp' ); ?> <input type="text" id="debug-log-filter" class="alignright regular-text" placeholder="<?php echo esc_attr__( 'Filter..', 'mailchimp-for-wp' ); ?>" /></h3>
<?php
if ( ! $log->test() ) {
echo '<p>';
echo esc_html__( 'Log file is not writable.', 'mailchimp-for-wp' ) . ' ';
echo sprintf( wp_kses( __( 'Please ensure %1$s has the proper <a href="%2$s">file permissions</a>.', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), '<code>' . $log->file . '</code>', 'https://codex.wordpress.org/Changing_File_Permissions' );
echo '</p>';
// hack to hide filter input
echo '<style type="text/css">#debug-log-filter { display: none; }</style>';
} else {
?>
<div id="debug-log" class="mc4wp-log widefat">
<?php
$line = $log_reader->read_as_html();
if ( ! empty( $line ) ) {
while ( is_string( $line ) ) {
if ( ! empty( $line ) ) {
echo '<div class="debug-log-line">' . $line . '</div>';
}
$line = $log_reader->read_as_html();
}
} else {
echo '<div class="debug-log-empty">';
echo '-- ', esc_html__( 'Nothing here. Which means there are no errors!', 'mailchimp-for-wp' );
echo '</div>';
}
?>
</div>
<form method="post">
<input type="hidden" name="_mc4wp_action" value="empty_debug_log">
<p>
<input type="submit" class="button" value="<?php echo esc_attr__( 'Empty Log', 'mailchimp-for-wp' ); ?>"/>
</p>
</form>
<?php
} // end if is writable
if ( $log->level >= 300 ) {
echo '<p>';
echo esc_html__( 'Right now, the plugin is configured to only log errors and warnings.', 'mailchimp-for-wp' );
echo '</p>';
}
?>
<script>
(function() {
'use strict';
// scroll to bottom of log
var log = document.getElementById("debug-log"),
logItems;
log.scrollTop = log.scrollHeight;
log.style.minHeight = '';
log.style.maxHeight = '';
log.style.height = log.clientHeight + "px";
// add filter
var logFilter = document.getElementById('debug-log-filter');
logFilter.addEventListener('keydown', function(evt) {
if(evt.keyCode === 13 ) {
searchLog(evt.target.value.trim());
}
});
// search log for query
function searchLog(query) {
if( ! logItems ) {
logItems = [].map.call(log.children, function(node) {
return node.cloneNode(true);
})
}
var ri = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), 'i');
var newLog = log.cloneNode();
logItems.forEach(function(node) {
if( ! node.textContent ) { return ; }
if( ! query.length || ri.test(node.textContent) ) {
newLog.appendChild(node);
}
});
log.parentNode.replaceChild(newLog,log);
log = newLog;
log.scrollTop = log.scrollHeight;
}
})();
</script>
</div>
<!-- / Debug Log -->
<?php include __DIR__ . '/parts/admin-footer.php'; ?>
</div>
<!-- Sidebar -->
<div class="sidebar col col-2">
<?php include __DIR__ . '/parts/admin-sidebar.php'; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,51 @@
<?php defined( 'ABSPATH' ) or exit;
/**
* @ignore
*/
function _mc4wp_admin_translation_notice() {
// show for every language other than the default
if ( stripos( get_locale(), 'en_us' ) === 0 ) {
return;
}
/* translators: %s links to the WordPress.org translation project */
echo '<p class="help">' . sprintf( wp_kses( __( 'Mailchimp for WordPress is in need of translations. Is the plugin not translated in your language or do you spot errors with the current translations? Helping out is easy! Please <a href="%s">help translate the plugin using your WordPress.org account</a>.', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), 'https://translate.wordpress.org/projects/wp-plugins/mailchimp-for-wp/stable/' ) . '</p>';
}
/**
* @ignore
*/
function _mc4wp_admin_github_notice() {
if ( strpos( $_SERVER['HTTP_HOST'], 'localhost' ) === false && ! WP_DEBUG ) {
return;
}
echo '<p class="help">Developer? Follow <a href="https://github.com/ibericode/mailchimp-for-wordpress">Mailchimp for WordPress on GitHub</a> or have a look at our repository of <a href="https://github.com/ibericode/mc4wp-snippets">sample code snippets</a>.</p>';
}
/**
* @ignore
*/
function _mc4wp_admin_disclaimer_notice() {
echo '<p class="help">', esc_html__( 'This plugin is not developed by or affiliated with Mailchimp in any way.', 'mailchimp-for-wp' ), '</p>';
}
add_action( 'mc4wp_admin_footer', '_mc4wp_admin_translation_notice', 20 );
add_action( 'mc4wp_admin_footer', '_mc4wp_admin_github_notice', 50 );
add_action( 'mc4wp_admin_footer', '_mc4wp_admin_disclaimer_notice', 80 );
?>
<div class="big-margin">
<?php
/**
* Runs while printing the footer of every Mailchimp for WordPress settings page.
*
* @since 3.0
*/
do_action( 'mc4wp_admin_footer' );
?>
</div>

View File

@@ -0,0 +1,63 @@
<?php
defined( 'ABSPATH' ) or exit;
/**
* @ignore
*/
function _mc4wp_admin_sidebar_support_notice() {
?>
<div class="mc4wp-box">
<h4 class="mc4wp-title"><?php echo esc_html__( 'Looking for help?', 'mailchimp-for-wp' ); ?></h4>
<p><?php echo esc_html__( 'We have some resources available to help you in the right direction.', 'mailchimp-for-wp' ); ?></p>
<ul class="ul-square">
<li><a href="https://www.mc4wp.com/kb/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar"><?php echo esc_html__( 'Knowledge Base', 'mailchimp-for-wp' ); ?></a></li>
<li><a href="https://wordpress.org/plugins/mailchimp-for-wp/faq/"><?php echo esc_html__( 'Frequently Asked Questions', 'mailchimp-for-wp' ); ?></a></li>
</ul>
<p><?php echo sprintf( wp_kses( __( 'If your answer can not be found in the resources listed above, please use the <a href="%s">support forums on WordPress.org</a>.', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), 'https://wordpress.org/support/plugin/mailchimp-for-wp' ); ?></p>
<p><?php echo sprintf( wp_kses( __( 'Found a bug? Please <a href="%s">open an issue on GitHub</a>.', 'mailchimp-for-wp' ), array( 'a' => array( 'href' => array() ) ) ), 'https://github.com/ibericode/mailchimp-for-wordpress/issues' ); ?></p>
</div>
<?php
}
/**
* @ignore
*/
function _mc4wp_admin_sidebar_other_plugins() {
echo '<div class="mc4wp-box">';
echo '<h4 class="mc4wp-title">', esc_html__( 'Other plugins by ibericode', 'mailchimp-for-wp' ), '</h4>';
echo '<ul style="margin-bottom: 0;">';
// Koko Analytics
echo '<li style="margin: 12px 0;">';
echo sprintf( '<strong><a href="%s">Koko Analytics</a></strong><br />', 'https://wordpress.org/plugins/koko-analytics/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar' );
echo esc_html__( 'Privacy-friendly analytics plugin that does not use any external services.', 'mailchimp-for-wp' );
echo '</li>';
// Boxzilla
echo '<li style="margin: 12px 0;">';
echo sprintf( '<strong><a href="%s">Boxzilla Pop-ups</a></strong><br />', 'https://wordpress.org/plugins/boxzilla/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar' );
echo esc_html__( 'Pop-ups or boxes that slide-in with a newsletter sign-up form. A sure-fire way to grow your email lists.', 'mailchimp-for-wp' );
echo '</li>';
// HTML Forms
echo '<li style="margin: 12px 0;">';
echo sprintf( '<strong><a href="%s">HTML Forms</a></strong><br />', 'https://wordpress.org/plugins/html-forms/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar' );
echo esc_html__( 'Super flexible forms using native HTML. Just like Mailchimp for WordPress forms but for other purposes, like a contact form.', 'mailchimp-for-wp' );
echo '</li>';
echo '</ul>';
echo '</div>';
}
add_action( 'mc4wp_admin_sidebar', '_mc4wp_admin_sidebar_other_plugins', 40 );
add_action( 'mc4wp_admin_sidebar', '_mc4wp_admin_sidebar_support_notice', 50 );
/**
* Runs when the sidebar is outputted on Mailchimp for WordPress settings pages.
*
* Please note that not all pages have a sidebar.
*
* @since 3.0
*/
do_action( 'mc4wp_admin_sidebar' );

View File

@@ -0,0 +1,59 @@
<h3><?php echo esc_html__( 'Your Mailchimp Account', 'mailchimp-for-wp' ); ?></h3>
<p><?php echo esc_html__( 'The table below shows your Mailchimp lists and their details. If you just applied changes to your Mailchimp lists, please use the following button to renew the cached lists configuration.', 'mailchimp-for-wp' ); ?></p>
<div id="mc4wp-list-fetcher">
<form method="post" action="">
<input type="hidden" name="_mc4wp_action" value="empty_lists_cache" />
<p>
<input type="submit" value="<?php echo esc_html__( 'Renew Mailchimp lists', 'mailchimp-for-wp' ); ?>" class="button" />
</p>
</form>
</div>
<div class="mc4wp-lists-overview">
<?php
if ( empty( $lists ) ) {
?>
<p><?php echo esc_html__( 'No lists were found in your Mailchimp account', 'mailchimp-for-wp' ); ?>.</p>
<?php
} else {
echo sprintf( '<p>' . esc_html__( 'A total of %d lists were found in your Mailchimp account.', 'mailchimp-for-wp' ) . '</p>', count( $lists ) );
echo '<table class="widefat striped" id="mc4wp-mailchimp-lists-overview">';
$headings = array(
esc_html__( 'List Name', 'mailchimp-for-wp' ),
esc_html__( 'ID', 'mailchimp-for-wp' ),
esc_html__( 'Subscribers', 'mailchimp-for-wp' ),
);
echo '<thead>';
echo '<tr>';
foreach ( $headings as $heading ) {
echo sprintf( '<th>%s</th>', $heading );
}
echo '</tr>';
echo '</thead>';
foreach ( $lists as $list ) {
echo '<tr>';
echo sprintf( '<td><a href="#" class="mc4wp-mailchimp-list" data-list-id="%s">%s</a><span class="row-actions alignright"></span></td>', esc_attr( $list->id ), esc_html( $list->name ) );
echo sprintf( '<td><code>%s</code></td>', esc_html( $list->id ) );
echo sprintf( '<td>%s</td>', esc_html( $list->stats->member_count ) );
echo '</tr>';
echo sprintf( '<tr class="list-details list-%s-details" style="display: none;">', $list->id );
echo '<td colspan="3" style="padding: 0 20px 40px;">';
echo sprintf( '<p class="alignright" style="margin: 20px 0;"><a href="https://admin.mailchimp.com/lists/members/?id=%s" target="_blank"><span class="dashicons dashicons-edit"></span> ' . esc_html__( 'Edit this list in Mailchimp', 'mailchimp-for-wp' ) . '</a></p>', $list->web_id );
echo '<div><div>', esc_html__( 'Loading... Please wait.', 'mailchimp-for-wp' ) , '</div></div>';
echo '</td>';
echo '</tr>';
?>
<?php
} // end foreach $lists
echo '</table>';
} // end if empty
?>
</div>