Under Construction - Version 3.35

Version Description

  • 2019/03/18
  • 300,000 installs hit on 2019/01/18 with 2,151,500 downloads
  • bug fixes
  • partnership with Weglot
Download this release

Release Info

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

Code changes from version 3.31 to 3.35

css/ucp-admin.css CHANGED
@@ -229,7 +229,8 @@ div.ucp-thumb img, .ucp-thumb-special img {
229
  .ucp-list {
230
  list-style-type: circle;
231
  list-style-position: outside;
232
- margin-left: 14px;
 
233
  }
234
 
235
  input[type=url]:invalid, input[type=email]:invalid, input[type=tel]:invalid {
@@ -919,3 +920,42 @@ option.mailoptin-promo {
919
  border-top: 1px solid #2980b9;
920
  }
921
  /* upsell dialog */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  .ucp-list {
230
  list-style-type: circle;
231
  list-style-position: outside;
232
+ margin-left: 14px;
233
+ line-height: 150%;
234
  }
235
 
236
  input[type=url]:invalid, input[type=email]:invalid, input[type=tel]:invalid {
920
  border-top: 1px solid #2980b9;
921
  }
922
  /* upsell dialog */
923
+
924
+ /* weglot upsell dialog */
925
+ .weglot-upsell-dialog .ui-dialog-titlebar {
926
+ background: linear-gradient(140deg, #335ee2 10%, #271f50 90%);
927
+ text-align: center;
928
+ height: 55px;
929
+ }
930
+ .weglot-upsell-dialog .ui-dialog-titlebar img {
931
+ height: 32px;
932
+ display: inline-block;
933
+ margin: 11px 0 0 0;
934
+ }
935
+ .weglot-upsell-dialog .ui-dialog-titlebar-close {
936
+ color: #fff;
937
+ height: 55px;
938
+ }
939
+ .weglot-upsell-dialog .ui-dialog-titlebar-close:hover {
940
+ color: #333;
941
+ }
942
+ .weglot-upsell-dialog .ui-dialog-content {
943
+ padding: 0;
944
+ }
945
+ .weglot-upsell-dialog .ui-tabs-nav {
946
+ text-align: center;
947
+ }
948
+ .weglot-upsell-dialog .ui-tabs .upsell-tab {
949
+ padding: 20px 15px;
950
+ text-align: center;
951
+ }
952
+ .weglot-upsell-dialog a {
953
+ color: #333;
954
+ }
955
+ .weglot-upsell-dialog a:hover {
956
+ color: #000;
957
+ }
958
+ option.weglot-promo {
959
+ color: #2980b9;
960
+ }
961
+ /* upsell dialog */
images/weglot-logo-white.png ADDED
Binary file
js/ucp-admin.js CHANGED
@@ -331,6 +331,38 @@ jQuery(document).ready(function($) {
331
  });
332
 
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  // zebra on pricing table, per column
335
  $('#ucp-pricing-table').find('tr').each(function() {
336
  $(this).find('td').eq(1).addClass('hover');
@@ -395,6 +427,17 @@ jQuery(document).ready(function($) {
395
  });
396
 
397
 
 
 
 
 
 
 
 
 
 
 
 
398
  $('#tabs_upsell').on('tabsactivate', function(event, ui) {
399
  $('#upsell-dialog').dialog("option", "position", {my: "center", at: "center", of: window});
400
  });
331
  });
332
 
333
 
334
+ // upsell dialog init
335
+ $('#weglot-upsell-dialog').dialog({'dialogClass': 'wp-dialog ucp-dialog weglot-upsell-dialog',
336
+ 'modal': 1,
337
+ 'resizable': false,
338
+ 'title': 'Translate your under construction page to any language',
339
+ 'zIndex': 9999,
340
+ 'width': 550,
341
+ 'height': 'auto',
342
+ 'show': 'fade',
343
+ 'hide': 'fade',
344
+ 'open': function(event, ui) {
345
+ ucp_fix_dialog_close(event, ui);
346
+ $(this).siblings().find('span.ui-dialog-title').html(ucp.weglot_dialog_upsell_title);
347
+ },
348
+ 'close': function(event, ui) { },
349
+ 'autoOpen': false,
350
+ 'closeOnEscape': true
351
+ });
352
+ $(window).resize(function(e) {
353
+ $('#weglot-upsell-dialog').dialog("option", "position", {my: "center", at: "center", of: window});
354
+ });
355
+
356
+
357
+ jQuery('#install-weglot').on('click',function(e){
358
+ $('#weglot-upsell-dialog').dialog('close');
359
+ jQuery('body').append('<div style="width:550px;height:450px; position:fixed;top:10%;left:50%;margin-left:-275px; color:#444; background-color: #fbfbfb;border:1px solid #DDD; border-radius:4px;box-shadow: 0px 0px 0px 4000px rgba(0, 0, 0, 0.85);z-index: 9999999;"><iframe src="' + ucp.weglot_install_url + '" style="width:100%;height:100%;border:none;" /></div>');
360
+ jQuery('#wpwrap').css('pointer-events', 'none');
361
+ e.preventDefault();
362
+ return false;
363
+ });
364
+
365
+
366
  // zebra on pricing table, per column
367
  $('#ucp-pricing-table').find('tr').each(function() {
368
  $(this).find('td').eq(1).addClass('hover');
427
  });
428
 
429
 
430
+ $('.settings_page_ucp').on('click', '.open-weglot-upsell', function(e) {
431
+ e.preventDefault();
432
+
433
+ $(this).blur();
434
+
435
+ $('#weglot-upsell-dialog').dialog('open');
436
+
437
+ return false;
438
+ });
439
+
440
+
441
  $('#tabs_upsell').on('tabsactivate', function(event, ui) {
442
  $('#upsell-dialog').dialog("option", "position", {my: "center", at: "center", of: window});
443
  });
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
  === Under Construction ===
2
  Contributors: WebFactory, UnderConstructionPage, googlemapswidget, securityninja, wpreset
3
- Tags: maintenance mode, maintenance page, coming soon page, landing page, under construction, under construction page, coming soon, launch page, coming soon mode, maintenance mode page, offline page, maintenance
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
- Tested up to: 5.0
7
- Stable tag: 3.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- The fastest & simplest Under Construction Page, Landing Page, Maintenance Mode & Coming Soon WordPress plugin. Super-easy to use!
12
 
13
 
14
  == Description ==
@@ -23,6 +23,8 @@ A simple, no-nonsense plugin for all those situations when you have to hide the
23
 
24
  UCP has full support for collecting leads and subscribers via optin boxes in content, and optin popups. We've integrated <a href="https://wordpress.org/plugins/mailoptin/">MailOptin</a> a great, free plugin into UCP that connects to MailChimp and numerous other autoresponder services allowing you to easily collect emails.
25
 
 
 
26
 
27
  **Options**
28
 
@@ -135,6 +137,12 @@ Or if needed, upload manually;
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
138
  = 3.31 =
139
  * 2019/01/15
140
  * minor security fix
1
  === Under Construction ===
2
  Contributors: WebFactory, UnderConstructionPage, googlemapswidget, securityninja, wpreset
3
+ Tags: maintenance mode, maintenance page, coming soon page, landing page, under construction, under construction page, coming soon, launch page, coming soon mode, maintenance mode page, offline page, maintenance, multilingual, multilanguage
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
+ Tested up to: 5.1
7
+ Stable tag: 3.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Super-easy to use Under Construction Page, Landing Page, Maintenance Mode & Coming Soon WordPress plugin.
12
 
13
 
14
  == Description ==
23
 
24
  UCP has full support for collecting leads and subscribers via optin boxes in content, and optin popups. We've integrated <a href="https://wordpress.org/plugins/mailoptin/">MailOptin</a> a great, free plugin into UCP that connects to MailChimp and numerous other autoresponder services allowing you to easily collect emails.
25
 
26
+ Thanks to our partnership with <a href="https://wordpress.org/plugins/weglot/">Weglot</a>, UCP is fully multilanguage ready and you can instantly translate your under construction page to 100+ languages with one click.
27
+
28
 
29
  **Options**
30
 
137
 
138
  == Changelog ==
139
 
140
+ = 3.35 =
141
+ * 2019/03/18
142
+ * 300,000 installs hit on 2019/01/18 with 2,151,500 downloads
143
+ * bug fixes
144
+ * partnership with Weglot
145
+
146
  = 3.31 =
147
  * 2019/01/15
148
  * minor security fix
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.31
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
@@ -87,9 +87,10 @@ class UCP {
87
  add_action('admin_action_ucp_change_status', array(__CLASS__, 'change_status'));
88
  add_action('admin_action_ucp_reset_settings', array(__CLASS__, 'reset_settings'));
89
  add_action('admin_action_install_mailoptin', array(__CLASS__, 'install_mailoptin'));
 
90
 
91
  // enqueue admin scripts
92
- add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
93
 
94
  // AJAX endpoints
95
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
@@ -325,7 +326,9 @@ class UCP {
325
  'is_activated' => UCP_license::is_activated(),
326
  'dialog_upsell_title' => '<img alt="' . __('UnderConstructionPage PRO', 'under-construction-page') . '" title="' . __('UnderConstructionPage PRO', 'under-construction-page') . '" src="' . UCP_PLUGIN_URL . 'images/ucp_pro_logo_white.png' . '">',
327
  'mailoptin_dialog_upsell_title' => '<img alt="' . __('MailOptin', 'under-construction-page') . '" title="' . __('MailOptin', 'under-construction-page') . '" src="' . UCP_PLUGIN_URL . 'images/mailoptin-logo-white.png' . '">',
 
328
  'mailoptin_install_url' => add_query_arg(array('action' => 'install_mailoptin'), admin_url('admin.php')),
 
329
  'nonce_dismiss_survey' => wp_create_nonce('ucp_dismiss_survey'),
330
  'nonce_submit_survey' => wp_create_nonce('ucp_submit_survey'),
331
  'nonce_submit_earlybird' => wp_create_nonce('ucp_submit_earlybird'),
@@ -634,6 +637,11 @@ class UCP {
634
 
635
  $out .= '<link rel="shortcut icon" type="image/png" href="' . trailingslashit(UCP_PLUGIN_URL . 'themes/images') . 'favicon.png" />';
636
 
 
 
 
 
 
637
  if (self::is_mailoptin_active()) {
638
  $out .= '<script src="' . includes_url('/js/jquery/jquery.js') . '"></script>';
639
  $out .= '<script type="text/javascript">
@@ -1502,8 +1510,55 @@ class UCP {
1502
  $default_options = self::default_options();
1503
 
1504
  echo '<div class="ucp-tab-content">';
 
 
 
 
 
 
1505
  echo '<table class="form-table">';
1506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1507
  // todo: translate
1508
  echo '<tr valign="top">
1509
  <th scope="row"><label for="title">' . __('Title', 'under-construction-page') . '</label></th>
@@ -1801,7 +1856,6 @@ class UCP {
1801
 
1802
  static function tab_design() {
1803
  $options = self::get_options();
1804
- $default_options = self::default_options();
1805
 
1806
  $img_path = UCP_PLUGIN_URL . 'images/thumbnails/';
1807
  $themes = self::get_themes();
@@ -2160,7 +2214,24 @@ class UCP {
2160
  echo '</ul>';
2161
  echo '<p class="upsell-footer"><a class="button button-primary" id="install-mailoptin">Install &amp; activate MailOptin to start collecting leads</a></p>';
2162
  echo '</div>';
2163
- echo '</div>'; // mailoptin install dialog
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2164
 
2165
  $promo = self::is_promo_active();
2166
  if ($promo == 'welcome') {
@@ -2388,6 +2459,60 @@ class UCP {
2388
  } // install_mailoptin
2389
 
2390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2391
  static function is_plugin_installed($slug) {
2392
  if (!function_exists('get_plugins')) {
2393
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
@@ -2409,7 +2534,7 @@ class UCP {
2409
  }
2410
 
2411
  if (is_plugin_active('mailoptin/mailoptin.php')) {
2412
- $mailoptin_info = get_plugin_data(ABSPATH.'wp-content/plugins/mailoptin/mailoptin.php');
2413
  if( version_compare($mailoptin_info['Version'], '1.2.10.1', '<')) {
2414
  return false;
2415
  } else {
@@ -2421,6 +2546,40 @@ class UCP {
2421
  } // is_mailoptin_active
2422
 
2423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2424
  // helper function for adding plugins to fav list
2425
  static function featured_plugins_tab($args) {
2426
  add_filter('plugins_api_result', array(__CLASS__, 'plugins_api_result'), 10, 3);
@@ -2433,7 +2592,7 @@ class UCP {
2433
  static function add_plugin_favs($plugin_slug, $res) {
2434
  if (!empty($res->plugins) && is_array($res->plugins)) {
2435
  foreach ($res->plugins as $plugin) {
2436
- if ($plugin->slug == $plugin_slug) {
2437
  return $res;
2438
  }
2439
  } // foreach
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.35
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
87
  add_action('admin_action_ucp_change_status', array(__CLASS__, 'change_status'));
88
  add_action('admin_action_ucp_reset_settings', array(__CLASS__, 'reset_settings'));
89
  add_action('admin_action_install_mailoptin', array(__CLASS__, 'install_mailoptin'));
90
+ add_action('admin_action_install_weglot', array(__CLASS__, 'install_weglot'));
91
 
92
  // enqueue admin scripts
93
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'), 100, 1);
94
 
95
  // AJAX endpoints
96
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
326
  'is_activated' => UCP_license::is_activated(),
327
  'dialog_upsell_title' => '<img alt="' . __('UnderConstructionPage PRO', 'under-construction-page') . '" title="' . __('UnderConstructionPage PRO', 'under-construction-page') . '" src="' . UCP_PLUGIN_URL . 'images/ucp_pro_logo_white.png' . '">',
328
  'mailoptin_dialog_upsell_title' => '<img alt="' . __('MailOptin', 'under-construction-page') . '" title="' . __('MailOptin', 'under-construction-page') . '" src="' . UCP_PLUGIN_URL . 'images/mailoptin-logo-white.png' . '">',
329
+ 'weglot_dialog_upsell_title' => '<img alt="' . __('Weglot', 'under-construction-page') . '" title="' . __('Weglot', 'under-construction-page') . '" src="' . UCP_PLUGIN_URL . 'images/weglot-logo-white.png' . '">',
330
  'mailoptin_install_url' => add_query_arg(array('action' => 'install_mailoptin'), admin_url('admin.php')),
331
+ 'weglot_install_url' => add_query_arg(array('action' => 'install_weglot'), admin_url('admin.php')),
332
  'nonce_dismiss_survey' => wp_create_nonce('ucp_dismiss_survey'),
333
  'nonce_submit_survey' => wp_create_nonce('ucp_submit_survey'),
334
  'nonce_submit_earlybird' => wp_create_nonce('ucp_submit_earlybird'),
637
 
638
  $out .= '<link rel="shortcut icon" type="image/png" href="' . trailingslashit(UCP_PLUGIN_URL . 'themes/images') . 'favicon.png" />';
639
 
640
+ if (self::is_weglot_setup()) {
641
+ $out .= '<link rel="stylesheet" href="' . WEGLOT_URL_DIST . '/css/front-css.css?v=' . WEGLOT_VERSION . '" type="text/css">';
642
+ $out .= '<script src="' . WEGLOT_URL_DIST . '/front-js.js?v=' . WEGLOT_VERSION . '"></script>';
643
+ }
644
+
645
  if (self::is_mailoptin_active()) {
646
  $out .= '<script src="' . includes_url('/js/jquery/jquery.js') . '"></script>';
647
  $out .= '<script type="text/javascript">
1510
  $default_options = self::default_options();
1511
 
1512
  echo '<div class="ucp-tab-content">';
1513
+
1514
+ if (!self::is_weglot_active()) {
1515
+ echo '<div class="ucp-notice-small"><p><b>NEW</b> - Make your under construction page and your website <b>multilingual</b> with the Weglot Translate plugin.<br>To enable this feature, <a href="#" class="open-weglot-upsell">install the Weglot Translate freemium plugin</a>.';
1516
+ echo '</p></div>';
1517
+ }
1518
+
1519
  echo '<table class="form-table">';
1520
 
1521
+ if (self::is_weglot_active()) {
1522
+ echo '<tr id="weglot-settings">';
1523
+ echo '<th><label for="weglot_lang">Multilingual Support</label></th>';
1524
+ echo '<td>';
1525
+
1526
+
1527
+ if (self::is_weglot_setup()) {
1528
+ $tmp = '';
1529
+ $active_languages = weglot_get_destination_language();
1530
+ $languages = weglot_get_languages_available();
1531
+ $original_language = weglot_get_original_language();
1532
+
1533
+ echo '<p>Your under construction page is currently available in the following languages.<br>To add more languages and configure translations open <a href="' . admin_url('admin.php?page=weglot-settings') . '">Weglot settings</a>.</p>';
1534
+ echo '<ul class="ucp-list">';
1535
+ foreach ($languages as $language) {
1536
+ if ($language->getIso639() == $original_language) {
1537
+ $tmp = '<li>' . esc_html($language->getEnglishName()) . ' - original language</li>' . $tmp;
1538
+ }
1539
+ if (in_array($language->getIso639(), $active_languages, true )) {
1540
+ $tmp .= '<li>' . esc_html($language->getLocalName()) . '</li>';
1541
+ }
1542
+ } // foreach language
1543
+ echo $tmp;
1544
+ echo '</ul>';
1545
+ } else {
1546
+ echo '<p>Your under construction page is currently not translated.<br>Open <a href="' . admin_url('admin.php?page=weglot-settings') . '">Weglot settings</a> to select languages you want to translate to.</p>';
1547
+ }
1548
+ echo '</td>';
1549
+ echo '</tr>';
1550
+ } else {
1551
+ echo '<tr>';
1552
+ echo '<th><label for="weglot_support">Multilingual Support</label></th>';
1553
+ echo '<td>';
1554
+ echo '<div class="toggle-wrapper">
1555
+ <input type="checkbox" id="weglot_support" type="checkbox" value="1" class="skip-save open-weglot-upsell">
1556
+ <label for="weglot_support" class="toggle"><span class="toggle_handler"></span></label></div>';
1557
+ echo '<p class="description">55% of online visitors prefer to browse in their mother tongue. If you have an audience speaking multiple languages, making your website multilingual is a must-have. To instantly translate your website and your under construction page, <a href="#" class="open-weglot-upsell">install the Weglot plugin</a> (free plan and free trial available). It seamlessly integrates with UCP and is compatible with all themes &amp; plugins.</p>';
1558
+ echo '</td>';
1559
+ echo '</tr>';
1560
+ } // weglot not active
1561
+
1562
  // todo: translate
1563
  echo '<tr valign="top">
1564
  <th scope="row"><label for="title">' . __('Title', 'under-construction-page') . '</label></th>
1856
 
1857
  static function tab_design() {
1858
  $options = self::get_options();
 
1859
 
1860
  $img_path = UCP_PLUGIN_URL . 'images/thumbnails/';
1861
  $themes = self::get_themes();
2214
  echo '</ul>';
2215
  echo '<p class="upsell-footer"><a class="button button-primary" id="install-mailoptin">Install &amp; activate MailOptin to start collecting leads</a></p>';
2216
  echo '</div>';
2217
+ echo '</div>';
2218
+ // mailoptin install dialog
2219
+
2220
+ // weglot install dialog
2221
+ echo '<div id="weglot-upsell-dialog" style="display: none;" title="Weglot"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
2222
+ echo '<div style="padding: 20px; font-size: 15px;">';
2223
+ echo '<ul class="ucp-list">';
2224
+ echo '<li>Best-rated WordPress multilingual plugin</li>';
2225
+ echo '<li>Simple 5-minute set-up. No coding required</li>';
2226
+ echo '<li>Accelerated translation management: Machine & human translations with access to professional translators</li>';
2227
+ echo '<li>Compatible with any WordPress theme or plugin</li>';
2228
+ echo '<li>Optimized for multilingual SEO</li>';
2229
+ echo '<li>10-day Free trial and free plan available</li>';
2230
+ echo '</ul>';
2231
+ echo '<p class="upsell-footer"><a class="button button-primary" id="install-weglot">Install &amp; activate Weglot to make your website multilingual</a></p>';
2232
+ echo '</div>';
2233
+ echo '</div>';
2234
+ // weglot install dialog
2235
 
2236
  $promo = self::is_promo_active();
2237
  if ($promo == 'welcome') {
2459
  } // install_mailoptin
2460
 
2461
 
2462
+ // auto download / install / activate Weglot plugin
2463
+ static function install_weglot() {
2464
+ $plugin_slug = 'weglot/weglot.php';
2465
+ $plugin_zip = 'https://downloads.wordpress.org/plugin/weglot.latest-stable.zip';
2466
+
2467
+ @include_once ABSPATH . 'wp-admin/includes/plugin.php';
2468
+ @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
2469
+ @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
2470
+ @include_once ABSPATH . 'wp-admin/includes/file.php';
2471
+ @include_once ABSPATH . 'wp-admin/includes/misc.php';
2472
+ echo '<style>
2473
+ body{
2474
+ font-family: sans-serif;
2475
+ font-size: 14px;
2476
+ line-height: 1.5;
2477
+ color: #444;
2478
+ }
2479
+ </style>';
2480
+
2481
+ echo '<div style="margin: 20px; color:#444;">';
2482
+ echo 'If things are not done in a minute <a target="_parent" href="' . admin_url('plugin-install.php?s=weglot&tab=search&type=term') .'">install the plugin manually via Plugins page</a><br><br>';
2483
+ echo 'Starting ...<br><br>';
2484
+
2485
+ wp_cache_flush();
2486
+ $upgrader = new Plugin_Upgrader();
2487
+ echo 'Check if Weglot is already installed ... <br />';
2488
+ if (self::is_plugin_installed($plugin_slug)) {
2489
+ echo 'Weglot is already installed! <br /><br />Making sure it\'s the latest version.<br />';
2490
+ $upgrader->upgrade($plugin_slug);
2491
+ $installed = true;
2492
+ } else {
2493
+ echo 'Installing Weglot.<br />';
2494
+ $installed = $upgrader->install($plugin_zip);
2495
+ }
2496
+ wp_cache_flush();
2497
+
2498
+ if (!is_wp_error($installed) && $installed) {
2499
+ echo 'Activating Weglot.<br />';
2500
+ $activate = activate_plugin($plugin_slug);
2501
+
2502
+ if (is_null($activate)) {
2503
+ echo 'Weglot Activated.<br />';
2504
+
2505
+ echo '<script>setTimeout(function() { top.location = "options-general.php?page=ucp"; }, 1000);</script>';
2506
+ echo '<br>If you are not redirected in a few seconds - <a href="options-general.php?page=ucp" target="_parent">click here</a>.';
2507
+ }
2508
+ } else {
2509
+ echo 'Could not install Weglot. You\'ll have to <a target="_parent" href="' . admin_url('plugin-install.php?s=weglot&tab=search&type=term') .'">download and install manually</a>.';
2510
+ }
2511
+
2512
+ echo '</div>';
2513
+ } // install_weglot
2514
+
2515
+
2516
  static function is_plugin_installed($slug) {
2517
  if (!function_exists('get_plugins')) {
2518
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
2534
  }
2535
 
2536
  if (is_plugin_active('mailoptin/mailoptin.php')) {
2537
+ $mailoptin_info = get_plugin_data(ABSPATH . 'wp-content/plugins/mailoptin/mailoptin.php');
2538
  if( version_compare($mailoptin_info['Version'], '1.2.10.1', '<')) {
2539
  return false;
2540
  } else {
2546
  } // is_mailoptin_active
2547
 
2548
 
2549
+ // check if Weglot plugin is active and min version installed
2550
+ static function is_weglot_active() {
2551
+ if (!function_exists('is_plugin_active') || !function_exists('get_plugin_data')) {
2552
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
2553
+ }
2554
+
2555
+ if (is_plugin_active('weglot/weglot.php')) {
2556
+ $weglot_info = get_plugin_data(ABSPATH . 'wp-content/plugins/weglot/weglot.php');
2557
+ if( version_compare($weglot_info['Version'], '2.5', '<')) {
2558
+ return false;
2559
+ } else {
2560
+ return true;
2561
+ }
2562
+ } else {
2563
+ return false;
2564
+ }
2565
+ } // is_weglot_active
2566
+
2567
+
2568
+ // check if Weglot is completely set up
2569
+ static function is_weglot_setup() {
2570
+ if (!self::is_weglot_active()) {
2571
+ return false;
2572
+ }
2573
+
2574
+ $active_languages = weglot_get_destination_language();
2575
+ if (!empty($active_languages)) {
2576
+ return true;
2577
+ } else {
2578
+ return false;
2579
+ }
2580
+ } // is_weglot_setup
2581
+
2582
+
2583
  // helper function for adding plugins to fav list
2584
  static function featured_plugins_tab($args) {
2585
  add_filter('plugins_api_result', array(__CLASS__, 'plugins_api_result'), 10, 3);
2592
  static function add_plugin_favs($plugin_slug, $res) {
2593
  if (!empty($res->plugins) && is_array($res->plugins)) {
2594
  foreach ($res->plugins as $plugin) {
2595
+ if (is_object($plugin) && $plugin->slug == $plugin_slug) {
2596
  return $res;
2597
  }
2598
  } // foreach