Under Construction - Version 3.82

Version Description

  • 2020/10/01
  • minor fixes
  • added promo for WP 301 Redirects
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Under Construction
Version 3.82
Comparing to
See all releases

Code changes from version 3.81 to 3.82

js/ucp-admin.js CHANGED
@@ -392,6 +392,14 @@ jQuery(document).ready(function($) {
392
  return false;
393
  });
394
 
 
 
 
 
 
 
 
 
395
  $('#tabs_upsell').on('tabsactivate', function(event, ui) {
396
  $('#upsell-dialog').dialog("option", "position", {my: "center", at: "center", of: window});
397
  });
392
  return false;
393
  });
394
 
395
+ $('.settings_page_ucp').on('click change', '.open-smush-install', function(e) {
396
+ e.preventDefault();
397
+
398
+ $('#smush-install-link').trigger('click');
399
+
400
+ return false;
401
+ });
402
+
403
  $('#tabs_upsell').on('tabsactivate', function(event, ui) {
404
  $('#upsell-dialog').dialog("option", "position", {my: "center", at: "center", of: window});
405
  });
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Under Construction ===
2
- Contributors: WebFactory, UnderConstructionPage, googlemapswidget, wpreset, securityninja
3
  Tags: coming soon page, under construction mode, under construction, under construction page, coming soon, maintenance mode, maintenance page, launch page, coming soon mode, maintenance mode page, offline page, maintenance, landing page
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 5.5
7
- Stable tag: 3.81
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,11 @@ Or if needed, upload manually;
138
 
139
  == Changelog ==
140
 
 
 
 
 
 
141
  = 3.81 =
142
  * 2020/08/20
143
  * bug fixes
1
  === Under Construction ===
2
+ Contributors: WebFactory
3
  Tags: coming soon page, under construction mode, under construction, under construction page, coming soon, maintenance mode, maintenance page, launch page, coming soon mode, maintenance mode page, offline page, maintenance, landing page
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 5.5
7
+ Stable tag: 3.82
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
138
 
139
  == Changelog ==
140
 
141
+ = 3.82 =
142
+ * 2020/10/01
143
+ * minor fixes
144
+ * added promo for WP 301 Redirects
145
+
146
  = 3.81 =
147
  * 2020/08/20
148
  * bug fixes
