WP Maintenance Mode / Coming Soon Page Builder - Version 4.1

Version Description

Download this release

Release Info

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

Code changes from version 4.0 to 4.1

.gitignore DELETED
@@ -1,49 +0,0 @@
1
- # These are some examples of commonly ignored file patterns.
2
- # You should customize this list as applicable to your project.
3
- # Learn more about .gitignore:
4
- # https://www.atlassian.com/git/tutorials/saving-changes/gitignore
5
-
6
- # Node artifact files
7
- node_modules/
8
- dist/
9
-
10
- # Compiled Java class files
11
- *.class
12
-
13
- # Compiled Python bytecode
14
- *.py[cod]
15
-
16
- # Log files
17
- *.log
18
-
19
- # Package files
20
- *.jar
21
-
22
- # Maven
23
- target/
24
- dist/
25
-
26
- # JetBrains IDE
27
- .idea/
28
-
29
- # Unit test reports
30
- TEST*.xml
31
-
32
- # Generated by MacOS
33
- .DS_Store
34
-
35
- # Generated by Windows
36
- Thumbs.db
37
-
38
- # Applications
39
- *.app
40
- *.exe
41
- *.war
42
-
43
- # Large media files
44
- *.mp4
45
- *.tiff
46
- *.avi
47
- *.flv
48
- *.mov
49
- *.wmv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/classes/class-wpmmp-theme-handler.php CHANGED
@@ -22,8 +22,6 @@ class Wpmmp_Theme_Handler {
22
 
23
  function __construct() {
24
 
25
- $this->_hooks();
26
-
27
  $this->_filters();
28
 
29
  $this->hooks();
@@ -59,13 +57,6 @@ class Wpmmp_Theme_Handler {
59
 
60
  }
61
 
62
- private function _hooks() {
63
-
64
- add_action( 'wp_ajax_nopriv_wpmmp_c_soon_store_email', array( $this, 'store_email' ) );
65
- add_action( 'wp_ajax_wpmmp_c_soon_store_email', array( $this, 'store_email' ) );
66
-
67
- }
68
-
69
  public function name( $name = '' ) {
70
 
71
  if ( empty( $name ) )
@@ -345,77 +336,6 @@ class Wpmmp_Theme_Handler {
345
 
346
  }
347
 
348
- function store_email() {
349
-
350
- usleep( 500 );
351
-
352
- error_reporting(0);
353
-
354
- if ( ! wp_verify_nonce( $_POST['wpmmp_email_manager_nonce'],
355
- 'wpmmp_email_manager_nonce' ) ) {
356
- $response = array(
357
- 'valid' => 0,
358
- 'message' => 'Error ' . ' - ' . 'Invalid Nonce'
359
- );
360
-
361
- exit( json_encode( $response ) );
362
- }
363
-
364
- if ( ! isset( $_POST['name'] ) )
365
- $_POST['name'] = '';
366
-
367
- $email = $_POST['email'];
368
-
369
- $name = $_POST['name'];
370
-
371
- if ( ! is_email( $email ) ) {
372
-
373
- $response = array(
374
- 'valid' => 0,
375
- 'message' => 'Error ' . ' - ' . 'Invalid email address'
376
- );
377
-
378
- exit( json_encode( $response ) );
379
-
380
- }
381
-
382
- wpmmp_include( '/libs/MCAPI.class.php' );
383
-
384
- $api_key = get_option( 'mmp_mc_api' );
385
-
386
- $list_id = get_option( 'mmp_mc_listid' );
387
-
388
- $api = new Wpmmp_MCAPI( $api_key );
389
-
390
- list($fname,$lname) = preg_split('/\s+(?=[^\s]+$)/', $name, 2);
391
-
392
- $merge_vars = array(
393
- 'FNAME' => $fname,
394
- 'LNAME' => $lname
395
- );
396
-
397
- $retval = $api->listSubscribe( $list_id, $email, $merge_vars, 'html' );
398
-
399
- if( $api->errorCode ) {
400
-
401
- $response = array(
402
- 'valid' => 0,
403
- 'message' => 'Error ' . ' - ' . $api->errorMessage
404
- );
405
-
406
- exit( json_encode( $response ) );
407
-
408
- }
409
-
410
- $response = array(
411
- 'valid' => 1,
412
- 'message' => 'Email submitted successfully!'
413
- );
414
-
415
- exit( json_encode( $response ) );
416
-
417
- }
418
-
419
  function add_email_form($center=false) {
420
 
421
  include wpmmp_settings_part( 'add-email-form' );
22
 
23
  function __construct() {
24
 
 
 
25
  $this->_filters();
26
 
27
  $this->hooks();
57
 
58
  }
59
 
 
 
 
 
 
 
 
60
  public function name( $name = '' ) {
61
 
62
  if ( empty( $name ) )
336
 
337
  }
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  function add_email_form($center=false) {
340
 
341
  include wpmmp_settings_part( 'add-email-form' );
includes/libs/MailChimp.php ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DrewM\MailChimp;
4
+
5
+ /**
6
+ * Super-simple, minimum abstraction MailChimp API v3 wrapper
7
+ * MailChimp API v3: http://developer.mailchimp.com
8
+ * This wrapper: https://github.com/drewm/mailchimp-api
9
+ *
10
+ * @author Drew McLellan <drew.mclellan@gmail.com>
11
+ * @version 2.5
12
+ */
13
+ class MailChimp
14
+ {
15
+ private $api_key;
16
+ private $api_endpoint = 'https://<dc>.api.mailchimp.com/3.0';
17
+
18
+ const TIMEOUT = 10;
19
+
20
+ /* SSL Verification
21
+ Read before disabling:
22
+ http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/
23
+ */
24
+ public $verify_ssl = true;
25
+
26
+ private $request_successful = false;
27
+ private $last_error = '';
28
+ private $last_response = array();
29
+ private $last_request = array();
30
+
31
+ /**
32
+ * Create a new instance
33
+ *
34
+ * @param string $api_key Your MailChimp API key
35
+ * @param string $api_endpoint Optional custom API endpoint
36
+ *
37
+ * @throws \Exception
38
+ */
39
+ public function __construct($api_key, $api_endpoint = null)
40
+ {
41
+ if (!function_exists('curl_init') || !function_exists('curl_setopt')) {
42
+ throw new \Exception("cURL support is required, but can't be found.");
43
+ }
44
+
45
+ $this->api_key = $api_key;
46
+
47
+ if ($api_endpoint === null) {
48
+ if (strpos($this->api_key, '-') === false) {
49
+ throw new \Exception("Invalid MailChimp API key supplied.");
50
+ }
51
+ list(, $data_center) = explode('-', $this->api_key);
52
+ $this->api_endpoint = str_replace('<dc>', $data_center, $this->api_endpoint);
53
+ } else {
54
+ $this->api_endpoint = $api_endpoint;
55
+ }
56
+
57
+ $this->last_response = array('headers' => null, 'body' => null);
58
+ }
59
+
60
+ /**
61
+ * Create a new instance of a Batch request. Optionally with the ID of an existing batch.
62
+ *
63
+ * @param string $batch_id Optional ID of an existing batch, if you need to check its status for example.
64
+ *
65
+ * @return Batch New Batch object.
66
+ */
67
+ public function new_batch($batch_id = null)
68
+ {
69
+ return new Batch($this, $batch_id);
70
+ }
71
+
72
+ /**
73
+ * @return string The url to the API endpoint
74
+ */
75
+ public function getApiEndpoint()
76
+ {
77
+ return $this->api_endpoint;
78
+ }
79
+
80
+
81
+ /**
82
+ * Convert an email address into a 'subscriber hash' for identifying the subscriber in a method URL
83
+ *
84
+ * @param string $email The subscriber's email address
85
+ *
86
+ * @return string Hashed version of the input
87
+ */
88
+ public static function subscriberHash($email)
89
+ {
90
+ return md5(strtolower($email));
91
+ }
92
+
93
+ /**
94
+ * Was the last request successful?
95
+ *
96
+ * @return bool True for success, false for failure
97
+ */
98
+ public function success()
99
+ {
100
+ return $this->request_successful;
101
+ }
102
+
103
+ /**
104
+ * Get the last error returned by either the network transport, or by the API.
105
+ * If something didn't work, this should contain the string describing the problem.
106
+ *
107
+ * @return string|false describing the error
108
+ */
109
+ public function getLastError()
110
+ {
111
+ return $this->last_error ?: false;
112
+ }
113
+
114
+ /**
115
+ * Get an array containing the HTTP headers and the body of the API response.
116
+ *
117
+ * @return array Assoc array with keys 'headers' and 'body'
118
+ */
119
+ public function getLastResponse()
120
+ {
121
+ return $this->last_response;
122
+ }
123
+
124
+ /**
125
+ * Get an array containing the HTTP headers and the body of the API request.
126
+ *
127
+ * @return array Assoc array
128
+ */
129
+ public function getLastRequest()
130
+ {
131
+ return $this->last_request;
132
+ }
133
+
134
+ /**
135
+ * Make an HTTP DELETE request - for deleting data
136
+ *
137
+ * @param string $method URL of the API request method
138
+ * @param array $args Assoc array of arguments (if any)
139
+ * @param int $timeout Timeout limit for request in seconds
140
+ *
141
+ * @return array|false Assoc array of API response, decoded from JSON
142
+ */
143
+ public function delete($method, $args = array(), $timeout = self::TIMEOUT)
144
+ {
145
+ return $this->makeRequest('delete', $method, $args, $timeout);
146
+ }
147
+
148
+ /**
149
+ * Make an HTTP GET request - for retrieving data
150
+ *
151
+ * @param string $method URL of the API request method
152
+ * @param array $args Assoc array of arguments (usually your data)
153
+ * @param int $timeout Timeout limit for request in seconds
154
+ *
155
+ * @return array|false Assoc array of API response, decoded from JSON
156
+ */
157
+ public function get($method, $args = array(), $timeout = self::TIMEOUT)
158
+ {
159
+ return $this->makeRequest('get', $method, $args, $timeout);
160
+ }
161
+
162
+ /**
163
+ * Make an HTTP PATCH request - for performing partial updates
164
+ *
165
+ * @param string $method URL of the API request method
166
+ * @param array $args Assoc array of arguments (usually your data)
167
+ * @param int $timeout Timeout limit for request in seconds
168
+ *
169
+ * @return array|false Assoc array of API response, decoded from JSON
170
+ */
171
+ public function patch($method, $args = array(), $timeout = self::TIMEOUT)
172
+ {
173
+ return $this->makeRequest('patch', $method, $args, $timeout);
174
+ }
175
+
176
+ /**
177
+ * Make an HTTP POST request - for creating and updating items
178
+ *
179
+ * @param string $method URL of the API request method
180
+ * @param array $args Assoc array of arguments (usually your data)
181
+ * @param int $timeout Timeout limit for request in seconds
182
+ *
183
+ * @return array|false Assoc array of API response, decoded from JSON
184
+ */
185
+ public function post($method, $args = array(), $timeout = self::TIMEOUT)
186
+ {
187
+ return $this->makeRequest('post', $method, $args, $timeout);
188
+ }
189
+
190
+ /**
191
+ * Make an HTTP PUT request - for creating new items
192
+ *
193
+ * @param string $method URL of the API request method
194
+ * @param array $args Assoc array of arguments (usually your data)
195
+ * @param int $timeout Timeout limit for request in seconds
196
+ *
197
+ * @return array|false Assoc array of API response, decoded from JSON
198
+ */
199
+ public function put($method, $args = array(), $timeout = self::TIMEOUT)
200
+ {
201
+ return $this->makeRequest('put', $method, $args, $timeout);
202
+ }
203
+
204
+ /**
205
+ * Performs the underlying HTTP request. Not very exciting.
206
+ *
207
+ * @param string $http_verb The HTTP verb to use: get, post, put, patch, delete
208
+ * @param string $method The API method to be called
209
+ * @param array $args Assoc array of parameters to be passed
210
+ * @param int $timeout
211
+ *
212
+ * @return array|false Assoc array of decoded result
213
+ */
214
+ private function makeRequest($http_verb, $method, $args = array(), $timeout = self::TIMEOUT)
215
+ {
216
+ $url = $this->api_endpoint . '/' . $method;
217
+
218
+ $response = $this->prepareStateForRequest($http_verb, $method, $url, $timeout);
219
+
220
+ $httpHeader = array(
221
+ 'Accept: application/vnd.api+json',
222
+ 'Content-Type: application/vnd.api+json',
223
+ 'Authorization: apikey ' . $this->api_key
224
+ );
225
+
226
+ if (isset($args["language"])) {
227
+ $httpHeader[] = "Accept-Language: " . $args["language"];
228
+ }
229
+
230
+ if ($http_verb === 'put') {
231
+ $httpHeader[] = 'Allow: PUT, PATCH, POST';
232
+ }
233
+
234
+ $ch = curl_init();
235
+ curl_setopt($ch, CURLOPT_URL, $url);
236
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
237
+ curl_setopt($ch, CURLOPT_USERAGENT, 'DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)');
238
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
239
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
240
+ curl_setopt($ch, CURLOPT_HEADER, true);
241
+ curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
242
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);
243
+ curl_setopt($ch, CURLOPT_ENCODING, '');
244
+ curl_setopt($ch, CURLINFO_HEADER_OUT, true);
245
+
246
+ switch ($http_verb) {
247
+ case 'post':
248
+ curl_setopt($ch, CURLOPT_POST, true);
249
+ $this->attachRequestPayload($ch, $args);
250
+ break;
251
+
252
+ case 'get':
253
+ $query = http_build_query($args, '', '&');
254
+ curl_setopt($ch, CURLOPT_URL, $url . '?' . $query);
255
+ break;
256
+
257
+ case 'delete':
258
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
259
+ break;
260
+
261
+ case 'patch':
262
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
263
+ $this->attachRequestPayload($ch, $args);
264
+ break;
265
+
266
+ case 'put':
267
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
268
+ $this->attachRequestPayload($ch, $args);
269
+ break;
270
+ }
271
+
272
+ $responseContent = curl_exec($ch);
273
+ $response['headers'] = curl_getinfo($ch);
274
+ $response = $this->setResponseState($response, $responseContent, $ch);
275
+ $formattedResponse = $this->formatResponse($response);
276
+
277
+ curl_close($ch);
278
+
279
+ $isSuccess = $this->determineSuccess($response, $formattedResponse, $timeout);
280
+
281
+ return is_array($formattedResponse) ? $formattedResponse : $isSuccess;
282
+ }
283
+
284
+ /**
285
+ * @param string $http_verb
286
+ * @param string $method
287
+ * @param string $url
288
+ * @param integer $timeout
289
+ *
290
+ * @return array
291
+ */
292
+ private function prepareStateForRequest($http_verb, $method, $url, $timeout)
293
+ {
294
+ $this->last_error = '';
295
+
296
+ $this->request_successful = false;
297
+
298
+ $this->last_response = array(
299
+ 'headers' => null, // array of details from curl_getinfo()
300
+ 'httpHeaders' => null, // array of HTTP headers
301
+ 'body' => null // content of the response
302
+ );
303
+
304
+ $this->last_request = array(
305
+ 'method' => $http_verb,
306
+ 'path' => $method,
307
+ 'url' => $url,
308
+ 'body' => '',
309
+ 'timeout' => $timeout,
310
+ );
311
+
312
+ return $this->last_response;
313
+ }
314
+
315
+ /**
316
+ * Get the HTTP headers as an array of header-name => header-value pairs.
317
+ *
318
+ * The "Link" header is parsed into an associative array based on the
319
+ * rel names it contains. The original value is available under
320
+ * the "_raw" key.
321
+ *
322
+ * @param string $headersAsString
323
+ *
324
+ * @return array
325
+ */
326
+ private function getHeadersAsArray($headersAsString)
327
+ {
328
+ $headers = array();
329
+
330
+ foreach (explode("\r\n", $headersAsString) as $i => $line) {
331
+ if (preg_match('/HTTP\/[1-2]/', substr($line, 0, 7)) === 1) { // http code
332
+ continue;
333
+ }
334
+
335
+ $line = trim($line);
336
+ if (empty($line)) {
337
+ continue;
338
+ }
339
+
340
+ list($key, $value) = explode(': ', $line);
341
+
342
+ if ($key == 'Link') {
343
+ $value = array_merge(
344
+ array('_raw' => $value),
345
+ $this->getLinkHeaderAsArray($value)
346
+ );
347
+ }
348
+
349
+ $headers[$key] = $value;
350
+ }
351
+
352
+ return $headers;
353
+ }
354
+
355
+ /**
356
+ * Extract all rel => URL pairs from the provided Link header value
357
+ *
358
+ * Mailchimp only implements the URI reference and relation type from
359
+ * RFC 5988, so the value of the header is something like this:
360
+ *
361
+ * 'https://us13.api.mailchimp.com/schema/3.0/Lists/Instance.json; rel="describedBy",
362
+ * <https://us13.admin.mailchimp.com/lists/members/?id=XXXX>; rel="dashboard"'
363
+ *
364
+ * @param string $linkHeaderAsString
365
+ *
366
+ * @return array
367
+ */
368
+ private function getLinkHeaderAsArray($linkHeaderAsString)
369
+ {
370
+ $urls = array();
371
+
372
+ if (preg_match_all('/<(.*?)>\s*;\s*rel="(.*?)"\s*/', $linkHeaderAsString, $matches)) {
373
+ foreach ($matches[2] as $i => $relName) {
374
+ $urls[$relName] = $matches[1][$i];
375
+ }
376
+ }
377
+
378
+ return $urls;
379
+ }
380
+
381
+ /**
382
+ * Encode the data and attach it to the request
383
+ *
384
+ * @param resource $ch cURL session handle, used by reference
385
+ * @param array $data Assoc array of data to attach
386
+ */
387
+ private function attachRequestPayload(&$ch, $data)
388
+ {
389
+ $encoded = json_encode($data);
390
+ $this->last_request['body'] = $encoded;
391
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded);
392
+ }
393
+
394
+ /**
395
+ * Decode the response and format any error messages for debugging
396
+ *
397
+ * @param array $response The response from the curl request
398
+ *
399
+ * @return array|false The JSON decoded into an array
400
+ */
401
+ private function formatResponse($response)
402
+ {
403
+ $this->last_response = $response;
404
+
405
+ if (!empty($response['body'])) {
406
+ return json_decode($response['body'], true);
407
+ }
408
+
409
+ return false;
410
+ }
411
+
412
+ /**
413
+ * Do post-request formatting and setting state from the response
414
+ *
415
+ * @param array $response The response from the curl request
416
+ * @param string $responseContent The body of the response from the curl request
417
+ * @param resource $ch The curl resource
418
+ *
419
+ * @return array The modified response
420
+ */
421
+ private function setResponseState($response, $responseContent, $ch)
422
+ {
423
+ if ($responseContent === false) {
424
+ $this->last_error = curl_error($ch);
425
+ } else {
426
+
427
+ $headerSize = $response['headers']['header_size'];
428
+
429
+ $response['httpHeaders'] = $this->getHeadersAsArray(substr($responseContent, 0, $headerSize));
430
+ $response['body'] = substr($responseContent, $headerSize);
431
+
432
+ if (isset($response['headers']['request_header'])) {
433
+ $this->last_request['headers'] = $response['headers']['request_header'];
434
+ }
435
+ }
436
+
437
+ return $response;
438
+ }
439
+
440
+ /**
441
+ * Check if the response was successful or a failure. If it failed, store the error.
442
+ *
443
+ * @param array $response The response from the curl request
444
+ * @param array|false $formattedResponse The response body payload from the curl request
445
+ * @param int $timeout The timeout supplied to the curl request.
446
+ *
447
+ * @return bool If the request was successful
448
+ */
449
+ private function determineSuccess($response, $formattedResponse, $timeout)
450
+ {
451
+ $status = $this->findHTTPStatus($response, $formattedResponse);
452
+
453
+ if ($status >= 200 && $status <= 299) {
454
+ $this->request_successful = true;
455
+ return true;
456
+ }
457
+
458
+ if (isset($formattedResponse['detail'])) {
459
+ $this->last_error = sprintf('%d: %s', $formattedResponse['status'], $formattedResponse['detail']);
460
+ return false;
461
+ }
462
+
463
+ if ($timeout > 0 && $response['headers'] && $response['headers']['total_time'] >= $timeout) {
464
+ $this->last_error = sprintf('Request timed out after %f seconds.', $response['headers']['total_time']);
465
+ return false;
466
+ }
467
+
468
+ $this->last_error = 'Unknown error, call getLastResponse() to find out what happened.';
469
+ return false;
470
+ }
471
+
472
+ /**
473
+ * Find the HTTP status code from the headers or API response body
474
+ *
475
+ * @param array $response The response from the curl request
476
+ * @param array|false $formattedResponse The response body payload from the curl request
477
+ *
478
+ * @return int HTTP status code
479
+ */
480
+ private function findHTTPStatus($response, $formattedResponse)
481
+ {
482
+ if (!empty($response['headers']) && isset($response['headers']['http_code'])) {
483
+ return (int)$response['headers']['http_code'];
484
+ }
485
+
486
+ if (!empty($response['body']) && isset($formattedResponse['status'])) {
487
+ return (int)$formattedResponse['status'];
488
+ }
489
+
490
+ return 418;
491
+ }
492
+ }
includes/libs/freemius/assets/img/rocket-maintenance-mode.png ADDED
Binary file
includes/rocket_freemius.php CHANGED
@@ -12,7 +12,7 @@ if ( ! function_exists( 'oc_fs' ) ) {
12
 
13
  $oc_fs = fs_dynamic_init( array(
14
  'id' => '6925',
15
- 'slug' => 'RocketMaintenanceModeComingSoonPage',
16
  'type' => 'plugin',
17
  'public_key' => 'pk_8be1445a49e73d11a613735f248e8',
18
  'is_premium' => false,
12
 
13
  $oc_fs = fs_dynamic_init( array(
14
  'id' => '6925',
15
+ 'slug' => 'rocket-maintenance-mode',
16
  'type' => 'plugin',
17
  'public_key' => 'pk_8be1445a49e73d11a613735f248e8',
18
  'is_premium' => false,
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: maintenance mode, coming soon, coming soon page, maintenance mode page, ma
4
  Requires at least: 3.1
5
  Requires PHP: 7.0
6
  Tested up to: 5.5.1
7
- Stable tag: 4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -104,13 +104,18 @@ The subscribe form can be used to collect email addresses of visitors and at the
104
 
105
 
106
  == Changelog ==
 
 
 
 
107
  = v4.0 - 2020/09/18 =
108
  * Added Jquery Conditions
109
  * Added Freemius SDK, which will help with improving the product in the future. It’s completely opt-in, you can keep it disabled.
110
- * Tested upto WordPress 5.5.1
111
- * Tested Upto PHP 7.0
112
  * Fixed Jquery Errors
113
  * Fixed Font options
 
114
 
115
  = v3.92 - 2019/08/07 =
116
  * NotificationX integration
4
  Requires at least: 3.1
5
  Requires PHP: 7.0
6
  Tested up to: 5.5.1
7
+ Stable tag: 4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
104
 
105
 
106
  == Changelog ==
107
+ = v4.1 - 2020/09/29 =
108
+ * Update Mailchimp API to V3
109
+ * Fixed Freemius menu link
110
+
111
  = v4.0 - 2020/09/18 =
112
  * Added Jquery Conditions
113
  * Added Freemius SDK, which will help with improving the product in the future. It’s completely opt-in, you can keep it disabled.
114
+ * update Tested upto WordPress 5.5.1
115
+ * Update Tested Upto PHP 7.0
116
  * Fixed Jquery Errors
117
  * Fixed Font options
118
+ * Removed Theme, Script and Advance tab form the admin settings.
119
 
120
  = v3.92 - 2019/08/07 =
121
  * NotificationX integration
views/admin-settings/add-email-form.php CHANGED
@@ -1,50 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php if ( get_option('mmp_on_off_subscribe') === '1' ): ?>
2
- <form class="mm-form <?php if ( $center ) echo 'w3-center' ?> ">
3
  <span>
4
  <input type="email" name="email" class="mm-input" placeholder='<?php esc_attr_e( get_option('mmp_mc_pt') )?>' id="" style="width: 35%; height: 41px; padding: 18px 22px; font-size: 15px; color: #55B; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 5px;"> <input type="submit" value="<?php esc_attr_e( get_option('mmp_mc_sbt') ) ?>" class="mm-btn" style="background-color: black; border: none; border-radius: 5px; padding: 10px 20px;">
5
  </span>
6
  <input type="hidden" value="<?php echo wp_create_nonce('wpmmp_email_manager_nonce') ?>" name="wpmmp_email_manager_nonce" />
7
- <div class="success-message"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <div class="error-message"></div>
9
  <br>
10
  <br>
11
  </form>
12
  <?php endif; ?>
13
-
14
  <script>
15
- /*
16
- Subscription form
17
- */
18
- jQuery(function ($) {
19
- $('.success-message').hide();
20
- $('.error-message').hide();
21
-
22
- ajax_url = "<?php echo admin_url( 'admin-ajax.php' ) ?>";
23
-
24
- $('.mm-form').submit(function() {
25
- var postdata = $('.mm-form').serialize();
26
- $.ajax({
27
- type: 'POST',
28
- url: ajax_url + '?action=wpmmp_c_soon_store_email',
29
- data: postdata,
30
- dataType: 'json',
31
- success: function(json) {
32
- if(json.valid == 0) {
33
- $('.success-message').hide();
34
- $('.error-message').hide();
35
- $('.error-message').html(json.message);
36
- $('.error-message').fadeIn();
37
- }
38
- else {
39
- $('.error-message').hide();
40
- $('.success-message').hide();
41
- $('.subscribe form').hide();
42
- $('.success-message').html(json.message);
43
- $('.success-message').fadeIn();
44
- }
45
- }
46
- });
47
- return false;
48
  });
49
- });
50
  </script>
1
+ <?php
2
+ include WPMMP_PLUGIN_INCLUDE_DIRECTORY . 'libs/MailChimp.php' ;
3
+ use \DrewM\MailChimp\MailChimp;
4
+ if(isset($_POST['email']))
5
+ {
6
+ if ( ! isset( $_POST['email'] ) ) {
7
+ $email = $_POST['email'];
8
+ if ( ! is_email( $email ) ) {
9
+ wp_redirect(site_url()."?error=0");
10
+ }
11
+ }
12
+
13
+ if ( ! wp_verify_nonce( $_POST['wpmmp_email_manager_nonce'],
14
+ 'wpmmp_email_manager_nonce' ) ) {
15
+ wp_redirect(site_url()."?error=2");
16
+ } else {
17
+ $email = isset($_POST['email']) ? $_POST['email'] : '';
18
+ $api_key = get_option( 'mmp_mc_api' );
19
+ $list_id = get_option( 'mmp_mc_listid' );
20
+ $MailChimp = new MailChimp($api_key);
21
+
22
+ $result = $MailChimp->post("lists/$list_id/members", [
23
+ 'email_address' => $email,
24
+ 'status' => 'subscribed',
25
+ ]);
26
+
27
+ if($result){
28
+ wp_redirect(site_url()."?success=1");
29
+ } else{
30
+ wp_redirect(site_url()."?error=1");
31
+ }
32
+ }
33
+ }
34
+ ?>
35
  <?php if ( get_option('mmp_on_off_subscribe') === '1' ): ?>
36
+ <form method="POST" class="mm-form <?php if ( $center ) echo 'w3-center' ?>">
37
  <span>
38
  <input type="email" name="email" class="mm-input" placeholder='<?php esc_attr_e( get_option('mmp_mc_pt') )?>' id="" style="width: 35%; height: 41px; padding: 18px 22px; font-size: 15px; color: #55B; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 5px;"> <input type="submit" value="<?php esc_attr_e( get_option('mmp_mc_sbt') ) ?>" class="mm-btn" style="background-color: black; border: none; border-radius: 5px; padding: 10px 20px;">
39
  </span>
40
  <input type="hidden" value="<?php echo wp_create_nonce('wpmmp_email_manager_nonce') ?>" name="wpmmp_email_manager_nonce" />
41
+ <?php if(isset($_GET['success']) || isset($_GET['error'])) { ?>
42
+
43
+ <p class="result">
44
+ <?php
45
+ if($_GET['success'] == 1)
46
+ {
47
+ echo esc_html(__('Email Submitted Successfully'));
48
+ } else if($_GET['error'] == 0) {
49
+ echo esc_html(__('Invalid Email Address!'));
50
+ } else if($_GET['error'] == 1) {
51
+ echo esc_html(__('Something went wrong!'));
52
+ } else if($_GET['error'] == 2) {
53
+ echo esc_html(__('Invalid Nonce!'));
54
+ }
55
+ ?>
56
+ </p>
57
+ <?php } ?>
58
+ <div class="success-message"></div>
59
  <div class="error-message"></div>
60
  <br>
61
  <br>
62
  </form>
63
  <?php endif; ?>
 
64
  <script>
65
+ jQuery(document).ready(function () {
66
+ jQuery('p.result').delay(5000).fadeOut();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  });
 
68
  </script>
views/admin-settings/premiumui.php CHANGED
@@ -82,21 +82,6 @@ if (@$_GET['settings-updated'] == true) {
82
  </label>
83
  </td>
84
  </tr>
85
-
86
- <tr valign='top'>
87
- <th scope='row'><?php _e('Show Subscribe Form ');?></th>
88
- <td>
89
- <div class="onoffswitch">
90
- <input type="checkbox" name="mmp_on_off_subscribe" class="onoffswitch-checkbox" id="myonoffswitch9" value='1'<?php checked(1, get_option('mmp_on_off_subscribe')); ?> />
91
- <label class="onoffswitch-label" for="myonoffswitch9">
92
- <span class="onoffswitch-inner"></span>
93
- <span class="onoffswitch-switch"></span>
94
- </label>
95
- </div>
96
-
97
- </td>
98
- </tr>
99
-
100
  </table>
101
 
102
  </div>
@@ -179,6 +164,20 @@ if (@$_GET['settings-updated'] == true) {
179
  <div id="hed3"><h3><?php _e('Email Form ')?></h3><span class="heading_save_btn">
180
  <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
181
  </span></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  <tr>
183
  <th scope='row'><?php _e('MailChimp API');?></th>
184
  <td><label for='mmp_fb_page'>
82
  </label>
83
  </td>
84
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  </table>
86
 
87
  </div>
164
  <div id="hed3"><h3><?php _e('Email Form ')?></h3><span class="heading_save_btn">
165
  <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
166
  </span></div>
167
+ <tr valign='top'>
168
+ <th scope='row'><?php _e('Show Subscribe Form ');?></th>
169
+ <td>
170
+ <div class="onoffswitch">
171
+ <input type="checkbox" name="mmp_on_off_subscribe" class="onoffswitch-checkbox" id="myonoffswitch9" value='1'<?php checked(1, get_option('mmp_on_off_subscribe')); ?> />
172
+ <label class="onoffswitch-label" for="myonoffswitch9">
173
+ <span class="onoffswitch-inner"></span>
174
+ <span class="onoffswitch-switch"></span>
175
+ </label>
176
+ </div>
177
+
178
+ </td>
179
+ </tr>
180
+
181
  <tr>
182
  <th scope='row'><?php _e('MailChimp API');?></th>
183
  <td><label for='mmp_fb_page'>
views/themes/default/template.php CHANGED
@@ -63,7 +63,7 @@
63
  <img src="<?php echo esc_url(get_option('mmp_logo')) ?>" />
64
  </div>
65
  <h1><?php esc_html_e(get_option('mmp_headline')) ?></h1>
66
- <p><u><?php esc_html_e(get_option('mmp_subheading')) ?></u></p>
67
  <div id="content">
68
  <?php echo $this->_content( get_option('mmp_message') ) ?>
69
  </div>
63
  <img src="<?php echo esc_url(get_option('mmp_logo')) ?>" />
64
  </div>
65
  <h1><?php esc_html_e(get_option('mmp_headline')) ?></h1>
66
+ <p><?php esc_html_e(get_option('mmp_subheading')) ?></p>
67
  <div id="content">
68
  <?php echo $this->_content( get_option('mmp_message') ) ?>
69
  </div>
wp-wpmmp.php CHANGED
@@ -1,26 +1,26 @@
1
  <?php
2
  /**
3
- Plugin Name: Rocket Maintenance Mode & Coming Soon Page Builder
4
- Plugin URI: https://wordpress.org/plugins/rocket-maintenance-mode/
5
- Description: Add a responsive maintenance mode or coming soon page to your site that lets visitors know your site is down or under construction.
6
- Author: wpexpertsio
7
- Author URI: http://www.wpexperts.io/
8
- Version: 4.0
9
-
10
- Copyright 2015 - 2019 WebFactory Ltd (email: support@wpexperts.io)
11
-
12
- This program is free software; you can redistribute it and/or modify
13
- it under the terms of the GNU General Public License, version 2, as
14
- published by the Free Software Foundation.
15
-
16
- This program is distributed in the hope that it will be useful,
17
- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- GNU General Public License for more details.
20
-
21
- You should have received a copy of the GNU General Public License
22
- along with this program; if not, write to the Free Software
23
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
 
26
 
1
  <?php
2
  /**
3
+ * Plugin Name: Rocket Maintenance Mode & Coming Soon Page Builder
4
+ * Plugin URI: https://wordpress.org/plugins/rocket-maintenance-mode/
5
+ * Description: Add a responsive maintenance mode or coming soon page to your site that lets visitors know your site is down or under construction.
6
+ * Author: wpexpertsio
7
+ * Author URI: http://www.wpexperts.io/
8
+ * Version: 4.1
9
+ *
10
+ * Copyright 2015 - 2019 WebFactory Ltd (email: support@wpexperts.io)
11
+ *
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License, version 2, as
14
+ * published by the Free Software Foundation.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program; if not, write to the Free Software
23
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
 
26