MailMunch – Grow your Email List - Version 3.0.2

Version Description

  • SEO plugins can be used with landing pages
  • Landing pages can be set as home page
Download this release

Release Info

Developer mailmunch
Plugin Icon 128x128 MailMunch – Grow your Email List
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

admin/class-mailmunch-admin.php CHANGED
@@ -144,8 +144,13 @@ class Mailmunch_Admin {
144
  add_menu_page( $this->integration_name, $this->integration_name, 'manage_options', MAILMUNCH_SLUG, array($this, 'get_dashboard_html'), plugins_url( 'img/icon.png', __FILE__ ), 105.786);
145
 
146
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name, 'Forms', 'manage_options', MAILMUNCH_SLUG, array($this, 'get_dashboard_html') );
147
- add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. 'Landing Pages', 'Landing Pages', 'manage_options', 'edit.php?post_type='. MAILMUNCH_POST_TYPE );
148
- add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. 'Settings', 'Settings', 'manage_options', MAILMUNCH_SLUG. '-settings', array($this, 'settings_page') );
 
 
 
 
 
149
  }
150
 
151
  /**
@@ -247,6 +252,7 @@ class Mailmunch_Admin {
247
  $this->initiate_api();
248
  if ($_POST) {
249
  $this->mailmunch_api->setSetting('auto_embed', $_POST['auto_embed']);
 
250
  }
251
  require_once(plugin_dir_path(__FILE__) . 'partials/mailmunch-settings.php');
252
  }
@@ -276,12 +282,15 @@ class Mailmunch_Admin {
276
  * @since 3.0.0
277
  */
278
  public function dashboard_widget() {
 
279
  $html = '<div class="mailmunch-dash-widget">';
280
  $html .= '<div class="mailmunch-dash-widget-inner">';
281
  $html .= '<p>Welcome to MailMunch! The #1 plugin to grow your email list.</p>';
282
  $html .= '<div>';
283
  $html .= '<a class="mailmunch-dash-option" href="'. admin_url('admin.php?page='.MAILMUNCH_SLUG) .'"><span class="dashicons dashicons-editor-table"></span><span class="mailmunch-dash-text">Forms</span></a>';
284
- $html .= '<a class="mailmunch-dash-option" href="'. admin_url('edit.php?post_type='.MAILMUNCH_POST_TYPE) .'"><span class="dashicons dashicons-admin-page"></span><span class="mailmunch-dash-text">Landing Pages</span></a>';
 
 
285
  $html .= '</div>';
286
  $html .= '</div>';
287
  $html .= '</div>';
144
  add_menu_page( $this->integration_name, $this->integration_name, 'manage_options', MAILMUNCH_SLUG, array($this, 'get_dashboard_html'), plugins_url( 'img/icon.png', __FILE__ ), 105.786);
145
 
146
  add_submenu_page( MAILMUNCH_SLUG, $this->integration_name, 'Forms', 'manage_options', MAILMUNCH_SLUG, array($this, 'get_dashboard_html') );
147
+
148
+ $landingPagesEnabled = get_option(MAILMUNCH_PREFIX. '_landing_pages_enabled');
149
+ if (empty($landingPagesEnabled) || $landingPagesEnabled == 'yes') {
150
+ add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Landing Pages', 'Landing Pages', 'manage_options', 'edit.php?post_type='. MAILMUNCH_POST_TYPE );
151
+ }
152
+
153
+ add_submenu_page( MAILMUNCH_SLUG, $this->integration_name. ' Settings', 'Settings', 'manage_options', MAILMUNCH_SLUG. '-settings', array($this, 'settings_page') );
154
  }
155
 
156
  /**
252
  $this->initiate_api();
253
  if ($_POST) {
254
  $this->mailmunch_api->setSetting('auto_embed', $_POST['auto_embed']);
255
+ $this->mailmunch_api->setSetting('landing_pages_enabled', $_POST['landing_pages_enabled']);
256
  }
257
  require_once(plugin_dir_path(__FILE__) . 'partials/mailmunch-settings.php');
258
  }
282
  * @since 3.0.0
283
  */
