Version Description
Download this release
Release Info
Developer | mailmunch |
Plugin | MailMunch – Grow your Email List |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- inc/mailmunchapi.php +11 -1
- mailmunch.php +31 -82
- readme.txt +2 -2
inc/mailmunchapi.php
CHANGED
@@ -25,6 +25,16 @@
|
|
25 |
return $this->ping('/sites/'.$site_id.'/widgets');
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
function hasSite() {
|
29 |
$request = $this->sites();
|
30 |
$sites = $request->body;
|
@@ -79,7 +89,7 @@
|
|
79 |
function ping($path, $options=array(), $skipAuth=false) {
|
80 |
$auth = array('auth' => array($this->email, $this->password));
|
81 |
$type = $this->requestType;
|
82 |
-
if ($type
|
83 |
$request = Requests::$type($this->base_url. $path, $this->headers, $skipAuth ? $options : array_merge($options, $auth));
|
84 |
}
|
85 |
else {
|
25 |
return $this->ping('/sites/'.$site_id.'/widgets');
|
26 |
}
|
27 |
|
28 |
+
function getWidgetsHtml($site_id) {
|
29 |
+
$this->requestType = 'get';
|
30 |
+
return $this->ping('/sites/'.$site_id.'/widgets/wordpress');
|
31 |
+
}
|
32 |
+
|
33 |
+
function deleteWidget($site_id, $widget_id) {
|
34 |
+
$this->requestType = 'delete';
|
35 |
+
return $this->ping('/sites/'.$site_id.'/widgets/'.$widget_id);
|
36 |
+
}
|
37 |
+
|
38 |
function hasSite() {
|
39 |
$request = $this->sites();
|
40 |
$sites = $request->body;
|
89 |
function ping($path, $options=array(), $skipAuth=false) {
|
90 |
$auth = array('auth' => array($this->email, $this->password));
|
91 |
$type = $this->requestType;
|
92 |
+
if ($type != 'post') {
|
93 |
$request = Requests::$type($this->base_url. $path, $this->headers, $skipAuth ? $options : array_merge($options, $auth));
|
94 |
}
|
95 |
else {
|
mailmunch.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MailMunch
|
4 |
Plugin URI: http://www.mailmunch.co
|
5 |
Description: Collect email addresses from website visitors and grow your subscribers with our attention grabbing optin-forms, entry/exit intent technology, and other effective lead-generation forms.
|
6 |
-
Version: 1.
|
7 |
Author: MailMunch
|
8 |
Author URI: http://www.mailmunch.co
|
9 |
License: GPL2
|
@@ -13,7 +13,7 @@
|
|
13 |
require_once( plugin_dir_path( __FILE__ ) . 'inc/common.php' );
|
14 |
|
15 |
define( 'MAILMUNCH_SLUG', "mailmunch");
|
16 |
-
define( 'MAILMUNCH_VER', "1.
|
17 |
define( 'MAILMUNCH_URL', "www.mailmunch.co");
|
18 |
|
19 |
// Adding Admin Menu
|
@@ -44,6 +44,16 @@
|
|
44 |
if (!$mailmunch_data["script_src"]) return;
|
45 |
|
46 |
echo "<script type='text/javascript'>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
echo "(function(){ setTimeout(function(){ var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '".$mailmunch_data["script_src"]."'; f.parentNode.insertBefore(s, f); }, 1); })();";
|
48 |
echo "</script>";
|
49 |
}
|
@@ -78,6 +88,7 @@
|
|
78 |
$post_action = $_POST["action"];
|
79 |
|
80 |
if ($post_action == "save_settings") {
|
|
|
81 |
$mailmunch_data = array_merge(unserialize(get_option('mailmunch_data')), $post_data);
|
82 |
update_option("mailmunch_data", serialize($mailmunch_data));
|
83 |
} else if ($post_action == "sign_in") {
|
@@ -86,13 +97,26 @@
|
|
86 |
update_option("mailmunch_user_email", $_POST["email"]);
|
87 |
update_option("mailmunch_user_password", $_POST["password"]);
|
88 |
}
|
|
|
89 |
} else if ($post_action == "unlink_account") {
|
|
|
90 |
$mailmunch_data = array();
|
91 |
$mailmunch_data["site_url"] = home_url();
|
92 |
$mailmunch_data["site_name"] = get_bloginfo();
|
93 |
update_option("mailmunch_data", serialize($mailmunch_data));
|
94 |
delete_option("mailmunch_user_email", "");
|
95 |
delete_option("mailmunch_user_password", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
}
|
98 |
|
@@ -203,85 +227,10 @@
|
|
203 |
}
|
204 |
}
|
205 |
|
206 |
-
$request = $mm->
|
207 |
-
$widgets =
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
if (sizeof($widgets) > 0) {
|
212 |
-
?>
|
213 |
-
<div class="container">
|
214 |
-
<div class="page-header">
|
215 |
-
<h1 class="pull-left">Optin Forms</h1>
|
216 |
-
|
217 |
-
<div class="pull-right action-btns">
|
218 |
-
<form id="unlink-account" class="pull-left" action="" method="POST" onsubmit="return confirm('Are you sure you want to switch to another MailMunch account?')">
|
219 |
-
<input type="hidden" name="action" value="unlink_account" />
|
220 |
-
<input type="submit" value="Switch Account" class="unlink-btn" />
|
221 |
-
</form>
|
222 |
-
|
223 |
-
<a class="btn btn-success btn-sm new-optin-btn" href="http://<?php echo MAILMUNCH_URL; ?>/sso?email=<?php echo $mailmunch_email; ?>&password=<?php echo $mailmunch_password; ?>&next_url=<?php echo urlencode("/sites/".$mailmunch_data["site_id"]."/widgets/new?wordpress=1"); ?>" target="_mailmunch_window">New Optin Form</a>
|
224 |
-
</div>
|
225 |
-
<div class="clearfix"></div>
|
226 |
-
</div>
|
227 |
-
|
228 |
-
<table class="table table-condensed" style="margin-top: 20px;">
|
229 |
-
<thead>
|
230 |
-
<tr>
|
231 |
-
<th>Name</th>
|
232 |
-
<th>Exit Intent</th>
|
233 |
-
<th>Loading Delay</th>
|
234 |
-
<th>Status</th>
|
235 |
-
</tr>
|
236 |
-
</thead>
|
237 |
-
<tbody>
|
238 |
-
<?php foreach ($widgets as $widget) { ?>
|
239 |
-
<tr id="widget_<?php echo $widget->id ?>">
|
240 |
-
<td><?php echo $widget->name ?></td>
|
241 |
-
<td><?php if ($widget->exit_intent) { echo "Yes"; } else { echo "No"; } ?></td>
|
242 |
-
<td><?php if ($widget->loading_delay) { echo $widget->loading_delay; } else { echo "0"; } ?> seconds</td>
|
243 |
-
<td>
|
244 |
-
<?php if (widget.enabled) { ?>
|
245 |
-
<span class="label label-success">Active</span>
|
246 |
-
<?php } else { ?>
|
247 |
-
<span class="label label-danger">Inactive</span>
|
248 |
-
<?php } ?>
|
249 |
-
</td>
|
250 |
-
<td class="actions">
|
251 |
-
<div class="btn-group">
|
252 |
-
<a href="http://<?php echo MAILMUNCH_URL; ?>/sso?email=<?php echo $mailmunch_email; ?>&password=<?php echo $mailmunch_password; ?>&next_url=<?php echo urlencode("/sites/".$mailmunch_data["site_id"]."/widgets/".$widget->id."/design?wp_layout=1"); ?>" target="_mailmunch_window" class="btn btn-info btn-sm">Edit Optin Form</a>
|
253 |
-
</div>
|
254 |
-
</td>
|
255 |
-
</tr>
|
256 |
-
<?php } ?>
|
257 |
-
</tbody>
|
258 |
-
</table>
|
259 |
-
</div>
|
260 |
-
<?php
|
261 |
-
} else {
|
262 |
-
?>
|
263 |
-
<div class="container">
|
264 |
-
<div class="page-header">
|
265 |
-
<h1 class="pull-left">Optin Forms</h1>
|
266 |
-
|
267 |
-
<div class="pull-right">
|
268 |
-
<form id="unlink-account" action="" method="POST" onsubmit="return confirm('Are you sure you want to switch to another MailMunch account?')">
|
269 |
-
<input type="hidden" name="action" value="unlink_account" />
|
270 |
-
<input type="submit" value="Switch MailMunch Account" class="unlink-btn" />
|
271 |
-
</form>
|
272 |
-
</div>
|
273 |
-
<div class="clearfix"></div>
|
274 |
-
</div>
|
275 |
-
|
276 |
-
<div class="alert alert-warning alert-dismissable text-center">
|
277 |
-
<strong>Almost There!</strong> You have no Optin Forms yet. Click the button below to create your first one.
|
278 |
-
</div>
|
279 |
-
|
280 |
-
<div class="text-center">
|
281 |
-
<a href="http://<?php echo MAILMUNCH_URL; ?>/sso?email=<?php echo $mailmunch_email; ?>&password=<?php echo $mailmunch_password; ?>&next_url=<?php echo urlencode("/sites/".$mailmunch_data["site_id"]."/widgets/new?wordpress=1"); ?>" target="_mailmunch_window" class="btn btn-success btn-lg">Create Your First Optin Form</a>
|
282 |
-
</div>
|
283 |
-
</div>
|
284 |
-
<?php
|
285 |
-
}
|
286 |
}
|
287 |
?>
|
3 |
Plugin Name: MailMunch
|
4 |
Plugin URI: http://www.mailmunch.co
|
5 |
Description: Collect email addresses from website visitors and grow your subscribers with our attention grabbing optin-forms, entry/exit intent technology, and other effective lead-generation forms.
|
6 |
+
Version: 1.3
|
7 |
Author: MailMunch
|
8 |
Author URI: http://www.mailmunch.co
|
9 |
License: GPL2
|
13 |
require_once( plugin_dir_path( __FILE__ ) . 'inc/common.php' );
|
14 |
|
15 |
define( 'MAILMUNCH_SLUG', "mailmunch");
|
16 |
+
define( 'MAILMUNCH_VER', "1.3");
|
17 |
define( 'MAILMUNCH_URL', "www.mailmunch.co");
|
18 |
|
19 |
// Adding Admin Menu
|
44 |
if (!$mailmunch_data["script_src"]) return;
|
45 |
|
46 |
echo "<script type='text/javascript'>";
|
47 |
+
echo "var _mmunch = {'front': false, 'page': false, 'post': false, 'category': false, 'author': false, 'search': false, 'attachment': false, 'tag': false};";
|
48 |
+
if (is_front_page() || is_home()) { echo "_mmunch['front'] = true;"; }
|
49 |
+
if (is_page()) { echo "_mmunch['page'] = true;"; }
|
50 |
+
if (is_single()) { echo "_mmunch['post'] = true; _mmunch['postCategories'] = '".json_encode(get_the_category())."';"; }
|
51 |
+
if (is_category()) { echo "_mmunch['category'] = true; _mmunch['categoryData'] = '".json_encode(get_category(get_query_var('cat')))."';"; }
|
52 |
+
if (is_search()) { echo "_mmunch['search'] = true;"; }
|
53 |
+
if (is_author()) { echo "_mmunch['author'] = true;"; }
|
54 |
+
if (is_tag()) { echo "_mmunch['tag'] = true;"; }
|
55 |
+
if (is_attachment()) { echo "_mmunch['attachment'] = true;"; }
|
56 |
+
|
57 |
echo "(function(){ setTimeout(function(){ var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '".$mailmunch_data["script_src"]."'; f.parentNode.insertBefore(s, f); }, 1); })();";
|
58 |
echo "</script>";
|
59 |
}
|
88 |
$post_action = $_POST["action"];
|
89 |
|
90 |
if ($post_action == "save_settings") {
|
91 |
+
|
92 |
$mailmunch_data = array_merge(unserialize(get_option('mailmunch_data')), $post_data);
|
93 |
update_option("mailmunch_data", serialize($mailmunch_data));
|
94 |
} else if ($post_action == "sign_in") {
|
97 |
update_option("mailmunch_user_email", $_POST["email"]);
|
98 |
update_option("mailmunch_user_password", $_POST["password"]);
|
99 |
}
|
100 |
+
|
101 |
} else if ($post_action == "unlink_account") {
|
102 |
+
|
103 |
$mailmunch_data = array();
|
104 |
$mailmunch_data["site_url"] = home_url();
|
105 |
$mailmunch_data["site_name"] = get_bloginfo();
|
106 |
update_option("mailmunch_data", serialize($mailmunch_data));
|
107 |
delete_option("mailmunch_user_email", "");
|
108 |
delete_option("mailmunch_user_password", "");
|
109 |
+
|
110 |
+
} else if ($post_action == "delete_widget") {
|
111 |
+
|
112 |
+
if ($_POST["site_id"] && $_POST["widget_id"]) {
|
113 |
+
$account_info = getEmailPassword();
|
114 |
+
$mailmunch_email = $account_info['email'];
|
115 |
+
$mailmunch_password = $account_info['password'];
|
116 |
+
$mm = new MailmunchApi($account_info['email'], $account_info["password"], "http://".MAILMUNCH_URL);
|
117 |
+
$request = $mm->deleteWidget($_POST["site_id"], $_POST["widget_id"]);
|
118 |
+
}
|
119 |
+
|
120 |
}
|
121 |
}
|
122 |
|
227 |
}
|
228 |
}
|
229 |
|
230 |
+
$request = $mm->getWidgetsHtml($mailmunch_data["site_id"]);
|
231 |
+
$widgets = $request->body;
|
232 |
+
$widgets = str_replace("{{EMAIL}}", $mailmunch_email, $widgets);
|
233 |
+
$widgets = str_replace("{{PASSWORD}}", $mailmunch_password, $widgets);
|
234 |
+
echo $widgets;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
?>
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== MailMunch - Increase your Email Subscribers by over 500% ===
|
2 |
Contributors: mailmunch
|
3 |
-
Tags: widget, MailChimp, newsletter, newsletters, MailChimp plugin, Aweber,subscribe, popup, exit popup, exit intent, growth, subscribers, subscription, hellobar, email, posts, sharing, links, popover, analytics , newsletter, automatic , mail, lightbox, analytics, newsletter, getresponse, collect email, optin, optin forms, double optin, popover, optin monster,
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.9
|
6 |
-
Stable tag:
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
1 |
=== MailMunch - Increase your Email Subscribers by over 500% ===
|
2 |
Contributors: mailmunch
|
3 |
+
Tags: widget, MailChimp, newsletter, newsletters, MailChimp plugin, Aweber,subscribe, popup, exit popup, exit intent, growth, subscribers, subscription, hellobar, email, posts, sharing, links, popover, analytics , newsletter, automatic , mail, lightbox, analytics, newsletter, getresponse, collect email, optin, optin forms, double optin, popover, optin monster, popup domination, sumome, list builder, popupdomination
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.9
|
6 |
+
Stable tag: 1.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|