Maintenance - Version 4.05

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Maintenance
Version 4.05
Comparing to
See all releases

Code changes from version 4.03 to 4.05

css/admin.css CHANGED
@@ -272,7 +272,12 @@
272
 
273
  #maintenance-options #poststuff .metabox-holder .postbox-container.column-2 {
274
  float: right;
275
- width: 28%;
 
 
 
 
 
276
  min-width: 300px;
277
  }
278
 
@@ -483,3 +488,27 @@
483
  list-style-type: disc;
484
  list-style-position: inside;
485
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
  #maintenance-options #poststuff .metabox-holder .postbox-container.column-2 {
274
  float: right;
275
+ width: 33%;
276
+ min-width: 300px;
277
+ }
278
+
279
+ #side-sortables .postbox {
280
+ max-width: 500px;
281
  min-width: 300px;
282
  }
283
 
488
  list-style-type: disc;
489
  list-style-position: inside;
490
  }
491
+
492
+ #promo-wpfssl {
493
+ border: 3px solid #42982e;
494
+ }
495
+
496
+ #promo-wpfssl a.button:hover, #promo-wpfssl a.button:active, #promo-wpfssl a.button:focus {
497
+ box-shadow: 0px 0px 10px 0px rgb(50 138 210 / 52%);
498
+ background: #42982e;
499
+ color: white;
500
+ border: none;
501
+ }
502
+
503
+ #promo-wpfssl a.button {
504
+ padding: 11px 30px;
505
+ color: white;
506
+ background: #42982e;
507
+ font-weight: 600;
508
+ border: none;
509
+ line-height: 1.5;
510
+ height: auto;
511
+ margin-bottom: 10px;
512
+ white-space: normal;
513
+ max-width: 90%;
514
+ }
images/security-ninja.png DELETED
Binary file
images/weglot-banner.png DELETED
Binary file
images/wp-force-ssl-logo.png ADDED
Binary file
includes/admin.php CHANGED
@@ -111,6 +111,14 @@ function mtnc_admin_print_custom_styles()
111
  'mtnc',
112
  array(
113
  'path' => MTNC_URI,
 
 
 
 
 
 
 
 
114
  'cm_settings' => $cm_settings,
115
  'site_url' => home_url(),
116
  'first_install_date' => $firstInstallDateTimeTimeStamp,
@@ -235,7 +243,7 @@ function mtnc_generate_plugin_page()
235
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
236
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
237
  <div class="postbox-container header-container column-1 normal">
238
- <h1><?php esc_html_e('Maintenance', 'maintenance'); ?><input type="checkbox" id="state" name="lib_options[state]" <?php checked($mt_option['state'], 1); ?> /> <p class="submit"><a href="<?php echo home_url( '?maintenance-preview'); ?>" target="_blank" class="button">Preview</a> &nbsp;&nbsp; <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p></h1>
239
 
240
  </div>
241
  <div class="clear"></div>
111
  'mtnc',
112
  array(
113
  'path' => MTNC_URI,
114
+ 'wpfssl_install_url' => add_query_arg(
115
+ array(
116
+ 'action' => 'mtnc_install_wpfssl',
117
+ '_wpnonce' => wp_create_nonce('install_wpfssl'),
118
+ 'rnd' => rand()
119
+ ),
120
+ admin_url('admin.php')
121
+ ),
122
  'cm_settings' => $cm_settings,
123
  'site_url' => home_url(),
124
  'first_install_date' => $firstInstallDateTimeTimeStamp,
243
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
244
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
245
  <div class="postbox-container header-container column-1 normal">
246
+ <h1><?php esc_html_e('Maintenance', 'maintenance'); ?><input type="checkbox" id="state" name="lib_options[state]" <?php checked($mt_option['state'], 1); ?> /> <p class="submit"><a href="<?php echo esc_url(home_url( '?maintenance-preview')); ?>" target="_blank" class="button">Preview</a> &nbsp;&nbsp; <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p></h1>
247
 
248
  </div>
249
  <div class="clear"></div>
includes/functions.php CHANGED
@@ -47,7 +47,7 @@ function mtnc_generate_input_filed($title, $id, $name, $value, $placeholder = ''
47
  $out_filed .= '</fieldset>';
48
  $out_filed .= '</td>';
49
  $out_filed .= '</tr>';
50
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
51
  }
52
 
53
  function mtnc_generate_number_filed($title, $id, $name, $value, $placeholder = '')
@@ -61,7 +61,7 @@ function mtnc_generate_number_filed($title, $id, $name, $value, $placeholder = '
61
  $out_filed .= '</fieldset>';
62
  $out_filed .= '</td>';
63
  $out_filed .= '</tr>';
64
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
65
  }
66
 
67
  function mtnc_generate_textarea_filed($title, $id, $name, $value)
@@ -75,7 +75,7 @@ function mtnc_generate_textarea_filed($title, $id, $name, $value)
75
  $out_filed .= '</fieldset>';
76
  $out_filed .= '</td>';
77
  $out_filed .= '</tr>';
78
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
79
  }
80
 
81
 
@@ -102,7 +102,7 @@ function mtnc_generate_tinymce_filed($title, $id, $name, $value)
102
  $out_filed .= '</fieldset>';
103
  $out_filed .= '</td>';
104
  $out_filed .= '</tr>';
105
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
106
  }
107
 
108
 
@@ -120,7 +120,7 @@ function mtnc_generate_check_filed($title, $label, $id, $name, $value)
120
  $out_filed .= '</fieldset>';
121
  $out_filed .= '</td>';
122
  $out_filed .= '</tr>';
123
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
124
  }
125
 
126
  function mtnc_generate_image_filed($title, $id, $name, $value, $class, $name_btn, $class_btn)
@@ -150,7 +150,7 @@ function mtnc_generate_image_filed($title, $id, $name, $value, $class, $name_btn
150
  $out_filed .= '</fieldset>';
151
  $out_filed .= '</td>';
152
  $out_filed .= '</tr>';
153
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
154
  }
155
 
156
  function mtnc_get_color_field($title, $id, $name, $value, $default_color)
@@ -164,7 +164,7 @@ function mtnc_get_color_field($title, $id, $name, $value, $default_color)
164
  $out_filed .= '<fieldset>';
165
  $out_filed .= '</td>';
166
  $out_filed .= '</tr>';
167
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
168
  }
169
 
170
  function mtnc_get_google_font($font = null)
@@ -274,7 +274,7 @@ function mtnc_page_create_meta_boxes()
274
  $mt_option = mtnc_get_plugin_options(true);
275
 
276
  if (!$mt_option['default_settings'] || $mt_option['gg_analytics_id']) {
277
- add_meta_box('review-top', __('Please help us keep the plugin free &amp; maintained', 'maintenance'), 'mtnc_add_review_top', $mtnc_variable->options_page, 'normal', 'high');
278
  }
279
  add_meta_box('mtnc-general', __('General Settings', 'maintenance'), 'mtnc_add_data_fields', $mtnc_variable->options_page, 'normal', 'default');
280
  add_meta_box('mtnc-themes', __('Ready To Use Themes', 'maintenance'), 'mtnc_add_themes_fields', $mtnc_variable->options_page, 'normal', 'default');
@@ -295,20 +295,20 @@ function mtnc_add_review_top() {
295
  $promo_text .= '<p><b>Your review means a lot!</b> Please help us spread the word so that others know the Maintenance plugin is free and well maintained!<br>
296
  Thank you very much for using our plugin and helping us out!</p>';
297
  $promo_text .= '<p><br><a href="https://wordpress.org/support/plugin/maintenance/reviews/#new-post" target="_blank" class="button button-primary">Leave a Review</a> &nbsp;&nbsp; <a href="#" class="hide-review-box">I already left a review ;)</a></p>';
298
- echo $promo_text;
299
  }
300
 
301
  function mtnc_page_create_meta_boxes_widget_support()
302
  {
303
  global $mtnc_variable;
304
 
 
 
 
 
305
  add_meta_box('promo-review2', __('Help us keep the plugin free &amp; maintained', 'maintenance'), 'mtnc_review_box', $mtnc_variable->options_page, 'side', 'high');
306
 
307
- if (false && !mtnc_is_sn_active()) {
308
- add_meta_box('promo-sn', __('Protect your site from day one with Security Ninja', 'maintenance'), 'mtnc_promo_sn', $mtnc_variable->options_page, 'side', 'default');
309
- }
310
  add_meta_box('promo-content2', __('Something is not working? Do you need our help?', 'maintenance'), 'mtnc_contact_support', $mtnc_variable->options_page, 'side', 'default');
311
- //add_meta_box('promo-extended', __('Translate Maintanance page to 100+ languages', 'maintenance'), 'mtnc_extended_version', $mtnc_variable->options_page, 'side', 'default');
312
  }
313
  add_action('add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_support', 13);
314
 
@@ -379,7 +379,7 @@ function mtnc_add_data_fields($object, $box)
379
 
380
  mtnc_generate_check_filed(__('Enable Frontend Login', 'maintenance'), '', 'is_login', 'is_login', isset($mt_option['is_login']));
381
 
382
- echo '<tr><td colspan="2"><p><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p></td></tr>'
383
  ?>
384
  </tbody>
385
  </table>
@@ -407,7 +407,7 @@ function mtnc_create_select_options($options, $selected = null, $output = true)
407
  } // foreach
408
 
409
  if ($output) {
410
- echo $out;
411
  } else {
412
  return $out;
413
  }
@@ -418,7 +418,7 @@ function mtnc_smush_option() {
418
  echo '<tr>';
419
  echo '<th><label for="smush_support">Enable Image Compression</label></th>';
420
  echo '<td style="line-height: 1.5;">';
421
- echo 'Configure <a href="' . admin_url('admin.php?page=smush') . '">image compression options</a>.';
422
  echo '</td>';
423
  echo '</tr>';
424
  } else {
@@ -431,18 +431,6 @@ function mtnc_smush_option() {
431
  }
432
  } // mtnc_smush_option
433
 
434
- function mtnc_is_sn_active() {
435
- if (!function_exists('is_plugin_active') || !function_exists('get_plugin_data')) {
436
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
437
- }
438
-
439
- if (is_plugin_active('security-ninja/security-ninja.php')) {
440
- return true;
441
- } else {
442
- return false;
443
- }
444
- } // is_sn_active
445
-
446
  function mtnc_add_css_fields()
447
  {
448
  $mt_option = mtnc_get_plugin_options(true);
@@ -2552,23 +2540,23 @@ function mtnc_add_themes_fields()
2552
  $i = 1;
2553
  foreach ($themes as $theme) {
2554
  if ($i > 9) {
2555
- echo '<div class="theme-thumb hidden" data-theme="' . $theme['name_clean'] . '">';
2556
  } else {
2557
- echo '<div class="theme-thumb" data-theme="' . $theme['name_clean'] . '">';
2558
  }
2559
  $i++;
2560
  if ($theme['status'] != 'free') {
2561
- echo '<a href="' . mtnc_csmm_generate_web_link('preview-theme-thumb-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean'])) . '" target="_blank"><img src="' . MTNC_URI . 'images/pro-templates/' . $theme['name_clean'] . '.jpg" alt="Preview ' . $theme['name'] . '" title="Preview ' . $theme['name'] . '"></a>';
2562
  }
