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,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>