284
  public function dashboard_widget() {
285
+ $landingPagesEnabled = get_option(MAILMUNCH_PREFIX. '_landing_pages_enabled');
286
  $html = '<div class="mailmunch-dash-widget">';
287
  $html .= '<div class="mailmunch-dash-widget-inner">';
288
  $html .= '<p>Welcome to MailMunch! The #1 plugin to grow your email list.</p>';
289
  $html .= '<div>';
290
  $html .= '<a class="mailmunch-dash-option" href="'. admin_url('admin.php?page='.MAILMUNCH_SLUG) .'"><span class="dashicons dashicons-editor-table"></span><span class="mailmunch-dash-text">Forms</span></a>';
291
+ if (empty($landingPagesEnabled) || $landingPagesEnabled == 'yes') {
292
+ $html .= '<a class="mailmunch-dash-option" href="'. admin_url('edit.php?post_type='.MAILMUNCH_POST_TYPE) .'"><span class="dashicons dashicons-admin-page"></span><span class="mailmunch-dash-text">Landing Pages</span></a>';
293
+ }
294
  $html .= '</div>';
295
  $html .= '</div>';
296
  $html .= '</div>';
admin/partials/mailmunch-settings.php CHANGED
@@ -1,5 +1,8 @@
1
  <form method="POST" id="mailmunch-settings">
2
- <?php $autoEmbed = $this->mailmunch_api->getSetting('auto_embed'); ?>
 
 
 
3
  <div id="poststuff" class="wrap">
4
  <div id="post-body" class="metabox-holder columns-2">
5
  <div id="post-body-content">
@@ -23,6 +26,18 @@
23
  </select>
24
  </td>
25
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
26
  <tr>
27
  <td colspan="2">
28
  <input type="submit" name="Save" value="Save Settings" class="button button-primary" />
1
  <form method="POST" id="mailmunch-settings">
2
+ <?php
3
+ $autoEmbed = $this->mailmunch_api->getSetting('auto_embed');
4
+ $landingPagesEnabled = $this->mailmunch_api->getSetting('landing_pages_enabled');
5
+ ?>
6
  <div id="poststuff" class="wrap">
7
  <div id="post-body" class="metabox-holder columns-2">
8
  <div id="post-body-content">
26
  </select>
27
  </td>
28
  </tr>
29
+ <tr>
30
+ <td class="inside-container" width="30%">
31
+ <h3>Enable Landing Pages</h3>
32
+ <p>If enabled, you will be able to use MailMunch landing pages and create pages from within your Wordpress admin.</p>
33
+ </td>
34
+ <td class="setting">
35
+ <select name="landing_pages_enabled">
36
+ <option value="yes"<?php if ($landingPagesEnabled == 'yes' || empty($landingPagesEnabled)) echo "selected=\"selected\""; ?>>Yes</option>
37
+ <option value="no"<?php if ($landingPagesEnabled == 'no') echo "selected=\"selected\""; ?>>No</option>
38
+ </select>
39
+ </td>
40
+ </tr>
41
  <tr>
42
  <td colspan="2">
43
  <input type="submit" name="Save" value="Save Settings" class="button button-primary" />
includes/class-mailmunch-post-type.php CHANGED
@@ -139,5 +139,13 @@ class Mailmunch_Post_Type {
139
  }
140
  }
141
 
142
-
 
 
 
 
 
 
 
 
143
  }
139
  }
140
  }
141
 
142
+ public function add_pages_to_dropdown($pages, $r) {
143
+ if ('page_on_front' == $r['name']) {
144
+ $args = array('post_type' => MAILMUNCH_POST_TYPE);
145
+ $stacks = get_posts($args);
146
+ $pages = array_merge($pages, $stacks);
147
+ }
148
+
149
+ return $pages;
150
+ }
151
  }
includes/class-mailmunch-rewrite.php CHANGED
@@ -76,6 +76,16 @@ class Mailmunch_Rewrite {
76
  return $slug;
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Regenerate rewrite rules for each custom page
81
  *
76
  return $slug;
77
  }
78
 
