-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-mailup.php
201 lines (178 loc) · 6.61 KB
/
wp-mailup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
/**
* @package WP-MailUp
*/
/*
Plugin name: WP-MailUp
Plugin URI: http://wordpress.org/extend/plugins/wp-mailup/
Description: Wordpress plugin for MailUp email marketing system.
Version: 1.4.0
Author: MailUp and N. I. Biz Soft Solutions
Author URI: http://www.mailup.com/
License: GPLv2
*/
/* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
global $wpdb, $wpmailup, $mailup_path;
/*
Admin menu
*/
require_once(dirname(__FILE__).'/ajax.functions.php');
function wpmailup_admin_menu()
{
$page_title = 'MailUp Pluging Settings';
$menu_title = 'WP MailUp';
$capability = 'manage_options';
$menu_slug = 'wp-mailup-settings';
$function = 'wp_mailup_admin';
$position = '';
/* Add Option page submenu */
$parent_slug = 'options-general.php';
$page = add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function);
add_action( 'admin_print_styles-' . $page, create_function('', 'wp_enqueue_style( "mailUpStylesheet" );') );
}
add_action('admin_menu', 'wpmailup_admin_menu');
function wp_mailup_admin()
{
global $wpmailup, $mailup_path;
/*
some admin page settings
*/
$text_field_size = 35;
$text_field_maxlength = 80;
include(dirname(__FILE__).'/display-setting.php');
}
function wpmailup_init()
{
global $wpmailup, $mailup_path;
define('WPMAILUP', 'wpmailup');
$wpmailup = array();
$mailup_path = WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__));
wp_register_style( 'mailUpStylesheet', $mailup_path . 'mailup.css' );
/*
Load jquery from Google's CDN
*/
if (!is_admin()) {
/*wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://code.jquery.com/jquery-1.6.1.js');*/
wp_enqueue_script( 'jquery' );
}
/*
Load language file
*/
if(!load_plugin_textdomain('/wp-content/languages/')) {
load_plugin_textdomain('/wp-content/plugins/wp-mailup/languages/');
}
}
add_action('init', 'wpmailup_init');
/* add_action('wp_head', create_function('', 'wp_enqueue_style( "mailUpStylesheet" );')); */
/*
MailUp widget
*/
class WPMailUp_Widget extends WP_Widget {
function WPMailUp_Widget() {
// widget actual processes
parent::WP_Widget(false, $name = 'WP MailUp');
}
function form($instance) {
// outputs the options form on admin
$title = esc_attr($instance['title']);
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<?php
}
function update($new_instance, $old_instance) {
// processes widget options to be saved
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function widget($args, $instance) {
// outputs the content of the widget
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
include(dirname(__FILE__).'/display-widget.php');
echo $after_widget;
}
}
add_action('widgets_init', create_function('', 'return register_widget("WPMailUp_Widget");'));
function wpmailup_active()
{
$wpmailup['consoleHost'] = '';
$wpmailup['subscribePath'] = '/frontend/xmlSubscribe.aspx';
$wpmailup['pluginTitle'] = _('Newsletter subscription');
$wpmailup['pluginDescription'] = _('Our monthly newsletter with a selection of the best posts');
//$wpmailup['externalCss'] = $_REQUEST['external-css'];
$wpmailup['cssCombination'] = 'style1';
$wpmailup['submitButton'] = 'SIGN UP';
$wpmailup['requestConfirm'] = 'yes';
$wpmailup['textInside'] = '';
$wpmailup['requestConfirm'] = '';
$wpmailup['listId'] = 1;
$wpmailup['listDisplayedName'] = 'Newsletter subscribers';
$wpmailup['groupId'] = '';
$wpmailup['emailShow'] = 'yes';
$wpmailup['emailRequired'] = 'yes';
$wpmailup['emailFieldcode'] = 'Email';
$wpmailup['emailDisplayedName'] = _('Email');
$wpmailup['dateShow'] = '';
$wpmailup['dateRequired'] = '';
$wpmailup['dateFieldcode'] = 'Campo6';
$wpmailup['dateDisplayedName'] = '';
$wpmailup['extfield1Show'] = 'yes';
$wpmailup['extfield1Required'] = 'yes';
$wpmailup['extfield1Fieldcode'] = 'Campo1';
$wpmailup['extfield1DisplayedName'] = 'Name';
$wpmailup['extfield2Show'] = 'yes';
$wpmailup['extfield2Required'] = 'yes';
$wpmailup['extfield2Fieldcode'] = 'Campo2';
$wpmailup['extfield2DisplayedName'] = 'Last name';
$wpmailup['extfield3Show'] = '';
$wpmailup['extfield3Required'] = '';
$wpmailup['extfield3Fieldcode'] = 'Campo3';
$wpmailup['extfield3DisplayedName'] = '';
$wpmailup['extfield4Show'] = '';
$wpmailup['extfield4Required'] = '';
$wpmailup['extfield4Fieldcode'] = 'Campo4';
$wpmailup['extfield4DisplayedName'] = '';
$wpmailup['extfield5Show'] = '';
$wpmailup['extfield5Required'] = '';
$wpmailup['extfield5Fieldcode'] = 'Campo5';
$wpmailup['extfield5DisplayedName'] = '';
$wpmailup['mobileShow'] = 'yes';
$wpmailup['mobileRequired'] = 'yes';
$wpmailup['mobileFieldcode'] = 'sms';
$wpmailup['mobileDisplayedName'] = _('Mobile number');
$wpmailup['successMessage'] = _('Operation completed');
$wpmailup['genericError'] = _('Generic error');
$wpmailup['invalidAddress'] = _('Invalid email address');
$wpmailup['invalidPhone'] = _('Invalid mobile phone number');
$wpmailup['alreadyPresent'] = _('Already a subscriber!');
$wpmailup['fieldRequired'] = _('is required');
$wpmailup['termsNotAgreed'] = _('Please agree to the terms');
$wpmailup['termsConfirm'] = '';
$wpmailup['termsNcon'] = '';
$wpmailup['acceptanceMsg'] = _('I accept terms and conditions.');
add_option('wpmailup', serialize($wpmailup));
}
register_activation_hook(__FILE__, 'wpmailup_active');
function wpmailup_deactive()
{
delete_option('wpmailup');
}
register_deactivation_hook(__FILE__, 'wpmailup_deactive');
?>