first commit

This commit is contained in:
2024-07-31 13:12:38 +07:00
commit b4e8cbe182
10213 changed files with 3125839 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
defined('ABSPATH') or exit;
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<style>
#mc4wp-admin h4{ margin-bottom: 2px; }
#mc4wp-admin h4 + p { margin-top: 0; }
</style>
<h1 class="mc4wp-page-title">Mailchimp for WordPress: Add-on plugins</h1>
<div class="mc4wp-margin-m" >
<h2><span style="color: #c44;">Mailchimp for WordPress Premium</span>, take your email marketing to the next level!</h2>
<p>You're currently on the free version of the <strong>MC4WP: Mailchimp for WordPress</strong> plugin.</p>
<p>Did you know that there is a premium version too? It comes with the following additional features:</p>
<ul class="ul-square">
<li><strong>Multiple and improved forms</strong> &mdash; allowing an unlimited amount of sign-up forms that submit without requiring a full page reload.</li>
<li><strong>E-Commerce integration</strong> &mdash; tightly integrate your WooCommerce store with Mailchimp.
<li><strong>User Sync</strong> &mdash; keep your WordPress user database in sync with a Mailchimp list.</li>
<li><strong>Logging</strong> - every form submission is stored locally, allowing charted data and exporting to CSV or JSON</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; an easy setting to automatically append a 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="mc4wp-margin-m">
<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-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,106 @@
<?php
defined('ABSPATH') or exit;
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<p class="mc4wp-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="mc4wp-row">
<!-- Main Content -->
<div class="main-content mc4wp-col">
<h1 class="mc4wp-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="mc4wp-status positive"><?php echo esc_html__('CONNECTED', 'mailchimp-for-wp'); ?></span>
<?php
} else {
?>
<span class="mc4wp-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="description">
<?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="description">', 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';
}
require __DIR__ . '/parts/admin-footer.php';
?>
</div>
<!-- Sidebar -->
<div class="mc4wp-sidebar mc4wp-col">
<?php require __DIR__ . '/parts/admin-sidebar.php'; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,176 @@
<?php
defined('ABSPATH') or exit;
/** @var array $opts */
/** @var MC4WP_Debug_Log $log */
/** @var MC4WP_Debug_Log_Reader $log_reader */
?>
<div id="mc4wp-admin" class="wrap mc4wp-settings">
<p class="mc4wp-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="mc4wp-row">
<!-- Main Content -->
<div class="main-content mc4wp-col">
<h1 class="mc4wp-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'); ?>
<div class="mc4wp-margin-m" >
<h3><?php echo esc_html__('Miscellaneous settings', 'mailchimp-for-wp'); ?></h3>
<table class="form-table">
<tr>
<th><label for="mc4wp-debug-log-level"><?php echo esc_html__('Logging', 'mailchimp-for-wp'); ?></label></th>
<td>
<select id="mc4wp-debug-log-level" 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="description">
<?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
/**
* @ignore
*/
do_action('mc4wp_admin_other_settings', $opts);
?>
<div style="margin-top: -20px;"><?php submit_button(); ?></div>
</form>
<!-- Debug Log -->
<div class="mc4wp-margin-m">
<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>#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">
<?php wp_nonce_field('_mc4wp_action', '_wpnonce'); ?>
<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() {
// scroll to bottom of log
let log = document.getElementById("debug-log"),
logItems;
log.scrollTop = log.scrollHeight;
log.style.minHeight = '';
log.style.maxHeight = '';
log.style.height = log.clientHeight + "px";
// add filter
document.getElementById('debug-log-filter').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);
})
}
const ri = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), 'i');
const newLog = log.cloneNode(false);
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 require __DIR__ . '/parts/admin-footer.php'; ?>
</div>
<!-- Sidebar -->
<div class="mc4wp-sidebar mc4wp-col">
<?php require __DIR__ . '/parts/admin-sidebar.php'; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,55 @@
<?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="description">' . 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="description">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/mailchimp-for-wordpress/tree/master/sample-code-snippets">sample code snippets</a>.</p>';
}
/**
* @ignore
*/
function _mc4wp_admin_disclaimer_notice()
{
echo '<p class="description">', 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="mc4wp-margin-l">
<?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,65 @@
<?php
defined('ABSPATH') or exit;
/**
* @ignore
*/
function _mc4wp_admin_sidebar_support_notice()
{
?>
<div class="mc4wp-box mc4wp-margin-m">
<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 mc4wp-margin-m">';
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,104 @@
<?php
/**
* @var object[] $merge_fields
* @var object[] $interest_categories
* @var object[] $marketing_permissions
*/
?>
<h3>Merge fields</h3>
<table class="widefat striped">
<thead>
<tr>
<th>Name</th>
<th>Tag</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php foreach ($merge_fields as $f) { ?>
<tr>
<td><?php echo $f->name; ?> <?php
if ($f->required) {
?>
<span class="mc4wp-red">*</span>
<?php } ?></td>
<td><code><?php echo $f->tag; ?></code></td>
<td>
<?php echo $f->type; ?>
<?php
if ($f->options && $f->options->date_format) {
echo '(' . $f->options->date_format . ')';
}
?>
<?php
if ($f->options && $f->options->choices) {
echo '(' . join(', ', $f->options->choices) . ')';
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php if ($interest_categories) { ?>
<h3>Interest Categories</h3>
<table class="striped widefat">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Interests</th>
</tr>
</thead>
<tbody>
<?php foreach ($interest_categories as $f) { ?>
<tr>
<td>
<strong><?php echo $f->title; ?></strong>
<br />
<br />
ID: <code><?php echo $f->id; ?></code>
</td>
<td><?php echo $f->type; ?></td>
<td>
<table>
<thead>
<tr><th>Name</th><th>ID</th></tr>
</thead>
<tbody>
<?php foreach ($f->interests as $id => $name) { ?>
<tr>
<td><?php echo $name; ?></td>
<td><code><?php echo $id; ?></code></td>
</tr>
<?php } ?>
</tbody>
</table>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } // end if interest categories ?>
<?php if ($marketing_permissions) { ?>
<h3>Marketing Permissions</h3>
<table class="striped widefat">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php foreach ($marketing_permissions as $mp) { ?>
<tr>
<td><code><?php echo $mp->marketing_permission_id; ?></code></td>
<td><?php echo $mp->text; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } // end if marketing permissions ?>

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>