2563
- echo '<span class="name">' . $theme['name'] . ' <small>' . $theme['status'] . ' theme</small></span>';
2564
  echo '<span name="actions">';
2565
  if ($theme['status'] != 'free') {
2566
- echo '<a href="' . mtnc_csmm_generate_web_link('buy-with-25', '/', array('coupon' => 'maintenance')) . '" target="_blank" class="button button-primary">BUY with 25% discount</a>&nbsp; &nbsp;';
2567
- echo '<a target="_blank" class="button button-secondary" href="' . mtnc_csmm_generate_web_link('preview-theme-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean'])) . '">Preview</a>';
2568
  }
2569
  echo '</span>';
2570
  if ($theme['status'] != 'free') {
2571
- echo '<div class="ribbon" title="' . ucfirst($theme['status']) . ' theme. Click \'Get this theme\' for more info."><i><span class="dashicons dashicons-star-filled"></span></i></div>';
2572
  }
2573
  echo '</div>';
2574
  } // foreach theme
@@ -2671,7 +2659,7 @@ function mtnc_add_exclude_pages_fields()
2671
  $out_filed .= '</tbody>';
2672
  $out_filed .= '</table>';
2673
 
2674
- echo $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput
2675
  }
2676
 
2677
  function mtnc_get_background_fileds_action()
@@ -2694,13 +2682,13 @@ add_action('mtnc_color_fields', 'mtnc_get_color_fileds_action', 10);
2694
  function mtnc_get_font_fileds_action()
2695
  {
2696
  $mt_option = mtnc_get_plugin_options(true);
2697
- echo mtnc_get_fonts_field(__('Font Family', 'maintenance'), 'body_font_family', 'body_font_family', esc_attr($mt_option['body_font_family'])); // phpcs:ignore WordPress.Security.EscapeOutput
2698
  $subset = '';
2699
 
2700
  if (!empty($mt_option['body_font_subset'])) {
2701
  $subset = $mt_option['body_font_subset'];
2702
  }
2703
- echo mtnc_get_fonts_subsets(__('Subsets', 'maintenance'), 'body_font_subset', 'body_font_subset', esc_attr($subset)); // phpcs:ignore WordPress.Security.EscapeOutput
2704
  }
2705
  add_action('mtnc_font_fields', 'mtnc_get_font_fileds_action', 10);
2706
 
@@ -2725,25 +2713,17 @@ function mtnc_review_box()
2725
  echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput
2726
  }
2727
 
2728
- function mtnc_extended_version()
2729
  {
2730
  $promo_text = '';
2731
- if (mtnc_is_weglot_active()) {
2732
- $promo_text .= '<p>You are minutes away from having your site translated to 100+ languages thanks to <a href="https://wordpress.org/plugins/weglot/" target="_blank">Weglot</a>! Make sure you configure everything in <a href="' . admin_url('admin.php?page=weglot-settings') . '" target="_blank">Weglot options</a> so that visitors can browse in their native language.</p>';
2733
- } else {
2734
- $promo_text .= '<a title="Install Weglot and translate your site to 100+ languages" href="#" class="open-weglot-upsell"><img src="' . MTNC_URI . 'images/weglot-banner.png" alt="Install Weglot and translate your site to 100+ languages" title="Install Weglot and translate your site to 100+ languages"></a>';
2735
- }
2736
- echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput
2737
- }
2738
 
2739
- function mtnc_promo_sn()
2740
- {
2741
- $promo_text = '';
2742
- if (!mtnc_is_sn_active()) {
2743
- $promo_text .= '<a href="' . admin_url('plugin-install.php?fix-install-button=1&tab=plugin-information&plugin=security-ninja&TB_iframe=true&width=600&height=550') . '" class="textcenter thickbox open-plugin-details-modal"><img src="' . MTNC_URI . 'images/security-ninja.png" alt="Security Ninja" title="Security Ninja"></a>';
2744
- }
2745
- echo $promo_text;
2746
- }
2747
 
2748
  function mtnc_cur_page_url()
2749
  {
@@ -2876,7 +2856,7 @@ function mtnc_metaboxes_scripts()
2876
  //<![CDATA[
2877
  jQuery(document).ready(function() {
2878
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
2879
- postboxes.add_postbox_toggles('<?php echo esc_js($mtnc_variable->options_page); ?>');
2880
  });
2881
  //]]>
2882
  </script>
47
  $out_filed .= '</fieldset>';
48
  $out_filed .= '</td>';
49
  $out_filed .= '</tr>';
50
+ mtnc_wp_kses($out_filed);
51
  }
52
 
53
  function mtnc_generate_number_filed($title, $id, $name, $value, $placeholder = '')
61
  $out_filed .= '</fieldset>';
62
  $out_filed .= '</td>';
63
  $out_filed .= '</tr>';
64
+ mtnc_wp_kses($out_filed);
65
  }
66
 
67
  function mtnc_generate_textarea_filed($title, $id, $name, $value)
75
  $out_filed .= '</fieldset>';
76
  $out_filed .= '</td>';
77
  $out_filed .= '</tr>';
78
+ mtnc_wp_kses($out_filed);
79
  }
80
 
81
 
102
  $out_filed .= '</fieldset>';
103
  $out_filed .= '</td>';
104
  $out_filed .= '</tr>';
105
+ mtnc_wp_kses($out_filed);
106
  }
107
 
108
 
120
  $out_filed .= '</fieldset>';
121
  $out_filed .= '</td>';
122
  $out_filed .= '</tr>';
123
+ mtnc_wp_kses($out_filed);
124
  }
125
 
126
  function mtnc_generate_image_filed($title, $id, $name, $value, $class, $name_btn, $class_btn)
150
  $out_filed .= '</fieldset>';
151
  $out_filed .= '</td>';
152
  $out_filed .= '</tr>';
153
+ mtnc_wp_kses($out_filed);
154
  }
155
 
156
  function mtnc_get_color_field($title, $id, $name, $value, $default_color)
164
  $out_filed .= '<fieldset>';
165
  $out_filed .= '</td>';
166
  $out_filed .= '</tr>';
167
+ mtnc_wp_kses($out_filed);
168
  }
169
 
170
  function mtnc_get_google_font($font = null)
274
  $mt_option = mtnc_get_plugin_options(true);
275
 
276
  if (!$mt_option['default_settings'] || $mt_option['gg_analytics_id']) {
277
+ //add_meta_box('review-top', __('Please help us keep the plugin free &amp; maintained', 'maintenance'), 'mtnc_add_review_top', $mtnc_variable->options_page, 'normal', 'high');
278
  }
279
  add_meta_box('mtnc-general', __('General Settings', 'maintenance'), 'mtnc_add_data_fields', $mtnc_variable->options_page, 'normal', 'default');
280
  add_meta_box('mtnc-themes', __('Ready To Use Themes', 'maintenance'), 'mtnc_add_themes_fields', $mtnc_variable->options_page, 'normal', 'default');
295
  $promo_text .= '<p><b>Your review means a lot!</b> Please help us spread the word so that others know the Maintenance plugin is free and well maintained!<br>
296
  Thank you very much for using our plugin and helping us out!</p>';
297
  $promo_text .= '<p><br><a href="https://wordpress.org/support/plugin/maintenance/reviews/#new-post" target="_blank" class="button button-primary">Leave a Review</a> &nbsp;&nbsp; <a href="#" class="hide-review-box">I already left a review ;)</a></p>';
298
+ mtnc_wp_kses($promo_text);
299
  }
300
 
301
  function mtnc_page_create_meta_boxes_widget_support()
302
  {
303
  global $mtnc_variable;
304
 
305
+ if (!defined('WPFSSL_OPTIONS_KEY')) {
306
+ add_meta_box('promo-wpfssl', __('Solve all SSL problems - free WP Force SSL plugin', 'maintenance'), 'mtnc_promo_wpfssl', $mtnc_variable->options_page, 'side', 'high');
307
+ }
308
+
309
  add_meta_box('promo-review2', __('Help us keep the plugin free &amp; maintained', 'maintenance'), 'mtnc_review_box', $mtnc_variable->options_page, 'side', 'high');
310
 
 
 
 
311
  add_meta_box('promo-content2', __('Something is not working? Do you need our help?', 'maintenance'), 'mtnc_contact_support', $mtnc_variable->options_page, 'side', 'default');
 
312
  }
313
  add_action('add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_support', 13);
314
 
379
 
380
  mtnc_generate_check_filed(__('Enable Frontend Login', 'maintenance'), '', 'is_login', 'is_login', isset($mt_option['is_login']));
381
 
382
+ mtnc_wp_kses('<tr><td colspan="2"><p><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p></td></tr>');
383
  ?>
384
  </tbody>
385
  </table>
407
  } // foreach
408
 
409
  if ($output) {
410
+ mtnc_wp_kses($out);
411
  } else {
412
  return $out;
413
  }
418
  echo '<tr>';
419
  echo '<th><label for="smush_support">Enable Image Compression</label></th>';
420
  echo '<td style="line-height: 1.5;">';
421
+ echo 'Configure <a href="' . esc_url(admin_url('admin.php?page=smush')) . '">image compression options</a>.';
422
  echo '</td>';
423
  echo '</tr>';
424
  } else {
431
  }
432
  } // mtnc_smush_option
433
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  function mtnc_add_css_fields()
435
  {
436
  $mt_option = mtnc_get_plugin_options(true);
2540
  $i = 1;
2541
  foreach ($themes as $theme) {
2542
  if ($i > 9) {
2543
+ echo '<div class="theme-thumb hidden" data-theme="' . esc_html($theme['name_clean']) . '">';
2544
  } else {
2545
+ echo '<div class="theme-thumb" data-theme="' . esc_html($theme['name_clean']) . '">';
2546
  }
2547
  $i++;
2548
  if ($theme['status'] != 'free') {
2549
+ echo '<a href="' . esc_url(mtnc_csmm_generate_web_link('preview-theme-thumb-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean']))) . '" target="_blank"><img src="' . esc_url(MTNC_URI) . 'images/pro-templates/' . esc_html($theme['name_clean']) . '.jpg" alt="Preview ' . esc_html($theme['name']) . '" title="Preview ' . esc_html($theme['name']) . '"></a>';
2550
  }
2551
+ echo '<span class="name">' . esc_html($theme['name']) . ' <small>' . esc_html($theme['status']) . ' theme</small></span>';
2552
  echo '<span name="actions">';
2553
  if ($theme['status'] != 'free') {
2554
+ echo '<a href="' . esc_url(mtnc_csmm_generate_web_link('buy-with-25', '/', array('coupon' => 'maintenance'))) . '" target="_blank" class="button button-primary">BUY with 25% discount</a>&nbsp; &nbsp;';
2555
+ echo '<a target="_blank" class="button button-secondary" href="' . esc_url(mtnc_csmm_generate_web_link('preview-theme-' . $theme['name_clean'], 'theme-preview', array('theme' => $theme['name_clean']))) . '">Preview</a>';
2556
  }
2557
  echo '</span>';
2558
  if ($theme['status'] != 'free') {
2559
+ echo '<div class="ribbon" title="' . esc_html(ucfirst($theme['status'])) . ' theme. Click \'Get this theme\' for more info."><i><span class="dashicons dashicons-star-filled"></span></i></div>';
2560
  }
2561
  echo '</div>';