themes/setup/index.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
- /*
3
- * UnderConstructionPage
4
- * Setup theme
5
- * (c) WebFactory Ltd, 2015 - 2020
6
- */
7
-
8
-
9
- // this is an include only WP file
10
- if (!defined('ABSPATH')) {
11
- die;
12
- }
13
- ?>
14
- <!DOCTYPE html>
15
- <html lang="en">
16
- <head>
17
- <meta charset="utf-8">
18
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
19
- <meta name="viewport" content="width=device-width, initial-scale=1">
20
- <title>[title]</title>
21
- <meta name="description" content="[description]" />
22
- <meta name="generator" content="[generator]">
23
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:400,900">
24
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600">
25
- [head]
26
- </head>
27
-
28
- <body>
29
- <div class="container top-container">
30
- <div class="row display-table">
31
- <div class="col-lg-offset-1 col-xs-12 col-md-12 col-lg-5 display-cell">
32
- <h1>[heading1]</h1>
33
- </div>
34
- <div class="col-xs-12 col-md-12 col-lg-5 display-cell">
35
- <div id="hero-image">
36
- <img src="[theme-url]setup.png" alt="Site Setup is Under Way" title="Site Setup is Under Way">
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
-
42
- <div class="container">
43
- <div class="row">
44
- <div class="col-xs-12 col-md-8 col-md-offset-2 col-lg-offset-2 col-lg-8">
45
- <p class="content">[content]</p>
46
- </div>
47
- </div>
48
-
49
- <div class="row" id="social">
50
- <div class="col-xs-12 col-md-12 col-lg-12">
51
- [social-icons]
52
- </div>
53
- </div>
54
-
55
- </div>
56
- [footer]
57
- </body>
58
- </html>
1
+ <?php
2
+ /*
3
+ * UnderConstructionPage
4
+ * Setup theme
5
+ * (c) WebFactory Ltd, 2015 - 2020
6
+ */
7
+
8
+
9
+ // this is an include only WP file
10
+ if (!defined('ABSPATH')) {
11
+ die;
12
+ }
13
+ ?>
14
+ <!DOCTYPE html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="utf-8">
18
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
19
+ <meta name="viewport" content="width=device-width, initial-scale=1">
20
+ <title>[title]</title>
21
+ <meta name="description" content="[description]" />
22
+ <meta name="generator" content="[generator]">
23
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:400,900">
24
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600">
25
+ [head]
26
+ </head>
27
+
28
+ <body>
29
+ <div class="container top-container">
30
+ <div class="row display-table">
31
+ <div class="col-lg-offset-1 col-xs-12 col-md-12 col-lg-5 display-cell">
32
+ <h1>[heading1]</h1>
33
+ </div>
34
+ <div class="col-xs-12 col-md-12 col-lg-5 display-cell">
35
+ <div id="hero-image">
36
+ <img src="[theme-url]setup.png" alt="Site Setup is Under Way" title="Site Setup is Under Way">
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ <div class="container">
43
+ <div class="row">
44
+ <div class="col-xs-12 col-md-8 col-md-offset-2 col-lg-offset-2 col-lg-8">
45
+ <p class="content">[content]</p>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="row" id="social">
50
+ <div class="col-xs-12 col-md-12 col-lg-12">
51
+ [social-icons]
52
+ </div>
53
+ </div>
54
+
55
+ </div>
56
+ [footer]
57
+ </body>
58
+ </html>
themes/setup/style.css CHANGED
@@ -1,110 +1,110 @@
1
- /*
2
- * UnderConstructionPage
3
- * Setup theme CSS
4
- * (c) WebFactory Ltd, 2015 - 2020
5
- */
6
-
7
-
8
- html {
9
- height: 100%;
10
- padding: 0;
11
- margin: 0;
12
- }
13
-
14
- body {
15
- font-weight: 400;
16
- font-size: 15px;
17
- line-height: 120%;
18
- color: #111111;
19
- background: #ffc153;
20
- padding: 0;
21
- margin: 0;
22
- height: 100%;
23
- background-repeat: no-repeat;
24
- background-attachment: fixed;
25
- }
26
-
27
- .top-container {
28
- padding: 50px 0;
29
- }
30
-
31
- #hero-image {
32
- text-align: center;
33
- }
34
-
35
- #hero-image img {
36
- max-width: 80%;
37
- }
38
-
39
- .display-table {
40
- display: table;
41
- table-layout: fixed;
42
- }
43
-
44
- .display-cell {
45
- display: table-cell;
46
- vertical-align: middle;
47
- float: none;
48
- }
49
-
50
- h1 {
51
- font-size: 34px;
52
- color: #e1632b;
53
- font-family: "Nunito", sans-serif;
54
- font-weight: 900;
55
- margin: 20px 0 30px 0;
56
- text-align: right;
57
- }
58
-
59
- .content {
60
- text-align: center;
61
- font-family: "Open Sans", sans-serif;
62
- font-weight: 600;
63
- }
64
-
65
- #social {
66
- text-align: center;
67
- margin-top: 30px;
68
- }
69
-
70
- #social a i {
71
- color: #111111;
72
- margin: 10px;
73
- box-sizing: content-box;
74
- }
75
-
76
- #social a:hover i {
77
- color: #ffffff;
78
- }
79
-
80
- @media(max-width:767px) {
81
- h1 {
82
- font-size: 28px;
83
- margin: 10px 0 30px 0;
84
- }
85
- #hero-image img {
86
- max-width: 95%;
87
- }
88
- }
89
-
90
- @media (max-width: 1200px) {
91
- h1 {
92
- text-align: center;
93
- padding: 0 20px;
94
- }
95
- .display-table {
96
- display: initial;
97
- table-layout: auto;
98
- }
99
- .display-cell {
100
- display: block;
101
- vertical-align: middle;
102
- float: none;
103
- }
104
- #hero-image img {
105
- max-height: 250px
106
- }
107
- .top-container {
108
- padding: 25px 0;
109
- }
110
- }
1
+ /*
2
+ * UnderConstructionPage
3
+ * Setup theme CSS
4
+ * (c) WebFactory Ltd, 2015 - 2020
5
+ */
6
+
7
+
8
+ html {
9
+ height: 100%;
10
+ padding: 0;
11
+ margin: 0;
12
+ }
13
+
14
+ body {
15
+ font-weight: 400;
16
+ font-size: 15px;
17
+ line-height: 120%;
18
+ color: #111111;
19
+ background: #ffc153;
20
+ padding: 0;
21
+ margin: 0;
22
+ height: 100%;
23
+ background-repeat: no-repeat;
24
+ background-attachment: fixed;
25
+ }
26
+
27
+ .top-container {
28
+ padding: 50px 0;
29
+ }
30
+
31
+ #hero-image {
32
+ text-align: center;
33
+ }
34
+
35
+ #hero-image img {
36
+ max-width: 80%;
37
+ }
38
+
39
+ .display-table {
40
+ display: table;
41
+ table-layout: fixed;
42
+ }
43
+
44
+ .display-cell {
45
+ display: table-cell;
46
+ vertical-align: middle;
47
+ float: none;
48
+ }
49
+
50
+ h1 {
51
+ font-size: 34px;
52
+ color: #e1632b;
53
+ font-family: "Nunito", sans-serif;
54
+ font-weight: 900;
55
+ margin: 20px 0 30px 0;
56
+ text-align: right;
57
+ }
58
+
59
+ .content {
60
+ text-align: center;
61
+ font-family: "Open Sans", sans-serif;
62
+ font-weight: 600;
63
+ }
64
+
65
+ #social {
66
+ text-align: center;
67
+ margin-top: 30px;
68
+ }
69
+
70
+ #social a i {
71
+ color: #111111;
72
+ margin: 10px;
73
+ box-sizing: content-box;
74
+ }
75
+
76
+ #social a:hover i {
77
+ color: #ffffff;
78
+ }
79
+
80
+ @media(max-width:767px) {
81
+ h1 {
82
+ font-size: 28px;
83
+ margin: 10px 0 30px 0;
84
+ }
85
+ #hero-image img {
86
+ max-width: 95%;
87
+ }
88
+ }
89
+
90
+ @media (max-width: 1200px) {
91
+ h1 {
92
+ text-align: center;
93
+ padding: 0 20px;
94
+ }
95
+ .display-table {
96
+ display: initial;
97
+ table-layout: auto;
98
+ }
99
+ .display-cell {
100
+ display: block;
101
+ vertical-align: middle;
102
+ float: none;
103
+ }
104
+ #hero-image img {
105
+ max-height: 250px
106
+ }
107
+ .top-container {
108
+ padding: 25px 0;
109
+ }
110
+ }
under-construction.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: https://underconstructionpage.com/
5
  Description: Put your site behind a great looking under construction, coming soon, maintenance mode or landing page.