79
+ public function enable_front_page_landing_pages($query) {
80
+ if (array_key_exists('post_type', $query->query_vars)) {
81
+ $postType = $query->query_vars['post_type'];
82
+ }
83
+
84
+ if ('' == $postType && 0 != $query->query_vars['page_id']) {
85
+ $query->query_vars['post_type'] = array('page', MAILMUNCH_POST_TYPE);
86
+ }
87
+ }
88
+
89
  /**
90
  * Regenerate rewrite rules for each custom page
91
  *
includes/class-mailmunch.php CHANGED
@@ -22,7 +22,7 @@ define( 'MAILMUNCH_SLUG', "mailmunch" );
22
  define( 'MAILMUNCH_PREFIX', 'mailmunch' );
23
  define( 'MAILMUNCH_POST_TYPE', 'mailmunch_page' );
24
  define( 'MAILMUNCH_PLUGIN_DIRECTORY', 'mailmunch' );
25
- define( 'MAILMUNCH_VERSION', '3.0.1' );
26
 
27
  /**
28
  * The core plugin class.
@@ -107,7 +107,10 @@ class Mailmunch {
107
  $this->define_admin_hooks();
108
  }
109
  $this->define_public_hooks();
110
- $this->define_post_type();
 
 
 
111
  }
112
 
113
  /**
@@ -259,9 +262,9 @@ class Mailmunch {
259
  private function define_post_type() {
260
  // Landing Page
261
  $plugin_post_type = new Mailmunch_Post_Type();
262
- $this->loader->add_action( 'init', $plugin_post_type, 'create_post_type' );
263
- $this->loader->add_filter( 'template_include', $plugin_post_type, 'post_type_template' );
264
-
265
  $this->loader->add_action('add_meta_boxes', $plugin_post_type, 'post_meta_box', 10, 2);
266
  $this->loader->add_action('save_post', $plugin_post_type, 'landing_page_save_meta', 10, 2 );
267
 
@@ -269,6 +272,7 @@ class Mailmunch {
269
  $this->loader->add_action('init', $plugin_rewrite, 'init');
270
  $this->loader->add_action('save_post', $plugin_rewrite, 'on_save_post');
271
  $this->loader->add_action('wp_insert_post', $plugin_rewrite, 'on_wp_insert_post');
 
272
  $this->loader->add_filter('post_type_link', $plugin_rewrite, 'on_post_type_link');
273
  $this->loader->add_filter('wp_unique_post_slug', $plugin_rewrite, 'on_wp_unique_post_slug', 10, 6);
274
  }
22
  define( 'MAILMUNCH_PREFIX', 'mailmunch' );
23
  define( 'MAILMUNCH_POST_TYPE', 'mailmunch_page' );
24
  define( 'MAILMUNCH_PLUGIN_DIRECTORY', 'mailmunch' );
25
+ define( 'MAILMUNCH_VERSION', '3.0.2' );
26
 
27
  /**
28
  * The core plugin class.
107
  $this->define_admin_hooks();
108
  }
109
  $this->define_public_hooks();
110
+ $landingPagesEnabled = get_option(MAILMUNCH_PREFIX. '_landing_pages_enabled');
111
+ if (empty($landingPagesEnabled) || $landingPagesEnabled == 'yes') {
112
+ $this->define_post_type();
113
+ }
114
  }
115
 
116
  /**
262
  private function define_post_type() {
263
  // Landing Page
264
  $plugin_post_type = new Mailmunch_Post_Type();
265
+ $this->loader->add_action('init', $plugin_post_type, 'create_post_type');
266
+ $this->loader->add_filter('template_include', $plugin_post_type, 'post_type_template');
267
+ $this->loader->add_filter('get_pages', $plugin_post_type, 'add_pages_to_dropdown', 10, 2);
268
  $this->loader->add_action('add_meta_boxes', $plugin_post_type, 'post_meta_box', 10, 2);
269
  $this->loader->add_action('save_post', $plugin_post_type, 'landing_page_save_meta', 10, 2 );
270
 
272
  $this->loader->add_action('init', $plugin_rewrite, 'init');
273
  $this->loader->add_action('save_post', $plugin_rewrite, 'on_save_post');
274
  $this->loader->add_action('wp_insert_post', $plugin_rewrite, 'on_wp_insert_post');
275
+ $this->loader->add_action('pre_get_posts', $plugin_rewrite, 'enable_front_page_landing_pages', 11);
276
  $this->loader->add_filter('post_type_link', $plugin_rewrite, 'on_post_type_link');
277
  $this->loader->add_filter('wp_unique_post_slug', $plugin_rewrite, 'on_wp_unique_post_slug', 10, 6);
278
  }
mailmunch.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: MailMunch - Grow Your Email List
17
  * Plugin URI: http://www.mailmunch.co
18
  * Description: The best free plugin to get more email subscribers. Beautiful signup forms and landing pages that integrate with MailChimp, Constant Contact, AWeber, Campaign Monitor and more.
19
- * Version: 3.0.1
20
  * Author: MailMunch
21
  * Author URI: http://www.mailmunch.co
22
  * License: GPL-2.0+
16
  * Plugin Name: MailMunch - Grow Your Email List
17
  * Plugin URI: http://www.mailmunch.co
18
  * Description: The best free plugin to get more email subscribers. Beautiful signup forms and landing pages that integrate with MailChimp, Constant Contact, AWeber, Campaign Monitor and more.
19
+ * Version: 3.0.2
20
  * Author: MailMunch
21
  * Author URI: http://www.mailmunch.co
22
  * License: GPL-2.0+
public/mailmunch-landing-page.php CHANGED
@@ -1,11 +1,43 @@
1
  <?php
2
  $landing_page_id = get_post_meta( get_the_ID(), '_mailmunch_landing_page_id', true );
3
- $response = wp_remote_get(MAILMUNCH_PAGE_SERVICE_URL. '/'. $landing_page_id);
 
 
 
 
4
  if ( is_array( $response ) && ! is_wp_error( $response ) ) {
5
- echo $response['body'];
 
 
 
 
6
  } else {
7
  status_header( 404 );
8
  nocache_headers();
9
  include( get_query_template( '404' ) );
10
  die();
11
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  $landing_page_id = get_post_meta( get_the_ID(), '_mailmunch_landing_page_id', true );
3
+ $response = wp_remote_get(MAILMUNCH_PAGE_SERVICE_URL. '/'. $landing_page_id, array(
4
+ 'headers' => array(
5
+ 'X-MailMunch-JSON' => 1
6
+ )
7
+ ));
8
  if ( is_array( $response ) && ! is_wp_error( $response ) ) {
9
+ $landingPageJson = json_decode($response['body']);
10
+ $pageHead = $landingPageJson->head;
11
+ $pageBody = $landingPageJson->body;
12
+ $pageTitle = $landingPageJson->title;
13
+ $pageScreenshotUrl = $landingPageJson->screenshotUrl;
14
  } else {
15
  status_header( 404 );
16
  nocache_headers();
17
  include( get_query_template( '404' ) );
18
  die();
19
  }
20
+ ?>
21
+ <!DOCTYPE html>
22
+ <html lang="en">
23
+ <head>
24
+ <meta charset="UTF-8">
25
+ <meta name=viewport content="width=device-width, initial-scale=1">
26
+ <meta property="og:type" content="website" />
27
+ <meta property="og:image" content="<?php echo $pageScreenshotUrl ?>" />
28
+ <meta property="og:image:width" content="600" />
29
+ <meta property="og:image:height" content="600" />
30
+ <title><?php echo wp_title(''); ?></title>
31
+ <?php echo wp_head(); ?>
32
+
33
+ <style type="text/css" media="screen">
34
+ html { margin-top: 0px !important; }
35
+ * html body { margin-top: 0px !important; }
36
+ </style>
37
+
38
+ <?php echo $pageHead; ?>
39
+ </head>
40
+ <body>
41
+ <?php echo $pageBody; ?>
42
+ </body>
43
+ </html>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mailmunch, lizgannes
3
  Tags: signup form, newsletter, newsletters, subscribe, popup, exit popup, exit intent, subscribers, subscription, popover, lightbox, analytics, collect email, optin, optin form, optin forms, double optin, list builder, email form, lead, leads, mailchimp, mailchimp form, mailchimp newsletter, mailchimp plugin, mailchimp signup, mailchimp signup forms, mailchimp signup form, mailchimp widget, mailchimp subscribe, constant contact, contact contact form, constant contact newsletter, constant contact plugin, constant contact signup, constant contact signup forms, constant contact signup form, constant contact widget, constant contact subscribe, aweber, aweber form, aweber forms, aweber signup form, aweber plugin
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
- Stable tag: 3.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -163,6 +163,10 @@ Why people use AWeber
163
 
164
  == Changelog ==
165
 
 
 
 
 
166
  = 3.0.0 =
167
  * Landing pages
168
 
3
  Tags: signup form, newsletter, newsletters, subscribe, popup, exit popup, exit intent, subscribers, subscription, popover, lightbox, analytics, collect email, optin, optin form, optin forms, double optin, list builder, email form, lead, leads, mailchimp, mailchimp form, mailchimp newsletter, mailchimp plugin, mailchimp signup, mailchimp signup forms, mailchimp signup form, mailchimp widget, mailchimp subscribe, constant contact, contact contact form, constant contact newsletter, constant contact plugin, constant contact signup, constant contact signup forms, constant contact signup form, constant contact widget, constant contact subscribe, aweber, aweber form, aweber forms, aweber signup form, aweber plugin
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
+ Stable tag: 3.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
163
 
164
  == Changelog ==
165
 
166
+ = 3.0.2 =
167
+ * SEO plugins can be used with landing pages
168
+ * Landing pages can be set as home page
169
+
170
  = 3.0.0 =
171
  * Landing pages
172