2562
  } // foreach theme
2659
  $out_filed .= '</tbody>';
2660
  $out_filed .= '</table>';
2661
 
2662
+ mtnc_wp_kses($out_filed);
2663
  }
2664
 
2665
  function mtnc_get_background_fileds_action()
2682
  function mtnc_get_font_fileds_action()
2683
  {
2684
  $mt_option = mtnc_get_plugin_options(true);
2685
+ mtnc_wp_kses(mtnc_get_fonts_field(__('Font Family', 'maintenance'), 'body_font_family', 'body_font_family', esc_html($mt_option['body_font_family'])));
2686
  $subset = '';
2687
 
2688
  if (!empty($mt_option['body_font_subset'])) {
2689
  $subset = $mt_option['body_font_subset'];
2690
  }
2691
+ mtnc_wp_kses(mtnc_get_fonts_subsets(__('Subsets', 'maintenance'), 'body_font_subset', 'body_font_subset', esc_html($subset)));
2692
  }
2693
  add_action('mtnc_font_fields', 'mtnc_get_font_fileds_action', 10);
2694
 
2713
  echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput
2714
  }
2715
 
2716
+ function mtnc_promo_wpfssl()
2717
  {
2718
  $promo_text = '';
2719
+ $promo_text .= '<h3 class="textcenter"><b>Problems with SSL certificate?<br>Moving a site from HTTP to HTTPS?<br>Mixed content giving you troubles?</b></h3>';
2720
+ $promo_text .= '<p class="textcenter"><a href="#" class="textcenter install-wpfssl"><img style="max-width: 90%;" src="' . MTNC_URI . 'images/wp-force-ssl-logo.png" alt="WP Force SSL" title="WP Force SSL"></a></p>';
 
 
 
 
 
2721
 
2722
+ $promo_text .= '<p class="textcenter"><br><a href="#" class="install-wpfssl button button-primary">Install &amp; activate the free WP Force SSL plugin</a></p>';
2723
+
2724
+ $promo_text .= '<p><a href="https://wordpress.org/plugins/wp-force-ssl/" target="_blank">WP Force SSL</a> is a free WP plugin maintained by the same team as this Maintenance plugin. It has <b>+150,000 users, 5-star rating</b>, and is hosted on the official WP repository.</p>';
2725
+ mtnc_wp_kses($promo_text);
2726
+ } // mtnc_promo_wpfssl
 
 
 
2727
 
2728
  function mtnc_cur_page_url()
2729
  {
2856
  //<![CDATA[
2857
  jQuery(document).ready(function() {
2858
  jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
2859
+ postboxes.add_postbox_toggles('<?php echo esc_html($mtnc_variable->options_page); ?>');
2860
  });
2861
  //]]>
2862
  </script>
js/init.js CHANGED
@@ -114,7 +114,16 @@ jQuery(window).ready(function($) {
114
  return false;
115
  });
116
 
117
- /******************* */
 
 
 
 
 
 
 
 
 
118
 
119
  wp.codeEditor.initialize(jQuery('#custom_css'), mtnc.cm_settings);
120
 
114
  return false;
115
  });
116
 
117
+ jQuery('.install-wpfssl').on('click',function(e){
118
+ if (!confirm('The free WP Force SSL plugin will be installed & activated from the official WordPress repository.')) {
119
+ return;
120
+ }
121
+
122
+ 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="' + mtnc.wpfssl_install_url + '" style="width:100%;height:100%;border:none;" /></div>');
123
+ jQuery('#wpwrap').css('pointer-events', 'none');
124
+ e.preventDefault();
125
+ return false;
126
+ });
127
 
128
  wp.codeEditor.initialize(jQuery('#custom_css'), mtnc.cm_settings);
129
 
load/functions.php CHANGED
@@ -2,163 +2,163 @@
2
 
3
  function mtnc_get_custom_login_code()