6
  Author: WebFactory Ltd
7
- Version: 3.81
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
 
@@ -41,6 +41,9 @@ define('UCP_SURVEYS_KEY', 'ucp_surveys');
41
 
42
  require_once UCP_PLUGIN_DIR . 'ucp-license.php';
43
 
 
 
 
44
 
45
  // main plugin class
46
  class UCP {
@@ -79,6 +82,7 @@ class UCP {
79
  array(__CLASS__, 'plugin_action_links'));
80
  add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
81
  add_filter('admin_footer_text', array(__CLASS__, 'admin_footer_text'));
 
82
 
83
  // manages admin header notifications
84
  add_action('admin_notices', array(__CLASS__, 'admin_notices'));
@@ -1044,6 +1048,18 @@ class UCP {
1044
  } // admin_footer_text
1045
 
1046
 
 
 
 
 
 
 
 
 
 
 
 
 
1047
  // test if we're on plugin's page
1048
  static function is_plugin_page() {
1049
  $current_screen = get_current_screen();
@@ -1251,8 +1267,8 @@ class UCP {
1251
 
1252
  return array_merge($old_options, $options);
1253
  } // sanitize_settings
1254
-
1255
-
1256
  static function empty_cache() {
1257
  wp_cache_flush();
1258
  if (function_exists('w3tc_flush_all')) {
@@ -1501,6 +1517,20 @@ class UCP {
1501
  echo '</tr>';
1502
  } // weglot not active
1503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1504
  echo '<tr valign="top">
1505
  <th scope="row"><label for="title">' . __('Title', 'under-construction-page') . '</label></th>
1506
  <td><input type="text" id="title" class="regular-text" name="' . UCP_OPTIONS_KEY . '[title]" value="' . esc_attr($options['title']) . '" />';
@@ -2438,11 +2468,11 @@ class UCP {
2438
  // add our plugins to recommended list
2439
  static function plugins_api_result($res, $action, $args) {
2440
  remove_filter('plugins_api_result', array(__CLASS__, 'plugins_api_result'), 10, 3);
2441
-
2442
  $res = self::add_plugin_favs('eps-301-redirects', $res);
2443
  $res = self::add_plugin_favs('simple-author-box', $res);
2444
  $res = self::add_plugin_favs('security-ninja', $res);
2445
-
2446
  return $res;
2447
  } // plugins_api_result
2448
 
4
  Plugin URI: https://underconstructionpage.com/
5
  Description: Put your site behind a great looking under construction, coming soon, maintenance mode or landing page.
6
  Author: WebFactory Ltd
7
+ Version: 3.82
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
 
41
 
42
  require_once UCP_PLUGIN_DIR . 'ucp-license.php';
43
 
44
+ require_once 'wp301/wp301.php';
45
+ new wf_wp301(__FILE__, 'settings_page_ucp');
46
+
47
 
48
  // main plugin class
49
  class UCP {
82
  array(__CLASS__, 'plugin_action_links'));
83
  add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
84
  add_filter('admin_footer_text', array(__CLASS__, 'admin_footer_text'));
85
+ add_filter('admin_footer', array(__CLASS__, 'admin_footer'));
86
 
87
  // manages admin header notifications
88
  add_action('admin_notices', array(__CLASS__, 'admin_notices'));
1048
  } // admin_footer_text
1049
 
1050
 
1051
+ // fix for opening the plugin install modal
1052
+ static function admin_footer() {
1053
+ if (empty($_GET['fix-install-button']) || empty($_GET['tab']) || $_GET['tab'] != 'plugin-information') {
1054
+ return;
1055
+ }
1056
+
1057
+ echo '<script>';
1058
+ echo "jQuery('#plugin_install_from_iframe').on('click', function() { window.location.href = jQuery(this).attr('href'); return false;});";
1059
+ echo '</script>';
1060
+ } // admin_footer
1061
+
1062
+
1063
  // test if we're on plugin's page
1064
  static function is_plugin_page() {
1065
  $current_screen = get_current_screen();
1267
 
1268
  return array_merge($old_options, $options);
1269
  } // sanitize_settings
1270
+
1271
+
1272
  static function empty_cache() {
1273
  wp_cache_flush();
1274
  if (function_exists('w3tc_flush_all')) {
1517
  echo '</tr>';
1518
  } // weglot not active
1519
 
1520
+ echo '<tr>';
1521
+ echo '<th><label for="smush_support">Image Compression</label></th>';
1522
+ echo '<td>';
1523
+ if (defined('WP_SMUSH_VERSION')) {
1524
+ echo 'Configure <a target="_blank" href="' . admin_url('admin.php?page=smush') . '">image compression options</a>.';
1525
+ } else {
1526
+ echo '<div class="toggle-wrapper">
1527
+ <input type="checkbox" id="smush_support" type="checkbox" value="1" class="skip-save open-smush-install">
1528
+ <label for="smush_support" class="toggle"><span class="toggle_handler"></span></label></div>';
1529
+ echo '<p class="description">The easiest way to speed up any site is to <b>compress images</b>. On an average page you can easily save a few megabytes. Doing it manually in Photoshop is a pain! That\'s why there are free plugins like <a href="' . admin_url('plugin-install.php?fix-install-button=1&tab=plugin-information&plugin=wp-smushit&TB_iframe=true&width=600&height=550') . '" class="thickbox open-plugin-details-modal smush-thickbox" id="smush-install-link">Smush</a> that specialize in compressing images. <a href="' . admin_url('plugin-install.php?fix-install-button=1&tab=plugin-information&plugin=wp-smushit&TB_iframe=true&width=600&height=550') . '" class="thickbox open-plugin-details-modal smush-thickbox">Install the free Smush plugin</a>. It has no limit on the amount of images you can compress, seamlessly integrates with WordPress, and is compatible with all plugins &amp; themes. And best of all - <b>it\'s used by over a million users just like you</b>.</p>';
1530
+ }
1531
+ echo '</td>';
1532
+ echo '</tr>';
1533
+
1534
  echo '<tr valign="top">
1535
  <th scope="row"><label for="title">' . __('Title', 'under-construction-page') . '</label></th>
1536
  <td><input type="text" id="title" class="regular-text" name="' . UCP_OPTIONS_KEY . '[title]" value="' . esc_attr($options['title']) . '" />';
2468
  // add our plugins to recommended list
2469
  static function plugins_api_result($res, $action, $args) {
2470
  remove_filter('plugins_api_result', array(__CLASS__, 'plugins_api_result'), 10, 3);
2471
+
2472
  $res = self::add_plugin_favs('eps-301-redirects', $res);
2473
  $res = self::add_plugin_favs('simple-author-box', $res);
2474
  $res = self::add_plugin_favs('security-ninja', $res);
2475
+
2476
  return $res;
2477
  } // plugins_api_result
2478
 
wp301/wp301-logo.png ADDED
Binary file
wp301/wp301.js ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Campaign for WP 301 Redirects PRO
3
+ * (c) WebFactory Ltd, 2020
4
+ */
5
+
6
+ jQuery(document).ready(function ($) {
7
+ $('#wp301promo_dismiss').on('click', function (e) {
8
+ e.preventDefault();
9
+
10
+ var slug = $(this).data('plugin-slug');
11
+
12
+ $.get({
13
+ url: ajaxurl,
14
+ data: {
15
+ action: 'wp301_promo_dismiss',
16
+ slug: slug,
17
+ _ajax_nonce: wp301_promo.nonce_wp301_promo_dismiss,
18
+ },
19
+ })
20
+ .always(function (data) {})
21
+ .done(function (data) {
22
+ if (data.success) {
23
+ if (slug == 'dashboard') {
24
+ $('#wp301promo_widget').hide();
25
+ } else {
26
+ $('#wp301-dialog').dialog('close');
27
+ }
28
+ } else {
29
+ alert('Sorry, something is not right. Please reload the page and try again.');
30
+ }
31
+ })
32
+ .fail(function (data) {
33
+ alert('Sorry, something is not right. Please reload the page and try again.');
34
+ });
35
+ }); // dismiss
36
+
37
+
38
+ $('#wp301promo_submit').on('click', function (e) {
39
+ e.preventDefault();
40
+
41
+ var btn = $('#wp301promo_submit');
42
+ var name = $('#wp301promo_name').val();
43
+ var email = $('#wp301promo_email').val();
44
+ var plugin = $('#wp301promo_plugin').val();
45
+ var position = $('#wp301promo_position').val();
46
+ var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
47
+
48
+ if (name.length < 2 || name.length > 128) {
49
+ $('#wp301promo_name').focus();
50
+ alert('Please enter your name. Thank you 👍');
51
+ return false;
52
+ }
53
+ if (!regex.test(email) || email.lenght > 128) {
54
+ $('#wp301promo_email').focus();
55
+ alert('Please enter a valid email address. Thank you 👍');
56
+ return false;
57
+ }
58
+
59
+ $(btn).addClass('disabled');
60
+ $.get({
61
+ url: ajaxurl,
62
+ data: {
63
+ action: 'wp301_promo_submit',
64
+ _ajax_nonce: wp301_promo.nonce_wp301_promo_submit,
65
+ name: name,
66
+ email: email,
67
+ position: position,
68
+ plugin: plugin,
69
+ },
70
+ })
71
+ .always(function (data) {
72
+ $(btn).removeClass('disabled');
73
+ })
74
+ .done(function (data) {
75
+ if (data.success) {
76
+ alert(data.data);
77
+
78
+ if (position == 'dashboard') {
79
+ $('#wp301promo_widget').hide();
80
+ } else {
81
+ $('#wp301-dialog').dialog('close');
82
+ }
83
+ } else {
84
+ alert(data.data);
85
+ }
86
+ })
87
+ .fail(function (data) {
88
+ alert('Sorry, something is not right. Please reload the page and try again.');
89
+ });
90
+ });
91
+
92
+
93
+ $('#wp301promo_name, #wp301promo_email').on('keypress', function (e) {
94
+ if (e.which == 13) {
95
+ $('#wp301promo_submit').trigger('click');
96
+ }
97
+ }); // on enter
98
+
99
+
100
+ if (wp301_promo.open_popup && $('#wp301-dialog').length == 1) {
101
+ $('#wp301-dialog').dialog({
102
+ dialogClass: 'wp-dialog wp301-dialog',
103
+ modal: true,
104
+ resizable: false,
105
+ width: 550,
106
+ height: 'auto',
107
+ show: 'fade',
108
+ hide: 'fade',
109
+ close: function (event, ui) {},
110
+ open: function (event, ui) {
111
+ $(this)
112
+ .siblings()
113
+ .find('span.ui-dialog-title')
114
+ .html('Get a WP 301 Redirects PRO license for FREE <del>$158</del>');
115
+ wp301_fix_dialog_close(event, ui);
116
+ },
117
+ autoOpen: true,
118
+ closeOnEscape: false,
119
+ });
120
+ } // open dialog
121
+ }); // jQuery ready
122
+
123
+
124
+ function wp301_fix_dialog_close(event, ui) {
125
+ jQuery('.ui-widget-overlay').bind('click', function () {
126
+ jQuery('#' + event.target.id).dialog('close');
127
+ });
128
+ } // wp301_fix_dialog_close
wp301/wp301.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Campaign for WP 301 Redirects PRO
5
+ * (c) WebFactory Ltd, 2020
6
+ */
7
+
8
+
9
+ if (false == class_exists('wf_wp301')) {
10
+ class wf_wp301
11
+ {
12
+ var $plugin_file = '';
13
+ var $plugin_slug = '';
14
+ var $plugin_screen = '';
15
+ var $options = '';
16
+
17
+
18
+ function __construct($plugin_file, $plugin_screen)
19
+ {
20
+ $this->plugin_file = $plugin_file;
21
+ $this->plugin_slug = basename(dirname($plugin_file));
22
+ $this->plugin_screen = $plugin_screen;
23
+ $this->options = get_option('wp301promo', array());
24
+
25
+ if (!is_admin() || !empty($this->options['email_submitted']) || date('Y-m-d') > '2020-11-05') {
26
+ return;
27
+ } else {
28
+ add_action('admin_init', array($this, 'init'));
29
+ }
30
+ } // __construct
31
+
32
+
33
+ function init()
34
+ {
35
+ add_action('wp_dashboard_setup', array($this, 'add_widget'));
36
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
37
+ add_action('wp_ajax_wp301_promo_submit', array($this, 'ajax_submit'));
38
+ add_action('wp_ajax_wp301_promo_dismiss', array($this, 'ajax_dismiss'));
39
+ add_action('admin_footer', array($this, 'admin_footer'));
40
+ } // init
41
+
42
+
43
+ function admin_enqueue_scripts()
44
+ {
45
+ $screen = get_current_screen();
46
+
47
+ if ($screen->base != 'dashboard' && $screen->id != $this->plugin_screen) {
48
+ return;
49
+ }
50
+
51
+ if ($screen->base == 'dashboard' && !empty($this->options['popup_dismissed_dashboard'])) {
52
+ return;
53
+ }
54
+
55
+ if ($screen->id == $this->plugin_screen) {
56
+ wp_enqueue_style('wp-jquery-ui-dialog');
57
+ wp_enqueue_script('jquery-ui-dialog');
58
+ }
59
+
60
+ wp_enqueue_script('wp301_promo', plugin_dir_url($this->plugin_file) . 'wp301/wp301.js');
61
+
62
+ $js_vars = array(
63
+ 'nonce_wp301_promo_submit' => wp_create_nonce('wp301_submit'),
64
+ 'nonce_wp301_promo_dismiss' => wp_create_nonce('wp301_dismiss'),
65
+ );
66
+
67
+ if (empty($this->options['popup_dismissed_' . $this->plugin_slug])) {
68
+ $js_vars['open_popup'] = true;
69
+ }
70
+
71
+ wp_localize_script('wp301_promo', 'wp301_promo', $js_vars);
72
+ } // admin_enqueue_scripts
73
+
74
+
75
+ function ajax_dismiss()
76
+ {
77
+ if (!wp_verify_nonce(@$_GET['_ajax_nonce'], 'wp301_dismiss')) {
78
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
79
+ }
80
+
81
+ $slug = substr(strip_tags(trim(@$_GET['slug'])), 0, 64);
82
+
83
+ $this->options['popup_dismissed_' . $slug] = true;
84
+ $tmp = update_option('wp301promo', $this->options);
85
+
86
+ if ($tmp) {
87
+ wp_send_json_success();
88
+ } else {
89
+ wp_send_json_error();
90
+ }
91
+ } // ajax_dismiss
92
+
93
+
94
+ function ajax_submit()
95
+ {
96
+ if (!wp_verify_nonce(@$_GET['_ajax_nonce'], 'wp301_submit')) {
97
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
98
+ }
99
+
100
+ $email = strip_tags(trim(@$_GET['email']));
101
+ $name = strip_tags(trim(@$_GET['name']));
102
+ $plugin = strip_tags(trim(@$_GET['plugin'])) . '-' . strip_tags(trim(@$_GET['position']));
103
+
104
+ if (!is_email($email)) {
105
+ wp_send_json_error('Please enter a valid email address.');
106
+ }
107
+
108
+ $url = add_query_arg(array('name' => $name, 'email' => $email, 'plugin' => $plugin), 'https://wp301redirects.com/subscribe/');
109
+
110
+ $response = wp_remote_get($url, array('timeout' => 25));
111
+
112
+ if (is_wp_error($response)) {
113
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
114
+ }
115
+
116
+ $body = @json_decode(wp_remote_retrieve_body($response), true);
117
+ if (empty($body['success'])) {
118
+ wp_send_json_error('Something is not right. Please reload the page and try again.');
119
+ }
120
+
121
+ $this->options['email_submitted'] = true;
122
+ update_option('wp301promo', $this->options);
123
+ wp_send_json_success('Thank you for trusting us with your email! You\'ll hear from us soon 🚀');
124
+ } // ajax_submit
125
+
126
+
127
+ function add_widget()
128
+ {
129
+ if (!empty($this->options['popup_dismissed_dashboard'])) {
130
+ return;
131
+ }
132
+
133
+ add_meta_box('wp301promo_widget', 'Get a WP 301 Redirects PRO license for FREE <del>$158</del>', array($this, 'widget_content'), 'dashboard', 'side', 'high');
134
+ } // add_widget
135
+
136
+
137
+ function widget_content()
138
+ {
139
+ $out = '';
140
+
141
+ $out .= '<style>';
142
+ $out .= '#wp301promo_widget .disabled { pointer-events: none; }';
143
+ $out .= '#wp301promo_widget label { font-weight: normal; display: inline-block; width: 15%; margin-bottom: 10px; }';
144
+ $out .= '#wp301promo_widget input { width: 74%; margin-bottom: 10px; }';
145
+ $out .= '#wp301promo_widget .button-primary { padding: 14px 28px; text-decoration: none; line-height: 1; }';
146
+ $out .= '#wp301promo_dismiss { font-style: italic; display: inline-block; color: #444; text-decoration: none; margin: 8px 0 0 0; }';
147
+ $out .= '#wp301promo_dismiss:hover { text-decoration: underline; }';
148
+ $out .= '#wp301promo_widget, #wp301promo_widget p { font-size: 14px; }';
149
+ $out .= '#wp301promo_widget .title301 { font-weight: 600; margin: 10px 0 -10px 0; }';
150
+ $out .= '#wp301promo_widget img { max-width: 60%; }';
151
+ $out .= '#wp301promo_widget .center { text-align: center; }';
152
+ $out .= '#wp301promo_email { margin-bottom: 0 !important; }';
153
+ $out .= '#wp301promo_widget { background-color: #fafafa; }';
154
+ $out .= '#wp301promo_widget li a { text-decoration: underline; }';
155
+ $out .= '#wp301promo_widget .wp301inside { padding: 25px 12px 0px 12px; position: relative; }';
156
+ $out .= '#wp301promo_widget p { margin-top: 14px; line-height: 1.5; }';
157
+ $out .= '#wp301promo_widget small { margin-left: 17%; }';
158
+ $out .= '#wp301promo_widget ul { font-size: 14px; margin: 0 0 20px 0; list-style-type: disc; list-style-position: inside; }';
159
+ $out .= '#wp301promo_widget li { margin-bottom: 3px; }';
160
+ $out .= '#wp301promo_submit span { display: none; text-decoration: none; margin-right: 10px; animation: wf-spin-animation 1.5s infinite linear; }';
161
+ $out .= '#wp301promo_submit.disabled span { display: inline-block; }';
162
+ $out .= '@keyframes wf-spin-animation {
163
+ from { transform: rotate(0deg); }
164
+ to { transform: rotate(360deg); }
165
+ }';
166
+ $out .= '#wp301promo_widget .inside { overflow: hidden; margin: 0; }
167
+ .ribbon { margin: 0; padding: 11px 20px 10px 20px; background: #007cba; color: #FFF; font-weight: 800; position: absolute; top: -17px; right: -17px; transform: translateX(30%) translateY(0%) rotate(45deg); transform-origin: top left; letter-spacing: 1px; }
168
+ .ribbon:before, .ribbon:after { content: ""; position: absolute; top:0; margin: 0 -1px; width: 100%; height: 100%; background: #007cba; }
169
+ .ribbon:before { right:100%; }
170
+ .ribbon:after { left:100%; }';
171
+ $out .= '</style>';
172
+
173
+ $plugin_url = plugin_dir_url($this->plugin_file);
174
+
175
+ $out .= '<div class="ribbon">FREE</div>';
176
+ $out .= '<div class="wp301inside">';
177
+
178
+ $out .= '<div class="center"><a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-dashboard" target="_blank"><img src="' . $plugin_url . 'wp301/wp301-logo.png' . '" alt="WP 301 Redirects PRO" title="WP 301 Redirects PRO"></a></div>';
179
+
180
+ $out .= '<p>On November 6th <a href="https://www.webfactoryltd.com/" target="_blank">WebFactory Ltd</a> will give away a limited number of lifetime WP 301 Redirect PRO licenses, <b>each for 10 sites</b>. A $158 retail value! 🚀 Leave your email, we\'ll send you a link &amp; download your copy.</p><p style="margin-bottom: 0;"><b>What do I get?</b></p>';
181
+
182
+ $out .= '<ul>';
183
+ $out .= '<li>Automatically fix 404 errors &amp; URL typos</li>';
184
+ $out .= '<li>Create advanced redirect rules &amp; control affiliate links</li>';
185
+ $out .= '<li>Detailed log of all redirects &amp; 404s</li>';
186
+ $out .= '<li>Manage all sites\' licenses from a central Dashboard</li>';
187
+ $out .= '<li>Lifetime license for 10 sites. <a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-dashboard" target="_blank">See all features</a></li>';
188
+ $out .= '</ul>';
189
+
190
+ $out .= '
191
+ <div>
192
+ <label for="wp301promo_name">Name:</label>
193
+ <input type="text" name="wp301promo_name" id="wp301promo_name" placeholder="How shall we call you?"><br>
194
+ <label for="wp301promo_email">Email:</label>
195
+ <input type="text" name="wp301promo_email" id="wp301promo_email" placeholder="Your best email address to get the plugin"><br>
196
+ <small>We hate spam as much as you do and never send it!</small>
197
+ <input type="hidden" id="wp301promo_plugin" value="' . $this->plugin_slug . '">
198
+ <input type="hidden" id="wp301promo_position" value="dashboard">
199
+ </div>
200
+
201
+ <p class="center">
202
+ <a id="wp301promo_submit" class="button button-primary" href="#"><span class="dashicons dashicons-update"></span>I Want My FREE License <del>$158</del></a><br>
203
+ <a id="wp301promo_dismiss" class="" href="#" data-plugin-slug="dashboard">I don\'t want a free license; don\'t show this again</a>
204
+ </p>
205
+ </div>';
206
+
207
+ echo $out;
208
+ } // widget_content
209
+
210
+
211
+ function admin_footer()
212
+ {
213
+ $screen = get_current_screen();
214
+ if ($screen->id != $this->plugin_screen) {
215
+ return;
216
+ }
217
+
218
+ $out = '';
219
+
220
+ $out .= '<style>';
221
+ $out .= '#wp301promo_widget .disabled { pointer-events: none; }';
222
+ $out .= '.wp301-dialog .ui-dialog-titlebar-close { visibility: hidden; }';
223
+ $out .= '#wp301-dialog label { font-weight: normal; display: inline-block; width: 15%; margin-bottom: 10px; }';
224
+ $out .= '#wp301-dialog input { width: 74%; margin-bottom: 10px; }';
225
+ $out .= '#wp301-dialog .button-primary { background-color: #007cba; border: 1px solid #007cba; padding: 14px 28px; text-decoration: none; line-height: 1; }';
226
+ $out .= '#wp301-dialog, #wp301-dialog p { font-size: 14px; }';
227
+ $out .= '#wp301-dialog .title301 { font-size: 1.3em; font-weight: 600; margin: 10px 0 -10px 0; }';
228
+ $out .= '#wp301-dialog img { max-width: 60%; }';
229
+ $out .= '#wp301-dialog li a { text-decoration: underline; }';
230
+ $out .= '#wp301-dialog small { margin-left: 16%; }';
231
+ $out .= '#wp301-dialog .center { text-align: center; }';
232
+ $out .= '#wp301-dialog, .wp301-dialog .ui-dialog-titlebar { background-color: #fafafa; }';
233
+ $out .= '#wp301-dialog .wp301inside { padding: 12px 12px 0px 12px; }';
234
+ $out .= '#wp301-dialog p { margin-top: 14px; line-height: 1.5; }';
235
+ $out .= '#wp301-dialog ul { margin: 0 0 20px 0; list-style-type: disc; list-style-position: inside; }';
236
+ $out .= '#wp301-dialog li { margin-bottom: 3px; }';
237
+ $out .= '#wp301promo_dismiss { display: inline-block; color: #444; text-decoration: none; margin: 8px 0 0 0; }';
238
+ $out .= '#wp301promo_dismiss:hover { text-decoration: underline; }';
239
+ $out .= '#wp301promo_submit span { display: none; text-decoration: none; margin-right: 10px; animation: wf-spin-animation 1.5s infinite linear; }';
240
+ $out .= '#wp301promo_submit.disabled span { display: inline-block; }';
241
+ $out .= '@keyframes wf-spin-animation {
242
+ from { transform: rotate(0deg); }
243
+ to { transform: rotate(360deg); }
244
+ }';
245
+ $out .= '#wp301promo_widget .inside { overflow: hidden; margin: 0; }
246
+ .ribbon { margin: 0; padding: 11px 20px 10px 20px; background: #007cba; color: #FFF; font-weight: 800; position: absolute; top: -17px; right: -17px; transform: translateX(30%) translateY(0%) rotate(45deg); transform-origin: top left; letter-spacing: 1px; }
247
+ .ribbon:before, .ribbon:after { content: ""; position: absolute; top:0; margin: 0 -1px; width: 100%; height: 100%; background: #007cba; }
248
+ .ribbon:before { right:100%; }
249
+ .ribbon:after { left:100%; }';
250
+ $out .= '</style>';
251
+
252
+ $out .= '<div id="wp301-dialog" style="display: none;" title="Get a WP 301 Redirects PRO license for FREE"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
253
+
254
+ $plugin_url = plugin_dir_url($this->plugin_file);
255
+
256
+ $out .= '<div class="wp301inside">';
257
+ $out .= '<div class="ribbon">FREE</div>';
258
+
259
+ $out .= '<div class="center"><a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-popup" target="_blank"><img src="' . $plugin_url . 'wp301/wp301-logo.png' . '" alt="WP 301 Redirects PRO" title="WP 301 Redirects PRO"></a></div>';
260
+
261
+ $out .= '<p>On November 6th <a href="https://www.webfactoryltd.com/" target="_blank">WebFactory Ltd</a> will give away a limited number of lifetime WP 301 Redirect PRO licenses, <b>each for 10 sites</b>. A $158 retail value! 🚀 Leave your email, we\'ll send you a link &amp; download your copy.</p><p style="margin-bottom: 0;"><b>What do I get?</b></p>';
262
+
263
+ $out .= '<ul>';
264
+ $out .= '<li>Automatically fix 404 errors &amp; URL typos</li>';
265
+ $out .= '<li>Create advanced redirect rules &amp; control affiliate links</li>';
266
+ $out .= '<li>Detailed log of all redirects &amp; 404s</li>';
267
+ $out .= '<li>Manage all sites\' licenses from a central Dashboard</li>';
268
+ $out .= '<li>Lifetime license for 10 sites. <a href="https://wp301redirects.com/free-license/?ref=free-' . $this->plugin_slug . '-popup" target="_blank">See all features</a></li>';
269
+ $out .= '</ul>';
270
+
271
+ $out .= '
272
+ <div>
273
+ <label for="wp301promo_name">Name:</label>
274
+ <input type="text" name="wp301promo_name" id="wp301promo_name" placeholder="How shall we call you?"><br>
275
+ <label for="wp301promo_email">Email:</label>
276
+ <input type="text" name="wp301promo_email" id="wp301promo_email" placeholder="Your best email address to get the plugin"><br>
277
+ <small>We hate spam as much as you do and never send it!</small>
278
+ <input type="hidden" id="wp301promo_plugin" value="' . $this->plugin_slug . '">
279
+ <input type="hidden" id="wp301promo_position" value="popup">
280
+ </div>
281
+
282
+ <p class="center">
283
+ <a id="wp301promo_submit" class="button button-primary" href="#"><span class="dashicons dashicons-update"></span>I Want My FREE License <del>$158</del></a><br>
284
+ <a id="wp301promo_dismiss" class="" href="#" data-plugin-slug="' . $this->plugin_slug . '">I don\'t want a free license; don\'t show this again</a>
285
+ </p>
286
+
287
+ </div>';
288
+
289
+ $out .= '</div>';
290
+
291
+ echo $out;
292
+ } // wp_footer
293
+ } // wf_wp301
294
+ }