PluginProbe
Maintenance / 4.32
Maintenance v4.32
4.32 4.31 4.30 4.19 4.20 4.21 trunk 1.0 1.1 1.1.1 1.2 1.2.1 1.2.2 1.2.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.2 2.2.1 2.3 2.4 2.5 2.6 All 66 releases
maintenance / maintenance.php

maintenance.php in Maintenance 4.32, at maintenance.php

5,228 lines 287.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
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.32
7 Author: WebFactory Ltd
8 Author URI: https://www.webfactoryltd.com/
9 License: GPL2
10
11 Copyright 2013-2026 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
15 published by the Free Software Foundation.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26
27 // include only file
28 if (!defined('ABSPATH')) {
29 die('Do not open this file directly.');
30 }
31
32 define('MTNC_FILE', __FILE__);
33 define('MTNC_URL', trailingslashit(plugins_url('', __FILE__)));
34 define('MTNC_PATH', trailingslashit(plugin_dir_path(__FILE__)));
35 define('MTNC_URI', trailingslashit(plugin_dir_url(__FILE__)));
36 define('MTNC_INCLUDES', MTNC_PATH . trailingslashit('inc'));
37 define('MTNC_LOAD', MTNC_PATH . trailingslashit('frontend'));
38 define('MTNC_THEMES_PATH', MTNC_PATH . trailingslashit('themes'));
39
40 class MTNC
41 {
42 protected static $instance = null;
43 public $version = 0;
44 public $plugin_url = '';
45 public $plugin_dir = '';
46 public $modules;
47 public $theme_id;
48 public $theme;
49 protected $options = array();
50
51 /**
52 * Creates a new MTNC object and implements singleton
53 *
54 * @return MTNC
55 */
56 public static function getInstance()
57 {
58 if (!is_a(self::$instance, 'MTNC')) {
59 self::$instance = new MTNC();
60 }
61
62 return self::$instance;
63 } // getInstance
64
65 /**
66 * Initialize properties, hook to filters and actions
67 *
68 * @return null
69 */
70 private function __construct()
71 {
72 $this->version = $this->get_plugin_version();
73 $this->plugin_dir = plugin_dir_path(__FILE__);
74 $this->plugin_url = plugin_dir_url(__FILE__);
75 $this->load_options();
76
77 $options = $this->get_options();
78 $this->theme_id = isset($_GET['theme_id']) && array_key_exists($_GET['theme_id'], $options['themes']) ? wp_unslash($_GET['theme_id']) : $options['theme_global']; //phpcs:ignore
79 $this->theme = $options['themes'][$this->theme_id];
80
81 //Admin Interface
82 add_action('admin_menu', array($this, 'admin_menu'));
83 add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
84 add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2);
85 add_filter('admin_footer_text', array($this, 'admin_footer_text'));
86 add_action('wp_before_admin_bar_render', array($this, 'admin_bar'));
87 add_action('wp_head', array($this, 'admin_bar_style'));
88 add_action('admin_head', array($this, 'admin_bar_style'));
89
90 //Admin actions
91 add_action('admin_action_mtnc_change_status', array($this, 'change_status'));
92 add_action('admin_action_mtnc_install_wpfssl', array(&$this, 'install_wpfssl'));
93 add_action('admin_action_mtnc_install_wpcaptcha', array(&$this, 'install_wpcaptcha'));
94 add_action('admin_action_mtnc_install_weglot', array(&$this, 'install_weglot'));
95 add_action('admin_action_mtnc_install_weglot', array(&$this, 'install_weglot'));
96 add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'plugin_action_links'));
97 add_action('admin_action_mtnc_reset_settings', array($this, 'mtnc_reset_settings'));
98
99 //AJAX
100 add_action('wp_ajax_mtnc_action', array($this, 'ajax_action'));
101 add_action('wp_ajax_maintenance_dismiss_notice', array($this, 'ajax_dismiss_notice'));
102
103 //Frontend
104 add_action('template_include', array($this, 'template_include'), 999999);
105 } // __construct
106
107 /**
108 * Get plugin version from file header
109 *
110 * @return string
111 */
112 public function get_plugin_version()
113 {
114 $plugin_data = get_file_data(__FILE__, array('version' => 'Version'), 'plugin');
115
116 return $plugin_data['version'];
117 } // get_plugin_version
118
119 // add settings link to plugins page
120 static function plugin_action_links($links)
121 {
122 $settings_link = '<a href="' . admin_url('options-general.php?page=maintenance') . '" title="Manage redirects">Configure</a>';
123 $pro_link = '<a href="' . admin_url('options-general.php?page=maintenance#open-pro-dialog') . '" title="Get PRO"><b>Get PRO</b></a>';
124
125 array_unshift($links, $pro_link);
126 array_unshift($links, $settings_link);
127
128 return $links;
129 } // plugin_action_links
130
131 /**
132 * Load and prepare the options array. If needed create a new DB entry.
133 *
134 * @return array
135 */
136 private function load_options()
137 {
138 $options = get_option('mtnc-options', array('options' => array()));
139 $change = false;
140
141 if (!is_array($options)) {
142 $options = array('options' => array());
143 }
144
145 if (!is_array($options['options'])) {
146 $options['options'] = array();
147 }
148
149 if (empty($options['meta'])) {
150 $options['meta'] = array('first_version' => $this->version, 'first_install' => current_time('timestamp', true));
151 $change = true;
152 }
153
154 if (!isset($options['dismissed_notices']) || !is_array($options['dismissed_notices'])) {
155 $options['dismissed_notices'] = array();
156 $change = true;
157 }
158
159 $default_theme_id = md5(time() . 'default');
160 $def_options = array(
161 'status' => '0',
162 'mode' => 'layout',
163 'mtnc_page' => 0,
164 'header_text' => 'Our site is under maintenance!',
165 //SEO
166 'title' => get_bloginfo('name') . ' is under maintenance',
167 'description' => 'We are doing some work on our site. Please come back later. We\'ll be up and running in no time.',
168 'target_keyword' => 'maintenance',
169 'excludese' => '0',
170 'blockse' => '0',
171 'favicon' => '',
172 'social_preview' => '',
173 'analytics' => '',
174 'tracking_pixel' => '',
175 'twitter_site' => '',
176 'facebook_site' => '',
177 //Access
178 'show_logged_in' => '1',
179 'ip_whitelist' => '',
180 'per_url_settings' => '',
181 'per_url_enable_disable' => '',
182 'direct_access_link' => '',
183 'custom_login_url' => '',
184 'login_button' => '1',
185 'wplogin_button_tooltip' => 'Access WordPress admin',
186 'maintenance_password' => '',
187 'site_password' => '',
188 'password_button' => '0',
189 'login_button_text' => 'Access the Site',
190 'login_message' => 'Please enter the password to access the site',
191 'login_wrong_password_text' => 'Wrong password',
192 'login_button_tooltip' => 'Direct Access login',
193 //Advanced
194 'no_cache_headers' => '1',
195 'disable_toolbar_menu' => '',
196 'force_ssl' => '',
197 'enable_rest' => '',
198 'custom_wp_maintenance' => '',
199 'custom_wp_maintenance_title' => '',
200 'custom_wp_maintenance_content' => '',
201
202 );
203
204 $def_options['theme_global'] = $default_theme_id;
205 $def_options['themes'] = array($default_theme_id => json_decode(
206 '{
207 "modules": {
208 "header-dbd02cd1": {
209 "name": "Header",
210 "type": "header",
211 "groups": {
212 "header": {
213 "name": "Header",
214 "active": true,
215 "fields": {
216 "text": {
217 "type": "text",
218 "name": "text",
219 "label": "Text",
220 "value": "Site is undergoing maintenance",
221 "class": "full-width",
222 "desc": ""
223 },
224 "text_align": {
225 "type": "radio",
226 "name": "text_align",
227 "label": "Text Align",
228 "class": "",
229 "values": {
230 "left": "Left",
231 "center": "Center",
232 "right": "Right"
233 },
234 "value": "center"
235 },
236 "font_size": {
237 "type": "range",
238 "name": "font_size",
239 "label": "Font Size",
240 "value": "47",
241 "min": 6,
242 "max": 120,
243 "class": "",
244 "units": {
245 "px": "px",
246 "pt": "pt",
247 "em": "em"
248 },
249 "unit_value": "px"
250 },
251 "color": {
252 "type": "color",
253 "name": "text_color",
254 "label": "Color",
255 "value": "rgba(255,255,255,1)",
256 "desc": ""
257 },
258 "font": {
259 "type": "font",
260 "name": "font",
261 "label": "Font",
262 "value": "Open Sans",
263 "class": "full-width",
264 "desc": ""
265 },
266 "line_height": {
267 "type": "number",
268 "name": "line_height",
269 "label": "Line Height",
270 "value": "2",
271 "units": {
272 "px": "px",
273 "percent": "%",
274 "em": "em"
275 },
276 "unit_value": "em",
277 "class": "number_small",
278 "desc": ""
279 }
280 }
281 },
282 "layout": {
283 "name": "Layout",
284 "fields": {
285 "padding_label": {
286 "type": "label",
287 "name": "padding_label",
288 "label": "Padding"
289 },
290 "padding_top": {
291 "type": "number",
292 "name": "padding_top",
293 "label": "Top",
294 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
295 "value": "10",
296 "class": "number_small",
297 "units": {
298 "px": "px",
299 "percent": "%",
300 "em": "em"
301 },
302 "unit_value": "px",
303 "wrapper_class": "col-4"
304 },
305 "padding_bottom": {
306 "type": "number",
307 "name": "padding_bottom",
308 "label": "Bottom",
309 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
310 "value": "10",
311 "class": "number_small",
312 "units": {
313 "px": "px",
314 "percent": "%",
315 "em": "em"
316 },
317 "unit_value": "px",
318 "wrapper_class": "col-4"
319 },
320 "padding_left": {
321 "type": "number",
322 "name": "padding_left",
323 "label": "Left",
324 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
325 "value": "0",
326 "class": "number_small",
327 "units": {
328 "px": "px",
329 "percent": "%",
330 "em": "em"
331 },
332 "unit_value": "px",
333 "wrapper_class": "col-4"
334 },
335 "padding_right": {
336 "type": "number",
337 "name": "padding_right",
338 "label": "Right",
339 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
340 "value": "0",
341 "class": "number_small",
342 "units": {
343 "px": "px",
344 "percent": "%",
345 "em": "em"
346 },
347 "unit_value": "px",
348 "wrapper_class": "col-4"
349 },
350 "margin_label": {
351 "type": "label",
352 "name": "margin_label",
353 "label": "Margin"
354 },
355 "margin_top": {
356 "type": "number",
357 "name": "margin_top",
358 "label": "Top",
359 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
360 "value": "0",
361 "class": "number_small",
362 "units": {
363 "px": "px",
364 "percent": "%",
365 "em": "em"
366 },
367 "unit_value": "px",
368 "wrapper_class": "col-4"
369 },
370 "margin_bottom": {
371 "type": "number",
372 "name": "margin_bottom",
373 "label": "Bottom",
374 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
375 "value": "0",
376 "class": "number_small",
377 "units": {
378 "px": "px",
379 "percent": "%",
380 "em": "em"
381 },
382 "unit_value": "px",
383 "wrapper_class": "col-4"
384 },
385 "margin_left": {
386 "type": "number",
387 "name": "margin_left",
388 "label": "Left",
389 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
390 "value": "0",
391 "class": "number_small",
392 "units": {
393 "px": "px",
394 "percent": "%",
395 "em": "em"
396 },
397 "unit_value": "px",
398 "wrapper_class": "col-4"
399 },
400 "margin_right": {
401 "type": "number",
402 "name": "margin_right",
403 "label": "Right",
404 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
405 "value": "0",
406 "class": "number_small",
407 "units": {
408 "px": "px",
409 "percent": "%",
410 "em": "em"
411 },
412 "unit_value": "px",
413 "wrapper_class": "col-4"
414 },
415 "background_label": {
416 "type": "label",
417 "name": "background_label",
418 "label": "Background"
419 },
420 "background_color": {
421 "type": "color",
422 "name": "background_color",
423 "nolabel": true,
424 "value": "rgba(255,255,255,0)",
425 "desc": ""
426 },
427 "background": {
428 "type": "image",
429 "name": "background",
430 "nolabel": true,
431 "value": "",
432 "class": "",
433 "desc": ""
434 }
435 }
436 }
437 }
438 },
439 "content-471365b7": {
440 "name": "Content",
441 "type": "content",
442 "groups": {
443 "col1": {
444 "name": "Footer",
445 "active": true,
446 "fields": {
447 "text": {
448 "type": "textarea",
449 "name": "text",
450 "label": "Text",
451 "value": "Maintenance mode is on",
452 "class": "full-width",
453 "desc": ""
454 },
455 "font_size": {
456 "type": "number",
457 "name": "font_size",
458 "label": "Font Size",
459 "value": "36",
460 "class": "number_small",
461 "units": {
462 "px": "px",
463 "pt": "pt",
464 "em": "em"
465 },
466 "unit_value": "px"
467 },
468 "color": {
469 "type": "color",
470 "name": "text_color",
471 "label": "Color",
472 "value": "rgba(255,255,255,1)",
473 "desc": ""
474 },
475 "font": {
476 "type": "font",
477 "name": "font",
478 "label": "Font",
479 "value": "Open Sans",
480 "class": "full-width",
481 "desc": ""
482 },
483 "line_height": {
484 "type": "number",
485 "name": "line_height",
486 "label": "Line Height",
487 "value": "1",
488 "units": {
489 "px": "px",
490 "percent": "%",
491 "em": "em"
492 },
493 "unit_value": "em",
494 "class": "number_small",
495 "desc": ""
496 }
497 }
498 },
499 "layout": {
500 "name": "Layout",
501 "fields": {
502 "padding_label": {
503 "type": "label",
504 "name": "padding_label",
505 "label": "Padding"
506 },
507 "padding_top": {
508 "type": "number",
509 "name": "padding_top",
510 "label": "Top",
511 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
512 "value": "100",
513 "class": "number_small",
514 "units": {
515 "px": "px",
516 "percent": "%",
517 "em": "em"
518 },
519 "unit_value": "px",
520 "wrapper_class": "col-4"
521 },
522 "padding_bottom": {
523 "type": "number",
524 "name": "padding_bottom",
525 "label": "Bottom",
526 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
527 "value": "10",
528 "class": "number_small",
529 "units": {
530 "px": "px",
531 "percent": "%",
532 "em": "em"
533 },
534 "unit_value": "px",
535 "wrapper_class": "col-4"
536 },
537 "padding_left": {
538 "type": "number",
539 "name": "padding_left",
540 "label": "Left",
541 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
542 "value": "0",
543 "class": "number_small",
544 "units": {
545 "px": "px",
546 "percent": "%",
547 "em": "em"
548 },
549 "unit_value": "px",
550 "wrapper_class": "col-4"
551 },
552 "padding_right": {
553 "type": "number",
554 "name": "padding_right",
555 "label": "Right",
556 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
557 "value": "0",
558 "class": "number_small",
559 "units": {
560 "px": "px",
561 "percent": "%",
562 "em": "em"
563 },
564 "unit_value": "px",
565 "wrapper_class": "col-4"
566 },
567 "margin_label": {
568 "type": "label",
569 "name": "margin_label",
570 "label": "Margin"
571 },
572 "margin_top": {
573 "type": "number",
574 "name": "margin_top",
575 "label": "Top",
576 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
577 "value": "0",
578 "class": "number_small",
579 "units": {
580 "px": "px",
581 "percent": "%",
582 "em": "em"
583 },
584 "unit_value": "px",
585 "wrapper_class": "col-4"
586 },
587 "margin_bottom": {
588 "type": "number",
589 "name": "margin_bottom",
590 "label": "Bottom",
591 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
592 "value": "0",
593 "class": "number_small",
594 "units": {
595 "px": "px",
596 "percent": "%",
597 "em": "em"
598 },
599 "unit_value": "px",
600 "wrapper_class": "col-4"
601 },
602 "margin_left": {
603 "type": "number",
604 "name": "margin_left",
605 "label": "Left",
606 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
607 "value": "0",
608 "class": "number_small",
609 "units": {
610 "px": "px",
611 "percent": "%",
612 "em": "em"
613 },
614 "unit_value": "px",
615 "wrapper_class": "col-4"
616 },
617 "margin_right": {
618 "type": "number",
619 "name": "margin_right",
620 "label": "Right",
621 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
622 "value": "0",
623 "class": "number_small",
624 "units": {
625 "px": "px",
626 "percent": "%",
627 "em": "em"
628 },
629 "unit_value": "px",
630 "wrapper_class": "col-4"
631 },
632 "background_label": {
633 "type": "label",
634 "name": "background_label",
635 "label": "Background"
636 },
637 "background_color": {
638 "type": "color",
639 "name": "background_color",
640 "nolabel": true,
641 "value": "rgba(255,255,255,0)",
642 "desc": ""
643 },
644 "background": {
645 "type": "image",
646 "name": "background",
647 "nolabel": true,
648 "value": "",
649 "class": "",
650 "desc": ""
651 }
652 }
653 }
654 }
655 },
656 "content-9742e2f8": {
657 "name": "Content",
658 "type": "content",
659 "groups": {
660 "col1": {
661 "name": "Footer",
662 "active": true,
663 "fields": {
664 "text": {
665 "type": "textarea",
666 "name": "text",
667 "label": "Text",
668 "value": "Site will be available soon. Thank you for your patience!",
669 "class": "full-width",
670 "desc": ""
671 },
672 "font_size": {
673 "type": "number",
674 "name": "font_size",
675 "label": "Font Size",
676 "value": "20",
677 "class": "number_small",
678 "units": {
679 "px": "px",
680 "pt": "pt",
681 "em": "em"
682 },
683 "unit_value": "px"
684 },
685 "color": {
686 "type": "color",
687 "name": "text_color",
688 "label": "Color",
689 "value": "rgba(255,255,255,1)",
690 "desc": ""
691 },
692 "font": {
693 "type": "font",
694 "name": "font",
695 "label": "Font",
696 "value": "Open Sans",
697 "class": "full-width",
698 "desc": ""
699 },
700 "line_height": {
701 "type": "number",
702 "name": "line_height",
703 "label": "Line Height",
704 "value": "1",
705 "units": {
706 "px": "px",
707 "percent": "%",
708 "em": "em"
709 },
710 "unit_value": "em",
711 "class": "number_small",
712 "desc": ""
713 }
714 }
715 },
716 "layout": {
717 "name": "Layout",
718 "fields": {
719 "padding_label": {
720 "type": "label",
721 "name": "padding_label",
722 "label": "Padding"
723 },
724 "padding_top": {
725 "type": "number",
726 "name": "padding_top",
727 "label": "Top",
728 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
729 "value": "10",
730 "class": "number_small",
731 "units": {
732 "px": "px",
733 "percent": "%",
734 "em": "em"
735 },
736 "unit_value": "px",
737 "wrapper_class": "col-4"
738 },
739 "padding_bottom": {
740 "type": "number",
741 "name": "padding_bottom",
742 "label": "Bottom",
743 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
744 "value": "10",
745 "class": "number_small",
746 "units": {
747 "px": "px",
748 "percent": "%",
749 "em": "em"
750 },
751 "unit_value": "px",
752 "wrapper_class": "col-4"
753 },
754 "padding_left": {
755 "type": "number",
756 "name": "padding_left",
757 "label": "Left",
758 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
759 "value": "0",
760 "class": "number_small",
761 "units": {
762 "px": "px",
763 "percent": "%",
764 "em": "em"
765 },
766 "unit_value": "px",
767 "wrapper_class": "col-4"
768 },
769 "padding_right": {
770 "type": "number",
771 "name": "padding_right",
772 "label": "Right",
773 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
774 "value": "0",
775 "class": "number_small",
776 "units": {
777 "px": "px",
778 "percent": "%",
779 "em": "em"
780 },
781 "unit_value": "px",
782 "wrapper_class": "col-4"
783 },
784 "margin_label": {
785 "type": "label",
786 "name": "margin_label",
787 "label": "Margin"
788 },
789 "margin_top": {
790 "type": "number",
791 "name": "margin_top",
792 "label": "Top",
793 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
794 "value": "0",
795 "class": "number_small",
796 "units": {
797 "px": "px",
798 "percent": "%",
799 "em": "em"
800 },
801 "unit_value": "px",
802 "wrapper_class": "col-4"
803 },
804 "margin_bottom": {
805 "type": "number",
806 "name": "margin_bottom",
807 "label": "Bottom",
808 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
809 "value": "0",
810 "class": "number_small",
811 "units": {
812 "px": "px",
813 "percent": "%",
814 "em": "em"
815 },
816 "unit_value": "px",
817 "wrapper_class": "col-4"
818 },
819 "margin_left": {
820 "type": "number",
821 "name": "margin_left",
822 "label": "Left",
823 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
824 "value": "0",
825 "class": "number_small",
826 "units": {
827 "px": "px",
828 "percent": "%",
829 "em": "em"
830 },
831 "unit_value": "px",
832 "wrapper_class": "col-4"
833 },
834 "margin_right": {
835 "type": "number",
836 "name": "margin_right",
837 "label": "Right",
838 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
839 "value": "0",
840 "class": "number_small",
841 "units": {
842 "px": "px",
843 "percent": "%",
844 "em": "em"
845 },
846 "unit_value": "px",
847 "wrapper_class": "col-4"
848 },
849 "background_label": {
850 "type": "label",
851 "name": "background_label",
852 "label": "Background"
853 },
854 "background_color": {
855 "type": "color",
856 "name": "background_color",
857 "nolabel": true,
858 "value": "rgba(255,255,255,0)",
859 "desc": ""
860 },
861 "background": {
862 "type": "image",
863 "name": "background",
864 "nolabel": true,
865 "value": "",
866 "class": "",
867 "desc": ""
868 }
869 }
870 }
871 }
872 },
873 "footer-a29820d6": {
874 "name": "Footer",
875 "type": "footer",
876 "groups": {
877 "col1": {
878 "name": "Footer",
879 "active": true,
880 "fields": {
881 "text": {
882 "type": "textarea",
883 "name": "text",
884 "label": "Text",
885 "value": "© Maintenance 2026",
886 "class": "full-width",
887 "desc": ""
888 },
889 "font_size": {
890 "type": "number",
891 "name": "font_size",
892 "label": "Font Size",
893 "value": "24",
894 "class": "number_small",
895 "units": {
896 "px": "px",
897 "pt": "pt",
898 "em": "em"
899 },
900 "unit_value": "px"
901 },
902 "color": {
903 "type": "color",
904 "name": "text_color",
905 "label": "Color",
906 "value": "rgba(255,255,255,1)",
907 "desc": ""
908 },
909 "font": {
910 "type": "font",
911 "name": "font",
912 "label": "Font",
913 "value": "Open Sans",
914 "class": "full-width",
915 "desc": ""
916 },
917 "line_height": {
918 "type": "number",
919 "name": "line_height",
920 "label": "Line Height",
921 "value": "1",
922 "units": {
923 "px": "px",
924 "percent": "%",
925 "em": "em"
926 },
927 "unit_value": "em",
928 "class": "number_small",
929 "desc": ""
930 }
931 }
932 },
933 "layout": {
934 "name": "Layout",
935 "fields": {
936 "padding_label": {
937 "type": "label",
938 "name": "padding_label",
939 "label": "Padding"
940 },
941 "padding_top": {
942 "type": "number",
943 "name": "padding_top",
944 "label": "Top",
945 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
946 "value": "10",
947 "class": "number_small",
948 "units": {
949 "px": "px",
950 "percent": "%",
951 "em": "em"
952 },
953 "unit_value": "px",
954 "wrapper_class": "col-4"
955 },
956 "padding_bottom": {
957 "type": "number",
958 "name": "padding_bottom",
959 "label": "Bottom",
960 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
961 "value": "10",
962 "class": "number_small",
963 "units": {
964 "px": "px",
965 "percent": "%",
966 "em": "em"
967 },
968 "unit_value": "px",
969 "wrapper_class": "col-4"
970 },
971 "padding_left": {
972 "type": "number",
973 "name": "padding_left",
974 "label": "Left",
975 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
976 "value": "0",
977 "class": "number_small",
978 "units": {
979 "px": "px",
980 "percent": "%",
981 "em": "em"
982 },
983 "unit_value": "px",
984 "wrapper_class": "col-4"
985 },
986 "padding_right": {
987 "type": "number",
988 "name": "padding_right",
989 "label": "Right",
990 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
991 "value": "0",
992 "class": "number_small",
993 "units": {
994 "px": "px",
995 "percent": "%",
996 "em": "em"
997 },
998 "unit_value": "px",
999 "wrapper_class": "col-4"
1000 },
1001 "margin_label": {
1002 "type": "label",
1003 "name": "margin_label",
1004 "label": "Margin"
1005 },
1006 "margin_top": {
1007 "type": "number",
1008 "name": "margin_top",
1009 "label": "Top",
1010 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
1011 "value": "0",
1012 "class": "number_small",
1013 "units": {
1014 "px": "px",
1015 "percent": "%",
1016 "em": "em"
1017 },
1018 "unit_value": "px",
1019 "wrapper_class": "col-4"
1020 },
1021 "margin_bottom": {
1022 "type": "number",
1023 "name": "margin_bottom",
1024 "label": "Bottom",
1025 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
1026 "value": "0",
1027 "class": "number_small",
1028 "units": {
1029 "px": "px",
1030 "percent": "%",
1031 "em": "em"
1032 },
1033 "unit_value": "px",
1034 "wrapper_class": "col-4"
1035 },
1036 "margin_left": {
1037 "type": "number",
1038 "name": "margin_left",
1039 "label": "Left",
1040 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
1041 "value": "0",
1042 "class": "number_small",
1043 "units": {
1044 "px": "px",
1045 "percent": "%",
1046 "em": "em"
1047 },
1048 "unit_value": "px",
1049 "wrapper_class": "col-4"
1050 },
1051 "margin_right": {
1052 "type": "number",
1053 "name": "margin_right",
1054 "label": "Right",
1055 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
1056 "value": "0",
1057 "class": "number_small",
1058 "units": {
1059 "px": "px",
1060 "percent": "%",
1061 "em": "em"
1062 },
1063 "unit_value": "px",
1064 "wrapper_class": "col-4"
1065 },
1066 "background_label": {
1067 "type": "label",
1068 "name": "background_label",
1069 "label": "Background"
1070 },
1071 "background_color": {
1072 "type": "color",
1073 "name": "background_color",
1074 "nolabel": true,
1075 "value": "rgba(255,255,255,0)",
1076 "desc": ""
1077 },
1078 "background": {
1079 "type": "image",
1080 "name": "background",
1081 "nolabel": true,
1082 "value": "",
1083 "class": "",
1084 "desc": ""
1085 }
1086 }
1087 }
1088 }
1089 }
1090 },
1091 "modules_order": {
1092 "header-dbd02cd1": "header-dbd02cd1",
1093 "content-471365b7": "content-471365b7",
1094 "content-9742e2f8": "content-9742e2f8",
1095 "footer-a29820d6": "footer-a29820d6"
1096 },
1097 "name": "Default",
1098 "theme_thumbnail": "",
1099 "theme_status": "",
1100 "body_font_size": "16",
1101 "body_font_color": "#FFFFFF",
1102 "body_font": "Open Sans",
1103 "body_link_color": "#0096FF",
1104 "body_link_hover_color": "#57BAFF",
1105 "background_type": "image",
1106 "background_video": "",
1107 "background_video_fallback": "",
1108 "background_video_filter": "",
1109 "background_size_opt": "cover",
1110 "background_position": "center center",
1111 "background_image_filter": "",
1112 "background_blur": 0,
1113 "background_image": "' . trailingslashit(MTNC_URL) . 'img/mt-sample-background.jpg",
1114 "preloader_background_image": "",
1115 "background_color": "rgba(0,0,0,1)",
1116 "login_background_color": "rgba(0,0,0,1)",
1117 "content_overlay": "",
1118 "content_width": 916,
1119 "content_overlay_color": "rgba(0,0,0,0.2)",
1120 "content_overlay_shadow_color": "rgba(0,0,0,0.2)",
1121 "content_position": "middle",
1122 "modules_spacing": 20,
1123 "custom_css": ".mtnc_module,\r\n.mtnc_module h2{\r\n\tfont-weight:300;\r\n}"
1124 }'
1125 )
1126 );
1127
1128 if (sizeof($options['options']) < sizeof($def_options)) {
1129 $options['options'] = array_merge($def_options, (array) $options['options']);
1130 $change = true;
1131 }
1132
1133 /* Detect upgrade from free */
1134 $mtnc_free_options = get_option('maintenance_options', false);
1135
1136
1137
1138 if ($mtnc_free_options !== false && array_key_exists('state', $mtnc_free_options) && !array_key_exists('upgraded', $options)) {
1139 if(!empty($mtnc_free_options['state']) && $mtnc_free_options['state'] == '1'){
1140 $options['options']['status'] = '1';
1141 } else {
1142 $options['options']['status'] = '0';
1143 }
1144
1145 $options['options']['theme_global'] = $default_theme_id;
1146 $options['options']['themes'] = [];
1147 $options['options']['themes'][$default_theme_id] = json_decode('{"modules":{"logo-ea1e7873":{"name":"Logo","type":"logo","groups":{"logo":{"name":"Logo","active":true,"fields":{"logo":{"type":"image","name":"logo","label":"Logo","value":"","class":"","desc":""},"title":{"type":"text","name":"title","label":"Logo Title","value":"","class":"full-width","desc":""},"width":{"type":"number","name":"width","label":"Width","value":"","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","desc":"Leave blank for auto"},"height":{"type":"number","name":"height","label":"Height","value":"","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","desc":"Leave blank for auto"}}},"layout":{"name":"Layout","fields":{"padding_label":{"type":"label","name":"padding_label","label":"Padding"},"padding_top":{"type":"number","name":"padding_top","label":"Top","image_label":"MTNCURL\/img\/icons\/padding_top.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_bottom":{"type":"number","name":"padding_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/padding_bottom.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_left":{"type":"number","name":"padding_left","label":"Left","image_label":"MTNCURL\/img\/icons\/padding_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_right":{"type":"number","name":"padding_right","label":"Right","image_label":"MTNCURL\/img\/icons\/padding_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_label":{"type":"label","name":"margin_label","label":"Margin"},"margin_top":{"type":"number","name":"margin_top","label":"Top","image_label":"MTNCURL\/img\/icons\/margin_top.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_bottom":{"type":"number","name":"margin_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/margin_bottom.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_left":{"type":"number","name":"margin_left","label":"Left","image_label":"MTNCURL\/img\/icons\/margin_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_right":{"type":"number","name":"margin_right","label":"Right","image_label":"MTNCURL\/img\/icons\/margin_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"background_label":{"type":"label","name":"background_label","label":"Background"},"background_color":{"type":"color","name":"background_color","nolabel":true,"value":"rgba(255,255,255,0)","desc":""},"background":{"type":"image","name":"background","nolabel":true,"value":"","class":"","desc":""}}}}},"content-a60d7054":{"name":"Content","type":"content","groups":{"col1":{"name":"Footer","active":true,"fields":{"text":{"type":"textarea","name":"text","label":"Text","value":"<span style=\"color: rgb(255, 255, 255); font-family: \"Open Sans\"; text-align: center; background-color: rgb(17, 17, 17);\">Site will be available soon. Thank you for your patience!<\/span>","class":"full-width","desc":""},"font_size":{"type":"number","name":"font_size","label":"Font Size","value":"14","class":"number_small","units":{"px":"px","pt":"pt","em":"em"},"unit_value":"px"},"color":{"type":"color","name":"text_color","label":"Color","value":"rgba(255,255,255,1)","desc":""},"font":{"type":"font","name":"font","label":"Font","value":"Arial","class":"full-width","desc":""},"line_height":{"type":"number","name":"line_height","label":"Line Height","value":"1","units":{"px":"px","percent":"%","em":"em"},"unit_value":"em","class":"number_small","desc":""}}},"layout":{"name":"Layout","fields":{"padding_label":{"type":"label","name":"padding_label","label":"Padding"},"padding_top":{"type":"number","name":"padding_top","label":"Top","image_label":"MTNCURL\/img\/icons\/padding_top.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_bottom":{"type":"number","name":"padding_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/padding_bottom.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_left":{"type":"number","name":"padding_left","label":"Left","image_label":"MTNCURL\/img\/icons\/padding_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_right":{"type":"number","name":"padding_right","label":"Right","image_label":"MTNCURL\/img\/icons\/padding_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_label":{"type":"label","name":"margin_label","label":"Margin"},"margin_top":{"type":"number","name":"margin_top","label":"Top","image_label":"MTNCURL\/img\/icons\/margin_top.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_bottom":{"type":"number","name":"margin_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/margin_bottom.png","value":"80","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_left":{"type":"number","name":"margin_left","label":"Left","image_label":"MTNCURL\/img\/icons\/margin_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_right":{"type":"number","name":"margin_right","label":"Right","image_label":"MTNCURL\/img\/icons\/margin_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"background_label":{"type":"label","name":"background_label","label":"Background"},"background_color":{"type":"color","name":"background_color","nolabel":true,"value":"rgba(255,255,255,0)","desc":""},"background":{"type":"image","name":"background","nolabel":true,"value":"","class":"","desc":""}}}}},"header-4b5742b4":{"name":"Header","type":"header","groups":{"header":{"name":"Header","active":true,"fields":{"text":{"type":"text","name":"text","label":"Text","value":"Maintenance mode is on","class":"full-width","desc":""},"text_align":{"type":"radio","name":"text_align","label":"Text Align","class":"","values":{"left":"Left","center":"Center","right":"Right"},"value":"center"},"font_size":{"type":"range","name":"font_size","label":"Font Size","value":"30","min":6,"max":120,"class":"","units":{"px":"px","pt":"pt","em":"em"},"unit_value":"px"},"color":{"type":"color","name":"text_color","label":"Color","value":"rgba(255,255,255,1)","desc":""},"font":{"type":"font","name":"font","label":"Font","value":"Arial","class":"full-width","desc":""},"line_height":{"type":"number","name":"line_height","label":"Line Height","value":"1","units":{"px":"px","percent":"%","em":"em"},"unit_value":"em","class":"number_small","desc":""}}},"layout":{"name":"Layout","fields":{"padding_label":{"type":"label","name":"padding_label","label":"Padding"},"padding_top":{"type":"number","name":"padding_top","label":"Top","image_label":"MTNCURL\/img\/icons\/padding_top.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_bottom":{"type":"number","name":"padding_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/padding_bottom.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_left":{"type":"number","name":"padding_left","label":"Left","image_label":"MTNCURL\/img\/icons\/padding_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_right":{"type":"number","name":"padding_right","label":"Right","image_label":"MTNCURL\/img\/icons\/padding_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_label":{"type":"label","name":"margin_label","label":"Margin"},"margin_top":{"type":"number","name":"margin_top","label":"Top","image_label":"MTNCURL\/img\/icons\/margin_top.png","value":"80","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_bottom":{"type":"number","name":"margin_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/margin_bottom.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_left":{"type":"number","name":"margin_left","label":"Left","image_label":"MTNCURL\/img\/icons\/margin_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_right":{"type":"number","name":"margin_right","label":"Right","image_label":"MTNCURL\/img\/icons\/margin_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"background_label":{"type":"label","name":"background_label","label":"Background"},"background_color":{"type":"color","name":"background_color","nolabel":true,"value":"rgba(255,255,255,0)","desc":""},"background":{"type":"image","name":"background","nolabel":true,"value":"","class":"","desc":""}}}}},"footer-b527dd0c":{"name":"Footer","type":"footer","groups":{"col1":{"name":"Footer","active":true,"fields":{"text":{"type":"textarea","name":"text","label":"Text","value":"<div style=\"text-align: center;\">\u00a9 Maintenance 2022<br><\/div>","class":"full-width","desc":""},"font_size":{"type":"number","name":"font_size","label":"Font Size","value":"14","class":"number_small","units":{"px":"px","pt":"pt","em":"em"},"unit_value":"px"},"color":{"type":"color","name":"text_color","label":"Color","value":"rgba(255,255,255,1)","desc":""},"font":{"type":"font","name":"font","label":"Font","value":"Arial","class":"full-width","desc":""},"line_height":{"type":"number","name":"line_height","label":"Line Height","value":"1","units":{"px":"px","percent":"%","em":"em"},"unit_value":"em","class":"number_small","desc":""}}},"layout":{"name":"Layout","fields":{"padding_label":{"type":"label","name":"padding_label","label":"Padding"},"padding_top":{"type":"number","name":"padding_top","label":"Top","image_label":"MTNCURL\/img\/icons\/padding_top.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_bottom":{"type":"number","name":"padding_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/padding_bottom.png","value":"10","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_left":{"type":"number","name":"padding_left","label":"Left","image_label":"MTNCURL\/img\/icons\/padding_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"padding_right":{"type":"number","name":"padding_right","label":"Right","image_label":"MTNCURL\/img\/icons\/padding_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_label":{"type":"label","name":"margin_label","label":"Margin"},"margin_top":{"type":"number","name":"margin_top","label":"Top","image_label":"MTNCURL\/img\/icons\/margin_top.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_bottom":{"type":"number","name":"margin_bottom","label":"Bottom","image_label":"MTNCURL\/img\/icons\/margin_bottom.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_left":{"type":"number","name":"margin_left","label":"Left","image_label":"MTNCURL\/img\/icons\/margin_left.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"margin_right":{"type":"number","name":"margin_right","label":"Right","image_label":"MTNCURL\/img\/icons\/margin_right.png","value":"0","class":"number_small","units":{"px":"px","percent":"%","em":"em"},"unit_value":"px","wrapper_class":"col-4"},"background_label":{"type":"label","name":"background_label","label":"Background"},"background_color":{"type":"color","name":"background_color","nolabel":true,"value":"rgba(255,255,255,0)","desc":""},"background":{"type":"image","name":"background","nolabel":true,"value":"","class":"","desc":""}}}}}},"modules_order":{"logo-ea1e7873":"logo-ea1e7873","header-4b5742b4":"header-4b5742b4","content-a60d7054":"content-a60d7054","footer-b527dd0c":"footer-b527dd0c"},"name":"My Theme","body_font_size":"16","body_font_color":"#FFFFFF","body_font":"Orbitron","body_link_color":"#0096FF","body_link_hover_color":"#57BAFF","background_type":"image","background_video":"","background_video_fallback":"","background_video_filter":"","background_size_opt":"cover","background_position":"center center","background_image_filter":"","background_image":"","background_color":"rgba(64,64,64,1)","content_overlay":"","content_width":600,"content_overlay_color":"rgba(0,0,0,0.2)","content_overlay_shadow_color":"rgba(0,0,0,0)","content_position":"middle","modules_spacing":10,"custom_css":"","theme_thumbnail":"","theme_status":"","background_blur":10,"preloader_background_image":""}');
1148
1149 $logo_src = wp_get_attachment_image_src($mtnc_free_options['logo'], 'full');
1150 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->logo->value = esc_url($logo_src[0]);
1151 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->width->value = $mtnc_free_options['logo_width'];
1152 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->height->value = $mtnc_free_options['logo_height'];
1153
1154 //SEO
1155 $options['options']['title'] = $mtnc_free_options['page_title'];
1156 $options['options']['description'] = $mtnc_free_options['description'];
1157
1158 //Access
1159 $options['options']['login_button'] = $mtnc_free_options['is_login'];
1160
1161 //Design
1162 $old_bg = wp_get_attachment_image_src($mtnc_free_options['body_bg'], 'full');
1163 $options['options']['themes'][$default_theme_id]->background_image = esc_url($old_bg[0]);
1164 $options['options']['themes'][$default_theme_id]->background_blur = $mtnc_free_options['blur_intensity'];
1165 $options['options']['themes'][$default_theme_id]->background_color = $mtnc_free_options['body_bg_color'];
1166 $options['options']['themes'][$default_theme_id]->login_background_color = $mtnc_free_options['controls_bg_color'];
1167
1168
1169 $options['options']['themes'][$default_theme_id]->body_font_color = $mtnc_free_options['font_color'];
1170 $options['options']['themes'][$default_theme_id]->body_font = $mtnc_free_options['body_font_family'];
1171 $options['options']['themes'][$default_theme_id]->background_color = $mtnc_free_options['body_bg_color'];
1172 $options['options']['themes'][$default_theme_id]->custom_css = 'body,h2{font-weight:300;}';
1173
1174 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->text->value = '<span style="text-align: center;">' . $mtnc_free_options['heading'] . '</span>';
1175 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->font_size->value = 45;
1176 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->font->value = $mtnc_free_options['body_font_family'];
1177 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->layout->fields->margin_top->value = 80;
1178
1179 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->text->value = '<span style="text-align: center;">' . $mtnc_free_options['description'] . '</span>';
1180 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->font_size->value = 16;
1181 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->font->value = $mtnc_free_options['body_font_family'];
1182 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->layout->fields->margin_bottom->value = 80;
1183
1184 $options['options']['themes'][$default_theme_id]->modules->{'footer-b527dd0c'}->groups->col1->fields->text->value = '<span style="text-align: center;">' . $mtnc_free_options['footer_text'] . '</span>';
1185 $options['options']['themes'][$default_theme_id]->modules->{'footer-b527dd0c'}->groups->col1->fields->font_size->value = 16;
1186 $options['options']['themes'][$default_theme_id]->modules->{'footer-b527dd0c'}->groups->col1->fields->font->value = $mtnc_free_options['body_font_family'];
1187
1188 $options['upgraded'] = time();
1189 $change = true;
1190 }
1191
1192 if ($change) {
1193 update_option('mtnc-options', $options, true);
1194 }
1195
1196 $this->options = $options;
1197 return $options;
1198 } // load_options
1199
1200 // change status via admin bar
1201 public function change_status()
1202 {
1203 check_admin_referer('mtnc_change_status');
1204
1205 if (empty($_GET['new_status'])) {
1206 wp_safe_redirect(admin_url());
1207 exit;
1208 }
1209
1210 $options = $this->get_options();
1211
1212 if ($_GET['new_status'] == 'enabled') {
1213 $options['status'] = '1';
1214 } else {
1215 $options['status'] = '0';
1216 }
1217
1218 $this->update_options('options', $options);
1219
1220 if (!empty($_GET['redirect'])) {
1221 wp_safe_redirect(wp_unslash($_GET['redirect']));
1222 } else {
1223 wp_safe_redirect(admin_url());
1224 }
1225
1226 exit;
1227 } // change_status
1228
1229 /**
1230 * Dismiss notice via AJAX call
1231 *
1232 * @return null
1233 */
1234 function ajax_dismiss_notice()
1235 {
1236 check_ajax_referer('maintenance_dismiss_notice');
1237
1238 if (!current_user_can('manage_options')) {
1239 wp_send_json_error('You are not allowed to run this action.');
1240 }
1241
1242 $notice_name = trim(sanitize_text_field(wp_unslash($_GET['notice_name'] ?? '')));
1243 if (!$this->dismiss_notice($notice_name)) {
1244 wp_send_json_error('Notice is already dismissed.');
1245 } else {
1246 wp_send_json_success();
1247 }
1248 } // ajax_dismiss_notice
1249
1250
1251 /**
1252 * Dismiss notice by adding it to dismissed_notices options array
1253 *
1254 * @param string $notice_name Notice to dismiss.
1255 *
1256 * @return bool
1257 */
1258 function dismiss_notice($notice_name)
1259 {
1260 if ($this->get_dismissed_notices($notice_name)) {
1261 return false;
1262 } else {
1263 $notices = $this->get_dismissed_notices();
1264 $notices[$notice_name] = true;
1265
1266 $this->update_options('dismissed_notices', $notices);
1267 return true;
1268 }
1269 } // dismiss_notice
1270
1271
1272 /**
1273 * Get all dismissed notices, or check for one specific notice
1274 *
1275 * @param string $notice_name Optional. Check if specified notice is dismissed.
1276 *
1277 * @return bool|array
1278 */
1279 function get_dismissed_notices($notice_name = '')
1280 {
1281 $notices = $this->options['dismissed_notices'];
1282
1283 if (empty($notice_name)) {
1284 return $notices;
1285 } else {
1286 if (empty($notices[$notice_name])) {
1287 return false;
1288 } else {
1289 return true;
1290 }
1291 }
1292 } // get_dismissed_notices
1293
1294
1295 /**
1296 * Retrieve available modules
1297 *
1298 * @return array
1299 */
1300 public function get_modules()
1301 {
1302 $modules = array();
1303 $modules['logo'] = array('name' => 'Logo', 'pro' => false);
1304 $modules['header'] = array('name' => 'Header', 'pro' => false);
1305 $modules['footer'] = array('name' => 'Footer', 'pro' => false);
1306 $modules['content'] = array('name' => 'Content', 'pro' => false);
1307 $modules['content2col'] = array('name' => 'Content 2 Column', 'pro' => true);
1308 $modules['content3col'] = array('name' => 'Content 3 Column', 'pro' => true);
1309 $modules['form'] = array('name' => 'Form', 'pro' => true);
1310 $modules['video'] = array('name' => 'Video', 'pro' => true);
1311 $modules['countdown'] = array('name' => 'Countdown', 'pro' => true);
1312 $modules['progressbar'] = array('name' => 'Progress Bar', 'pro' => true);
1313 $modules['social'] = array('name' => 'Social Icons', 'pro' => true);
1314 $modules['map'] = array('name' => 'Map', 'pro' => true);
1315 $modules['html'] = array('name' => 'Custom HTML', 'pro' => true);
1316 $modules['divider'] = array('name' => 'Divider', 'pro' => true);
1317
1318 $modules = apply_filters('mtnc_modules_list', $modules);
1319
1320 return $modules;
1321 }
1322
1323 /**
1324 * Get meta part of plugin options
1325 *
1326 * @return array
1327 */
1328 public function get_meta()
1329 {
1330 return $this->options['meta'];
1331 } // get_meta
1332
1333 public function get_fonts()
1334 {
1335 $fonts = array('Arial', 'Helvetica', 'Georgia', 'Times New Roman', 'Tahoma', 'Verdana', 'Geneva', 'ABeeZee', 'Abel', 'Abhaya Libre', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Adamina', 'Advent Pro', 'Aguafina Script', 'Akronim', 'Aladin', 'Aldrich', 'Alef', 'Alegreya', 'Alegreya SC', 'Alegreya Sans', 'Alegreya Sans SC', 'Alex Brush', 'Alfa Slab One', 'Alice', 'Alike', 'Alike Angular', 'Allan', 'Allerta', 'Allerta Stencil', 'Allura', 'Almendra', 'Almendra Display', 'Almendra SC', 'Amarante', 'Amaranth', 'Amatic SC', 'Amethysta', 'Amiko', 'Amiri', 'Amita', 'Anaheim', 'Andada', 'Andika', 'Angkor', 'Annie Use Your Telescope', 'Anonymous Pro', 'Antic', 'Antic Didone', 'Antic Slab', 'Anton', 'Arapey', 'Arbutus', 'Arbutus Slab', 'Architects Daughter', 'Archivo', 'Archivo Black', 'Archivo Narrow', 'Aref Ruqaa', 'Arima Madurai', 'Arimo', 'Arizonia', 'Armata', 'Arsenal', 'Artifika', 'Arvo', 'Arya', 'Asap', 'Asap Condensed', 'Asar', 'Asset', 'Assistant', 'Astloch', 'Asul', 'Athiti', 'Atma', 'Atomic Age', 'Aubrey', 'Audiowide', 'Autour One', 'Average', 'Average Sans', 'Averia Gruesa Libre', 'Averia Libre', 'Averia Sans Libre', 'Averia Serif Libre', 'Bad Script', 'Bahiana', 'Baloo', 'Baloo Bhai', 'Baloo Bhaijaan', 'Baloo Bhaina', 'Baloo Chettan', 'Baloo Da', 'Baloo Paaji', 'Baloo Tamma', 'Baloo Tammudu', 'Baloo Thambi', 'Balthazar', 'Bangers', 'Barlow', 'Barlow Condensed', 'Barlow Semi Condensed', 'Barrio', 'Basic', 'Battambang', 'Baumans', 'Bayon', 'Belgrano', 'Bellefair', 'Belleza', 'BenchNine', 'Bentham', 'Berkshire Swash', 'Bevan', 'Bigelow Rules', 'Bigshot One', 'Bilbo', 'Bilbo Swash Caps', 'BioRhyme', 'BioRhyme Expanded', 'Biryani', 'Bitter', 'Black Ops One', 'Bokor', 'Bonbon', 'Boogaloo', 'Bowlby One', 'Bowlby One SC', 'Brawler', 'Bree Serif', 'Bubblegum Sans', 'Bubbler One', 'Buda', 'Buenard', 'Bungee', 'Bungee Hairline', 'Bungee Inline', 'Bungee Outline', 'Bungee Shade', 'Butcherman', 'Butterfly Kids', 'Cabin', 'Cabin Condensed', 'Cabin Sketch', 'Caesar Dressing', 'Cagliostro', 'Cairo', 'Calligraffitti', 'Cambay', 'Cambo', 'Candal', 'Cantarell', 'Cantata One', 'Cantora One', 'Capriola', 'Cardo', 'Carme', 'Carrois Gothic', 'Carrois Gothic SC', 'Carter One', 'Catamaran', 'Caudex', 'Caveat', 'Caveat Brush', 'Cedarville Cursive', 'Ceviche One', 'Changa', 'Changa One', 'Chango', 'Chathura', 'Chau Philomene One', 'Chela One', 'Chelsea Market', 'Chenla', 'Cherry Cream Soda', 'Cherry Swash', 'Chewy', 'Chicle', 'Chivo', 'Chonburi', 'Cinzel', 'Cinzel Decorative', 'Clicker Script', 'Coda', 'Coda Caption', 'Codystar', 'Coiny', 'Combo', 'Comfortaa', 'Maintenance', 'Concert One', 'Condiment', 'Content', 'Contrail One', 'Convergence', 'Cookie', 'Copse', 'Corben', 'Cormorant', 'Cormorant Garamond', 'Cormorant Infant', 'Cormorant SC', 'Cormorant Unicase', 'Cormorant Upright', 'Courgette', 'Cousine', 'Coustard', 'Covered By Your Grace', 'Crafty Girls', 'Creepster', 'Crete Round', 'Crimson Text', 'Croissant One', 'Crushed', 'Cuprum', 'Cutive', 'Cutive Mono', 'Damion', 'Dancing Script', 'Dangrek', 'David Libre', 'Dawning of a New Day', 'Days One', 'Dekko', 'Delius', 'Delius Swash Caps', 'Delius Unicase', 'Della Respira', 'Denk One', 'Devonshire', 'Dhurjati', 'Didact Gothic', 'Diplomata', 'Diplomata SC', 'Domine', 'Donegal One', 'Doppio One', 'Dorsa', 'Dosis', 'Dr Sugiyama', 'Duru Sans', 'Dynalight', 'EB Garamond', 'Eagle Lake', 'Eater', 'Economica', 'Eczar', 'El Messiri', 'Electrolize', 'Elsie', 'Elsie Swash Caps', 'Emblema One', 'Emilys Candy', 'Encode Sans', 'Encode Sans Condensed', 'Encode Sans Expanded', 'Encode Sans Semi Condensed', 'Encode Sans Semi Expanded', 'Engagement', 'Englebert', 'Enriqueta', 'Erica One', 'Esteban', 'Euphoria Script', 'Ewert', 'Exo', 'Exo 2', 'Expletus Sans', 'Fanwood Text', 'Farsan', 'Fascinate', 'Fascinate Inline', 'Faster One', 'Fasthand', 'Fauna One', 'Faustina', 'Federant', 'Federo', 'Felipa', 'Fenix', 'Finger Paint', 'Fira Mono', 'Fira Sans', 'Fira Sans Condensed', 'Fira Sans Extra Condensed', 'Fjalla One', 'Fjord One', 'Flamenco', 'Flavors', 'Fondamento', 'Fontdiner Swanky', 'Forum', 'Francois One', 'Frank Ruhl Libre', 'Freckle Face', 'Fredericka the Great', 'Fredoka One', 'Freehand', 'Fresca', 'Frijole', 'Fruktur', 'Fugaz One', 'GFS Didot', 'GFS Neohellenic', 'Gabriela', 'Gafata', 'Galada', 'Galdeano', 'Galindo', 'Gentium Basic', 'Gentium Book Basic', 'Geo', 'Geostar', 'Geostar Fill', 'Germania One', 'Gidugu', 'Gilda Display', 'Give You Glory', 'Glass Antiqua', 'Glegoo', 'Gloria Hallelujah', 'Goblin One', 'Gochi Hand', 'Gorditas', 'Goudy Bookletter 1911', 'Graduate', 'Grand Hotel', 'Gravitas One', 'Great Vibes', 'Griffy', 'Gruppo', 'Gudea', 'Gurajada', 'Habibi', 'Halant', 'Hammersmith One', 'Hanalei', 'Hanalei Fill', 'Handlee', 'Hanuman', 'Happy Monkey', 'Harmattan', 'Headland One', 'Heebo', 'Henny Penny', 'Herr Von Muellerhoff', 'Hind', 'Hind Guntur', 'Hind Madurai', 'Hind Siliguri', 'Hind Vadodara', 'Holtwood One SC', 'Homemade Apple', 'Homenaje', 'IBM Plex Mono', 'IBM Plex Sans', 'IBM Plex Sans Condensed', 'IBM Plex Serif', 'IM Fell DW Pica', 'IM Fell DW Pica SC', 'IM Fell Double Pica', 'IM Fell Double Pica SC', 'IM Fell English', 'IM Fell English SC', 'IM Fell French Canon', 'IM Fell French Canon SC', 'IM Fell Great Primer', 'IM Fell Great Primer SC', 'Iceberg', 'Iceland', 'Imprima', 'Inconsolata', 'Inder', 'Indie Flower', 'Inika', 'Inknut Antiqua', 'Irish Grover', 'Istok Web', 'Italiana', 'Italianno', 'Itim', 'Jacques Francois', 'Jacques Francois Shadow', 'Jaldi', 'Jim Nightshade', 'Jockey One', 'Jolly Lodger', 'Jomhuria', 'Josefin Sans', 'Josefin Slab', 'Joti One', 'Judson', 'Julee', 'Julius Sans One', 'Junge', 'Jura', 'Just Another Hand', 'Just Me Again Down Here', 'Kadwa', 'Kalam', 'Kameron', 'Kanit', 'Kantumruy', 'Karla', 'Karma', 'Katibeh', 'Kaushan Script', 'Kavivanar', 'Kavoon', 'Kdam Thmor', 'Keania One', 'Kelly Slab', 'Kenia', 'Khand', 'Khmer', 'Khula', 'Kite One', 'Knewave', 'Kotta One', 'Koulen', 'Kranky', 'Kreon', 'Kristi', 'Krona One', 'Kumar One', 'Kumar One Outline', 'Kurale', 'La Belle Aurore', 'Laila', 'Lakki Reddy', 'Lalezar', 'Lancelot', 'Lateef', 'Lato', 'League Script', 'Leckerli One', 'Ledger', 'Lekton', 'Lemon', 'Lemonada', 'Libre Barcode 128', 'Libre Barcode 128 Text', 'Libre Barcode 39', 'Libre Barcode 39 Extended', 'Libre Barcode 39 Extended Text', 'Libre Barcode 39 Text', 'Libre Baskerville', 'Libre Franklin', 'Life Savers', 'Lilita One', 'Lily Script One', 'Limelight', 'Linden Hill', 'Lobster', 'Lobster Two', 'Londrina Outline', 'Londrina Shadow', 'Londrina Sketch', 'Londrina Solid', 'Lora', 'Love Ya Like A Sister', 'Loved by the King', 'Lovers Quarrel', 'Luckiest Guy', 'Lusitana', 'Lustria', 'Macondo', 'Macondo Swash Caps', 'Mada', 'Magra', 'Maiden Orange', 'Maitree', 'Mako', 'Mallanna', 'Mandali', 'Manuale', 'Marcellus', 'Marcellus SC', 'Marck Script', 'Margarine', 'Marko One', 'Marmelad', 'Martel', 'Martel Sans', 'Marvel', 'Mate', 'Mate SC', 'Maven Pro', 'McLaren', 'Meddon', 'MedievalSharp', 'Medula One', 'Meera Inimai', 'Megrim', 'Meie Script', 'Merienda', 'Merienda One', 'Merriweather', 'Merriweather Sans', 'Metal', 'Metal Mania', 'Metamorphous', 'Metrophobic', 'Michroma', 'Milonga', 'Miltonian', 'Miltonian Tattoo', 'Mina', 'Miniver', 'Miriam Libre', 'Mirza', 'Miss Fajardose', 'Mitr', 'Modak', 'Modern Antiqua', 'Mogra', 'Molengo', 'Molle', 'Monda', 'Monofett', 'Monoton', 'Monsieur La Doulaise', 'Montaga', 'Montez', 'Montserrat', 'Montserrat Alternates', 'Montserrat Subrayada', 'Moul', 'Moulpali', 'Mountains of Christmas', 'Mouse Memoirs', 'Mr Bedfort', 'Mr Dafoe', 'Mr De Haviland', 'Mrs Saint Delafield', 'Mrs Sheppards', 'Mukta', 'Mukta Mahee', 'Mukta Malar', 'Mukta Vaani', 'Muli', 'Mystery Quest', 'NTR', 'Nanum Brush Script', 'Nanum Gothic', 'Nanum Gothic Coding', 'Nanum Myeongjo', 'Nanum Pen Script', 'Neucha', 'Neuton', 'New Rocker', 'News Cycle', 'Niconne', 'Nixie One', 'Nobile', 'Nokora', 'Norican', 'Nosifer', 'Nothing You Could Do', 'Noticia Text', 'Noto Sans', 'Noto Serif', 'Nova Cut', 'Nova Flat', 'Nova Mono', 'Nova Oval', 'Nova Round', 'Nova Script', 'Nova Slim', 'Nova Square', 'Numans', 'Nunito', 'Nunito Sans', 'Odor Mean Chey', 'Offside', 'Old Standard TT', 'Oldenburg', 'Oleo Script', 'Oleo Script Swash Caps', 'Open Sans', 'Open Sans Condensed', 'Oranienbaum', 'Orbitron', 'Oregano', 'Orienta', 'Original Surfer', 'Oswald', 'Over the Rainbow', 'Overlock', 'Overlock SC', 'Overpass', 'Overpass Mono', 'Ovo', 'Oxygen', 'Oxygen Mono', 'PT Mono', 'PT Sans', 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Pacifico', 'Padauk', 'Palanquin', 'Palanquin Dark', 'Pangolin', 'Paprika', 'Parisienne', 'Passero One', 'Passion One', 'Pathway Gothic One', 'Patrick Hand', 'Patrick Hand SC', 'Pattaya', 'Patua One', 'Pavanam', 'Paytone One', 'Peddana', 'Peralta', 'Permanent Marker', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Piedra', 'Pinyon Script', 'Pirata One', 'Plaster', 'Play', 'Playball', 'Playfair Display', 'Playfair Display SC', 'Podkova', 'Poiret One', 'Poller One', 'Poly', 'Pompiere', 'Pontano Sans', 'Poppins', 'Port Lligat Sans', 'Port Lligat Slab', 'Pragati Narrow', 'Prata', 'Preahvihear', 'Press Start 2P', 'Pridi', 'Princess Sofia', 'Prociono', 'Prompt', 'Prosto One', 'Proza Libre', 'Puritan', 'Purple Purse', 'Quando', 'Quantico', 'Quattrocento', 'Quattrocento Sans', 'Questrial', 'Quicksand', 'Quintessential', 'Qwigley', 'Racing Sans One', 'Radley', 'Rajdhani', 'Rakkas', 'Raleway', 'Raleway Dots', 'Ramabhadra', 'Ramaraja', 'Rambla', 'Rammetto One', 'Ranchers', 'Rancho', 'Ranga', 'Rasa', 'Rationale', 'Ravi Prakash', 'Redressed', 'Reem Kufi', 'Reenie Beanie', 'Revalia', 'Rhodium Libre', 'Ribeye', 'Ribeye Marrow', 'Righteous', 'Risque', 'Roboto', 'Roboto Condensed', 'Roboto Mono', 'Roboto Slab', 'Rochester', 'Rock Salt', 'Rokkitt', 'Romanesco', 'Ropa Sans', 'Rosario', 'Rosarivo', 'Rouge Script', 'Rozha One', 'Rubik', 'Rubik Mono One', 'Ruda', 'Rufina', 'Ruge Boogie', 'Ruluko', 'Rum Raisin', 'Ruslan Display', 'Russo One', 'Ruthie', 'Rye', 'Sacramento', 'Sahitya', 'Sail', 'Saira', 'Saira Condensed', 'Saira Extra Condensed', 'Saira Semi Condensed', 'Salsa', 'Sanchez', 'Sancreek', 'Sansita', 'Sarala', 'Sarina', 'Sarpanch', 'Satisfy', 'Scada', 'Scheherazade', 'Schoolbell', 'Scope One', 'Seaweed Script', 'Secular One', 'Sedgwick Ave', 'Sedgwick Ave Display', 'Sevillana', 'Seymour One', 'Shadows Into Light', 'Shadows Into Light Two', 'Shanti', 'Share', 'Share Tech', 'Share Tech Mono', 'Shojumaru', 'Short Stack', 'Shrikhand', 'Siemreap', 'Sigmar One', 'Signika', 'Signika Negative', 'Simonetta', 'Sintony', 'Sirin Stencil', 'Six Caps', 'Skranji', 'Slabo 13px', 'Slabo 27px', 'Slackey', 'Smokum', 'Smythe', 'Sniglet', 'Snippet', 'Snowburst One', 'Sofadi One', 'Sofia', 'Sonsie One', 'Sorts Mill Goudy', 'Source Code Pro', 'Source Sans Pro', 'Source Serif Pro', 'Space Mono', 'Special Elite', 'Spectral', 'Spectral SC', 'Spicy Rice', 'Spinnaker', 'Spirax', 'Squada One', 'Sree Krushnadevaraya', 'Sriracha', 'Stalemate', 'Stalinist One', 'Stardos Stencil', 'Stint Ultra Condensed', 'Stint Ultra Expanded', 'Stoke', 'Strait', 'Sue Ellen Francisco', 'Suez One', 'Sumana', 'Sunshiney', 'Supermercado One', 'Sura', 'Suranna', 'Suravaram', 'Suwannaphum', 'Swanky and Moo Moo', 'Syncopate', 'Tangerine', 'Taprom', 'Tauri', 'Taviraj', 'Teko', 'Telex', 'Tenali Ramakrishna', 'Tenor Sans', 'Text Me One', 'The Girl Next Door', 'Tienne', 'Tillana', 'Timmana', 'Tinos', 'Titan One', 'Titillium Web', 'Trade Winds', 'Trirong', 'Trocchi', 'Trochut', 'Trykker', 'Tulpen One', 'Ubuntu', 'Ubuntu Condensed', 'Ubuntu Mono', 'Ultra', 'Uncial Antiqua', 'Underdog', 'Unica One', 'UnifrakturCook', 'UnifrakturMaguntia', 'Unkempt', 'Unlock', 'Unna', 'VT323', 'Vampiro One', 'Varela', 'Varela Round', 'Vast Shadow', 'Vesper Libre', 'Vibur', 'Vidaloka', 'Viga', 'Voces', 'Volkhov', 'Vollkorn', 'Vollkorn SC', 'Voltaire', 'Waiting for the Sunrise', 'Wallpoet', 'Walter Turncoat', 'Warnes', 'Wellfleet', 'Wendy One', 'Wire One', 'Work Sans', 'Yanone Kaffeesatz', 'Yantramanav', 'Yatra One', 'Yellowtail', 'Yeseva One', 'Yesteryear', 'Yrsa', 'Zeyada', 'Zilla Slab', 'Zilla Slab Highlight');
1336 return $fonts;
1337 }
1338
1339 /**
1340 * Get options part of plugin options
1341 *
1342 * @return array
1343 */
1344 public function get_options()
1345 {
1346 return $this->options['options'];
1347 } // get_options
1348
1349 /**
1350 * Get all plugin options
1351 *
1352 * @return array
1353 */
1354 public function get_all_options()
1355 {
1356 return $this->options;
1357 } // get_all_options
1358
1359 /**
1360 * Update specified plugin options key
1361 *
1362 * @param string $key Data to save.
1363 * @param string $data Option key.
1364 *
1365 * @return bool
1366 */
1367 public function update_options($key, $data)
1368 {
1369 if (false === in_array($key, array('meta', 'dismissed_notices', 'options'))) {
1370 user_error('Unknown options key.', E_USER_ERROR);
1371 return false;
1372 }
1373
1374 $this->options[$key] = $data;
1375 $tmp = update_option('mtnc-options', $this->options);
1376
1377 return $tmp;
1378 } // set_options
1379
1380 /**
1381 * Add plugin menu entry under Tools menu
1382 *
1383 * @return null
1384 */
1385 public function admin_menu()
1386 {
1387 add_menu_page('Maintenance', 'Maintenance', 'manage_options', 'maintenance', array($this, 'plugin_page'), $this->plugin_url . 'img/icon-small.png');
1388 } // admin_menu
1389
1390
1391 /**
1392 * Returns all WP pointers
1393 *
1394 * @return array
1395 */
1396 function get_pointers()
1397 {
1398 $pointers = array();
1399
1400 $pointers['welcome'] = array('target' => '#toplevel_page_maintenance', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the <b style="font-weight: 800;">Maintenance</b> plugin!<br>Open <a href="' . admin_url('admin.php?page=maintenance') . '">Maintenance</a> to access Maintenance settings.');
1401
1402 return $pointers;
1403 } // get_pointers
1404
1405
1406 /**
1407 * Enqueue CSS and JS files
1408 *
1409 * @return null
1410 */
1411 public function admin_enqueue_scripts($hook)
1412 {
1413 $options = $this->get_options();
1414 $pointers = $this->get_pointers();
1415
1416 $dismissed_notices = $this->get_dismissed_notices();
1417
1418 foreach ($dismissed_notices as $notice_name => $tmp) {
1419 if ($tmp) {
1420 unset($pointers[$notice_name]);
1421 }
1422 }
1423
1424 if (!empty($pointers) && !$this->is_plugin_page() && current_user_can('manage_options')) {
1425 $pointers['_nonce_dismiss_pointer'] = wp_create_nonce('maintenance_dismiss_notice');
1426
1427 wp_enqueue_style('wp-pointer');
1428
1429 wp_enqueue_script('maintenance-pointers', $this->plugin_url . 'js/pointers.js', array('jquery'), $this->version, true);
1430 wp_enqueue_script('wp-pointer');
1431 wp_localize_script('wp-pointer', 'mtnc_pointers', $pointers);
1432 }
1433
1434 if (!$this->is_plugin_page()) {
1435 return;
1436 }
1437
1438 $this->dismiss_notice('welcome');
1439
1440 $js_localize = array(
1441 'undocumented_error' => esc_html__('An undocumented error has occurred. Please refresh the page and try again.', 'maintenance'),
1442 'documented_error' => esc_html__('An error has occurred.', 'maintenance'),
1443 'plugin_name' => 'Maintenance',
1444 'url' => MTNC_URL,
1445 'icon_url' => $this->plugin_url . 'img/loader-icon.png',
1446 'nonce_action' => wp_create_nonce('mtnc_action'),
1447 'theme_global' => $options['theme_global'],
1448 'theme' => $this->theme,
1449 'theme_id' => $this->theme_id,
1450 'fonts' => $this->get_fonts(),
1451 'max_upload_size' => wp_max_upload_size(),
1452 'settings_url' => admin_url('admin.php?page=maintenance'),
1453 'is_plugin_page' => $this->is_plugin_page(),
1454 'wpfssl_install_url' => add_query_arg(
1455 array(
1456 'action' => 'mtnc_install_wpfssl',
1457 '_wpnonce' => wp_create_nonce('install_wpfssl'),
1458 'rnd' => wp_rand()
1459 ),
1460 admin_url('admin.php')
1461 ),
1462 'wpcaptcha_install_url' => add_query_arg(
1463 array(
1464 'action' => 'mtnc_install_wpcaptcha',
1465 '_wpnonce' => wp_create_nonce('install_wpcaptcha'),
1466 'rnd' => wp_rand()
1467 ),
1468 admin_url('admin.php')
1469 ),
1470 'weglot_install_url' => add_query_arg(
1471 array(
1472 'action' => 'mtnc_install_weglot',
1473 '_wpnonce' => wp_create_nonce('install_weglot'),
1474 'rnd' => wp_rand()
1475 ),
1476 admin_url('admin.php')
1477 ),
1478 'weglot_dialog_upsell_title' => '<img alt="' . esc_attr__('Weglot', 'maintenance') . '" title="' . esc_attr__('Weglot', 'maintenance') . '" src="' . MTNC_URI . 'img/weglot-logo-white.png' . '">',
1479 );
1480
1481 if ($this->is_plugin_page()) {
1482 wp_enqueue_style('maintenance-admin', $this->plugin_url . 'css/maintenance-admin.css', array(), $this->version);
1483 wp_enqueue_script('jquery-ui-tabs');
1484 wp_enqueue_script('jquery-ui-core');
1485 wp_enqueue_script('jquery-ui-position');
1486 wp_enqueue_script('jquery-ui-sortable');
1487 wp_enqueue_script('jquery-ui-datepicker');
1488 wp_enqueue_style('wp-jquery-ui-dialog');
1489 wp_enqueue_script('jquery-ui-dialog');
1490
1491 wp_enqueue_style('maintenance-summernote', $this->plugin_url . 'css/summernote-lite.min.css', array(), $this->version);
1492 wp_enqueue_script('maintenance-summernote', $this->plugin_url . 'js/summernote-lite.min.js', array('jquery'), $this->version, true); //WYSIWYG Module Editor
1493 wp_enqueue_style('maintenance-fonticonpicker', $this->plugin_url . 'css/jquery.fonticonpicker.min.css', array(), $this->version);
1494
1495 wp_enqueue_style('maintenance-font-roboto', 'https://fonts.bunny.net/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap', array(), $this->version);
1496 wp_enqueue_style('maintenance-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version);
1497
1498 wp_enqueue_style('maintenance-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
1499 wp_enqueue_style('maintenance-select2', $this->plugin_url . 'css/select2.css', array(), $this->version);
1500
1501 wp_enqueue_script('maintenance-sweetalert2', $this->plugin_url . 'js/maintenance-sweetalert2.min.js', array('jquery'), $this->version, true);
1502 wp_enqueue_script('maintenance-select2', $this->plugin_url . 'js/select2.min.js', array('jquery'), $this->version, true);
1503 wp_enqueue_script('maintenance-colorpicker', $this->plugin_url . 'js/colorpicker/jscolor.js', false, $this->version, true);
1504 wp_enqueue_script('maintenance', $this->plugin_url . 'js/maintenance-admin.js', array('jquery'), $this->version, true);
1505 wp_enqueue_script('maintenance-fonticonpicker', $this->plugin_url . 'js/jquery.fonticonpicker.min.js', array('jquery'), $this->version, true);
1506 wp_enqueue_script('maintenance-ace-editor', $this->plugin_url . 'js/editor/ace.js', false, $this->version, true); // Custom CSS Editor
1507 wp_enqueue_script('maintenance-webfonts', $this->plugin_url . 'js/webfont.js', false, $this->version, true); //Visual font picker preview
1508
1509 wp_localize_script('maintenance', 'mtnc', $js_localize);
1510 wp_enqueue_media();
1511
1512 wp_dequeue_style('uiStyleSheet');
1513 wp_dequeue_style('wpcufpnAdmin');
1514 wp_dequeue_style('unifStyleSheet');
1515 wp_dequeue_style('wpcufpn_codemirror');
1516 wp_dequeue_style('wpcufpn_codemirrorTheme');
1517 wp_dequeue_style('collapse-admin-css');
1518 wp_dequeue_style('jquery-ui-css');
1519 wp_dequeue_style('tribe-common-admin');
1520 wp_dequeue_style('file-manager__jquery-ui-css');
1521 wp_dequeue_style('file-manager__jquery-ui-css-theme');
1522 wp_dequeue_style('wpmegmaps-jqueryui');
1523 wp_dequeue_style('wp-botwatch-css');
1524 }
1525 } // admin_enqueue_scripts
1526
1527 function frontend_login()
1528 {
1529 global $wp_query, $error;
1530 $mt_options = $this->get_options();
1531 $user_connect = false;
1532 if (!is_array($wp_query->query_vars)) {
1533 $wp_query->query_vars = array();
1534 }
1535 $error_message = $user_login = $user_pass = $error = '';
1536 $class_login = 'user-icon';
1537 $class_password = 'pass-icon';
1538
1539 if (isset($_POST['is_custom_login'])) {
1540 $user_login = '';
1541 if (isset($_POST['log']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
1542 $user_login = sanitize_user(wp_unslash($_POST['log']));
1543 }
1544 $user_login = sanitize_user($user_login);
1545 $user_pass = '';
1546 if (isset($_POST['pwd']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
1547 $user_pass = trim(sanitize_text_field(wp_unslash($_POST['pwd'])));
1548 }
1549 $access = array();
1550 $access['user_login'] = esc_attr($user_login);
1551 $access['user_password'] = $user_pass;
1552 $access['remember'] = true;
1553
1554 $user = null;
1555 $user = new WP_User(0, $user_login);
1556
1557 if (is_ssl()) {
1558 $ssl = true;
1559 } else {
1560 $ssl = false;
1561 }
1562
1563 $user_connect = wp_signon($access, $ssl);
1564 if (is_wp_error($user_connect)) {
1565 if ($user_connect->get_error_code() === 'invalid_username') {
1566 $error_message = esc_html__('Login is incorrect!', 'maintenance');
1567
1568 $class_login = 'error';
1569 $class_password = 'error';
1570 } elseif ($user_connect->get_error_code() === 'incorrect_password') {
1571 $error_message = esc_html__('Password is incorrect!', 'maintenance');
1572 $class_password = 'error';
1573 } else {
1574 $error_message = esc_html__('Login and password are incorrect!', 'maintenance');
1575 $class_login = 'error';
1576 $class_password = 'error';
1577 }
1578 } else {
1579 wp_safe_redirect(home_url('/'));
1580 exit;
1581 }
1582 }
1583
1584 return array($error_message, $class_login, $class_password, $user_login);
1585 } // frontend_login
1586
1587
1588 public function admin_bar_style()
1589 {
1590 $options = $this->get_options();
1591
1592 // admin bar has to be anabled, user an admin and custom filter true
1593 if ($options['disable_toolbar_menu'] || false === is_admin_bar_showing() || false === current_user_can('manage_options')) {
1594 return;
1595 }
1596
1597 // no sense in loading a new CSS file for 2 lines of CSS
1598 $custom_css = '<style type="text/css">#wpadminbar i.mtnc-status-dot { font-size: 17px; margin-top: -7px; color: #02ca02; height: 17px; display: inline-block; } #wpadminbar i.mtnc-status-dot-enabled { color: #64bd63; } #wpadminbar i.mtnc-status-dot-disabled { color: #FE2D2D; } #wpadminbar #mtnc-status-wrapper { display: inline; border: 1px solid rgba(240,245,250,0.7); padding: 0; margin: 0 0 0 5px; background: rgb(35, 40, 45); } #wpadminbar .mtnc-status-btn { padding: 0 7px; color: #fff; } #wpadminbar #mtnc-status-wrapper.off #mtnc-status-off { background: #FE2D2D;} #wpadminbar #mtnc-status-wrapper.on #mtnc-status-on { background: #64bd63; }#wp-admin-bar-mtnc img.logo { height: 17px; margin-bottom: 4px; padding-right: 3px; } #wp-admin-bar-mtnc a img { height: 17px; margin-bottom: -2px; padding-right: 3px; display:inline-block; } #wpadminbar #wp-admin-bar-mtnc-status .ab-empty-item { margin-bottom: 2px; }</style>';
1599
1600 self::wp_kses_wf($custom_css);
1601 } // admin_bar_style
1602
1603
1604 // add admin bar menu and status
1605 public function admin_bar()
1606 {
1607 global $wp_admin_bar;
1608 $options = $this->get_options();
1609
1610 // only show to admins
1611 if ($options['disable_toolbar_menu'] || false === current_user_can('manage_options')) {
1612 return;
1613 }
1614
1615 $plugin_name = 'Maintenance';
1616 $plugin_logo = MTNC_URL . '/img/icon-transparent.png';
1617 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
1618 if ($options['status'] == '1') {
1619 $main_label = '<img src="' . $plugin_logo . '" alt="Maintenance mode is enabled" title="Maintenance mode is enabled"><span class="ab-label">' . $plugin_name . ' <i class="mtnc-status-dot mtnc-status-dot-enabled">&#9679;</i></span>';
1620 $class = 'mtnc-enabled';
1621 $action_url = add_query_arg(array('action' => 'mtnc_change_status', 'new_status' => 'disabled', 'redirect' => urlencode($request_uri)), admin_url('admin.php'));
1622 $action_url = wp_nonce_url($action_url, 'mtnc_change_status');
1623 $action = 'Maintenance mode';
1624 $action .= '<a href="' . $action_url . '" id="mtnc-status-wrapper" class="on"><span id="mtnc-status-off" class="mtnc-status-btn">OFF</span><span id="mtnc-status-on" class="mtnc-status-btn">ON</span></a>';
1625 } else {
1626 $main_label = '<img src="' . $plugin_logo . '" alt="Maintenance mode is enabled" title="Maintenance mode is enabled"><span class="ab-label">' . $plugin_name . ' <i class="mtnc-status-dot mtnc-status-dot-disabled">&#9679;</i></span>';
1627 $class = 'mtnc-disabled';
1628 $action_url = add_query_arg(array('action' => 'mtnc_change_status', 'new_status' => 'enabled', 'redirect' => urlencode($request_uri)), admin_url('admin.php'));
1629 $action_url = wp_nonce_url($action_url, 'mtnc_change_status');
1630 $action = 'Maintenance mode';
1631 $action .= '<a href="' . $action_url . '" id="mtnc-status-wrapper" class="off"><span id="mtnc-status-off" class="mtnc-status-btn">OFF</span><span id="mtnc-status-on" class="mtnc-status-btn">ON</span></a>';
1632 }
1633
1634 $wp_admin_bar->add_menu(array(
1635 'parent' => '',
1636 'id' => 'mtnc',
1637 'title' => $main_label,
1638 'href' => admin_url('admin.php?page=maintenance'),
1639 'meta' => array('class' => $class),
1640 ));
1641 $wp_admin_bar->add_node(array(
1642 'id' => 'mtnc-status',
1643 'title' => $action,
1644 'href' => false,
1645 'parent' => 'mtnc',
1646 ));
1647 $wp_admin_bar->add_node(array(
1648 'id' => 'mtnc-preview',
1649 'title' => 'Preview',
1650 'href' => home_url('/') . '?maintenance-preview',
1651 'parent' => 'mtnc',
1652 'meta' => array('target' => '_blank'),
1653 ));
1654 $wp_admin_bar->add_node(array(
1655 'id' => 'mtnc-settings',
1656 'title' => 'Settings',
1657 'href' => admin_url('admin.php?page=maintenance'),
1658 'parent' => 'mtnc',
1659 ));
1660 } // admin_bar
1661
1662 /**
1663 * Perform an action via AJAX
1664 *
1665 * @return bool
1666 */
1667 public function ajax_action()
1668 {
1669 check_ajax_referer('mtnc_action');
1670 if (!current_user_can('manage_options')) {
1671 wp_send_json_error(__('You are not allowed to run this action.', 'maintenance'));
1672 }
1673
1674 $options = $this->get_options();
1675
1676 $action = trim(wp_unslash($_REQUEST['mtnc_action'] ?? '')); //phpcs:ignore
1677 $extra_data = wp_unslash($_REQUEST['extra_data'] ?? ''); //phpcs:ignore
1678 if (is_string($extra_data)) {
1679 parse_str($extra_data, $extra_data);
1680 } elseif (is_array($extra_data)) {
1681 $extra_data = array_slice($extra_data, 0, 20);
1682 } else {
1683 $extra_data = false;
1684 }
1685
1686 switch ($action) {
1687 case 'save':
1688 $new_options = array(
1689 'theme_global' => $options['theme_global'],
1690 'themes' => $options['themes'],
1691 'status' => @absint($extra_data['mtnc_status']),
1692 'mode' => 'layout',
1693 'mtnc_page' => 0,
1694 //SEO
1695 'title' => strip_tags($extra_data['title']),
1696 'analytics' => strip_tags($this->convert_ga($extra_data['analytics'])),
1697 //Access
1698 'per_url_settings' => wp_strip_all_tags($extra_data['per_url_settings']),
1699 'per_url_enable_disable' => wp_strip_all_tags($extra_data['per_url_enable_disable']),
1700 'login_button' => @absint($extra_data['login_button']),
1701 'wplogin_button_tooltip' => wp_strip_all_tags($extra_data['wplogin_button_tooltip']),
1702 );
1703
1704 $new_options['theme_global'] = sanitize_text_field(wp_unslash($_REQUEST['theme_global'] ?? ''));
1705
1706 //theme JSON will get broken by sanitization through wp_kses_post or normal functions, fields will be escaped when rendering on front-end
1707 $theme = $_REQUEST['theme']; //phpcs:ignore
1708 $theme_id = sanitize_text_field(wp_unslash($_REQUEST['theme_id'] ?? ''));
1709 $theme_new = sanitize_text_field(wp_unslash($_REQUEST['theme_new'] ?? ''));
1710 $theme_name = sanitize_text_field(wp_unslash($_REQUEST['theme_name'] ?? ''));
1711
1712 if (isset($_REQUEST['theme_new']) && $theme_new == true) {
1713 $theme_id = md5(time() . $theme_name);
1714 }
1715
1716 $new_options['themes'][$theme_id] = json_decode(stripslashes($theme));
1717 $new_options['themes'][$theme_id]->name = $theme_name;
1718
1719 //Design General
1720 if (isset($extra_data['theme_thumbnail'])) {
1721 $new_options['themes'][$theme_id]->theme_thumbnail = wp_strip_all_tags($extra_data['theme_thumbnail']);
1722 }
1723 if (isset($extra_data['theme_status'])) {
1724 $new_options['themes'][$theme_id]->theme_status = wp_strip_all_tags($extra_data['theme_status']);
1725 }
1726
1727 $new_options['themes'][$theme_id]->body_font_size = wp_strip_all_tags($extra_data['body_font_size']);
1728 $new_options['themes'][$theme_id]->body_font_color = wp_strip_all_tags($extra_data['body_font_color']);
1729 $new_options['themes'][$theme_id]->body_font = wp_strip_all_tags($extra_data['body_font']);
1730 $new_options['themes'][$theme_id]->body_link_color = wp_strip_all_tags($extra_data['body_link_color']);
1731 $new_options['themes'][$theme_id]->body_link_hover_color = wp_strip_all_tags($extra_data['body_link_hover_color']);
1732
1733 //Design General
1734 $new_options['themes'][$theme_id]->background_type = wp_strip_all_tags($extra_data['background_type']);
1735 $new_options['themes'][$theme_id]->background_video = wp_strip_all_tags($extra_data['background_video']);
1736 $new_options['themes'][$theme_id]->background_video_fallback = isset($extra_data['background_video_fallback']) ? wp_strip_all_tags($extra_data['background_video_fallback']) : '';
1737 $new_options['themes'][$theme_id]->background_video_filter = wp_strip_all_tags($extra_data['background_video_filter']);
1738 $new_options['themes'][$theme_id]->background_size_opt = wp_strip_all_tags($extra_data['background_size_opt']);
1739 $new_options['themes'][$theme_id]->background_position = wp_strip_all_tags($extra_data['background_position']);
1740 $new_options['themes'][$theme_id]->background_image_filter = wp_strip_all_tags($extra_data['background_image_filter']);
1741 $new_options['themes'][$theme_id]->background_image = wp_strip_all_tags($extra_data['background_image']);
1742 $new_options['themes'][$theme_id]->background_blur = (int)$extra_data['background_blur'];
1743 $new_options['themes'][$theme_id]->login_background_color = wp_strip_all_tags($extra_data['login_background_color']);
1744
1745
1746 $new_options['themes'][$theme_id]->preloader_background_image = wp_strip_all_tags($extra_data['preloader_background_image']);
1747
1748 $new_options['themes'][$theme_id]->background_color = wp_strip_all_tags($extra_data['background_color']);
1749 $new_options['themes'][$theme_id]->content_overlay = isset($extra_data['content_overlay']) ? wp_strip_all_tags($extra_data['content_overlay']) : '';
1750 $new_options['themes'][$theme_id]->content_width = (int) $extra_data['content_width'];
1751 $new_options['themes'][$theme_id]->content_overlay_color = wp_strip_all_tags($extra_data['content_overlay_color']);
1752 $new_options['themes'][$theme_id]->content_overlay_shadow_color = wp_strip_all_tags($extra_data['content_overlay_shadow_color']);
1753 $new_options['themes'][$theme_id]->content_position = wp_strip_all_tags($extra_data['content_position']);
1754 $new_options['themes'][$theme_id]->modules_spacing = (int) $extra_data['modules_spacing'];
1755 $new_options['themes'][$theme_id]->custom_css = wp_strip_all_tags($extra_data['custom_css']);
1756
1757
1758 $this->update_options('options', $new_options);
1759 wp_send_json_success(array('theme_id' => $theme_id, 'theme' => $new_options['themes'][$theme_id]));
1760 break;
1761 }
1762 }
1763
1764
1765 /**
1766 * Test if we're on Maintenance's admin page
1767 *
1768 * @return bool
1769 */
1770 public function is_plugin_page()
1771 {
1772 if (!function_exists('get_current_screen')) {
1773 return false;
1774 }
1775
1776 $current_screen = get_current_screen();
1777
1778 if (!empty($current_screen) && $current_screen->id == 'toplevel_page_maintenance') {
1779 return true;
1780 } else {
1781 return false;
1782 }
1783 } // is_plugin_page
1784
1785 /**
1786 * Main/starter function for displaying plugin's admin page
1787 *
1788 * @return null
1789 */
1790 public function plugin_page()
1791 {
1792 $options = $this->get_options();
1793 // double check for admin privileges
1794 if (!current_user_can('manage_options')) {
1795 wp_die(esc_html__('Sorry, you are not allowed to access this page.', 'maintenance'));
1796 }
1797
1798 echo '<div class="wrap">
1799 <form class="mtnc-body mtnc-clearfix">
1800 <header>
1801 <div class="mtnc-header mtnc-clearfix">
1802 <img src="' . esc_html(MTNC_URL . '/img/logo.png') . '" id="logo-icon" class="mtnc-logo" title="Maintenance" alt="Maintenance">';
1803
1804 echo '<div id="header-right">
1805 <div id="header-status" title="Click to change Maintenance status">
1806 <label for="mtnc_status">Maintenance</label>
1807
1808 <div class="onoffswitch">
1809 <input type="checkbox" id="mtnc_status" name="mtnc_status" class="onoffswitch-checkbox" ' . checked($options['status'], 1, false) . ' value="1">
1810 <label class="onoffswitch-label" for="mtnc_status"></label>
1811 </div>
1812 </div>
1813 </div>';
1814
1815 echo '</div>
1816 </header>';
1817
1818 $mtnc_notice = get_transient('mtnc_notice_' . get_current_user_id());
1819 delete_transient('mtnc_notice_' . get_current_user_id());
1820 if ($mtnc_notice !== false) {
1821 self::wp_kses_wf($mtnc_notice);
1822 }
1823
1824 echo '<div id="loading-tabs"><img class="mtnc_rotating" src="' . esc_url($this->plugin_url . 'img/loader-icon.png') . '" alt="Loading. Please wait." title="Loading. Please wait."></div>';
1825
1826 echo '<div id="mtnc-tabs-wrapper">';
1827 // Tab ID should be level1 or level1-level2 separated by dash, for example "welcome" or "design-background"
1828 echo '<div class="mtnc-form-body">
1829 <nav>
1830 <div class="mtnc-float-left">
1831 <div class="mtnc-mobile-menu"></div>
1832 <ul class="mtnc-main-menu">';
1833
1834 echo '<li><a href="#themes-premade"><span class="material-icons">format_paint</span>' . esc_html__('Themes', 'maintenance') . '</a>
1835 </li>
1836 <li><a href="#design"><span class="material-icons">brush</span>' . esc_html__('Design', 'maintenance') . '</a>
1837 <div class="mtnc-submenu">
1838 <a title="Page Settings" href="#design">General</a>
1839 <a title="Layout" href="#design-layout">Layout</a>
1840 <a title="Background" href="#design-background">Background</a>
1841 <a title="Custom CSS" href="#design-css">Custom CSS</a>
1842 </div>
1843 </li>
1844 <li><a href="#seo"><span class="material-icons">insights</span>' . esc_html__('SEO', 'maintenance') . '</a></li>
1845 <li><a href="#access"><span class="material-icons">lock</span>' . esc_html__('Access', 'maintenance') . '</a>
1846 <div class="mtnc-submenu">
1847 <a title="Access Settings" href="#access">Settings</a>
1848 <a title="Layout" href="#access-password">Password</a>
1849 </div>
1850 </li>
1851 <li><a href="#advanced"><span class="material-icons">settings</span>' . esc_html__('Advanced', 'maintenance') . '</a></li>
1852 <li class="pro-menu"><a href="#" data-pro-feature="main-menu" class="open-pro-dialog"><span class="material-icons">star</span>PRO</a></li>';
1853 echo '</ul>
1854 </div>
1855 </nav>';
1856
1857 echo '<div class="mtnc-float-right">';
1858
1859
1860 echo '<div style="display: none;" class="mtnc-tab" id="themes-premade">';
1861 $this->tab_themes_premade();
1862 echo '</div>';
1863
1864 echo '<div style="display: none;" class="mtnc-tab" id="access">';
1865 $this->tab_access();
1866 echo '</div>';
1867
1868 echo '<div style="display: none;" class="mtnc-tab" id="access-password">';
1869 $this->tab_access_password();
1870 echo '</div>';
1871
1872 echo '<div style="display: none;" class="mtnc-tab" id="design">';
1873 $this->tab_design_general();
1874 echo '</div>';
1875
1876 echo '<div style="display: none;" class="mtnc-tab" id="design-layout">';
1877 $this->tab_design_layout();
1878 echo '</div>';
1879
1880 echo '<div style="display: none;" class="mtnc-tab" id="design-background">';
1881 $this->tab_design_background();
1882 echo '</div>';
1883
1884 echo '<div style="display: none;" class="mtnc-tab" id="design-css">';
1885 $this->tab_design_css();
1886 echo '</div>';
1887
1888 echo '<div style="display: none;" class="mtnc-tab" id="seo">';
1889 $this->tab_seo();
1890 echo '</div>';
1891
1892 echo '<div style="display: none;" class="mtnc-tab" id="advanced">';
1893 $this->tab_advanced();
1894 echo '</div>';
1895
1896
1897 echo '</div>'; // tabs
1898
1899 echo '</div>'; // mtnc-form-body
1900
1901
1902 echo '</div>'; // mtnc-tabs-wrapper
1903
1904 echo '<div id="mtnc-sidebar-wrapper">';
1905
1906 echo '<div class="sidebar-box pro-ad-box">
1907 <p class="textcenter"><a href="https://wpmaintenancemode.com/?ref=eps-free-sidebar-box" target="_blank"><img src="' . esc_url(MTNC_URI . 'img/logo.png') . '" alt="WP Maintenance PRO" title="WP Maintenance PRO"></a><br><b>PRO version</b> is here! Grab the discount - <b>all prices are LIFETIME!</b></p>
1908
1909 <ul class="plain-list">
1910 <li>Use 200+ Awesome Themes</li>
1911 <li>Unlock all Page Builder Elements</li>
1912 <li>8.5+ million Premium Images</li>
1913 <li>Easy Access for Clients through Access links</li>
1914 <li>Licenses &amp; Sites Manager (remote SaaS dashboard)</li>
1915 <li>White-label Mode + Complete Plugin Rebranding</li>
1916 <li>Email support from plugin developers</li>
1917 </ul>
1918
1919 <p class="textcenter"><a href="#" class="open-pro-dialog button button-buy" data-pro-feature="sidebar-box">Get PRO Now</a></p>
1920 </div>';
1921
1922 if (!defined('WPCAPTCHA_PLUGIN_FILE')) {
1923 echo '<div class="sidebar-box pro-ad-box" id="promo-wpcaptcha">';
1924 echo '<p class="textcenter"><a href="#" class="textcenter install-wpcaptcha"><img style="max-width: 90%;" src="' . esc_url(MTNC_URI . 'img/wp-captcha-logo.png') . '" alt="Advanced Google reCAPTCHA" title="Advanced Google reCAPTCHA"></a></p>';
1925 echo '<p class="textcenter"><br><a href="#" class="install-wpcaptcha button button-primary">Install &amp; activate the free Advanced Google reCAPTCHA</a></p>';
1926 echo '<p><a href="https://wordpress.org/plugins/advanced-google-recaptcha/" target="_blank">Advanced Google reCAPTCHA</a> is a free WP plugin that protects your site from various bad actors. It\'s maintained by the same team as this Maintenance plugin. It has <b>+200,000 users, 5-star rating</b>, and is hosted on the official WP repository.</p>';
1927 echo '</div>';
1928 }
1929
1930 if (!$this->is_weglot_active()) {
1931 echo '<div class="sidebar-box pro-ad-box" id="promo-weglot">';
1932 echo '<h3>50% of your customers don\'t speak english</h3>';
1933 echo '<p>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 maintenance page.</p>';
1934 echo '<p class="textcenter"><br><a href="#" class="button button-primary open-weglot-upsell">Install the Weglot Translate freemium plugin</a></p>';
1935 echo '</div>';
1936 }
1937
1938 if (0 && !defined('WPFSSL_OPTIONS_KEY')) {
1939 echo '<div class="sidebar-box pro-ad-box" id="promo-wpfssl">';
1940 echo '<h3>Solve all SSL problems with the free WP Force SSL plugin</h3>';
1941 echo '<p class="textcenter"><a href="#" class="textcenter install-wpfssl"><img style="max-width: 90%;" src="' . esc_url(MTNC_URI . 'img/wp-force-ssl-logo.png') . '" alt="WP Force SSL" title="WP Force SSL"></a></p>';
1942 echo '<p class="textcenter"><br><a href="#" class="install-wpfssl button button-primary">Install &amp; activate the free WP Force SSL plugin</a></p>';
1943 echo '<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>+180,000 users, 5-star rating</b>, and is hosted on the official WP repository.</p>';
1944 echo '</div>';
1945 }
1946
1947 echo '<div class="sidebar-box pro-ad-box" id="promo-review2">';
1948 echo '<h3>Help us keep the plugin free &amp; maintained</h3>';
1949 echo '<p><b>Your review means a lot!</b> Please help us spread the word so that others know this plugin is free and well maintained! Thank you very much for <a href="https://wordpress.org/support/plugin/maintenance/reviews/#new-post" target="_blank">reviewing the Maintanance plugin with �
1950 �
1951 �
1952 �
1953 �
1954 stars</a>!</p>';
1955 echo '<p><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-box2">I already left a review ;)</a></p>';
1956 echo '</div>';
1957
1958 echo '</div>'; // mtnc-sidebar-wrapper
1959
1960
1961 echo '</form>'; // mtnc-body
1962
1963 echo '</div>'; // wrap
1964
1965 self::wp_kses_wf($this->pro_dialog());
1966 } // plugin_page
1967
1968 function is_weglot_active()
1969 {
1970 if (!function_exists('is_plugin_active') || !function_exists('get_plugin_data')) {
1971 require_once ABSPATH . 'wp-admin/includes/plugin.php';
1972 }
1973
1974 if (is_plugin_active('weglot/weglot.php')) {
1975 $weglot_info = get_plugin_data(ABSPATH . 'wp-content/plugins/weglot/weglot.php');
1976 if (version_compare($weglot_info['Version'], '2.5', '<')) {
1977 return false;
1978 } else {
1979 return true;
1980 }
1981 } else {
1982 return false;
1983 }
1984 } // mtcn_is_weglot_active
1985
1986 // check if Weglot is completely set up
1987 function is_weglot_setup()
1988 {
1989 if (!$this->is_weglot_active()) {
1990 return false;
1991 }
1992
1993 $active_languages = weglot_get_destination_languages();
1994 if (!empty($active_languages)) {
1995 return true;
1996 } else {
1997 return false;
1998 }
1999 } // is_weglot_setup
2000
2001 function pro_dialog()
2002 {
2003 $out = '';
2004
2005 $out .= '<div id="mtnc-pro-dialog" style="display: none;" title="WP Maintenance PRO is here!"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
2006
2007 $out .= '<div class="center logo"><a href="https://wpmaintenancemode.com/?ref=mtnc-free-pricing-table" target="_blank"><img src="' . MTNC_URI . 'img/logo.png' . '" alt="WP Maintenance PRO" title="WP Maintenance PRO"></a><br>';
2008
2009 $out .= '<span>Limited PRO Discount - <b>all prices are LIFETIME</b>! Pay once &amp; use forever!</span>';
2010 $out .= '</div>';
2011
2012 $out .= '<table id="mtnc-pro-table">';
2013 $out .= '<tr>';
2014 $out .= '<td class="center">Lifetime Personal License</td>';
2015 $out .= '<td class="center">Lifetime Team License</td>';
2016 $out .= '<td class="center">Lifetime Agency License</td>';
2017 $out .= '</tr>';
2018
2019 $out .= '<tr class="prices">';
2020 $out .= '<td class="center"><del>$49 /year</del><br><span>$69</span> <b>/lifetime</b></td>';
2021 $out .= '<td class="center"><del>$89 /year</del><br><span>$79</span> <b>/lifetime</b></td>';
2022 $out .= '<td class="center"><del>$199 /year</del><br><span>$119</span> <b>/lifetime</b></td>';
2023 $out .= '</tr>';
2024
2025 $out .= '<tr>';
2026 $out .= '<td><span class="dashicons dashicons-yes"></span><b>1 Site License</b></td>';
2027 $out .= '<td><span class="dashicons dashicons-yes"></span><b>5 Sites License</b></td>';
2028 $out .= '<td><span class="dashicons dashicons-yes"></span><b>100 Sites License</b></td>';
2029 $out .= '</tr>';
2030
2031 $out .= '<tr>';
2032 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
2033 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
2034 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
2035 $out .= '</tr>';
2036
2037 $out .= '<tr>';
2038 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
2039 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
2040 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
2041 $out .= '</tr>';
2042
2043 $out .= '<tr>';
2044 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
2045 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
2046 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
2047 $out .= '</tr>';
2048
2049 $out .= '<tr>';
2050 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
2051 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
2052 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
2053 $out .= '</tr>';
2054
2055 $out .= '<tr>';
2056 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
2057 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
2058 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
2059 $out .= '</tr>';
2060
2061 $out .= '<tr>';
2062 $out .= '<td><span class="dashicons dashicons-no"></span>Licenses &amp; Sites Manager</td>';
2063 $out .= '<td><span class="dashicons dashicons-yes"></span>Licenses &amp; Sites Manager</td>';
2064 $out .= '<td><span class="dashicons dashicons-yes"></span>Licenses &amp; Sites Manager</td>';
2065 $out .= '</tr>';
2066
2067 $out .= '<tr>';
2068 $out .= '<td><span class="dashicons dashicons-no"></span>White-label Mode</td>';
2069 $out .= '<td><span class="dashicons dashicons-yes"></span>White-label Mode</td>';
2070 $out .= '<td><span class="dashicons dashicons-yes"></span>White-label Mode</td>';
2071 $out .= '</tr>';
2072
2073 $out .= '<tr>';
2074 $out .= '<td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>';
2075 $out .= '<td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>';
2076 $out .= '<td><span class="dashicons dashicons-yes"></span>Full Plugin Rebranding</td>';
2077 $out .= '</tr>';
2078
2079 $out .= '<tr>';
2080 $out .= '<td><a class="button button-buy" data-href-org="https://wpmaintenancemode.com/buy/?product=personal-free&ref=pricing-table" href="https://wpmaintenancemode.com/buy/?product=personal-free&ref=pricing-table" target="_blank">Lifetime License<br>$69 -&gt; BUY NOW</a></td>';
2081 $out .= '<td><a class="button button-buy" data-href-org="https://wpmaintenancemode.com/buy/?product=team-free&ref=pricing-table" href="https://wpmaintenancemode.com/buy/?product=team-free&ref=pricing-table" target="_blank">Lifetime License<br>$79 -&gt; BUY NOW</a></td>';
2082 $out .= '<td><a class="button button-buy" data-href-org="https://wpmaintenancemode.com/buy/?product=agency-free&ref=pricing-table" href="https://wpmaintenancemode.com/buy/?product=agency-free&ref=pricing-table" target="_blank">Lifetime License<br>$119 -&gt; BUY NOW</a></td>';
2083 $out .= '</tr>';
2084
2085 $out .= '</table>';
2086
2087 $out .= '<div class="upsell-footer">Need the plugin only for a <b>short period of time</b>? <a class="link-buy" target="_blank" data-href-org="https://wpmaintenancemode.com/buy/?product=personal-monthly&ref=pricing-table" href="https://wpmaintenancemode.com/buy/?product=personal-monthly&ref=pricing-table"><b>Get it for only $9.99</b><small> /month</small></a> &amp; cancel any time!</div>';
2088
2089 $out .= '<div class="center footer"><b>100% No-Risk Money Back Guarantee!</b> If you don\'t like the plugin over the next 7 days, we will happily refund 100% of your money. No questions asked! Payments are processed by our merchant of records - <a href="https://paddle.com/" target="_blank">Paddle</a>.</div></div>';
2090
2091
2092 // weglot install dialog
2093 $out .= '<div id="weglot-upsell-dialog" style="display: none;" title="Weglot"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
2094 $out .= '<div style="padding: 20px; font-size: 15px;">';
2095 $out .= '<ul class="mtnc-list">';
2096 $out .= '<li>Best-rated WordPress multilingual plugin</li>';
2097 $out .= '<li>Simple 5-minute set-up. No coding required</li>';
2098 $out .= '<li>Accelerated translation management: AI powered & human translations with access to professional translators</li>';
2099 $out .= '<li>Compatible with any WordPress theme or plugin</li>';
2100 $out .= '<li>Optimized for multilingual SEO</li>';
2101 $out .= '<li>14-day Free trial and free plan available</li>';
2102 $out .= '</ul>';
2103 $out .= '<p class="upsell-footer"><a class="button button-primary" id="install-weglot">Install &amp; activate Weglot to make your website multilingual</a></p>';
2104 $out .= '</div>';
2105 $out .= '</div>';
2106 // weglot install dialog
2107
2108 return $out;
2109 } // pro_dialog
2110
2111 public function tab_footer($tab = false)
2112 {
2113 echo '<div class="mtnc-tab-footer">';
2114
2115
2116 echo '<a class="mtnc-btn mtnc-btn-secondary mtnc-preview" style="margin: 0 15px 0 0;" href="' . esc_url(home_url('?maintenance-preview=' . $this->theme_id)) . '" target="_blank">Preview Maintenance Page</a>';
2117 echo '<div data-caption="Save Changes" name="mtnc_submit" class="mtnc-btn mtnc-btn-save mtnc_submit">Save Changes</div>';
2118
2119 echo '</div>';
2120 }
2121
2122
2123 /**
2124 * Echoes content for themes tab
2125 *
2126 * @return null
2127 */
2128 private function tab_themes_premade()
2129 {
2130 echo '<div class="mtnc-tile-title">Themes</div>';
2131 echo '<p>Are you in a hurry? Looking for something that looks great for your site? Pick one of <b>+200 premium pre-built themes</b> and be done in 5 minutes! Our PRO plugin comes with built-in SEO analyzer, a collection of over <b>7 million images</b> and it can connect to any mailing system like Mailchimp so you can start collecting emails from day one! Did we mention you can <b>rebrand the plugin</b> and control all client sites from the plugin\'s centralized Dashboard?</p>';
2132
2133 $options = $this->get_options();
2134 echo '<div id="mtnc-themes-wrapper">';
2135
2136 $themes = [
2137 '5f2f8c65307b6f3097f2ca4d25d5cb26' => 'Adventure Blog',
2138 '883f61d5131f6c7b558ccde9c5d1f411' => 'Analytics',
2139 '00cf8a2ca9efec1e8aea483568e2a8d8' => 'Baby Store',
2140 'ccdbb99fd1dfecd36e13d5a4cff45d21' => 'Burger Palace',
2141 '0a0c5efe1e95f91a42bc9e6e6ca884dd' => 'Business',
2142 '781cb3af776a041533735bdfc59e811a' => 'Car Repair',
2143 'e8e6f070f05eae0367699e6dc7963439' => 'Design Agency',
2144 '06142f926b2da71d8dddfba3254a78cb' => 'Digital Marketing Agency',
2145 'd41b1b0a6d4cb304e886121b3118cfa0' => 'Fashion',
2146 '7f96d3918bd5840258a6dce654f4b0dc' => 'Flower Shop',
2147 'b6e3012a316272608e1bbfac4d6b5a78' => 'Food Recommendation',
2148 '310e65d9600903508451d5670ab0c33f' => 'Freelance',
2149 '1c498ed60de01a93c2a4cac0ab50ddc2' => 'Gaming',
2150 'da24f016888540131b49800c7b8cb07e' => 'Health Service',
2151 '4dc670fa8069dd1293b85cf6235ceb25' => 'Hiking',
2152 'bb9f78a54648fe776fe7cdce018d4649' => 'Interior Design',
2153 '0888b7c6cfdfde868ad842b76f47dbdc' => 'Jewelry Shop',
2154 '9dd2a18f38bcfdcb6fce7b037c22e1ec' => 'Marketing',
2155 'bce5308440264fa4a8ce9cf1b38f3242' => 'Mobile App',
2156 'b20f2da4e5cd0753638723ff12383378' => 'Non-Profit Organization',
2157 '2c6c47a437172cf970e9027ab7c4f680' => 'Photography',
2158 'ea2584e286d8e0304994f4d9d9e4d335' => 'Podcast',
2159 'f7432f296c75f398c018ebbd0118cf1f' => 'Product Marketing',
2160 '274bd92fd91aadc05fe0637f614633d8' => 'Restaurant',
2161 '1ff8ca16c5010eec8797eb5416373c6d' => 'Skincare',
2162 'eb668b7221bb4ed50c8edc8aebb68ba4' => 'Sport',
2163 'a61a5890d7db6cef943729dc082f24e0' => 'Tech Conference',
2164 '1e26f176878e01991d42463cce0d3182' => 'Training',
2165 '906d50132e2caf64ad57d9c76b07f78c' => 'Travel Vlog',
2166 'd1dd1f82d0d557460f22ac7058c291e0' => 'Wedding',
2167 '35b404155b3be97d198dadf05ddfc960' => 'Wellness',
2168 '293e20f552ddd1e851351a93408be322' => 'Winery',
2169 ];
2170
2171 echo '<div class="theme-card">';
2172 echo '<div class="theme-card-background" style="background-image:url(\'' . esc_url(MTNC_URL) . 'img/themes/default.jpg' . '\')"></div>';
2173 echo '<div class="theme-card-title" title="Default">';
2174 echo 'Default Theme';
2175 echo '</div>';
2176 echo '<div class="theme-card-buttons">';
2177 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
2178 echo '<a data-confirm-title="Are you sure you want to reset to the default theme? Other settings will not be affected." data-confirm-button="Reset theme" data-confirm-text="All theme settings are reset to default values. <strong>There is NO undo!</strong>" href="' . esc_url(add_query_arg(array('_wpnonce' => wp_create_nonce('mtnc_admin_action'), 'action' => 'mtnc_reset_settings', 'reset' => 'theme', 'redirect' => urlencode($request_uri)), admin_url('admin.php'))) . '" class="mtnc-btn mtnc-btn-small mtnc-confirm">Reset theme</a>';
2179 echo '</div>';
2180 echo '</div>';
2181
2182 foreach ($themes as $theme_id => $theme_name) {
2183 echo '<div class="theme-card">';
2184 echo '<div class="theme-card-background" style="background-image:url(\'' . esc_url(MTNC_URL . 'img/themes/' . $theme_id . '.jpg') . '\')"></div>';
2185 echo '<div class="theme-card-title" title="' . esc_html($theme_name) . '">';
2186 echo esc_html(substr($theme_name, 0, 30));
2187 echo '</div>';
2188 echo '<div class="theme-card-buttons">';
2189 echo '<a href="" class="open-pro-dialog mtnc-btn mtnc-btn-small" data-pro-feature="theme-business">Install</a>';
2190 echo '<a href="' . esc_url('https://themes.wpmaintenancemode.com?maintenance-preview=' . $theme_id) . '" class="mtnc-btn mtnc-btn-small mtnc-btn-secondary" target="_blank">Preview</a>';
2191 echo '</div>';
2192 echo '<div class="ribbon" title="PRO theme. Click \'Get this theme\' for more info."><i><span class="dashicons dashicons-star-filled"></span></i></div>';
2193 echo '</div>';
2194 }
2195
2196 echo '</div>';
2197
2198 $this->tab_footer();
2199 } // tab_themes
2200
2201 /**
2202 * Echoes content for access tab
2203 *
2204 * @return null
2205 */
2206 private function tab_access()
2207 {
2208 $options = $this->get_options();
2209
2210 echo '<div class="mtnc-tile-title">Access</div>';
2211 echo '<p>By default, if Maintenance mode is enabled, all site visitors except the logged in ones (regardless of their user role) will see the Maintenance page instead of the "normal" site.<br>The easiest way to show the site to clients or friends is to share the Secret Access Link, or whitelist their IP address if it doesn\'t change too often.</p>';
2212
2213 echo '<div class="mtnc-double-group clearfix">';
2214 echo '<div class="mtnc-form-group">';
2215 echo '<label for="show_logged_in" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="show_logged_in">Show Normal Site to Logged in Users <sup>PRO</sup></label>';
2216 echo '<div class="toggle-wrapper">';
2217 echo '<input id="show_logged_in" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="show_logged_in" value="1">';
2218 echo '<label for="show_logged_in" class="toggle"><span class="toggle_handler"></span></label>';
2219 echo '</div>';
2220
2221 echo '<p class="mtnc-form-help-block">Logged in users (regardless of their user role) will not be affected by the maintenance mode and will see the "normal" site.</p>';
2222 echo '</div>';
2223 echo '<div class="mtnc-form-group">';
2224 echo '<label for="ip_whitelist" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="ip_whitelist">IP Whitelisting <sup>PRO</sup></label>';
2225 echo '<textarea rows="2" class="mtnc-form-control open-pro-dialog pro-disabled" name="ip_whitelist" id="ip_whitelist"></textarea>';
2226 $ip_address = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? ''));
2227 echo '<p class="mtnc-form-help-block">Noted IPs will not be affected by the maintenance mode, and their users will see the "normal" site.<br>Write one IP per line. Wildcards are not supported. If the user\'s IP changes, he will no longer be whitelisted. Your IP address is: ' . esc_html($ip_address) . '</p>';
2228 echo '</div>';
2229 echo '</div>';
2230
2231 echo '<div class="mtnc-double-group clearfix">';
2232 echo '<div class="mtnc-form-group">';
2233 echo '<label for="per_url_settings" class="mtnc-strong">URL Based Rules</label>';
2234 echo '<select name="per_url_settings" id="per_url_settings">';
2235 $per_url_settings = array(
2236 array('val' => '', 'label' => esc_html__('Disabled', 'maintenance')),
2237 array('val' => 'whitelist', 'label' => esc_html__('Listed URLs will NEVER be affected by maintenance mode', 'maintenance')),
2238 array('val' => 'blacklist', 'label' => esc_html__('ONLY listed URLs CAN BE affected by maintenance mode', 'maintenance')),
2239 );
2240 self::wp_kses_wf($this->create_select_options($per_url_settings, $options['per_url_settings'], false));
2241 echo '</select>';
2242 echo '<p class="mtnc-form-help-block">Use this option to set per-URL rules and enable maintenance mode on the entire site except for selected pages, or enable it on just some pages and leave all others accessible to visitors. If the second option is used, all other access rules apply too.</p>';
2243 echo '</div>';
2244
2245 echo '<div class="mtnc-form-group per-url-wrapper">';
2246 echo '<label for="per_url_enable_disable" class="mtnc-strong">URL List</label>';
2247 echo '<textarea rows="3" class="mtnc-form-control" name="per_url_enable_disable" id="per_url_enable_disable">' . esc_attr($options['per_url_enable_disable']) . '</textarea>';
2248 echo '<p class="mtnc-form-help-block">Enter one URL per line. Start and end URLs with a forward slash (/).</p>';
2249 echo '</div>';
2250 echo '</div>';
2251
2252 echo '<div class="mtnc-double-group mtnc-clearfix">';
2253 echo '<div class="mtnc-form-group">';
2254 echo '<label for="direct_access_link" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="secret-access-link">Secret Access Link <sup>PRO</sup></label>';
2255 echo '<span style="vertical-align: middle;">' . esc_url(trailingslashit(get_home_url())) . '?</span><input type="text" name="direct_access_link" id="direct_access_link" value="" placeholder="preview-full-site" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"><a data-base-url="' . esc_url(trailingslashit(get_home_url())) . '?" href="javascript: void(0);" class="copy-secret-link"><span class="dashicons dashicons-clipboard"></span></a>';
2256 echo '<p class="mtnc-form-help-block">Share this link with people who need to see the normal site behind the maintenance page.</p>';
2257 echo '</div>';
2258
2259 echo '<div class="mtnc-form-group">';
2260 echo '<label for="custom_login_url" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="custom-login-url">Custom Login URL <sup>PRO</sup></label>';
2261 echo '<span style="vertical-align: middle;"><span style="vertical-align: middle;">' . esc_url(trailingslashit(get_home_url())) . '?</span><input type="text" name="custom_login_url" id="custom_login_url" value="" placeholder="my-login-url/" class="mtnc-form-control open-pro-dialog pro-disabled small_80_percent"></span>';
2262 echo '<p class="mtnc-form-help-block">If you\'re using a custom login URL and can\'t access it, enter the custom login URL here. That URL will never be affected by the maintenance mode.</p>';
2263 echo '</div>';
2264 echo '</div>';
2265
2266 echo '<div class="mtnc-double-group mtnc-clearfix">';
2267 echo '<div class="mtnc-form-group">';
2268 echo '<label for="login_button" class="mtnc-strong">Show Login Button</label>';
2269 echo '<div class="toggle-wrapper">';
2270
2271 echo '<input id="login_button" type="checkbox" name="login_button" value="1" ' . checked('1', (isset($options['login_button']) ? esc_html($options['login_button']) : ''), false) . '>';
2272 echo '<label for="login_button" class="toggle"><span class="toggle_handler"></span></label>';
2273 echo '</div>';
2274 echo '<p class="mtnc-form-help-block">Show a discrete button that links to the WordPress login page in the lower right corner of the maintenance page.</p>';
2275 echo '</div>';
2276
2277 echo '<div class="mtnc-form-group">';
2278 echo '<label for="wplogin_button_tooltip" class="mtnc-strong">WordPress Login Button Tooltip</label>';
2279 echo '<span style="vertical-align: middle;"><input type="text" name="wplogin_button_tooltip" id="wplogin_button_tooltip" value="' . (isset($options['wplogin_button_tooltip']) ? esc_attr($options['wplogin_button_tooltip']) : 'Access WordPress admin') . '" placeholder="" class="mtnc-form-control small_80_percent"></span>';
2280 echo '<p class="mtnc-form-help-block">Text for the "Access WordPress admin" button tooltip.</p>';
2281 echo '</div>';
2282 echo '</div>';
2283 $this->tab_footer();
2284 } // tab_access
2285
2286 /**
2287 * Echoes content for access password tab
2288 *
2289 * @return null
2290 */
2291 private function tab_access_password()
2292 {
2293 $options = $this->get_options();
2294
2295 echo '<div class="mtnc-tile-title">Password Protection</div>';
2296 echo '<p>By default, if Maintenance mode is enabled, all site visitors except the logged in ones (regardless of their user role) will see the Maintenance page instead of the "normal" site.<br>The easiest way to show the site to clients or friends is to share the Secret Access Link, or whitelist their IP address if it doesn\'t change too often.</p>';
2297
2298 echo '<div class="mtnc-double-group mtnc-clearfix">';
2299 echo '<div class="mtnc-form-group">';
2300 echo '<label for="site_password" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="direct-access-password">Direct Access Password <sup>PRO</sup></label>';
2301 echo '<span style="vertical-align: middle;"><input type="text" name="site_password" id="site_password" value="" placeholder="" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"></span>';
2302 echo '<p class="mtnc-form-help-block">Direct Access Password is a user-friendly way (especially when working with clients) to give selected visitors access to the "normal" site. Enter the password and send users the following link: <a href="' . esc_url(get_home_url()) . '/#access-site-form">' . esc_url(get_home_url()) . '/#access-site-form</a> or enable the option on the right to show the password form button.<br>The password has to be at least 4 characters long</p>';
2303 echo '</div>';
2304
2305 echo '<div class="mtnc-form-group">';
2306 echo '<label for="password_button" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="password-form-button-text">Password Form Button <sup>PRO</sup></label>';
2307 echo '<div class="toggle-wrapper">';
2308 echo '<input id="password_button" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="password_button" value="1">';
2309 echo '<label for="password_button" class="toggle"><span class="toggle_handler"></span></label>';
2310 echo '</div>';
2311 echo '<p class="mtnc-form-help-block">Show a discrete button to the direct access password form in the lower right corner of the maintenance page.</p>';
2312 echo '</div>';
2313 echo '</div>';
2314
2315 echo '<div class="mtnc-double-group mtnc-clearfix">';
2316 echo '<div class="mtnc-form-group">';
2317 echo '<label for="maintenance_password_toggle" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password">Password to Protect the Maintenance Page <sup>PRO</sup></label>';
2318 echo '<div class="toggle-wrapper">';
2319 echo '<input id="maintenance_password_toggle" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="maintenance_password_toggle" value="1">';
2320 echo '<label for="maintenance_password_toggle" class="toggle"><span class="toggle_handler"></span></label>';
2321 echo '</div>';
2322 echo '<p class="mtnc-form-help-block">Protect the entire site with a password you choose. Only those with the password can view the maintenance page.</p>';
2323 echo '</div>';
2324
2325 echo '<div class="mtnc-form-group" id="maintenance_password_wrapper">';
2326 echo '<label for="maintenance_password" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password">Password <sup>PRO</sup></label>';
2327 echo '<span style="vertical-align: middle;"><input type="text" name="maintenance_password" id="maintenance_password" value="" placeholder="" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"></span>';
2328 echo '<p class="mtnc-form-help-block">The password has to be at least 4 characters long.</p>';
2329 echo '</div>';
2330 echo '</div>';
2331
2332 echo '<div class="mtnc-double-group mtnc-clearfix">';
2333 echo '<div class="mtnc-form-group">';
2334 echo '<label for="login_message" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password-message">Password Popup Message <sup>PRO</sup></label>';
2335 echo '<span style="vertical-align: middle;"><input type="text" name="login_message" id="login_message" value="Please enter the password to access the site" placeholder="" class="mtnc-form-control open-pro-dialog pro-disabled small_80_percent"></span>';
2336 echo '<p class="mtnc-form-help-block">The message displayed in the password popup above the password input. </p>';
2337 echo '</div>';
2338
2339 echo '<div class="mtnc-form-group">';
2340 echo '<label for="login_button_text" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password-button">Password Popup Button Message <sup>PRO</sup></label>';
2341 echo '<span style="vertical-align: middle;"><input type="text" name="login_button_text" id="login_button_text" value="Access the Site" placeholder="" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"></span>';
2342 echo '<p class="mtnc-form-help-block">Text for the password popup button.</p>';
2343 echo '</div>';
2344 echo '</div>';
2345
2346 echo '<div class="mtnc-double-group mtnc-clearfix">';
2347 echo '<div class="mtnc-form-group">';
2348 echo '<label for="login_wrong_password_text" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password-wrong">Wrong Password Text <sup>PRO</sup></label>';
2349 echo '<span style="vertical-align: middle;"><input type="text" name="login_wrong_password_text" id="login_wrong_password_text" value="Wrong password" placeholder="" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"></span>';
2350 echo '<p class="mtnc-form-help-block">Text for the "Wrong Password" message.</p>';
2351 echo '</div>';
2352
2353 echo '<div class="mtnc-form-group">';
2354 echo '<label for="login_button_tooltip" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-direct-button">Maintenance Direct Access Button Tooltip <sup>PRO</sup></label>';
2355 echo '<span style="vertical-align: middle;"><input type="text" name="login_button_tooltip" id="login_button_tooltip" value="Direct Access login" placeholder="" class="mtnc-form-control small_80_percent open-pro-dialog pro-disabled"></span>';
2356 echo '<p class="mtnc-form-help-block">Text for the "Direct Access login" button tooltip.</p>';
2357 echo '</div>';
2358 echo '</div>';
2359 $this->tab_footer();
2360 } // tab_access_password
2361
2362 /**
2363 * Admin footer text
2364 *
2365 * @since 5.0
2366 *
2367 * @return null
2368 */
2369 public function admin_footer_text($text)
2370 {
2371 if (!$this->is_plugin_page()) {
2372 return $text;
2373 }
2374
2375 $text = '<i class="wfsab-footer">Thank you for creating with <a href="' . esc_url($this->generate_web_link('admin_footer')) . '" title="' . esc_html__('Visit Maintenance page for more info', 'maintenance') . '" target="_blank">Maintenance</a> v' . $this->version . '</i>';
2376
2377 return $text;
2378 } // admin_footer_text
2379
2380 /**
2381 * Add links to plugin's description in plugins table
2382 *
2383 * @param array $links Initial list of links.
2384 * @param string $file Basename of current plugin.
2385 *
2386 * @return array
2387 */
2388 function plugin_meta_links($links, $file)
2389 {
2390 if ($file !== plugin_basename(__FILE__)) {
2391 return $links;
2392 }
2393
2394 $support_link = '<a target="_blank" href="' . $this->generate_web_link('plugins-table-right', '/support/') . '" title="Get help">Support</a>';
2395 $home_link = '<a target="_blank" href="' . $this->generate_web_link('plugins-table-right') . '" title="Plugin Homepage">Plugin Homepage</a>';
2396
2397 $links[] = $support_link;
2398 $links[] = $home_link;
2399
2400 return $links;
2401 } // plugin_meta_links
2402
2403
2404 /**
2405 * Helper function for generating UTM tagged links
2406 *
2407 * @param string $placement Optional. UTM content param.
2408 * @param string $page Optional. Page to link to.
2409 * @param array $params Optional. Extra URL params.
2410 * @param string $anchor Optional. URL anchor part.
2411 *
2412 * @return string
2413 */
2414 public function generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '')
2415 {
2416 $base_url = 'https://wpmaintenancemode.com';
2417
2418 if ('/' != $page) {
2419 $page = '/' . trim($page, '/') . '/';
2420 }
2421 if ($page == '//') {
2422 $page = '/';
2423 }
2424
2425 $parts = array_merge(array('utm_source' => 'maintenance-free', 'utm_content' => $placement), $params);
2426
2427 if (!empty($anchor)) {
2428 $anchor = '#' . trim($anchor, '#');
2429 }
2430
2431 $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
2432
2433 return $out;
2434 } // generate_web_link
2435
2436
2437 function generate_dashboard_link($placement = '', $page = '/', $params = array(), $anchor = '')
2438 {
2439 $base_url = 'https://dashboard.wpmaintenancemode.com';
2440
2441 if ('/' != $page) {
2442 $page = '/' . trim($page, '/') . '/';
2443 }
2444 if ($page == '//') {
2445 $page = '/';
2446 }
2447
2448 $parts = array_merge(array('utm_source' => 'maintenance-free', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'maintenance-free-v' . $this->version), $params);
2449
2450 if (!empty($anchor)) {
2451 $anchor = '#' . trim($anchor, '#');
2452 }
2453
2454 $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
2455
2456 return $out;
2457 } // generate_dashboard_link
2458
2459
2460 /**
2461 * Echoes content for design header such as theme name
2462 *
2463 * @return null
2464 */
2465 private function design_header()
2466 {
2467 $options = $this->get_options();
2468
2469 echo '<div class="mtnc-theme-title">';
2470 if ($options['theme_global'] == $this->theme_id) {
2471 echo '<span class="mtnc-theme-active dashicons dashicons-star-filled" title="This is the currently active theme"></span>';
2472 }
2473 echo 'Editing theme <span class="mtnc-theme-title-name">' . esc_html($this->theme->name) . '</span>';
2474 echo '<a href="' . esc_url(admin_url('admin.php?page=maintenance#themes')) . '">switch theme</a>';
2475 echo '</div>';
2476 }
2477
2478 /**
2479 * Echoes content for design-general tab
2480 *
2481 * @return null
2482 */
2483 private function tab_design_general()
2484 {
2485 $fonts = $this->get_fonts();
2486 $options = $this->get_options();
2487
2488 echo '<div class="mtnc-double-group mtnc-clearfix">';
2489 echo '<div class="mtnc-form-group">';
2490 echo '<label for="show_logged_in" class="mtnc-strong">Multilingual Support</label>';
2491 echo '<div class="toggle-wrapper">';
2492 echo '<input id="weglot_translate" type="checkbox" class="mtnc-form-ios open-weglot-upsell" name="content_overlay" value="1">';
2493 echo '<label for="weglot_translate" class="toggle open-weglot-upsell"><span class="toggle_handler"></span></label>';
2494 echo '<p class="mtnc-form-help-block">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 maintenance, <a href="#" class="open-weglot-upsell">install the Weglot plugin</a> (free plan and free trial available). It seamlessly integrates with Maintenance and is compatible with all themes &amp; plugins.</label></p>';
2495 echo '</div>';
2496 echo '</div>';
2497 echo '</div>';
2498
2499 echo '<div class="mtnc-double-group mtnc-clearfix">';
2500 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
2501 echo '<label for="body_font_size" class="mtnc-strong">Content Text Size</label>';
2502 echo '<div class="range-slider-wrapper">';
2503 echo '<input type="range" name="body_font_size" value="' . esc_attr($this->theme->body_font_size) . '" min="6" max="300" class="range-slider">';
2504 echo '</div>';
2505 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->body_font_size) . '</span>px';
2506 echo '<p class="mtnc-form-help-block">Don\'t be afraid to make to font a bit bigger. Default: 16px;</p>';
2507 echo '</div>';
2508
2509 echo '<div class="mtnc-form-group">';
2510 echo '<label for="body_font_color" class="mtnc-strong">Content Text Color</label>';
2511 echo '<input type="text" name="body_font_color" id="body_font_color" value="' . esc_html($this->theme->body_font_color) . '" class="jscolor mtnc-form-control color {required:false}">';
2512 echo '<p class="mtnc-form-help-block">Make sure the contrast is good. Whiteish text on a dark background is always a good pick.</p>';
2513 echo '</div>';
2514 echo '</div>';
2515
2516 echo '<div class="mtnc-double-group mtnc-clearfix">';
2517 echo '<div class="mtnc-form-group">';
2518 echo '<label for="body_font" class="mtnc-strong">Content Font</label>';
2519 echo '<select name="body_font" id="body_font" class="mtnc-bunny-fonts">';
2520 // Listing fonts from the array
2521 foreach ($fonts as $font) {
2522 echo '<option value="' . esc_html($font) . '"' . selected($font, $this->theme->body_font, false) . '>' . esc_html($font) . '</option>' . "\n";
2523 }
2524 echo '</select>';
2525 echo '<h3>' . esc_html__('This is how the content font is going to look!', 'maintenance') . '</h3>';
2526 echo '<p class="mtnc-form-help-block">Choose from over 700 Fonts. Make sure other modules use the same, or matching fonts. Maintenance now uses Bunny Fonts instead of Google fonts. Bunny Fonts is an open-source, privacy-first web font platform designed to put privacy back into the internet. With a zero-tracking and no-logging policy, <strong>Bunny Fonts helps you stay fully GDPR compliant</strong> and puts your user\'s personal data into their own hands. Additionally, you can enjoy lightning-fast load times thanks to bunny.net\'s global CDN network to help improve SEO and deliver a better user experience.</p>';
2527 echo '</div>';
2528 echo '</div>';
2529
2530 echo '<div class="mtnc-double-group mtnc-clearfix">';
2531 echo '<div class="mtnc-form-group">';
2532 echo '<label for="body_link_color" class="mtnc-strong">Link Color</label>';
2533 echo '<input type="text" name="body_link_color" id="body_link_color" value="' . esc_html($this->theme->body_link_color) . '" class="jscolor mtnc-form-control color {required:false}">';
2534 echo '<p class="mtnc-form-help-block">Make sure it stands out but make it fit your color scheme.</p>';
2535 echo '</div>';
2536
2537 echo '<div class="mtnc-form-group">';
2538 echo '<label for="body_link_hover_color" class="mtnc-strong">Link Hover Color</label>';
2539 echo '<input type="text" name="body_link_hover_color" id="body_link_hover_color" value="' . esc_html($this->theme->body_link_hover_color) . '" class="jscolor mtnc-form-control color {required:false}">';
2540 echo '<p class="mtnc-form-help-block">Generally it\'s a lighter or darker variation of the normal link color.</p>';
2541 echo '</div>';
2542
2543 echo '</div>';
2544
2545 echo '<div class="mtnc-double-group mtnc-clearfix">';
2546 echo '<div class="mtnc-form-group">';
2547 echo '<label for="show_logged_in" class="mtnc-strong">Content Overlay</label>';
2548 echo '<div class="toggle-wrapper">';
2549 echo '<input id="content_overlay" type="checkbox" class="mtnc-form-ios" name="content_overlay" value="1" ' . checked('1', $this->theme->content_overlay, false) . '>';
2550 echo '<label for="content_overlay" class="toggle"><span class="toggle_handler"></span></label>';
2551 echo '<p class="mtnc-form-help-block">If enabled, applies a transparent background to the entire content section of the page.</p>';
2552 echo '</div>';
2553 echo '</div>';
2554
2555 echo '<div class="mtnc-form-group overlay_parameters">';
2556 echo '<label for="body_font" class="mtnc-strong">Content Position</label>';
2557 $content_positions = array(
2558 'left' => 'Top Left',
2559 'right' => 'Top Right',
2560 'center' => 'Top Center',
2561 'middle' => 'Middle Center',
2562 'bottom' => 'Bottom Center',
2563 );
2564 echo '<select name="content_position" id="content_position">';
2565 foreach ($content_positions as $position => $label) {
2566 echo '<option value="' . esc_html($position) . '"' . selected($position, $this->theme->content_position, false) . '>' . esc_html($label) . '</option>' . "\n";
2567 }
2568 echo '</select>';
2569 echo '<p class="mtnc-form-help-block">Content box position on the page.</p>';
2570 echo '</div>';
2571 echo '</div>';
2572
2573 echo '<div class="mtnc-double-group mtnc-clearfix overlay_parameters">';
2574 echo '<div class="mtnc-form-group" ' . (!$this->theme->content_overlay ? 'style="display:none;"' : '') . '>';
2575 echo '<label for="content_overlay_color" class="mtnc-strong">Content Overlay Color</label>';
2576 echo '<input type="text" name="content_overlay_color" id="content_overlay_color" value="' . esc_html($this->theme->content_overlay_color) . '" data-jscolor="{format: \'rgba\',previewSize: 36}" class="jscolor mtnc-form-control color {required:false}">';
2577 echo '<p class="mtnc-form-help-block">Background color for the content overlay.</p>';
2578 echo '</div>';
2579
2580 echo '<div class="mtnc-form-group" ' . (!$this->theme->content_overlay ? 'style="display:none;"' : '') . '>';
2581 echo '<label for="content_overlay_shadow_color" class="mtnc-strong">Content Overlay Shadow Color</label>';
2582 echo '<input type="text" name="content_overlay_shadow_color" id="content_overlay_shadow_color" value="' . (isset($this->theme->content_overlay_shadow_color) ? esc_html($this->theme->content_overlay_shadow_color) : '') . '" data-jscolor="{format: \'rgba\',previewSize: 36}" class="jscolor mtnc-form-control color {required:false}">';
2583 echo '<p class="mtnc-form-help-block">Shadow color for the content overlay.</p>';
2584 echo '</div>';
2585
2586 echo '</div>';
2587
2588 echo '<div class="mtnc-double-group mtnc-clearfix">';
2589 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
2590 echo '<label for="content_width" class="mtnc-strong">Content Width</label>';
2591 echo '<div class="range-slider-wrapper">';
2592 echo '<input type="range" name="content_width" value="' . esc_attr($this->theme->content_width) . '" min="200" max="1600" class="range-slider">';
2593 echo '</div>';
2594 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->content_width) . '</span>px';
2595 echo '<p class="mtnc-form-help-block">Maximum content width. Default: 600px.</p>';
2596 echo '</div>';
2597
2598 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
2599 echo '<label for="modules_spacing" class="mtnc-strong">Modules Spacing</label>';
2600 echo '<div class="range-slider-wrapper">';
2601 echo '<input type="range" name="modules_spacing" value="' . esc_attr($this->theme->modules_spacing) . '" min="0" max="50" class="range-slider">';
2602 echo '</div>';
2603 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->modules_spacing) . '</span>px';
2604 echo '<p class="mtnc-form-help-block">Vertical spacing between design modules. The selected value is added to both top and bottom margins of the module. Default: 10px.</p>';
2605 echo '</div>';
2606 echo '</div>';
2607
2608 $this->tab_footer('design');
2609 } // tab_design_general
2610
2611
2612 /**
2613 * Echoes content for design-background tab
2614 *
2615 * @return null
2616 */
2617 private function tab_design_background()
2618 {
2619 $options = $this->get_options();
2620 $filters = array(
2621 array('val' => '', 'label' => 'No Filter'),
2622 array('label' => '1977', 'val' => ' _1977'),
2623 array('label' => 'Aden', 'val' => ' aden'),
2624 array('label' => 'Black & White', 'val' => ' blackwhite'),
2625 array('label' => 'Brannan', 'val' => ' brannan'),
2626 array('label' => 'Brooklyn', 'val' => ' brooklyn'),
2627 array('label' => 'Clarendon', 'val' => ' clarendon'),
2628 array('label' => 'Earlybird', 'val' => ' earlybird'),
2629 array('label' => 'Gingham', 'val' => ' gingham'),
2630 array('label' => 'Hudson', 'val' => ' hudson'),
2631 array('label' => 'Inkwell', 'val' => ' inkwell'),
2632 array('label' => 'Kelvin', 'val' => ' kelvin'),
2633 array('label' => 'Lark', 'val' => ' lark'),
2634 array('label' => 'Lo-Fi', 'val' => ' lofi'),
2635 array('label' => 'Maven', 'val' => ' maven'),
2636 array('label' => 'Mayfair', 'val' => ' mayfair'),
2637 array('label' => 'Moon', 'val' => ' moon'),
2638 array('label' => 'Nashville', 'val' => ' nashville'),
2639 array('label' => 'Perpetua', 'val' => ' perpetua'),
2640 array('label' => 'Reyes', 'val' => ' reyes'),
2641 array('label' => 'Rise', 'val' => ' rise'),
2642 array('label' => 'Slumber', 'val' => ' slumber'),
2643 array('label' => 'Stinson', 'val' => ' stinson'),
2644 array('label' => 'Toaster', 'val' => ' toaster'),
2645 array('label' => 'Valencia', 'val' => ' valencia'),
2646 array('label' => 'Walden', 'val' => ' walden'),
2647 array('label' => 'Willow', 'val' => ' willow'),
2648 array('label' => 'X-pro II', 'val' => ' xpro2'),
2649 );
2650
2651
2652 echo '<div class="mtnc-tile-title">Background</div>';
2653 echo '<p>The background image makes or breaks the whole page. Take your time to choose a perfect image from our gallery of 400,000+ images and then make it pop by using filters. If you don\'t have much content to show, then choose a video background.</p>';
2654
2655 echo '<div class="mtnc-section-content">';
2656 echo '<div class="mtnc-double-group mtnc-clearfix">';
2657 echo '<div class="mtnc-form-group">';
2658 echo '<label for="background_type" class="mtnc-strong">Background Type</label>';
2659 echo '<select name="background_type" id="background_type">';
2660 $bg_type = array(
2661 array('val' => 'image', 'label' => 'Image'),
2662 array('val' => 'video', 'label' => 'Video'),
2663 );
2664 $this->create_select_options($bg_type, $this->theme->background_type);
2665 echo '</select>';
2666
2667 echo '<p class="mtnc-form-help-block">Video background draws attention away from the content, so use it wisely, only in situations when you don\'t have much content to put on the page. In all other cases, an image background is a better choice.</p>';
2668 echo '</div>';
2669 echo '</div>';
2670
2671 echo '<div class="background-type background-type-video">';
2672 echo '<div class="mtnc-double-group mtnc-clearfix">';
2673 echo '<div class="mtnc-form-group">';
2674 echo '<label for="background_video" class="mtnc-strong">Background Video ID</label>';
2675 echo '<input type="text" name="background_video" id="background_video" value="' . esc_attr($this->theme->background_video) . '" placeholder="UFHQzF593ak" class="mtnc-form-control">';
2676 echo '<p class="mtnc-form-help-block">Only YouTube videos are supported. Enter only the video ID, ie: <i>UFHQzF593ak</i>, found in the YouTube URL. Video is played muted and looped.<br>If the video ID is valid a preview will be shown below.</p>';
2677 echo '<div id="video-preview" class="rise">';
2678 echo '<div class="video-container"></div>';
2679 echo '</div>';
2680 echo '</div>';
2681
2682 echo '<div class="mtnc-form-group">';
2683 echo '<label for="background_video_filter" class="mtnc-strong">Background Video Filter</label>';
2684 echo '<select name="background_video_filter" id="background_video_filter">';
2685 $this->create_select_options($filters, $this->theme->background_video_filter);
2686 echo '</select>';
2687 echo '<p class="mtnc-form-help-block">The filter is immediately applied to the video preview.</p>';
2688 echo '</div>';
2689 echo '</div>';
2690
2691 echo '<div class="mtnc-double-group mtnc-clearfix">';
2692 echo '<div class="mtnc-upload-group mtnc-clearfix">';
2693 echo '<div class="mtnc-form-group border-fix">';
2694 echo '<div class="mtnc-image-upload-wrapper">';
2695 echo '<label class="mtnc-strong">Mobile Video Fallback Image</label>';
2696 if (stripos($this->theme->background_video_fallback, 'undefined index') !== false) {
2697 $this->theme->background_video_fallback = '';
2698 }
2699 if (!empty($this->theme->background_video_fallback)) {
2700 echo '<span class="mtnc-preview-area" id="video-fallback-preview"><img src="' . esc_attr($this->theme->background_video_fallback) . '" /></span>';
2701 } else {
2702 echo '<span class="mtnc-preview-area" id="video-fallback-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
2703 }
2704
2705 echo '<input type="hidden" name="fallback" id="fallback" class="mm_upload_image_input" value="' . esc_attr($this->theme->background_video_fallback) . '">';
2706 echo '<button type="button" name="fallback_upload" id="fallback_upload" class="mtnc-btn mtnc-upload mtnc-free-images" style="margin-top: 4px">Open images gallery</button>';
2707 echo '<span class="mtnc-upload-append">';
2708 if (!empty($this->theme->background_video_fallback)) {
2709 echo '&nbsp;<a href="javascript: void(0);" class="mtnc-remove-image">' . esc_html__('Remove', 'maintenance') . '</a>';
2710 }
2711 echo '</span>';
2712 echo '</div>';
2713 echo '</div>';
2714 echo '</div>';
2715 echo '</div>';
2716 echo '</div>';
2717
2718 echo '<div class="background-type background-type-image">';
2719 echo '<div class="mtnc-upload-group mtnc-clearfix">';
2720 echo '<div class="mtnc-form-group border-fix">';
2721 echo '<div class="mtnc-image-upload-wrapper">';
2722 echo '<label class="mtnc-strong">Background Image</label>';
2723
2724 echo '<input type="hidden" name="background_image" id="background_image" class="mtnc-image-upload-input" value="' . esc_attr($this->theme->background_image) . '">';
2725
2726 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($this->theme->background_image) ? 'style="background-image:url(\'' . esc_attr($this->theme->background_image) . '\')"' : '') . '>';
2727 if (empty($this->theme->background_image)) {
2728 echo '<img src="' . esc_url(MTNC_URL . '/img/icons/image.png') . '">';
2729 echo '<span class="mtnc-preview-area" id="background-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
2730 }
2731 echo '<button type="button" name="bg_upload" id="bg_upload" class="mtnc-btn mtnc-upload mtnc-free-images" style="margin-top: 4px">Open images gallery</button>';
2732 if (!empty($this->theme->background_image)) {
2733 echo '<button type="button" class="button mtnc-image-upload-remove" style="margin-top: 4px">Remove</button>';
2734 }
2735 echo '</div>';
2736 echo '</div>';
2737 echo '</div>';
2738 echo '</div>';
2739 echo '</div>';
2740
2741 echo '<div class="mtnc-double-group mtnc-clearfix">';
2742 echo '<div class="mtnc-form-group">';
2743 echo '<label for="background_size_opt" class="mtnc-strong">Background Image Size</label>';
2744 echo '<select name="background_size_opt" id="background_size_opt">';
2745 $bkg_opt = array(
2746 array('val' => 'auto', 'label' => 'Auto'),
2747 array('val' => 'contain', 'label' => 'Contain'),
2748 array('val' => 'cover', 'label' => 'Cover'),
2749 );
2750 $this->create_select_options($bkg_opt, $this->theme->background_size_opt);
2751 echo '</select>';
2752
2753 echo '<p class="mtnc-form-help-block">Auto - display image in original size; Contain - resize the image so it\'s fully visible; Cover - resize the image to cover the entire screen.</p>';
2754 echo '</div>';
2755
2756 echo '<div class="mtnc-form-group">';
2757 echo '<label for="background_image_filter" class="mtnc-strong">Background Image Filter</label>';
2758 echo '<select name="background_image_filter" id="background_image_filter">';
2759 $this->create_select_options($filters, $this->theme->background_image_filter);
2760 echo '</select>';
2761 echo '<p class="mtnc-form-help-block">The filter is immediately applied to the background image thumbnail above for a preview.</p>';
2762 echo '</div>';
2763 echo '</div>';
2764
2765 echo '<div class="mtnc-double-group mtnc-clearfix">';
2766 echo '<div class="mtnc-form-group">';
2767 echo '<label for="background_position" class="mtnc-strong">Background Image Position</label>';
2768 echo '<select name="background_position" id="background_position">';
2769 $positions = array(
2770 array('val' => '', 'label' => 'Auto'),
2771 array('val' => 'left top', 'label' => 'Top left'),
2772 array('val' => 'center top', 'label' => 'Top center'),
2773 array('val' => 'right top', 'label' => 'Top right'),
2774 array('val' => 'left center', 'label' => 'Center left'),
2775 array('val' => 'center center', 'label' => 'Center'),
2776 array('val' => 'right center', 'label' => 'Center right'),
2777 array('val' => 'left bottom', 'label' => 'Bottom left'),
2778 array('val' => 'center bottom', 'label' => 'Bottom center'),
2779 array('val' => 'right bottom', 'label' => 'Bottom right'),
2780 );
2781 $this->create_select_options($positions, $this->theme->background_position);
2782 echo '</select>';
2783
2784 echo '<p class="mtnc-form-help-block">If defined, the position defines the screen and image corners that will be aligned. It works best with the "cover" size option.</p>';
2785 echo '</div>';
2786
2787 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
2788 echo '<label for="background_blur" class="mtnc-strong">Background Blur</label>';
2789 echo '<div class="range-slider-wrapper">';
2790 echo '<input type="range" name="background_blur" value="' . (isset($this->theme->background_blur) ? esc_attr($this->theme->background_blur) : '') . '" min="0" max="50" class="range-slider">';
2791 echo '</div>';
2792 echo '<span class="range_value" data-unit="px">' . (isset($this->theme->background_blur) ? esc_attr($this->theme->background_blur) : '') . '</span>px';
2793 echo '<p class="mtnc-form-help-block">Blur the background image to make the content more visible</p>';
2794 echo '</div>';
2795
2796
2797 echo '</div>';
2798
2799 echo '<div class="mtnc-double-group mtnc-clearfix">';
2800 echo '<div class="mtnc-form-group">';
2801 echo '<label for="background_color" class="mtnc-strong">' . esc_html__('Background Color', 'maintenance') . '</label>';
2802 echo '<input name="background_color" id="background_color" value="' . (isset($this->theme->background_color) ? esc_attr($this->theme->background_color) : '') . '" data-jscolor="{format: \'rgba\',previewSize: 36}" class="mtnc-form-control {required:false}">';
2803 echo '<p class="mtnc-form-help-block">If the background image is set, the color will not be visible once the image is loaded.</p>';
2804 echo '</div>';
2805
2806 echo '<div class="mtnc-form-group">';
2807 echo '<label for="login_background_color" class="mtnc-strong">' . esc_html__('Login Background Color', 'maintenance') . '</label>';
2808 echo '<input name="login_background_color" id="login_background_color" value="' . (isset($this->theme->login_background_color) ? esc_attr($this->theme->login_background_color) : '') . '" data-jscolor="{format: \'rgba\',previewSize: 36}" class="mtnc-form-control {required:false}">';
2809 echo '<p class="mtnc-form-help-block">Background color of the login sidebar.</p>';
2810 echo '</div>';
2811
2812
2813
2814 echo '</div>';
2815
2816 echo '<div class="background-type background-type-image">';
2817 echo '<div class="mtnc-upload-group mtnc-clearfix">';
2818 echo '<div class="mtnc-form-group border-fix">';
2819 echo '<div class="mtnc-image-upload-wrapper">';
2820 echo '<label class="mtnc-strong">Preloader Image</label>';
2821
2822 echo '<input type="hidden" name="preloader_background_image" id="preloader_background_image" class="mtnc-image-upload-input" value="' . (isset($this->theme->preloader_background_image) ? esc_attr($this->theme->preloader_background_image) : '') . '">';
2823
2824 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($this->theme->preloader_background_image) ? 'style="background-image:url(\'' . esc_attr($this->theme->preloader_background_image) . '\')"' : '') . '>';
2825 if (empty($this->theme->preloader_background_image)) {
2826 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
2827 echo '<span class="mtnc-preview-area" id="background-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
2828 }
2829 echo '<button type="button" name="bg_upload" id="bg_upload" class="mtnc-btn mtnc-upload mtnc-free-images" style="margin-top: 4px">Open images gallery</button>';
2830 if (!empty($this->theme->preloader_background_image)) {
2831 echo '<button type="button" class="button mtnc-image-upload-remove" style="margin-top: 4px">Remove</button>';
2832 }
2833 echo '</div>';
2834 echo '</div>';
2835 echo '</div>';
2836 echo '<p class="mtnc-form-help-block">Preloader image to replace the default gear icon.</p>';
2837 echo '</div>';
2838 echo '</div>';
2839
2840
2841
2842 echo '</div>';
2843 $this->tab_footer('design');
2844 } // tab_design_background
2845
2846 /**
2847 * Echoes content for design-layout tab
2848 *
2849 * @return null
2850 */
2851 private function tab_design_layout()
2852 {
2853 $modules = $this->get_modules();
2854
2855
2856 // Modules
2857 echo '<div class="arrange-wrapper" id="mtnc-theme-builder-modules-wrapper"><span class="arrange-label">Available Modules</span>';
2858 echo '<ul id="mtnc-theme-builder-modules" class="mtnc-theme-builder">';
2859 foreach ($modules as $module => $module_properties) {
2860 echo '<li data-type="' . esc_html($module) . '" ' . ($module_properties['pro'] === true ? 'class="pro-module open-pro-dialog" data-pro-feature="layout-module"' : 'class="available-module"') . '>';
2861 if ($module_properties['pro'] === true) {
2862 echo '<div class="pro-module-label">PRO</div>';
2863 }
2864 echo '<img style="max-height: 45px;" src="' . esc_url(MTNC_URL . 'img/modules/' . $module . '.png') . '" title="Drag to rearrange the module on maintenance page, or move it to inactive modules"><br />';
2865 echo '<span class="module-name">' . esc_html($module_properties['name']) . '</span>';
2866 echo '<div class="module-actions"><span class="module-name">' . esc_html($module_properties['name']) . '</span>';
2867 echo '<a title="Drag to rearrange the module on maintenance page, or move it to inactive modules" href="#" class="mtnc-move-module"><span class="dashicons dashicons-move"></span></a>';
2868 echo '<a title="Edit module" href="#" class="mtnc-edit-module" title="Edit module"><span class="dashicons dashicons-edit"></span></a>';
2869 echo '<a title="Clone module" href="#" class="mtnc-clone-module" title="Clone module"><span class="dashicons dashicons-admin-page"></span></a>';
2870 echo '<a href="#" class="mtnc-remove-module" title="Remove module from maintenance page"><span class="dashicons dashicons-trash"></span></a>';
2871 echo '</li>';
2872 }
2873 echo '</ul></div>';
2874
2875 //Layout
2876 echo '<div class="arrange-wrapper mtnc-theme-builder-right-col"><span class="arrange-label">Active Modules (hover over each one to show the edit menu)</span>';
2877 echo '<div class="arrange-wrapper" id="mtnc-theme-builder-layout-wrapper">';
2878 echo '<div class="browser-header">
2879 <div class="browser-button-wrapper">
2880 <div class="browser-button browser-button-red"></div>
2881 <div class="browser-button browser-button-yellow"></div>
2882 <div class="browser-button browser-button-green"></div>
2883 </div>
2884 <div class="browser-bar">
2885 <span class="material-icons">navigate_before</span>
2886 <span class="material-icons">navigate_next</span>
2887 <span class="material-icons">refresh</span>
2888 <div class="browser-input"></div>
2889 </div>
2890 </div>';
2891 echo '<ul id="mtnc-theme-builder-layout" class="mtnc-theme-builder">';
2892 echo '</ul>';
2893 echo '</div>';
2894
2895
2896
2897 $this->tab_footer('design');
2898 echo '</div>';
2899
2900 echo '<input type="hidden" name="theme" id="theme" value="">';
2901 } // tab_design_layout
2902
2903 /**
2904 * Echoes content for design-css tab
2905 *
2906 * @return null
2907 */
2908 public function tab_design_css()
2909 {
2910 echo '<div class="mtnc-tile-title">Custom CSS</div>';
2911 echo '<p>Custom CSS applies to current theme only. Please double-check any custom code you enter in the settings below. Any typos or mistakes will affect the appearance of the page.</p>';
2912 echo '<div id="custom_css_editor"></div>';
2913 echo '<textarea class="mtnc-form-control" id="custom_css" name="custom_css">' . esc_html($this->theme->custom_css) . '</textarea>';
2914 echo '<p class="mtnc-form-help-block">Write only the CSS code. Do not include the &lt;style&gt; tags. Code is placed in the page\'s &lt;head&gt; tag.</p>';
2915 $this->tab_footer('design');
2916 } //tab_design_css
2917
2918 /**
2919 * Echoes content for settings tab
2920 *
2921 * @return null
2922 */
2923 private function tab_seo()
2924 {
2925 $options = $this->get_options();
2926 echo '<div class="mtnc-tile-title">SEO</div>';
2927 echo '<p>Carefully craft your content in order to rank your site as best as possible from day one. Use the SEO Analysis tool to improve weak areas.</p>';
2928
2929 //SEO Preview and Analysis
2930 echo '<div class="mtnc-double-group clearfix" style="margin-top:20px; padding-bottom:20px; display: flex;">';
2931 echo '<div class="mtnc-seo-snippet mtnc-form-group">';
2932 echo '<div class="mtnc-strong">SEO Snippet Preview</div>';
2933 echo '<br />';
2934 echo '<div class="mtnc-seo-snippet-preview">';
2935 echo '<h3 id="mtnc-seo-snippet-title">' . esc_attr(stripslashes($options['title'])) . '</h3>';
2936 echo '<cite id="mtnc-seo-snippet-url">' . esc_url(home_url()) . '</cite>';
2937 echo '<div id="mtnc-seo-snippet-description">' . esc_attr(stripslashes($options['description'])) . '</div>';
2938 echo '<br />';
2939 echo '<label for="target_keyword" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-target-keyword">Target Keyword <sup>PRO</sup></label>';
2940 echo '<input type="text" name="target_keyword" id="target_keyword" value="maintenance" placeholder="Pick the main keyword or phrase that this page focuses on" class="mtnc-form-control pro-option open-pro-dialog pro-disabled" data-pro-feature="seo-target-keyword">';
2941 echo '<div id="mtnc-seo-gage">
2942 <svg height="100%" version="1.1" width="280px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="overflow: hidden; position: relative; top: -0.96875px;"><desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Created with Raphaël 2.2.0</desc><defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><filter id="inner-shadow-mtnc-seo-gage"><feOffset dx="0" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs><path fill="#edebeb" stroke="none" d="M93.40556249999999,123.36240000000001L64.49249999999999,123.36240000000001A77.1015,77.1015,0,0,1,218.69549999999998,123.36240000000001L189.78243750000001,123.36240000000001A48.188437500000006,48.188437500000006,0,0,0,93.40556249999999,123.36240000000001Z" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" filter="url(#inner-shadow-mtnc-seo-gage)"></path><path fill="#f6b501" stroke="none" d="M93.40556249999999,123.36240000000001L64.49249999999999,123.36240000000001A77.1015,77.1015,0,0,1,153.65533190629938,47.210147407604L149.13233244143711,75.7672421297525A48.188437500000006,48.188437500000006,0,0,0,93.40556249999999,123.36240000000001Z" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" filter="url(#inner-shadow-mtnc-seo-gage)"></path><text x="141.594" y="24.09421875" text-anchor="middle" font-family="sans-serif" font-size="15px" stroke="none" fill="#666666" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-family: sans-serif; font-size: 15px; font-weight: bold; fill-opacity: 1;" font-weight="bold" fill-opacity="1"><tspan dy="0" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Page SEO Score</tspan></text><text x="141.594" y="120.94352941176471" text-anchor="middle" font-family="Arial" font-size="23px" stroke="none" fill="#010101" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-family: Arial; font-size: 23px; font-weight: bold; fill-opacity: 1;" font-weight="bold" fill-opacity="1"><tspan dy="0" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">55</tspan></text><text x="141.594" y="137.80529864253396" text-anchor="middle" font-family="Arial" font-size="10px" stroke="none" fill="#b3b3b3" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-family: Arial; font-size: 10px; font-weight: normal; fill-opacity: 1;" font-weight="normal" fill-opacity="1"><tspan dy="0" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></tspan></text><text x="78.94903124999999" y="137.80529864253396" text-anchor="middle" font-family="Arial" font-size="10px" stroke="none" fill="#b3b3b3" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-family: Arial; font-size: 10px; font-weight: normal; fill-opacity: 1;" font-weight="normal" fill-opacity="1"><tspan dy="0" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">0</tspan></text><text x="204.23896874999997" y="137.80529864253396" text-anchor="middle" font-family="Arial" font-size="10px" stroke="none" fill="#b3b3b3" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font-family: Arial; font-size: 10px; font-weight: normal; fill-opacity: 1;" font-weight="normal" fill-opacity="1"><tspan dy="0" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">100</tspan></text></svg>
2943 </div></div>';
2944 echo '</div>';
2945
2946 echo '<div class="mtnc-seo-analysis mtnc-form-group">';
2947 echo '<div class="mtnc-strong">SEO Analysis</div>';
2948 echo '<br />';
2949 echo '<div id="mtnc-seo-results" class="clearfix"><div class="mtnc-strong">Problems:</div><ul><li class="mtnc-test-bad">Target keyword does not appear in page <a class="goto-anchor" href="#description">meta description</a>.</li><li class="mtnc-test-bad">Keyword density in content is 4.76%, which is over the advised 2% maximum; the keyword was found 1 times in <a class="mtnc-change-tab" href="#design-layout">content</a>.</li><li class="mtnc-test-bad">Target keyword does not appear in the <a class="mtnc-change-tab" href="#design-logo">logo title</a>.</li><li class="mtnc-test-bad">Target keyword does not appear in the <a class="mtnc-change-tab" href="#design-header">page header</a>.</li></ul><div class="mtnc-strong">Potential Improvements:</div><ul><li class="mtnc-test-warning">Page <a href="#title" class="goto-anchor">SEO title</a> is too short. Keep the length between 40 and 60 characters.</li></ul><div class="mtnc-strong">Good Results:</div><ul><li class="mtnc-test-good">The page is not blocking search engines.</li><li class="mtnc-test-good">Target keyword appears in the page title.</li><li class="mtnc-test-good">Page meta description length is good.</li><li class="mtnc-test-good">Target keyword appears in the page URL.</li><li class="mtnc-test-good">Target keyword is set.</li></ul></div>';
2950 echo '</div>';
2951 echo '</div>';
2952
2953 echo '<div class="mtnc-double-group clearfix" id="seotitle">';
2954 //SEO Title
2955 echo '<div class="mtnc-form-group">';
2956 echo '<label for="title" class="mtnc-strong">SEO Title</label>';
2957 echo '<input type="text" name="title" id="title" data-site-title="' . esc_html(get_bloginfo('name')) . '" value="' . esc_attr(stripslashes($options['title'])) . '" placeholder="%sitetitle% is under maintenance" class="mtnc-form-control">';
2958 echo '<div class="mtnc-seo-progress " id="mtnc-seo-progress-title">';
2959 echo '<div class="mtnc-seo-progress-bar"></div>';
2960 echo '</div>';
2961 echo '<p class="mtnc-form-help-block">Recommended format: <i>Primary Keyword - Secondary Keyword - Brand Name</i> with length up to 60 characters.<br>Use <i>%sitetitle%</i> and <i>%sitetagline%</i> to grab settings from WP.</p>';
2962 echo '</div>';
2963
2964 //Meta Description
2965 echo '<div class="mtnc-form-group">';
2966 echo '<label for="description" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-description">Meta Description <sup>PRO</sup></label>';
2967 echo '<textarea type="text" name="description" id="description" data-site-description="' . esc_html(get_bloginfo('description')) . '" rows="3" class="mtnc-form-control open-pro-dialog pro-disabled">' . esc_html(get_bloginfo('description')) . '</textarea>';
2968 echo '<div class="mtnc-seo-progress " id="mtnc-seo-progress-description">';
2969 echo '<div class="mtnc-seo-progress-bar"></div>';
2970 echo '</div>';
2971 echo '<p class="mtnc-form-help-block">Write for humans, not search engines! This text will incite people to click on your site on Google. The length should be 50 - 300 characters.</p>';
2972 echo '</div>';
2973 echo '</div>';
2974
2975 echo '<div class="mtnc-double-group clearfix" id="mtnc-blockse">';
2976
2977 //Show normal website to Search Engines?
2978 echo '<div class="mtnc-form-group">';
2979 echo '<label for="excludese" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-show-normal-site">Show normal website to Search Engines? <sup>PRO</sup></label>';
2980 echo '<div class="toggle-wrapper">';
2981 echo '<input type="checkbox" class="mtnc-form-ios open-pro-dialog open-pro-dialog pro-disabled" name="excludese" id="excludese" value="1">';
2982 echo '<label for="excludese" class="toggle"><span class="toggle_handler"></span></label>';
2983 echo '</div>';
2984 echo '<p class="mtnc-form-help-block">If enabled, search engines will always see your normal page, never the maintenance one. We do not recommend enabling this feature.</p>';
2985 echo '</div>';
2986
2987 //Discourage Search Engine crawlers
2988 echo '<div class="mtnc-form-group">';
2989 echo '<label for="blockse" class="mtnc-strong">Enable 503 <i>(Service Unavailable)</i> status code to discourage Search Engine crawlers</label>';
2990 echo '<div class="toggle-wrapper">';
2991 echo '<input type="checkbox" class="mtnc-form-ios" name="blockse" id="blockse" value="1" ' . checked('1', $options['blockse'], false) . '>';
2992 echo '<label for="blockse" class="toggle"><span class="toggle_handler"></span></label>';
2993 echo '</div>';
2994 echo '<p class="mtnc-form-help-block">If your site is already indexed and you\'re just taking it down for a while, enable this option. It temporarily discourages search engines from crawling the site by telling them it\'s unavailable by sending a <i>503 Service Unavailable</i> response.</p>';
2995 echo '</div>';
2996 echo '</div>';
2997
2998 echo '<div class="mtnc-double-group mtnc-clearfix" style="flex-wrap: wrap;">';
2999 //Favicon
3000 echo '<div class="mtnc-form-group border-fix">';
3001 echo '<div class="mtnc-image-upload-wrapper">';
3002 echo '<label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-favicon">Favicon Image <sup>PRO</sup></label>';
3003 echo '<input type="hidden" name="favicon" id="favicon" class="mtnc-image-upload-input" value="' . esc_attr($options['favicon']) . '">';
3004
3005 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($options['favicon']) ? 'style="background-image:url(\'' . esc_attr($options['favicon']) . '\')"' : '') . '>';
3006 if (empty($options['favicon'])) {
3007 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
3008 }
3009 echo '<button type="button" name="bg_upload" class="mtnc-btn open-pro-dialog" style="margin-top: 4px" data-pro-feature="seo-favicon">Open images gallery</button>';
3010
3011 echo '</div>';
3012 echo '<p class="mtnc-form-help-block" style="padding: 0 10px;">Make sure the image is square (1:1 ratio). PNG will do just fine, about 64x64px. Don\'t go over 256x256px.</p>';
3013 echo '</div>';
3014 echo '</div>';
3015
3016 //Social Preview Image
3017 echo '<div class="mtnc-form-group border-fix">';
3018 echo '<div class="mtnc-image-upload-wrapper">';
3019 echo '<label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-social-preview">Social Preview Image <sup>PRO</sup></label>';
3020 echo '<input type="hidden" name="social_preview" id="social_preview" class="mtnc-image-upload-input" value="' . esc_attr($options['social_preview']) . '">';
3021
3022 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($options['favicon']) ? 'style="background-image:url(\'' . esc_attr($options['social_preview']) . '\')"' : '') . '>';
3023 if (empty($options['social_preview'])) {
3024 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
3025 }
3026 echo '<button type="button" name="bg_upload" class="mtnc-btn open-pro-dialog" data-pro-feature="seo-social-preview" style="margin-top: 4px">Open images gallery</button>';
3027
3028 echo '</div>';
3029
3030 echo '<p class="mtnc-form-help-block" style="padding: 0 10px;">Image ratio should be 1:2. Facebook recommends 1200x630px. Minimum should be 600x315px.</p>';
3031 echo '</div>';
3032 echo '</div>';
3033
3034
3035 echo '</div>';
3036
3037 echo '<div class="mtnc-double-group mtnc-clearfix">';
3038 //Google Analytics Tracking ID
3039 echo '<div class="mtnc-form-group">';
3040 echo '<label for="analytics" class="mtnc-strong">Google Analytics Tracking ID</label>';
3041 echo '<input name="analytics" id="analytics" placeholder="UA-123456-99" value="' . esc_attr($options['analytics']) . '">';
3042
3043 echo '<p class="mtnc-form-help-block">Enter only the Google Analytics Profile ID, ie: UA-123456-99. You\'ll find it in the GA tracking code.</p>';
3044 echo '</div>';
3045
3046 //Tracking Pixel and 3rd Party Analytics Code
3047 echo '<div class="mtnc-form-group">';
3048 echo '<label for="tracking_pixel" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-tracking-pixel">Tracking Pixel &amp; 3rd Party Analytics Code <sup>PRO</sup></label>';
3049 echo '<textarea name="tracking_pixel" id="tracking_pixel" class="open-pro-dialog pro-disabled" placeholder="Tracking pixel code or any 3rd party tracking code, including <script> tags"></textarea>';
3050 echo '<p class="mtnc-form-help-block">Copy&amp;paste the complete code, including the opening and closing <i>&lt;script&gt;</i> tags. The code is outputted in the page\'s header section.</p>';
3051 echo '</div>';
3052 echo '</div>';
3053
3054 echo '<div class="mtnc-double-group clearfix">';
3055 //Facebook Page URL
3056 echo '<div class="mtnc-form-group"><label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-facebook-page" for="facebook_site">Facebook Page URL <sup>PRO</sup></label>';
3057 echo '<input class="mtnc-form-control open-pro-dialog pro-disabled" placeholder="https://www.facebook.com/page-name-123/" type="text" id="facebook_site" name="facebook_site" value="">';
3058 echo '<p class="mtnc-form-help-block">Full URL to your Facebook page, including the <i>https://</i> prefix.</p>';
3059 echo '</div>';
3060
3061 //Twitter @username
3062 echo '<div class="mtnc-form-group"><label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-twitter" for="twitter_site">X (Twitter) @username <sup>PRO</sup></label>';
3063 echo '<input class="mtnc-form-control open-pro-dialog pro-disabled" placeholder="@mytwitterhandle" type="text" id="twitter_site" name="twitter_site" value="">';
3064 echo '<p class="mtnc-form-help-block">X (Twitter) handle name including the @ sign, ie: @john.</p>';
3065 echo '</div>';
3066 echo '</div>';
3067 $this->tab_footer();
3068 } // tab_seo
3069
3070 /**
3071 * Echoes content for advanced tab
3072 *
3073 * @return null
3074 */
3075 private function tab_advanced()
3076 {
3077 $options = $this->get_options();
3078
3079 echo '<div class="mtnc-tile-title">Advanced</div>';
3080 echo '<p>Please double-check any custom code you enter in the settings below. Any typos or mistakes will affect the appearance of the page.</p>';
3081
3082 echo '<div class="mtnc-double-group clearfix">';
3083 echo '<div class="mtnc-form-group">';
3084 echo '<a class="mtnc-btn open-pro-dialog pro-button" data-pro-feature="export-settings">Export Settings <sup>PRO</sup></a>';
3085 echo '<p class="mtnc-form-help-block">All settings are exported except themes. If you would like to export themes, please go to the Themes tab. You can safely transfer (export and then import) settings between different domains/sites.</p>';
3086 echo '</div>';
3087
3088 echo '<div class="mtnc-form-group">';
3089 echo '<div data-caption="Import Settings" class="mtnc-btn open-pro-dialog pro-button" data-pro-feature="import-settings" style="float:left;">Import Settings <sup>PRO</sup></div>';
3090 echo '<p class="mtnc-form-help-block">All settings are imported and overwritten. Themes are not imported. If you want to import themes go to the Themes tab.</p>';
3091 echo '</div>';
3092 echo '</div>';
3093
3094 echo '<div class="mtnc-double-group clearfix">';
3095 echo '<div class="mtnc-form-group">';
3096 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
3097 echo '<a data-confirm-title="Are you sure you want to reset all Maintenance settings, including the theme?" data-confirm-button="Reset settings" data-confirm-text="All settings are reset to default values. <strong>There is NO undo!</strong>" href="' . esc_url(add_query_arg(array('_wpnonce' => wp_create_nonce('mtnc_admin_action'), 'action' => 'mtnc_reset_settings', 'reset' => 'settings', 'redirect' => urlencode($request_uri)), admin_url('admin.php'))) . '" class="mtnc-btn mtnc-confirm">Reset Settings</a>';
3098 echo '<p class="mtnc-form-help-block">All settings are reset to default values. There is NO undo.</p>';
3099 echo '</div>';
3100 echo '</div>';
3101
3102 echo '<div class="mtnc-double-group clearfix">';
3103
3104 echo '<div class="mtnc-form-group">';
3105 echo '<label for="no_cache_headers" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-no-cache-headers">Send no-cache Headers <sup>PRO</sup></label>';
3106 echo '<div class="toggle-wrapper">';
3107 echo '<input id="no_cache_headers" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="no_cache_headers" value="1">';
3108 echo '<label for="no_cache_headers" class="toggle"><span class="toggle_handler"></span></label>';
3109 echo '</div>';
3110 echo '<p class="mtnc-form-help-block">If you don\'t want the maintenance page\'s preview to be cached by Facebook and other social media, enable this option. Once you switch to the normal site, social media preview (visible when sharing the site\'s link) will immediately be refreshed. Normal visitors won\'t notice any differences with the option enabled.</p>';
3111 echo '</div>';
3112
3113 $plugin_name = 'Maintenance';
3114
3115 echo '<div class="mtnc-form-group">';
3116 echo '<label for="disable_toolbar_menu" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="disable-menu">Disable Maintenance Toolbar Menu <sup>PRO</sup></label>';
3117 echo '<div class="toggle-wrapper">';
3118 echo '<input id="disable_toolbar_menu" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="disable_toolbar_menu" value="1">';
3119 echo '<label for="disable_toolbar_menu" class="toggle"><span class="toggle_handler"></span></label>';
3120 echo '</div>';
3121 echo '<p class="mtnc-form-help-block">By default, a helpful ' . esc_html($plugin_name) . ' menu and status are added to the admin and front-end toolbar. If your toolbar is too crowded, disable the menu.</p>';
3122 echo '</div>';
3123
3124 echo '</div>';
3125
3126 echo '<div class="mtnc-double-group clearfix">';
3127
3128 echo '<div class="mtnc-form-group">';
3129 echo '<label for="force_ssl" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="force-ssl">Force SSL on maintenance page <sup>PRO</sup></label>';
3130 echo '<div class="toggle-wrapper">';
3131 echo '<input id="force_ssl" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="force_ssl" value="1">';
3132 echo '<label for="force_ssl" class="toggle"><span class="toggle_handler"></span></label>';
3133 echo '</div>';
3134 echo '<p class="mtnc-form-help-block">If you have a valid SSL certificate installed on your site but people are still visiting the non-secure HTTP version, you can redirect them to HTTPS. The redirection only works for the maintenance page, not for the entire site and not for the preview.<br>
3135 DO NOT enable this option unless you have a valid SSL certificate installed. Check if you do by opening your site via the HTTPS protocol - <i><a href="' . esc_html(str_ireplace('http://', 'https://', home_url('/'))) . '" target="_blank">' . esc_html(str_ireplace('http://', 'https://', home_url('/'))) . '</a></i>.</p>';
3136 echo '</div>';
3137
3138 echo '<div class="mtnc-form-group">';
3139 echo '<label for="enable_rest" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="rest-api">Enable WordPress Rest API <sup>PRO</sup></label>';
3140 echo '<div class="toggle-wrapper">';
3141 echo '<input id="enable_rest" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="enable_rest" value="1">';
3142 echo '<label for="enable_rest" class="toggle"><span class="toggle_handler"></span></label>';
3143 echo '</div>';
3144 echo '<p class="mtnc-form-help-block">Allow WordPress REST API calls while maintenance mode is enabled.</p>';
3145 echo '</div>';
3146
3147 echo '</div>';
3148
3149 echo '<div class="mtnc-form-group clearfix">';
3150 echo '<label for="custom_wp_maintenance" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="customize-builtin-page">Customize the built-in WordPress maintenance page <sup>PRO</sup></label>';
3151 echo '<div class="toggle-wrapper">';
3152 echo '<input id="custom_wp_maintenance" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="custom_wp_maintenance" value="1">';
3153 echo '<label for="custom_wp_maintenance" class="toggle"><span class="toggle_handler"></span></label>';
3154 echo '</div>';
3155 echo '<p class="mtnc-form-help-block">The built-in WordPress maintenance mode page is automatically shown to everybody (visitors and admins) for a few moments when WordPress is doing updates to themes, plugins, or core. It\'s a built-in feature and its behaviour can\'t be changed. This page can\'t contain any interactive elements such as a contact forms because when updates are performed the database and some files might not be accessible.<br>
3156 By default the page is quite ugly and the content can\'t be easily changed (you can read about it in this <a href="https://wpreset.com/disable-enable-modify-wordpress-maintenance-page/" target="_blank">article</a>). This option enables you do have a nicer maintenance page with your custom text on it. It\'s still automatically enabled and disabled by WordPress.</p>';
3157 echo '</div>';
3158
3159 echo '<div class="mtnc-form-group clearfix custom_wp_maintenance_options">';
3160 echo '<label for="custom_wp_maintenance_title" class="mtnc-strong">Maintenance page title</label>';
3161 echo '<input class="mtnc-form-control" placeholder="" type="text" id="custom_wp_maintenance_title" name="custom_wp_maintenance_title" value="">';
3162 echo '</div>';
3163
3164 echo '<div class="mtnc-form-group clearfix custom_wp_maintenance_options">';
3165 echo '<label for="custom_wp_maintenance_title" class="mtnc-strong">Maintenance page content</label>';
3166 wp_editor(stripslashes($options['custom_wp_maintenance_content']), 'custom_wp_maintenance_content', $settings = array(
3167 'textarea_rows' => 10,
3168 'media_buttons' => 1,
3169 'teeny' => false,
3170 'editor_class' => 'skip_save',
3171 ));
3172 echo '</div>';
3173
3174 $this->tab_footer();
3175 } // tab_advanced
3176
3177
3178 /**
3179 * Reset Settings
3180 *
3181 * @return null
3182 */
3183 public function mtnc_reset_settings()
3184 {
3185 check_admin_referer('mtnc_admin_action');
3186
3187 if (!current_user_can('manage_options')) {
3188 wp_send_json_error(__('You are not allowed to run this action.', 'maintenance'));
3189 }
3190
3191 $options = $this->get_options();
3192 $default_theme_id = md5(time() . 'default');
3193 $reset = sanitize_text_field(wp_unslash($_GET['reset'] ?? '')) == 'settings' ? 'settings':'theme';
3194
3195 if($reset == 'theme'){
3196 $new_options = $options;
3197 } else {
3198 $new_options = array(
3199 'status' => '0',
3200 'mode' => 'layout',
3201 'mtnc_page' => 0,
3202 'header_text' => 'Our site is under maintenance!',
3203 //SEO
3204 'title' => get_bloginfo('name') . ' is under maintenance',
3205 'description' => 'We are doing some work on our site. Please come back later. We\'ll be up and running in no time.',
3206 'target_keyword' => 'maintenance',
3207 'excludese' => '0',
3208 'blockse' => '0',
3209 'favicon' => '',
3210 'social_preview' => '',
3211 'analytics' => '',
3212 'tracking_pixel' => '',
3213 'twitter_site' => '',
3214 'facebook_site' => '',
3215 //Access
3216 'show_logged_in' => '1',
3217 'ip_whitelist' => '',
3218 'per_url_settings' => '',
3219 'per_url_enable_disable' => '',
3220 'direct_access_link' => '',
3221 'custom_login_url' => '',
3222 'login_button' => '1',
3223 'wplogin_button_tooltip' => 'Access WordPress admin',
3224 'maintenance_password' => '',
3225 'site_password' => '',
3226 'password_button' => '0',
3227 'login_button_text' => 'Access the Site',
3228 'login_message' => 'Please enter the password to access the site',
3229 'login_wrong_password_text' => 'Wrong password',
3230 'login_button_tooltip' => 'Direct Access login',
3231 //Advanced
3232 'no_cache_headers' => '1',
3233 'disable_toolbar_menu' => '',
3234 'force_ssl' => '',
3235 'enable_rest' => '',
3236 'custom_wp_maintenance' => '',
3237 'custom_wp_maintenance_title' => '',
3238 'custom_wp_maintenance_content' => '',
3239 'upgraded' => $options['upgraded']
3240 );
3241 }
3242
3243 $new_options['theme_global'] = $default_theme_id;
3244 $new_options['themes'] = array($default_theme_id => json_decode(
3245 '{
3246 "modules": {
3247 "header-dbd02cd1": {
3248 "name": "Header",
3249 "type": "header",
3250 "groups": {
3251 "header": {
3252 "name": "Header",
3253 "active": true,
3254 "fields": {
3255 "text": {
3256 "type": "text",
3257 "name": "text",
3258 "label": "Text",
3259 "value": "Site is undergoing maintenance",
3260 "class": "full-width",
3261 "desc": ""
3262 },
3263 "text_align": {
3264 "type": "radio",
3265 "name": "text_align",
3266 "label": "Text Align",
3267 "class": "",
3268 "values": {
3269 "left": "Left",
3270 "center": "Center",
3271 "right": "Right"
3272 },
3273 "value": "center"
3274 },
3275 "font_size": {
3276 "type": "range",
3277 "name": "font_size",
3278 "label": "Font Size",
3279 "value": "47",
3280 "min": 6,
3281 "max": 120,
3282 "class": "",
3283 "units": {
3284 "px": "px",
3285 "pt": "pt",
3286 "em": "em"
3287 },
3288 "unit_value": "px"
3289 },
3290 "color": {
3291 "type": "color",
3292 "name": "text_color",
3293 "label": "Color",
3294 "value": "rgba(255,255,255,1)",
3295 "desc": ""
3296 },
3297 "font": {
3298 "type": "font",
3299 "name": "font",
3300 "label": "Font",
3301 "value": "Open Sans",
3302 "class": "full-width",
3303 "desc": ""
3304 },
3305 "line_height": {
3306 "type": "number",
3307 "name": "line_height",
3308 "label": "Line Height",
3309 "value": "2",
3310 "units": {
3311 "px": "px",
3312 "percent": "%",
3313 "em": "em"
3314 },
3315 "unit_value": "em",
3316 "class": "number_small",
3317 "desc": ""
3318 }
3319 }
3320 },
3321 "layout": {
3322 "name": "Layout",
3323 "fields": {
3324 "padding_label": {
3325 "type": "label",
3326 "name": "padding_label",
3327 "label": "Padding"
3328 },
3329 "padding_top": {
3330 "type": "number",
3331 "name": "padding_top",
3332 "label": "Top",
3333 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
3334 "value": "10",
3335 "class": "number_small",
3336 "units": {
3337 "px": "px",
3338 "percent": "%",
3339 "em": "em"
3340 },
3341 "unit_value": "px",
3342 "wrapper_class": "col-4"
3343 },
3344 "padding_bottom": {
3345 "type": "number",
3346 "name": "padding_bottom",
3347 "label": "Bottom",
3348 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
3349 "value": "10",
3350 "class": "number_small",
3351 "units": {
3352 "px": "px",
3353 "percent": "%",
3354 "em": "em"
3355 },
3356 "unit_value": "px",
3357 "wrapper_class": "col-4"
3358 },
3359 "padding_left": {
3360 "type": "number",
3361 "name": "padding_left",
3362 "label": "Left",
3363 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
3364 "value": "0",
3365 "class": "number_small",
3366 "units": {
3367 "px": "px",
3368 "percent": "%",
3369 "em": "em"
3370 },
3371 "unit_value": "px",
3372 "wrapper_class": "col-4"
3373 },
3374 "padding_right": {
3375 "type": "number",
3376 "name": "padding_right",
3377 "label": "Right",
3378 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
3379 "value": "0",
3380 "class": "number_small",
3381 "units": {
3382 "px": "px",
3383 "percent": "%",
3384 "em": "em"
3385 },
3386 "unit_value": "px",
3387 "wrapper_class": "col-4"
3388 },
3389 "margin_label": {
3390 "type": "label",
3391 "name": "margin_label",
3392 "label": "Margin"
3393 },
3394 "margin_top": {
3395 "type": "number",
3396 "name": "margin_top",
3397 "label": "Top",
3398 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
3399 "value": "0",
3400 "class": "number_small",
3401 "units": {
3402 "px": "px",
3403 "percent": "%",
3404 "em": "em"
3405 },
3406 "unit_value": "px",
3407 "wrapper_class": "col-4"
3408 },
3409 "margin_bottom": {
3410 "type": "number",
3411 "name": "margin_bottom",
3412 "label": "Bottom",
3413 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
3414 "value": "0",
3415 "class": "number_small",
3416 "units": {
3417 "px": "px",
3418 "percent": "%",
3419 "em": "em"
3420 },
3421 "unit_value": "px",
3422 "wrapper_class": "col-4"
3423 },
3424 "margin_left": {
3425 "type": "number",
3426 "name": "margin_left",
3427 "label": "Left",
3428 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
3429 "value": "0",
3430 "class": "number_small",
3431 "units": {
3432 "px": "px",
3433 "percent": "%",
3434 "em": "em"
3435 },
3436 "unit_value": "px",
3437 "wrapper_class": "col-4"
3438 },
3439 "margin_right": {
3440 "type": "number",
3441 "name": "margin_right",
3442 "label": "Right",
3443 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
3444 "value": "0",
3445 "class": "number_small",
3446 "units": {
3447 "px": "px",
3448 "percent": "%",
3449 "em": "em"
3450 },
3451 "unit_value": "px",
3452 "wrapper_class": "col-4"
3453 },
3454 "background_label": {
3455 "type": "label",
3456 "name": "background_label",
3457 "label": "Background"
3458 },
3459 "background_color": {
3460 "type": "color",
3461 "name": "background_color",
3462 "nolabel": true,
3463 "value": "rgba(255,255,255,0)",
3464 "desc": ""
3465 },
3466 "background": {
3467 "type": "image",
3468 "name": "background",
3469 "nolabel": true,
3470 "value": "",
3471 "class": "",
3472 "desc": ""
3473 }
3474 }
3475 }
3476 }
3477 },
3478 "content-471365b7": {
3479 "name": "Content",
3480 "type": "content",
3481 "groups": {
3482 "col1": {
3483 "name": "Footer",
3484 "active": true,
3485 "fields": {
3486 "text": {
3487 "type": "textarea",
3488 "name": "text",
3489 "label": "Text",
3490 "value": "Maintenance mode is on",
3491 "class": "full-width",
3492 "desc": ""
3493 },
3494 "font_size": {
3495 "type": "number",
3496 "name": "font_size",
3497 "label": "Font Size",
3498 "value": "36",
3499 "class": "number_small",
3500 "units": {
3501 "px": "px",
3502 "pt": "pt",
3503 "em": "em"
3504 },
3505 "unit_value": "px"
3506 },
3507 "color": {
3508 "type": "color",
3509 "name": "text_color",
3510 "label": "Color",
3511 "value": "rgba(255,255,255,1)",
3512 "desc": ""
3513 },
3514 "font": {
3515 "type": "font",
3516 "name": "font",
3517 "label": "Font",
3518 "value": "Open Sans",
3519 "class": "full-width",
3520 "desc": ""
3521 },
3522 "line_height": {
3523 "type": "number",
3524 "name": "line_height",
3525 "label": "Line Height",
3526 "value": "1",
3527 "units": {
3528 "px": "px",
3529 "percent": "%",
3530 "em": "em"
3531 },
3532 "unit_value": "em",
3533 "class": "number_small",
3534 "desc": ""
3535 }
3536 }
3537 },
3538 "layout": {
3539 "name": "Layout",
3540 "fields": {
3541 "padding_label": {
3542 "type": "label",
3543 "name": "padding_label",
3544 "label": "Padding"
3545 },
3546 "padding_top": {
3547 "type": "number",
3548 "name": "padding_top",
3549 "label": "Top",
3550 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
3551 "value": "100",
3552 "class": "number_small",
3553 "units": {
3554 "px": "px",
3555 "percent": "%",
3556 "em": "em"
3557 },
3558 "unit_value": "px",
3559 "wrapper_class": "col-4"
3560 },
3561 "padding_bottom": {
3562 "type": "number",
3563 "name": "padding_bottom",
3564 "label": "Bottom",
3565 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
3566 "value": "10",
3567 "class": "number_small",
3568 "units": {
3569 "px": "px",
3570 "percent": "%",
3571 "em": "em"
3572 },
3573 "unit_value": "px",
3574 "wrapper_class": "col-4"
3575 },
3576 "padding_left": {
3577 "type": "number",
3578 "name": "padding_left",
3579 "label": "Left",
3580 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
3581 "value": "0",
3582 "class": "number_small",
3583 "units": {
3584 "px": "px",
3585 "percent": "%",
3586 "em": "em"
3587 },
3588 "unit_value": "px",
3589 "wrapper_class": "col-4"
3590 },
3591 "padding_right": {
3592 "type": "number",
3593 "name": "padding_right",
3594 "label": "Right",
3595 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
3596 "value": "0",
3597 "class": "number_small",
3598 "units": {
3599 "px": "px",
3600 "percent": "%",
3601 "em": "em"
3602 },
3603 "unit_value": "px",
3604 "wrapper_class": "col-4"
3605 },
3606 "margin_label": {
3607 "type": "label",
3608 "name": "margin_label",
3609 "label": "Margin"
3610 },
3611 "margin_top": {
3612 "type": "number",
3613 "name": "margin_top",
3614 "label": "Top",
3615 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
3616 "value": "0",
3617 "class": "number_small",
3618 "units": {
3619 "px": "px",
3620 "percent": "%",
3621 "em": "em"
3622 },
3623 "unit_value": "px",
3624 "wrapper_class": "col-4"
3625 },
3626 "margin_bottom": {
3627 "type": "number",
3628 "name": "margin_bottom",
3629 "label": "Bottom",
3630 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
3631 "value": "0",
3632 "class": "number_small",
3633 "units": {
3634 "px": "px",
3635 "percent": "%",
3636 "em": "em"
3637 },
3638 "unit_value": "px",
3639 "wrapper_class": "col-4"
3640 },
3641 "margin_left": {
3642 "type": "number",
3643 "name": "margin_left",
3644 "label": "Left",
3645 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
3646 "value": "0",
3647 "class": "number_small",
3648 "units": {
3649 "px": "px",
3650 "percent": "%",
3651 "em": "em"
3652 },
3653 "unit_value": "px",
3654 "wrapper_class": "col-4"
3655 },
3656 "margin_right": {
3657 "type": "number",
3658 "name": "margin_right",
3659 "label": "Right",
3660 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
3661 "value": "0",
3662 "class": "number_small",
3663 "units": {
3664 "px": "px",
3665 "percent": "%",
3666 "em": "em"
3667 },
3668 "unit_value": "px",
3669 "wrapper_class": "col-4"
3670 },
3671 "background_label": {
3672 "type": "label",
3673 "name": "background_label",
3674 "label": "Background"
3675 },
3676 "background_color": {
3677 "type": "color",
3678 "name": "background_color",
3679 "nolabel": true,
3680 "value": "rgba(255,255,255,0)",
3681 "desc": ""
3682 },
3683 "background": {
3684 "type": "image",
3685 "name": "background",
3686 "nolabel": true,
3687 "value": "",
3688 "class": "",
3689 "desc": ""
3690 }
3691 }
3692 }
3693 }
3694 },
3695 "content-9742e2f8": {
3696 "name": "Content",
3697 "type": "content",
3698 "groups": {
3699 "col1": {
3700 "name": "Footer",
3701 "active": true,
3702 "fields": {
3703 "text": {
3704 "type": "textarea",
3705 "name": "text",
3706 "label": "Text",
3707 "value": "Site will be available soon. Thank you for your patience!",
3708 "class": "full-width",
3709 "desc": ""
3710 },
3711 "font_size": {
3712 "type": "number",
3713 "name": "font_size",
3714 "label": "Font Size",
3715 "value": "20",
3716 "class": "number_small",
3717 "units": {
3718 "px": "px",
3719 "pt": "pt",
3720 "em": "em"
3721 },
3722 "unit_value": "px"
3723 },
3724 "color": {
3725 "type": "color",
3726 "name": "text_color",
3727 "label": "Color",
3728 "value": "rgba(255,255,255,1)",
3729 "desc": ""
3730 },
3731 "font": {
3732 "type": "font",
3733 "name": "font",
3734 "label": "Font",
3735 "value": "Open Sans",
3736 "class": "full-width",
3737 "desc": ""
3738 },
3739 "line_height": {
3740 "type": "number",
3741 "name": "line_height",
3742 "label": "Line Height",
3743 "value": "1",
3744 "units": {
3745 "px": "px",
3746 "percent": "%",
3747 "em": "em"
3748 },
3749 "unit_value": "em",
3750 "class": "number_small",
3751 "desc": ""
3752 }
3753 }
3754 },
3755 "layout": {
3756 "name": "Layout",
3757 "fields": {
3758 "padding_label": {
3759 "type": "label",
3760 "name": "padding_label",
3761 "label": "Padding"
3762 },
3763 "padding_top": {
3764 "type": "number",
3765 "name": "padding_top",
3766 "label": "Top",
3767 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
3768 "value": "10",
3769 "class": "number_small",
3770 "units": {
3771 "px": "px",
3772 "percent": "%",
3773 "em": "em"
3774 },
3775 "unit_value": "px",
3776 "wrapper_class": "col-4"
3777 },
3778 "padding_bottom": {
3779 "type": "number",
3780 "name": "padding_bottom",
3781 "label": "Bottom",
3782 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
3783 "value": "10",
3784 "class": "number_small",
3785 "units": {
3786 "px": "px",
3787 "percent": "%",
3788 "em": "em"
3789 },
3790 "unit_value": "px",
3791 "wrapper_class": "col-4"
3792 },
3793 "padding_left": {
3794 "type": "number",
3795 "name": "padding_left",
3796 "label": "Left",
3797 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
3798 "value": "0",
3799 "class": "number_small",
3800 "units": {
3801 "px": "px",
3802 "percent": "%",
3803 "em": "em"
3804 },
3805 "unit_value": "px",
3806 "wrapper_class": "col-4"
3807 },
3808 "padding_right": {
3809 "type": "number",
3810 "name": "padding_right",
3811 "label": "Right",
3812 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
3813 "value": "0",
3814 "class": "number_small",
3815 "units": {
3816 "px": "px",
3817 "percent": "%",
3818 "em": "em"
3819 },
3820 "unit_value": "px",
3821 "wrapper_class": "col-4"
3822 },
3823 "margin_label": {
3824 "type": "label",
3825 "name": "margin_label",
3826 "label": "Margin"
3827 },
3828 "margin_top": {
3829 "type": "number",
3830 "name": "margin_top",
3831 "label": "Top",
3832 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
3833 "value": "0",
3834 "class": "number_small",
3835 "units": {
3836 "px": "px",
3837 "percent": "%",
3838 "em": "em"
3839 },
3840 "unit_value": "px",
3841 "wrapper_class": "col-4"
3842 },
3843 "margin_bottom": {
3844 "type": "number",
3845 "name": "margin_bottom",
3846 "label": "Bottom",
3847 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
3848 "value": "0",
3849 "class": "number_small",
3850 "units": {
3851 "px": "px",
3852 "percent": "%",
3853 "em": "em"
3854 },
3855 "unit_value": "px",
3856 "wrapper_class": "col-4"
3857 },
3858 "margin_left": {
3859 "type": "number",
3860 "name": "margin_left",
3861 "label": "Left",
3862 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
3863 "value": "0",
3864 "class": "number_small",
3865 "units": {
3866 "px": "px",
3867 "percent": "%",
3868 "em": "em"
3869 },
3870 "unit_value": "px",
3871 "wrapper_class": "col-4"
3872 },
3873 "margin_right": {
3874 "type": "number",
3875 "name": "margin_right",
3876 "label": "Right",
3877 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
3878 "value": "0",
3879 "class": "number_small",
3880 "units": {
3881 "px": "px",
3882 "percent": "%",
3883 "em": "em"
3884 },
3885 "unit_value": "px",
3886 "wrapper_class": "col-4"
3887 },
3888 "background_label": {
3889 "type": "label",
3890 "name": "background_label",
3891 "label": "Background"
3892 },
3893 "background_color": {
3894 "type": "color",
3895 "name": "background_color",
3896 "nolabel": true,
3897 "value": "rgba(255,255,255,0)",
3898 "desc": ""
3899 },
3900 "background": {
3901 "type": "image",
3902 "name": "background",
3903 "nolabel": true,
3904 "value": "",
3905 "class": "",
3906 "desc": ""
3907 }
3908 }
3909 }
3910 }
3911 },
3912 "footer-a29820d6": {
3913 "name": "Footer",
3914 "type": "footer",
3915 "groups": {
3916 "col1": {
3917 "name": "Footer",
3918 "active": true,
3919 "fields": {
3920 "text": {
3921 "type": "textarea",
3922 "name": "text",
3923 "label": "Text",
3924 "value": "© Maintenance 2026",
3925 "class": "full-width",
3926 "desc": ""
3927 },
3928 "font_size": {
3929 "type": "number",
3930 "name": "font_size",
3931 "label": "Font Size",
3932 "value": "24",
3933 "class": "number_small",
3934 "units": {
3935 "px": "px",
3936 "pt": "pt",
3937 "em": "em"
3938 },
3939 "unit_value": "px"
3940 },
3941 "color": {
3942 "type": "color",
3943 "name": "text_color",
3944 "label": "Color",
3945 "value": "rgba(255,255,255,1)",
3946 "desc": ""
3947 },
3948 "font": {
3949 "type": "font",
3950 "name": "font",
3951 "label": "Font",
3952 "value": "Open Sans",
3953 "class": "full-width",
3954 "desc": ""
3955 },
3956 "line_height": {
3957 "type": "number",
3958 "name": "line_height",
3959 "label": "Line Height",
3960 "value": "1",
3961 "units": {
3962 "px": "px",
3963 "percent": "%",
3964 "em": "em"
3965 },
3966 "unit_value": "em",
3967 "class": "number_small",
3968 "desc": ""
3969 }
3970 }
3971 },
3972 "layout": {
3973 "name": "Layout",
3974 "fields": {
3975 "padding_label": {
3976 "type": "label",
3977 "name": "padding_label",
3978 "label": "Padding"
3979 },
3980 "padding_top": {
3981 "type": "number",
3982 "name": "padding_top",
3983 "label": "Top",
3984 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
3985 "value": "10",
3986 "class": "number_small",
3987 "units": {
3988 "px": "px",
3989 "percent": "%",
3990 "em": "em"
3991 },
3992 "unit_value": "px",
3993 "wrapper_class": "col-4"
3994 },
3995 "padding_bottom": {
3996 "type": "number",
3997 "name": "padding_bottom",
3998 "label": "Bottom",
3999 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
4000 "value": "10",
4001 "class": "number_small",
4002 "units": {
4003 "px": "px",
4004 "percent": "%",
4005 "em": "em"
4006 },
4007 "unit_value": "px",
4008 "wrapper_class": "col-4"
4009 },
4010 "padding_left": {
4011 "type": "number",
4012 "name": "padding_left",
4013 "label": "Left",
4014 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
4015 "value": "0",
4016 "class": "number_small",
4017 "units": {
4018 "px": "px",
4019 "percent": "%",
4020 "em": "em"
4021 },
4022 "unit_value": "px",
4023 "wrapper_class": "col-4"
4024 },
4025 "padding_right": {
4026 "type": "number",
4027 "name": "padding_right",
4028 "label": "Right",
4029 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
4030 "value": "0",
4031 "class": "number_small",
4032 "units": {
4033 "px": "px",
4034 "percent": "%",
4035 "em": "em"
4036 },
4037 "unit_value": "px",
4038 "wrapper_class": "col-4"
4039 },
4040 "margin_label": {
4041 "type": "label",
4042 "name": "margin_label",
4043 "label": "Margin"
4044 },
4045 "margin_top": {
4046 "type": "number",
4047 "name": "margin_top",
4048 "label": "Top",
4049 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
4050 "value": "0",
4051 "class": "number_small",
4052 "units": {
4053 "px": "px",
4054 "percent": "%",
4055 "em": "em"
4056 },
4057 "unit_value": "px",
4058 "wrapper_class": "col-4"
4059 },
4060 "margin_bottom": {
4061 "type": "number",
4062 "name": "margin_bottom",
4063 "label": "Bottom",
4064 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
4065 "value": "0",
4066 "class": "number_small",
4067 "units": {
4068 "px": "px",
4069 "percent": "%",
4070 "em": "em"
4071 },
4072 "unit_value": "px",
4073 "wrapper_class": "col-4"
4074 },
4075 "margin_left": {
4076 "type": "number",
4077 "name": "margin_left",
4078 "label": "Left",
4079 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
4080 "value": "0",
4081 "class": "number_small",
4082 "units": {
4083 "px": "px",
4084 "percent": "%",
4085 "em": "em"
4086 },
4087 "unit_value": "px",
4088 "wrapper_class": "col-4"
4089 },
4090 "margin_right": {
4091 "type": "number",
4092 "name": "margin_right",
4093 "label": "Right",
4094 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
4095 "value": "0",
4096 "class": "number_small",
4097 "units": {
4098 "px": "px",
4099 "percent": "%",
4100 "em": "em"
4101 },
4102 "unit_value": "px",
4103 "wrapper_class": "col-4"
4104 },
4105 "background_label": {
4106 "type": "label",
4107 "name": "background_label",
4108 "label": "Background"
4109 },
4110 "background_color": {
4111 "type": "color",
4112 "name": "background_color",
4113 "nolabel": true,
4114 "value": "rgba(255,255,255,0)",
4115 "desc": ""
4116 },
4117 "background": {
4118 "type": "image",
4119 "name": "background",
4120 "nolabel": true,
4121 "value": "",
4122 "class": "",
4123 "desc": ""
4124 }
4125 }
4126 }
4127 }
4128 }
4129 },
4130 "modules_order": {
4131 "header-dbd02cd1": "header-dbd02cd1",
4132 "content-471365b7": "content-471365b7",
4133 "content-9742e2f8": "content-9742e2f8",
4134 "footer-a29820d6": "footer-a29820d6"
4135 },
4136 "name": "Default",
4137 "theme_thumbnail": "",
4138 "theme_status": "",
4139 "body_font_size": "16",
4140 "body_font_color": "#FFFFFF",
4141 "body_font": "Open Sans",
4142 "body_link_color": "#0096FF",
4143 "body_link_hover_color": "#57BAFF",
4144 "background_type": "image",
4145 "background_video": "",
4146 "background_video_fallback": "",
4147 "background_video_filter": "",
4148 "background_size_opt": "cover",
4149 "background_position": "center center",
4150 "background_image_filter": "",
4151 "background_blur": 0,
4152 "background_image": "' . trailingslashit(MTNC_URL) . 'img/mt-sample-background.jpg",
4153 "preloader_background_image": "",
4154 "background_color": "rgba(0,0,0,1)",
4155 "login_background_color": "rgba(0,0,0,1)",
4156 "content_overlay": "",
4157 "content_width": 916,
4158 "content_overlay_color": "rgba(0,0,0,0.2)",
4159 "content_overlay_shadow_color": "rgba(0,0,0,0.2)",
4160 "content_position": "middle",
4161 "modules_spacing": 20,
4162 "custom_css": ".mtnc_module,\r\n.mtnc_module h2{\r\n\tfont-weight:300;\r\n}"
4163 }'
4164 )
4165 );
4166
4167 $this->update_options('options', $new_options);
4168
4169 if (!empty($_GET['redirect'])) {
4170 if($reset == 'theme'){
4171 wp_safe_redirect(admin_url('admin.php?page=maintenance&theme-reset=true'));
4172 } else {
4173 wp_safe_redirect(admin_url('admin.php?page=maintenance&settings-reset=true'));
4174 }
4175 }
4176
4177 die();
4178 }
4179
4180 /**
4181 * Create select options
4182 *
4183 * @param array $options Options
4184 * @param string $selected current value
4185 * @param bool $output current value
4186 *
4187 * @return string html if $output is false
4188 */
4189 public function create_select_options($options, $selected = null, $output = true)
4190 {
4191 $out = "\n";
4192 foreach ($options as $option) {
4193 $disabled = '';
4194 if (isset($option['disabled'])) {
4195 $disabled .= ' disabled="disabled" ';
4196 }
4197
4198 $out .= '<option value="' . $option['val'] . '" ' . selected($option['val'], $selected, false) . ' ' . $disabled . '>' . $option['label'] . '</option>';
4199 } // foreach
4200
4201 if ($output) {
4202 self::wp_kses_wf($out);
4203 } else {
4204 return $out;
4205 }
4206 } // create_select_options
4207
4208 /**
4209 * Generate CSS Style for a module for front-end display
4210 *
4211 * @param object $module object
4212 *
4213 * @return string CSS styles
4214 */
4215 public function get_module_style($module)
4216 {
4217 $styles = 'padding:0px; margin:' . round($this->theme->modules_spacing / 2) . 'px auto; text-align:center;';
4218
4219 //Padding
4220 if (!empty($module->groups->layout->fields->padding_top->value)) {
4221 $styles .= 'padding-top:' . $module->groups->layout->fields->padding_top->value . str_replace('percent', '%', $module->groups->layout->fields->padding_top->unit_value) . ';';
4222 }
4223 if (!empty($module->groups->layout->fields->padding_right->value)) {
4224 $styles .= 'padding-right:' . $module->groups->layout->fields->padding_right->value . str_replace('percent', '%', $module->groups->layout->fields->padding_right->unit_value) . ';';
4225 }
4226 if (!empty($module->groups->layout->fields->padding_bottom->value)) {
4227 $styles .= 'padding-bottom:' . $module->groups->layout->fields->padding_bottom->value . str_replace('percent', '%', $module->groups->layout->fields->padding_bottom->unit_value) . ';';
4228 }
4229 if (!empty($module->groups->layout->fields->padding_left->value)) {
4230 $styles .= 'padding-left:' . $module->groups->layout->fields->padding_left->value . str_replace('percent', '%', $module->groups->layout->fields->padding_left->unit_value) . ';';
4231 }
4232
4233 //Margin
4234 if (!empty($module->groups->layout->fields->margin_top->value)) {
4235 $styles .= 'margin-top:' . $module->groups->layout->fields->margin_top->value . str_replace('percent', '%', $module->groups->layout->fields->margin_top->unit_value) . ';';
4236 }
4237 if (!empty($module->groups->layout->fields->margin_right->value)) {
4238 $styles .= 'margin-right:' . $module->groups->layout->fields->margin_right->value . str_replace('percent', '%', $module->groups->layout->fields->margin_right->unit_value) . ';';
4239 }
4240 if (!empty($module->groups->layout->fields->margin_bottom->value)) {
4241 $styles .= 'margin-bottom:' . $module->groups->layout->fields->margin_bottom->value . str_replace('percent', '%', $module->groups->layout->fields->margin_bottom->unit_value) . ';';
4242 }
4243 if (!empty($module->groups->layout->fields->margin_left->value)) {
4244 $styles .= 'margin-left:' . $module->groups->layout->fields->margin_left->value . str_replace('percent', '%', $module->groups->layout->fields->margin_left->unit_value) . ';';
4245 }
4246
4247 //Background
4248 if (!empty($module->groups->layout->fields->background_color->value)) {
4249 $styles .= 'background-color:' . $module->groups->layout->fields->background_color->value . ';';
4250 }
4251
4252 if (!empty($module->groups->layout->fields->background->value)) {
4253 $styles .= 'background:url(' . $module->groups->layout->fields->background->value . ');';
4254 }
4255
4256 if ($module->type == 'footer') {
4257 $styles .= 'position:absolute; bottom:0px; left: 0px;';
4258 }
4259
4260 return $styles;
4261 }
4262
4263 /**
4264 * Convert GA Code
4265 *
4266 * @param string GA Code
4267 *
4268 * @return string GA Code
4269 */
4270 public function convert_ga($code)
4271 {
4272 if (empty($code) || strpos($code, '<script') === false) {
4273 return $code;
4274 }
4275
4276 preg_match_all('/(UA-[0-9]{3,10}-[0-9]{1,3})/i', $code, $matches, PREG_SET_ORDER, 0);
4277 if (!empty($matches[0][0])) {
4278 return $matches[0][0];
4279 } else {
4280 return '';
4281 }
4282 }
4283
4284
4285 /**
4286 * Overwrite current page template with Maintenance page
4287 *
4288 * @param object original_template
4289 *
4290 * @return object new template
4291 */
4292 public function template_include($original_template)
4293 {
4294 $original_template = $this->load_maintenance_page($original_template);
4295 return $original_template;
4296 }
4297
4298 public function check_maintenance_unlocked()
4299 {
4300 $mtnc_options = $this->get_options(true);
4301 if (isset($_COOKIE['maintenance_unlocked']) && $_COOKIE['maintenance_unlocked'] == md5($mtnc_options['maintenance_password'])) {
4302 return true;
4303 } else {
4304 return false;
4305 }
4306 }
4307
4308 public function check_site_unlocked()
4309 {
4310 $mtnc_options = $this->get_options(true);
4311 if (isset($_COOKIE['site_unlocked']) && $_COOKIE['site_unlocked'] == md5($mtnc_options['site_password'])) {
4312 return true;
4313 } else {
4314 return false;
4315 }
4316 }
4317
4318 public function check_maintenance_locked()
4319 {
4320 $mtnc_options = $this->get_options(true);
4321 if (isset($mtnc_options['maintenance_password']) && strlen($mtnc_options['maintenance_password']) > 0 && !$this->check_maintenance_unlocked()) {
4322 return true;
4323 }
4324 return false;
4325 }
4326
4327 public function check_site_locked()
4328 {
4329 $mtnc_options = $this->get_options(true);
4330 if (isset($mtnc_options['site_password']) && strlen($mtnc_options['site_password']) > 0 && !$this->check_site_unlocked()) {
4331 return true;
4332 }
4333 return false;
4334 }
4335
4336 public function load_maintenance_page($original_template)
4337 {
4338 $mtnc_options = $this->get_options(true);
4339 // just to be on the safe side
4340 if (defined('DOING_CRON') && DOING_CRON) {
4341 return false;
4342 }
4343 if (defined('DOING_AJAX') && DOING_AJAX) {
4344 return false;
4345 }
4346 if (defined('WP_CLI') && WP_CLI) {
4347 return false;
4348 }
4349
4350 // init custom enter no main url
4351 $custom_url_link = $mtnc_options['direct_access_link'];
4352 if (!empty($custom_url_link)) {
4353 if (isset($_GET[$custom_url_link])) { //phpcs:ignore
4354 setcookie("skip_maintenance_mode", true, time() + 24 * 60 * 60, '/');
4355 $_COOKIE['skip_maintenance_mode'] = true;
4356 }
4357 }
4358
4359 // Getting custom login URL for the admin
4360 $login_url = wp_login_url();
4361
4362 // This is the server address of the current page
4363 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
4364 $request_uri = $this->slashit(strtolower(wp_parse_url($request_uri, PHP_URL_PATH)));
4365 $server_url = get_home_url() . $request_uri;
4366
4367 // Checking for the custom_login_url value
4368 if (empty($mtnc_options['custom_login_url'])) {
4369 $mtnc_options['custom_login_url'] = '';
4370 } else {
4371 $mtnc_options['custom_login_url'] = get_home_url() . $this->slashit($mtnc_options['custom_login_url']);
4372 }
4373
4374 if (!is_admin() || isset($_GET['maintenance-preview'])) { //phpcs:ignore
4375 if ('1' == $mtnc_options['status'] || apply_filters('mtnc_force_display', false) || isset($_GET['maintenance-preview'])) { //phpcs:ignore
4376 if (
4377 false === strpos($server_url, '/wp-login.php')
4378 && false === strpos($server_url, '/wp-admin/')
4379 && false === strpos($server_url, '/async-upload.php')
4380 && false === strpos($server_url, '/upgrade.php')
4381 && false === strpos($server_url, '/xmlrpc.php')
4382 && false === strpos($server_url, $login_url)
4383 && !isset($_GET['mainwpsignature']) //phpcs:ignore
4384 ) {
4385
4386 $show_maintenance_page = 1;
4387
4388 if (!empty($mtnc_options['custom_login_url']) && false !== strpos($server_url, $mtnc_options['custom_login_url'])) {
4389 $show_maintenance_page = 0;
4390 }
4391
4392 // search engines
4393 if ($mtnc_options['excludese'] == '1' && $this->check_referrer()) {
4394 $show_maintenance_page = 0;
4395 }
4396
4397 // if logged in
4398 if ($mtnc_options['show_logged_in'] == '1' && is_user_logged_in()) {
4399 $show_maintenance_page = 0;
4400 }
4401
4402 // IP whitelist
4403 $all_ips = explode("\n", $mtnc_options['ip_whitelist']);
4404 $all_ips = array_map('trim', $all_ips);
4405 $current_ip = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? ''));
4406
4407 if (@in_array($current_ip, $all_ips)) {
4408 $show_maintenance_page = 0;
4409 }
4410
4411 // urls list
4412 $all_urls = explode("\n", trim($mtnc_options['per_url_enable_disable']));
4413 $all_urls = array_map('trim', $all_urls);
4414
4415 // whitelisted / blacklisted URLs
4416 if ($mtnc_options['per_url_settings'] == 'whitelist' && !empty($all_urls)) {
4417 if (in_array($request_uri, $all_urls)) {
4418 $show_maintenance_page = 0;
4419 }
4420 } elseif ($mtnc_options['per_url_settings'] == 'blacklist' && !empty($all_urls)) {
4421 if (!in_array($request_uri, $all_urls)) {
4422 $show_maintenance_page = 0;
4423 }
4424 }
4425
4426 if (!empty($_COOKIE['skip_maintenance_mode'])) {
4427 $show_maintenance_page = 0;
4428 }
4429
4430 if (isset($_COOKIE['site_unlocked']) && $_COOKIE['site_unlocked'] == md5($mtnc_options['site_password'])) {
4431 $show_maintenance_page = 0;
4432 }
4433
4434 $show_maintenance_page = apply_filters('mtnc_force_display', $show_maintenance_page);
4435
4436 if ($show_maintenance_page == 1 || isset($_GET['maintenance-preview'])) { //phpcs:ignore
4437 if (file_exists(MTNC_LOAD . 'index.php')) {
4438 add_filter('script_loader_tag', 'mtnc_defer_scripts', 10, 2);
4439 return MTNC_LOAD . 'index.php';
4440 } else {
4441 return $original_template;
4442 }
4443 }
4444 }
4445 }
4446 }
4447
4448 return $original_template;
4449 }
4450
4451 public function slashit($url)
4452 {
4453 if (strpos($url, '?') === false && substr($url, -4, 1) != '.') {
4454 $url = trailingslashit($url);
4455 }
4456
4457 if ($url != '/') {
4458 $url = '/' . ltrim($url, '/');
4459 }
4460
4461 return $url;
4462 } // slashit
4463
4464 public function get_headers_503()
4465 {
4466 $mtnc_options = $this->get_options(true);
4467 nocache_headers();
4468 if (!empty($mtnc_options['blockse'])) {
4469 $protocol = 'HTTP/1.0';
4470 if (isset($_SERVER['SERVER_PROTOCOL']) && 'HTTP/1.1' === $_SERVER['SERVER_PROTOCOL']) {
4471 $protocol = 'HTTP/1.1';
4472 }
4473 header("$protocol 503 Service Unavailable", true, 503);
4474
4475 $v_curr_date_end = '';
4476 $vdate_end = date_i18n('Y-m-d', strtotime(current_time('mysql', 0)));
4477 $vtime_end = date_i18n('h:i a', strtotime('12:00 pm'));
4478
4479 if (!empty($mtnc_options['expiry_date_end'])) {
4480 $vdate_end = $mtnc_options['expiry_date_end'];
4481 }
4482 if (!empty($mtnc_options['expiry_time_end'])) {
4483 $vtime_end = $mtnc_options['expiry_time_end'];
4484 }
4485 if ($mtnc_options['state'] && !empty($mtnc_options['expiry_date_end']) && !empty($mtnc_options['expiry_time_end'])) {
4486 $date_concat = $vdate_end . ' ' . $vtime_end;
4487 $v_curr_date = strtotime($date_concat);
4488 if (strtotime(current_time('mysql', 0)) < $v_curr_date) {
4489 header('Retry-After: ' . gmdate('D, d M Y H:i:s', $v_curr_date));
4490 } else {
4491 header('Retry-After: 3600');
4492 }
4493 } else {
4494 header('Retry-After: 3600');
4495 }
4496 }
4497 }
4498
4499 public function add_bunny_fonts($theme)
4500 {
4501 $fonts = array();
4502
4503 foreach ($theme->modules as $module) {
4504 foreach ($module->groups as $group) {
4505 foreach ($group->fields as $field) {
4506 if ($field->type == 'font') {
4507 $font_link = $this->get_bunny_font(esc_attr($field->value));
4508 if (!empty($font_link)) {
4509 $fonts[] = $font_link;
4510 }
4511 }
4512 }
4513 }
4514 }
4515 return $fonts;
4516 } //add_bunny_fonts
4517
4518 /**
4519 * Get Google link
4520 *
4521 * @return string link
4522 */
4523 public function get_bunny_font($font = null)
4524 {
4525 $font_params = $full_link = $gg_fonts = '';
4526
4527 $gg_fonts = json_decode($this->get_bunny_fonts());
4528
4529 if (property_exists($gg_fonts, $font)) {
4530 $curr_font = $gg_fonts->{$font};
4531 if (!empty($curr_font)) {
4532 foreach ($curr_font->variants as $values) {
4533 if (!empty($values->id)) {
4534 $font_params .= $values->id . ',';
4535 } elseif (!empty($values)) {
4536 $font_params .= $values . ',';
4537 }
4538 }
4539
4540 $font_params = trim($font_params, ',');
4541 $full_link = $font . ':' . $font_params;
4542 }
4543 }
4544
4545 return $full_link;
4546 } //get_bunny_font
4547
4548 /**
4549 * Get Google fonts from json
4550 *
4551 * @return string Google fonts
4552 */
4553 public function get_bunny_fonts()
4554 {
4555 $gg_fonts = file_get_contents(MTNC_PATH . 'css/font/bunnyfonts.json');
4556 return $gg_fonts;
4557 } //get_bunny_fonts
4558
4559 public function get_custom_login_code()
4560 {
4561 global $wp_query,
4562 $error;
4563 $mtnc_options = $this->get_options();
4564 $user_connect = false;
4565 if (!is_array($wp_query->query_vars)) {
4566 $wp_query->query_vars = array();
4567 }
4568 $error_message = $user_login = $user_pass = $error = '';
4569 $is_role_check = true;
4570 $class_login = 'user-icon';
4571 $class_password = 'pass-icon';
4572 $using_cookie = false;
4573
4574 if (isset($_POST['is_custom_login'])) {
4575 $user_login = '';
4576 if (isset($_POST['log']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
4577 $user_login = sanitize_text_field(wp_unslash($_POST['log']));
4578 }
4579 $user_login = sanitize_user($user_login);
4580 $user_pass = '';
4581 if (isset($_POST['pwd']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
4582 $user_pass = sanitize_text_field(wp_unslash($_POST['pwd']));
4583 }
4584 $access = array();
4585 $access['user_login'] = esc_attr($user_login);
4586 $access['user_password'] = $user_pass;
4587 $access['remember'] = true;
4588
4589 $user = null;
4590 $user = new WP_User(0, $user_login);
4591 $current_role = current($user->roles);
4592
4593 if (!empty($mtnc_options['roles_array'])) {
4594 foreach (array_keys($mtnc_options['roles_array']) as $key) {
4595 if ($key === $current_role) {
4596 $is_role_check = false;
4597 }
4598 }
4599 } else {
4600 $is_role_check = true;
4601 }
4602
4603 if (!$is_role_check) {
4604 $error_message = esc_html__('Permission access denied!', 'maintenance');
4605 $class_login = 'error';
4606 $class_password = 'error';
4607 } else {
4608
4609 if (is_ssl()) {
4610 $ssl = true;
4611 } else {
4612 $ssl = false;
4613 }
4614
4615 $user_connect = wp_signon($access, $ssl);
4616 if (is_wp_error($user_connect)) {
4617 if ($user_connect->get_error_code() === 'invalid_username') {
4618 $error_message = esc_html__('Login is incorrect!', 'maintenance');
4619
4620 $class_login = 'error';
4621 $class_password = 'error';
4622 } elseif ($user_connect->get_error_code() === 'incorrect_password') {
4623 $error_message = esc_html__('Password is incorrect!', 'maintenance');
4624 $class_password = 'error';
4625 } else {
4626 $error_message = esc_html__('Login and password are incorrect!', 'maintenance');
4627 $class_login = 'error';
4628 $class_password = 'error';
4629 }
4630 } else {
4631 wp_safe_redirect(home_url('/'));
4632 exit;
4633 }
4634 }
4635 }
4636
4637 if (!$user_connect) {
4638 $this->get_headers_503();
4639 }
4640
4641 return array($error_message, $class_login, $class_password, $user_login);
4642 }
4643
4644 /**
4645 * Check referrer if it's a SERP crawler
4646 *
4647 * @return bool true if crawler
4648 */
4649 public function check_referrer()
4650 {
4651 // List of crawlers to check for
4652 $crawlers = array(
4653 'Abacho' => 'AbachoBOT',
4654 'Accoona' => 'Acoon',
4655 'AcoiRobot' => 'AcoiRobot',
4656 'Adidxbot' => 'adidxbot',
4657 'AltaVista robot' => 'Altavista',
4658 'Altavista robot' => 'Scooter',
4659 'ASPSeek' => 'ASPSeek',
4660 'Atomz' => 'Atomz',
4661 'Bing' => 'bingbot',
4662 'BingPreview' => 'BingPreview',
4663 'CrocCrawler' => 'CrocCrawler',
4664 'Dumbot' => 'Dumbot',
4665 'eStyle Bot' => 'eStyle',
4666 'FAST-WebCrawler' => 'FAST-WebCrawler',
4667 'GeonaBot' => 'GeonaBot',
4668 'Gigabot' => 'Gigabot',
4669 'Google' => 'Googlebot',
4670 'ID-Search Bot' => 'IDBot',
4671 'Lycos spider' => 'Lycos',
4672 'MSN' => 'msnbot',
4673 'MSRBOT' => 'MSRBOT',
4674 'Rambler' => 'Rambler',
4675 'Scrubby robot' => 'Scrubby',
4676 'Yahoo' => 'Yahoo',
4677 );
4678
4679 // Checking for the crawler over here
4680 if ($this->string_to_array(sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'] ?? '')), $crawlers)) {
4681 return true;
4682 }
4683 return false;
4684 } //check_referrer
4685
4686 /**
4687 * Function to match the user agent with the crawlers array
4688 *
4689 * @param string string to find
4690 * @param array array to look in
4691 *
4692 * @return bool true if match found
4693 */
4694 public function string_to_array($str, $array)
4695 {
4696 $regexp = '~(' . implode('|', array_values($array)) . ')~i';
4697 return (bool) preg_match($regexp, $str);
4698 } //string_to_array
4699
4700 static function wp_kses_wf($html)
4701 {
4702 add_filter('safe_style_css', function ($styles) {
4703 $styles_wf = array(
4704 'text-align',
4705 'margin',
4706 'color',
4707 'float',
4708 'border',
4709 'background',
4710 'background-color',
4711 'border-bottom',
4712 'border-bottom-color',
4713 'border-bottom-style',
4714 'border-bottom-width',
4715 'border-collapse',
4716 'border-color',
4717 'border-left',
4718 'border-left-color',
4719 'border-left-style',
4720 'border-left-width',
4721 'border-right',
4722 'border-right-color',
4723 'border-right-style',
4724 'border-right-width',
4725 'border-spacing',
4726 'border-style',
4727 'border-top',
4728 'border-top-color',
4729 'border-top-style',
4730 'border-top-width',
4731 'border-width',
4732 'caption-side',
4733 'clear',
4734 'cursor',
4735 'direction',
4736 'font',
4737 'font-family',
4738 'font-size',
4739 'font-style',
4740 'font-variant',
4741 'font-weight',
4742 'height',
4743 'letter-spacing',
4744 'line-height',
4745 'margin-bottom',
4746 'margin-left',
4747 'margin-right',
4748 'margin-top',
4749 'overflow',
4750 'padding',
4751 'padding-bottom',
4752 'padding-left',
4753 'padding-right',
4754 'padding-top',
4755 'text-decoration',
4756 'text-indent',
4757 'vertical-align',
4758 'width',
4759 'display',
4760 );
4761
4762 foreach ($styles_wf as $style_wf) {
4763 $styles[] = $style_wf;
4764 }
4765 return $styles;
4766 });
4767
4768 $allowed_tags = wp_kses_allowed_html('post');
4769 $allowed_tags['input'] = array(
4770 'type' => true,
4771 'style' => true,
4772 'class' => true,
4773 'id' => true,
4774 'checked' => true,
4775 'disabled' => true,
4776 'name' => true,
4777 'size' => true,
4778 'placeholder' => true,
4779 'value' => true,
4780 'data-*' => true,
4781 'size' => true,
4782 'disabled' => true
4783 );
4784
4785 $allowed_tags['textarea'] = array(
4786 'type' => true,
4787 'style' => true,
4788 'class' => true,
4789 'id' => true,
4790 'checked' => true,
4791 'disabled' => true,
4792 'name' => true,
4793 'size' => true,
4794 'placeholder' => true,
4795 'value' => true,
4796 'data-*' => true,
4797 'cols' => true,
4798 'rows' => true,
4799 'disabled' => true,
4800 'autocomplete' => true
4801 );
4802
4803 $allowed_tags['select'] = array(
4804 'type' => true,
4805 'style' => true,
4806 'class' => true,
4807 'id' => true,
4808 'checked' => true,
4809 'disabled' => true,
4810 'name' => true,
4811 'size' => true,
4812 'placeholder' => true,
4813 'value' => true,
4814 'data-*' => true,
4815 'multiple' => true,
4816 'disabled' => true
4817 );
4818
4819 $allowed_tags['option'] = array(
4820 'type' => true,
4821 'style' => true,
4822 'class' => true,
4823 'id' => true,
4824 'checked' => true,
4825 'disabled' => true,
4826 'name' => true,
4827 'size' => true,
4828 'placeholder' => true,
4829 'value' => true,
4830 'selected' => true,
4831 'data-*' => true
4832 );
4833 $allowed_tags['optgroup'] = array(
4834 'type' => true,
4835 'style' => true,
4836 'class' => true,
4837 'id' => true,
4838 'checked' => true,
4839 'disabled' => true,
4840 'name' => true,
4841 'size' => true,
4842 'placeholder' => true,
4843 'value' => true,
4844 'selected' => true,
4845 'data-*' => true,
4846 'label' => true
4847 );
4848
4849 $allowed_tags['a'] = array(
4850 'href' => true,
4851 'data-*' => true,
4852 'class' => true,
4853 'style' => true,
4854 'id' => true,
4855 'target' => true,
4856 'data-*' => true,
4857 'role' => true,
4858 'aria-controls' => true,
4859 'aria-selected' => true,
4860 'disabled' => true
4861 );
4862
4863 $allowed_tags['div'] = array(
4864 'style' => true,
4865 'class' => true,
4866 'id' => true,
4867 'data-*' => true,
4868 'role' => true,
4869 'aria-labelledby' => true,
4870 'value' => true,
4871 'aria-modal' => true,
4872 'tabindex' => true
4873 );
4874
4875 $allowed_tags['h2'] = array(
4876 'style' => true,
4877 'class' => true,
4878 'id' => true,
4879 'data-*' => true,
4880 'role' => true,
4881 'aria-labelledby' => true,
4882 'value' => true,
4883 'aria-modal' => true,
4884 'tabindex' => true,
4885 'font-family' => true,
4886 );
4887
4888 $allowed_tags['li'] = array(
4889 'style' => true,
4890 'class' => true,
4891 'id' => true,
4892 'data-*' => true,
4893 'role' => true,
4894 'aria-labelledby' => true,
4895 'value' => true,
4896 'aria-modal' => true,
4897 'tabindex' => true
4898 );
4899
4900 $allowed_tags['span'] = array(
4901 'style' => true,
4902 'class' => true,
4903 'id' => true,
4904 'data-*' => true,
4905 'aria-hidden' => true
4906 );
4907
4908 $allowed_tags['style'] = array(
4909 'class' => true,
4910 'id' => true,
4911 'type' => true,
4912 'font-family' => true,
4913 );
4914
4915 $allowed_tags['fieldset'] = array(
4916 'class' => true,
4917 'id' => true,
4918 'type' => true
4919 );
4920
4921 $allowed_tags['link'] = array(
4922 'class' => true,
4923 'id' => true,
4924 'type' => true,
4925 'rel' => true,
4926 'href' => true,
4927 'media' => true
4928 );
4929
4930 $allowed_tags['form'] = array(
4931 'style' => true,
4932 'class' => true,
4933 'id' => true,
4934 'method' => true,
4935 'action' => true,
4936 'data-*' => true
4937 );
4938
4939 echo wp_kses($html, $allowed_tags);
4940
4941 add_filter('safe_style_css', function ($styles) {
4942 $styles_wf = array(
4943 'text-align',
4944 'margin',
4945 'color',
4946 'float',
4947 'border',
4948 'background',
4949 'background-color',
4950 'border-bottom',
4951 'border-bottom-color',
4952 'border-bottom-style',
4953 'border-bottom-width',
4954 'border-collapse',
4955 'border-color',
4956 'border-left',
4957 'border-left-color',
4958 'border-left-style',
4959 'border-left-width',
4960 'border-right',
4961 'border-right-color',
4962 'border-right-style',
4963 'border-right-width',
4964 'border-spacing',
4965 'border-style',
4966 'border-top',
4967 'border-top-color',
4968 'border-top-style',
4969 'border-top-width',
4970 'border-width',
4971 'caption-side',
4972 'clear',
4973 'cursor',
4974 'direction',
4975 'font',
4976 'font-family',
4977 'font-size',
4978 'font-style',
4979 'font-variant',
4980 'font-weight',
4981 'height',
4982 'letter-spacing',
4983 'line-height',
4984 'margin-bottom',
4985 'margin-left',
4986 'margin-right',
4987 'margin-top',
4988 'overflow',
4989 'padding',
4990 'padding-bottom',
4991 'padding-left',
4992 'padding-right',
4993 'padding-top',
4994 'text-decoration',
4995 'text-indent',
4996 'vertical-align',
4997 'width'
4998 );
4999
5000 foreach ($styles_wf as $style_wf) {
5001 if (($key = array_search($style_wf, $styles)) !== false) {
5002 unset($styles[$key]);
5003 }
5004 }
5005 return $styles;
5006 });
5007 }
5008
5009 function is_plugin_installed($slug)
5010 {
5011 if (!function_exists('get_plugins')) {
5012 require_once ABSPATH . 'wp-admin/includes/plugin.php';
5013 }
5014 $all_plugins = get_plugins();
5015
5016 if (!empty($all_plugins[$slug])) {
5017 return true;
5018 } else {
5019 return false;
5020 }
5021 } // is_plugin_installed
5022
5023 // auto download / install / activate WP Force SSL plugin
5024 function install_wpfssl()
5025 {
5026 check_ajax_referer('install_wpfssl');
5027
5028 if (false === current_user_can('administrator')) {
5029 wp_die('Sorry, you have to be an admin to run this action.');
5030 }
5031
5032 $plugin_slug = 'wp-force-ssl/wp-force-ssl.php';
5033 $plugin_zip = 'https://downloads.wordpress.org/plugin/wp-force-ssl.latest-stable.zip';
5034
5035 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
5036 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
5037 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
5038 @include_once ABSPATH . 'wp-admin/includes/file.php';
5039 @include_once ABSPATH . 'wp-admin/includes/misc.php';
5040 echo '<style>
5041 body{
5042 font-family: sans-serif;
5043 font-size: 14px;
5044 line-height: 1.5;
5045 color: #444;
5046 }
5047 </style>';
5048
5049 echo '<div style="margin: 20px; color:#444;">';
5050 echo 'If things are not done in a minute <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=force%20ssl%20webfactory&tab=search&type=term')) . '">install the plugin manually via Plugins page</a><br><br>';
5051 echo 'Starting ...<br><br>';
5052
5053 wp_cache_flush();
5054 $upgrader = new Plugin_Upgrader();
5055 echo 'Check if WP Force SSL is already installed ... <br />';
5056 if ($this->is_plugin_installed($plugin_slug)) {
5057 echo 'WP Force SSL is already installed! <br /><br />Making sure it\'s the latest version.<br />';
5058 $upgrader->upgrade($plugin_slug);
5059 $installed = true;
5060 } else {
5061 echo 'Installing WP Force SSL.<br />';
5062 $installed = $upgrader->install($plugin_zip);
5063 }
5064 wp_cache_flush();
5065
5066 if (!is_wp_error($installed) && $installed) {
5067 echo 'Activating WP Force SSL.<br />';
5068 $activate = activate_plugin($plugin_slug);
5069
5070 if (is_null($activate)) {
5071 echo 'WP Force SSL Activated.<br />';
5072
5073 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
5074 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
5075 }
5076 } else {
5077 echo 'Could not install WP Force SSL. You\'ll have to <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=force%20ssl%20webfactory&tab=search&type=term')) . '">download and install manually</a>.';
5078 }
5079
5080 echo '</div>';
5081 } // install_wpfssl
5082
5083 // auto download / install / activate Advanced Google reCAPTCHA plugin
5084 function install_wpcaptcha()
5085 {
5086 check_ajax_referer('install_wpcaptcha');
5087
5088 if (false === current_user_can('administrator')) {
5089 wp_die('Sorry, you have to be an admin to run this action.');
5090 }
5091
5092 $plugin_slug = 'advanced-google-recaptcha/advanced-google-recaptcha.php';
5093 $plugin_zip = 'https://downloads.wordpress.org/plugin/advanced-google-recaptcha.latest-stable.zip';
5094
5095 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
5096 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
5097 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
5098 @include_once ABSPATH . 'wp-admin/includes/file.php';
5099 @include_once ABSPATH . 'wp-admin/includes/misc.php';
5100 echo '<style>
5101 body{
5102 font-family: sans-serif;
5103 font-size: 14px;
5104 line-height: 1.5;
5105 color: #444;
5106 }
5107 </style>';
5108
5109 echo '<div style="margin: 20px; color:#444;">';
5110 echo 'If things are not done in a minute <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=advanced%20recaptcha%20webfactory&tab=search&type=term')) . '">install the plugin manually via Plugins page</a><br><br>';
5111 echo 'Starting ...<br><br>';
5112
5113 wp_cache_flush();
5114 $upgrader = new Plugin_Upgrader();
5115 echo 'Check if Advanced Google reCAPTCHA is already installed ... <br />';
5116 if ($this->is_plugin_installed($plugin_slug)) {
5117 echo 'Advanced Google reCAPTCHA is already installed! <br /><br />Making sure it\'s the latest version.<br />';
5118 $upgrader->upgrade($plugin_slug);
5119 $installed = true;
5120 } else {
5121 echo 'Installing Advanced Google reCAPTCHA.<br />';
5122 $installed = $upgrader->install($plugin_zip);
5123 }
5124 wp_cache_flush();
5125
5126 if (!is_wp_error($installed) && $installed) {
5127 echo 'Activating Advanced Google reCAPTCHA.<br />';
5128 $activate = activate_plugin($plugin_slug);
5129
5130 if (is_null($activate)) {
5131 echo 'Advanced Google reCAPTCHA Activated.<br />';
5132
5133 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
5134 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
5135 }
5136 } else {
5137 echo 'Could not install Advanced Google reCAPTCHA. You\'ll have to <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=advanced%20recaptcha%20webfactory&tab=search&type=term')) . '">download and install manually</a>.';
5138 }
5139
5140 echo '</div>';
5141 } // install_wpcaptcha
5142
5143 // auto download / install / activate Weglot plugin
5144 function install_weglot()
5145 {
5146 check_ajax_referer('install_weglot');
5147
5148 if (false === current_user_can('administrator')) {
5149 wp_die('Sorry, you have to be an admin to run this action.');
5150 }
5151
5152 $plugin_slug = 'weglot/weglot.php';
5153 $plugin_zip = 'https://downloads.wordpress.org/plugin/weglot.latest-stable.zip';
5154
5155 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
5156 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
5157 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
5158 @include_once ABSPATH . 'wp-admin/includes/file.php';
5159 @include_once ABSPATH . 'wp-admin/includes/misc.php';
5160 echo '<style>
5161 body{
5162 font-family: sans-serif;
5163 font-size: 14px;
5164 line-height: 1.5;
5165 color: #444;
5166 }
5167 </style>';
5168
5169 echo '<div style="margin: 20px; color:#444;">';
5170 echo 'If things are not done in a minute <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=weglot&tab=search&type=term')) . '">install the plugin manually via Plugins page</a><br><br>';
5171 echo 'Starting ...<br><br>';
5172
5173 wp_cache_flush();
5174 $upgrader = new Plugin_Upgrader();
5175 echo 'Check if Weglot is already installed ... <br />';
5176 if ($this->is_plugin_installed($plugin_slug)) {
5177 echo 'Weglot is already installed! <br /><br />Making sure it\'s the latest version.<br />';
5178 $upgrader->upgrade($plugin_slug);
5179 $installed = true;
5180 } else {
5181 echo 'Installing Weglot.<br />';
5182 $installed = $upgrader->install($plugin_zip);
5183 }
5184 wp_cache_flush();
5185
5186 if (!is_wp_error($installed) && $installed) {
5187 echo 'Activating Weglot.<br />';
5188 $activate = activate_plugin($plugin_slug);
5189
5190 if (is_null($activate)) {
5191 echo 'Weglot Activated.<br />';
5192
5193 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
5194 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
5195 }
5196 } else {
5197 echo 'Could not install Weglot. You\'ll have to <a target="_parent" href="' . esc_url(admin_url('plugin-install.php?s=weglot&tab=search&type=term')) . '">download and install manually</a>.';
5198 }
5199
5200 echo '</div>';
5201 } // install_weglot
5202
5203 /**
5204 * Disabled; we use singleton pattern so magic functions need to be disabled
5205 *
5206 * @return null
5207 */
5208 public function __clone() {}
5209
5210 /**
5211 * Disabled; we use singleton pattern so magic functions need to be disabled
5212 *
5213 * @return null
5214 */
5215 public function __sleep() {}
5216
5217 /**
5218 * Disabled; we use singleton pattern so magic functions need to be disabled
5219 *
5220 * @return null
5221 */
5222 public function __wakeup() {}
5223 } // MTNC class
5224
5225 // Create plugin instance and hook things up
5226 global $wf_mtnc; //phpcs:ignore
5227 $wf_mtnc = MTNC::getInstance(); //phpcs:ignore
5228