4
  {
5
- global $wp_query,
6
- $error;
7
- $mt_options = mtnc_get_plugin_options(true);
8
- $user_connect = false;
9
- if (!is_array($wp_query->query_vars)) {
10
- $wp_query->query_vars = array();
11
- }
12
- $error_message = $user_login = $user_pass = $error = '';
13
- $is_role_check = true;
14
- $class_login = 'user-icon';
15
- $class_password = 'pass-icon';
16
- $using_cookie = false;
17
-
18
- if (isset($_POST['is_custom_login'])) {
19
- $user_login = '';
20
- if (isset($_POST['log']) && wp_verify_nonce($_POST['mtnc_login_check'], 'mtnc_login')) {
21
- $user_login = sanitize_post(wp_unslash($_POST['log']));
22
- }
23
- $user_login = sanitize_user($user_login);
24
- $user_pass = '';
25
- if (isset($_POST['pwd']) && wp_verify_nonce($_POST['mtnc_login_check'], 'mtnc_login')) {
26
- $user_pass = $_POST['pwd'];
27
- }
28
- $access = array();
29
- $access['user_login'] = esc_attr($user_login);
30
- $access['user_password'] = $user_pass;
31
- $access['remember'] = true;
32
-
33
- $user = null;
34
- $user = new WP_User(0, $user_login);
35
- $current_role = current($user->roles);
36
-
37
- if (!empty($mt_options['roles_array'])) {
38
- foreach (array_keys($mt_options['roles_array']) as $key) {
39
- if ($key === $current_role) {
40
- $is_role_check = false;
41
- }
42
- }
43
- } else {
44
- $is_role_check = true;
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- if (!$is_role_check) {
48
- $error_message = __('Permission access denied!', 'maintenance');
49
- $class_login = 'error';
50
- $class_password = 'error';
51
- } else {
52
-
53
- if (is_ssl()) {
54
- $ssl = true;
55
- } else {
56
- $ssl = false;
57
- }
58
-
59
- $user_connect = wp_signon($access, $ssl);
60
- if (is_wp_error($user_connect)) {
61
- if ($user_connect->get_error_code() === 'invalid_username') {
62
- $error_message = __('Login is incorrect!', 'maintenance');
63
-
64
- $class_login = 'error';
65
- $class_password = 'error';
66
- } elseif ($user_connect->get_error_code() === 'incorrect_password') {
67
- $error_message = __('Password is incorrect!', 'maintenance');
68
- $class_password = 'error';
69
  } else {
70
- $error_message = __('Login and password are incorrect!', 'maintenance');
71
- $class_login = 'error';
72
- $class_password = 'error';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
- } else {
75
- wp_safe_redirect(home_url('/'));
76
- exit;
77
- }
78
  }
79
- }
80
 
81
- if (!$user_connect) {
82
- mtnc_get_headers_503();
83
- }
84
 
85
- return array($error_message, $class_login, $class_password, $user_login);
86
  }
87
 
88
  function mtnc_add_custom_style()
89
  {
90
- global $wp_styles;
91
-
92
- // all.css loading in index.php inline by 2 steps
93
- wp_register_style('mtnc-style', MTNC_URI . 'load/css/style.css', '', filemtime(MTNC_DIR . 'load/css/style.css'));
94
- wp_register_style('mtnc-fonts', MTNC_URI . 'load/css/fonts.css', '', filemtime(MTNC_DIR . 'load/css/fonts.css'));
95
- $wp_styles->do_items('mtnc-style');
96
- $wp_styles->do_items('mtnc-fonts');
97
- mtnc_get_options_style();
98
  }
99
 
100
  function mtnc_add_google_fonts()
101
  {
102
- global $wp_scripts;
103
- $mt_options = mtnc_get_plugin_options(true);
104
- $font_link = array();
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
- if (!empty($mt_options['body_font_family'])) {
107
- $font_link[0] = mtnc_get_google_font(esc_attr($mt_options['body_font_family']));
108
- /*Check if chooses subset for fonts*/
109
- if (!empty($mt_options['body_font_subset'])) {
110
- $font_subset = esc_attr($mt_options['body_font_subset']);
111
- $font_link[0] .= ':' . $font_subset . '';
112
- }
113
- }
114
- if (!empty($mt_options['countdown_font_family'])) {
115
- $font_link[1] = mtnc_get_google_font(esc_attr($mt_options['countdown_font_family']));
116
- }
117
-
118
- if ($font_link) {
119
- return $font_link;
120
- }
121
- return '';
122
  }
123
 
124
  function mtnc_add_custom_scripts()
125
  {
126
- global $wp_scripts;
127
- $mt_options = mtnc_get_plugin_options(true);
128
- $js_options = array(
129
- 'body_bg' => '',
130
- 'gallery_array' => array(),
131
- 'blur_intensity' => $mt_options['blur_intensity'],
132
- 'font_link' => '',
133
- );
134
 
135
- wp_register_script('_frontend', MTNC_URI . 'load/js/jquery.frontend.js', 'jquery', filemtime(MTNC_DIR . 'load/js/jquery.frontend.js'), true);
136
 
137
- // IE scripts
138
- wp_register_script('jquery_ie', $wp_scripts->registered['jquery-core']->src, '', '', true);
139
 
140
- wp_script_add_data('jquery_ie', 'conditional', 'lte IE 10');
141
 
142
- if (!empty($mt_options['body_bg']) && empty($mt_options['gallery_array']['attachment_ids'])) {
143
- $bg = wp_get_attachment_image_src($mt_options['body_bg'], 'full');
144
- $js_options['body_bg'] = esc_url($bg[0]);
145
- }
146
 
147
- $js_options['font_link'] = mtnc_add_google_fonts();
148
- wp_localize_script('_frontend', 'mtnc_front_options', $js_options);
149
 
150
- $wp_scripts->do_items('jquery_ie');
151
- $wp_scripts->do_items('jquery_migrate_ie');
152
- $wp_scripts->do_items('_placeholder_ie');
153
- $wp_scripts->do_items('_frontend_ie');
154
 
155
- echo '<!--[if !IE]><!-->';
156
- $wp_scripts->do_items('jquery');
157
- echo '<!--<![endif]-->';
158
 
159
- $wp_scripts->do_items('_backstretch');
160
 
161
- $wp_scripts->do_items('_frontend');
162
  }
163
 
164
  add_action('load_custom_scripts', 'mtnc_add_custom_scripts', 15);
@@ -166,196 +166,204 @@ add_action('load_custom_style', 'mtnc_add_custom_style', 20);
166
 
167
  function mtnc_get_page_title($error_message = null)
168
  {
169
- $mt_options = mtnc_get_plugin_options(true);
170
- $title = '';
171
- if (empty($mt_options['page_title'])) {
172
- $title = wp_title('|', false);
173
- } else {
174
- $title = wp_strip_all_tags(stripslashes($mt_options['page_title']));
175
- }
176
-
177
- echo "<title>$title</title>"; // phpcs:ignore WordPress.Security.EscapeOutput
178
  }
179
 
180
  function mtnc_get_options_style()
181
  {
182
- $mt_options = mtnc_get_plugin_options(true);
183
- $options_style = '';
184
- if (!empty($mt_options['body_bg_color'])) {
185
- $mt_options['body_bg_color'] = strip_tags($mt_options['body_bg_color']);
186
- $options_style .= 'body {background-color: ' . esc_attr($mt_options['body_bg_color']) . '}';
187
- $options_style .= '.preloader {background-color: ' . esc_attr($mt_options['body_bg_color']) . '}';
188
- }
189
-
190
- if (!empty($mt_options['is_blur']) && !empty($mt_options['blur_intensity'])) {
191
- $options_style .= '.bg-img img, .bg-img source{';
192
- $options_style .= '-webkit-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
193
- $options_style .= '-moz-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
194
- $options_style .= '-o-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
195
- $options_style .= '-ms-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
196
- $options_style .= 'filter:blur(' . $mt_options['blur_intensity'] . 'px);';
197
- $options_style .= 'filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius=' . $mt_options['blur_intensity'] . ', enabled=\'true\');';
198
- $options_style .= '}';
199
- }
200
-
201
- if ($mt_options['blur_intensity'] == '0') {
202
- $options_style .= ' body > .main-container:after { background-color: transparent; } ';
203
- }
204
-
205
- if (!empty($mt_options['body_font_family'])) {
206
- $options_style .= 'body {font-family: ' . esc_attr($mt_options['body_font_family']) . '; }';
207
- }
208
-
209
- if (!empty($mt_options['font_color'])) {
210
- $font_color = strip_tags($mt_options['font_color']);
211
- $options_style .= '.site-title, .preloader i, .login-form, .login-form a.lost-pass, .btn-open-login-form, .site-content, .user-content-wrapper, .user-content, footer, .maintenance a{color: ' . $font_color . ';} ';
212
- $options_style .= 'a.close-user-content, #mailchimp-box form input[type="submit"], .login-form input#submit.button {border-color:' . $font_color . '} ';
213
- $options_style .= 'input[type="submit"]:hover{background-color:' . $font_color . '} ';
214
- $options_style .= 'input:-webkit-autofill, input:-webkit-autofill:focus{-webkit-text-fill-color:' . $font_color . '} ';
215
- }
216
-
217
- if (!empty($mt_options['controls_bg_color'])) {
218
- $mt_options['controls_bg_color'] = strip_tags($mt_options['controls_bg_color']);
219
- $options_style .= "body > .login-form-container{background-color:{$mt_options['controls_bg_color']}}";
220
- $options_style .= ".btn-open-login-form{background-color:{$mt_options['controls_bg_color']}}";
221
- $options_style .= "input:-webkit-autofill, input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 50px {$mt_options['controls_bg_color']} inset}";
222
- $options_style .= "input[type='submit']:hover{color:{$mt_options['controls_bg_color']}} ";
223
- $options_style .= "#custom-subscribe #submit-subscribe:before{background-color:{$mt_options['controls_bg_color']}} ";
224
- }
225
-
226
- if (!empty($mt_options['custom_css'])) {
227
- $options_style .= strip_tags(wp_kses_stripslashes($mt_options['custom_css']));
228
- }
229
-
230
- echo '<style type="text/css">';
231
- echo $options_style; // phpcs:ignore WordPress.Security.EscapeOutput
232
- echo '</style>';
233
  }
234
 
235
  function mtnc_get_logo_box()
236
  {
237
- $mt_options = mtnc_get_plugin_options(true);
238
- $logo_w = $logo_h = '';
239
-
240
- if (!empty($mt_options['logo_width'])) {
241
- $logo_w = $mt_options['logo_width'];
242
- }
243
- if (!empty($mt_options['logo_height'])) {
244
- $logo_h = $mt_options['logo_height'];
245
- }
246
- if (!empty($mt_options['logo']) || !empty($mt_options['retina_logo'])) {
247
- $logo = wp_get_attachment_image_src($mt_options['logo'], 'full', true);
248
- $retina_logo = wp_get_attachment_image_src($mt_options['retina_logo'], 'full', true);
249
- if (!empty($logo)) {
250
- $image_link = esc_url_raw($logo[0]);
251
- } else {
252
- $image_link = $mt_options['logo'];
253
  }
254
- if (!empty($retina_logo)) {
255
- $image_link_retina = esc_url_raw($retina_logo[0]);
256
- } else {
257
- $image_link_retina = $mt_options['retina_logo'];
258
  }
 
 
 
 
 
259
 
260
- $image_link = empty($image_link) ? $image_link_retina : $image_link;
261
- $image_link_retina = empty($image_link_retina) ? $image_link : $image_link_retina;
 
 
 
262
 
263
- ?>
264
- <div class="logo-box" rel="home">
265
- <img src="<?php echo esc_url($image_link); ?>" srcset="<?php echo esc_url($image_link_retina); ?> 2x" width="<?php echo esc_attr($logo_w); ?>" <?php echo (!empty($logo_h)) ? 'height="' . esc_attr($logo_h) . '"' : ''; ?> alt="logo">
266
- </div>
267
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  } else {
269
- echo '<div class="logo-box istext" rel="home"><h1 class="site-title">' . esc_html(get_bloginfo('name')) . '</h1></div>';
270
  }
271
- }
272
- add_action('logo_box', 'mtnc_get_logo_box', 10);
273
 
274
- function mtnc_get_content_section()
275
- {
276
  $mt_options = mtnc_get_plugin_options(true);
277
  if (!empty($mt_options['body_font_subset'])) {
278
- $current_subset = esc_attr($mt_options['body_font_subset']);
279
- $font_weight = (string) ((int) $current_subset);
280
- $font_style = str_replace($font_weight, '', $current_subset);
281
  }
282
 
283
  if (empty($font_style) || $font_style === 'regular') {
284
- $font_style = 'normal';
285
  }
286
  if (empty($font_weight)) {
287
- $font_weight = 'normal';
288
  }
289
  $out_content = null;
290
  if (!empty($mt_options['heading'])) {
291
- $out_content .= '<h2 class="heading font-center" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . wp_kses_post(stripslashes($mt_options['heading'])) . '</h2>';
292
  }
293
 
294
  if (!empty($mt_options['description'])) {
295
- $description_content = wpautop(wp_kses_post(stripslashes($mt_options['description'])), true);
296
- $out_content .= '<div class="description" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . $description_content . '</div>';
297
  } else {
298
- $site_description = get_bloginfo('description');
299
- $out_content .= '<div class="description" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '"><h3>' . $site_description . '</h3></div>';
300
  }
301
 
302
- echo $out_content; // phpcs:ignore WordPress.Security.EscapeOutput
303
- }
304
- add_action('content_section', 'mtnc_get_content_section', 10);
305
 
306
- function mtnc_get_footer_section()
307
- {
308
  $mt_options = mtnc_get_plugin_options(true);
309
  if (!empty($mt_options['body_font_subset'])) {
310
- $current_subset = esc_attr($mt_options['body_font_subset']);
311
- $font_weight = (string) ((int) $current_subset);
312
- $font_style = str_replace($font_weight, '', $current_subset);
313
  }
314
 
315
  if (empty($font_style) || $font_style === 'regular') {
316
- $font_style = 'normal';
317
  }
318
  if (empty($font_weight)) {
319
- $font_weight = 'normal';
320
  }
321
 
322
  $out_ftext = '';
323
 
324
  if (isset($mt_options['footer_text']) && !empty($mt_options['footer_text'])) {
325
- $out_ftext .= wp_kses_post(stripslashes($mt_options['footer_text']));
326
  }
327
  if (!empty($mt_options['show_some_love'])) {
328
- $out_ftext .= '<br><small>This site is using the free <a title="Free WP Maintenance Plugin" target="_blank" href="https://wordpress.org/plugins/maintenance/">WP Maintenance plugin</a>.</small>';
329
  }
330
 
331
  if ($out_ftext) {
332
- $out_ftext = '<div style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . $out_ftext . '</div>';
333
  }
334
 
335
- echo $out_ftext; // phpcs:ignore WordPress.Security.EscapeOutput
336
- }
337
- add_action('footer_section', 'mtnc_get_footer_section', 10);
338
 
339
- function mtnc_do_button_login_form($error = -1)
340
- {
341
  ?>
342
- <div id="btn-open-login-form" class="btn-open-login-form">
343
- <i class="fi-lock"></i>
344
 
345
- </div>
346
- <div id="btn-sound" class="btn-open-login-form sound">
347
- <i id="value_botton" class="fa fa-volume-off" aria-hidden="true"></i>
348
- </div>
349
- <?php
350
 
351
- }
352
 
353
- function mtnc_do_login_form($user_login, $class_login, $class_password, $error = null)
354
- {
355
  $mt_options = mtnc_get_plugin_options(true);
356
  $out_login_form = $form_error = '';
357
  if (($class_login === 'error') || ($class_password === 'error')) {
358
- $form_error = ' active error';
359
  }
360
 
361
  $out_login_form .= '<form name="login-form" id="login-form" class="login-form' . $form_error . '" method="post">';
@@ -370,89 +378,384 @@ function mtnc_get_logo_box()
370
  $out_login_form .= '</form>';
371
 
372
  if (isset($mt_options['is_login'])) {
373
- echo $out_login_form; // phpcs:ignore WordPress.Security.EscapeOutput
374
  }
375
- }
376
 
377
- function mtnc_reset_pass_url()
378
- {
379
  $args = array('action' => 'lostpassword');
380
  $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
381
  return $lostpassword_url;
382
- }
383
- add_filter('lostpassword_url', 'mtnc_reset_pass_url', 999, 0);
384
 
385
- function mtnc_get_preloader_element()
386
- {
387
  $mt_options = mtnc_get_plugin_options(true);
388
  if (!empty($mt_options['preloader_img'])) {
389
- $preloader_img = wp_get_attachment_image_src($mt_options['preloader_img'], 'full');
390
- $preloader_img = !empty($preloader_img) ? $preloader_img[0] : false;
391
  }
392
 
393
  $preloader = !empty($preloader_img) ? '<img src="' . $preloader_img . '">' : '<i class="fi-widget" aria-hidden="true"></i>';
394
  $out = '<div class="preloader">' . $preloader . '</div>';
395
- echo $out; // phpcs:ignore WordPress.Security.EscapeOutput
396
- }
397
- add_action('before_content_section', 'mtnc_get_preloader_element', 5);
398
 
399
- function mtnc_gg_analytics_code()
400
- {
401
  $mt_options = mtnc_get_plugin_options(true);
402
  if (!isset($mt_options['503_enabled']) && isset($mt_options['gg_analytics_id']) && ($mt_options['gg_analytics_id'] !== '')) {
403
- ?>
404
- <script type="text/javascript">
405
- (function(i, s, o, g, r, a, m) {
406
- i['GoogleAnalyticsObject'] = r;
407
- i[r] = i[r] || function() {
408
- (i[r].q = i[r].q || []).push(arguments)
409
- }, i[r].l = 1 * new Date();
410
- a = s.createElement(o),
411
- m = s.getElementsByTagName(o)[0];
412
- a.async = 1;
413
- a.src = g;
414
- m.parentNode.insertBefore(a, m)
415
- })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
416
-
417
- ga('create', '<?php echo esc_attr($mt_options['gg_analytics_id']); ?>', 'auto');
418
- ga('send', 'pageview');
419
- </script>
420
  <?php
421
- }
422
  }
423
  add_action('add_gg_analytics_code', 'mtnc_gg_analytics_code');
424
 
425
  function mtnc_get_headers_503()
426
  {
427
- $mt_options = mtnc_get_plugin_options(true);
428
- nocache_headers();
429
- if (!empty($mt_options['503_enabled'])) {
430
- $protocol = 'HTTP/1.0';
431
- if (isset($_SERVER['SERVER_PROTOCOL']) && 'HTTP/1.1' === $_SERVER['SERVER_PROTOCOL']) {
432
- $protocol = 'HTTP/1.1';
433
- }
434
- header("$protocol 503 Service Unavailable", true, 503);
435
-
436
- $v_curr_date_end = '';
437
- $vdate_end = date_i18n('Y-m-d', strtotime(current_time('mysql', 0)));
438
- $vtime_end = date_i18n('h:i a', strtotime('12:00 pm'));
439
-
440
- if (!empty($mt_options['expiry_date_end'])) {
441
- $vdate_end = $mt_options['expiry_date_end'];
442
- }
443
- if (!empty($mt_options['expiry_time_end'])) {
444
- $vtime_end = $mt_options['expiry_time_end'];
445
- }
446
- if ($mt_options['state'] && !empty($mt_options['expiry_date_end']) && !empty($mt_options['expiry_time_end'])) {
447
- $date_concat = $vdate_end . ' ' . $vtime_end;
448
- $v_curr_date = strtotime($date_concat);
449
- if (strtotime(current_time('mysql', 0)) < $v_curr_date) {
450
- header('Retry-After: ' . gmdate('D, d M Y H:i:s', $v_curr_date));
451
- } else {
452
- header('Retry-After: 3600');
453
- }
454
- } else {
455
- header('Retry-After: 3600');
 
456
  }
457
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }
2
 
3
  function mtnc_get_custom_login_code()
4
  {
5
+ global $wp_query,
6
+ $error;
7
+ $mt_options = mtnc_get_plugin_options(true);
8
+ $user_connect = false;
9
+ if (!is_array($wp_query->query_vars)) {
10
+ $wp_query->query_vars = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
+ $error_message = $user_login = $user_pass = $error = '';
13
+ $is_role_check = true;
14
+ $class_login = 'user-icon';
15
+ $class_password = 'pass-icon';
16
+ $using_cookie = false;
17
+
18
+ if (isset($_POST['is_custom_login'])) {
19
+ $user_login = '';
20
+ if (isset($_POST['log']) && wp_verify_nonce($_POST['mtnc_login_check'], 'mtnc_login')) {
21
+ $user_login = sanitize_user(wp_unslash($_POST['log']));
22
+ }
23
+ $user_login = sanitize_user($user_login);
24
+ $user_pass = '';
25
+ if (isset($_POST['pwd']) && wp_verify_nonce($_POST['mtnc_login_check'], 'mtnc_login')) {
26
+ $user_pass = trim($_POST['pwd']);
27
+ }
28
+ $access = array();
29
+ $access['user_login'] = esc_attr($user_login);
30
+ $access['user_password'] = $user_pass;
31
+ $access['remember'] = true;
32
+
33
+ $user = null;
34
+ $user = new WP_User(0, $user_login);
35
+ $current_role = current($user->roles);
36
+
37
+ if (!empty($mt_options['roles_array'])) {
38
+ foreach (array_keys($mt_options['roles_array']) as $key) {
39
+ if ($key === $current_role) {
40
+ $is_role_check = false;
41
+ }
42
+ }
43
+ } else {
44
+ $is_role_check = true;
45
+ }
46
 
47
+ if (!$is_role_check) {
48
+ $error_message = __('Permission access denied!', 'maintenance');
49
+ $class_login = 'error';
50
+ $class_password = 'error';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  } else {
52
+
53
+ if (is_ssl()) {
54
+ $ssl = true;
55
+ } else {
56
+ $ssl = false;
57
+ }
58
+
59
+ $user_connect = wp_signon($access, $ssl);
60
+ if (is_wp_error($user_connect)) {
61
+ if ($user_connect->get_error_code() === 'invalid_username') {
62
+ $error_message = __('Login is incorrect!', 'maintenance');
63
+
64
+ $class_login = 'error';
65
+ $class_password = 'error';
66
+ } elseif ($user_connect->get_error_code() === 'incorrect_password') {
67
+ $error_message = __('Password is incorrect!', 'maintenance');
68
+ $class_password = 'error';
69
+ } else {
70
+ $error_message = __('Login and password are incorrect!', 'maintenance');
71
+ $class_login = 'error';
72
+ $class_password = 'error';
73
+ }
74
+ } else {
75
+ wp_safe_redirect(home_url('/'));
76
+ exit;
77
+ }
78
  }
 
 
 
 
79
  }
 
80
 
81
+ if (!$user_connect) {
82
+ mtnc_get_headers_503();
83
+ }
84
 
85
+ return array($error_message, $class_login, $class_password, $user_login);
86
  }
87
 
88
  function mtnc_add_custom_style()
89
  {
90
+ global $wp_styles;
91
+
92
+ // all.css loading in index.php inline by 2 steps
93
+ wp_register_style('mtnc-style', MTNC_URI . 'load/css/style.css', '', filemtime(MTNC_DIR . 'load/css/style.css'));
94
+ wp_register_style('mtnc-fonts', MTNC_URI . 'load/css/fonts.css', '', filemtime(MTNC_DIR . 'load/css/fonts.css'));
95
+ $wp_styles->do_items('mtnc-style');
96
+ $wp_styles->do_items('mtnc-fonts');
97
+ mtnc_get_options_style();
98
  }
99
 
100
  function mtnc_add_google_fonts()
101
  {
102
+ global $wp_scripts;
103
+ $mt_options = mtnc_get_plugin_options(true);
104
+ $font_link = array();
105
+
106
+ if (!empty($mt_options['body_font_family'])) {
107
+ $font_link[0] = mtnc_get_google_font(esc_attr($mt_options['body_font_family']));
108
+ /*Check if chooses subset for fonts*/
109
+ if (!empty($mt_options['body_font_subset'])) {
110
+ $font_subset = esc_attr($mt_options['body_font_subset']);
111
+ $font_link[0] .= ':' . $font_subset . '';
112
+ }
113
+ }
114
+ if (!empty($mt_options['countdown_font_family'])) {
115
+ $font_link[1] = mtnc_get_google_font(esc_attr($mt_options['countdown_font_family']));
116
+ }
117
 
118
+ if ($font_link) {
119
+ return $font_link;
120
+ }
121
+ return '';
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
124
  function mtnc_add_custom_scripts()
125
  {
126
+ global $wp_scripts;
127
+ $mt_options = mtnc_get_plugin_options(true);
128
+ $js_options = array(
129
+ 'body_bg' => '',
130
+ 'gallery_array' => array(),
131
+ 'blur_intensity' => $mt_options['blur_intensity'],
132
+ 'font_link' => '',
133
+ );
134
 
135
+ wp_register_script('_frontend', MTNC_URI . 'load/js/jquery.frontend.js', 'jquery', filemtime(MTNC_DIR . 'load/js/jquery.frontend.js'), true);
136
 
137
+ // IE scripts
138
+ wp_register_script('jquery_ie', $wp_scripts->registered['jquery-core']->src, '', '', true);
139
 
140
+ wp_script_add_data('jquery_ie', 'conditional', 'lte IE 10');
141
 
142
+ if (!empty($mt_options['body_bg']) && empty($mt_options['gallery_array']['attachment_ids'])) {
143
+ $bg = wp_get_attachment_image_src($mt_options['body_bg'], 'full');
144
+ $js_options['body_bg'] = esc_url($bg[0]);
145
+ }
146
 
147
+ $js_options['font_link'] = mtnc_add_google_fonts();
148
+ wp_localize_script('_frontend', 'mtnc_front_options', $js_options);
149
 
150
+ $wp_scripts->do_items('jquery_ie');
151
+ $wp_scripts->do_items('jquery_migrate_ie');
152
+ $wp_scripts->do_items('_placeholder_ie');
153
+ $wp_scripts->do_items('_frontend_ie');
154
 
155
+ echo '<!--[if !IE]><!-->';
156
+ $wp_scripts->do_items('jquery');
157
+ echo '<!--<![endif]-->';
158
 
159
+ $wp_scripts->do_items('_backstretch');
160
 
161
+ $wp_scripts->do_items('_frontend');
162
  }
163
 
164
  add_action('load_custom_scripts', 'mtnc_add_custom_scripts', 15);
166
 
167
  function mtnc_get_page_title($error_message = null)
168
  {
169
+ $mt_options = mtnc_get_plugin_options(true);
170
+ $title = '';
171
+ if (empty($mt_options['page_title'])) {
172
+ $title = wp_title('|', false);
173
+ } else {
174
+ $title = wp_strip_all_tags(stripslashes($mt_options['page_title']));
175
+ }
176
+
177
+ echo '<title>' . esc_html($title) . '</title>';
178
  }
179
 
180
  function mtnc_get_options_style()
181
  {
182
+ $mt_options = mtnc_get_plugin_options(true);
183
+ $options_style = '';
184
+ if (!empty($mt_options['body_bg_color'])) {
185
+ $mt_options['body_bg_color'] = strip_tags($mt_options['body_bg_color']);
186
+ $options_style .= 'body {background-color: ' . esc_attr($mt_options['body_bg_color']) . '}';
187
+ $options_style .= '.preloader {background-color: ' . esc_attr($mt_options['body_bg_color']) . '}';
188
+ }
189
+
190
+ if (!empty($mt_options['is_blur']) && !empty($mt_options['blur_intensity'])) {
191
+ $options_style .= '.bg-img img, .bg-img source{';
192
+ $options_style .= '-webkit-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
193
+ $options_style .= '-moz-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
194
+ $options_style .= '-o-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
195
+ $options_style .= '-ms-filter: blur(' . $mt_options['blur_intensity'] . 'px);';
196
+ $options_style .= 'filter:blur(' . $mt_options['blur_intensity'] . 'px);';
197
+ $options_style .= 'filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius=' . $mt_options['blur_intensity'] . ', enabled=\'true\');';
198
+ $options_style .= '}';
199
+ }
200
+
201
+ if ($mt_options['blur_intensity'] == '0') {
202
+ $options_style .= ' body > .main-container:after { background-color: transparent; } ';
203
+ }
204
+
205
+ if (!empty($mt_options['body_font_family'])) {
206
+ $options_style .= 'body {font-family: ' . esc_attr($mt_options['body_font_family']) . '; }';
207
+ }
208
+
209
+ if (!empty($mt_options['font_color'])) {
210
+ $font_color = strip_tags($mt_options['font_color']);
211
+ $options_style .= '.site-title, .preloader i, .login-form, .login-form a.lost-pass, .btn-open-login-form, .site-content, .user-content-wrapper, .user-content, footer, .maintenance a{color: ' . $font_color . ';} ';
212
+ $options_style .= 'a.close-user-content, #mailchimp-box form input[type="submit"], .login-form input#submit.button {border-color:' . $font_color . '} ';
213
+ $options_style .= 'input[type="submit"]:hover{background-color:' . $font_color . '} ';
214
+ $options_style .= 'input:-webkit-autofill, input:-webkit-autofill:focus{-webkit-text-fill-color:' . $font_color . '} ';
215
+ }
216
+
217
+ if (!empty($mt_options['controls_bg_color'])) {
218
+ $mt_options['controls_bg_color'] = strip_tags($mt_options['controls_bg_color']);
219
+ $options_style .= "body > .login-form-container{background-color:{$mt_options['controls_bg_color']}}";
220
+ $options_style .= ".btn-open-login-form{background-color:{$mt_options['controls_bg_color']}}";
221
+ $options_style .= "input:-webkit-autofill, input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 50px {$mt_options['controls_bg_color']} inset}";
222
+ $options_style .= "input[type='submit']:hover{color:{$mt_options['controls_bg_color']}} ";
223
+ $options_style .= "#custom-subscribe #submit-subscribe:before{background-color:{$mt_options['controls_bg_color']}} ";
224
+ }
225
+
226
+ if (!empty($mt_options['custom_css'])) {
227
+ $options_style .= strip_tags(wp_kses_stripslashes($mt_options['custom_css']));
228
+ }
229
+
230
+ echo '<style type="text/css">';
231
+ mtnc_wp_kses($options_style);
232
+ echo '</style>';
233
  }
234
 
235
  function mtnc_get_logo_box()
236
  {
237
+ $mt_options = mtnc_get_plugin_options(true);
238
+ $logo_w = $logo_h = '';
239
+
240
+ if (!empty($mt_options['logo_width'])) {
241
+ $logo_w = $mt_options['logo_width'];
 
 
 
 
 
 
 
 
 
 
 
242
  }
243
+ if (!empty($mt_options['logo_height'])) {
244
+ $logo_h = $mt_options['logo_height'];
 
 
245
  }
246
+ if (!empty($mt_options['logo']) || !empty($mt_options['retina_logo'])) {
247
+ $logo = false;
248
+ if (is_numeric($mt_options['logo']) && $mt_options['logo'] > 0) {
249
+ $logo = wp_get_attachment_image_src($mt_options['logo'], 'full', true);
250
+ }
251
 
252
+ if (!empty($logo)) {
253
+ $image_link = esc_url_raw($logo[0]);
254
+ } else {
255
+ $image_link = $mt_options['logo'];
256
+ }
257
 
258
+ $retina_logo = false;
259
+ if (is_numeric($mt_options['retina_logo']) && $mt_options['retina_logo'] > 0) {
260
+ $retina_logo = wp_get_attachment_image_src($mt_options['retina_logo'], 'full', true);
261
+ }
262
+
263
+ if (!empty($retina_logo)) {
264
+ $image_link_retina = esc_url_raw($retina_logo[0]);
265
+ } else {
266
+ $image_link_retina = $mt_options['retina_logo'];
267
+ }
268
+
269
+ $image_link = empty($image_link) ? $image_link_retina : $image_link;
270
+ $image_link_retina = empty($image_link_retina) ? $image_link : $image_link_retina;
271
+ ?>
272
+ <div class="logo-box" rel="home">
273
+ <img src="<?php echo esc_url($image_link); ?>" srcset="<?php echo esc_url($image_link_retina); ?> 2x" width="<?php echo esc_attr($logo_w); ?>" <?php echo (!empty($logo_h)) ? 'height="' . esc_attr($logo_h) . '"' : ''; ?> alt="logo">
274
+ </div>
275
+ <?php
276
  } else {
277
+ echo '<div class="logo-box istext" rel="home"><h1 class="site-title">' . esc_html(get_bloginfo('name')) . '</h1></div>';
278
  }
279
+ }
280
+ add_action('logo_box', 'mtnc_get_logo_box', 10);
281
 
282
+ function mtnc_get_content_section()
283
+ {
284
  $mt_options = mtnc_get_plugin_options(true);
285
  if (!empty($mt_options['body_font_subset'])) {
286
+ $current_subset = esc_attr($mt_options['body_font_subset']);
287
+ $font_weight = (string) ((int) $current_subset);
288
+ $font_style = str_replace($font_weight, '', $current_subset);
289
  }
290
 
291
  if (empty($font_style) || $font_style === 'regular') {
292
+ $font_style = 'normal';
293
  }
294
  if (empty($font_weight)) {
295
+ $font_weight = 'normal';
296
  }
297
  $out_content = null;
298
  if (!empty($mt_options['heading'])) {
299
+ $out_content .= '<h2 class="heading font-center" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . wp_kses_post(stripslashes($mt_options['heading'])) . '</h2>';
300
  }
301
 
302
  if (!empty($mt_options['description'])) {
303
+ $description_content = wpautop(wp_kses_post(stripslashes($mt_options['description'])), true);
304
+ $out_content .= '<div class="description" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . $description_content . '</div>';
305
  } else {
306
+ $site_description = get_bloginfo('description');
307
+ $out_content .= '<div class="description" style="font-weight:' . $font_weight . ';font-style:' . $font_style . '"><h3>' . $site_description . '</h3></div>';
308
  }
309
 
310
+ mtnc_wp_kses($out_content);
311
+ }
312
+ add_action('content_section', 'mtnc_get_content_section', 10);
313
 
314
+ function mtnc_get_footer_section()
315
+ {
316
  $mt_options = mtnc_get_plugin_options(true);
317
  if (!empty($mt_options['body_font_subset'])) {
318
+ $current_subset = esc_attr($mt_options['body_font_subset']);
319
+ $font_weight = (string) ((int) $current_subset);
320
+ $font_style = str_replace($font_weight, '', $current_subset);
321
  }
322
 
323
  if (empty($font_style) || $font_style === 'regular') {
324
+ $font_style = 'normal';
325
  }
326
  if (empty($font_weight)) {
327
+ $font_weight = 'normal';
328
  }
329
 
330
  $out_ftext = '';
331
 
332
  if (isset($mt_options['footer_text']) && !empty($mt_options['footer_text'])) {
333
+ $out_ftext .= wp_kses_post(stripslashes($mt_options['footer_text']));
334
  }
335
  if (!empty($mt_options['show_some_love'])) {
336
+ $out_ftext .= '<br><small>This site is using the free <a title="Free WP Maintenance Plugin" target="_blank" href="https://wordpress.org/plugins/maintenance/">WP Maintenance plugin</a>.</small>';
337
  }
338
 
339
  if ($out_ftext) {
340
+ $out_ftext = '<div style="font-weight:' . $font_weight . ';font-style:' . $font_style . '">' . $out_ftext . '</div>';
341
  }
342
 
343
+ mtnc_wp_kses($out_ftext);
344
+ }
345
+ add_action('footer_section', 'mtnc_get_footer_section', 10);
346
 
347
+ function mtnc_do_button_login_form($error = -1)
348
+ {
349
  ?>
350
+ <div id="btn-open-login-form" class="btn-open-login-form">
351
+ <i class="fi-lock"></i>
352
 
353
+ </div>
354
+ <div id="btn-sound" class="btn-open-login-form sound">
355
+ <i id="value_botton" class="fa fa-volume-off" aria-hidden="true"></i>
356
+ </div>
357
+ <?php
358
 
359
+ }
360
 
361
+ function mtnc_do_login_form($user_login, $class_login, $class_password, $error = null)
362
+ {
363
  $mt_options = mtnc_get_plugin_options(true);
364
  $out_login_form = $form_error = '';
365
  if (($class_login === 'error') || ($class_password === 'error')) {
366
+ $form_error = ' active error';
367
  }
368
 
369
  $out_login_form .= '<form name="login-form" id="login-form" class="login-form' . $form_error . '" method="post">';
378
  $out_login_form .= '</form>';
379
 
380
  if (isset($mt_options['is_login'])) {
381
+ mtnc_wp_kses($out_login_form);
382
  }
383
+ }
384
 
385
+ function mtnc_reset_pass_url()
386
+ {
387
  $args = array('action' => 'lostpassword');
388
  $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
389
  return $lostpassword_url;
390
+ }
391
+ add_filter('lostpassword_url', 'mtnc_reset_pass_url', 999, 0);
392
 
393
+ function mtnc_get_preloader_element()
394
+ {
395
  $mt_options = mtnc_get_plugin_options(true);
396
  if (!empty($mt_options['preloader_img'])) {
397
+ $preloader_img = wp_get_attachment_image_src($mt_options['preloader_img'], 'full');
398
+ $preloader_img = !empty($preloader_img) ? $preloader_img[0] : false;
399
  }
400
 
401
  $preloader = !empty($preloader_img) ? '<img src="' . $preloader_img . '">' : '<i class="fi-widget" aria-hidden="true"></i>';
402
  $out = '<div class="preloader">' . $preloader . '</div>';
403
+ mtnc_wp_kses($out);
404
+ }
405
+ add_action('before_content_section', 'mtnc_get_preloader_element', 5);
406
 
407
+ function mtnc_gg_analytics_code()
408
+ {
409
  $mt_options = mtnc_get_plugin_options(true);
410
  if (!isset($mt_options['503_enabled']) && isset($mt_options['gg_analytics_id']) && ($mt_options['gg_analytics_id'] !== '')) {
411
+ ?>
412
+ <script type="text/javascript">
413
+ (function(i, s, o, g, r, a, m) {
414
+ i['GoogleAnalyticsObject'] = r;
415
+ i[r] = i[r] || function() {
416
+ (i[r].q = i[r].q || []).push(arguments)
417
+ }, i[r].l = 1 * new Date();
418
+ a = s.createElement(o),
419
+ m = s.getElementsByTagName(o)[0];
420
+ a.async = 1;
421
+ a.src = g;
422
+ m.parentNode.insertBefore(a, m)
423
+ })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
424
+
425
+ ga('create', '<?php echo esc_attr($mt_options['gg_analytics_id']); ?>', 'auto');
426
+ ga('send', 'pageview');
427
+ </script>
428
  <?php
429
+ }
430
  }
431
  add_action('add_gg_analytics_code', 'mtnc_gg_analytics_code');
432
 
433
  function mtnc_get_headers_503()
434
  {
435
+ $mt_options = mtnc_get_plugin_options(true);
436
+ nocache_headers();
437
+ if (!empty($mt_options['503_enabled'])) {
438
+ $protocol = 'HTTP/1.0';
439
+ if (isset($_SERVER['SERVER_PROTOCOL']) && 'HTTP/1.1' === $_SERVER['SERVER_PROTOCOL']) {
440
+ $protocol = 'HTTP/1.1';
441
+ }
442
+ header("$protocol 503 Service Unavailable", true, 503);
443
+
444
+ $v_curr_date_end = '';
445
+ $vdate_end = date_i18n('Y-m-d', strtotime(current_time('mysql', 0)));
446
+ $vtime_end = date_i18n('h:i a', strtotime('12:00 pm'));
447
+
448
+ if (!empty($mt_options['expiry_date_end'])) {
449
+ $vdate_end = $mt_options['expiry_date_end'];
450
+ }
451
+ if (!empty($mt_options['expiry_time_end'])) {
452
+ $vtime_end = $mt_options['expiry_time_end'];
453
+ }
454
+ if ($mt_options['state'] && !empty($mt_options['expiry_date_end']) && !empty($mt_options['expiry_time_end'])) {
455
+ $date_concat = $vdate_end . ' ' . $vtime_end;
456
+ $v_curr_date = strtotime($date_concat);
457
+ if (strtotime(current_time('mysql', 0)) < $v_curr_date) {
458
+ header('Retry-After: ' . gmdate('D, d M Y H:i:s', $v_curr_date));
459
+ } else {
460
+ header('Retry-After: 3600');
461
+ }
462
+ } else {
463
+ header('Retry-After: 3600');
464
+ }
465
  }
466
+ }
467
+
468
+ function mtnc_wp_kses($html)
469
+ {
470
+ add_filter('safe_style_css', function ($styles) {
471
+ $styles_wf = array(
472
+ 'text-align',
473
+ 'margin',
474
+ 'color',
475
+ 'float',
476
+ 'border',
477
+ 'background',
478
+ 'background-color',
479
+ 'border-bottom',
480
+ 'border-bottom-color',
481
+ 'border-bottom-style',
482
+ 'border-bottom-width',
483
+ 'border-collapse',
484
+ 'border-color',
485
+ 'border-left',
486
+ 'border-left-color',
487
+ 'border-left-style',
488
+ 'border-left-width',
489
+ 'border-right',
490
+ 'border-right-color',
491
+ 'border-right-style',
492
+ 'border-right-width',
493
+ 'border-spacing',
494
+ 'border-style',
495
+ 'border-top',
496
+ 'border-top-color',
497
+ 'border-top-style',
498
+ 'border-top-width',
499
+ 'border-width',
500
+ 'caption-side',
501
+ 'clear',
502
+ 'cursor',
503
+ 'direction',
504
+ 'font',
505
+ 'font-family',
506
+ 'font-size',
507
+ 'font-style',
508
+ 'font-variant',
509
+ 'font-weight',
510
+ 'height',
511
+ 'letter-spacing',
512
+ 'line-height',
513
+ 'margin-bottom',
514
+ 'margin-left',
515
+ 'margin-right',
516
+ 'margin-top',
517
+ 'overflow',
518
+ 'padding',
519
+ 'padding-bottom',
520
+ 'padding-left',
521
+ 'padding-right',
522
+ 'padding-top',
523
+ 'text-decoration',
524
+ 'text-indent',
525
+ 'vertical-align',
526
+ 'width',
527
+ 'display',
528
+ );
529
+
530
+ foreach ($styles_wf as $style_wf) {
531
+ $styles[] = $style_wf;
532
+ }
533
+ return $styles;
534
+ });
535
+
536
+ $allowed_tags = wp_kses_allowed_html('post');
537
+ $allowed_tags['input'] = array(
538
+ 'type' => true,
539
+ 'style' => true,
540
+ 'class' => true,
541
+ 'id' => true,
542
+ 'checked' => true,
543
+ 'disabled' => true,
544
+ 'name' => true,
545
+ 'size' => true,
546
+ 'placeholder' => true,
547
+ 'value' => true,
548
+ 'data-*' => true,
549
+ 'size' => true,
550
+ 'disabled' => true
551
+ );
552
+
553
+ $allowed_tags['textarea'] = array(
554
+ 'type' => true,
555
+ 'style' => true,
556
+ 'class' => true,
557
+ 'id' => true,
558
+ 'checked' => true,
559
+ 'disabled' => true,
560
+ 'name' => true,
561
+ 'size' => true,
562
+ 'placeholder' => true,
563
+ 'value' => true,
564
+ 'data-*' => true,
565
+ 'cols' => true,
566
+ 'rows' => true,
567
+ 'disabled' => true,
568
+ 'autocomplete' => true
569
+ );
570
+
571
+ $allowed_tags['select'] = array(
572
+ 'type' => true,
573
+ 'style' => true,
574
+ 'class' => true,
575
+ 'id' => true,
576
+ 'checked' => true,
577
+ 'disabled' => true,
578
+ 'name' => true,
579
+ 'size' => true,
580
+ 'placeholder' => true,
581
+ 'value' => true,
582
+ 'data-*' => true,
583
+ 'multiple' => true,
584
+ 'disabled' => true
585
+ );
586
+
587
+ $allowed_tags['option'] = array(
588
+ 'type' => true,
589
+ 'style' => true,
590
+ 'class' => true,
591
+ 'id' => true,
592
+ 'checked' => true,
593
+ 'disabled' => true,
594
+ 'name' => true,
595
+ 'size' => true,
596
+ 'placeholder' => true,
597
+ 'value' => true,
598
+ 'selected' => true,
599
+ 'data-*' => true
600
+ );
601
+ $allowed_tags['optgroup'] = array(
602
+ 'type' => true,
603
+ 'style' => true,
604
+ 'class' => true,
605
+ 'id' => true,
606
+ 'checked' => true,
607
+ 'disabled' => true,
608
+ 'name' => true,
609
+ 'size' => true,
610
+ 'placeholder' => true,
611
+ 'value' => true,
612
+ 'selected' => true,
613
+ 'data-*' => true,
614
+ 'label' => true
615
+ );
616
+
617
+ $allowed_tags['a'] = array(
618
+ 'href' => true,
619
+ 'data-*' => true,
620
+ 'class' => true,
621
+ 'style' => true,
622
+ 'id' => true,
623
+ 'target' => true,
624
+ 'data-*' => true,
625
+ 'role' => true,
626
+ 'aria-controls' => true,
627
+ 'aria-selected' => true,
628
+ 'disabled' => true
629
+ );
630
+
631
+ $allowed_tags['div'] = array(
632
+ 'style' => true,
633
+ 'class' => true,
634
+ 'id' => true,
635
+ 'data-*' => true,
636
+ 'role' => true,
637
+ 'aria-labelledby' => true,
638
+ 'value' => true,
639
+ 'aria-modal' => true,
640
+ 'tabindex' => true
641
+ );
642
+
643
+ $allowed_tags['li'] = array(
644
+ 'style' => true,
645
+ 'class' => true,
646
+ 'id' => true,
647
+ 'data-*' => true,
648
+ 'role' => true,
649
+ 'aria-labelledby' => true,
650
+ 'value' => true,
651
+ 'aria-modal' => true,
652
+ 'tabindex' => true
653
+ );
654
+
655
+ $allowed_tags['span'] = array(
656
+ 'style' => true,
657
+ 'class' => true,
658
+ 'id' => true,
659
+ 'data-*' => true,
660
+ 'aria-hidden' => true
661
+ );
662
+
663
+ $allowed_tags['style'] = array(
664
+ 'class' => true,
665
+ 'id' => true,
666
+ 'type' => true
667
+ );
668
+
669
+ $allowed_tags['fieldset'] = array(
670
+ 'class' => true,
671
+ 'id' => true,
672
+ 'type' => true
673
+ );
674
+
675
+ $allowed_tags['link'] = array(
676
+ 'class' => true,
677
+ 'id' => true,
678
+ 'type' => true,
679
+ 'rel' => true,
680
+ 'href' => true,
681
+ 'media' => true
682
+ );
683
+
684
+ $allowed_tags['form'] = array(
685
+ 'style' => true,
686
+ 'class' => true,
687
+ 'id' => true,
688
+ 'method' => true,
689
+ 'action' => true,
690
+ 'data-*' => true
691
+ );
692
+
693
+ echo wp_kses($html, $allowed_tags);
694
+
695
+ add_filter('safe_style_css', function ($styles) {
696
+ $styles_wf = array(
697
+ 'text-align',
698
+ 'margin',
699
+ 'color',
700
+ 'float',
701
+ 'border',
702
+ 'background',
703
+ 'background-color',
704
+ 'border-bottom',
705
+ 'border-bottom-color',
706
+ 'border-bottom-style',
707
+ 'border-bottom-width',
708
+ 'border-collapse',
709
+ 'border-color',
710
+ 'border-left',
711
+ 'border-left-color',
712
+ 'border-left-style',
713
+ 'border-left-width',
714
+ 'border-right',
715
+ 'border-right-color',
716
+ 'border-right-style',
717
+ 'border-right-width',
718
+ 'border-spacing',
719
+ 'border-style',
720
+ 'border-top',
721
+ 'border-top-color',
722
+ 'border-top-style',
723
+ 'border-top-width',
724
+ 'border-width',
725
+ 'caption-side',
726
+ 'clear',
727
+ 'cursor',
728
+ 'direction',
729
+ 'font',
730
+ 'font-family',
731
+ 'font-size',
732
+ 'font-style',
733
+ 'font-variant',
734
+ 'font-weight',
735
+ 'height',
736
+ 'letter-spacing',
737
+ 'line-height',
738
+ 'margin-bottom',
739
+ 'margin-left',
740
+ 'margin-right',
741
+ 'margin-top',
742
+ 'overflow',
743
+ 'padding',
744
+ 'padding-bottom',
745
+ 'padding-left',
746
+ 'padding-right',
747
+ 'padding-top',
748
+ 'text-decoration',
749
+ 'text-indent',
750
+ 'vertical-align',
751
+ 'width'
752
+ );
753
+
754
+ foreach ($styles_wf as $style_wf) {
755
+ if (($key = array_search($style_wf, $styles)) !== false) {
756
+ unset($styles[$key]);
757
+ }
758
+ }
759
+ return $styles;
760
+ });
761
  }
load/index.php CHANGED
@@ -57,11 +57,11 @@ $google_fonts = mtnc_add_google_fonts();
57
  <?php
58
  if ( ! empty( $logo ) ) {
59
  ?>
60
- <meta property="og:image" content="<?php echo esc_url( $logo ); ?>" />
61
- <meta property="og:image:url" content="<?php echo esc_url( $logo ); ?>"/>
62
- <meta property="og:image:secure_url" content="<?php echo esc_url( $logo ); ?>"/>
63
- <meta property="og:image:type" content="<?php echo esc_attr( $logo_ext ); ?>"/>
64
- <?php
65
  }
66
  ?>
67
  <link rel="profile" href="http://gmpg.org/xfn/11" />
@@ -83,7 +83,7 @@ $google_fonts = mtnc_add_google_fonts();
83
  ?>
84
  </head>
85
 
86
- <body class="maintenance <?php echo $ebody_class; ?>">
87
 
88
  <?php do_action( 'before_main_container' ); ?>
89
  <div class="main-container">
57
  <?php
58
  if ( ! empty( $logo ) ) {
59
  ?>
60
+ <meta property="og:image" content="<?php echo esc_url( $logo ); ?>" />
61
+ <meta property="og:image:url" content="<?php echo esc_url( $logo ); ?>"/>
62
+ <meta property="og:image:secure_url" content="<?php echo esc_url( $logo ); ?>"/>
63
+ <meta property="og:image:type" content="<?php echo esc_attr( $logo_ext ); ?>"/>
64
+ <?php
65
  }
66
  ?>
67
  <link rel="profile" href="http://gmpg.org/xfn/11" />
83
  ?>
84
  </head>
85
 
86
+ <body class="maintenance <?php echo esc_html($ebody_class); ?>">
87
 
88
  <?php do_action( 'before_main_container' ); ?>
89
  <div class="main-container">
maintenance.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Maintenance
4
  Plugin URI: https://wpmaintenancemode.com/
5
  Description: Put your site in maintenance mode, away from the public view. Use maintenance plugin if your website is in development or you need to change a few things, run an upgrade. Make it only accessible to logged in users.
6
- Version: 4.03
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  License: GPL2
10
 
11
- Copyright 2013-2021 WebFactory Ltd (email : support@webfactoryltd.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
@@ -48,6 +48,8 @@ class MTNC
48
  add_action('init', array(&$this, 'mtnc_admin_bar'));
49
  add_action('init', array(&$this, 'mtnc_set_global_options'), 1);
50
 
 
 
51
  add_filter(
52
  'plugin_action_links_' . plugin_basename(__FILE__),
53
  array(&$this, 'plugin_action_links')
@@ -196,6 +198,66 @@ class MTNC
196
  }
197
  } // is_plugin_installed
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  } // class MTNC
200
 
201
  $mtnc = new MTNC();
3
  Plugin Name: Maintenance
4
  Plugin URI: https://wpmaintenancemode.com/
5
  Description: Put your site in maintenance mode, away from the public view. Use maintenance plugin if your website is in development or you need to change a few things, run an upgrade. Make it only accessible to logged in users.
6
+ Version: 4.05
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  License: GPL2
10
 
11
+ Copyright 2013-2022 WebFactory Ltd (email : support@webfactoryltd.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
48
  add_action('init', array(&$this, 'mtnc_admin_bar'));
49
  add_action('init', array(&$this, 'mtnc_set_global_options'), 1);
50
 
51
+ add_action('admin_action_mtnc_install_wpfssl', array(&$this, 'install_wpfssl'));
52
+
53
  add_filter(
54
  'plugin_action_links_' . plugin_basename(__FILE__),
55
  array(&$this, 'plugin_action_links')
198
  }
199
  } // is_plugin_installed
200
 
201
+ // auto download / install / activate WP Force SSL plugin
202
+ function install_wpfssl()
203
+ {
204
+ check_ajax_referer('install_wpfssl');
205
+
206
+ if (false === current_user_can('administrator')) {
207
+ wp_die('Sorry, you have to be an admin to run this action.');
208
+ }
209
+
210
+ $plugin_slug = 'wp-force-ssl/wp-force-ssl.php';
211
+ $plugin_zip = 'https://downloads.wordpress.org/plugin/wp-force-ssl.latest-stable.zip';
212
+
213
+ @include_once ABSPATH . 'wp-admin/includes/plugin.php';
214
+ @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
215
+ @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
216
+ @include_once ABSPATH . 'wp-admin/includes/file.php';
217
+ @include_once ABSPATH . 'wp-admin/includes/misc.php';
218
+ echo '<style>
219
+ body{
220
+ font-family: sans-serif;
221
+ font-size: 14px;
222
+ line-height: 1.5;
223
+ color: #444;
224
+ }
225
+ </style>';
226
+
227
+ echo '<div style="margin: 20px; color:#444;">';
228
+ echo 'If things are not done in a minute <a target="_parent" href="' . admin_url('plugin-install.php?s=force%20ssl%20webfactory&tab=search&type=term') . '">install the plugin manually via Plugins page</a><br><br>';
229
+ echo 'Starting ...<br><br>';
230
+
231
+ wp_cache_flush();
232
+ $upgrader = new Plugin_Upgrader();
233
+ echo 'Check if WP Force SSL is already installed ... <br />';
234
+ if ($this->is_plugin_installed($plugin_slug)) {
235
+ echo 'WP Force SSL is already installed! <br /><br />Making sure it\'s the latest version.<br />';
236
+ $upgrader->upgrade($plugin_slug);
237
+ $installed = true;
238
+ } else {
239
+ echo 'Installing WP Force SSL.<br />';
240
+ $installed = $upgrader->install($plugin_zip);
241
+ }
242
+ wp_cache_flush();
243
+
244
+ if (!is_wp_error($installed) && $installed) {
245
+ echo 'Activating WP Force SSL.<br />';
246
+ $activate = activate_plugin($plugin_slug);
247
+
248
+ if (is_null($activate)) {
249
+ echo 'WP Force SSL Activated.<br />';
250
+
251
+ echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
252
+ echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
253
+ }
254
+ } else {
255
+ echo 'Could not install WP Force SSL. You\'ll have to <a target="_parent" href="' . admin_url('plugin-install.php?s=force%20ssl%20webfactory&tab=search&type=term') . '">download and install manually</a>.';
256
+ }
257
+
258
+ echo '</div>';
259
+ } // install_wpfssl
260
+
261
  } // class MTNC
262
 
263
  $mtnc = new MTNC();
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: WebFactory
3
  Tags: maintenance, maintenance mode, maintenance page, coming soon, coming soon page, under construction, under construction page
4
  Requires at least: 4.0
5
- Tested up to: 5.8
6
- Stable tag: 4.03
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -16,8 +16,7 @@ Maintenance plugin allows the WordPress site administrator to close the website
16
 
17
  Need **200+ pre-made themes** to build coming soon & landing pages faster? Have a look at our <a href="https://comingsoonwp.com/">Coming Soon & Maintenance Mode</a> plugin.
18
 
19
- Let <a href="https://wordpress.org/plugins/security-ninja/">Security Ninja</a> take care of your site's security from day one! Run over 50 security tests with one click. Get a detailed report and automatically fix security issues.
20
-
21
 
22
  <h3>Features</h3>
23
  <ul>
@@ -88,6 +87,12 @@ Please post the question on the <a href="http://wordpress.org/support/plugin/mai
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
91
  = v4.03 =
92
  - 2021/07/18
93
  - security fixes
2
  Contributors: WebFactory
3
  Tags: maintenance, maintenance mode, maintenance page, coming soon, coming soon page, under construction, under construction page
4
  Requires at least: 4.0
5
+ Tested up to: 5.9
6
+ Stable tag: 4.05
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
 
17
  Need **200+ pre-made themes** to build coming soon & landing pages faster? Have a look at our <a href="https://comingsoonwp.com/">Coming Soon & Maintenance Mode</a> plugin.
18
 
19
+ If you're having problems with SSL or HTTPS try our free <a href="https://wordpress.org/plugins/wp-force-ssl/">WP Force SSL</a> plugin. It's a great plugin to enable SSL.
 
20
 
21
  <h3>Features</h3>
22
  <ul>
87
 
88
  == Changelog ==
89
 
90
+ = v4.05 =
91
+ - 2022/01/04
92
+ - bug fix for retina image
93
+ - security fixes
94
+ - ad for our free WP Force SSL plugin
95
+
96
  = v4.03 =
97
  - 2021/07/18
98
  - security fixes
wf-flyout/config.php CHANGED
@@ -9,9 +9,10 @@ $config['icon_image'] = 'maintenance.png';
9
  $config['icon_padding'] = '0px';
10
  $config['icon_size'] = '65px';
11
  $config['menu_accent_color'] = '#dd3036';
12
- $config['custom_css'] = '#wf-flyout .wff-menu-item .dashicons.dashicons-universal-access { font-size: 30px; padding: 0px 10px 0px 0; } #wf-flyout .ucp-icon .wff-icon img { max-width: 66%; } #wf-flyout .ucp-icon .wff-icon { line-height: 57px; } #wf-flyout .wpr-icon .wff-icon { line-height: 62px; } #wf-flyout .wp301-icon .wff-icon img { max-width: 66%; } #wf-flyout .wp301-icon .wff-icon { line-height: 57px; }';
13
 
14
  $config['menu_items'] = array(
 
15
  array('href' => 'https://wp301redirects.com/?ref=wff-maintenance&coupon=50off', 'label' => 'Fix 2 most common SEO issues on WordPress that most people ignore', 'icon' => '301-logo.png', 'class' => 'wp301-icon'),
16
  array('href' => 'https://wpreset.com/?ref=wff-maintenance&coupon=50off', 'target' => '_blank', 'label' => 'Get WP Reset PRO with 50% off', 'icon' => 'wp-reset.png', 'class' => 'wpr-icon'),
17
  array('href' => 'https://underconstructionpage.com/?ref=wff-maintenance&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
9
  $config['icon_padding'] = '0px';
10
  $config['icon_size'] = '65px';
11
  $config['menu_accent_color'] = '#dd3036';
12
+ $config['custom_css'] = '#wf-flyout .wff-menu-item .dashicons.dashicons-universal-access { font-size: 30px; padding: 0px 10px 0px 0; } #wf-flyout .ucp-icon .wff-icon img { max-width: 66%; } #wf-flyout .ucp-icon .wff-icon { line-height: 57px; } #wf-flyout .wpr-icon .wff-icon { line-height: 62px; } #wf-flyout .wp301-icon .wff-icon img { max-width: 66%; } #wf-flyout .wp301-icon .wff-icon { line-height: 57px; } #wf-flyout .wpfssl-icon .wff-icon img { max-width: 66%; } #wf-flyout .wpfssl-icon .wff-icon { line-height: 57px; }';
13
 
14
  $config['menu_items'] = array(
15
+ array('href' => 'https://wpforcessl.com/?ref=wff-maintenance', 'label' => 'Fix all SSL problems &amp; monitor site in real-time', 'icon' => 'wp-ssl.png', 'class' => 'wpfssl-icon'),
16
  array('href' => 'https://wp301redirects.com/?ref=wff-maintenance&coupon=50off', 'label' => 'Fix 2 most common SEO issues on WordPress that most people ignore', 'icon' => '301-logo.png', 'class' => 'wp301-icon'),
17
  array('href' => 'https://wpreset.com/?ref=wff-maintenance&coupon=50off', 'target' => '_blank', 'label' => 'Get WP Reset PRO with 50% off', 'icon' => 'wp-reset.png', 'class' => 'wpr-icon'),
18
  array('href' => 'https://underconstructionpage.com/?ref=wff-maintenance&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
wf-flyout/icons/wp-ssl.png ADDED
Binary file
wf-flyout/wf-flyout.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * Universal fly-out menu for WebFactory plugins
3
- * (c) WebFactory Ltd, 2021
4
  */
5
 
6
  #wf-flyout {
1
  /**
2
  * Universal fly-out menu for WebFactory plugins
3
+ * (c) WebFactory Ltd, 2022
4
  */
5
 
6
  #wf-flyout {
wf-flyout/wf-flyout.js CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * Universal fly-out menu for WebFactory plugins
3
- * (c) WebFactory Ltd, 2021
4
  */
5
 
6
  jQuery(document).ready(function ($) {
1
  /**
2
  * Universal fly-out menu for WebFactory plugins
3
+ * (c) WebFactory Ltd, 2022
4
  */
5
 
6
  jQuery(document).ready(function ($) {
wf-flyout/wf-flyout.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Universal fly-out menu for WebFactory plugins
4
- * (c) WebFactory Ltd, 2021
5
  */
6
 
7
 
@@ -111,7 +111,7 @@ if (false == class_exists('wf_flyout')) {
111
  $out .= sanitize_text_field($this->config['custom_css']);
112
  $out .= '</style>';
113
 
114
- echo $out;
115
  } // admin_head
116
 
117
 
@@ -160,7 +160,7 @@ if (false == class_exists('wf_flyout')) {
160
 
161
  $out .= '</div>'; // #wf-flyout
162
 
163
- echo $out;
164
  } // admin_footer
165
  } // wf_flyout
166
  } // if class exists
1
  <?php
2
  /**
3
  * Universal fly-out menu for WebFactory plugins
4
+ * (c) WebFactory Ltd, 2022
5
  */
6
 
7
 
111
  $out .= sanitize_text_field($this->config['custom_css']);
112
  $out .= '</style>';
113
 
114
+ mtnc_wp_kses($out);
115
  } // admin_head
116
 
117
 
160
 
161
  $out .= '</div>'; // #wf-flyout
162
 
163
+ mtnc_wp_kses($out);
164
  } // admin_footer
165
  } // wf_flyout
166
  } // if class exists