WP Maintenance Mode / Coming Soon Page Builder - Version 2.0

Version Description

Download this release

Release Info

Developer Muneeb
Plugin Icon 128x128 WP Maintenance Mode / Coming Soon Page Builder
Version 2.0
Comparing to
See all releases

Code changes from version 1.0 to 2.0

images/alissa-1.png ADDED
Binary file
includes/classes/class-wpmmp-settings.php CHANGED
@@ -95,7 +95,7 @@ class Wpmmp_Settings {
95
  'ajax_url' => admin_url( 'admin-ajax.php' )
96
  );
97
 
98
- wp_localize_script( 'wpmmp-settings', 'wpmmpjs', $translation_array );
99
 
100
  }
101
 
95
  'ajax_url' => admin_url( 'admin-ajax.php' )
96
  );
97
 
98
+ wp_localize_script( 'wpmp-settings', 'wpmmpjs', $translation_array );
99
 
100
  }
101
 
includes/classes/class-wpmmp-theme-handler.php CHANGED
@@ -12,6 +12,12 @@ class Wpmmp_Theme_Handler {
12
 
13
  protected $template_name;
14
 
 
 
 
 
 
 
15
  function __construct() {
16
 
17
  $this->_hooks();
@@ -46,15 +52,24 @@ class Wpmmp_Theme_Handler {
46
 
47
  add_filter( 'wpmmp_themes', array( $this, 'register_theme' ) );
48
 
 
 
 
 
49
  if ( $this->is_activated() && $this->check_rules() )
50
  $this->theme_change();
51
 
 
 
 
52
  }
53
 
54
  private function _hooks() {
55
 
56
  if ( $this->is_activated() )
57
  add_action( 'wpmmp_current_theme_settings', array( $this, 'theme_settings' ) );
 
 
58
 
59
  }
60
 
@@ -130,7 +145,8 @@ class Wpmmp_Theme_Handler {
130
 
131
  function theme_change() {
132
 
133
- if ( is_admin() || current_user_can( 'manage_options' ) )
 
134
  return FALSE;
135
 
136
  add_action( 'template_redirect', array( $this, 'template_hook' ) );
@@ -149,6 +165,8 @@ class Wpmmp_Theme_Handler {
149
 
150
  $settings = wpmmp_get_settings();
151
 
 
 
152
  if ( $settings['feed'] == 'enabled' )
153
  $this->disable_feed();
154
 
@@ -191,5 +209,39 @@ class Wpmmp_Theme_Handler {
191
  wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
192
 
193
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
  }
12
 
13
  protected $template_name;
14
 
15
+ protected $settings_page;
16
+
17
+ protected $settings_page_title;
18
+
19
+ protected $settings_page_slug;
20
+
21
  function __construct() {
22
 
23
  $this->_hooks();
52
 
53
  add_filter( 'wpmmp_themes', array( $this, 'register_theme' ) );
54
 
55
+ add_filter( 'wpmmp_settings_get_tab', array( $this, 'settings_get_tab' ) );
56
+
57
+ add_filter( 'wpmmp_settings', array( $this, 'filter_settings' ) );
58
+
59
  if ( $this->is_activated() && $this->check_rules() )
60
  $this->theme_change();
61
 
62
+
63
+ if ( $this->settings_page )
64
+ add_filter( 'wpmmp_settings_tabs', array( $this, 'add_settings_tab' ) );
65
  }
66
 
67
  private function _hooks() {
68
 
69
  if ( $this->is_activated() )
70
  add_action( 'wpmmp_current_theme_settings', array( $this, 'theme_settings' ) );
71
+
72
+ add_action( 'wpmmp_save_settings', array( $this, 'save_settings' ) );
73
 
74
  }
75
 
145
 
146
  function theme_change() {
147
 
148
+ if ( is_admin() || current_user_can( 'manage_options' )
149
+ && ! defined( 'WPMMP_DEBUG_MODE' ) )
150
  return FALSE;
151
 
152
  add_action( 'template_redirect', array( $this, 'template_hook' ) );
165
 
166
  $settings = wpmmp_get_settings();
167
 
168
+ $theme_settings = $this->get_settings();
169
+
170
  if ( $settings['feed'] == 'enabled' )
171
  $this->disable_feed();
172
 
209
  wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
210
 
211
  }
212
+
213
+ function add_settings_tab( $tabs ) {
214
+
215
+ $slug = $this->settings_page_slug;
216
+
217
+ $title = $this->settings_page_title;
218
+
219
+ $tabs[$slug] = $title;
220
+
221
+ return $tabs;
222
+ }
223
+
224
+ function settings_get_tab( $tab ) {
225
+
226
+ if ( ! isset( $_GET['tab'] ) )
227
+ return $tab;
228
+
229
+ if ( $this->settings_page && $_GET['tab'] == $this->settings_page_slug ) {
230
+ return dirname( $this->path ) . '/settings-page-view.php';
231
+ }
232
+
233
+ return $tab;
234
+ }
235
+
236
+ function save_settings($tab){}
237
+ function get_settings() { return array(); }
238
+
239
+ function filter_settings( $settings ) {
240
+
241
+ $settings[$this->id] = $this->get_settings();
242
+
243
+ return $settings;
244
+
245
+ }
246
 
247
  }
includes/functions.php CHANGED
@@ -23,7 +23,6 @@ function load_wpmmp_classes() {
23
  wpmmp_include( 'classes/class-wpmmp-theme-handler.php' );
24
  wpmmp_include( 'classes/class-wpmmp-default-theme.php' );
25
 
26
-
27
  new Wpmmp_Settings();
28
 
29
  add_action( 'plugins_loaded', 'wpmmp_when_plugins_loaded' );
23
  wpmmp_include( 'classes/class-wpmmp-theme-handler.php' );
24
  wpmmp_include( 'classes/class-wpmmp-default-theme.php' );
25
 
 
26
  new Wpmmp_Settings();
27
 
28
  add_action( 'plugins_loaded', 'wpmmp_when_plugins_loaded' );
includes/libs/MCAPI.class.php ADDED
@@ -0,0 +1,2907 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wpmmp_MCAPI {
4
+ var $version = "1.3";
5
+ var $errorMessage;
6
+ var $errorCode;
7
+
8
+ /**
9
+ * Cache the information on the API location on the server
10
+ */
11
+ var $apiUrl;
12
+
13
+ /**
14
+ * Default to a 300 second timeout on server calls
15
+ */
16
+ var $timeout = 300;
17
+
18
+ /**
19
+ * Default to a 8K chunk size
20
+ */
21
+ var $chunkSize = 8192;
22
+
23
+ /**
24
+ * Cache the user api_key so we only have to log in once per client instantiation
25
+ */
26
+ var $api_key;
27
+
28
+ /**
29
+ * Cache the user api_key so we only have to log in once per client instantiation
30
+ */
31
+ var $secure = false;
32
+
33
+ /**
34
+ * Connect to the MailChimp API for a given list.
35
+ *
36
+ * @param string $apikey Your MailChimp apikey
37
+ * @param string $secure Whether or not this should use a secure connection
38
+ */
39
+ function Wpmmp_MCAPI($apikey, $secure=false) {
40
+ $this->secure = $secure;
41
+ $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
42
+ $this->api_key = $apikey;
43
+ }
44
+ function setTimeout($seconds){
45
+ if (is_int($seconds)){
46
+ $this->timeout = $seconds;
47
+ return true;
48
+ }
49
+ }
50
+ function getTimeout(){
51
+ return $this->timeout;
52
+ }
53
+ function useSecure($val){
54
+ if ($val===true){
55
+ $this->secure = true;
56
+ } else {
57
+ $this->secure = false;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Unschedule a campaign that is scheduled to be sent in the future
63
+ *
64
+ * @section Campaign Related
65
+ * @example mcapi_campaignUnschedule.php
66
+ * @example xml-rpc_campaignUnschedule.php
67
+ *
68
+ * @param string $cid the id of the campaign to unschedule
69
+ * @return boolean true on success
70
+ */
71
+ function campaignUnschedule($cid) {
72
+ $params = array();
73
+ $params["cid"] = $cid;
74
+ return $this->callServer("campaignUnschedule", $params);
75
+ }
76
+
77
+ /**
78
+ * Schedule a campaign to be sent in the future
79
+ *
80
+ * @section Campaign Related
81
+ * @example mcapi_campaignSchedule.php
82
+ * @example xml-rpc_campaignSchedule.php
83
+ *
84
+ * @param string $cid the id of the campaign to schedule
85
+ * @param string $schedule_time the time to schedule the campaign. For A/B Split "schedule" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
86
+ * @param string $schedule_time_b optional -the time to schedule Group B of an A/B Split "schedule" campaign - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
87
+ * @return boolean true on success
88
+ */
89
+ function campaignSchedule($cid, $schedule_time, $schedule_time_b=NULL) {
90
+ $params = array();
91
+ $params["cid"] = $cid;
92
+ $params["schedule_time"] = $schedule_time;
93
+ $params["schedule_time_b"] = $schedule_time_b;
94
+ return $this->callServer("campaignSchedule", $params);
95
+ }
96
+
97
+ /**
98
+ * Schedule a campaign to be sent in batches sometime in the future. Only valid for "regular" campaigns
99
+ *
100
+ * @section Campaign Related
101
+ *
102
+ * @param string $cid the id of the campaign to schedule
103
+ * @param string $schedule_time the time to schedule the campaign.
104
+ * @param string $num_batches optional - the number of batches between 2 and 26 to send. defaults to 2
105
+ * @param string $stagger_mins optional - the number of minutes between each batch - 5, 10, 15, 20, 25, 30, or 60. defaults to 5
106
+ * @return boolean true on success
107
+ */
108
+ function campaignScheduleBatch($cid, $schedule_time, $num_batches=2, $stagger_mins=5) {
109
+ $params = array();
110
+ $params["cid"] = $cid;
111
+ $params["schedule_time"] = $schedule_time;
112
+ $params["num_batches"] = $num_batches;
113
+ $params["stagger_mins"] = $stagger_mins;
114
+ return $this->callServer("campaignScheduleBatch", $params);
115
+ }
116
+
117
+ /**
118
+ * Resume sending an AutoResponder or RSS campaign
119
+ *
120
+ * @section Campaign Related
121
+ *
122
+ * @param string $cid the id of the campaign to pause
123
+ * @return boolean true on success
124
+ */
125
+ function campaignResume($cid) {
126
+ $params = array();
127
+ $params["cid"] = $cid;
128
+ return $this->callServer("campaignResume", $params);
129
+ }
130
+
131
+ /**
132
+ * Pause an AutoResponder or RSS campaign from sending
133
+ *
134
+ * @section Campaign Related
135
+ *
136
+ * @param string $cid the id of the campaign to pause
137
+ * @return boolean true on success
138
+ */
139
+ function campaignPause($cid) {
140
+ $params = array();
141
+ $params["cid"] = $cid;
142
+ return $this->callServer("campaignPause", $params);
143
+ }
144
+
145
+ /**
146
+ * Send a given campaign immediately. For RSS campaigns, this will "start" them.
147
+ *
148
+ * @section Campaign Related
149
+ *
150
+ * @example mcapi_campaignSendNow.php
151
+ * @example xml-rpc_campaignSendNow.php
152
+ *
153
+ * @param string $cid the id of the campaign to send
154
+ * @return boolean true on success
155
+ */
156
+ function campaignSendNow($cid) {
157
+ $params = array();
158
+ $params["cid"] = $cid;
159
+ return $this->callServer("campaignSendNow", $params);
160
+ }
161
+
162
+ /**
163
+ * Send a test of this campaign to the provided email address
164
+ *
165
+ * @section Campaign Related
166
+ *
167
+ * @example mcapi_campaignSendTest.php
168
+ * @example xml-rpc_campaignSendTest.php
169
+ *
170
+ * @param string $cid the id of the campaign to test
171
+ * @param array $test_emails an array of email address to receive the test message
172
+ * @param string $send_type optional by default (null) both formats are sent - "html" or "text" send just that format
173
+ * @return boolean true on success
174
+ */
175
+ function campaignSendTest($cid, $test_emails=array (
176
+ ), $send_type=NULL) {
177
+ $params = array();
178
+ $params["cid"] = $cid;
179
+ $params["test_emails"] = $test_emails;
180
+ $params["send_type"] = $send_type;
181
+ return $this->callServer("campaignSendTest", $params);
182
+ }
183
+
184
+ /**
185
+ * Allows one to test their segmentation rules before creating a campaign using them
186
+ *
187
+ * @section Campaign Related
188
+ * @example mcapi_campaignSegmentTest.php
189
+ * @example xml-rpc_campaignSegmentTest.php
190
+ *
191
+ * @param string $list_id the list to test segmentation on - get lists using lists()
192
+ * @param array $options with 2 keys:
193
+ string "match" controls whether to use AND or OR when applying your options - expects "<strong>any</strong>" (for OR) or "<strong>all</strong>" (for AND)
194
+ array "conditions" - up to 10 different criteria to apply while segmenting. Each criteria row must contain 3 keys - "<strong>field</strong>", "<strong>op</strong>", and "<strong>value</strong>" - and possibly a fourth, "<strong>extra</strong>", based on these definitions:
195
+
196
+ Field = "<strong>date</strong>" : Select based on signup date
197
+ Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
198
+ Valid Values:
199
+ string last_campaign_sent uses the date of the last campaign sent
200
+ string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns()
201
+ string YYYY-MM-DD - any date in the form of YYYY-MM-DD - <em>note:</em> anything that appears to start with YYYY will be treated as a date
202
+
203
+ Field = "<strong>last_changed</strong>" : Select based on subscriber record last changed date
204
+ Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
205
+ Valid Values:
206
+ string last_campaign_sent uses the date of the last campaign sent
207
+ string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns()
208
+ string YYYY-MM-DD - any date in the form of YYYY-MM-DD - <em>note:</em> anything that appears to start with YYYY will be treated as a date
209
+
210
+ Field = "<strong>interests-X</strong>": where X is the Grouping Id from listInterestGroupings()
211
+ Valid Op(erations): <strong>one</strong> / <strong>none</strong> / <strong>all</strong>
212
+ Valid Values: a comma delimited of interest groups for the list - see listInterestGroupings()
213
+
214
+ Field = "<strong>aim</strong>"
215
+ Valid Op(erations): <strong>open</strong> / <strong>noopen</strong> / <strong>click</strong> / <strong>noclick</strong>
216
+ Valid Values: "<strong>any</strong>" or a valid AIM-enabled Campaign that has been sent
217
+
218
+ Field = "<strong>rating</strong>" : allows matching based on list member ratings
219
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;)
220
+ Valid Values: a number between 0 and 5
221
+
222
+ Field = "<strong>ecomm_prod</strong>" or "<strong>ecomm_prod</strong>": allows matching product and category names from purchases
223
+ Valid Op(erations):
224
+ <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah')
225
+ Valid Values: any string
226
+
227
+ Field = "<strong>ecomm_spent_one</strong>" or "<strong>ecomm_spent_all</strong>" : allows matching purchase amounts on a single order or all orders
228
+ Valid Op(erations): <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;)
229
+ Valid Values: a number
230
+
231
+ Field = "<strong>ecomm_date</strong>" : allow matching based on order dates
232
+ Valid Op(eration): <strong>eq</strong> (is) / <strong>gt</strong> (after) / <strong>lt</strong> (before)
233
+ Valid Values:
234
+ string last_campaign_sent uses the date of the last campaign sent
235
+ string campaign_id - uses the send date of the campaign that carriers the Id submitted - see campaigns()
236
+ string YYYY-MM-DD - any date in the form of YYYY-MM-DD - <em>note:</em> anything that appears to start with YYYY will be treated as a date
237
+
238
+ Field = "<strong>social_gender</strong>" : allows matching against the gender acquired from SocialPro
239
+ Valid Op(eration): <strong>eq</strong> (is) / <strong>ne</strong> (is not)
240
+ Valid Values: male, female
241
+
242
+ Field = "<strong>social_age</strong>" : allows matching against the age acquired from SocialPro
243
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;)
244
+ Valid Values: any number
245
+
246
+ Field = "<strong>social_influence</strong>" : allows matching against the influence acquired from SocialPro
247
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;)
248
+ Valid Values: a number between 0 and 5
249
+
250
+ Field = "<strong>social_network</strong>" :
251
+ Valid Op(erations): <strong>member</strong> (is a member of) / <strong>notmember</strong> (is not a member of)
252
+ Valid Values: twitter, facebook, myspace, linkedin, flickr
253
+
254
+ Field = "<strong>static_segment</strong>" :
255
+ Valid Op(erations): <strong>eq</strong> (is in) / <strong>ne</strong> (is not in)
256
+ Valid Values: an int - get from listStaticSegments()
257
+
258
+ Field = "<strong>default_location</strong>" : the location we automatically assign to a subscriber based on where we've seen their activity originate
259
+ Valid Op(erations): <strong>ipgeostate</strong> (within a US state) / <strong>ipgeonotstate</strong> (not within a US state) / <strong>ipgeocountry</strong> (within a country) / <strong>ipgeonotcountry</strong> (not within a country) / <strong>ipgeoin</strong> (within lat/lng parameters) / <strong>ipgeonotin</strong> (not within lat/lng parameters)
260
+ Valid Values:
261
+ string ipgeostate/ipgeonotstate a full US state name (not case sensitive)
262
+ string ipgeocountry/ipgeonotcountry an ISO3166 2 digit country code (not case sensitive)
263
+ int ipgeoin/ipgeonotin a distance in miles centered around a point you must specify by also passing <strong>lat</strong> (latitude) and <strong>lng</strong> (longitude) parameters
264
+
265
+ Field = A <strong>Birthday</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Brithday fields can <strong>only</strong> use the operations listed here.
266
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>starts</strong> (month equals) / <strong>ends</strong> (day equals)
267
+ Valid Values: Any valid number for the operation being checked.
268
+
269
+ Field = A <strong>Zip</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Zip fields can <strong>only</strong> use the operations listed here.
270
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>geoin</strong> (US only)
271
+ Valid Values: For <strong>eq</strong> (=) / <strong>ne</strong>, a Zip Code. For <strong>geoin</strong>, a radius in miles
272
+ Extra Value: Only for <strong>geoin</strong> - the Zip Code to be used as the center point
273
+
274
+ Field = An <strong>Address</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Address fields can <strong>only</strong> use the operations listed here.
275
+ Valid Op(erations): <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>geoin</strong>
276
+ Valid Values: For <strong>like</strong> and <strong>nlike</strong>, a string. For <strong>geoin</strong>, a radius in miles
277
+ Extra Value: Only for <strong>geoin</strong> - the Zip Code to be used as the center point
278
+
279
+ Field = A <strong>Number</strong> type Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars(). Note, Number fields can <strong>only</strong> use the operations listed here.
280
+ Valid Op(erations): <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (>) / <strong>lt</strong> (<) /
281
+ Valid Values: Any valid number.
282
+
283
+ Default Field = A Merge Var. Use <strong>Merge0-Merge30</strong> or the <strong>Custom Tag</strong> you've setup for your merge field - see listMergeVars()
284
+ Valid Op(erations):
285
+ <strong>eq</strong> (=) / <strong>ne</strong> (!=) / <strong>gt</strong> (&gt;) / <strong>lt</strong> (&lt;) / <strong>like</strong> (like '%blah%') / <strong>nlike</strong> (not like '%blah%') / <strong>starts</strong> (like 'blah%') / <strong>ends</strong> (like '%blah')
286
+ Valid Values: any string
287
+ * @return int total The total number of subscribers matching your segmentation options
288
+ */
289
+ function campaignSegmentTest($list_id, $options) {
290
+ $params = array();
291
+ $params["list_id"] = $list_id;
292
+ $params["options"] = $options;
293
+ return $this->callServer("campaignSegmentTest", $params);
294
+ }
295
+
296
+ /**
297
+ * Create a new draft campaign to send. You <strong>can not</strong> have more than 32,000 campaigns in your account.
298
+ *
299
+ * @section Campaign Related
300
+ * @example mcapi_campaignCreate.php
301
+ * @example xml-rpc_campaignCreate.php
302
+ * @example xml-rpc_campaignCreateABSplit.php
303
+ * @example xml-rpc_campaignCreateRss.php
304
+ *
305
+ * @param string $type the Campaign Type to create - one of "regular", "plaintext", "absplit", "rss", "auto"
306
+ * @param array $options a hash of the standard options for this campaign :
307
+ string list_id the list to send this campaign to- get lists using lists()
308
+ string subject the subject line for your campaign message
309
+ string from_email the From: email address for your campaign message
310
+ string from_name the From: name for your campaign message (not an email address)
311
+ string to_name the To: name recipients will see (not email address)
312
+ int template_id optional - use this user-created template to generate the HTML content of the campaign (takes precendence over other template options)
313
+ int gallery_template_id optional - use a template from the public gallery to generate the HTML content of the campaign (takes precendence over base template options)
314
+ int base_template_id optional - use this a base/start-from-scratch template to generate the HTML content of the campaign
315
+ int folder_id optional - automatically file the new campaign in the folder_id passed. Get using folders() - note that Campaigns and Autoresponders have separate folder setupsn
316
+ array tracking optional - set which recipient actions will be tracked, as a struct of boolean values with the following keys: "opens", "html_clicks", and "text_clicks". By default, opens and HTML clicks will be tracked. Click tracking can not be disabled for Free accounts.
317
+ string title optional - an internal name to use for this campaign. By default, the campaign subject will be used.
318
+ boolean authenticate optional - set to true to enable SenderID, DomainKeys, and DKIM authentication, defaults to false.
319
+ array analytics optional - if provided, use a struct with "service type" as a key and the "service tag" as a value. Use "google" for Google Analytics, "clicktale" for ClickTale, and "gooal" for Goo.al tracking. The "tag" is any custom text (up to 50 characters) that should be included.
320
+ boolean auto_footer optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
321
+ boolean inline_css optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false.
322
+ boolean generate_text optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false.
323
+ boolean auto_tweet optional If set, this campaign will be auto-tweeted when it is sent - defaults to false. Note that if a Twitter account isn't linked, this will be silently ignored.
324
+ array auto_fb_post optional If set, this campaign will be auto-posted to the page_ids contained in the array. If a Facebook account isn't linked or the account does not have permission to post to the page_ids requested, those failures will be silently ignored.
325
+ boolean fb_comments optional If true, the Facebook comments (and thus the <a href="http://kb.mailchimp.com/article/i-dont-want-an-archiave-of-my-campaign-can-i-turn-it-off/" target="_blank">archive bar</a> will be displayed. If false, Facebook comments will not be enabled (does not imply no archive bar, see previous link). Defaults to "true".
326
+ boolean timewarp optional If set, this campaign must be scheduled 24 hours in advance of sending - default to false. Only valid for "regular" campaigns and "absplit" campaigns that split on schedule_time.
327
+ boolean ecomm360 optional If set, our <a href="http://www.mailchimp.com/blog/ecommerce-tracking-plugin/" target="_blank">Ecommerce360 tracking</a> will be enabled for links in the campaign
328
+ array crm_tracking optional If set, enable CRM tracking for:<div style="padding-left:15px"><table>
329
+ array salesforce optional Enable SalesForce push back<div style="padding-left:15px"><table>
330
+ bool campaign optional - if true, create a Campaign object and update it with aggregate stats
331
+ bool notes optional - if true, attempt to update Contact notes based on email address</table></div>
332
+ array highrise optional Enable SalesForce push back<div style="padding-left:15px"><table>
333
+ bool campaign optional - if true, create a Kase object and update it with aggregate stats
334
+ bool notes optional - if true, attempt to update Contact notes based on email address</table></div>
335
+ array capsule optional Enable Capsule push back (only notes are supported)<div style="padding-left:15px"><table>
336
+ bool notes optional - if true, attempt to update Contact notes based on email address</table></div></table></div>
337
+ * @param array $content the content for this campaign - use a struct with the following keys:
338
+ string html for pasted HTML content
339
+ string text for the plain-text version
340
+ string url to have us pull in content from a URL. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
341
+ string archive to send a Base64 encoded archive file for us to import all media from. Note, this will override any other content options - for lists with Email Format options, you'll need to turn on generate_text as well
342
+ string archive_type optional - only necessary for the "archive" option. Supported formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz . If not included, we will default to zip
343
+
344
+ If you chose a template instead of pasting in your HTML content, then use "html_" followed by the template sections as keys - for example, use a key of "html_MAIN" to fill in the "MAIN" section of a template.
345
+ * @param array $segment_opts optional - if you wish to do Segmentation with this campaign this array should contain: see campaignSegmentTest(). It's suggested that you test your options against campaignSegmentTest().
346
+ * @param array $type_opts optional -
347
+ For RSS Campaigns this, array should contain:
348
+ string url the URL to pull RSS content from - it will be verified and must exist
349
+ string schedule optional one of "daily", "weekly", "monthly" - defaults to "daily"
350
+ string schedule_hour optional an hour between 0 and 24 - default to 4 (4am <em>local time</em>) - applies to all schedule types
351
+ string schedule_weekday optional for "weekly" only, a number specifying the day of the week to send: 0 (Sunday) - 6 (Saturday) - defaults to 1 (Monday)
352
+ string schedule_monthday optional for "monthly" only, a number specifying the day of the month to send (1 - 28) or "last" for the last day of a given month. Defaults to the 1st day of the month
353
+ array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on
354
+ bool 1 optional Monday, defaults to true
355
+ bool 2 optional Tuesday, defaults to true
356
+ bool 3 optional Wednesday, defaults to true
357
+ bool 4 optional Thursday, defaults to true
358
+ bool 5 optional Friday, defaults to true
359
+ bool 6 optional Saturday, defaults to true
360
+ bool 7 optional Sunday, defaults to true
361
+
362
+ For A/B Split campaigns, this array should contain:
363
+ string split_test The values to segment based on. Currently, one of: "subject", "from_name", "schedule". NOTE, for "schedule", you will need to call campaignSchedule() separately!
364
+ string pick_winner How the winner will be picked, one of: "opens" (by the open_rate), "clicks" (by the click rate), "manual" (you pick manually)
365
+ int wait_units optional the default time unit to wait before auto-selecting a winner - use "3600" for hours, "86400" for days. Defaults to 86400.
366
+ int wait_time optional the number of units to wait before auto-selecting a winner - defaults to 1, so if not set, a winner will be selected after 1 Day.
367
+ int split_size optional this is a percentage of what size the Campaign's List plus any segmentation options results in. "schedule" type forces 50%, all others default to 10%
368
+ string from_name_a optional sort of, required when split_test is "from_name"
369
+ string from_name_b optional sort of, required when split_test is "from_name"
370
+ string from_email_a optional sort of, required when split_test is "from_name"
371
+ string from_email_b optional sort of, required when split_test is "from_name"
372
+ string subject_a optional sort of, required when split_test is "subject"
373
+ string subject_b optional sort of, required when split_test is "subject"
374
+
375
+ For AutoResponder campaigns, this array should contain:
376
+ string offset-units one of "hourly", "day", "week", "month", "year" - required
377
+ string offset-time optional, sort of - the number of units must be a number greater than 0 for signup based autoresponders, ignored for "hourly"
378
+ string offset-dir either "before" or "after", ignored for "hourly"
379
+ string event optional "signup" (default) to base this members added to a list, "date", "annual", or "birthday" to base this on merge field in the list, "campaignOpen" or "campaignClicka" to base this on any activity for a campaign, "campaignClicko" to base this on clicks on a specific URL in a campaign, "mergeChanged" to base this on a specific merge field being changed to a specific value
380
+ string event-datemerge optional sort of, this is required if the event is "date", "annual", "birthday", or "mergeChanged"
381
+ string campaign_id optional sort of, required for "campaignOpen", "campaignClicka", or "campaignClicko"
382
+ string campaign_url optional sort of, required for "campaignClicko"
383
+
384
+ int schedule_hour The hour of the day - 24 hour format in GMT - the autoresponder should be triggered, ignored for "hourly"
385
+ boolean use_import_time whether or not imported subscribers (ie, <em>any</em> non-double optin subscribers) will receive
386
+ array days optional used for "daily" schedules only, an array of the <a href="http://en.wikipedia.org/wiki/ISO-8601#Week_dates" target="_blank">ISO-8601 weekday numbers</a> to send on
387
+ bool 1 optional Monday, defaults to true
388
+ bool 2 optional Tuesday, defaults to true
389
+ bool 3 optional Wednesday, defaults to true
390
+ bool 4 optional Thursday, defaults to true
391
+ bool 5 optional Friday, defaults to true
392
+ bool 6 optional Saturday, defaults to true
393
+ bool 7 optional Sunday, defaults to true
394
+
395
+ *
396
+ * @return string the ID for the created campaign
397
+ */
398
+ function campaignCreate($type, $options, $content, $segment_opts=NULL, $type_opts=NULL) {
399
+ $params = array();
400
+ $params["type"] = $type;
401
+ $params["options"] = $options;
402
+ $params["content"] = $content;
403
+ $params["segment_opts"] = $segment_opts;
404
+ $params["type_opts"] = $type_opts;
405
+ return $this->callServer("campaignCreate", $params);
406
+ }
407
+
408
+ /** Update just about any setting for a campaign that has <em>not</em> been sent. See campaignCreate() for details.
409
+ *
410
+ *
411
+ * Caveats:<br/><ul class='simplelist square'>
412
+ * <li>If you set list_id, all segmentation options will be deleted and must be re-added.</li>
413
+ * <li>If you set template_id, you need to follow that up by setting it's 'content'</li>
414
+ * <li>If you set segment_opts, you should have tested your options against campaignSegmentTest() as campaignUpdate() will not allow you to set a segment that includes no members.</li>
415
+ * <li>To clear/unset segment_opts, pass an empty string or array as the value. Various wrappers may require one or the other.</li>
416
+ * </ul>
417
+ * @section Campaign Related
418
+ *
419
+ * @example mcapi_campaignUpdate.php
420
+ * @example mcapi_campaignUpdateAB.php
421
+ * @example xml-rpc_campaignUpdate.php
422
+ * @example xml-rpc_campaignUpdateAB.php
423
+ *
424
+ * @param string $cid the Campaign Id to update
425
+ * @param string $name the parameter name ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's name (subject, from_email, etc.). Additional parameters will be that option name (content, segment_opts). "type_opts" will be the name of the type - rss, auto, etc.
426
+ * @param mixed $value an appropriate value for the parameter ( see campaignCreate() ). For items in the <strong>options</strong> array, this will be that parameter's value. For additional parameters, this is the same value passed to them.
427
+ * @return boolean true if the update succeeds, otherwise an error will be thrown
428
+ */
429
+ function campaignUpdate($cid, $name, $value) {
430
+ $params = array();
431
+ $params["cid"] = $cid;
432
+ $params["name"] = $name;
433
+ $params["value"] = $value;
434
+ return $this->callServer("campaignUpdate", $params);
435
+ }
436
+
437
+ /** Replicate a campaign.
438
+ *
439
+ * @section Campaign Related
440
+ *
441
+ * @example mcapi_campaignReplicate.php
442
+ *
443
+ * @param string $cid the Campaign Id to replicate
444
+ * @return string the id of the replicated Campaign created, otherwise an error will be thrown
445
+ */
446
+ function campaignReplicate($cid) {
447
+ $params = array();
448
+ $params["cid"] = $cid;
449
+ return $this->callServer("campaignReplicate", $params);
450
+ }
451
+
452
+ /** Delete a campaign. Seriously, "poof, gone!" - be careful!
453
+ *
454
+ * @section Campaign Related
455
+ *
456
+ * @example mcapi_campaignDelete.php
457
+ *
458
+ * @param string $cid the Campaign Id to delete
459
+ * @return boolean true if the delete succeeds, otherwise an error will be thrown
460
+ */
461
+ function campaignDelete($cid) {
462
+ $params = array();
463
+ $params["cid"] = $cid;
464
+ return $this->callServer("campaignDelete", $params);
465
+ }
466
+
467
+ /**
468
+ * Get the list of campaigns and their details matching the specified filters
469
+ *
470
+ * @section Campaign Related
471
+ * @example mcapi_campaigns.php
472
+ * @example xml-rpc_campaigns.php
473
+ *
474
+ * @param array $filters a hash of filters to apply to this query - all are optional:
475
+ string campaign_id optional - return the campaign using a know campaign_id. Accepts multiples separated by commas when not using exact matching.
476
+ string parent_id optional - return the child campaigns using a know parent campaign_id. Accepts multiples separated by commas when not using exact matching.
477
+ string list_id optional - the list to send this campaign to- get lists using lists(). Accepts multiples separated by commas when not using exact matching.
478
+ int folder_id optional - only show campaigns from this folder id - get folders using campaignFolders(). Accepts multiples separated by commas when not using exact matching.
479
+ int template_id optional - only show campaigns using this template id - get templates using templates(). Accepts multiples separated by commas when not using exact matching.
480
+ string status optional - return campaigns of a specific status - one of "sent", "save", "paused", "schedule", "sending". Accepts multiples separated by commas when not using exact matching.
481
+ string type optional - return campaigns of a specific type - one of "regular", "plaintext", "absplit", "rss", "auto". Accepts multiples separated by commas when not using exact matching.
482
+ string from_name optional - only show campaigns that have this "From Name"
483
+ string from_email optional - only show campaigns that have this "Reply-to Email"
484
+ string title optional - only show campaigns that have this title
485
+ string subject optional - only show campaigns that have this subject
486
+ string sendtime_start optional - only show campaigns that have been sent since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
487
+ string sendtime_end optional - only show campaigns that have been sent before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
488
+ boolean uses_segment - whether to return just campaigns with or without segments
489
+ boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true. Using this disables the use of any filters that accept multiples.
490
+ * @param int $start optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)
491
+ * @param int $limit optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)
492
+ * @return array an array containing a count of all matching campaigns and the specific ones for the current page (see Returned Fields for description)
493
+ int total the total number of campaigns matching the filters passed in
494
+ array data the data for each campaign being returned
495
+ string id Campaign Id (used for all other campaign functions)
496
+ int web_id The Campaign id used in our web app, allows you to create a link directly to it
497
+ string list_id The List used for this campaign
498
+ int folder_id The Folder this campaign is in
499
+ int template_id The Template this campaign uses
500
+ string content_type How the campaign's content is put together - one of 'template', 'html', 'url'
501
+ string title Title of the campaign
502
+ string type The type of campaign this is (regular,plaintext,absplit,rss,inspection,auto)
503
+ string create_time Creation time for the campaign
504
+ string send_time Send time for the campaign - also the scheduled time for scheduled campaigns.
505
+ int emails_sent Number of emails email was sent to
506
+ string status Status of the given campaign (save,paused,schedule,sending,sent)
507
+ string from_name From name of the given campaign
508
+ string from_email Reply-to email of the given campaign
509
+ string subject Subject of the given campaign
510
+ string to_name Custom "To:" email string using merge variables
511
+ string archive_url Archive link for the given campaign
512
+ boolean inline_css Whether or not the campaign content's css was auto-inlined
513
+ string analytics Either "google" if enabled or "N" if disabled
514
+ string analytics_tag The name/tag the campaign's links were tagged with if analytics were enabled.
515
+ boolean authenticate Whether or not the campaign was authenticated
516
+ boolean ecomm360 Whether or not ecomm360 tracking was appended to links
517
+ boolean auto_tweet Whether or not the campaign was auto tweeted after sending
518
+ string auto_fb_post A comma delimited list of Facebook Profile/Page Ids the campaign was posted to after sending. If not used, blank.
519
+ boolean auto_footer Whether or not the auto_footer was manually turned on
520
+ boolean timewarp Whether or not the campaign used Timewarp
521
+ string timewarp_schedule The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array
522
+ string parent_id the unique id of the parent campaign (currently only valid for rss children)
523
+ array tracking the various tracking options used
524
+ boolean html_clicks whether or not tracking for html clicks was enabled.
525
+ boolean text_clicks whether or not tracking for text clicks was enabled.
526
+ boolean opens whether or not opens tracking was enabled.
527
+ string segment_text a string marked-up with HTML explaining the segment used for the campaign in plain English
528
+ array segment_opts the segment used for the campaign - can be passed to campaignSegmentTest() or campaignCreate()
529
+ array type_opts the type-specific options for the campaign - can be passed to campaignCreate()
530
+ */
531
+ function campaigns($filters=array (
532
+ ), $start=0, $limit=25) {
533
+ $params = array();
534
+ $params["filters"] = $filters;
535
+ $params["start"] = $start;
536
+ $params["limit"] = $limit;
537
+ return $this->callServer("campaigns", $params);
538
+ }
539
+
540
+ /**
541
+ * Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)
542
+ *
543
+ * @section Campaign Stats
544
+ *
545
+ * @example mcapi_campaignStats.php
546
+ * @example xml-rpc_campaignStats.php
547
+ *
548
+ * @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
549
+ * @return array struct of the statistics for this campaign
550
+ int syntax_errors Number of email addresses in campaign that had syntactical errors.
551
+ int hard_bounces Number of email addresses in campaign that hard bounced.
552
+ int soft_bounces Number of email addresses in campaign that soft bounced.
553
+ int unsubscribes Number of email addresses in campaign that unsubscribed.
554
+ int abuse_reports Number of email addresses in campaign that reported campaign for abuse.
555
+ int forwards Number of times email was forwarded to a friend.
556
+ int forwards_opens Number of times a forwarded email was opened.
557
+ int opens Number of times the campaign was opened.
558
+ string last_open Date of the last time the email was opened.
559
+ int unique_opens Number of people who opened the campaign.
560
+ int clicks Number of times a link in the campaign was clicked.
561
+ int unique_clicks Number of unique recipient/click pairs for the campaign.
562
+ string last_click Date of the last time a link in the email was clicked.
563
+ int users_who_clicked Number of unique recipients who clicked on a link in the campaign.
564
+ int emails_sent Number of email addresses campaign was sent to.
565
+ int unique_likes total number of unique likes (Facebook)
566
+ int recipient_likes total number of recipients who liked (Facebook) the campaign
567
+ int facebook_likes total number of likes (Facebook) that came from Facebook
568
+ array absplit If this was an absplit campaign, stats for the A and B groups will be returned
569
+ int bounces_a bounces for the A group
570
+ int bounces_b bounces for the B group
571
+ int forwards_a forwards for the A group
572
+ int forwards_b forwards for the B group
573
+ int abuse_reports_a abuse reports for the A group
574
+ int abuse_reports_b abuse reports for the B group
575
+ int unsubs_a unsubs for the A group
576
+ int unsubs_b unsubs for the B group
577
+ int recipients_click_a clicks for the A group
578
+ int recipients_click_b clicks for the B group
579
+ int forwards_opens_a opened forwards for the A group
580
+ int forwards_opens_b opened forwards for the B group
581
+ int opens_a total opens for the A group
582
+ int opens_b total opens for the B group
583
+ string last_open_a date/time of last open for the A group
584
+ string last_open_b date/time of last open for the BG group
585
+ int unique_opens_a unique opens for the A group
586
+ int unique_opens_b unique opens for the B group
587
+ array timewarp If this campaign was a Timewarp campaign, an array of stats from each timezone for it, with the GMT offset as they key. Each timezone will contain:
588
+ int opens opens for this timezone
589
+ string last_open the date/time of the last open for this timezone
590
+ int unique_opens the unique opens for this timezone
591
+ int clicks the total clicks for this timezone
592
+ string last_click the date/time of the last click for this timezone
593
+ int unique_opens the unique clicks for this timezone
594
+ int bounces the total bounces for this timezone
595
+ int total the total number of members sent to in this timezone
596
+ int sent the total number of members delivered to in this timezone
597
+ array timeseries For the first 24 hours of the campaign, per-hour stats:
598
+ string timestamp The timestemp in Y-m-d H:00:00 format
599
+ int emails_sent the total emails sent during the hour
600
+ int unique_opens unique opens seen during the hour
601
+ int recipients_click unique clicks seen during the hour
602
+
603
+ */
604
+ function campaignStats($cid) {
605
+ $params = array();
606
+ $params["cid"] = $cid;
607
+ return $this->callServer("campaignStats", $params);
608
+ }
609
+
610
+ /**
611
+ * Get an array of the urls being tracked, and their click counts for a given campaign
612
+ *
613
+ * @section Campaign Stats
614
+ *
615
+ * @example mcapi_campaignClickStats.php
616
+ * @example xml-rpc_campaignClickStats.php
617
+ *
618
+ * @param string $cid the campaign id to pull stats for (can be gathered using campaigns())
619
+ * @return array urls will be keys and contain their associated statistics:
620
+ int clicks Number of times the specific link was clicked
621
+ int unique Number of unique people who clicked on the specific link
622
+ */
623
+ function campaignClickStats($cid) {
624
+ $params = array();
625
+ $params["cid"] = $cid;
626
+ return $this->callServer("campaignClickStats", $params);
627
+ }
628
+
629
+ /**
630
+ * Get the top 5 performing email domains for this campaign. Users want more than 5 should use campaign campaignEmailStatsAIM()
631
+ * or campaignEmailStatsAIMAll() and generate any additional stats they require.
632
+ *
633
+ * @section Campaign Stats
634
+ *
635
+ * @example mcapi_campaignEmailDomainPerformance.php
636
+ *
637
+ * @param string $cid the campaign id to pull email domain performance for (can be gathered using campaigns())
638
+ * @return array domains email domains and their associated stats
639
+ string domain Domain name or special "Other" to roll-up stats past 5 domains
640
+ int total_sent Total Email across all domains - this will be the same in every row
641
+ int emails Number of emails sent to this domain
642
+ int bounces Number of bounces
643
+ int opens Number of opens
644
+ int clicks Number of clicks
645
+ int unsubs Number of unsubs
646
+ int delivered Number of deliveries
647
+ int emails_pct Percentage of emails that went to this domain (whole number)
648
+ int bounces_pct Percentage of bounces from this domain (whole number)
649
+ int opens_pct Percentage of opens from this domain (whole number)
650
+ int clicks_pct Percentage of clicks from this domain (whole number)
651
+ int unsubs_pct Percentage of unsubs from this domain (whole number)
652
+ */
653
+ function campaignEmailDomainPerformance($cid) {
654
+ $params = array();
655
+ $params["cid"] = $cid;
656
+ return $this->callServer("campaignEmailDomainPerformance", $params);
657
+ }
658
+
659
+ /**
660
+ * Get all email addresses the campaign was successfully sent to (ie, no bounces)
661
+ *
662
+ * @section Campaign Stats
663
+ *
664
+ * @param string $cid the campaign id to pull members for (can be gathered using campaigns())
665
+ * @param string $status optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned
666
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
667
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
668
+ * @return array a total of all matching emails and the specific emails for this page
669
+ int total the total number of members for the campaign and status
670
+ array data the full campaign member records
671
+ string email the email address sent to
672
+ string status the status of the send - one of 'sent', 'hard', 'soft'
673
+ string absplit_group if this was an absplit campaign, one of 'a','b', or 'winner'
674
+ string tz_group if this was an timewarp campaign the timezone GMT offset the member was included in
675
+ */
676
+ function campaignMembers($cid, $status=NULL, $start=0, $limit=1000) {
677
+ $params = array();
678
+ $params["cid"] = $cid;
679
+ $params["status"] = $status;
680
+ $params["start"] = $start;
681
+ $params["limit"] = $limit;
682
+ return $this->callServer("campaignMembers", $params);
683
+ }
684
+
685
+ /**
686
+ * <strong>DEPRECATED</strong> Get all email addresses with Hard Bounces for a given campaign
687
+ *
688
+ * @deprecated See campaignMembers() for a replacement
689
+ *
690
+ * @section Campaign Stats
691
+ *
692
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
693
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
694
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
695
+ * @return array a total of all hard bounced emails and the specific emails for this page
696
+ int total the total number of hard bounces for the campaign
697
+ array data array of the full email addresses that bounced
698
+ */
699
+ function campaignHardBounces($cid, $start=0, $limit=1000) {
700
+ $params = array();
701
+ $params["cid"] = $cid;
702
+ $params["start"] = $start;
703
+ $params["limit"] = $limit;
704
+ return $this->callServer("campaignHardBounces", $params);
705
+ }
706
+
707
+ /**
708
+ * <strong>DEPRECATED</strong> Get all email addresses with Soft Bounces for a given campaign
709
+ *
710
+ * @deprecated See campaignMembers() for a replacement
711
+ *
712
+ * @section Campaign Stats
713
+ *
714
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
715
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
716
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
717
+ * @return array a total of all soft bounced emails and the specific emails for this page
718
+ int total the total number of soft bounces for the campaign
719
+ array data array of the full email addresses that bounced
720
+ */
721
+ function campaignSoftBounces($cid, $start=0, $limit=1000) {
722
+ $params = array();
723
+ $params["cid"] = $cid;
724
+ $params["start"] = $start;
725
+ $params["limit"] = $limit;
726
+ return $this->callServer("campaignSoftBounces", $params);
727
+ }
728
+
729
+ /**
730
+ * Get all unsubscribed email addresses for a given campaign
731
+ *
732
+ * @section Campaign Stats
733
+ *
734
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
735
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
736
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
737
+ * @return array a total of all unsubscribed emails and the specific emails for this page
738
+ int total the total number of unsubscribes for the campaign
739
+ array data the full email addresses that unsubscribed
740
+ string email the email address that unsubscribed
741
+ string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
742
+ string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
743
+ */
744
+ function campaignUnsubscribes($cid, $start=0, $limit=1000) {
745
+ $params = array();
746
+ $params["cid"] = $cid;
747
+ $params["start"] = $start;
748
+ $params["limit"] = $limit;
749
+ return $this->callServer("campaignUnsubscribes", $params);
750
+ }
751
+
752
+ /**
753
+ * Get all email addresses that complained about a given campaign
754
+ *
755
+ * @section Campaign Stats
756
+ *
757
+ * @example mcapi_campaignAbuseReports.php
758
+ *
759
+ * @param string $cid the campaign id to pull abuse reports for (can be gathered using campaigns())
760
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
761
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
762
+ * @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
763
+ * @return array reports the abuse reports for this campaign
764
+ int total the total reports matched
765
+ array data the report data for each, including:
766
+ string date date/time the abuse report was received and processed
767
+ string email the email address that reported abuse
768
+ string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
769
+ */
770
+ function campaignAbuseReports($cid, $since=NULL, $start=0, $limit=500) {
771
+ $params = array();
772
+ $params["cid"] = $cid;
773
+ $params["since"] = $since;
774
+ $params["start"] = $start;
775
+ $params["limit"] = $limit;
776
+ return $this->callServer("campaignAbuseReports", $params);
777
+ }
778
+
779
+ /**
780
+ * Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
781
+ * suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary
782
+ *
783
+ * @section Campaign Stats
784
+ *
785
+ * @example mcapi_campaignAdvice.php
786
+ *
787
+ * @param string $cid the campaign id to pull advice text for (can be gathered using campaigns())
788
+ * @return array advice on the campaign's performance, each containing:
789
+ msg the advice message
790
+ type the "type" of the message. one of: negative, positive, or neutral
791
+ */
792
+ function campaignAdvice($cid) {
793
+ $params = array();
794
+ $params["cid"] = $cid;
795
+ return $this->callServer("campaignAdvice", $params);
796
+ }
797
+
798
+ /**
799
+ * Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.
800
+ *
801
+ * @section Campaign Stats
802
+ *
803
+ * @example mcapi_campaignAnalytics.php
804
+ *
805
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
806
+ * @return array analytics we've collected for the passed campaign.
807
+ int visits number of visits
808
+ int pages number of page views
809
+ int new_visits new visits recorded
810
+ int bounces vistors who "bounced" from your site
811
+ double time_on_site the total time visitors spent on your sites
812
+ int goal_conversions number of goals converted
813
+ double goal_value value of conversion in dollars
814
+ double revenue revenue generated by campaign
815
+ int transactions number of transactions tracked
816
+ int ecomm_conversions number Ecommerce transactions tracked
817
+ array goals an array containing goal names and number of conversions
818
+ string name the name of the goal
819
+ int conversions the number of conversions for the goal
820
+ */
821
+ function campaignAnalytics($cid) {
822
+ $params = array();
823
+ $params["cid"] = $cid;
824
+ return $this->callServer("campaignAnalytics", $params);
825
+ }
826
+
827
+ /**
828
+ * Retrieve the countries and number of opens tracked for each. Email address are not returned.
829
+ *
830
+ * @section Campaign Stats
831
+ *
832
+ *
833
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
834
+ * @return array countries an array of countries where opens occurred
835
+ string code The ISO3166 2 digit country code
836
+ string name A version of the country name, if we have it
837
+ int opens The total number of opens that occurred in the country
838
+ boolean region_detail Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
839
+ */
840
+ function campaignGeoOpens($cid) {
841
+ $params = array();
842
+ $params["cid"] = $cid;
843
+ return $this->callServer("campaignGeoOpens", $params);
844
+ }
845
+
846
+ /**
847
+ * Retrieve the regions and number of opens tracked for a certain country. Email address are not returned.
848
+ *
849
+ * @section Campaign Stats
850
+ *
851
+ *
852
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
853
+ * @param string $code An ISO3166 2 digit country code
854
+ * @return array regions an array of regions within the provided country where opens occurred.
855
+ string code An internal code for the region. When this is blank, it indicates we know the country, but not the region
856
+ string name The name of the region, if we have one. For blank "code" values, this will be "Rest of Country"
857
+ int opens The total number of opens that occurred in the country
858
+ */
859
+ function campaignGeoOpensForCountry($cid, $code) {
860
+ $params = array();
861
+ $params["cid"] = $cid;
862
+ $params["code"] = $code;
863
+ return $this->callServer("campaignGeoOpensForCountry", $params);
864
+ }
865
+
866
+ /**
867
+ * Retrieve the tracked eepurl mentions on Twitter
868
+ *
869
+ * @section Campaign Stats
870
+ *
871
+ *
872
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
873
+ * @return array stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl
874
+ array twitter various Twitter related stats
875
+ int tweets Total number of tweets seen
876
+ string first_tweet date and time of the first tweet seen
877
+ string last_tweet date and time of the last tweet seen
878
+ int retweets Total number of retweets seen
879
+ string first_retweet date and time of the first retweet seen
880
+ string last_retweet date and time of the last retweet seen
881
+ array statuses an array of statuses recorded inclduing:
882
+ string status the text of the tweet/update
883
+ string screen_name the screen name as recorded when first seen
884
+ string status_id the status id of the tweet (they are really unsigned 64 bit ints)
885
+ string datetime the date/time of the tweet
886
+ bool is_retweet whether or not this was a retweet
887
+ array clicks stats related to click-throughs on the eepurl
888
+ int clicks Total number of clicks seen
889
+ string first_click date and time of the first click seen
890
+ string last_click date and time of the first click seen
891
+ array locations an array of geographic locations including:
892
+ string country the country name the click was tracked to
893
+ string region the region in the country the click was tracked to (if available)
894
+ int total clicks total clicks occuring in this country+region pair
895
+ array referrers an array of arrays, each containing
896
+ string referrer the referrer, truncated to 100 bytes
897
+ int clicks Total number of clicks seen from this referrer
898
+ string first_click date and time of the first click seen from this referrer
899
+ string last_click date and time of the first click seen from this referrer
900
+ */
901
+ function campaignEepUrlStats($cid) {
902
+ $params = array();
903
+ $params["cid"] = $cid;
904
+ return $this->callServer("campaignEepUrlStats", $params);
905
+ }
906
+
907
+ /**
908
+ * Retrieve the most recent full bounce message for a specific email address on the given campaign.
909
+ * Messages over 30 days old are subject to being removed
910
+ *
911
+ *
912
+ * @section Campaign Stats
913
+ *
914
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
915
+ * @param string $email the email address or unique id of the member to pull a bounce message for.
916
+ * @return array the full bounce message for this email+campaign along with some extra data.
917
+ string date date/time the bounce was received and processed
918
+ string email the email address that bounced
919
+ string message the entire bounce message received
920
+ */
921
+ function campaignBounceMessage($cid, $email) {
922
+ $params = array();
923
+ $params["cid"] = $cid;
924
+ $params["email"] = $email;
925
+ return $this->callServer("campaignBounceMessage", $params);
926
+ }
927
+
928
+ /**
929
+ * Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts
930
+ * of data depending on how large the campaign was and how much cruft the bounce provider returned. Also,
931
+ * message over 30 days old are subject to being removed
932
+ *
933
+ * @section Campaign Stats
934
+ *
935
+ * @example mcapi_campaignBounceMessages.php
936
+ *
937
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
938
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
939
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 25, upper limit set at 50
940
+ * @param string $since optional pull only messages since this time - use YYYY-MM-DD format in <strong>GMT</strong> (we only store the date, not the time)
941
+ * @return array bounces the full bounce messages for this campaign
942
+ int total that total number of bounce messages for the campaign
943
+ array data an array containing the data for this page
944
+ string date date/time the bounce was received and processed
945
+ string email the email address that bounced
946
+ string message the entire bounce message received
947
+ */
948
+ function campaignBounceMessages($cid, $start=0, $limit=25, $since=NULL) {
949
+ $params = array();
950
+ $params["cid"] = $cid;
951
+ $params["start"] = $start;
952
+ $params["limit"] = $limit;
953
+ $params["since"] = $since;
954
+ return $this->callServer("campaignBounceMessages", $params);
955
+ }
956
+
957
+ /**
958
+ * Retrieve the Ecommerce Orders tracked by campaignEcommOrderAdd()
959
+ *
960
+ * @section Campaign Stats
961
+ *
962
+ * @param string $cid the campaign id to pull bounces for (can be gathered using campaigns())
963
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
964
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500
965
+ * @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
966
+ * @return array the total matching orders and the specific orders for the requested page
967
+ int total the total matching orders
968
+ array data the actual data for each order being returned
969
+ string store_id the store id generated by the plugin used to uniquely identify a store
970
+ string store_name the store name collected by the plugin - often the domain name
971
+ string order_id the internal order id the store tracked this order by
972
+ string email the email address that received this campaign and is associated with this order
973
+ double order_total the order total
974
+ double tax_total the total tax for the order (if collected)
975
+ double ship_total the shipping total for the order (if collected)
976
+ string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we received it
977
+ array lines containing detail of the order:
978
+ int line_num the line number assigned to this line
979
+ int product_id the product id assigned to this item
980
+ string product_name the product name
981
+ string product_sku the sku for the product
982
+ int product_category_id the id for the product category
983
+ string product_category_name the product category name
984
+ int qty the quantity of items ordered
985
+ cost the total cost of items ordered
986
+ */
987
+ function campaignEcommOrders($cid, $start=0, $limit=100, $since=NULL) {
988
+ $params = array();
989
+ $params["cid"] = $cid;
990
+ $params["start"] = $start;
991
+ $params["limit"] = $limit;
992
+ $params["since"] = $since;
993
+ return $this->callServer("campaignEcommOrders", $params);
994
+ }
995
+
996
+ /**
997
+ * Get the URL to a customized <a href="http://eepurl.com/gKmL" target="_blank">VIP Report</a> for the specified campaign and optionally send an email to someone with links to it. Note subsequent calls will overwrite anything already set for the same campign (eg, the password)
998
+ *
999
+ * @section Campaign Related
1000
+ *
1001
+ * @param string $cid the campaign id to share a report for (can be gathered using campaigns())
1002
+ * @param array $opts optional various parameters which can be used to configure the shared report
1003
+ string to_email optional - optional, comma delimited list of email addresses to share the report with - no value means an email will not be sent
1004
+ string company optional - a company name to be displayed (use of a theme may hide this) - max 255 bytes
1005
+ int theme_id optional - either a global or a user-specific theme id. Currently this needs to be pulled out of either the Share Report or Cobranding web views by grabbing the "theme" attribute from the list presented.
1006
+ string css_url optional - a link to an external CSS file to be included after our default CSS (http://vip-reports.net/css/vip.css) <strong>only if</strong> loaded via the "secure_url" - max 255 bytes
1007
+ * @return array Array containing details for the shared report
1008
+ string title The Title of the Campaign being shared
1009
+ string url The URL to the shared report
1010
+ string secure_url The URL to the shared report, including the password (good for loading in an IFRAME). For non-secure reports, this will not be returned
1011
+ string password If secured, the password for the report, otherwise this field will not be returned
1012
+ */
1013
+ function campaignShareReport($cid, $opts=array (
1014
+ )) {
1015
+ $params = array();
1016
+ $params["cid"] = $cid;
1017
+ $params["opts"] = $opts;
1018
+ return $this->callServer("campaignShareReport", $params);
1019
+ }
1020
+
1021
+ /**
1022
+ * Get the content (both html and text) for a campaign either as it would appear in the campaign archive or as the raw, original content
1023
+ *
1024
+ * @section Campaign Related
1025
+ *
1026
+ * @param string $cid the campaign id to get content for (can be gathered using campaigns())
1027
+ * @param bool $for_archive optional controls whether we return the Archive version (true) or the Raw version (false), defaults to true
1028
+ * @return array Array containing all content for the campaign
1029
+ string html The HTML content used for the campgain with merge tags intact
1030
+ string text The Text content used for the campgain with merge tags intact
1031
+ */
1032
+ function campaignContent($cid, $for_archive=true) {
1033
+ $params = array();
1034
+ $params["cid"] = $cid;
1035
+ $params["for_archive"] = $for_archive;
1036
+ return $this->callServer("campaignContent", $params);
1037
+ }
1038
+
1039
+ /**
1040
+ * Get the HTML template content sections for a campaign. Note that this <strong>will</strong> return very jagged, non-standard results based on the template
1041
+ * a campaign is using. You only want to use this if you want to allow editing template sections in your applicaton.
1042
+ *
1043
+ * @section Campaign Related
1044
+ *
1045
+ * @param string $cid the campaign id to get content for (can be gathered using campaigns())
1046
+ * @return array array containing all content section for the campaign - section name are dependent upon the template used and thus can't be documented
1047
+ */
1048
+ function campaignTemplateContent($cid) {
1049
+ $params = array();
1050
+ $params["cid"] = $cid;
1051
+ return $this->callServer("campaignTemplateContent", $params);
1052
+ }
1053
+
1054
+ /**
1055
+ * Retrieve the list of email addresses that opened a given campaign with how many times they opened - note: this AIM function is free and does
1056
+ * not actually require the AIM module to be installed
1057
+ *
1058
+ * @section Campaign Report Data
1059
+ *
1060
+ * @param string $cid the campaign id to get opens for (can be gathered using campaigns())
1061
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1062
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
1063
+ * @return array array containing the total records matched and the specific records for this page
1064
+ int total the total number of records matched
1065
+ array data the actual opens data, including:
1066
+ string email Email address that opened the campaign
1067
+ int open_count Total number of times the campaign was opened by this email address
1068
+ */
1069
+ function campaignOpenedAIM($cid, $start=0, $limit=1000) {
1070
+ $params = array();
1071
+ $params["cid"] = $cid;
1072
+ $params["start"] = $start;
1073
+ $params["limit"] = $limit;
1074
+ return $this->callServer("campaignOpenedAIM", $params);
1075
+ }
1076
+
1077
+ /**
1078
+ * Retrieve the list of email addresses that did not open a given campaign
1079
+ *
1080
+ * @section Campaign Report Data
1081
+ *
1082
+ * @param string $cid the campaign id to get no opens for (can be gathered using campaigns())
1083
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1084
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
1085
+ * @return array array containing the total records matched and the specific records for this page
1086
+ int total the total number of records matched
1087
+ array data the email addresses that did not open the campaign
1088
+ */
1089
+ function campaignNotOpenedAIM($cid, $start=0, $limit=1000) {
1090
+ $params = array();
1091
+ $params["cid"] = $cid;
1092
+ $params["start"] = $start;
1093
+ $params["limit"] = $limit;
1094
+ return $this->callServer("campaignNotOpenedAIM", $params);
1095
+ }
1096
+
1097
+ /**
1098
+ * Return the list of email addresses that clicked on a given url, and how many times they clicked
1099
+ *
1100
+ * @section Campaign Report Data
1101
+ *
1102
+ * @param string $cid the campaign id to get click stats for (can be gathered using campaigns())
1103
+ * @param string $url the URL of the link that was clicked on
1104
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1105
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000
1106
+ * @return array array containing the total records matched and the specific records for this page
1107
+ int total the total number of records matched
1108
+ array data the email addresses that did not open the campaign
1109
+ string email Email address that opened the campaign
1110
+ int clicks Total number of times the URL was clicked on by this email address
1111
+ */
1112
+ function campaignClickDetailAIM($cid, $url, $start=0, $limit=1000) {
1113
+ $params = array();
1114
+ $params["cid"] = $cid;
1115
+ $params["url"] = $url;
1116
+ $params["start"] = $start;
1117
+ $params["limit"] = $limit;
1118
+ return $this->callServer("campaignClickDetailAIM", $params);
1119
+ }
1120
+
1121
+ /**
1122
+ * Given a campaign and email address, return the entire click and open history with timestamps, ordered by time
1123
+ *
1124
+ * @section Campaign Report Data
1125
+ *
1126
+ * @param string $cid the campaign id to get stats for (can be gathered using campaigns())
1127
+ * @param array $email_address an array of up to 50 email addresses to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).
1128
+ * @return array an array with the keys listed in Returned Fields below
1129
+ int success the number of email address records found
1130
+ int error the number of email address records which could not be found
1131
+ array data arrays containing the actions (opens and clicks) that the email took, with timestamps
1132
+ string action The action taken (open or click)
1133
+ string timestamp Time the action occurred
1134
+ string url For clicks, the URL that was clicked
1135
+ */
1136
+ function campaignEmailStatsAIM($cid, $email_address) {
1137
+ $params = array();
1138
+ $params["cid"] = $cid;
1139
+ $params["email_address"] = $email_address;
1140
+ return $this->callServer("campaignEmailStatsAIM", $params);
1141
+ }
1142
+
1143
+ /**
1144
+ * Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time,
1145
+ * for every user a campaign was delivered to.
1146
+ *
1147
+ * @section Campaign Report Data
1148
+ * @example mcapi_campaignEmailStatsAIMAll.php
1149
+ *
1150
+ * @param string $cid the campaign id to get stats for (can be gathered using campaigns())
1151
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1152
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 1000
1153
+ * @return array Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps
1154
+ int total the total number of records
1155
+ array data each record keyed by email address containing arrays of actions including:
1156
+ string action The action taken (open or click)
1157
+ string timestamp Time the action occurred
1158
+ string url For clicks, the URL that was clicked
1159
+ */
1160
+ function campaignEmailStatsAIMAll($cid, $start=0, $limit=100) {
1161
+ $params = array();
1162
+ $params["cid"] = $cid;
1163
+ $params["start"] = $start;
1164
+ $params["limit"] = $limit;
1165
+ return $this->callServer("campaignEmailStatsAIMAll", $params);
1166
+ }
1167
+
1168
+ /**
1169
+ * Attach Ecommerce Order Information to a Campaign. This will generally be used by ecommerce package plugins
1170
+ * <a href="http://connect.mailchimp.com/category/ecommerce" target="_blank">provided by us or by 3rd part system developers</a>.
1171
+ * @section Campaign Related
1172
+ *
1173
+ * @param array $order an array of information pertaining to the order that has completed. Use the following keys:
1174
+ string id the Order Id
1175
+ string campaign_id the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
1176
+ string email_id the Email Id of the subscriber we should attach this order to (see the "mc_eid" query string variable a campaign passes)
1177
+ double total The Order Total (ie, the full amount the customer ends up paying)
1178
+ string order_date optional the date of the order - if this is not provided, we will default the date to now
1179
+ double shipping optional the total paid for Shipping Fees
1180
+ double tax optional the total tax paid
1181
+ string store_id a unique id for the store sending the order in (20 bytes max)
1182
+ string store_name optional a "nice" name for the store - typically the base web address (ie, "store.mailchimp.com"). We will automatically update this if it changes (based on store_id)
1183
+ array items the individual line items for an order using these keys:
1184
+ <div style="padding-left:30px"><table>
1185
+ int line_num optional the line number of the item on the order. We will generate these if they are not passed
1186
+ int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
1187
+ string sku optional the store's internal SKU for the product. (max 30 bytes)
1188
+ string product_name the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
1189
+ int category_id the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
1190
+ string category_name the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
1191
+ double qty the quantity of the item ordered
1192
+ double cost the cost of a single item (ie, not the extended cost of the line)
1193
+ </table></div>
1194
+ * @return bool true if the data is saved, otherwise an error is thrown.
1195
+ */
1196
+ function campaignEcommOrderAdd($order) {
1197
+ $params = array();
1198
+ $params["order"] = $order;
1199
+ return $this->callServer("campaignEcommOrderAdd", $params);
1200
+ }
1201
+
1202
+ /**
1203
+ * Retrieve all of the lists defined for your user account
1204
+ *
1205
+ * @section List Related
1206
+ * @example mcapi_lists.php
1207
+ * @example xml-rpc_lists.php
1208
+ *
1209
+ * @param array $filters a hash of filters to apply to this query - all are optional:
1210
+ string list_id optional - return a single list using a known list_id. Accepts multiples separated by commas when not using exact matching
1211
+ string list_name optional - only lists that match this name
1212
+ string from_name optional - only lists that have a default from name matching this
1213
+ string from_email optional - only lists that have a default from email matching this
1214
+ string from_subject optional - only lists that have a default from email matching this
1215
+ string created_before optional - only show lists that were created before this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
1216
+ string created_after optional - only show lists that were created since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
1217
+ boolean exact optional - flag for whether to filter on exact values when filtering, or search within content for filter values - defaults to true
1218
+ * @param int $start optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)
1219
+ * @param int $limit optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)
1220
+ * @param string sort_field optional - "created" (the created date, default) or "web" (the display order in the web app). Invalid values will fall back on "created" - case insensitive.
1221
+ * @param string sort_dir optional - "DESC" for descending (default), "ASC" for Ascending. Invalid values will fall back on "created" - case insensitive. Note: to get the exact display order as the web app you'd use "web" and "ASC"
1222
+ * @return array an array with keys listed in Returned Fields below
1223
+ int total the total number of lists which matched the provided filters
1224
+ array data the lists which matched the provided filters, including the following for
1225
+ string id The list id for this list. This will be used for all other list management functions.
1226
+ int web_id The list id used in our web app, allows you to create a link directly to it
1227
+ string name The name of the list.
1228
+ string date_created The date that this list was created.
1229
+ boolean email_type_option Whether or not the List supports multiple formats for emails or just HTML
1230
+ boolean use_awesomebar Whether or not campaigns for this list use the Awesome Bar in archives by default
1231
+ string default_from_name Default From Name for campaigns using this list
1232
+ string default_from_email Default From Email for campaigns using this list
1233
+ string default_subject Default Subject Line for campaigns using this list
1234
+ string default_language Default Language for this list's forms
1235
+ double list_rating An auto-generated activity score for the list (0 - 5)
1236
+ string subscribe_url_short Our eepurl shortened version of this list's subscribe form (will not change)
1237
+ string subscribe_url_long The full version of this list's subscribe form (host will vary)
1238
+ string beamer_address The email address to use for this list's <a href="http://kb.mailchimp.com/article/how-do-i-import-a-campaign-via-email-email-beamer/">Email Beamer</a>
1239
+ string visibility Whether this list is Public (pub) or Private (prv). Used internally for projects like <a href="http://blog.mailchimp.com/introducing-wavelength/" target="_blank">Wavelength</a>
1240
+ array stats various stats and counts for the list - many of these are cached for at least 5 minutes
1241
+ double member_count The number of active members in the given list.
1242
+ double unsubscribe_count The number of members who have unsubscribed from the given list.
1243
+ double cleaned_count The number of members cleaned from the given list.
1244
+ double member_count_since_send The number of active members in the given list since the last campaign was sent
1245
+ double unsubscribe_count_since_send The number of members who have unsubscribed from the given list since the last campaign was sent
1246
+ double cleaned_count_since_send The number of members cleaned from the given list since the last campaign was sent
1247
+ double campaign_count The number of campaigns in any status that use this list
1248
+ double grouping_count The number of Interest Groupings for this list
1249
+ double group_count The number of Interest Groups (regardless of grouping) for this list
1250
+ double merge_var_count The number of merge vars for this list (not including the required EMAIL one)
1251
+ double avg_sub_rate the average number of subscribe per month for the list (empty value if we haven't calculated this yet)
1252
+ double avg_unsub_rate the average number of unsubscribe per month for the list (empty value if we haven't calculated this yet)
1253
+ double target_sub_rate the target subscription rate for the list to keep it growing (empty value if we haven't calculated this yet)
1254
+ double open_rate the average open rate per campaign for the list (empty value if we haven't calculated this yet)
1255
+ double click_rate the average click rate per campaign for the list (empty value if we haven't calculated this yet)
1256
+ array modules Any list specific modules installed for this list (example is SocialPro)
1257
+ */
1258
+ function lists($filters=array (
1259
+ ), $start=0, $limit=25, $sort_field='created', $sort_dir='DESC') {
1260
+ $params = array();
1261
+ $params["filters"] = $filters;
1262
+ $params["start"] = $start;
1263
+ $params["limit"] = $limit;
1264
+ $params["sort_field"] = $sort_field;
1265
+ $params["sort_dir"] = $sort_dir;
1266
+ return $this->callServer("lists", $params);
1267
+ }
1268
+
1269
+ /**
1270
+ * Get the list of merge tags for a given list, including their name, tag, and required setting
1271
+ *
1272
+ * @section List Related
1273
+ * @example xml-rpc_listMergeVars.php
1274
+ *
1275
+ * @param string $id the list id to connect to. Get by calling lists()
1276
+ * @return array list of merge tags for the list
1277
+ string name Name of the merge field
1278
+ bool req Denotes whether the field is required (true) or not (false)
1279
+ string field_type The "data type" of this merge var. One of: email, text, number, radio, dropdown, date, address, phone, url, imageurl
1280
+ bool public Whether or not this field is visible to list subscribers
1281
+ bool show Whether the list owner has this field displayed on their list dashboard
1282
+ string order The order the list owner has set this field to display in
1283
+ string default The default value the list owner has set for this field
1284
+ string size The width of the field to be used
1285
+ string tag The merge tag that's used for forms and listSubscribe() and listUpdateMember()
1286
+ array choices For radio and dropdown field types, an array of the options available
1287
+ */
1288
+ function listMergeVars($id) {
1289
+ $params = array();
1290
+ $params["id"] = $id;
1291
+ return $this->callServer("listMergeVars", $params);
1292
+ }
1293
+
1294
+ /**
1295
+ * Add a new merge tag to a given list
1296
+ *
1297
+ * @section List Related
1298
+ * @example xml-rpc_listMergeVarAdd.php
1299
+ *
1300
+ * @param string $id the list id to connect to. Get by calling lists()
1301
+ * @param string $tag The merge tag to add, e.g. FNAME. 10 bytes max, valid characters: "A-Z 0-9 _" no spaces, dashes, etc.
1302
+ * @param string $name The long description of the tag being added, used for user displays
1303
+ * @param array $options optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a "boolean"
1304
+ string field_type optional one of: text, number, radio, dropdown, date, address, phone, url, imageurl, zip, birthday - defaults to text
1305
+ boolean req optional indicates whether the field is required - defaults to false
1306
+ boolean public optional indicates whether the field is displayed in public - defaults to true
1307
+ boolean show optional indicates whether the field is displayed in the app's list member view - defaults to true
1308
+ int order The order this merge tag should be displayed in - this will cause existing values to be reset so this fits
1309
+ string default_value optional the default value for the field. See listSubscribe() for formatting info. Defaults to blank
1310
+ array choices optional kind of - an array of strings to use as the choices for radio and dropdown type fields
1311
+ string dateformat optional only valid for birthday and date fields. For birthday type, must be "MM/DD" (default) or "DD/MM". For date type, must be "MM/DD/YYYY" (default) or "DD/MM/YYYY". Any other values will be converted to the default.
1312
+ string phoneformat optional "US" is the default - any other value will cause them to be unformatted (international)
1313
+ string defaultcountry optional the <a href="http://www.iso.org/iso/english_country_names_and_code_elements" target="_blank">ISO 3166 2 digit character code</a> for the default country. Defaults to "US". Anything unrecognized will be converted to the default.
1314
+
1315
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1316
+ */
1317
+ function listMergeVarAdd($id, $tag, $name, $options=array (
1318
+ )) {
1319
+ $params = array();
1320
+ $params["id"] = $id;
1321
+ $params["tag"] = $tag;
1322
+ $params["name"] = $name;
1323
+ $params["options"] = $options;
1324
+ return $this->callServer("listMergeVarAdd", $params);
1325
+ }
1326
+
1327
+ /**
1328
+ * Update most parameters for a merge tag on a given list. You cannot currently change the merge type
1329
+ *
1330
+ * @section List Related
1331
+ *
1332
+ * @param string $id the list id to connect to. Get by calling lists()
1333
+ * @param string $tag The merge tag to update
1334
+ * @param array $options The options to change for a merge var. See listMergeVarAdd() for valid options. "tag" and "name" may also be used here.
1335
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1336
+ */
1337
+ function listMergeVarUpdate($id, $tag, $options) {
1338
+ $params = array();
1339
+ $params["id"] = $id;
1340
+ $params["tag"] = $tag;
1341
+ $params["options"] = $options;
1342
+ return $this->callServer("listMergeVarUpdate", $params);
1343
+ }
1344
+
1345
+ /**
1346
+ * Delete a merge tag from a given list and all its members. Seriously - the data is removed from all members as well!
1347
+ * Note that on large lists this method may seem a bit slower than calls you typically make.
1348
+ *
1349
+ * @section List Related
1350
+ * @example xml-rpc_listMergeVarDel.php
1351
+ *
1352
+ * @param string $id the list id to connect to. Get by calling lists()
1353
+ * @param string $tag The merge tag to delete
1354
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1355
+ */
1356
+ function listMergeVarDel($id, $tag) {
1357
+ $params = array();
1358
+ $params["id"] = $id;
1359
+ $params["tag"] = $tag;
1360
+ return $this->callServer("listMergeVarDel", $params);
1361
+ }
1362
+
1363
+ /**
1364
+ * Completely resets all data stored in a merge var on a list. All data is removed and this action can not be undone.
1365
+ *
1366
+ * @section List Related
1367
+ *
1368
+ * @param string $id the list id to connect to. Get by calling lists()
1369
+ * @param string $tag The merge tag to reset
1370
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1371
+ */
1372
+ function listMergeVarReset($id, $tag) {
1373
+ $params = array();
1374
+ $params["id"] = $id;
1375
+ $params["tag"] = $tag;
1376
+ return $this->callServer("listMergeVarReset", $params);
1377
+ }
1378
+
1379
+ /**
1380
+ * Get the list of interest groupings for a given list, including the label, form information, and included groups for each
1381
+ *
1382
+ * @section List Related
1383
+ * @example xml-rpc_listInterestGroupings.php
1384
+ *
1385
+ * @param string $id the list id to connect to. Get by calling lists()
1386
+ * @return struct list of interest groups for the list
1387
+ int id The id for the Grouping
1388
+ string name Name for the Interest groups
1389
+ string form_field Gives the type of interest group: checkbox,radio,select
1390
+ array groups Array of the grouping options including:
1391
+ string bit the bit value - not really anything to be done with this
1392
+ string name the name of the group
1393
+ string display_order the display order of the group, if set
1394
+ int subscribers total number of subscribers who have this group
1395
+ */
1396
+ function listInterestGroupings($id) {
1397
+ $params = array();
1398
+ $params["id"] = $id;
1399
+ return $this->callServer("listInterestGroupings", $params);
1400
+ }
1401
+
1402
+ /** Add a single Interest Group - if interest groups for the List are not yet enabled, adding the first
1403
+ * group will automatically turn them on.
1404
+ *
1405
+ * @section List Related
1406
+ * @example xml-rpc_listInterestGroupAdd.php
1407
+ *
1408
+ * @param string $id the list id to connect to. Get by calling lists()
1409
+ * @param string $group_name the interest group to add - group names must be unique within a grouping
1410
+ * @param int $grouping_id optional The grouping to add the new group to - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
1411
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1412
+ */
1413
+ function listInterestGroupAdd($id, $group_name, $grouping_id=NULL) {
1414
+ $params = array();
1415
+ $params["id"] = $id;
1416
+ $params["group_name"] = $group_name;
1417
+ $params["grouping_id"] = $grouping_id;
1418
+ return $this->callServer("listInterestGroupAdd", $params);
1419
+ }
1420
+
1421
+ /** Delete a single Interest Group - if the last group for a list is deleted, this will also turn groups for the list off.
1422
+ *
1423
+ * @section List Related
1424
+ * @example xml-rpc_listInterestGroupDel.php
1425
+ *
1426
+ * @param string $id the list id to connect to. Get by calling lists()
1427
+ * @param string $group_name the interest group to delete
1428
+ * @param int $grouping_id The grouping to delete the group from - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
1429
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1430
+ */
1431
+ function listInterestGroupDel($id, $group_name, $grouping_id=NULL) {
1432
+ $params = array();
1433
+ $params["id"] = $id;
1434
+ $params["group_name"] = $group_name;
1435
+ $params["grouping_id"] = $grouping_id;
1436
+ return $this->callServer("listInterestGroupDel", $params);
1437
+ }
1438
+
1439
+ /** Change the name of an Interest Group
1440
+ *
1441
+ * @section List Related
1442
+ *
1443
+ * @param string $id the list id to connect to. Get by calling lists()
1444
+ * @param string $old_name the interest group name to be changed
1445
+ * @param string $new_name the new interest group name to be set
1446
+ * @param int $grouping_id optional The grouping to delete the group from - get using listInterestGrouping() . If not supplied, the first grouping on the list is used.
1447
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1448
+ */
1449
+ function listInterestGroupUpdate($id, $old_name, $new_name, $grouping_id=NULL) {
1450
+ $params = array();
1451
+ $params["id"] = $id;
1452
+ $params["old_name"] = $old_name;
1453
+ $params["new_name"] = $new_name;
1454
+ $params["grouping_id"] = $grouping_id;
1455
+ return $this->callServer("listInterestGroupUpdate", $params);
1456
+ }
1457
+
1458
+ /** Add a new Interest Grouping - if interest groups for the List are not yet enabled, adding the first
1459
+ * grouping will automatically turn them on.
1460
+ *
1461
+ * @section List Related
1462
+ * @example xml-rpc_listInterestGroupingAdd.php
1463
+ *
1464
+ * @param string $id the list id to connect to. Get by calling lists()
1465
+ * @param string $name the interest grouping to add - grouping names must be unique
1466
+ * @param string $type The type of the grouping to add - one of "checkboxes", "hidden", "dropdown", "radio"
1467
+ * @param array $groups The lists of initial group names to be added - at least 1 is required and the names must be unique within a grouping. If the number takes you over the 60 group limit, an error will be thrown.
1468
+ * @return int the new grouping id if the request succeeds, otherwise an error will be thrown
1469
+ */
1470
+ function listInterestGroupingAdd($id, $name, $type, $groups) {
1471
+ $params = array();
1472
+ $params["id"] = $id;
1473
+ $params["name"] = $name;
1474
+ $params["type"] = $type;
1475
+ $params["groups"] = $groups;
1476
+ return $this->callServer("listInterestGroupingAdd", $params);
1477
+ }
1478
+
1479
+ /** Update an existing Interest Grouping
1480
+ *
1481
+ * @section List Related
1482
+ * @example xml-rpc_listInterestGroupingUpdate.php
1483
+ *
1484
+ * @param int $grouping_id the interest grouping id - get from listInterestGroupings()
1485
+ * @param string $name The name of the field to update - either "name" or "type". Groups with in the grouping should be manipulated using the standard listInterestGroup* methods
1486
+ * @param string $value The new value of the field. Grouping names must be unique - only "hidden" and "checkboxes" grouping types can be converted between each other.
1487
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1488
+ */
1489
+ function listInterestGroupingUpdate($grouping_id, $name, $value) {
1490
+ $params = array();
1491
+ $params["grouping_id"] = $grouping_id;
1492
+ $params["name"] = $name;
1493
+ $params["value"] = $value;
1494
+ return $this->callServer("listInterestGroupingUpdate", $params);
1495
+ }
1496
+
1497
+ /** Delete an existing Interest Grouping - this will permanently delete all contained interest groups and will remove those selections from all list members
1498
+ *
1499
+ * @section List Related
1500
+ * @example xml-rpc_listInterestGroupingDel.php
1501
+ *
1502
+ * @param int $grouping_id the interest grouping id - get from listInterestGroupings()
1503
+ * @return bool true if the request succeeds, otherwise an error will be thrown
1504
+ */
1505
+ function listInterestGroupingDel($grouping_id) {
1506
+ $params = array();
1507
+ $params["grouping_id"] = $grouping_id;
1508
+ return $this->callServer("listInterestGroupingDel", $params);
1509
+ }
1510
+
1511
+ /** Return the Webhooks configured for the given list
1512
+ *
1513
+ * @section List Related
1514
+ *
1515
+ * @param string $id the list id to connect to. Get by calling lists()
1516
+ * @return array list of webhooks
1517
+ string url the URL for this Webhook
1518
+ array actions the possible actions and whether they are enabled
1519
+ bool subscribe triggered when subscribes happen
1520
+ bool unsubscribe triggered when unsubscribes happen
1521
+ bool profile triggered when profile updates happen
1522
+ bool cleaned triggered when a subscriber is cleaned (bounced) from a list
1523
+ bool upemail triggered when a subscriber's email address is changed
1524
+ bool campaign triggered when a campaign is sent or canceled
1525
+ array sources the possible sources and whether they are enabled
1526
+ bool user whether user/subscriber triggered actions are returned
1527
+ bool admin whether admin (manual, in-app) triggered actions are returned
1528
+ bool api whether api triggered actions are returned
1529
+ */
1530
+ function listWebhooks($id) {
1531
+ $params = array();
1532
+ $params["id"] = $id;
1533
+ return $this->callServer("listWebhooks", $params);
1534
+ }
1535
+
1536
+ /** Add a new Webhook URL for the given list
1537
+ *
1538
+ * @section List Related
1539
+ *
1540
+ * @param string $id the list id to connect to. Get by calling lists()
1541
+ * @param string $url a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.
1542
+ * @param array $actions optional a hash of actions to fire this Webhook for
1543
+ bool subscribe optional as subscribes occur, defaults to true
1544
+ bool unsubscribe optional as subscribes occur, defaults to true
1545
+ bool profile optional as profile updates occur, defaults to true
1546
+ bool cleaned optional as emails are cleaned from the list, defaults to true
1547
+ bool upemail optional when subscribers change their email address, defaults to true
1548
+ bool campaign option when a campaign is sent or canceled, defaults to true
1549
+ * @param array $sources optional a hash of sources to fire this Webhook for
1550
+ bool user optional user/subscriber initiated actions, defaults to true
1551
+ bool admin optional admin actions in our web app, defaults to true
1552
+ bool api optional actions that happen via API calls, defaults to false
1553
+ * @return bool true if the call succeeds, otherwise an exception will be thrown
1554
+ */
1555
+ function listWebhookAdd($id, $url, $actions=array (
1556
+ ), $sources=array (
1557
+ )) {
1558
+ $params = array();
1559
+ $params["id"] = $id;
1560
+ $params["url"] = $url;
1561
+ $params["actions"] = $actions;
1562
+ $params["sources"] = $sources;
1563
+ return $this->callServer("listWebhookAdd", $params);
1564
+ }
1565
+
1566
+ /** Delete an existing Webhook URL from a given list
1567
+ *
1568
+ * @section List Related
1569
+ *
1570
+ * @param string $id the list id to connect to. Get by calling lists()
1571
+ * @param string $url the URL of a Webhook on this list
1572
+ * @return boolean true if the call succeeds, otherwise an exception will be thrown
1573
+ */
1574
+ function listWebhookDel($id, $url) {
1575
+ $params = array();
1576
+ $params["id"] = $id;
1577
+ $params["url"] = $url;
1578
+ return $this->callServer("listWebhookDel", $params);
1579
+ }
1580
+
1581
+ /** Retrieve all of the Static Segments for a list.
1582
+ *
1583
+ * @section List Related
1584
+ *
1585
+ * @param string $id the list id to connect to. Get by calling lists()
1586
+ * @return array an array of parameters for each static segment
1587
+ int id the id of the segment
1588
+ string name the name for the segment
1589
+ int member_count the total number of subscribed members currently in a segment
1590
+ string created_date the date/time the segment was created
1591
+ string last_update the date/time the segment was last updated (add or del)
1592
+ string last_reset the date/time the segment was last reset (ie had all members cleared from it)
1593
+ */
1594
+ function listStaticSegments($id) {
1595
+ $params = array();
1596
+ $params["id"] = $id;
1597
+ return $this->callServer("listStaticSegments", $params);
1598
+ }
1599
+
1600
+ /** Save a segment against a list for later use. There is no limit to the number of segments which can be saved. Static Segments <strong>are not</strong> tied
1601
+ * to any merge data, interest groups, etc. They essentially allow you to configure an unlimited number of custom segments which will have standard performance.
1602
+ * When using proper segments, Static Segments are one of the available options for segmentation just as if you used a merge var (and they can be used with other segmentation
1603
+ * options), though performance may degrade at that point.
1604
+ *
1605
+ * @section List Related
1606
+ *
1607
+ * @param string $id the list id to connect to. Get by calling lists()
1608
+ * @param string $name a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error
1609
+ * @return int the id of the new segment, otherwise an error will be thrown.
1610
+ */
1611
+ function listStaticSegmentAdd($id, $name) {
1612
+ $params = array();
1613
+ $params["id"] = $id;
1614
+ $params["name"] = $name;
1615
+ return $this->callServer("listStaticSegmentAdd", $params);
1616
+ }
1617
+
1618
+ /** Resets a static segment - removes <strong>all</strong> members from the static segment. Note: does not actually affect list member data
1619
+ *
1620
+ * @section List Related
1621
+ *
1622
+ * @param string $id the list id to connect to. Get by calling lists()
1623
+ * @param int $seg_id the id of the static segment to reset - get from listStaticSegments()
1624
+ * @return bool true if it worked, otherwise an error is thrown.
1625
+ */
1626
+ function listStaticSegmentReset($id, $seg_id) {
1627
+ $params = array();
1628
+ $params["id"] = $id;
1629
+ $params["seg_id"] = $seg_id;
1630
+ return $this->callServer("listStaticSegmentReset", $params);
1631
+ }
1632
+
1633
+ /** Delete a static segment. Note that this will, of course, remove any member affiliations with the segment
1634
+ *
1635
+ * @section List Related
1636
+ *
1637
+ * @param string $id the list id to connect to. Get by calling lists()
1638
+ * @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
1639
+ * @return bool true if it worked, otherwise an error is thrown.
1640
+ */
1641
+ function listStaticSegmentDel($id, $seg_id) {
1642
+ $params = array();
1643
+ $params["id"] = $id;
1644
+ $params["seg_id"] = $seg_id;
1645
+ return $this->callServer("listStaticSegmentDel", $params);
1646
+ }
1647
+
1648
+ /** Add list members to a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list
1649
+ * in order to be included - this <strong>will not</strong> subscribe them to the list!
1650
+ *
1651
+ * @section List Related
1652
+ *
1653
+ * @param string $id the list id to connect to. Get by calling lists()
1654
+ * @param int $seg_id the id of the static segment to modify - get from listStaticSegments()
1655
+ * @param array $batch an array of email addresses and/or unique_ids to add to the segment
1656
+ * @return array an array with the results of the operation
1657
+ int success the total number of successful updates (will include members already in the segment)
1658
+ array errors error data including:
1659
+ string email address the email address in question
1660
+ string code the error code
1661
+ string msg the full error message
1662
+ */
1663
+ function listStaticSegmentMembersAdd($id, $seg_id, $batch) {
1664
+ $params = array();
1665
+ $params["id"] = $id;
1666
+ $params["seg_id"] = $seg_id;
1667
+ $params["batch"] = $batch;
1668
+ return $this->callServer("listStaticSegmentMembersAdd", $params);
1669
+ }
1670
+
1671
+ /** Remove list members from a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list
1672
+ * in order to be removed - this <strong>will not</strong> unsubscribe them from the list!
1673
+ *
1674
+ * @section List Related
1675
+ *
1676
+ * @param string $id the list id to connect to. Get by calling lists()
1677
+ * @param int $seg_id the id of the static segment to delete - get from listStaticSegments()
1678
+ * @param array $batch an array of email addresses and/or unique_ids to remove from the segment
1679
+ * @return array an array with the results of the operation
1680
+ int success the total number of succesful removals
1681
+ array errors error data including:
1682
+ string email address the email address in question
1683
+ string code the error code
1684
+ string msg the full error message
1685
+ */
1686
+ function listStaticSegmentMembersDel($id, $seg_id, $batch) {
1687
+ $params = array();
1688
+ $params["id"] = $id;
1689
+ $params["seg_id"] = $seg_id;
1690
+ $params["batch"] = $batch;
1691
+ return $this->callServer("listStaticSegmentMembersDel", $params);
1692
+ }
1693
+
1694
+ /**
1695
+ * Subscribe the provided email to a list. By default this sends a confirmation email - you will not see new members until the link contained in it is clicked!
1696
+ *
1697
+ * @section List Related
1698
+ *
1699
+ * @example mcapi_listSubscribe.php
1700
+ * @example json_listSubscribe.php
1701
+ * @example xml-rpc_listSubscribe.php
1702
+ *
1703
+ * @param string $id the list id to connect to. Get by calling lists()
1704
+ * @param string $email_address the email address to subscribe
1705
+ * @param array $merge_vars optional merges for the email (FNAME, LNAME, etc.) (see examples below for handling "blank" arrays). Note that a merge field can only hold up to 255 bytes. Also, there are a few "special" keys:
1706
+ string EMAIL set this to change the email address. This is only respected on calls using update_existing or when passed to listUpdateMember()
1707
+ string NEW-EMAIL set this to change the email address. This is only respected on calls using update_existing or when passed to listUpdateMember(). Required to change via listBatchSubscribe() - EMAIL takes precedence on other calls, though either will work.
1708
+ array GROUPINGS Set Interest Groups by Grouping. Each element in this array should be an array containing the "groups" parameter which contains a comma delimited list of Interest Groups to add. Commas in Interest Group names should be escaped with a backslash. ie, "," =&gt; "\," and either an "id" or "name" parameter to specify the Grouping - get from listInterestGroupings()
1709
+ string OPTIN_IP Set the Opt-in IP field. <em>Abusing this may cause your account to be suspended.</em> We do validate this and it must not be a private IP address.
1710
+ string OPTIN_TIME Set the Opt-in Time field. <em>Abusing this may cause your account to be suspended.</em> We do validate this and it must be a valid date. Use YYYY-MM-DD HH:ii:ss to be safe. Generally, though, anything strtotime() understands we'll understand - <a href="http://us2.php.net/strtotime" target="_blank">http://us2.php.net/strtotime</a>
1711
+ array MC_LOCATION Set the members geographic location. By default if this merge field exists, we'll update using the optin_ip if it exists. If the array contains LATITUDE and LONGITUDE keys, they will be used. NOTE - this will slow down each subscribe call a bit, especially for lat/lng pairs in sparsely populated areas. Currently our automated background processes can and will overwrite this based on opens and clicks.
1712
+
1713
+ <strong>Handling Field Data Types</strong> - most fields you can just pass a string and all is well. For some, though, that is not the case...
1714
+ Field values should be formatted as follows:
1715
+ string address For the string version of an Address, the fields should be delimited by <strong>2</strong> spaces. Address 2 can be skipped. The Country should be a 2 character ISO-3166-1 code and will default to your default country if not set
1716
+ array address For the array version of an Address, the requirements for Address 2 and Country are the same as with the string version. Then simply pass us an array with the keys <strong>addr1</strong>, <strong>addr2</strong>, <strong>city</strong>, <strong>state</strong>, <strong>zip</strong>, <strong>country</strong> and appropriate values for each
1717
+
1718
+ string birthday the month and day of birth, passed as MM/DD
1719
+ array birthday the month and day of birth, passed in an array using the keys <strong>month</strong> and <strong>day</strong>
1720
+
1721
+ string date use YYYY-MM-DD to be safe. Generally, though, anything strtotime() understands we'll understand - <a href="http://us2.php.net/strtotime" target="_blank">http://us2.php.net/strtotime</a>
1722
+ string dropdown can be a normal string - we <em>will</em> validate that the value is a valid option
1723
+ string image must be a valid, existing url. we <em>will</em> check its existence
1724
+ string multi_choice can be a normal string - we <em>will</em> validate that the value is a valid option
1725
+ double number pass in a valid number - anything else will turn in to zero (0). Note, this will be rounded to 2 decimal places
1726
+ string phone If your account has the US Phone numbers option set, this <em>must</em> be in the form of NPA-NXX-LINE (404-555-1212). If not, we assume an International number and will simply set the field with what ever number is passed in.
1727
+ string website This is a standard string, but we <em>will</em> verify that it looks like a valid URL
1728
+ string zip A U.S. zip code. We'll validate this is a 4 or 5 digit number.
1729
+
1730
+ * @param string $email_type optional email type preference for the email (html, text, or mobile defaults to html)
1731
+ * @param bool $double_optin optional flag to control whether a double opt-in confirmation message is sent, defaults to true. <em>Abusing this may cause your account to be suspended.</em>
1732
+ * @param bool $update_existing optional flag to control whether existing subscribers should be updated instead of throwing an error, defaults to false
1733
+ * @param bool $replace_interests optional flag to determine whether we replace the interest groups with the groups provided or we add the provided groups to the member's interest groups (optional, defaults to true)
1734
+ * @param bool $send_welcome optional if your double_optin is false and this is true, we will send your lists Welcome Email if this subscribe succeeds - this will *not* fire if we end up updating an existing subscriber. If double_optin is true, this has no effect. defaults to false.
1735
+ * @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object (see below)
1736
+ */
1737
+ function listSubscribe($id, $email_address, $merge_vars=NULL, $email_type='html', $double_optin=true, $update_existing=false, $replace_interests=true, $send_welcome=false) {
1738
+ $params = array();
1739
+ $params["id"] = $id;
1740
+ $params["email_address"] = $email_address;
1741
+ $params["merge_vars"] = $merge_vars;
1742
+ $params["email_type"] = $email_type;
1743
+ $params["double_optin"] = $double_optin;
1744
+ $params["update_existing"] = $update_existing;
1745
+ $params["replace_interests"] = $replace_interests;
1746
+ $params["send_welcome"] = $send_welcome;
1747
+ return $this->callServer("listSubscribe", $params);
1748
+ }
1749
+
1750
+ /**
1751
+ * Unsubscribe the given email address from the list
1752
+ *
1753
+ * @section List Related
1754
+ * @example mcapi_listUnsubscribe.php
1755
+ * @example xml-rpc_listUnsubscribe.php
1756
+ *
1757
+ * @param string $id the list id to connect to. Get by calling lists()
1758
+ * @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
1759
+ * @param boolean $delete_member flag to completely delete the member from your list instead of just unsubscribing, default to false
1760
+ * @param boolean $send_goodbye flag to send the goodbye email to the email address, defaults to true
1761
+ * @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true
1762
+ * @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object (see below)
1763
+ */
1764
+ function listUnsubscribe($id, $email_address, $delete_member=false, $send_goodbye=true, $send_notify=true) {
1765
+ $params = array();
1766
+ $params["id"] = $id;
1767
+ $params["email_address"] = $email_address;
1768
+ $params["delete_member"] = $delete_member;
1769
+ $params["send_goodbye"] = $send_goodbye;
1770
+ $params["send_notify"] = $send_notify;
1771
+ return $this->callServer("listUnsubscribe", $params);
1772
+ }
1773
+
1774
+ /**
1775
+ * Edit the email address, merge fields, and interest groups for a list member. If you are doing a batch update on lots of users,
1776
+ * consider using listBatchSubscribe() with the update_existing and possible replace_interests parameter.
1777
+ *
1778
+ * @section List Related
1779
+ * @example mcapi_listUpdateMember.php
1780
+ *
1781
+ * @param string $id the list id to connect to. Get by calling lists()
1782
+ * @param string $email_address the current email address of the member to update OR the "id" for the member returned from listMemberInfo, Webhooks, and Campaigns
1783
+ * @param array $merge_vars array of new field values to update the member with. See merge_vars in listSubscribe() for details.
1784
+ * @param string $email_type change the email type preference for the member ("html", "text", or "mobile"). Leave blank to keep the existing preference (optional)
1785
+ * @param boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true)
1786
+ * @return boolean true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object
1787
+ */
1788
+ function listUpdateMember($id, $email_address, $merge_vars, $email_type='', $replace_interests=true) {
1789
+ $params = array();
1790
+ $params["id"] = $id;
1791
+ $params["email_address"] = $email_address;
1792
+ $params["merge_vars"] = $merge_vars;
1793
+ $params["email_type"] = $email_type;
1794
+ $params["replace_interests"] = $replace_interests;
1795
+ return $this->callServer("listUpdateMember", $params);
1796
+ }
1797
+
1798
+ /**
1799
+ * Subscribe a batch of email addresses to a list at once. If you are using a serialized version of the API, we strongly suggest that you
1800
+ * only run this method as a POST request, and <em>not</em> a GET request. Maximum batch sizes vary based on the amount of data in each record,
1801
+ * though you should cap them at 5k - 10k records, depending on your experience. These calls are also long, so be sure you increase your timeout values.
1802
+ *
1803
+ * @section List Related
1804
+ *
1805
+ * @example mcapi_listBatchSubscribe.php
1806
+ * @example xml-rpc_listBatchSubscribe.php
1807
+ *
1808
+ * @param string $id the list id to connect to. Get by calling lists()
1809
+ * @param array $batch an array of structs for each address to import with two special keys: "EMAIL" for the email address, and "EMAIL_TYPE" for the email type option (html, text, or mobile)
1810
+ * @param boolean $double_optin flag to control whether to send an opt-in confirmation email - defaults to true
1811
+ * @param boolean $update_existing flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error)
1812
+ * @param boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true)
1813
+ * @return array Array of result counts and any errors that occurred
1814
+ int add_count Number of email addresses that were succesfully added
1815
+ int update_count Number of email addresses that were succesfully updated
1816
+ int error_count Number of email addresses that failed during addition/updating
1817
+ array errors error data including:
1818
+ string email address the email address in question
1819
+ int code the error code
1820
+ string message the full error message
1821
+ */
1822
+ function listBatchSubscribe($id, $batch, $double_optin=true, $update_existing=false, $replace_interests=true) {
1823
+ $params = array();
1824
+ $params["id"] = $id;
1825
+ $params["batch"] = $batch;
1826
+ $params["double_optin"] = $double_optin;
1827
+ $params["update_existing"] = $update_existing;
1828
+ $params["replace_interests"] = $replace_interests;
1829
+ return $this->callServer("listBatchSubscribe", $params);
1830
+ }
1831
+
1832
+ /**
1833
+ * Unsubscribe a batch of email addresses to a list
1834
+ *
1835
+ * @section List Related
1836
+ * @example mcapi_listBatchUnsubscribe.php
1837
+ *
1838
+ * @param string $id the list id to connect to. Get by calling lists()
1839
+ * @param array $emails array of email addresses to unsubscribe
1840
+ * @param boolean $delete_member flag to completely delete the member from your list instead of just unsubscribing, default to false
1841
+ * @param boolean $send_goodbye flag to send the goodbye email to the email addresses, defaults to true
1842
+ * @param boolean $send_notify flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to false
1843
+ * @return array Array of result counts and any errors that occurred
1844
+ int success_count Number of email addresses that were succesfully added/updated
1845
+ int error_count Number of email addresses that failed during addition/updating
1846
+ array errors error data including:
1847
+ string email address the email address in question
1848
+ int code the error code
1849
+ string message the full error message
1850
+
1851
+ */
1852
+ function listBatchUnsubscribe($id, $emails, $delete_member=false, $send_goodbye=true, $send_notify=false) {
1853
+ $params = array();
1854
+ $params["id"] = $id;
1855
+ $params["emails"] = $emails;
1856
+ $params["delete_member"] = $delete_member;
1857
+ $params["send_goodbye"] = $send_goodbye;
1858
+ $params["send_notify"] = $send_notify;
1859
+ return $this->callServer("listBatchUnsubscribe", $params);
1860
+ }
1861
+
1862
+ /**
1863
+ * Get all of the list members for a list that are of a particular status. Are you trying to get a dump including lots of merge
1864
+ * data or specific members of a list? If so, checkout the <a href="/export">Export API</a>
1865
+ *
1866
+ * @section List Related
1867
+ * @example mcapi_listMembers.php
1868
+ *
1869
+ * @param string $id the list id to connect to. Get by calling lists()
1870
+ * @param string $status the status to get members for - one of(subscribed, unsubscribed, <a target="_blank" href="http://eepurl.com/gWOO">cleaned</a>, updated), defaults to subscribed
1871
+ * @param string $since optional pull all members whose status (subscribed/unsubscribed/cleaned) has changed or whose profile (updated) has changed since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)
1872
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1873
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 15000
1874
+ * @param string $sort_dir optional ASC for ascending, DESC for descending. defaults to ASC even if an invalid value is encountered.
1875
+ * @return array Array of a the total records match and matching list member data for this page (see Returned Fields for details)
1876
+ int total the total matching records
1877
+ array data the data for each member, including:
1878
+ string email Member email address
1879
+ date timestamp timestamp of their associated status date (subscribed, unsubscribed, cleaned, or updated) in GMT
1880
+ string reason For unsubscribes only - the reason collected for the unsubscribe. If populated, one of 'NORMAL','NOSIGNUP','INAPPROPRIATE','SPAM','OTHER'
1881
+ string reason_text For unsubscribes only - if the reason is OTHER, the text entered.
1882
+ */
1883
+ function listMembers($id, $status='subscribed', $since=NULL, $start=0, $limit=100, $sort_dir='ASC') {
1884
+ $params = array();
1885
+ $params["id"] = $id;
1886
+ $params["status"] = $status;
1887
+ $params["since"] = $since;
1888
+ $params["start"] = $start;
1889
+ $params["limit"] = $limit;
1890
+ $params["sort_dir"] = $sort_dir;
1891
+ return $this->callServer("listMembers", $params);
1892
+ }
1893
+
1894
+ /**
1895
+ * Get all the information for particular members of a list
1896
+ *
1897
+ * @section List Related
1898
+ * @example mcapi_listMemberInfo.php
1899
+ * @example xml-rpc_listMemberInfo.php
1900
+ *
1901
+ * @param string $id the list id to connect to. Get by calling lists()
1902
+ * @param array $email_address an array of up to 50 email addresses to get information for OR the "id"(s) for the member returned from listMembers, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).
1903
+ * @return array array of list members with their info in an array (see Returned Fields for details)
1904
+ int success the number of subscribers successfully found on the list
1905
+ int errors the number of subscribers who were not found on the list
1906
+ array data an array of arrays where each one has member info:
1907
+ string id The unique id for this email address on an account
1908
+ string email The email address associated with this record
1909
+ string email_type The type of emails this customer asked to get: html, text, or mobile
1910
+ array merges An associative array of all the merge tags and the data for those tags for this email address. <em>Note</em>: Interest Groups are returned as comma delimited strings - if a group name contains a comma, it will be escaped with a backslash. ie, "," =&gt; "\,". Groupings will be returned with their "id" and "name" as well as a "groups" field formatted just like Interest Groups
1911
+ string status The subscription status for this email address, either pending, subscribed, unsubscribed, or cleaned
1912
+ string ip_signup IP Address this address signed up from. This may be blank if single optin is used.
1913
+ string timestamp_signup The date/time the double optin was initiated. This may be blank if single optin is used.
1914
+ string ip_opt IP Address this address opted in from.
1915
+ string timestamp_opt The date/time the optin completed
1916
+ int member_rating the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
1917
+ string campaign_id If the user is unsubscribed and they unsubscribed from a specific campaign, that campaign_id will be listed, otherwise this is not returned.
1918
+ array lists An associative array of the other lists this member belongs to - the key is the list id and the value is their status in that list.
1919
+ string timestamp The date/time this email address entered it's current status
1920
+ string info_changed The last time this record was changed. If the record is old enough, this may be blank.
1921
+ int web_id The Member id used in our web app, allows you to create a link directly to it
1922
+ bool is_gmonkey Whether the member is a <a href="http://mailchimp.com/features/golden-monkeys/" target="_blank">Golden Monkey</a> or not.
1923
+ array geo the geographic information if we have it. including:
1924
+ string latitude the latitude
1925
+ string longitude the longitude
1926
+ string gmtoff GMT offset
1927
+ string dstoff GMT offset during daylight savings (if DST not observered, will be same as gmtoff
1928
+ string timezone the timezone we've place them in
1929
+ string cc 2 digit ISO-3166 country code
1930
+ string region generally state, province, or similar
1931
+ array clients the client we've tracked the address as using with two keys:
1932
+ string name the common name of the client
1933
+ string icon_url a url representing a path to an icon representing this client
1934
+ array static_segments static segments the member is a part of including:
1935
+ int id the segment id
1936
+ string name the name given to the segment
1937
+ string added the date the member was added
1938
+ */
1939
+ function listMemberInfo($id, $email_address) {
1940
+ $params = array();
1941
+ $params["id"] = $id;
1942
+ $params["email_address"] = $email_address;
1943
+ return $this->callServer("listMemberInfo", $params);
1944
+ }
1945
+
1946
+ /**
1947
+ * Get the most recent 100 activities for particular list members (open, click, bounce, unsub, abuse, sent to)
1948
+ *
1949
+ * @section List Related
1950
+ *
1951
+ * @param string $id the list id to connect to. Get by calling lists()
1952
+ * @param array $email_address an array of up to 50 email addresses to get information for OR the "id"(s) for the member returned from listMembers, Webhooks, and Campaigns.
1953
+ * @return array array of data and success/error counts
1954
+ int success the number of subscribers successfully found on the list
1955
+ int errors the number of subscribers who were not found on the list
1956
+ array data an array of arrays where each activity record has:
1957
+ string action The action name, one of: open, click, bounce, unsub, abuse, sent
1958
+ string timestamp The date/time of the action
1959
+ string url For click actions, the url clicked, otherwise this is empty
1960
+ string bounce_type For bounce actions, the bounce type, otherwise this is empty
1961
+ string campaign_id The campaign id the action was related to, if it exists - otherwise empty (ie, direct unsub from list)
1962
+ */
1963
+ function listMemberActivity($id, $email_address) {
1964
+ $params = array();
1965
+ $params["id"] = $id;
1966
+ $params["email_address"] = $email_address;
1967
+ return $this->callServer("listMemberActivity", $params);
1968
+ }
1969
+
1970
+ /**
1971
+ * Get all email addresses that complained about a given campaign
1972
+ *
1973
+ * @section List Related
1974
+ *
1975
+ * @example mcapi_listAbuseReports.php
1976
+ *
1977
+ * @param string $id the list id to pull abuse reports for (can be gathered using lists())
1978
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
1979
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000
1980
+ * @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
1981
+ * @return array the total of all reports and the specific reports reports this page
1982
+ int total the total number of matching abuse reports
1983
+ array data the actual data for each reports, including:
1984
+ string date date/time the abuse report was received and processed
1985
+ string email the email address that reported abuse
1986
+ string campaign_id the unique id for the campaign that report was made against
1987
+ string type an internal type generally specifying the orginating mail provider - may not be useful outside of filling report views
1988
+ */
1989
+ function listAbuseReports($id, $start=0, $limit=500, $since=NULL) {
1990
+ $params = array();
1991
+ $params["id"] = $id;
1992
+ $params["start"] = $start;
1993
+ $params["limit"] = $limit;
1994
+ $params["since"] = $since;
1995
+ return $this->callServer("listAbuseReports", $params);
1996
+ }
1997
+
1998
+ /**
1999
+ * Access the Growth History by Month for a given list.
2000
+ *
2001
+ * @section List Related
2002
+ *
2003
+ * @example mcapi_listGrowthHistory.php
2004
+ *
2005
+ * @param string $id the list id to connect to. Get by calling lists()
2006
+ * @return array array of months and growth
2007
+ string month The Year and Month in question using YYYY-MM format
2008
+ int existing number of existing subscribers to start the month
2009
+ int imports number of subscribers imported during the month
2010
+ int optins number of subscribers who opted-in during the month
2011
+ */
2012
+ function listGrowthHistory($id) {
2013
+ $params = array();
2014
+ $params["id"] = $id;
2015
+ return $this->callServer("listGrowthHistory", $params);
2016
+ }
2017
+
2018
+ /**
2019
+ * Access up to the previous 180 days of daily detailed aggregated activity stats for a given list
2020
+ *
2021
+ * @section List Related
2022
+ *
2023
+ *
2024
+ * @param string $id the list id to connect to. Get by calling lists()
2025
+ * @return array array of array of daily values, each containing:
2026
+ string day The day in YYYY-MM-DD
2027
+ int emails_sent number of emails sent to the list
2028
+ int unique_opens number of unique opens for the list
2029
+ int recipient_clicks number of clicks for the list
2030
+ int hard_bounce number of hard bounces for the list
2031
+ int soft_bounce number of soft bounces for the list
2032
+ int abuse_reports number of abuse reports for the list
2033
+ int subs number of double optin subscribes for the list
2034
+ int unsubs number of manual unsubscribes for the list
2035
+ int other_adds number of non-double optin subscribes for the list (manual, API, or import)
2036
+ int other_removes number of non-manual unsubscribes for the list (deletions, empties, soft-bounce removals)
2037
+ */
2038
+ function listActivity($id) {
2039
+ $params = array();
2040
+ $params["id"] = $id;
2041
+ return $this->callServer("listActivity", $params);
2042
+ }
2043
+
2044
+ /**
2045
+ * Retrieve the locations (countries) that the list's subscribers have been tagged to based on geocoding their IP address
2046
+ *
2047
+ * @section List Related
2048
+ *
2049
+ * @param string $id the list id to connect to. Get by calling lists()
2050
+ * @return array array of locations
2051
+ string country the country name
2052
+ string cc the 2 digit country code
2053
+ double percent the percent of subscribers in the country
2054
+ double total the total number of subscribers in the country
2055
+ */
2056
+ function listLocations($id) {
2057
+ $params = array();
2058
+ $params["id"] = $id;
2059
+ return $this->callServer("listLocations", $params);
2060
+ }
2061
+
2062
+ /**
2063
+ * Retrieve the clients that the list's subscribers have been tagged as being used based on user agents seen. Made possible by <a href="http://user-agent-string.info" target="_blank">user-agent-string.info</a>
2064
+ *
2065
+ * @section List Related
2066
+ *
2067
+ * @param string $id the list id to connect to. Get by calling lists()
2068
+ * @return array the desktop and mobile user agents in use on the list
2069
+ array desktop desktop user agents and percentages
2070
+ double penetration the percent of desktop clients in use
2071
+ array clients a record for each containing:
2072
+ string client the common name for the client
2073
+ string icon a url to an image representing this client
2074
+ string percent percent of list using the client
2075
+ string members total members using the client
2076
+ array mobile mobile user agents and percentages
2077
+ double penetration the percent of mobile clients in use
2078
+ array clients a record for each containing:
2079
+ string client the common name for the client
2080
+ string icon a url to an image representing this client
2081
+ string percent percent of list using the client
2082
+ string members total members using the client
2083
+ */
2084
+ function listClients($id) {
2085
+ $params = array();
2086
+ $params["id"] = $id;
2087
+ return $this->callServer("listClients", $params);
2088
+ }
2089
+
2090
+ /**
2091
+ * Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created.
2092
+ *
2093
+ * @section Template Related
2094
+ * @example mcapi_templates.php
2095
+ * @example xml-rpc_templates.php
2096
+ *
2097
+ * @param array $types optional the types of templates to return
2098
+ boolean user Custom templates for this user account. Defaults to true.
2099
+ boolean gallery Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false.
2100
+ boolean base Our "start from scratch" extremely basic templates. Defaults to false.
2101
+ * @param string $category optional for Gallery templates only, limit to a specific template category
2102
+ * @param array $inactives optional options to control how inactive templates are returned, if at all
2103
+ boolean include user templates are not deleted, only set inactive. defaults to false.
2104
+ boolean only only include inactive templates. defaults to false.
2105
+ * @return array An array of arrays, one for each template
2106
+ int id Id of the template
2107
+ string name Name of the template
2108
+ string layout Layout of the template - "basic", "left_column", "right_column", or "postcard"
2109
+ string preview_image If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available
2110
+ string date_created The date/time the template was created
2111
+ boolean edit_source Whether or not you are able to edit the source of a template.
2112
+ */
2113
+ function templates($types=array (
2114
+ ), $category=NULL, $inactives=array (
2115
+ )) {
2116
+ $params = array();
2117
+ $params["types"] = $types;
2118
+ $params["category"] = $category;
2119
+ $params["inactives"] = $inactives;
2120
+ return $this->callServer("templates", $params);
2121
+ }
2122
+
2123
+ /**
2124
+ * Pull details for a specific template to help support editing
2125
+ *
2126
+ * @section Template Related
2127
+ *
2128
+ * @param int $tid the template id - get from templates()
2129
+ * @param string $type optional the template type to load - one of 'user', 'gallery', 'base', defaults to user.
2130
+ * @return array an array of info to be used when editing
2131
+ array default_content the default content broken down into the named editable sections for the template - dependant upon template, so not documented
2132
+ array sections the valid editable section names - dependant upon template, so not documented
2133
+ string source the full source of the template as if you exported it via our template editor
2134
+ string preview similar to the source, but the rendered version of the source from our popup preview
2135
+ */
2136
+ function templateInfo($tid, $type='user') {
2137
+ $params = array();
2138
+ $params["tid"] = $tid;
2139
+ $params["type"] = $type;
2140
+ return $this->callServer("templateInfo", $params);
2141
+ }
2142
+
2143
+ /**
2144
+ * Create a new user template, <strong>NOT</strong> campaign content. These templates can then be applied while creating campaigns.
2145
+ *
2146
+ * @section Template Related
2147
+ * @example mcapi_create_template.php
2148
+ * @example xml-rpc_create_template.php
2149
+ *
2150
+ * @param string $name the name for the template - names must be unique and a max of 50 bytes
2151
+ * @param string $html a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href="http://www.mailchimp.com/resources/email-template-language/" target="_blank">template language</a>.
2152
+ * @return int the new template id, otherwise an error is thrown.
2153
+ */
2154
+ function templateAdd($name, $html) {
2155
+ $params = array();
2156
+ $params["name"] = $name;
2157
+ $params["html"] = $html;
2158
+ return $this->callServer("templateAdd", $params);
2159
+ }
2160
+
2161
+ /**
2162
+ * Replace the content of a user template, <strong>NOT</strong> campaign content.
2163
+ *
2164
+ * @section Template Related
2165
+ *
2166
+ * @param int $id the id of the user template to update
2167
+ * @param array $values the values to updates - while both are optional, at least one should be provided. Both can be updated at the same time.
2168
+ string name optional the name for the template - names must be unique and a max of 50 bytes
2169
+ string html optional a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href="http://www.mailchimp.com/resources/email-template-language/" target="_blank">template language</a>.
2170
+
2171
+ * @return boolean true if the template was updated, otherwise an error will be thrown
2172
+ */
2173
+ function templateUpdate($id, $values) {
2174
+ $params = array();
2175
+ $params["id"] = $id;
2176
+ $params["values"] = $values;
2177
+ return $this->callServer("templateUpdate", $params);
2178
+ }
2179
+
2180
+ /**
2181
+ * Delete (deactivate) a user template
2182
+ *
2183
+ * @section Template Related
2184
+ *
2185
+ * @param int $id the id of the user template to delete
2186
+ * @return boolean true if the template was deleted, otherwise an error will be thrown
2187
+ */
2188
+ function templateDel($id) {
2189
+ $params = array();
2190
+ $params["id"] = $id;
2191
+ return $this->callServer("templateDel", $params);
2192
+ }
2193
+
2194
+ /**
2195
+ * Undelete (reactivate) a user template
2196
+ *
2197
+ * @section Template Related
2198
+ *
2199
+ * @param int $id the id of the user template to reactivate
2200
+ * @return boolean true if the template was deleted, otherwise an error will be thrown
2201
+ */
2202
+ function templateUndel($id) {
2203
+ $params = array();
2204
+ $params["id"] = $id;
2205
+ return $this->callServer("templateUndel", $params);
2206
+ }
2207
+
2208
+ /**
2209
+ * Retrieve lots of account information including payments made, plan info, some account stats, installed modules,
2210
+ * contact info, and more. No private information like Credit Card numbers is available.
2211
+ *
2212
+ * @section Helper
2213
+ *
2214
+ * @param array $exclude optional defaults to nothing for backwards compatibility. Allows controlling which extra arrays are returned since they can slow down calls. Valid keys are "modules", "orders", "rewards-credits", "rewards-inspections", "rewards-referrals", and "rewards-applied". Hint: "rewards-referrals" is typically the culprit. To avoid confusion, if data is excluded, the corresponding key <strong>will not be returned at all</strong>.
2215
+ * @return array containing the details for the account tied to this API Key
2216
+ string username The Account username
2217
+ string user_id The Account user unique id (for building some links)
2218
+ bool is_trial Whether the Account is in Trial mode (can only send campaigns to less than 100 emails)
2219
+ bool is_approved Whether the Account has been approved for purchases
2220
+ bool has_activated Whether the Account has been activated
2221
+ string timezone The timezone for the Account - default is "US/Eastern"
2222
+ string plan_type Plan Type - "monthly", "payasyougo", or "free"
2223
+ int plan_low <em>only for Monthly plans</em> - the lower tier for list size
2224
+ int plan_high <em>only for Monthly plans</em> - the upper tier for list size
2225
+ string plan_start_date <em>only for Monthly plans</em> - the start date for a monthly plan
2226
+ int emails_left <em>only for Free and Pay-as-you-go plans</em> emails credits left for the account
2227
+ bool pending_monthly Whether the account is finishing Pay As You Go credits before switching to a Monthly plan
2228
+ string first_payment date of first payment
2229
+ string last_payment date of most recent payment
2230
+ int times_logged_in total number of times the account has been logged into via the web
2231
+ string last_login date/time of last login via the web
2232
+ string affiliate_link Monkey Rewards link for our Affiliate program
2233
+ array contact Contact details for the account
2234
+ string fname First Name
2235
+ string lname Last Name
2236
+ string email Email Address
2237
+ string company Company Name
2238
+ string address1 Address Line 1
2239
+ string address2 Address Line 2
2240
+ string city City
2241
+ string state State or Province
2242
+ string zip Zip or Postal Code
2243
+ string country Country name
2244
+ string url Website URL
2245
+ string phone Phone number
2246
+ string fax Fax number
2247
+ array modules Addons installed in the account
2248
+ string id An internal module id
2249
+ string name The module name
2250
+ string added The date the module was added
2251
+ array data Any extra data associated with this module as key=>value pairs
2252
+ array orders Order details for the account
2253
+ int order_id The order id
2254
+ string type The order type - either "monthly" or "credits"
2255
+ double amount The order amount
2256
+ string date The order date
2257
+ double credits_used The total credits used
2258
+ array rewards Rewards details for the account including credits & inspections earned, number of referals, referal details, and rewards used
2259
+ int referrals_this_month the total number of referrals this month
2260
+ string notify_on whether or not we notify the user when rewards are earned
2261
+ string notify_email the email address address used for rewards notifications
2262
+ array credits Email credits earned:
2263
+ int this_month credits earned this month
2264
+ int total_earned credits earned all time
2265
+ int remaining credits remaining
2266
+ array inspections Inbox Inspections earned:
2267
+ int this_month credits earned this month
2268
+ int total_earned credits earned all time
2269
+ int remaining credits remaining
2270
+ array referrals All referrals, including:
2271
+ string name the name of the account
2272
+ string email the email address associated with the account
2273
+ string signup_date the signup date for the account
2274
+ string type the source for the referral
2275
+ array applied Applied rewards, including:
2276
+ int value the number of credits user
2277
+ string date the date appplied
2278
+ int order_id the order number credits were applied to
2279
+ string order_desc the order description
2280
+ */
2281
+ function getAccountDetails($exclude=array (
2282
+ )) {
2283
+ $params = array();
2284
+ $params["exclude"] = $exclude;
2285
+ return $this->callServer("getAccountDetails", $params);
2286
+ }
2287
+
2288
+ /**
2289
+ * Retrieve all domains verification records for an account
2290
+ *
2291
+ * @section Helper
2292
+ *
2293
+ * @return array records of domains verification has been attempted for
2294
+ string domain the verified domain
2295
+ string status the status of the verification - either "verified" or "pending"
2296
+ string email the email address used for verification
2297
+ */
2298
+ function getVerifiedDomains() {
2299
+ $params = array();
2300
+ return $this->callServer("getVerifiedDomains", $params);
2301
+ }
2302
+
2303
+ /**
2304
+ * Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content, an existing Campaign Id, or an existing Template Id. Note that this will <strong>not</strong> save anything to or update any of your lists, campaigns, or templates.
2305
+ *
2306
+ * @section Helper
2307
+ * @example xml-rpc_generateText.php
2308
+ *
2309
+ * @param string $type The type of content to parse. Must be one of: "html", "template", "url", "cid" (Campaign Id), or "tid" (Template Id)
2310
+ * @param mixed $content The content to use. For "html" expects a single string value, "template" expects an array like you send to campaignCreate, "url" expects a valid & public URL to pull from, "cid" expects a valid Campaign Id, and "tid" expects a valid Template Id on your account.
2311
+ * @return string the content pass in converted to text.
2312
+ */
2313
+ function generateText($type, $content) {
2314
+ $params = array();
2315
+ $params["type"] = $type;
2316
+ $params["content"] = $content;
2317
+ return $this->callServer("generateText", $params);
2318
+ }
2319
+
2320
+ /**
2321
+ * Send your HTML content to have the CSS inlined and optionally remove the original styles.
2322
+ *
2323
+ * @section Helper
2324
+ * @example xml-rpc_inlineCss.php
2325
+ *
2326
+ * @param string $html Your HTML content
2327
+ * @param bool $strip_css optional Whether you want the CSS &lt;style&gt; tags stripped from the returned document. Defaults to false.
2328
+ * @return string Your HTML content with all CSS inlined, just like if we sent it.
2329
+ */
2330
+ function inlineCss($html, $strip_css=false) {
2331
+ $params = array();
2332
+ $params["html"] = $html;
2333
+ $params["strip_css"] = $strip_css;
2334
+ return $this->callServer("inlineCss", $params);
2335
+ }
2336
+
2337
+ /**
2338
+ * List all the folders for a user account
2339
+ *
2340
+ * @section Folder Related
2341
+ * @example mcapi_folders.php
2342
+ * @example xml-rpc_folders.php
2343
+ *
2344
+ * @param string $type optional the type of folders to return - either "campaign" or "autoresponder". Defaults to "campaign"
2345
+ * @return array Array of folder structs (see Returned Fields for details)
2346
+ int folder_id Folder Id for the given folder, this can be used in the campaigns() function to filter on.
2347
+ string name Name of the given folder
2348
+ string date_created The date/time the folder was created
2349
+ string type The type of the folders being returned, just to make sure you know.
2350
+ */
2351
+ function folders($type='campaign') {
2352
+ $params = array();
2353
+ $params["type"] = $type;
2354
+ return $this->callServer("folders", $params);
2355
+ }
2356
+
2357
+ /**
2358
+ * Add a new folder to file campaigns or autoresponders in
2359
+ *
2360
+ * @section Folder Related
2361
+ * @example mcapi_folderAdd.php
2362
+ * @example xml-rpc_folderAdd.php
2363
+ *
2364
+ * @param string $name a unique name for a folder (max 100 bytes)
2365
+ * @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
2366
+ * @return int the folder_id of the newly created folder.
2367
+ */
2368
+ function folderAdd($name, $type='campaign') {
2369
+ $params = array();
2370
+ $params["name"] = $name;
2371
+ $params["type"] = $type;
2372
+ return $this->callServer("folderAdd", $params);
2373
+ }
2374
+
2375
+ /**
2376
+ * Update the name of a folder for campaigns or autoresponders
2377
+ *
2378
+ * @section Folder Related
2379
+ *
2380
+ * @param int $fid the folder id to update - retrieve from folders()
2381
+ * @param string $name a new, unique name for the folder (max 100 bytes)
2382
+ * @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
2383
+ * @return bool true if the update worked, otherwise an exception is thrown
2384
+ */
2385
+ function folderUpdate($fid, $name, $type='campaign') {
2386
+ $params = array();
2387
+ $params["fid"] = $fid;
2388
+ $params["name"] = $name;
2389
+ $params["type"] = $type;
2390
+ return $this->callServer("folderUpdate", $params);
2391
+ }
2392
+
2393
+ /**
2394
+ * Delete a campaign or autoresponder folder. Note that this will simply make campaigns in the folder appear unfiled, they are not removed.
2395
+ *
2396
+ * @section Folder Related
2397
+ *
2398
+ * @param int $fid the folder id to update - retrieve from folders()
2399
+ * @param string $type optional the type of folder to create - either "campaign" or "autoresponder". Defaults to "campaign"
2400
+ * @return bool true if the delete worked, otherwise an exception is thrown
2401
+ */
2402
+ function folderDel($fid, $type='campaign') {
2403
+ $params = array();
2404
+ $params["fid"] = $fid;
2405
+ $params["type"] = $type;
2406
+ return $this->callServer("folderDel", $params);
2407
+ }
2408
+
2409
+ /**
2410
+ * Retrieve the Ecommerce Orders for an account
2411
+ *
2412
+ * @section Ecommerce
2413
+ *
2414
+ * @param int $start optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
2415
+ * @param int $limit optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500
2416
+ * @param string $since optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong>
2417
+ * @return array the total matching orders and the specific orders for the requested page
2418
+ int total the total matching orders
2419
+ array data the actual data for each order being returned
2420
+ string store_id the store id generated by the plugin used to uniquely identify a store
2421
+ string store_name the store name collected by the plugin - often the domain name
2422
+ string order_id the internal order id the store tracked this order by
2423
+ string email the email address that received this campaign and is associated with this order
2424
+ double order_total the order total
2425
+ double tax_total the total tax for the order (if collected)
2426
+ double ship_total the shipping total for the order (if collected)
2427
+ string order_date the date the order was tracked - from the store if possible, otherwise the GMT time we received it
2428
+ array lines containing the detail of line of the order:
2429
+ int line_num the line number
2430
+ int product_id the product id
2431
+ string product_name the product name
2432
+ string product_sku the sku for the product
2433
+ int product_category_id the category id for the product
2434
+ string product_category_name the category name for the product
2435
+ int qty the quantity ordered
2436
+ double cost the cost of the item
2437
+ */
2438
+ function ecommOrders($start=0, $limit=100, $since=NULL) {
2439
+ $params = array();
2440
+ $params["start"] = $start;
2441
+ $params["limit"] = $limit;
2442
+ $params["since"] = $since;
2443
+ return $this->callServer("ecommOrders", $params);
2444
+ }
2445
+
2446
+ /**
2447
+ * Import Ecommerce Order Information to be used for Segmentation. This will generally be used by ecommerce package plugins
2448
+ * <a href="http://connect.mailchimp.com/category/ecommerce" target="_blank">provided by us or by 3rd part system developers</a>.
2449
+ * @section Ecommerce
2450
+ *
2451
+ * @param array $order an array of information pertaining to the order that has completed. Use the following keys:
2452
+ string id the Order Id
2453
+ string email_id optional (kind of) the Email Id of the subscriber we should attach this order to (see the "mc_eid" query string variable a campaign passes) - either this or <strong>email</strong> is required. If both are provided, email_id takes precedence
2454
+ string email optional (kind of) the Email Address we should attach this order to - either this or <strong>email_id</strong> is required. If both are provided, email_id takes precedence
2455
+ double total The Order Total (ie, the full amount the customer ends up paying)
2456
+ string order_date optional the date of the order - if this is not provided, we will default the date to now
2457
+ double shipping optional the total paid for Shipping Fees
2458
+ double tax optional the total tax paid
2459
+ string store_id a unique id for the store sending the order in (20 bytes max)
2460
+ string store_name optional a "nice" name for the store - typically the base web address (ie, "store.mailchimp.com"). We will automatically update this if it changes (based on store_id)
2461
+ string campaign_id optional the Campaign Id to track this order with (see the "mc_cid" query string variable a campaign passes)
2462
+ array items the individual line items for an order using these keys:
2463
+ <div style="padding-left:30px"><table>
2464
+ int line_num optional the line number of the item on the order. We will generate these if they are not passed
2465
+ int product_id the store's internal Id for the product. Lines that do no contain this will be skipped
2466
+ string sku optional the store's internal SKU for the product. (max 30 bytes)
2467
+ string product_name the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
2468
+ int category_id the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
2469
+ string category_name the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
2470
+ double qty the quantity of the item ordered
2471
+ double cost the cost of a single item (ie, not the extended cost of the line)
2472
+ </table></div>
2473
+ * @return bool true if the data is saved, otherwise an error is thrown.
2474
+ */
2475
+ function ecommOrderAdd($order) {
2476
+ $params = array();
2477
+ $params["order"] = $order;
2478
+ return $this->callServer("ecommOrderAdd", $params);
2479
+ }
2480
+
2481
+ /**
2482
+ * Delete Ecommerce Order Information used for segmentation. This will generally be used by ecommerce package plugins
2483
+ * <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers.
2484
+ * @section Ecommerce
2485
+ *
2486
+ * @param string $store_id the store id the order belongs to
2487
+ * @param string $order_id the order id (generated by the store) to delete
2488
+ * @return bool true if an order is deleted, otherwise an error is thrown.
2489
+ */
2490
+ function ecommOrderDel($store_id, $order_id) {
2491
+ $params = array();
2492
+ $params["store_id"] = $store_id;
2493
+ $params["order_id"] = $order_id;
2494
+ return $this->callServer("ecommOrderDel", $params);
2495
+ }
2496
+
2497
+ /**
2498
+ * Retrieve all List Ids a member is subscribed to.
2499
+ *
2500
+ * @section Helper
2501
+ *
2502
+ * @param string $email_address the email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
2503
+ * @return array An array of list_ids the member is subscribed to.
2504
+ */
2505
+ function listsForEmail($email_address) {
2506
+ $params = array();
2507
+ $params["email_address"] = $email_address;
2508
+ return $this->callServer("listsForEmail", $params);
2509
+ }
2510
+
2511
+ /**
2512
+ * Retrieve all Campaigns Ids a member was sent
2513
+ *
2514
+ * @section Helper
2515
+ *
2516
+ * @param string $email_address the email address to unsubscribe OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns
2517
+ * @param array $options optional extra options to modify the returned data.
2518
+ string list_id optional A list_id to limit the campaigns to
2519
+ bool verbose optional Whether or not to return verbose data (beta - this will change the return format into something undocumented, but consistent). defaults to false
2520
+ * @return array An array of campaign_ids the member received
2521
+ */
2522
+ function campaignsForEmail($email_address, $options=NULL) {
2523
+ $params = array();
2524
+ $params["email_address"] = $email_address;
2525
+ $params["options"] = $options;
2526
+ return $this->callServer("campaignsForEmail", $params);
2527
+ }
2528
+
2529
+ /**
2530
+ * Return the current Chimp Chatter messages for an account.
2531
+ *
2532
+ * @section Helper
2533
+ *
2534
+ * @return array An array of chatter messages and properties
2535
+ string message The chatter message
2536
+ string type The type of the message - one of lists:new-subscriber, lists:unsubscribes, lists:profile-updates, campaigns:facebook-likes, campaigns:facebook-comments, campaigns:forward-to-friend, lists:imports, or campaigns:inbox-inspections
2537
+ string url a url into the web app that the message could link to
2538
+ string list_id the list_id a message relates to, if applicable
2539
+ string campaign_id the list_id a message relates to, if applicable
2540
+ string update_time The date/time the message was last updated
2541
+ */
2542
+ function chimpChatter() {
2543
+ $params = array();
2544
+ return $this->callServer("chimpChatter", $params);
2545
+ }
2546
+
2547
+ /**
2548
+ * Search account wide or on a specific list using the specified query terms
2549
+ *
2550
+ * @section Helper
2551
+ *
2552
+ * @param string $query terms to search on
2553
+ * @param string optional $id the list id to limit the search to. Get by calling lists()
2554
+ * @param int offset optional the paging offset to use if more than 100 records match
2555
+ * @return array An array of both exact matches and partial matches over a full search
2556
+ * array exact_matches
2557
+ * int total total members matching
2558
+ * array members - each entry will match the data format for a single member as returned by listMemberInfo()
2559
+ * array full_search
2560
+ * int total total members matching
2561
+ * array members - each entry will match the data format for a single member as returned by listMemberInfo()
2562
+ */
2563
+ function searchMembers($query, $id=NULL, $offset=0) {
2564
+ $params = array();
2565
+ $params["query"] = $query;
2566
+ $params["id"] = $id;
2567
+ $params["offset"] = $offset;
2568
+ return $this->callServer("searchMembers", $params);
2569
+ }
2570
+
2571
+ /**
2572
+ * Search all campaigns for the specified query terms
2573
+ *
2574
+ * @section Helper
2575
+ *
2576
+ * @param string $query terms to search on
2577
+ * @param int offset optional the paging offset to use if more than 100 records match
2578
+ * @param string snip_start optional by default clear text is returned. To have the match highlighted with something (like a strong HTML tag), <strong>both</strong> this and "snip_end" must be passed. You're on your own to not break the tags - 25 character max.
2579
+ * @param string snip_end optional see "snip_start" above.
2580
+ * @return array An array of both exact matches and partial matches over a full search
2581
+ * array exact_matches
2582
+ * int total total members matching
2583
+ * array members - each entry will match the data format for a single member as returned by listMemberInfo()
2584
+ * array full_search
2585
+ * int total total members matching
2586
+ * array results - each entry will match the data format for a single member as returned by listMemberInfo()
2587
+ */
2588
+ function searchCampaigns($query, $offset=0, $snip_start=NULL, $snip_end=NULL) {
2589
+ $params = array();
2590
+ $params["query"] = $query;
2591
+ $params["offset"] = $offset;
2592
+ $params["snip_start"] = $snip_start;
2593
+ $params["snip_end"] = $snip_end;
2594
+ return $this->callServer("searchCampaigns", $params);
2595
+ }
2596
+
2597
+ /**
2598
+ * Retrieve a list of all MailChimp API Keys for this User
2599
+ *
2600
+ * @section Security Related
2601
+ * @example xml-rpc_apikeyAdd.php
2602
+ * @example mcapi_apikeyAdd.php
2603
+ *
2604
+ * @param string $username Your MailChimp user name
2605
+ * @param string $password Your MailChimp password
2606
+ * @param boolean $expired optional - whether or not to include expired keys, defaults to false
2607
+ * @return array an array of API keys including:
2608
+ string apikey The api key that can be used
2609
+ string created_at The date the key was created
2610
+ string expired_at The date the key was expired
2611
+ */
2612
+ function apikeys($username, $password, $expired=false) {
2613
+ $params = array();
2614
+ $params["username"] = $username;
2615
+ $params["password"] = $password;
2616
+ $params["expired"] = $expired;
2617
+ return $this->callServer("apikeys", $params);
2618
+ }
2619
+
2620
+ /**
2621
+ * Add an API Key to your account. We will generate a new key for you and return it.
2622
+ *
2623
+ * @section Security Related
2624
+ * @example xml-rpc_apikeyAdd.php
2625
+ *
2626
+ * @param string $username Your MailChimp user name
2627
+ * @param string $password Your MailChimp password
2628
+ * @return string a new API Key that can be immediately used.
2629
+ */
2630
+ function apikeyAdd($username, $password) {
2631
+ $params = array();
2632
+ $params["username"] = $username;
2633
+ $params["password"] = $password;
2634
+ return $this->callServer("apikeyAdd", $params);
2635
+ }
2636
+
2637
+ /**
2638
+ * Expire a Specific API Key. Note that if you expire all of your keys, just visit <a href="http://admin.mailchimp.com/account/api" target="_blank">your API dashboard</a>
2639
+ * to create a new one. If you are trying to shut off access to your account for an old developer, change your
2640
+ * MailChimp password, then expire all of the keys they had access to. Note that this takes effect immediately, so make
2641
+ * sure you replace the keys in any working application before expiring them! Consider yourself warned...
2642
+ *
2643
+ * @section Security Related
2644
+ * @example mcapi_apikeyExpire.php
2645
+ * @example xml-rpc_apikeyExpire.php
2646
+ *
2647
+ * @param string $username Your MailChimp user name
2648
+ * @param string $password Your MailChimp password
2649
+ * @return boolean true if it worked, otherwise an error is thrown.
2650
+ */
2651
+ function apikeyExpire($username, $password) {
2652
+ $params = array();
2653
+ $params["username"] = $username;
2654
+ $params["password"] = $password;
2655
+ return $this->callServer("apikeyExpire", $params);
2656
+ }
2657
+
2658
+ /**
2659
+ * "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note
2660
+ * than unlike most all of our methods, we don't throw an Exception if we are having issues. You will simply receive a different
2661
+ * string back that will explain our view on what is going on.
2662
+ *
2663
+ * @section Helper
2664
+ * @example xml-rpc_ping.php
2665
+ *
2666
+ * @return string returns "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message
2667
+ */
2668
+ function ping() {
2669
+ $params = array();
2670
+ return $this->callServer("ping", $params);
2671
+ }
2672
+
2673
+ /**
2674
+ * Register a mobile device
2675
+ *
2676
+ * @section Mobile
2677
+ *
2678
+ * @param string $mobile_key a valid key identifying your mobile application.
2679
+ * @param array $details the details for the device registration
2680
+ * @return array the method completion status
2681
+ string status The status (success) of the call if it completed. Otherwise an error is thrown.
2682
+ */
2683
+ function deviceRegister($mobile_key, $details) {
2684
+ $params = array();
2685
+ $params["mobile_key"] = $mobile_key;
2686
+ $params["details"] = $details;
2687
+ return $this->callServer("deviceRegister", $params);
2688
+ }
2689
+
2690
+ /**
2691
+ * Unregister a mobile device
2692
+ *
2693
+ * @section Mobile
2694
+ *
2695
+ * @param string $mobile_key a valid key identifying your mobile application.
2696
+ * @param string $device_id the device id used for the device registration
2697
+ * @return array the method completion status
2698
+ string status The status (success) of the call if it completed. Otherwise an error is thrown.
2699
+ */
2700
+ function deviceUnregister($mobile_key, $device_id) {
2701
+ $params = array();
2702
+ $params["mobile_key"] = $mobile_key;
2703
+ $params["device_id"] = $device_id;
2704
+ return $this->callServer("deviceUnregister", $params);
2705
+ }
2706
+
2707
+ /**
2708
+ * Add Golden Monkey(s)
2709
+ *
2710
+ * @section Golden Monkeys
2711
+ *
2712
+ * @param string $id the list id to connect to. Get by calling lists()
2713
+ * @param array $email_address an array of email addresses (max 50) to attempt to flag as Golden Monkeys
2714
+ * @return array an array of API keys including:
2715
+ int success The number of successful adds
2716
+ int errors The number of unsuccessful adds
2717
+ array data details on the errors which occurred
2718
+ string email_address the email address which errored out
2719
+ string error an error message explaining the error
2720
+ */
2721
+ function gmonkeyAdd($id, $email_address) {
2722
+ $params = array();
2723
+ $params["id"] = $id;
2724
+ $params["email_address"] = $email_address;
2725
+ return $this->callServer("gmonkeyAdd", $params);
2726
+ }
2727
+
2728
+ /**
2729
+ * Remove Golden Monkey(s)
2730
+ *
2731
+ * @section Golden Monkeys
2732
+ *
2733
+ * @param string $id the list id to connect to. Get by calling lists()
2734
+ * @param array $email_address an array of email addresses (max 50) to attempt to remove Golden Monkey status from.
2735
+ * @return array an array of API keys including:
2736
+ int success The number of successful removals
2737
+ int errors The number of unsuccessful removals
2738
+ array data details on the errors which occurred
2739
+ string email_address the email address which errored out
2740
+ string error an error message explaining the error
2741
+ */
2742
+ function gmonkeyDel($id, $email_address) {
2743
+ $params = array();
2744
+ $params["id"] = $id;
2745
+ $params["email_address"] = $email_address;
2746
+ return $this->callServer("gmonkeyDel", $params);
2747
+ }
2748
+
2749
+ /**
2750
+ * Retrieve all Golden Monkey(s) for an account
2751
+ *
2752
+ * @section Golden Monkeys
2753
+ *
2754
+ * @return array an array for each Golden Monkey, including:
2755
+ string list_id The id of the List the Member appears on
2756
+ string list_name The name of the List the Member appears on
2757
+ string email The email address of the member
2758
+ string fname IF a FNAME merge field exists on the list, that value for the member
2759
+ string lname IF a LNAME merge field exists on the list, that value for the member
2760
+ int member_rating the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
2761
+ string member_since the datetime the member was added and/or confirmed
2762
+ */
2763
+ function gmonkeyMembers() {
2764
+ $params = array();
2765
+ return $this->callServer("gmonkeyMembers", $params);
2766
+ }
2767
+
2768
+ /**
2769
+ * Retrieve all Activity (opens/clicks) for Golden Monkeys over the past 10 days
2770
+ *
2771
+ * @section Golden Monkeys
2772
+ *
2773
+ * @return array an array for each Golden Monkey, including:
2774
+ string action The action taken - either "open" or "click"
2775
+ string timestamp The datetime the action occurred
2776
+ string url IF the action is a click, the url that was clicked
2777
+ string unique_id The campaign_id of the List the Member appears on
2778
+ string title The campaign title
2779
+ string list_name The name of the List the Member appears on
2780
+ string email The email address of the member
2781
+ string fname IF a FNAME merge field exists on the list, that value for the member
2782
+ string lname IF a LNAME merge field exists on the list, that value for the member
2783
+ int member_rating the rating of the subscriber. This will be 1 - 5 as described <a href="http://eepurl.com/f-2P" target="_blank">here</a>
2784
+ string member_since the datetime the member was added and/or confirmed
2785
+ array geo the geographic information if we have it. including:
2786
+ string latitude the latitude
2787
+ string longitude the longitude
2788
+ string gmtoff GMT offset
2789
+ string dstoff GMT offset during daylight savings (if DST not observered, will be same as gmtoff
2790
+ string timezone the timezone we've place them in
2791
+ string cc 2 digit ISO-3166 country code
2792
+ string region generally state, province, or similar
2793
+ */
2794
+ function gmonkeyActivity() {
2795
+ $params = array();
2796
+ return $this->callServer("gmonkeyActivity", $params);
2797
+ }
2798
+
2799
+ /**
2800
+ * Internal function - proxy method for certain XML-RPC calls | DO NOT CALL
2801
+ * @param mixed Method to call, with any parameters to pass along
2802
+ * @return mixed the result of the call
2803
+ */
2804
+ function callMethod() {
2805
+ $params = array();
2806
+ return $this->callServer("callMethod", $params);
2807
+ }
2808
+
2809
+ /**
2810
+ * Actually connect to the server and call the requested methods, parsing the result
2811
+ * You should never have to call this function manually
2812
+ */
2813
+ function callServer($method, $params) {
2814
+ $dc = "us1";
2815
+ if (strstr($this->api_key,"-")){
2816
+ list($key, $dc) = explode("-",$this->api_key,2);
2817
+ if (!$dc) $dc = "us1";
2818
+ }
2819
+ $host = $dc.".".$this->apiUrl["host"];
2820
+ $params["apikey"] = $this->api_key;
2821
+
2822
+ $this->errorMessage = "";
2823
+ $this->errorCode = "";
2824
+ $sep_changed = false;
2825
+ //sigh, apparently some distribs change this to &amp; by default
2826
+ if (ini_get("arg_separator.output")!="&"){
2827
+ $sep_changed = true;
2828
+ $orig_sep = ini_get("arg_separator.output");
2829
+ ini_set("arg_separator.output", "&");
2830
+ }
2831
+ $post_vars = http_build_query($params);
2832
+ if ($sep_changed){
2833
+ ini_set("arg_separator.output", $orig_sep);
2834
+ }
2835
+
2836
+ $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
2837
+ $payload .= "Host: " . $host . "\r\n";
2838
+ $payload .= "User-Agent: MCAPI/" . $this->version ."\r\n";
2839
+ $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
2840
+ $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
2841
+ $payload .= "Connection: close \r\n\r\n";
2842
+ $payload .= $post_vars;
2843
+
2844
+ ob_start();
2845
+ if ($this->secure){
2846
+ $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
2847
+ } else {
2848
+ $sock = fsockopen($host, 80, $errno, $errstr, 30);
2849
+ }
2850
+ if(!$sock) {
2851
+ $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
2852
+ $this->errorCode = "-99";
2853
+ ob_end_clean();
2854
+ return false;
2855
+ }
2856
+
2857
+ $response = "";
2858
+ fwrite($sock, $payload);
2859
+ stream_set_timeout($sock, $this->timeout);
2860
+ $info = stream_get_meta_data($sock);
2861
+ while ((!feof($sock)) && (!$info["timed_out"])) {
2862
+ $response .= fread($sock, $this->chunkSize);
2863
+ $info = stream_get_meta_data($sock);
2864
+ }
2865
+ fclose($sock);
2866
+ ob_end_clean();
2867
+ if ($info["timed_out"]) {
2868
+ $this->errorMessage = "Could not read response (timed out)";
2869
+ $this->errorCode = -98;
2870
+ return false;
2871
+ }
2872
+
2873
+ list($headers, $response) = explode("\r\n\r\n", $response, 2);
2874
+ $headers = explode("\r\n", $headers);
2875
+ $errored = false;
2876
+ foreach($headers as $h){
2877
+ if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
2878
+ $errored = true;
2879
+ $error_code = trim(substr($h,27));
2880
+ break;
2881
+ }
2882
+ }
2883
+
2884
+ if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
2885
+
2886
+ $serial = unserialize($response);
2887
+ if($response && $serial === false) {
2888
+ $response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
2889
+ } else {
2890
+ $response = $serial;
2891
+ }
2892
+ if($errored && is_array($response) && isset($response["error"])) {
2893
+ $this->errorMessage = $response["error"];
2894
+ $this->errorCode = $response["code"];
2895
+ return false;
2896
+ } elseif($errored){
2897
+ $this->errorMessage = "No error message was found";
2898
+ $this->errorCode = $error_code;
2899
+ return false;
2900
+ }
2901
+
2902
+ return $response;
2903
+ }
2904
+
2905
+ }
2906
+
2907
+ ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Muneeb
3
  Donate link: http://rocketplugins.com/wordpress-maintenance-mode-plugin/
4
  Tags: coming soon, coming soon page, construction, landing page, launch, launch page, maintenance, maintenance mode, newsletter, offline, site offline, unavailable, under construction, underconstruction, wordpress maintenance mode, wordpress under construction,theme
5
  Requires at least: 3.1
6
- Tested up to: 4.0
7
- Stable tag: 1.0
8
  License: GPLv2 or later
9
 
10
  Adds a responsive maintenance page to your site that lets visitors know your site is down.
3
  Donate link: http://rocketplugins.com/wordpress-maintenance-mode-plugin/
4
  Tags: coming soon, coming soon page, construction, landing page, launch, launch page, maintenance, maintenance mode, newsletter, offline, site offline, unavailable, under construction, underconstruction, wordpress maintenance mode, wordpress under construction,theme
5
  Requires at least: 3.1
6
+ Tested up to: 4.4
7
+ Stable tag: 2.0
8
  License: GPLv2 or later
9
 
10
  Adds a responsive maintenance page to your site that lets visitors know your site is down.
views/admin-settings/general-meta-box.php CHANGED
@@ -10,7 +10,7 @@
10
  <label>
11
  <?php _e( 'Status', 'wpmp' ); ?>
12
  </label>
13
- <p class="description"></p>
14
  </td>
15
  <td>
16
  <p><label><input type="radio" value="disabled" name="settings[status]" <?php checked( $settings['status'], 'disabled' ) ?> /><span><?php _e( 'Disabled', 'wpmmp' ) ?></span><label></p>
@@ -29,6 +29,11 @@
29
  </td>
30
  <td>
31
  <ul id="wpmmp-themes">
 
 
 
 
 
32
  <li>
33
  <img src="<?php echo wpmmp_image_url( 'default-1.jpg' ) ?>" />
34
  <p><input <?php checked( 'default-1', $settings['theme'] ) ?> type="radio" name="settings[theme]" value="default-1" /></p>
@@ -45,6 +50,7 @@
45
  <img src="<?php echo wpmmp_image_url( 'default-4.jpg' ) ?>" />
46
  <p><input <?php checked( 'default-4', $settings['theme'] ) ?> type="radio" name="settings[theme]" value="default-4" /></p>
47
  </li>
 
48
  <?php foreach ( $themes as $theme ): ?>
49
  <?php endforeach; ?>
50
  </ul>
10
  <label>
11
  <?php _e( 'Status', 'wpmp' ); ?>
12
  </label>
13
+ <p class="description"><?php _e( 'Admin users will not get maintenance mode page. Please logout or use your browser private tab for testing.', 'wpmp' ); ?></p>
14
  </td>
15
  <td>
16
  <p><label><input type="radio" value="disabled" name="settings[status]" <?php checked( $settings['status'], 'disabled' ) ?> /><span><?php _e( 'Disabled', 'wpmmp' ) ?></span><label></p>
29
  </td>
30
  <td>
31
  <ul id="wpmmp-themes">
32
+ <li>
33
+ <a href="http://rocketplugins.com/wordpress-maintenance-mode-plugin/" target="_blank"> <img style="height: 208px" src="<?php echo wpmmp_image_url( 'alissa-1.png' ) ?>" />
34
+ <p><input <?php checked( 'alissa', $settings['theme'] ) ?> type="radio" name="settings[theme]" value="alissa" /> <strong>Paid Theme</strong></p></a>
35
+ </li>
36
+
37
  <li>
38
  <img src="<?php echo wpmmp_image_url( 'default-1.jpg' ) ?>" />
39
  <p><input <?php checked( 'default-1', $settings['theme'] ) ?> type="radio" name="settings[theme]" value="default-1" /></p>
50
  <img src="<?php echo wpmmp_image_url( 'default-4.jpg' ) ?>" />
51
  <p><input <?php checked( 'default-4', $settings['theme'] ) ?> type="radio" name="settings[theme]" value="default-4" /></p>
52
  </li>
53
+
54
  <?php foreach ( $themes as $theme ): ?>
55
  <?php endforeach; ?>
56
  </ul>
wp-wpmmp.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://rocketplugins.com/wordpress-maintenance-mode-plugin/
5
  Description: Adds a responsive maintenance page to your site that lets visitors know your site is down.
6
  Author: Muneeb
7
  Author URI: http://rocketplugins.com/wordpress-maintenance-mode-plugin/
8
- Version: 1.0
9
  Copyright: 2013 Muneeb ur Rehman http://muneeb.me
10
  **/
11
 
5
  Description: Adds a responsive maintenance page to your site that lets visitors know your site is down.
6
  Author: Muneeb
7
  Author URI: http://rocketplugins.com/wordpress-maintenance-mode-plugin/
8
+ Version: 2.0
9
  Copyright: 2013 Muneeb ur Rehman http://muneeb.me
10
  **/
11