PluginProbe
Maintenance / 4.30
Maintenance v4.30
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.30, at maintenance.php

4,336 lines 242.5 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.30
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 'theme_global' => $default_theme_id,
162 'themes' => array($default_theme_id => json_decode(
163 '{
164 "modules":{},
165 "modules_order":[],
166 "name":"Default",
167 "theme_thumbnail":"",
168 "theme_status":"",
169 "body_font_size":"16",
170 "body_font_color":"FFFFFF",
171 "body_font":"Orbitron",
172 "body_link_color":"0096ff",
173 "body_link_hover_color":"57baff",
174 "background_type":"image",
175 "background_video":"",
176 "background_video_fallback":"",
177 "background_video_filter":"",
178 "background_size_opt":"cover",
179 "background_position":"center center",
180 "background_image_filter":"",
181 "background_blur":"",
182 "background_image":"' . trailingslashit(MTNC_URL) . 'img/mountain-bg.jpg",
183 "preloader_background_image":"",
184 "background_color":"FFFFFF",
185 "login_background_color":"000000",
186 "content_overlay":"1",
187 "content_width":"600",
188 "content_overlay_color":"#rgba(0,0,0,0.2)",
189 "content_overlay_shadow_color":"rgba(0,0,0,0.2)",
190 "content_position":"middle",
191 "modules_spacing":"10",
192 "custom_css":""
193 }'
194 )),
195 'status' => '0',
196 'mode' => 'layout',
197 'mtnc_page' => 0,
198 'header_text' => 'Our site is under maintenance!',
199 //SEO
200 'title' => get_bloginfo('name') . ' is under maintenance',
201 'description' => 'We are doing some work on our site. Please come back later. We\'ll be up and running in no time.',
202 'target_keyword' => 'maintenance',
203 'excludese' => '0',
204 'blockse' => '0',
205 'favicon' => '',
206 'social_preview' => '',
207 'analytics' => '',
208 'tracking_pixel' => '',
209 'twitter_site' => '',
210 'facebook_site' => '',
211 //Access
212 'show_logged_in' => '1',
213 'ip_whitelist' => '',
214 'per_url_settings' => '',
215 'per_url_enable_disable' => '',
216 'direct_access_link' => '',
217 'custom_login_url' => '',
218 'login_button' => '1',
219 'wplogin_button_tooltip' => 'Access WordPress admin',
220 'maintenance_password' => '',
221 'site_password' => '',
222 'password_button' => '0',
223 'login_button_text' => 'Access the Site',
224 'login_message' => 'Please enter the password to access the site',
225 'login_wrong_password_text' => 'Wrong password',
226 'login_button_tooltip' => 'Direct Access login',
227 //Advanced
228 'no_cache_headers' => '1',
229 'disable_toolbar_menu' => '',
230 'force_ssl' => '',
231 'enable_rest' => '',
232 'custom_wp_maintenance' => '',
233 'custom_wp_maintenance_title' => '',
234 'custom_wp_maintenance_content' => '',
235
236 );
237
238 if (sizeof($options['options']) < sizeof($def_options)) {
239 $options['options'] = array_merge($def_options, (array) $options['options']);
240 $change = true;
241 }
242
243 /* Detect upgrade from free */
244 $mtnc_free_options = get_option('maintenance_options', false);
245
246
247
248 if ($mtnc_free_options !== false && array_key_exists('state', $mtnc_free_options) && !array_key_exists('upgraded', $options)) {
249 if(!empty($mtnc_free_options['state']) && $mtnc_free_options['state'] == '1'){
250 $options['options']['status'] = '1';
251 } else {
252 $options['options']['status'] = '0';
253 }
254
255 $options['options']['theme_global'] = $default_theme_id;
256 $options['options']['themes'] = [];
257 $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":""}');
258
259 $logo_src = wp_get_attachment_image_src($mtnc_free_options['logo'], 'full');
260 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->logo->value = esc_url($logo_src[0]);
261 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->width->value = $mtnc_free_options['logo_width'];
262 $options['options']['themes'][$default_theme_id]->modules->{'logo-ea1e7873'}->groups->logo->fields->height->value = $mtnc_free_options['logo_height'];
263
264 //SEO
265 $options['options']['title'] = $mtnc_free_options['page_title'];
266 $options['options']['description'] = $mtnc_free_options['description'];
267
268 //Access
269 $options['options']['login_button'] = $mtnc_free_options['is_login'];
270
271 //Design
272 $old_bg = wp_get_attachment_image_src($mtnc_free_options['body_bg'], 'full');
273 $options['options']['themes'][$default_theme_id]->background_image = esc_url($old_bg[0]);
274 $options['options']['themes'][$default_theme_id]->background_blur = $mtnc_free_options['blur_intensity'];
275 $options['options']['themes'][$default_theme_id]->background_color = $mtnc_free_options['body_bg_color'];
276 $options['options']['themes'][$default_theme_id]->login_background_color = $mtnc_free_options['controls_bg_color'];
277
278
279 $options['options']['themes'][$default_theme_id]->body_font_color = $mtnc_free_options['font_color'];
280 $options['options']['themes'][$default_theme_id]->body_font = $mtnc_free_options['body_font_family'];
281 $options['options']['themes'][$default_theme_id]->background_color = $mtnc_free_options['body_bg_color'];
282 $options['options']['themes'][$default_theme_id]->custom_css = 'body,h2{font-weight:300;}';
283
284 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->text->value = '<span style="text-align: center;">' . $mtnc_free_options['heading'] . '</span>';
285 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->font_size->value = 45;
286 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->header->fields->font->value = $mtnc_free_options['body_font_family'];
287 $options['options']['themes'][$default_theme_id]->modules->{'header-4b5742b4'}->groups->layout->fields->margin_top->value = 80;
288
289 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->text->value = '<span style="text-align: center;">' . $mtnc_free_options['description'] . '</span>';
290 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->font_size->value = 16;
291 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->col1->fields->font->value = $mtnc_free_options['body_font_family'];
292 $options['options']['themes'][$default_theme_id]->modules->{'content-a60d7054'}->groups->layout->fields->margin_bottom->value = 80;
293
294 $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>';
295 $options['options']['themes'][$default_theme_id]->modules->{'footer-b527dd0c'}->groups->col1->fields->font_size->value = 16;
296 $options['options']['themes'][$default_theme_id]->modules->{'footer-b527dd0c'}->groups->col1->fields->font->value = $mtnc_free_options['body_font_family'];
297
298 $options['upgraded'] = time();
299 $change = true;
300 }
301
302 if ($change) {
303 update_option('mtnc-options', $options, true);
304 }
305
306 $this->options = $options;
307 return $options;
308 } // load_options
309
310 // change status via admin bar
311 public function change_status()
312 {
313 check_admin_referer('mtnc_change_status');
314
315 if (empty($_GET['new_status'])) {
316 wp_safe_redirect(admin_url());
317 exit;
318 }
319
320 $options = $this->get_options();
321
322 if ($_GET['new_status'] == 'enabled') {
323 $options['status'] = '1';
324 } else {
325 $options['status'] = '0';
326 }
327
328 $this->update_options('options', $options);
329
330 if (!empty($_GET['redirect'])) {
331 wp_safe_redirect(wp_unslash($_GET['redirect']));
332 } else {
333 wp_safe_redirect(admin_url());
334 }
335
336 exit;
337 } // change_status
338
339 /**
340 * Dismiss notice via AJAX call
341 *
342 * @return null
343 */
344 function ajax_dismiss_notice()
345 {
346 check_ajax_referer('maintenance_dismiss_notice');
347
348 if (!current_user_can('manage_options')) {
349 wp_send_json_error('You are not allowed to run this action.');
350 }
351
352 $notice_name = trim(sanitize_text_field(wp_unslash($_GET['notice_name'] ?? '')));
353 if (!$this->dismiss_notice($notice_name)) {
354 wp_send_json_error('Notice is already dismissed.');
355 } else {
356 wp_send_json_success();
357 }
358 } // ajax_dismiss_notice
359
360
361 /**
362 * Dismiss notice by adding it to dismissed_notices options array
363 *
364 * @param string $notice_name Notice to dismiss.
365 *
366 * @return bool
367 */
368 function dismiss_notice($notice_name)
369 {
370 if ($this->get_dismissed_notices($notice_name)) {
371 return false;
372 } else {
373 $notices = $this->get_dismissed_notices();
374 $notices[$notice_name] = true;
375
376 $this->update_options('dismissed_notices', $notices);
377 return true;
378 }
379 } // dismiss_notice
380
381
382 /**
383 * Get all dismissed notices, or check for one specific notice
384 *
385 * @param string $notice_name Optional. Check if specified notice is dismissed.
386 *
387 * @return bool|array
388 */
389 function get_dismissed_notices($notice_name = '')
390 {
391 $notices = $this->options['dismissed_notices'];
392
393 if (empty($notice_name)) {
394 return $notices;
395 } else {
396 if (empty($notices[$notice_name])) {
397 return false;
398 } else {
399 return true;
400 }
401 }
402 } // get_dismissed_notices
403
404
405 /**
406 * Retrieve available modules
407 *
408 * @return array
409 */
410 public function get_modules()
411 {
412 $modules = array();
413 $modules['logo'] = array('name' => 'Logo', 'pro' => false);
414 $modules['header'] = array('name' => 'Header', 'pro' => false);
415 $modules['footer'] = array('name' => 'Footer', 'pro' => false);
416 $modules['content'] = array('name' => 'Content', 'pro' => false);
417 $modules['content2col'] = array('name' => 'Content 2 Column', 'pro' => true);
418 $modules['content3col'] = array('name' => 'Content 3 Column', 'pro' => true);
419 $modules['form'] = array('name' => 'Form', 'pro' => true);
420 $modules['video'] = array('name' => 'Video', 'pro' => true);
421 $modules['countdown'] = array('name' => 'Countdown', 'pro' => true);
422 $modules['progressbar'] = array('name' => 'Progress Bar', 'pro' => true);
423 $modules['social'] = array('name' => 'Social Icons', 'pro' => true);
424 $modules['map'] = array('name' => 'Map', 'pro' => true);
425 $modules['html'] = array('name' => 'Custom HTML', 'pro' => true);
426 $modules['divider'] = array('name' => 'Divider', 'pro' => true);
427
428 $modules = apply_filters('mtnc_modules_list', $modules);
429
430 return $modules;
431 }
432
433 /**
434 * Get meta part of plugin options
435 *
436 * @return array
437 */
438 public function get_meta()
439 {
440 return $this->options['meta'];
441 } // get_meta
442
443 public function get_fonts()
444 {
445 $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');
446 return $fonts;
447 }
448
449 /**
450 * Get options part of plugin options
451 *
452 * @return array
453 */
454 public function get_options()
455 {
456 return $this->options['options'];
457 } // get_options
458
459 /**
460 * Get all plugin options
461 *
462 * @return array
463 */
464 public function get_all_options()
465 {
466 return $this->options;
467 } // get_all_options
468
469 /**
470 * Update specified plugin options key
471 *
472 * @param string $key Data to save.
473 * @param string $data Option key.
474 *
475 * @return bool
476 */
477 public function update_options($key, $data)
478 {
479 if (false === in_array($key, array('meta', 'dismissed_notices', 'options'))) {
480 user_error('Unknown options key.', E_USER_ERROR);
481 return false;
482 }
483
484 $this->options[$key] = $data;
485 $tmp = update_option('mtnc-options', $this->options);
486
487 return $tmp;
488 } // set_options
489
490 /**
491 * Add plugin menu entry under Tools menu
492 *
493 * @return null
494 */
495 public function admin_menu()
496 {
497 add_menu_page('Maintenance', 'Maintenance', 'manage_options', 'maintenance', array($this, 'plugin_page'), $this->plugin_url . 'img/icon-small.png');
498 } // admin_menu
499
500
501 /**
502 * Returns all WP pointers
503 *
504 * @return array
505 */
506 function get_pointers()
507 {
508 $pointers = array();
509
510 $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.');
511
512 return $pointers;
513 } // get_pointers
514
515
516 /**
517 * Enqueue CSS and JS files
518 *
519 * @return null
520 */
521 public function admin_enqueue_scripts($hook)
522 {
523 $options = $this->get_options();
524 $pointers = $this->get_pointers();
525
526 $dismissed_notices = $this->get_dismissed_notices();
527
528 foreach ($dismissed_notices as $notice_name => $tmp) {
529 if ($tmp) {
530 unset($pointers[$notice_name]);
531 }
532 }
533
534 if (!empty($pointers) && !$this->is_plugin_page() && current_user_can('manage_options')) {
535 $pointers['_nonce_dismiss_pointer'] = wp_create_nonce('maintenance_dismiss_notice');
536
537 wp_enqueue_style('wp-pointer');
538
539 wp_enqueue_script('maintenance-pointers', $this->plugin_url . 'js/pointers.js', array('jquery'), $this->version, true);
540 wp_enqueue_script('wp-pointer');
541 wp_localize_script('wp-pointer', 'mtnc_pointers', $pointers);
542 }
543
544 if (!$this->is_plugin_page()) {
545 return;
546 }
547
548 $this->dismiss_notice('welcome');
549
550 $js_localize = array(
551 'undocumented_error' => esc_html__('An undocumented error has occurred. Please refresh the page and try again.', 'maintenance'),
552 'documented_error' => esc_html__('An error has occurred.', 'maintenance'),
553 'plugin_name' => 'Maintenance',
554 'url' => MTNC_URL,
555 'icon_url' => $this->plugin_url . 'img/loader-icon.png',
556 'nonce_action' => wp_create_nonce('mtnc_action'),
557 'theme_global' => $options['theme_global'],
558 'theme' => $this->theme,
559 'theme_id' => $this->theme_id,
560 'fonts' => $this->get_fonts(),
561 'max_upload_size' => wp_max_upload_size(),
562 'settings_url' => admin_url('admin.php?page=maintenance'),
563 'is_plugin_page' => $this->is_plugin_page(),
564 'wpfssl_install_url' => add_query_arg(
565 array(
566 'action' => 'mtnc_install_wpfssl',
567 '_wpnonce' => wp_create_nonce('install_wpfssl'),
568 'rnd' => wp_rand()
569 ),
570 admin_url('admin.php')
571 ),
572 'wpcaptcha_install_url' => add_query_arg(
573 array(
574 'action' => 'mtnc_install_wpcaptcha',
575 '_wpnonce' => wp_create_nonce('install_wpcaptcha'),
576 'rnd' => wp_rand()
577 ),
578 admin_url('admin.php')
579 ),
580 'weglot_install_url' => add_query_arg(
581 array(
582 'action' => 'mtnc_install_weglot',
583 '_wpnonce' => wp_create_nonce('install_weglot'),
584 'rnd' => wp_rand()
585 ),
586 admin_url('admin.php')
587 ),
588 'weglot_dialog_upsell_title' => '<img alt="' . esc_attr__('Weglot', 'maintenance') . '" title="' . esc_attr__('Weglot', 'maintenance') . '" src="' . MTNC_URI . 'img/weglot-logo-white.png' . '">',
589 );
590
591 if ($this->is_plugin_page()) {
592 wp_enqueue_style('maintenance-admin', $this->plugin_url . 'css/maintenance-admin.css', array(), $this->version);
593 wp_enqueue_script('jquery-ui-tabs');
594 wp_enqueue_script('jquery-ui-core');
595 wp_enqueue_script('jquery-ui-position');
596 wp_enqueue_script('jquery-ui-sortable');
597 wp_enqueue_script('jquery-ui-datepicker');
598 wp_enqueue_style('wp-jquery-ui-dialog');
599 wp_enqueue_script('jquery-ui-dialog');
600
601 wp_enqueue_style('maintenance-summernote', $this->plugin_url . 'css/summernote-lite.min.css', array(), $this->version);
602 wp_enqueue_script('maintenance-summernote', $this->plugin_url . 'js/summernote-lite.min.js', array('jquery'), $this->version, true); //WYSIWYG Module Editor
603 wp_enqueue_style('maintenance-fonticonpicker', $this->plugin_url . 'css/jquery.fonticonpicker.min.css', array(), $this->version);
604
605 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);
606 wp_enqueue_style('maintenance-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons', array(), $this->version);
607
608 wp_enqueue_style('maintenance-sweetalert2', $this->plugin_url . 'css/sweetalert2.min.css', array(), $this->version);
609 wp_enqueue_style('maintenance-select2', $this->plugin_url . 'css/select2.css', array(), $this->version);
610
611 wp_enqueue_script('maintenance-sweetalert2', $this->plugin_url . 'js/maintenance-sweetalert2.min.js', array('jquery'), $this->version, true);
612 wp_enqueue_script('maintenance-select2', $this->plugin_url . 'js/select2.min.js', array('jquery'), $this->version, true);
613 wp_enqueue_script('maintenance-colorpicker', $this->plugin_url . 'js/colorpicker/jscolor.js', false, $this->version, true);
614 wp_enqueue_script('maintenance', $this->plugin_url . 'js/maintenance-admin.js', array('jquery'), $this->version, true);
615 wp_enqueue_script('maintenance-fonticonpicker', $this->plugin_url . 'js/jquery.fonticonpicker.min.js', array('jquery'), $this->version, true);
616 wp_enqueue_script('maintenance-ace-editor', $this->plugin_url . 'js/editor/ace.js', false, $this->version, true); // Custom CSS Editor
617 wp_enqueue_script('maintenance-webfonts', $this->plugin_url . 'js/webfont.js', false, $this->version, true); //Visual font picker preview
618
619 wp_localize_script('maintenance', 'mtnc', $js_localize);
620 wp_enqueue_media();
621
622 wp_dequeue_style('uiStyleSheet');
623 wp_dequeue_style('wpcufpnAdmin');
624 wp_dequeue_style('unifStyleSheet');
625 wp_dequeue_style('wpcufpn_codemirror');
626 wp_dequeue_style('wpcufpn_codemirrorTheme');
627 wp_dequeue_style('collapse-admin-css');
628 wp_dequeue_style('jquery-ui-css');
629 wp_dequeue_style('tribe-common-admin');
630 wp_dequeue_style('file-manager__jquery-ui-css');
631 wp_dequeue_style('file-manager__jquery-ui-css-theme');
632 wp_dequeue_style('wpmegmaps-jqueryui');
633 wp_dequeue_style('wp-botwatch-css');
634 }
635 } // admin_enqueue_scripts
636
637 function frontend_login()
638 {
639 global $wp_query, $error;
640 $mt_options = $this->get_options();
641 $user_connect = false;
642 if (!is_array($wp_query->query_vars)) {
643 $wp_query->query_vars = array();
644 }
645 $error_message = $user_login = $user_pass = $error = '';
646 $class_login = 'user-icon';
647 $class_password = 'pass-icon';
648
649 if (isset($_POST['is_custom_login'])) {
650 $user_login = '';
651 if (isset($_POST['log']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
652 $user_login = sanitize_user(wp_unslash($_POST['log']));
653 }
654 $user_login = sanitize_user($user_login);
655 $user_pass = '';
656 if (isset($_POST['pwd']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
657 $user_pass = trim(sanitize_text_field(wp_unslash($_POST['pwd'])));
658 }
659 $access = array();
660 $access['user_login'] = esc_attr($user_login);
661 $access['user_password'] = $user_pass;
662 $access['remember'] = true;
663
664 $user = null;
665 $user = new WP_User(0, $user_login);
666
667 if (is_ssl()) {
668 $ssl = true;
669 } else {
670 $ssl = false;
671 }
672
673 $user_connect = wp_signon($access, $ssl);
674 if (is_wp_error($user_connect)) {
675 if ($user_connect->get_error_code() === 'invalid_username') {
676 $error_message = esc_html__('Login is incorrect!', 'maintenance');
677
678 $class_login = 'error';
679 $class_password = 'error';
680 } elseif ($user_connect->get_error_code() === 'incorrect_password') {
681 $error_message = esc_html__('Password is incorrect!', 'maintenance');
682 $class_password = 'error';
683 } else {
684 $error_message = esc_html__('Login and password are incorrect!', 'maintenance');
685 $class_login = 'error';
686 $class_password = 'error';
687 }
688 } else {
689 wp_safe_redirect(home_url('/'));
690 exit;
691 }
692 }
693
694 return array($error_message, $class_login, $class_password, $user_login);
695 } // frontend_login
696
697
698 public function admin_bar_style()
699 {
700 $options = $this->get_options();
701
702 // admin bar has to be anabled, user an admin and custom filter true
703 if ($options['disable_toolbar_menu'] || false === is_admin_bar_showing() || false === current_user_can('manage_options')) {
704 return;
705 }
706
707 // no sense in loading a new CSS file for 2 lines of CSS
708 $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>';
709
710 self::wp_kses_wf($custom_css);
711 } // admin_bar_style
712
713
714 // add admin bar menu and status
715 public function admin_bar()
716 {
717 global $wp_admin_bar;
718 $options = $this->get_options();
719
720 // only show to admins
721 if ($options['disable_toolbar_menu'] || false === current_user_can('manage_options')) {
722 return;
723 }
724
725 $plugin_name = 'Maintenance';
726 $plugin_logo = MTNC_URL . '/img/icon-transparent.png';
727 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
728 if ($options['status'] == '1') {
729 $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>';
730 $class = 'mtnc-enabled';
731 $action_url = add_query_arg(array('action' => 'mtnc_change_status', 'new_status' => 'disabled', 'redirect' => urlencode($request_uri)), admin_url('admin.php'));
732 $action_url = wp_nonce_url($action_url, 'mtnc_change_status');
733 $action = 'Maintenance mode';
734 $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>';
735 } else {
736 $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>';
737 $class = 'mtnc-disabled';
738 $action_url = add_query_arg(array('action' => 'mtnc_change_status', 'new_status' => 'enabled', 'redirect' => urlencode($request_uri)), admin_url('admin.php'));
739 $action_url = wp_nonce_url($action_url, 'mtnc_change_status');
740 $action = 'Maintenance mode';
741 $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>';
742 }
743
744 $wp_admin_bar->add_menu(array(
745 'parent' => '',
746 'id' => 'mtnc',
747 'title' => $main_label,
748 'href' => admin_url('admin.php?page=maintenance'),
749 'meta' => array('class' => $class),
750 ));
751 $wp_admin_bar->add_node(array(
752 'id' => 'mtnc-status',
753 'title' => $action,
754 'href' => false,
755 'parent' => 'mtnc',
756 ));
757 $wp_admin_bar->add_node(array(
758 'id' => 'mtnc-preview',
759 'title' => 'Preview',
760 'href' => home_url('/') . '?maintenance-preview',
761 'parent' => 'mtnc',
762 'meta' => array('target' => '_blank'),
763 ));
764 $wp_admin_bar->add_node(array(
765 'id' => 'mtnc-settings',
766 'title' => 'Settings',
767 'href' => admin_url('admin.php?page=maintenance'),
768 'parent' => 'mtnc',
769 ));
770 } // admin_bar
771
772 /**
773 * Perform an action via AJAX
774 *
775 * @return bool
776 */
777 public function ajax_action()
778 {
779 check_ajax_referer('mtnc_action');
780 if (!current_user_can('manage_options')) {
781 wp_send_json_error(__('You are not allowed to run this action.', 'maintenance'));
782 }
783
784 $options = $this->get_options();
785
786 $action = trim(wp_unslash($_REQUEST['mtnc_action'] ?? '')); //phpcs:ignore
787 $extra_data = wp_unslash($_REQUEST['extra_data'] ?? ''); //phpcs:ignore
788 if (is_string($extra_data)) {
789 parse_str($extra_data, $extra_data);
790 } elseif (is_array($extra_data)) {
791 $extra_data = array_slice($extra_data, 0, 20);
792 } else {
793 $extra_data = false;
794 }
795
796 switch ($action) {
797 case 'save':
798 $new_options = array(
799 'theme_global' => $options['theme_global'],
800 'themes' => $options['themes'],
801 'status' => @absint($extra_data['mtnc_status']),
802 'mode' => 'layout',
803 'mtnc_page' => 0,
804 //SEO
805 'title' => strip_tags($extra_data['title']),
806 'analytics' => strip_tags($this->convert_ga($extra_data['analytics'])),
807 //Access
808 'per_url_settings' => wp_strip_all_tags($extra_data['per_url_settings']),
809 'per_url_enable_disable' => wp_strip_all_tags($extra_data['per_url_enable_disable']),
810 'login_button' => @absint($extra_data['login_button']),
811 'wplogin_button_tooltip' => wp_strip_all_tags($extra_data['wplogin_button_tooltip']),
812 );
813
814 $new_options['theme_global'] = sanitize_text_field(wp_unslash($_REQUEST['theme_global'] ?? ''));
815
816 //theme JSON will get broken by sanitization through wp_kses_post or normal functions, fields will be escaped when rendering on front-end
817 $theme = $_REQUEST['theme']; //phpcs:ignore
818 $theme_id = sanitize_text_field(wp_unslash($_REQUEST['theme_id'] ?? ''));
819 $theme_new = sanitize_text_field(wp_unslash($_REQUEST['theme_new'] ?? ''));
820 $theme_name = sanitize_text_field(wp_unslash($_REQUEST['theme_name'] ?? ''));
821
822 if (isset($_REQUEST['theme_new']) && $theme_new == true) {
823 $theme_id = md5(time() . $theme_name);
824 }
825
826 $new_options['themes'][$theme_id] = json_decode(stripslashes($theme));
827 $new_options['themes'][$theme_id]->name = $theme_name;
828
829 //Design General
830 if (isset($extra_data['theme_thumbnail'])) {
831 $new_options['themes'][$theme_id]->theme_thumbnail = wp_strip_all_tags($extra_data['theme_thumbnail']);
832 }
833 if (isset($extra_data['theme_status'])) {
834 $new_options['themes'][$theme_id]->theme_status = wp_strip_all_tags($extra_data['theme_status']);
835 }
836
837 $new_options['themes'][$theme_id]->body_font_size = wp_strip_all_tags($extra_data['body_font_size']);
838 $new_options['themes'][$theme_id]->body_font_color = wp_strip_all_tags($extra_data['body_font_color']);
839 $new_options['themes'][$theme_id]->body_font = wp_strip_all_tags($extra_data['body_font']);
840 $new_options['themes'][$theme_id]->body_link_color = wp_strip_all_tags($extra_data['body_link_color']);
841 $new_options['themes'][$theme_id]->body_link_hover_color = wp_strip_all_tags($extra_data['body_link_hover_color']);
842
843 //Design General
844 $new_options['themes'][$theme_id]->background_type = wp_strip_all_tags($extra_data['background_type']);
845 $new_options['themes'][$theme_id]->background_video = wp_strip_all_tags($extra_data['background_video']);
846 $new_options['themes'][$theme_id]->background_video_fallback = isset($extra_data['background_video_fallback']) ? wp_strip_all_tags($extra_data['background_video_fallback']) : '';
847 $new_options['themes'][$theme_id]->background_video_filter = wp_strip_all_tags($extra_data['background_video_filter']);
848 $new_options['themes'][$theme_id]->background_size_opt = wp_strip_all_tags($extra_data['background_size_opt']);
849 $new_options['themes'][$theme_id]->background_position = wp_strip_all_tags($extra_data['background_position']);
850 $new_options['themes'][$theme_id]->background_image_filter = wp_strip_all_tags($extra_data['background_image_filter']);
851 $new_options['themes'][$theme_id]->background_image = wp_strip_all_tags($extra_data['background_image']);
852 $new_options['themes'][$theme_id]->background_blur = (int)$extra_data['background_blur'];
853 $new_options['themes'][$theme_id]->login_background_color = wp_strip_all_tags($extra_data['login_background_color']);
854
855
856 $new_options['themes'][$theme_id]->preloader_background_image = wp_strip_all_tags($extra_data['preloader_background_image']);
857
858 $new_options['themes'][$theme_id]->background_color = wp_strip_all_tags($extra_data['background_color']);
859 $new_options['themes'][$theme_id]->content_overlay = isset($extra_data['content_overlay']) ? wp_strip_all_tags($extra_data['content_overlay']) : '';
860 $new_options['themes'][$theme_id]->content_width = (int) $extra_data['content_width'];
861 $new_options['themes'][$theme_id]->content_overlay_color = wp_strip_all_tags($extra_data['content_overlay_color']);
862 $new_options['themes'][$theme_id]->content_overlay_shadow_color = wp_strip_all_tags($extra_data['content_overlay_shadow_color']);
863 $new_options['themes'][$theme_id]->content_position = wp_strip_all_tags($extra_data['content_position']);
864 $new_options['themes'][$theme_id]->modules_spacing = (int) $extra_data['modules_spacing'];
865 $new_options['themes'][$theme_id]->custom_css = wp_strip_all_tags($extra_data['custom_css']);
866
867
868 $this->update_options('options', $new_options);
869 wp_send_json_success(array('theme_id' => $theme_id, 'theme' => $new_options['themes'][$theme_id]));
870 break;
871 }
872 }
873
874
875 /**
876 * Test if we're on Maintenance's admin page
877 *
878 * @return bool
879 */
880 public function is_plugin_page()
881 {
882 if (!function_exists('get_current_screen')) {
883 return false;
884 }
885
886 $current_screen = get_current_screen();
887
888 if (!empty($current_screen) && $current_screen->id == 'toplevel_page_maintenance') {
889 return true;
890 } else {
891 return false;
892 }
893 } // is_plugin_page
894
895 /**
896 * Main/starter function for displaying plugin's admin page
897 *
898 * @return null
899 */
900 public function plugin_page()
901 {
902 $options = $this->get_options();
903 // double check for admin privileges
904 if (!current_user_can('manage_options')) {
905 wp_die(esc_html__('Sorry, you are not allowed to access this page.', 'maintenance'));
906 }
907
908 echo '<div class="wrap">
909 <form class="mtnc-body mtnc-clearfix">
910 <header>
911 <div class="mtnc-header mtnc-clearfix">
912 <img src="' . esc_html(MTNC_URL . '/img/logo.png') . '" id="logo-icon" class="mtnc-logo" title="Maintenance" alt="Maintenance">';
913
914 echo '<div id="header-right">
915 <div id="header-status" title="Click to change Maintenance status">
916 <label for="mtnc_status">Maintenance</label>
917
918 <div class="onoffswitch">
919 <input type="checkbox" id="mtnc_status" name="mtnc_status" class="onoffswitch-checkbox" ' . checked($options['status'], 1, false) . ' value="1">
920 <label class="onoffswitch-label" for="mtnc_status"></label>
921 </div>
922 </div>
923 </div>';
924
925 echo '</div>
926 </header>';
927
928 $mtnc_notice = get_transient('mtnc_notice_' . get_current_user_id());
929 delete_transient('mtnc_notice_' . get_current_user_id());
930 if ($mtnc_notice !== false) {
931 self::wp_kses_wf($mtnc_notice);
932 }
933
934 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>';
935
936 echo '<div id="mtnc-tabs-wrapper">';
937 // Tab ID should be level1 or level1-level2 separated by dash, for example "welcome" or "design-background"
938 echo '<div class="mtnc-form-body">
939 <nav>
940 <div class="mtnc-float-left">
941 <div class="mtnc-mobile-menu"></div>
942 <ul class="mtnc-main-menu">';
943
944 echo '<li><a href="#themes-premade"><span class="material-icons">format_paint</span>' . esc_html__('Themes', 'maintenance') . '</a>
945 </li>
946 <li><a href="#design"><span class="material-icons">brush</span>' . esc_html__('Design', 'maintenance') . '</a>
947 <div class="mtnc-submenu">
948 <a title="Page Settings" href="#design">General</a>
949 <a title="Layout" href="#design-layout">Layout</a>
950 <a title="Background" href="#design-background">Background</a>
951 <a title="Custom CSS" href="#design-css">Custom CSS</a>
952 </div>
953 </li>
954 <li><a href="#seo"><span class="material-icons">insights</span>' . esc_html__('SEO', 'maintenance') . '</a></li>
955 <li><a href="#access"><span class="material-icons">lock</span>' . esc_html__('Access', 'maintenance') . '</a>
956 <div class="mtnc-submenu">
957 <a title="Access Settings" href="#access">Settings</a>
958 <a title="Layout" href="#access-password">Password</a>
959 </div>
960 </li>
961 <li><a href="#advanced"><span class="material-icons">settings</span>' . esc_html__('Advanced', 'maintenance') . '</a></li>
962 <li class="pro-menu"><a href="#" data-pro-feature="main-menu" class="open-pro-dialog"><span class="material-icons">star</span>PRO</a></li>';
963 echo '</ul>
964 </div>
965 </nav>';
966
967 echo '<div class="mtnc-float-right">';
968
969
970 echo '<div style="display: none;" class="mtnc-tab" id="themes-premade">';
971 $this->tab_themes_premade();
972 echo '</div>';
973
974 echo '<div style="display: none;" class="mtnc-tab" id="access">';
975 $this->tab_access();
976 echo '</div>';
977
978 echo '<div style="display: none;" class="mtnc-tab" id="access-password">';
979 $this->tab_access_password();
980 echo '</div>';
981
982 echo '<div style="display: none;" class="mtnc-tab" id="design">';
983 $this->tab_design_general();
984 echo '</div>';
985
986 echo '<div style="display: none;" class="mtnc-tab" id="design-layout">';
987 $this->tab_design_layout();
988 echo '</div>';
989
990 echo '<div style="display: none;" class="mtnc-tab" id="design-background">';
991 $this->tab_design_background();
992 echo '</div>';
993
994 echo '<div style="display: none;" class="mtnc-tab" id="design-css">';
995 $this->tab_design_css();
996 echo '</div>';
997
998 echo '<div style="display: none;" class="mtnc-tab" id="seo">';
999 $this->tab_seo();
1000 echo '</div>';
1001
1002 echo '<div style="display: none;" class="mtnc-tab" id="advanced">';
1003 $this->tab_advanced();
1004 echo '</div>';
1005
1006
1007 echo '</div>'; // tabs
1008
1009 echo '</div>'; // mtnc-form-body
1010
1011
1012 echo '</div>'; // mtnc-tabs-wrapper
1013
1014 echo '<div id="mtnc-sidebar-wrapper">';
1015
1016 echo '<div class="sidebar-box pro-ad-box">
1017 <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>
1018
1019 <ul class="plain-list">
1020 <li>Use 200+ Awesome Themes</li>
1021 <li>Unlock all Page Builder Elements</li>
1022 <li>8.5+ million Premium Images</li>
1023 <li>Easy Access for Clients through Access links</li>
1024 <li>Licenses &amp; Sites Manager (remote SaaS dashboard)</li>
1025 <li>White-label Mode + Complete Plugin Rebranding</li>
1026 <li>Email support from plugin developers</li>
1027 </ul>
1028
1029 <p class="textcenter"><a href="#" class="open-pro-dialog button button-buy" data-pro-feature="sidebar-box">Get PRO Now</a></p>
1030 </div>';
1031
1032 if (!defined('WPCAPTCHA_PLUGIN_FILE')) {
1033 echo '<div class="sidebar-box pro-ad-box" id="promo-wpcaptcha">';
1034 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>';
1035 echo '<p class="textcenter"><br><a href="#" class="install-wpcaptcha button button-primary">Install &amp; activate the free Advanced Google reCAPTCHA</a></p>';
1036 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>';
1037 echo '</div>';
1038 }
1039
1040 if (!$this->is_weglot_active()) {
1041 echo '<div class="sidebar-box pro-ad-box" id="promo-weglot">';
1042 echo '<h3>50% of your customers don\'t speak english</h3>';
1043 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>';
1044 echo '<p class="textcenter"><br><a href="#" class="button button-primary open-weglot-upsell">Install the Weglot Translate freemium plugin</a></p>';
1045 echo '</div>';
1046 }
1047
1048 if (0 && !defined('WPFSSL_OPTIONS_KEY')) {
1049 echo '<div class="sidebar-box pro-ad-box" id="promo-wpfssl">';
1050 echo '<h3>Solve all SSL problems with the free WP Force SSL plugin</h3>';
1051 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>';
1052 echo '<p class="textcenter"><br><a href="#" class="install-wpfssl button button-primary">Install &amp; activate the free WP Force SSL plugin</a></p>';
1053 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>';
1054 echo '</div>';
1055 }
1056
1057 echo '<div class="sidebar-box pro-ad-box" id="promo-review2">';
1058 echo '<h3>Help us keep the plugin free &amp; maintained</h3>';
1059 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 �
1060 �
1061 �
1062 �
1063 �
1064 stars</a>!</p>';
1065 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>';
1066 echo '</div>';
1067
1068 echo '</div>'; // mtnc-sidebar-wrapper
1069
1070
1071 echo '</form>'; // mtnc-body
1072
1073 echo '</div>'; // wrap
1074
1075 self::wp_kses_wf($this->pro_dialog());
1076 } // plugin_page
1077
1078 function is_weglot_active()
1079 {
1080 if (!function_exists('is_plugin_active') || !function_exists('get_plugin_data')) {
1081 require_once ABSPATH . 'wp-admin/includes/plugin.php';
1082 }
1083
1084 if (is_plugin_active('weglot/weglot.php')) {
1085 $weglot_info = get_plugin_data(ABSPATH . 'wp-content/plugins/weglot/weglot.php');
1086 if (version_compare($weglot_info['Version'], '2.5', '<')) {
1087 return false;
1088 } else {
1089 return true;
1090 }
1091 } else {
1092 return false;
1093 }
1094 } // mtcn_is_weglot_active
1095
1096 // check if Weglot is completely set up
1097 function is_weglot_setup()
1098 {
1099 if (!$this->is_weglot_active()) {
1100 return false;
1101 }
1102
1103 $active_languages = weglot_get_destination_languages();
1104 if (!empty($active_languages)) {
1105 return true;
1106 } else {
1107 return false;
1108 }
1109 } // is_weglot_setup
1110
1111 function pro_dialog()
1112 {
1113 $out = '';
1114
1115 $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>';
1116
1117 $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>';
1118
1119 $out .= '<span>Limited PRO Discount - <b>all prices are LIFETIME</b>! Pay once &amp; use forever!</span>';
1120 $out .= '</div>';
1121
1122 $out .= '<table id="mtnc-pro-table">';
1123 $out .= '<tr>';
1124 $out .= '<td class="center">Lifetime Personal License</td>';
1125 $out .= '<td class="center">Lifetime Team License</td>';
1126 $out .= '<td class="center">Lifetime Agency License</td>';
1127 $out .= '</tr>';
1128
1129 $out .= '<tr class="prices">';
1130 $out .= '<td class="center"><del>$49 /year</del><br><span>$69</span> <b>/lifetime</b></td>';
1131 $out .= '<td class="center"><del>$89 /year</del><br><span>$79</span> <b>/lifetime</b></td>';
1132 $out .= '<td class="center"><del>$199 /year</del><br><span>$119</span> <b>/lifetime</b></td>';
1133 $out .= '</tr>';
1134
1135 $out .= '<tr>';
1136 $out .= '<td><span class="dashicons dashicons-yes"></span><b>1 Site License</b></td>';
1137 $out .= '<td><span class="dashicons dashicons-yes"></span><b>5 Sites License</b></td>';
1138 $out .= '<td><span class="dashicons dashicons-yes"></span><b>100 Sites License</b></td>';
1139 $out .= '</tr>';
1140
1141 $out .= '<tr>';
1142 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
1143 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
1144 $out .= '<td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>';
1145 $out .= '</tr>';
1146
1147 $out .= '<tr>';
1148 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
1149 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
1150 $out .= '<td><span class="dashicons dashicons-yes"></span>Lifetime Updates &amp; Support</td>';
1151 $out .= '</tr>';
1152
1153 $out .= '<tr>';
1154 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
1155 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
1156 $out .= '<td><span class="dashicons dashicons-yes"></span>+200 Themes</td>';
1157 $out .= '</tr>';
1158
1159 $out .= '<tr>';
1160 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
1161 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
1162 $out .= '<td><span class="dashicons dashicons-yes"></span>+8.5 Million HD Images</td>';
1163 $out .= '</tr>';
1164
1165 $out .= '<tr>';
1166 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
1167 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
1168 $out .= '<td><span class="dashicons dashicons-yes"></span>5 new themes each month guaranteed</td>';
1169 $out .= '</tr>';
1170
1171 $out .= '<tr>';
1172 $out .= '<td><span class="dashicons dashicons-no"></span>Licenses &amp; Sites Manager</td>';
1173 $out .= '<td><span class="dashicons dashicons-yes"></span>Licenses &amp; Sites Manager</td>';
1174 $out .= '<td><span class="dashicons dashicons-yes"></span>Licenses &amp; Sites Manager</td>';
1175 $out .= '</tr>';
1176
1177 $out .= '<tr>';
1178 $out .= '<td><span class="dashicons dashicons-no"></span>White-label Mode</td>';
1179 $out .= '<td><span class="dashicons dashicons-yes"></span>White-label Mode</td>';
1180 $out .= '<td><span class="dashicons dashicons-yes"></span>White-label Mode</td>';
1181 $out .= '</tr>';
1182
1183 $out .= '<tr>';
1184 $out .= '<td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>';
1185 $out .= '<td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>';
1186 $out .= '<td><span class="dashicons dashicons-yes"></span>Full Plugin Rebranding</td>';
1187 $out .= '</tr>';
1188
1189 $out .= '<tr>';
1190 $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>';
1191 $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>';
1192 $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>';
1193 $out .= '</tr>';
1194
1195 $out .= '</table>';
1196
1197 $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>';
1198
1199
1200 // weglot install dialog
1201 $out .= '<div id="weglot-upsell-dialog" style="display: none;" title="Weglot"><span class="ui-helper-hidden-accessible"><input type="text"/></span>';
1202 $out .= '<div style="padding: 20px; font-size: 15px;">';
1203 $out .= '<ul class="mtnc-list">';
1204 $out .= '<li>Best-rated WordPress multilingual plugin</li>';
1205 $out .= '<li>Simple 5-minute set-up. No coding required</li>';
1206 $out .= '<li>Accelerated translation management: AI powered & human translations with access to professional translators</li>';
1207 $out .= '<li>Compatible with any WordPress theme or plugin</li>';
1208 $out .= '<li>Optimized for multilingual SEO</li>';
1209 $out .= '<li>14-day Free trial and free plan available</li>';
1210 $out .= '</ul>';
1211 $out .= '<p class="upsell-footer"><a class="button button-primary" id="install-weglot">Install &amp; activate Weglot to make your website multilingual</a></p>';
1212 $out .= '</div>';
1213 $out .= '</div>';
1214 // weglot install dialog
1215
1216 return $out;
1217 } // pro_dialog
1218
1219 public function tab_footer($tab = false)
1220 {
1221 echo '<div class="mtnc-tab-footer">';
1222
1223
1224 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>';
1225 echo '<div data-caption="Save Changes" name="mtnc_submit" class="mtnc-btn mtnc-btn-save mtnc_submit">Save Changes</div>';
1226
1227 echo '</div>';
1228 }
1229
1230
1231 /**
1232 * Echoes content for themes tab
1233 *
1234 * @return null
1235 */
1236 private function tab_themes_premade()
1237 {
1238 echo '<div class="mtnc-tile-title">Themes</div>';
1239 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>';
1240
1241 $options = $this->get_options();
1242 echo '<div id="mtnc-themes-wrapper">';
1243
1244 $themes = [
1245 '5f2f8c65307b6f3097f2ca4d25d5cb26' => 'Adventure Blog',
1246 '883f61d5131f6c7b558ccde9c5d1f411' => 'Analytics',
1247 '00cf8a2ca9efec1e8aea483568e2a8d8' => 'Baby Store',
1248 'ccdbb99fd1dfecd36e13d5a4cff45d21' => 'Burger Palace',
1249 '0a0c5efe1e95f91a42bc9e6e6ca884dd' => 'Business',
1250 '781cb3af776a041533735bdfc59e811a' => 'Car Repair',
1251 'e8e6f070f05eae0367699e6dc7963439' => 'Design Agency',
1252 '06142f926b2da71d8dddfba3254a78cb' => 'Digital Marketing Agency',
1253 'd41b1b0a6d4cb304e886121b3118cfa0' => 'Fashion',
1254 '7f96d3918bd5840258a6dce654f4b0dc' => 'Flower Shop',
1255 'b6e3012a316272608e1bbfac4d6b5a78' => 'Food Recommendation',
1256 '310e65d9600903508451d5670ab0c33f' => 'Freelance',
1257 '1c498ed60de01a93c2a4cac0ab50ddc2' => 'Gaming',
1258 'da24f016888540131b49800c7b8cb07e' => 'Health Service',
1259 '4dc670fa8069dd1293b85cf6235ceb25' => 'Hiking',
1260 'bb9f78a54648fe776fe7cdce018d4649' => 'Interior Design',
1261 '0888b7c6cfdfde868ad842b76f47dbdc' => 'Jewelry Shop',
1262 '9dd2a18f38bcfdcb6fce7b037c22e1ec' => 'Marketing',
1263 'bce5308440264fa4a8ce9cf1b38f3242' => 'Mobile App',
1264 'b20f2da4e5cd0753638723ff12383378' => 'Non-Profit Organization',
1265 '2c6c47a437172cf970e9027ab7c4f680' => 'Photography',
1266 'ea2584e286d8e0304994f4d9d9e4d335' => 'Podcast',
1267 'f7432f296c75f398c018ebbd0118cf1f' => 'Product Marketing',
1268 '274bd92fd91aadc05fe0637f614633d8' => 'Restaurant',
1269 '1ff8ca16c5010eec8797eb5416373c6d' => 'Skincare',
1270 'eb668b7221bb4ed50c8edc8aebb68ba4' => 'Sport',
1271 'a61a5890d7db6cef943729dc082f24e0' => 'Tech Conference',
1272 '1e26f176878e01991d42463cce0d3182' => 'Training',
1273 '906d50132e2caf64ad57d9c76b07f78c' => 'Travel Vlog',
1274 'd1dd1f82d0d557460f22ac7058c291e0' => 'Wedding',
1275 '35b404155b3be97d198dadf05ddfc960' => 'Wellness',
1276 '293e20f552ddd1e851351a93408be322' => 'Winery',
1277 ];
1278
1279 echo '<div class="theme-card">';
1280 echo '<div class="theme-card-background" style="background-image:url(\'' . esc_url(MTNC_URL) . 'img/themes/default.jpg' . '\')"></div>';
1281 echo '<div class="theme-card-title" title="Default">';
1282 echo 'Default Theme';
1283 echo '</div>';
1284 echo '<div class="theme-card-buttons">';
1285 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
1286 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>';
1287 echo '</div>';
1288 echo '</div>';
1289
1290 foreach ($themes as $theme_id => $theme_name) {
1291 echo '<div class="theme-card">';
1292 echo '<div class="theme-card-background" style="background-image:url(\'' . esc_url(MTNC_URL . 'img/themes/' . $theme_id . '.jpg') . '\')"></div>';
1293 echo '<div class="theme-card-title" title="' . esc_html($theme_name) . '">';
1294 echo esc_html(substr($theme_name, 0, 30));
1295 echo '</div>';
1296 echo '<div class="theme-card-buttons">';
1297 echo '<a href="" class="open-pro-dialog mtnc-btn mtnc-btn-small" data-pro-feature="theme-business">Install</a>';
1298 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>';
1299 echo '</div>';
1300 echo '<div class="ribbon" title="PRO theme. Click \'Get this theme\' for more info."><i><span class="dashicons dashicons-star-filled"></span></i></div>';
1301 echo '</div>';
1302 }
1303
1304 echo '</div>';
1305
1306 $this->tab_footer();
1307 } // tab_themes
1308
1309 /**
1310 * Echoes content for access tab
1311 *
1312 * @return null
1313 */
1314 private function tab_access()
1315 {
1316 $options = $this->get_options();
1317
1318 echo '<div class="mtnc-tile-title">Access</div>';
1319 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>';
1320
1321 echo '<div class="mtnc-double-group clearfix">';
1322 echo '<div class="mtnc-form-group">';
1323 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>';
1324 echo '<div class="toggle-wrapper">';
1325 echo '<input id="show_logged_in" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="show_logged_in" value="1">';
1326 echo '<label for="show_logged_in" class="toggle"><span class="toggle_handler"></span></label>';
1327 echo '</div>';
1328
1329 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>';
1330 echo '</div>';
1331 echo '<div class="mtnc-form-group">';
1332 echo '<label for="ip_whitelist" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="ip_whitelist">IP Whitelisting <sup>PRO</sup></label>';
1333 echo '<textarea rows="2" class="mtnc-form-control open-pro-dialog pro-disabled" name="ip_whitelist" id="ip_whitelist"></textarea>';
1334 $ip_address = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? ''));
1335 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>';
1336 echo '</div>';
1337 echo '</div>';
1338
1339 echo '<div class="mtnc-double-group clearfix">';
1340 echo '<div class="mtnc-form-group">';
1341 echo '<label for="per_url_settings" class="mtnc-strong">URL Based Rules</label>';
1342 echo '<select name="per_url_settings" id="per_url_settings">';
1343 $per_url_settings = array(
1344 array('val' => '', 'label' => esc_html__('Disabled', 'maintenance')),
1345 array('val' => 'whitelist', 'label' => esc_html__('Listed URLs will NEVER be affected by maintenance mode', 'maintenance')),
1346 array('val' => 'blacklist', 'label' => esc_html__('ONLY listed URLs CAN BE affected by maintenance mode', 'maintenance')),
1347 );
1348 self::wp_kses_wf($this->create_select_options($per_url_settings, $options['per_url_settings'], false));
1349 echo '</select>';
1350 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>';
1351 echo '</div>';
1352
1353 echo '<div class="mtnc-form-group per-url-wrapper">';
1354 echo '<label for="per_url_enable_disable" class="mtnc-strong">URL List</label>';
1355 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>';
1356 echo '<p class="mtnc-form-help-block">Enter one URL per line. Start and end URLs with a forward slash (/).</p>';
1357 echo '</div>';
1358 echo '</div>';
1359
1360 echo '<div class="mtnc-double-group mtnc-clearfix">';
1361 echo '<div class="mtnc-form-group">';
1362 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>';
1363 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>';
1364 echo '<p class="mtnc-form-help-block">Share this link with people who need to see the normal site behind the maintenance page.</p>';
1365 echo '</div>';
1366
1367 echo '<div class="mtnc-form-group">';
1368 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>';
1369 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>';
1370 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>';
1371 echo '</div>';
1372 echo '</div>';
1373
1374 echo '<div class="mtnc-double-group mtnc-clearfix">';
1375 echo '<div class="mtnc-form-group">';
1376 echo '<label for="login_button" class="mtnc-strong">Show Login Button</label>';
1377 echo '<div class="toggle-wrapper">';
1378
1379 echo '<input id="login_button" type="checkbox" name="login_button" value="1" ' . checked('1', (isset($options['login_button']) ? esc_html($options['login_button']) : ''), false) . '>';
1380 echo '<label for="login_button" class="toggle"><span class="toggle_handler"></span></label>';
1381 echo '</div>';
1382 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>';
1383 echo '</div>';
1384
1385 echo '<div class="mtnc-form-group">';
1386 echo '<label for="wplogin_button_tooltip" class="mtnc-strong">WordPress Login Button Tooltip</label>';
1387 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>';
1388 echo '<p class="mtnc-form-help-block">Text for the "Access WordPress admin" button tooltip.</p>';
1389 echo '</div>';
1390 echo '</div>';
1391 $this->tab_footer();
1392 } // tab_access
1393
1394 /**
1395 * Echoes content for access password tab
1396 *
1397 * @return null
1398 */
1399 private function tab_access_password()
1400 {
1401 $options = $this->get_options();
1402
1403 echo '<div class="mtnc-tile-title">Password Protection</div>';
1404 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>';
1405
1406 echo '<div class="mtnc-double-group mtnc-clearfix">';
1407 echo '<div class="mtnc-form-group">';
1408 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>';
1409 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>';
1410 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>';
1411 echo '</div>';
1412
1413 echo '<div class="mtnc-form-group">';
1414 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>';
1415 echo '<div class="toggle-wrapper">';
1416 echo '<input id="password_button" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="password_button" value="1">';
1417 echo '<label for="password_button" class="toggle"><span class="toggle_handler"></span></label>';
1418 echo '</div>';
1419 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>';
1420 echo '</div>';
1421 echo '</div>';
1422
1423 echo '<div class="mtnc-double-group mtnc-clearfix">';
1424 echo '<div class="mtnc-form-group">';
1425 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>';
1426 echo '<div class="toggle-wrapper">';
1427 echo '<input id="maintenance_password_toggle" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="maintenance_password_toggle" value="1">';
1428 echo '<label for="maintenance_password_toggle" class="toggle"><span class="toggle_handler"></span></label>';
1429 echo '</div>';
1430 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>';
1431 echo '</div>';
1432
1433 echo '<div class="mtnc-form-group" id="maintenance_password_wrapper">';
1434 echo '<label for="maintenance_password" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="maintenance-page-password">Password <sup>PRO</sup></label>';
1435 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>';
1436 echo '<p class="mtnc-form-help-block">The password has to be at least 4 characters long.</p>';
1437 echo '</div>';
1438 echo '</div>';
1439
1440 echo '<div class="mtnc-double-group mtnc-clearfix">';
1441 echo '<div class="mtnc-form-group">';
1442 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>';
1443 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>';
1444 echo '<p class="mtnc-form-help-block">The message displayed in the password popup above the password input. </p>';
1445 echo '</div>';
1446
1447 echo '<div class="mtnc-form-group">';
1448 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>';
1449 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>';
1450 echo '<p class="mtnc-form-help-block">Text for the password popup button.</p>';
1451 echo '</div>';
1452 echo '</div>';
1453
1454 echo '<div class="mtnc-double-group mtnc-clearfix">';
1455 echo '<div class="mtnc-form-group">';
1456 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>';
1457 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>';
1458 echo '<p class="mtnc-form-help-block">Text for the "Wrong Password" message.</p>';
1459 echo '</div>';
1460
1461 echo '<div class="mtnc-form-group">';
1462 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>';
1463 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>';
1464 echo '<p class="mtnc-form-help-block">Text for the "Direct Access login" button tooltip.</p>';
1465 echo '</div>';
1466 echo '</div>';
1467 $this->tab_footer();
1468 } // tab_access_password
1469
1470 /**
1471 * Admin footer text
1472 *
1473 * @since 5.0
1474 *
1475 * @return null
1476 */
1477 public function admin_footer_text($text)
1478 {
1479 if (!$this->is_plugin_page()) {
1480 return $text;
1481 }
1482
1483 $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>';
1484
1485 return $text;
1486 } // admin_footer_text
1487
1488 /**
1489 * Add links to plugin's description in plugins table
1490 *
1491 * @param array $links Initial list of links.
1492 * @param string $file Basename of current plugin.
1493 *
1494 * @return array
1495 */
1496 function plugin_meta_links($links, $file)
1497 {
1498 if ($file !== plugin_basename(__FILE__)) {
1499 return $links;
1500 }
1501
1502 $support_link = '<a target="_blank" href="' . $this->generate_web_link('plugins-table-right', '/support/') . '" title="Get help">Support</a>';
1503 $home_link = '<a target="_blank" href="' . $this->generate_web_link('plugins-table-right') . '" title="Plugin Homepage">Plugin Homepage</a>';
1504
1505 $links[] = $support_link;
1506 $links[] = $home_link;
1507
1508 return $links;
1509 } // plugin_meta_links
1510
1511
1512 /**
1513 * Helper function for generating UTM tagged links
1514 *
1515 * @param string $placement Optional. UTM content param.
1516 * @param string $page Optional. Page to link to.
1517 * @param array $params Optional. Extra URL params.
1518 * @param string $anchor Optional. URL anchor part.
1519 *
1520 * @return string
1521 */
1522 public function generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '')
1523 {
1524 $base_url = 'https://wpmaintenancemode.com';
1525
1526 if ('/' != $page) {
1527 $page = '/' . trim($page, '/') . '/';
1528 }
1529 if ($page == '//') {
1530 $page = '/';
1531 }
1532
1533 $parts = array_merge(array('utm_source' => 'maintenance-free', 'utm_content' => $placement), $params);
1534
1535 if (!empty($anchor)) {
1536 $anchor = '#' . trim($anchor, '#');
1537 }
1538
1539 $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
1540
1541 return $out;
1542 } // generate_web_link
1543
1544
1545 function generate_dashboard_link($placement = '', $page = '/', $params = array(), $anchor = '')
1546 {
1547 $base_url = 'https://dashboard.wpmaintenancemode.com';
1548
1549 if ('/' != $page) {
1550 $page = '/' . trim($page, '/') . '/';
1551 }
1552 if ($page == '//') {
1553 $page = '/';
1554 }
1555
1556 $parts = array_merge(array('utm_source' => 'maintenance-free', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'maintenance-free-v' . $this->version), $params);
1557
1558 if (!empty($anchor)) {
1559 $anchor = '#' . trim($anchor, '#');
1560 }
1561
1562 $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
1563
1564 return $out;
1565 } // generate_dashboard_link
1566
1567
1568 /**
1569 * Echoes content for design header such as theme name
1570 *
1571 * @return null
1572 */
1573 private function design_header()
1574 {
1575 $options = $this->get_options();
1576
1577 echo '<div class="mtnc-theme-title">';
1578 if ($options['theme_global'] == $this->theme_id) {
1579 echo '<span class="mtnc-theme-active dashicons dashicons-star-filled" title="This is the currently active theme"></span>';
1580 }
1581 echo 'Editing theme <span class="mtnc-theme-title-name">' . esc_html($this->theme->name) . '</span>';
1582 echo '<a href="' . esc_url(admin_url('admin.php?page=maintenance#themes')) . '">switch theme</a>';
1583 echo '</div>';
1584 }
1585
1586 /**
1587 * Echoes content for design-general tab
1588 *
1589 * @return null
1590 */
1591 private function tab_design_general()
1592 {
1593 $fonts = $this->get_fonts();
1594 $options = $this->get_options();
1595
1596 echo '<div class="mtnc-double-group mtnc-clearfix">';
1597 echo '<div class="mtnc-form-group">';
1598 echo '<label for="show_logged_in" class="mtnc-strong">Multilingual Support</label>';
1599 echo '<div class="toggle-wrapper">';
1600 echo '<input id="weglot_translate" type="checkbox" class="mtnc-form-ios open-weglot-upsell" name="content_overlay" value="1">';
1601 echo '<label for="weglot_translate" class="toggle open-weglot-upsell"><span class="toggle_handler"></span></label>';
1602 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>';
1603 echo '</div>';
1604 echo '</div>';
1605 echo '</div>';
1606
1607 echo '<div class="mtnc-double-group mtnc-clearfix">';
1608 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
1609 echo '<label for="body_font_size" class="mtnc-strong">Content Text Size</label>';
1610 echo '<div class="range-slider-wrapper">';
1611 echo '<input type="range" name="body_font_size" value="' . esc_attr($this->theme->body_font_size) . '" min="6" max="300" class="range-slider">';
1612 echo '</div>';
1613 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->body_font_size) . '</span>px';
1614 echo '<p class="mtnc-form-help-block">Don\'t be afraid to make to font a bit bigger. Default: 16px;</p>';
1615 echo '</div>';
1616
1617 echo '<div class="mtnc-form-group">';
1618 echo '<label for="body_font_color" class="mtnc-strong">Content Text Color</label>';
1619 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}">';
1620 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>';
1621 echo '</div>';
1622 echo '</div>';
1623
1624 echo '<div class="mtnc-double-group mtnc-clearfix">';
1625 echo '<div class="mtnc-form-group">';
1626 echo '<label for="body_font" class="mtnc-strong">Content Font</label>';
1627 echo '<select name="body_font" id="body_font" class="mtnc-bunny-fonts">';
1628 // Listing fonts from the array
1629 foreach ($fonts as $font) {
1630 echo '<option value="' . esc_html($font) . '"' . selected($font, $this->theme->body_font, false) . '>' . esc_html($font) . '</option>' . "\n";
1631 }
1632 echo '</select>';
1633 echo '<h3>' . esc_html__('This is how the content font is going to look!', 'maintenance') . '</h3>';
1634 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>';
1635 echo '</div>';
1636 echo '</div>';
1637
1638 echo '<div class="mtnc-double-group mtnc-clearfix">';
1639 echo '<div class="mtnc-form-group">';
1640 echo '<label for="body_link_color" class="mtnc-strong">Link Color</label>';
1641 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}">';
1642 echo '<p class="mtnc-form-help-block">Make sure it stands out but make it fit your color scheme.</p>';
1643 echo '</div>';
1644
1645 echo '<div class="mtnc-form-group">';
1646 echo '<label for="body_link_hover_color" class="mtnc-strong">Link Hover Color</label>';
1647 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}">';
1648 echo '<p class="mtnc-form-help-block">Generally it\'s a lighter or darker variation of the normal link color.</p>';
1649 echo '</div>';
1650
1651 echo '</div>';
1652
1653 echo '<div class="mtnc-double-group mtnc-clearfix">';
1654 echo '<div class="mtnc-form-group">';
1655 echo '<label for="show_logged_in" class="mtnc-strong">Content Overlay</label>';
1656 echo '<div class="toggle-wrapper">';
1657 echo '<input id="content_overlay" type="checkbox" class="mtnc-form-ios" name="content_overlay" value="1" ' . checked('1', $this->theme->content_overlay, false) . '>';
1658 echo '<label for="content_overlay" class="toggle"><span class="toggle_handler"></span></label>';
1659 echo '<p class="mtnc-form-help-block">If enabled, applies a transparent background to the entire content section of the page.</p>';
1660 echo '</div>';
1661 echo '</div>';
1662
1663 echo '<div class="mtnc-form-group overlay_parameters">';
1664 echo '<label for="body_font" class="mtnc-strong">Content Position</label>';
1665 $content_positions = array(
1666 'left' => 'Top Left',
1667 'right' => 'Top Right',
1668 'center' => 'Top Center',
1669 'middle' => 'Middle Center',
1670 'bottom' => 'Bottom Center',
1671 );
1672 echo '<select name="content_position" id="content_position">';
1673 foreach ($content_positions as $position => $label) {
1674 echo '<option value="' . esc_html($position) . '"' . selected($position, $this->theme->content_position, false) . '>' . esc_html($label) . '</option>' . "\n";
1675 }
1676 echo '</select>';
1677 echo '<p class="mtnc-form-help-block">Content box position on the page.</p>';
1678 echo '</div>';
1679 echo '</div>';
1680
1681 echo '<div class="mtnc-double-group mtnc-clearfix overlay_parameters">';
1682 echo '<div class="mtnc-form-group" ' . (!$this->theme->content_overlay ? 'style="display:none;"' : '') . '>';
1683 echo '<label for="content_overlay_color" class="mtnc-strong">Content Overlay Color</label>';
1684 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}">';
1685 echo '<p class="mtnc-form-help-block">Background color for the content overlay.</p>';
1686 echo '</div>';
1687
1688 echo '<div class="mtnc-form-group" ' . (!$this->theme->content_overlay ? 'style="display:none;"' : '') . '>';
1689 echo '<label for="content_overlay_shadow_color" class="mtnc-strong">Content Overlay Shadow Color</label>';
1690 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}">';
1691 echo '<p class="mtnc-form-help-block">Shadow color for the content overlay.</p>';
1692 echo '</div>';
1693
1694 echo '</div>';
1695
1696 echo '<div class="mtnc-double-group mtnc-clearfix">';
1697 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
1698 echo '<label for="content_width" class="mtnc-strong">Content Width</label>';
1699 echo '<div class="range-slider-wrapper">';
1700 echo '<input type="range" name="content_width" value="' . esc_attr($this->theme->content_width) . '" min="200" max="1600" class="range-slider">';
1701 echo '</div>';
1702 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->content_width) . '</span>px';
1703 echo '<p class="mtnc-form-help-block">Maximum content width. Default: 600px.</p>';
1704 echo '</div>';
1705
1706 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
1707 echo '<label for="modules_spacing" class="mtnc-strong">Modules Spacing</label>';
1708 echo '<div class="range-slider-wrapper">';
1709 echo '<input type="range" name="modules_spacing" value="' . esc_attr($this->theme->modules_spacing) . '" min="0" max="50" class="range-slider">';
1710 echo '</div>';
1711 echo '<span class="range_value" data-unit="px">' . esc_attr($this->theme->modules_spacing) . '</span>px';
1712 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>';
1713 echo '</div>';
1714 echo '</div>';
1715
1716 $this->tab_footer('design');
1717 } // tab_design_general
1718
1719
1720 /**
1721 * Echoes content for design-background tab
1722 *
1723 * @return null
1724 */
1725 private function tab_design_background()
1726 {
1727 $options = $this->get_options();
1728 $filters = array(
1729 array('val' => '', 'label' => 'No Filter'),
1730 array('label' => '1977', 'val' => ' _1977'),
1731 array('label' => 'Aden', 'val' => ' aden'),
1732 array('label' => 'Black & White', 'val' => ' blackwhite'),
1733 array('label' => 'Brannan', 'val' => ' brannan'),
1734 array('label' => 'Brooklyn', 'val' => ' brooklyn'),
1735 array('label' => 'Clarendon', 'val' => ' clarendon'),
1736 array('label' => 'Earlybird', 'val' => ' earlybird'),
1737 array('label' => 'Gingham', 'val' => ' gingham'),
1738 array('label' => 'Hudson', 'val' => ' hudson'),
1739 array('label' => 'Inkwell', 'val' => ' inkwell'),
1740 array('label' => 'Kelvin', 'val' => ' kelvin'),
1741 array('label' => 'Lark', 'val' => ' lark'),
1742 array('label' => 'Lo-Fi', 'val' => ' lofi'),
1743 array('label' => 'Maven', 'val' => ' maven'),
1744 array('label' => 'Mayfair', 'val' => ' mayfair'),
1745 array('label' => 'Moon', 'val' => ' moon'),
1746 array('label' => 'Nashville', 'val' => ' nashville'),
1747 array('label' => 'Perpetua', 'val' => ' perpetua'),
1748 array('label' => 'Reyes', 'val' => ' reyes'),
1749 array('label' => 'Rise', 'val' => ' rise'),
1750 array('label' => 'Slumber', 'val' => ' slumber'),
1751 array('label' => 'Stinson', 'val' => ' stinson'),
1752 array('label' => 'Toaster', 'val' => ' toaster'),
1753 array('label' => 'Valencia', 'val' => ' valencia'),
1754 array('label' => 'Walden', 'val' => ' walden'),
1755 array('label' => 'Willow', 'val' => ' willow'),
1756 array('label' => 'X-pro II', 'val' => ' xpro2'),
1757 );
1758
1759
1760 echo '<div class="mtnc-tile-title">Background</div>';
1761 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>';
1762
1763 echo '<div class="mtnc-section-content">';
1764 echo '<div class="mtnc-double-group mtnc-clearfix">';
1765 echo '<div class="mtnc-form-group">';
1766 echo '<label for="background_type" class="mtnc-strong">Background Type</label>';
1767 echo '<select name="background_type" id="background_type">';
1768 $bg_type = array(
1769 array('val' => 'image', 'label' => 'Image'),
1770 array('val' => 'video', 'label' => 'Video'),
1771 );
1772 $this->create_select_options($bg_type, $this->theme->background_type);
1773 echo '</select>';
1774
1775 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>';
1776 echo '</div>';
1777 echo '</div>';
1778
1779 echo '<div class="background-type background-type-video">';
1780 echo '<div class="mtnc-double-group mtnc-clearfix">';
1781 echo '<div class="mtnc-form-group">';
1782 echo '<label for="background_video" class="mtnc-strong">Background Video ID</label>';
1783 echo '<input type="text" name="background_video" id="background_video" value="' . esc_attr($this->theme->background_video) . '" placeholder="UFHQzF593ak" class="mtnc-form-control">';
1784 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>';
1785 echo '<div id="video-preview" class="rise">';
1786 echo '<div class="video-container"></div>';
1787 echo '</div>';
1788 echo '</div>';
1789
1790 echo '<div class="mtnc-form-group">';
1791 echo '<label for="background_video_filter" class="mtnc-strong">Background Video Filter</label>';
1792 echo '<select name="background_video_filter" id="background_video_filter">';
1793 $this->create_select_options($filters, $this->theme->background_video_filter);
1794 echo '</select>';
1795 echo '<p class="mtnc-form-help-block">The filter is immediately applied to the video preview.</p>';
1796 echo '</div>';
1797 echo '</div>';
1798
1799 echo '<div class="mtnc-double-group mtnc-clearfix">';
1800 echo '<div class="mtnc-upload-group mtnc-clearfix">';
1801 echo '<div class="mtnc-form-group border-fix">';
1802 echo '<div class="mtnc-image-upload-wrapper">';
1803 echo '<label class="mtnc-strong">Mobile Video Fallback Image</label>';
1804 if (stripos($this->theme->background_video_fallback, 'undefined index') !== false) {
1805 $this->theme->background_video_fallback = '';
1806 }
1807 if (!empty($this->theme->background_video_fallback)) {
1808 echo '<span class="mtnc-preview-area" id="video-fallback-preview"><img src="' . esc_attr($this->theme->background_video_fallback) . '" /></span>';
1809 } else {
1810 echo '<span class="mtnc-preview-area" id="video-fallback-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
1811 }
1812
1813 echo '<input type="hidden" name="fallback" id="fallback" class="mm_upload_image_input" value="' . esc_attr($this->theme->background_video_fallback) . '">';
1814 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>';
1815 echo '<span class="mtnc-upload-append">';
1816 if (!empty($this->theme->background_video_fallback)) {
1817 echo '&nbsp;<a href="javascript: void(0);" class="mtnc-remove-image">' . esc_html__('Remove', 'maintenance') . '</a>';
1818 }
1819 echo '</span>';
1820 echo '</div>';
1821 echo '</div>';
1822 echo '</div>';
1823 echo '</div>';
1824 echo '</div>';
1825
1826 echo '<div class="background-type background-type-image">';
1827 echo '<div class="mtnc-upload-group mtnc-clearfix">';
1828 echo '<div class="mtnc-form-group border-fix">';
1829 echo '<div class="mtnc-image-upload-wrapper">';
1830 echo '<label class="mtnc-strong">Background Image</label>';
1831
1832 echo '<input type="hidden" name="background_image" id="background_image" class="mtnc-image-upload-input" value="' . esc_attr($this->theme->background_image) . '">';
1833
1834 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($this->theme->background_image) ? 'style="background-image:url(\'' . esc_attr($this->theme->background_image) . '\')"' : '') . '>';
1835 if (empty($this->theme->background_image)) {
1836 echo '<img src="' . esc_url(MTNC_URL . '/img/icons/image.png') . '">';
1837 echo '<span class="mtnc-preview-area" id="background-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
1838 }
1839 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>';
1840 if (!empty($this->theme->background_image)) {
1841 echo '<button type="button" class="button mtnc-image-upload-remove" style="margin-top: 4px">Remove</button>';
1842 }
1843 echo '</div>';
1844 echo '</div>';
1845 echo '</div>';
1846 echo '</div>';
1847 echo '</div>';
1848
1849 echo '<div class="mtnc-double-group mtnc-clearfix">';
1850 echo '<div class="mtnc-form-group">';
1851 echo '<label for="background_size_opt" class="mtnc-strong">Background Image Size</label>';
1852 echo '<select name="background_size_opt" id="background_size_opt">';
1853 $bkg_opt = array(
1854 array('val' => 'auto', 'label' => 'Auto'),
1855 array('val' => 'contain', 'label' => 'Contain'),
1856 array('val' => 'cover', 'label' => 'Cover'),
1857 );
1858 $this->create_select_options($bkg_opt, $this->theme->background_size_opt);
1859 echo '</select>';
1860
1861 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>';
1862 echo '</div>';
1863
1864 echo '<div class="mtnc-form-group">';
1865 echo '<label for="background_image_filter" class="mtnc-strong">Background Image Filter</label>';
1866 echo '<select name="background_image_filter" id="background_image_filter">';
1867 $this->create_select_options($filters, $this->theme->background_image_filter);
1868 echo '</select>';
1869 echo '<p class="mtnc-form-help-block">The filter is immediately applied to the background image thumbnail above for a preview.</p>';
1870 echo '</div>';
1871 echo '</div>';
1872
1873 echo '<div class="mtnc-double-group mtnc-clearfix">';
1874 echo '<div class="mtnc-form-group">';
1875 echo '<label for="background_position" class="mtnc-strong">Background Image Position</label>';
1876 echo '<select name="background_position" id="background_position">';
1877 $positions = array(
1878 array('val' => '', 'label' => 'Auto'),
1879 array('val' => 'left top', 'label' => 'Top left'),
1880 array('val' => 'center top', 'label' => 'Top center'),
1881 array('val' => 'right top', 'label' => 'Top right'),
1882 array('val' => 'left center', 'label' => 'Center left'),
1883 array('val' => 'center center', 'label' => 'Center'),
1884 array('val' => 'right center', 'label' => 'Center right'),
1885 array('val' => 'left bottom', 'label' => 'Bottom left'),
1886 array('val' => 'center bottom', 'label' => 'Bottom center'),
1887 array('val' => 'right bottom', 'label' => 'Bottom right'),
1888 );
1889 $this->create_select_options($positions, $this->theme->background_position);
1890 echo '</select>';
1891
1892 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>';
1893 echo '</div>';
1894
1895 echo '<div class="mtnc-form-group mtnc-swal-input-wrapper">';
1896 echo '<label for="background_blur" class="mtnc-strong">Background Blur</label>';
1897 echo '<div class="range-slider-wrapper">';
1898 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">';
1899 echo '</div>';
1900 echo '<span class="range_value" data-unit="px">' . (isset($this->theme->background_blur) ? esc_attr($this->theme->background_blur) : '') . '</span>px';
1901 echo '<p class="mtnc-form-help-block">Blur the background image to make the content more visible</p>';
1902 echo '</div>';
1903
1904
1905 echo '</div>';
1906
1907 echo '<div class="mtnc-double-group mtnc-clearfix">';
1908 echo '<div class="mtnc-form-group">';
1909 echo '<label for="background_color" class="mtnc-strong">' . esc_html__('Background Color', 'maintenance') . '</label>';
1910 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}">';
1911 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>';
1912 echo '</div>';
1913
1914 echo '<div class="mtnc-form-group">';
1915 echo '<label for="login_background_color" class="mtnc-strong">' . esc_html__('Login Background Color', 'maintenance') . '</label>';
1916 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}">';
1917 echo '<p class="mtnc-form-help-block">Background color of the login sidebar.</p>';
1918 echo '</div>';
1919
1920
1921
1922 echo '</div>';
1923
1924 echo '<div class="background-type background-type-image">';
1925 echo '<div class="mtnc-upload-group mtnc-clearfix">';
1926 echo '<div class="mtnc-form-group border-fix">';
1927 echo '<div class="mtnc-image-upload-wrapper">';
1928 echo '<label class="mtnc-strong">Preloader Image</label>';
1929
1930 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) : '') . '">';
1931
1932 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) . '\')"' : '') . '>';
1933 if (empty($this->theme->preloader_background_image)) {
1934 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
1935 echo '<span class="mtnc-preview-area" id="background-preview">Select an image from our 400,000+ images gallery, or upload your own</span>';
1936 }
1937 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>';
1938 if (!empty($this->theme->preloader_background_image)) {
1939 echo '<button type="button" class="button mtnc-image-upload-remove" style="margin-top: 4px">Remove</button>';
1940 }
1941 echo '</div>';
1942 echo '</div>';
1943 echo '</div>';
1944 echo '<p class="mtnc-form-help-block">Preloader image to replace the default gear icon.</p>';
1945 echo '</div>';
1946 echo '</div>';
1947
1948
1949
1950 echo '</div>';
1951 $this->tab_footer('design');
1952 } // tab_design_background
1953
1954 /**
1955 * Echoes content for design-layout tab
1956 *
1957 * @return null
1958 */
1959 private function tab_design_layout()
1960 {
1961 $modules = $this->get_modules();
1962
1963
1964 // Modules
1965 echo '<div class="arrange-wrapper" id="mtnc-theme-builder-modules-wrapper"><span class="arrange-label">Available Modules</span>';
1966 echo '<ul id="mtnc-theme-builder-modules" class="mtnc-theme-builder">';
1967 foreach ($modules as $module => $module_properties) {
1968 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"') . '>';
1969 if ($module_properties['pro'] === true) {
1970 echo '<div class="pro-module-label">PRO</div>';
1971 }
1972 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 />';
1973 echo '<span class="module-name">' . esc_html($module_properties['name']) . '</span>';
1974 echo '<div class="module-actions"><span class="module-name">' . esc_html($module_properties['name']) . '</span>';
1975 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>';
1976 echo '<a title="Edit module" href="#" class="mtnc-edit-module" title="Edit module"><span class="dashicons dashicons-edit"></span></a>';
1977 echo '<a title="Clone module" href="#" class="mtnc-clone-module" title="Clone module"><span class="dashicons dashicons-admin-page"></span></a>';
1978 echo '<a href="#" class="mtnc-remove-module" title="Remove module from maintenance page"><span class="dashicons dashicons-trash"></span></a>';
1979 echo '</li>';
1980 }
1981 echo '</ul></div>';
1982
1983 //Layout
1984 echo '<div class="arrange-wrapper mtnc-theme-builder-right-col">';
1985 echo '<div class="arrange-wrapper" id="mtnc-theme-builder-layout-wrapper">';
1986 echo '<div class="browser-header">
1987 <div class="browser-button-wrapper">
1988 <div class="browser-button browser-button-red"></div>
1989 <div class="browser-button browser-button-yellow"></div>
1990 <div class="browser-button browser-button-green"></div>
1991 </div>
1992 <div class="browser-bar">
1993 <span class="material-icons">navigate_before</span>
1994 <span class="material-icons">navigate_next</span>
1995 <span class="material-icons">refresh</span>
1996 <div class="browser-input"></div>
1997 </div>
1998 </div>';
1999 echo '<ul id="mtnc-theme-builder-layout" class="mtnc-theme-builder">';
2000 echo '</ul>';
2001 echo '</div>';
2002
2003
2004
2005 $this->tab_footer('design');
2006 echo '</div>';
2007
2008 echo '<input type="hidden" name="theme" id="theme" value="">';
2009 } // tab_design_layout
2010
2011 /**
2012 * Echoes content for design-css tab
2013 *
2014 * @return null
2015 */
2016 public function tab_design_css()
2017 {
2018 echo '<div class="mtnc-tile-title">Custom CSS</div>';
2019 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>';
2020 echo '<div id="custom_css_editor"></div>';
2021 echo '<textarea class="mtnc-form-control" id="custom_css" name="custom_css">' . esc_html($this->theme->custom_css) . '</textarea>';
2022 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>';
2023 $this->tab_footer('design');
2024 } //tab_design_css
2025
2026 /**
2027 * Echoes content for settings tab
2028 *
2029 * @return null
2030 */
2031 private function tab_seo()
2032 {
2033 $options = $this->get_options();
2034 echo '<div class="mtnc-tile-title">SEO</div>';
2035 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>';
2036
2037 //SEO Preview and Analysis
2038 echo '<div class="mtnc-double-group clearfix" style="margin-top:20px; padding-bottom:20px; display: flex;">';
2039 echo '<div class="mtnc-seo-snippet mtnc-form-group">';
2040 echo '<div class="mtnc-strong">SEO Snippet Preview</div>';
2041 echo '<br />';
2042 echo '<div class="mtnc-seo-snippet-preview">';
2043 echo '<h3 id="mtnc-seo-snippet-title">' . esc_attr(stripslashes($options['title'])) . '</h3>';
2044 echo '<cite id="mtnc-seo-snippet-url">' . esc_url(home_url()) . '</cite>';
2045 echo '<div id="mtnc-seo-snippet-description">' . esc_attr(stripslashes($options['description'])) . '</div>';
2046 echo '<br />';
2047 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>';
2048 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">';
2049 echo '<div id="mtnc-seo-gage">
2050 <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>
2051 </div></div>';
2052 echo '</div>';
2053
2054 echo '<div class="mtnc-seo-analysis mtnc-form-group">';
2055 echo '<div class="mtnc-strong">SEO Analysis</div>';
2056 echo '<br />';
2057 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>';
2058 echo '</div>';
2059 echo '</div>';
2060
2061 echo '<div class="mtnc-double-group clearfix" id="seotitle">';
2062 //SEO Title
2063 echo '<div class="mtnc-form-group">';
2064 echo '<label for="title" class="mtnc-strong">SEO Title</label>';
2065 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">';
2066 echo '<div class="mtnc-seo-progress " id="mtnc-seo-progress-title">';
2067 echo '<div class="mtnc-seo-progress-bar"></div>';
2068 echo '</div>';
2069 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>';
2070 echo '</div>';
2071
2072 //Meta Description
2073 echo '<div class="mtnc-form-group">';
2074 echo '<label for="description" class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-description">Meta Description <sup>PRO</sup></label>';
2075 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>';
2076 echo '<div class="mtnc-seo-progress " id="mtnc-seo-progress-description">';
2077 echo '<div class="mtnc-seo-progress-bar"></div>';
2078 echo '</div>';
2079 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>';
2080 echo '</div>';
2081 echo '</div>';
2082
2083 echo '<div class="mtnc-double-group clearfix" id="mtnc-blockse">';
2084
2085 //Show normal website to Search Engines?
2086 echo '<div class="mtnc-form-group">';
2087 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>';
2088 echo '<div class="toggle-wrapper">';
2089 echo '<input type="checkbox" class="mtnc-form-ios open-pro-dialog open-pro-dialog pro-disabled" name="excludese" id="excludese" value="1">';
2090 echo '<label for="excludese" class="toggle"><span class="toggle_handler"></span></label>';
2091 echo '</div>';
2092 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>';
2093 echo '</div>';
2094
2095 //Discourage Search Engine crawlers
2096 echo '<div class="mtnc-form-group">';
2097 echo '<label for="blockse" class="mtnc-strong">Enable 503 <i>(Service Unavailable)</i> status code to discourage Search Engine crawlers</label>';
2098 echo '<div class="toggle-wrapper">';
2099 echo '<input type="checkbox" class="mtnc-form-ios" name="blockse" id="blockse" value="1" ' . checked('1', $options['blockse'], false) . '>';
2100 echo '<label for="blockse" class="toggle"><span class="toggle_handler"></span></label>';
2101 echo '</div>';
2102 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>';
2103 echo '</div>';
2104 echo '</div>';
2105
2106 echo '<div class="mtnc-double-group mtnc-clearfix" style="flex-wrap: wrap;">';
2107 //Favicon
2108 echo '<div class="mtnc-form-group border-fix">';
2109 echo '<div class="mtnc-image-upload-wrapper">';
2110 echo '<label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-favicon">Favicon Image <sup>PRO</sup></label>';
2111 echo '<input type="hidden" name="favicon" id="favicon" class="mtnc-image-upload-input" value="' . esc_attr($options['favicon']) . '">';
2112
2113 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($options['favicon']) ? 'style="background-image:url(\'' . esc_attr($options['favicon']) . '\')"' : '') . '>';
2114 if (empty($options['favicon'])) {
2115 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
2116 }
2117 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>';
2118
2119 echo '</div>';
2120 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>';
2121 echo '</div>';
2122 echo '</div>';
2123
2124 //Social Preview Image
2125 echo '<div class="mtnc-form-group border-fix">';
2126 echo '<div class="mtnc-image-upload-wrapper">';
2127 echo '<label class="mtnc-strong pro-option open-pro-dialog" data-pro-feature="seo-social-preview">Social Preview Image <sup>PRO</sup></label>';
2128 echo '<input type="hidden" name="social_preview" id="social_preview" class="mtnc-image-upload-input" value="' . esc_attr($options['social_preview']) . '">';
2129
2130 echo '<div class="mtnc-image-upload-preview-wrapper" ' . (isset($options['favicon']) ? 'style="background-image:url(\'' . esc_attr($options['social_preview']) . '\')"' : '') . '>';
2131 if (empty($options['social_preview'])) {
2132 echo '<img src="' . esc_html(MTNC_URL . '/img/icons/image.png') . '">';
2133 }
2134 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>';
2135
2136 echo '</div>';
2137
2138 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>';
2139 echo '</div>';
2140 echo '</div>';
2141
2142
2143 echo '</div>';
2144
2145 echo '<div class="mtnc-double-group mtnc-clearfix">';
2146 //Google Analytics Tracking ID
2147 echo '<div class="mtnc-form-group">';
2148 echo '<label for="analytics" class="mtnc-strong">Google Analytics Tracking ID</label>';
2149 echo '<input name="analytics" id="analytics" placeholder="UA-123456-99" value="' . esc_attr($options['analytics']) . '">';
2150
2151 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>';
2152 echo '</div>';
2153
2154 //Tracking Pixel and 3rd Party Analytics Code
2155 echo '<div class="mtnc-form-group">';
2156 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>';
2157 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>';
2158 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>';
2159 echo '</div>';
2160 echo '</div>';
2161
2162 echo '<div class="mtnc-double-group clearfix">';
2163 //Facebook Page URL
2164 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>';
2165 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="">';
2166 echo '<p class="mtnc-form-help-block">Full URL to your Facebook page, including the <i>https://</i> prefix.</p>';
2167 echo '</div>';
2168
2169 //Twitter @username
2170 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>';
2171 echo '<input class="mtnc-form-control open-pro-dialog pro-disabled" placeholder="@mytwitterhandle" type="text" id="twitter_site" name="twitter_site" value="">';
2172 echo '<p class="mtnc-form-help-block">X (Twitter) handle name including the @ sign, ie: @john.</p>';
2173 echo '</div>';
2174 echo '</div>';
2175 $this->tab_footer();
2176 } // tab_seo
2177
2178 /**
2179 * Echoes content for advanced tab
2180 *
2181 * @return null
2182 */
2183 private function tab_advanced()
2184 {
2185 $options = $this->get_options();
2186
2187 echo '<div class="mtnc-tile-title">Advanced</div>';
2188 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>';
2189
2190 echo '<div class="mtnc-double-group clearfix">';
2191 echo '<div class="mtnc-form-group">';
2192 echo '<a class="mtnc-btn open-pro-dialog pro-button" data-pro-feature="export-settings">Export Settings <sup>PRO</sup></a>';
2193 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>';
2194 echo '</div>';
2195
2196 echo '<div class="mtnc-form-group">';
2197 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>';
2198 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>';
2199 echo '</div>';
2200 echo '</div>';
2201
2202 echo '<div class="mtnc-double-group clearfix">';
2203 echo '<div class="mtnc-form-group">';
2204 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
2205 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>';
2206 echo '<p class="mtnc-form-help-block">All settings are reset to default values. There is NO undo.</p>';
2207 echo '</div>';
2208 echo '</div>';
2209
2210 echo '<div class="mtnc-double-group clearfix">';
2211
2212 echo '<div class="mtnc-form-group">';
2213 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>';
2214 echo '<div class="toggle-wrapper">';
2215 echo '<input id="no_cache_headers" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="no_cache_headers" value="1">';
2216 echo '<label for="no_cache_headers" class="toggle"><span class="toggle_handler"></span></label>';
2217 echo '</div>';
2218 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>';
2219 echo '</div>';
2220
2221 $plugin_name = 'Maintenance';
2222
2223 echo '<div class="mtnc-form-group">';
2224 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>';
2225 echo '<div class="toggle-wrapper">';
2226 echo '<input id="disable_toolbar_menu" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="disable_toolbar_menu" value="1">';
2227 echo '<label for="disable_toolbar_menu" class="toggle"><span class="toggle_handler"></span></label>';
2228 echo '</div>';
2229 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>';
2230 echo '</div>';
2231
2232 echo '</div>';
2233
2234 echo '<div class="mtnc-double-group clearfix">';
2235
2236 echo '<div class="mtnc-form-group">';
2237 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>';
2238 echo '<div class="toggle-wrapper">';
2239 echo '<input id="force_ssl" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="force_ssl" value="1">';
2240 echo '<label for="force_ssl" class="toggle"><span class="toggle_handler"></span></label>';
2241 echo '</div>';
2242 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>
2243 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>';
2244 echo '</div>';
2245
2246 echo '<div class="mtnc-form-group">';
2247 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>';
2248 echo '<div class="toggle-wrapper">';
2249 echo '<input id="enable_rest" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="enable_rest" value="1">';
2250 echo '<label for="enable_rest" class="toggle"><span class="toggle_handler"></span></label>';
2251 echo '</div>';
2252 echo '<p class="mtnc-form-help-block">Allow WordPress REST API calls while maintenance mode is enabled.</p>';
2253 echo '</div>';
2254
2255 echo '</div>';
2256
2257 echo '<div class="mtnc-form-group clearfix">';
2258 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>';
2259 echo '<div class="toggle-wrapper">';
2260 echo '<input id="custom_wp_maintenance" type="checkbox" class="mtnc-form-ios open-pro-dialog pro-disabled" name="custom_wp_maintenance" value="1">';
2261 echo '<label for="custom_wp_maintenance" class="toggle"><span class="toggle_handler"></span></label>';
2262 echo '</div>';
2263 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>
2264 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>';
2265 echo '</div>';
2266
2267 echo '<div class="mtnc-form-group clearfix custom_wp_maintenance_options">';
2268 echo '<label for="custom_wp_maintenance_title" class="mtnc-strong">Maintenance page title</label>';
2269 echo '<input class="mtnc-form-control" placeholder="" type="text" id="custom_wp_maintenance_title" name="custom_wp_maintenance_title" value="">';
2270 echo '</div>';
2271
2272 echo '<div class="mtnc-form-group clearfix custom_wp_maintenance_options">';
2273 echo '<label for="custom_wp_maintenance_title" class="mtnc-strong">Maintenance page content</label>';
2274 wp_editor(stripslashes($options['custom_wp_maintenance_content']), 'custom_wp_maintenance_content', $settings = array(
2275 'textarea_rows' => 10,
2276 'media_buttons' => 1,
2277 'teeny' => false,
2278 'editor_class' => 'skip_save',
2279 ));
2280 echo '</div>';
2281
2282 $this->tab_footer();
2283 } // tab_advanced
2284
2285
2286 /**
2287 * Reset Settings
2288 *
2289 * @return null
2290 */
2291 public function mtnc_reset_settings()
2292 {
2293 check_admin_referer('mtnc_admin_action');
2294
2295 if (!current_user_can('manage_options')) {
2296 wp_send_json_error(__('You are not allowed to run this action.', 'maintenance'));
2297 }
2298
2299 $options = $this->get_options();
2300 $default_theme_id = md5(time() . 'default');
2301 $reset = sanitize_text_field(wp_unslash($_GET['reset'] ?? '')) == 'settings' ? 'settings':'theme';
2302
2303 if($reset == 'theme'){
2304 $new_options = $options;
2305 } else {
2306 $new_options = array(
2307 'status' => '0',
2308 'mode' => 'layout',
2309 'mtnc_page' => 0,
2310 'header_text' => 'Our site is under maintenance!',
2311 //SEO
2312 'title' => get_bloginfo('name') . ' is under maintenance',
2313 'description' => 'We are doing some work on our site. Please come back later. We\'ll be up and running in no time.',
2314 'target_keyword' => 'maintenance',
2315 'excludese' => '0',
2316 'blockse' => '0',
2317 'favicon' => '',
2318 'social_preview' => '',
2319 'analytics' => '',
2320 'tracking_pixel' => '',
2321 'twitter_site' => '',
2322 'facebook_site' => '',
2323 //Access
2324 'show_logged_in' => '1',
2325 'ip_whitelist' => '',
2326 'per_url_settings' => '',
2327 'per_url_enable_disable' => '',
2328 'direct_access_link' => '',
2329 'custom_login_url' => '',
2330 'login_button' => '1',
2331 'wplogin_button_tooltip' => 'Access WordPress admin',
2332 'maintenance_password' => '',
2333 'site_password' => '',
2334 'password_button' => '0',
2335 'login_button_text' => 'Access the Site',
2336 'login_message' => 'Please enter the password to access the site',
2337 'login_wrong_password_text' => 'Wrong password',
2338 'login_button_tooltip' => 'Direct Access login',
2339 //Advanced
2340 'no_cache_headers' => '1',
2341 'disable_toolbar_menu' => '',
2342 'force_ssl' => '',
2343 'enable_rest' => '',
2344 'custom_wp_maintenance' => '',
2345 'custom_wp_maintenance_title' => '',
2346 'custom_wp_maintenance_content' => '',
2347 'upgraded' => $options['upgraded']
2348 );
2349 }
2350
2351 $new_options['theme_global'] = $default_theme_id;
2352 $new_options['themes'] = array($default_theme_id => json_decode(
2353 '{
2354 "modules": {
2355 "header-dbd02cd1": {
2356 "name": "Header",
2357 "type": "header",
2358 "groups": {
2359 "header": {
2360 "name": "Header",
2361 "active": true,
2362 "fields": {
2363 "text": {
2364 "type": "text",
2365 "name": "text",
2366 "label": "Text",
2367 "value": "Site is undergoing maintenance",
2368 "class": "full-width",
2369 "desc": ""
2370 },
2371 "text_align": {
2372 "type": "radio",
2373 "name": "text_align",
2374 "label": "Text Align",
2375 "class": "",
2376 "values": {
2377 "left": "Left",
2378 "center": "Center",
2379 "right": "Right"
2380 },
2381 "value": "center"
2382 },
2383 "font_size": {
2384 "type": "range",
2385 "name": "font_size",
2386 "label": "Font Size",
2387 "value": "47",
2388 "min": 6,
2389 "max": 120,
2390 "class": "",
2391 "units": {
2392 "px": "px",
2393 "pt": "pt",
2394 "em": "em"
2395 },
2396 "unit_value": "px"
2397 },
2398 "color": {
2399 "type": "color",
2400 "name": "text_color",
2401 "label": "Color",
2402 "value": "rgba(255,255,255,1)",
2403 "desc": ""
2404 },
2405 "font": {
2406 "type": "font",
2407 "name": "font",
2408 "label": "Font",
2409 "value": "Open Sans",
2410 "class": "full-width",
2411 "desc": ""
2412 },
2413 "line_height": {
2414 "type": "number",
2415 "name": "line_height",
2416 "label": "Line Height",
2417 "value": "2",
2418 "units": {
2419 "px": "px",
2420 "percent": "%",
2421 "em": "em"
2422 },
2423 "unit_value": "em",
2424 "class": "number_small",
2425 "desc": ""
2426 }
2427 }
2428 },
2429 "layout": {
2430 "name": "Layout",
2431 "fields": {
2432 "padding_label": {
2433 "type": "label",
2434 "name": "padding_label",
2435 "label": "Padding"
2436 },
2437 "padding_top": {
2438 "type": "number",
2439 "name": "padding_top",
2440 "label": "Top",
2441 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
2442 "value": "10",
2443 "class": "number_small",
2444 "units": {
2445 "px": "px",
2446 "percent": "%",
2447 "em": "em"
2448 },
2449 "unit_value": "px",
2450 "wrapper_class": "col-4"
2451 },
2452 "padding_bottom": {
2453 "type": "number",
2454 "name": "padding_bottom",
2455 "label": "Bottom",
2456 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
2457 "value": "10",
2458 "class": "number_small",
2459 "units": {
2460 "px": "px",
2461 "percent": "%",
2462 "em": "em"
2463 },
2464 "unit_value": "px",
2465 "wrapper_class": "col-4"
2466 },
2467 "padding_left": {
2468 "type": "number",
2469 "name": "padding_left",
2470 "label": "Left",
2471 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
2472 "value": "0",
2473 "class": "number_small",
2474 "units": {
2475 "px": "px",
2476 "percent": "%",
2477 "em": "em"
2478 },
2479 "unit_value": "px",
2480 "wrapper_class": "col-4"
2481 },
2482 "padding_right": {
2483 "type": "number",
2484 "name": "padding_right",
2485 "label": "Right",
2486 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
2487 "value": "0",
2488 "class": "number_small",
2489 "units": {
2490 "px": "px",
2491 "percent": "%",
2492 "em": "em"
2493 },
2494 "unit_value": "px",
2495 "wrapper_class": "col-4"
2496 },
2497 "margin_label": {
2498 "type": "label",
2499 "name": "margin_label",
2500 "label": "Margin"
2501 },
2502 "margin_top": {
2503 "type": "number",
2504 "name": "margin_top",
2505 "label": "Top",
2506 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
2507 "value": "0",
2508 "class": "number_small",
2509 "units": {
2510 "px": "px",
2511 "percent": "%",
2512 "em": "em"
2513 },
2514 "unit_value": "px",
2515 "wrapper_class": "col-4"
2516 },
2517 "margin_bottom": {
2518 "type": "number",
2519 "name": "margin_bottom",
2520 "label": "Bottom",
2521 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
2522 "value": "0",
2523 "class": "number_small",
2524 "units": {
2525 "px": "px",
2526 "percent": "%",
2527 "em": "em"
2528 },
2529 "unit_value": "px",
2530 "wrapper_class": "col-4"
2531 },
2532 "margin_left": {
2533 "type": "number",
2534 "name": "margin_left",
2535 "label": "Left",
2536 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
2537 "value": "0",
2538 "class": "number_small",
2539 "units": {
2540 "px": "px",
2541 "percent": "%",
2542 "em": "em"
2543 },
2544 "unit_value": "px",
2545 "wrapper_class": "col-4"
2546 },
2547 "margin_right": {
2548 "type": "number",
2549 "name": "margin_right",
2550 "label": "Right",
2551 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
2552 "value": "0",
2553 "class": "number_small",
2554 "units": {
2555 "px": "px",
2556 "percent": "%",
2557 "em": "em"
2558 },
2559 "unit_value": "px",
2560 "wrapper_class": "col-4"
2561 },
2562 "background_label": {
2563 "type": "label",
2564 "name": "background_label",
2565 "label": "Background"
2566 },
2567 "background_color": {
2568 "type": "color",
2569 "name": "background_color",
2570 "nolabel": true,
2571 "value": "rgba(255,255,255,0)",
2572 "desc": ""
2573 },
2574 "background": {
2575 "type": "image",
2576 "name": "background",
2577 "nolabel": true,
2578 "value": "",
2579 "class": "",
2580 "desc": ""
2581 }
2582 }
2583 }
2584 }
2585 },
2586 "content-471365b7": {
2587 "name": "Content",
2588 "type": "content",
2589 "groups": {
2590 "col1": {
2591 "name": "Footer",
2592 "active": true,
2593 "fields": {
2594 "text": {
2595 "type": "textarea",
2596 "name": "text",
2597 "label": "Text",
2598 "value": "Maintenance mode is on",
2599 "class": "full-width",
2600 "desc": ""
2601 },
2602 "font_size": {
2603 "type": "number",
2604 "name": "font_size",
2605 "label": "Font Size",
2606 "value": "36",
2607 "class": "number_small",
2608 "units": {
2609 "px": "px",
2610 "pt": "pt",
2611 "em": "em"
2612 },
2613 "unit_value": "px"
2614 },
2615 "color": {
2616 "type": "color",
2617 "name": "text_color",
2618 "label": "Color",
2619 "value": "rgba(255,255,255,1)",
2620 "desc": ""
2621 },
2622 "font": {
2623 "type": "font",
2624 "name": "font",
2625 "label": "Font",
2626 "value": "Open Sans",
2627 "class": "full-width",
2628 "desc": ""
2629 },
2630 "line_height": {
2631 "type": "number",
2632 "name": "line_height",
2633 "label": "Line Height",
2634 "value": "1",
2635 "units": {
2636 "px": "px",
2637 "percent": "%",
2638 "em": "em"
2639 },
2640 "unit_value": "em",
2641 "class": "number_small",
2642 "desc": ""
2643 }
2644 }
2645 },
2646 "layout": {
2647 "name": "Layout",
2648 "fields": {
2649 "padding_label": {
2650 "type": "label",
2651 "name": "padding_label",
2652 "label": "Padding"
2653 },
2654 "padding_top": {
2655 "type": "number",
2656 "name": "padding_top",
2657 "label": "Top",
2658 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
2659 "value": "100",
2660 "class": "number_small",
2661 "units": {
2662 "px": "px",
2663 "percent": "%",
2664 "em": "em"
2665 },
2666 "unit_value": "px",
2667 "wrapper_class": "col-4"
2668 },
2669 "padding_bottom": {
2670 "type": "number",
2671 "name": "padding_bottom",
2672 "label": "Bottom",
2673 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
2674 "value": "10",
2675 "class": "number_small",
2676 "units": {
2677 "px": "px",
2678 "percent": "%",
2679 "em": "em"
2680 },
2681 "unit_value": "px",
2682 "wrapper_class": "col-4"
2683 },
2684 "padding_left": {
2685 "type": "number",
2686 "name": "padding_left",
2687 "label": "Left",
2688 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
2689 "value": "0",
2690 "class": "number_small",
2691 "units": {
2692 "px": "px",
2693 "percent": "%",
2694 "em": "em"
2695 },
2696 "unit_value": "px",
2697 "wrapper_class": "col-4"
2698 },
2699 "padding_right": {
2700 "type": "number",
2701 "name": "padding_right",
2702 "label": "Right",
2703 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
2704 "value": "0",
2705 "class": "number_small",
2706 "units": {
2707 "px": "px",
2708 "percent": "%",
2709 "em": "em"
2710 },
2711 "unit_value": "px",
2712 "wrapper_class": "col-4"
2713 },
2714 "margin_label": {
2715 "type": "label",
2716 "name": "margin_label",
2717 "label": "Margin"
2718 },
2719 "margin_top": {
2720 "type": "number",
2721 "name": "margin_top",
2722 "label": "Top",
2723 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
2724 "value": "0",
2725 "class": "number_small",
2726 "units": {
2727 "px": "px",
2728 "percent": "%",
2729 "em": "em"
2730 },
2731 "unit_value": "px",
2732 "wrapper_class": "col-4"
2733 },
2734 "margin_bottom": {
2735 "type": "number",
2736 "name": "margin_bottom",
2737 "label": "Bottom",
2738 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
2739 "value": "0",
2740 "class": "number_small",
2741 "units": {
2742 "px": "px",
2743 "percent": "%",
2744 "em": "em"
2745 },
2746 "unit_value": "px",
2747 "wrapper_class": "col-4"
2748 },
2749 "margin_left": {
2750 "type": "number",
2751 "name": "margin_left",
2752 "label": "Left",
2753 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
2754 "value": "0",
2755 "class": "number_small",
2756 "units": {
2757 "px": "px",
2758 "percent": "%",
2759 "em": "em"
2760 },
2761 "unit_value": "px",
2762 "wrapper_class": "col-4"
2763 },
2764 "margin_right": {
2765 "type": "number",
2766 "name": "margin_right",
2767 "label": "Right",
2768 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
2769 "value": "0",
2770 "class": "number_small",
2771 "units": {
2772 "px": "px",
2773 "percent": "%",
2774 "em": "em"
2775 },
2776 "unit_value": "px",
2777 "wrapper_class": "col-4"
2778 },
2779 "background_label": {
2780 "type": "label",
2781 "name": "background_label",
2782 "label": "Background"
2783 },
2784 "background_color": {
2785 "type": "color",
2786 "name": "background_color",
2787 "nolabel": true,
2788 "value": "rgba(255,255,255,0)",
2789 "desc": ""
2790 },
2791 "background": {
2792 "type": "image",
2793 "name": "background",
2794 "nolabel": true,
2795 "value": "",
2796 "class": "",
2797 "desc": ""
2798 }
2799 }
2800 }
2801 }
2802 },
2803 "content-9742e2f8": {
2804 "name": "Content",
2805 "type": "content",
2806 "groups": {
2807 "col1": {
2808 "name": "Footer",
2809 "active": true,
2810 "fields": {
2811 "text": {
2812 "type": "textarea",
2813 "name": "text",
2814 "label": "Text",
2815 "value": "Site will be available soon. Thank you for your patience!",
2816 "class": "full-width",
2817 "desc": ""
2818 },
2819 "font_size": {
2820 "type": "number",
2821 "name": "font_size",
2822 "label": "Font Size",
2823 "value": "20",
2824 "class": "number_small",
2825 "units": {
2826 "px": "px",
2827 "pt": "pt",
2828 "em": "em"
2829 },
2830 "unit_value": "px"
2831 },
2832 "color": {
2833 "type": "color",
2834 "name": "text_color",
2835 "label": "Color",
2836 "value": "rgba(255,255,255,1)",
2837 "desc": ""
2838 },
2839 "font": {
2840 "type": "font",
2841 "name": "font",
2842 "label": "Font",
2843 "value": "Open Sans",
2844 "class": "full-width",
2845 "desc": ""
2846 },
2847 "line_height": {
2848 "type": "number",
2849 "name": "line_height",
2850 "label": "Line Height",
2851 "value": "1",
2852 "units": {
2853 "px": "px",
2854 "percent": "%",
2855 "em": "em"
2856 },
2857 "unit_value": "em",
2858 "class": "number_small",
2859 "desc": ""
2860 }
2861 }
2862 },
2863 "layout": {
2864 "name": "Layout",
2865 "fields": {
2866 "padding_label": {
2867 "type": "label",
2868 "name": "padding_label",
2869 "label": "Padding"
2870 },
2871 "padding_top": {
2872 "type": "number",
2873 "name": "padding_top",
2874 "label": "Top",
2875 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
2876 "value": "10",
2877 "class": "number_small",
2878 "units": {
2879 "px": "px",
2880 "percent": "%",
2881 "em": "em"
2882 },
2883 "unit_value": "px",
2884 "wrapper_class": "col-4"
2885 },
2886 "padding_bottom": {
2887 "type": "number",
2888 "name": "padding_bottom",
2889 "label": "Bottom",
2890 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
2891 "value": "10",
2892 "class": "number_small",
2893 "units": {
2894 "px": "px",
2895 "percent": "%",
2896 "em": "em"
2897 },
2898 "unit_value": "px",
2899 "wrapper_class": "col-4"
2900 },
2901 "padding_left": {
2902 "type": "number",
2903 "name": "padding_left",
2904 "label": "Left",
2905 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
2906 "value": "0",
2907 "class": "number_small",
2908 "units": {
2909 "px": "px",
2910 "percent": "%",
2911 "em": "em"
2912 },
2913 "unit_value": "px",
2914 "wrapper_class": "col-4"
2915 },
2916 "padding_right": {
2917 "type": "number",
2918 "name": "padding_right",
2919 "label": "Right",
2920 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
2921 "value": "0",
2922 "class": "number_small",
2923 "units": {
2924 "px": "px",
2925 "percent": "%",
2926 "em": "em"
2927 },
2928 "unit_value": "px",
2929 "wrapper_class": "col-4"
2930 },
2931 "margin_label": {
2932 "type": "label",
2933 "name": "margin_label",
2934 "label": "Margin"
2935 },
2936 "margin_top": {
2937 "type": "number",
2938 "name": "margin_top",
2939 "label": "Top",
2940 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
2941 "value": "0",
2942 "class": "number_small",
2943 "units": {
2944 "px": "px",
2945 "percent": "%",
2946 "em": "em"
2947 },
2948 "unit_value": "px",
2949 "wrapper_class": "col-4"
2950 },
2951 "margin_bottom": {
2952 "type": "number",
2953 "name": "margin_bottom",
2954 "label": "Bottom",
2955 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
2956 "value": "0",
2957 "class": "number_small",
2958 "units": {
2959 "px": "px",
2960 "percent": "%",
2961 "em": "em"
2962 },
2963 "unit_value": "px",
2964 "wrapper_class": "col-4"
2965 },
2966 "margin_left": {
2967 "type": "number",
2968 "name": "margin_left",
2969 "label": "Left",
2970 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
2971 "value": "0",
2972 "class": "number_small",
2973 "units": {
2974 "px": "px",
2975 "percent": "%",
2976 "em": "em"
2977 },
2978 "unit_value": "px",
2979 "wrapper_class": "col-4"
2980 },
2981 "margin_right": {
2982 "type": "number",
2983 "name": "margin_right",
2984 "label": "Right",
2985 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
2986 "value": "0",
2987 "class": "number_small",
2988 "units": {
2989 "px": "px",
2990 "percent": "%",
2991 "em": "em"
2992 },
2993 "unit_value": "px",
2994 "wrapper_class": "col-4"
2995 },
2996 "background_label": {
2997 "type": "label",
2998 "name": "background_label",
2999 "label": "Background"
3000 },
3001 "background_color": {
3002 "type": "color",
3003 "name": "background_color",
3004 "nolabel": true,
3005 "value": "rgba(255,255,255,0)",
3006 "desc": ""
3007 },
3008 "background": {
3009 "type": "image",
3010 "name": "background",
3011 "nolabel": true,
3012 "value": "",
3013 "class": "",
3014 "desc": ""
3015 }
3016 }
3017 }
3018 }
3019 },
3020 "footer-a29820d6": {
3021 "name": "Footer",
3022 "type": "footer",
3023 "groups": {
3024 "col1": {
3025 "name": "Footer",
3026 "active": true,
3027 "fields": {
3028 "text": {
3029 "type": "textarea",
3030 "name": "text",
3031 "label": "Text",
3032 "value": "© Maintenance 2026",
3033 "class": "full-width",
3034 "desc": ""
3035 },
3036 "font_size": {
3037 "type": "number",
3038 "name": "font_size",
3039 "label": "Font Size",
3040 "value": "24",
3041 "class": "number_small",
3042 "units": {
3043 "px": "px",
3044 "pt": "pt",
3045 "em": "em"
3046 },
3047 "unit_value": "px"
3048 },
3049 "color": {
3050 "type": "color",
3051 "name": "text_color",
3052 "label": "Color",
3053 "value": "rgba(255,255,255,1)",
3054 "desc": ""
3055 },
3056 "font": {
3057 "type": "font",
3058 "name": "font",
3059 "label": "Font",
3060 "value": "Open Sans",
3061 "class": "full-width",
3062 "desc": ""
3063 },
3064 "line_height": {
3065 "type": "number",
3066 "name": "line_height",
3067 "label": "Line Height",
3068 "value": "1",
3069 "units": {
3070 "px": "px",
3071 "percent": "%",
3072 "em": "em"
3073 },
3074 "unit_value": "em",
3075 "class": "number_small",
3076 "desc": ""
3077 }
3078 }
3079 },
3080 "layout": {
3081 "name": "Layout",
3082 "fields": {
3083 "padding_label": {
3084 "type": "label",
3085 "name": "padding_label",
3086 "label": "Padding"
3087 },
3088 "padding_top": {
3089 "type": "number",
3090 "name": "padding_top",
3091 "label": "Top",
3092 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_top.png",
3093 "value": "10",
3094 "class": "number_small",
3095 "units": {
3096 "px": "px",
3097 "percent": "%",
3098 "em": "em"
3099 },
3100 "unit_value": "px",
3101 "wrapper_class": "col-4"
3102 },
3103 "padding_bottom": {
3104 "type": "number",
3105 "name": "padding_bottom",
3106 "label": "Bottom",
3107 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_bottom.png",
3108 "value": "10",
3109 "class": "number_small",
3110 "units": {
3111 "px": "px",
3112 "percent": "%",
3113 "em": "em"
3114 },
3115 "unit_value": "px",
3116 "wrapper_class": "col-4"
3117 },
3118 "padding_left": {
3119 "type": "number",
3120 "name": "padding_left",
3121 "label": "Left",
3122 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_left.png",
3123 "value": "0",
3124 "class": "number_small",
3125 "units": {
3126 "px": "px",
3127 "percent": "%",
3128 "em": "em"
3129 },
3130 "unit_value": "px",
3131 "wrapper_class": "col-4"
3132 },
3133 "padding_right": {
3134 "type": "number",
3135 "name": "padding_right",
3136 "label": "Right",
3137 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/padding_right.png",
3138 "value": "0",
3139 "class": "number_small",
3140 "units": {
3141 "px": "px",
3142 "percent": "%",
3143 "em": "em"
3144 },
3145 "unit_value": "px",
3146 "wrapper_class": "col-4"
3147 },
3148 "margin_label": {
3149 "type": "label",
3150 "name": "margin_label",
3151 "label": "Margin"
3152 },
3153 "margin_top": {
3154 "type": "number",
3155 "name": "margin_top",
3156 "label": "Top",
3157 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_top.png",
3158 "value": "0",
3159 "class": "number_small",
3160 "units": {
3161 "px": "px",
3162 "percent": "%",
3163 "em": "em"
3164 },
3165 "unit_value": "px",
3166 "wrapper_class": "col-4"
3167 },
3168 "margin_bottom": {
3169 "type": "number",
3170 "name": "margin_bottom",
3171 "label": "Bottom",
3172 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_bottom.png",
3173 "value": "0",
3174 "class": "number_small",
3175 "units": {
3176 "px": "px",
3177 "percent": "%",
3178 "em": "em"
3179 },
3180 "unit_value": "px",
3181 "wrapper_class": "col-4"
3182 },
3183 "margin_left": {
3184 "type": "number",
3185 "name": "margin_left",
3186 "label": "Left",
3187 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_left.png",
3188 "value": "0",
3189 "class": "number_small",
3190 "units": {
3191 "px": "px",
3192 "percent": "%",
3193 "em": "em"
3194 },
3195 "unit_value": "px",
3196 "wrapper_class": "col-4"
3197 },
3198 "margin_right": {
3199 "type": "number",
3200 "name": "margin_right",
3201 "label": "Right",
3202 "image_label": "' . trailingslashit(MTNC_URL) . 'img/icons/margin_right.png",
3203 "value": "0",
3204 "class": "number_small",
3205 "units": {
3206 "px": "px",
3207 "percent": "%",
3208 "em": "em"
3209 },
3210 "unit_value": "px",
3211 "wrapper_class": "col-4"
3212 },
3213 "background_label": {
3214 "type": "label",
3215 "name": "background_label",
3216 "label": "Background"
3217 },
3218 "background_color": {
3219 "type": "color",
3220 "name": "background_color",
3221 "nolabel": true,
3222 "value": "rgba(255,255,255,0)",
3223 "desc": ""
3224 },
3225 "background": {
3226 "type": "image",
3227 "name": "background",
3228 "nolabel": true,
3229 "value": "",
3230 "class": "",
3231 "desc": ""
3232 }
3233 }
3234 }
3235 }
3236 }
3237 },
3238 "modules_order": {
3239 "header-dbd02cd1": "header-dbd02cd1",
3240 "content-471365b7": "content-471365b7",
3241 "content-9742e2f8": "content-9742e2f8",
3242 "footer-a29820d6": "footer-a29820d6"
3243 },
3244 "name": "Default",
3245 "theme_thumbnail": "",
3246 "theme_status": "",
3247 "body_font_size": "16",
3248 "body_font_color": "#FFFFFF",
3249 "body_font": "Open Sans",
3250 "body_link_color": "#0096FF",
3251 "body_link_hover_color": "#57BAFF",
3252 "background_type": "image",
3253 "background_video": "",
3254 "background_video_fallback": "",
3255 "background_video_filter": "",
3256 "background_size_opt": "cover",
3257 "background_position": "center center",
3258 "background_image_filter": "",
3259 "background_blur": 0,
3260 "background_image": "' . trailingslashit(MTNC_URL) . 'img/mt-sample-background.jpg",
3261 "preloader_background_image": "",
3262 "background_color": "rgba(0,0,0,1)",
3263 "login_background_color": "rgba(0,0,0,1)",
3264 "content_overlay": "",
3265 "content_width": 916,
3266 "content_overlay_color": "rgba(0,0,0,0.2)",
3267 "content_overlay_shadow_color": "rgba(0,0,0,0.2)",
3268 "content_position": "middle",
3269 "modules_spacing": 20,
3270 "custom_css": ".mtnc_module,\r\n.mtnc_module h2{\r\n\tfont-weight:300;\r\n}"
3271 }'
3272 )
3273 );
3274
3275 $this->update_options('options', $new_options);
3276
3277 if (!empty($_GET['redirect'])) {
3278 if($reset == 'theme'){
3279 wp_safe_redirect(admin_url('admin.php?page=maintenance&theme-reset=true'));
3280 } else {
3281 wp_safe_redirect(admin_url('admin.php?page=maintenance&settings-reset=true'));
3282 }
3283 }
3284
3285 die();
3286 }
3287
3288 /**
3289 * Create select options
3290 *
3291 * @param array $options Options
3292 * @param string $selected current value
3293 * @param bool $output current value
3294 *
3295 * @return string html if $output is false
3296 */
3297 public function create_select_options($options, $selected = null, $output = true)
3298 {
3299 $out = "\n";
3300 foreach ($options as $option) {
3301 $disabled = '';
3302 if (isset($option['disabled'])) {
3303 $disabled .= ' disabled="disabled" ';
3304 }
3305
3306 $out .= '<option value="' . $option['val'] . '" ' . selected($option['val'], $selected, false) . ' ' . $disabled . '>' . $option['label'] . '</option>';
3307 } // foreach
3308
3309 if ($output) {
3310 self::wp_kses_wf($out);
3311 } else {
3312 return $out;
3313 }
3314 } // create_select_options
3315
3316 /**
3317 * Generate CSS Style for a module for front-end display
3318 *
3319 * @param object $module object
3320 *
3321 * @return string CSS styles
3322 */
3323 public function get_module_style($module)
3324 {
3325 $styles = 'padding:0px; margin:' . round($this->theme->modules_spacing / 2) . 'px auto; text-align:center;';
3326
3327 //Padding
3328 if (!empty($module->groups->layout->fields->padding_top->value)) {
3329 $styles .= 'padding-top:' . $module->groups->layout->fields->padding_top->value . str_replace('percent', '%', $module->groups->layout->fields->padding_top->unit_value) . ';';
3330 }
3331 if (!empty($module->groups->layout->fields->padding_right->value)) {
3332 $styles .= 'padding-right:' . $module->groups->layout->fields->padding_right->value . str_replace('percent', '%', $module->groups->layout->fields->padding_right->unit_value) . ';';
3333 }
3334 if (!empty($module->groups->layout->fields->padding_bottom->value)) {
3335 $styles .= 'padding-bottom:' . $module->groups->layout->fields->padding_bottom->value . str_replace('percent', '%', $module->groups->layout->fields->padding_bottom->unit_value) . ';';
3336 }
3337 if (!empty($module->groups->layout->fields->padding_left->value)) {
3338 $styles .= 'padding-left:' . $module->groups->layout->fields->padding_left->value . str_replace('percent', '%', $module->groups->layout->fields->padding_left->unit_value) . ';';
3339 }
3340
3341 //Margin
3342 if (!empty($module->groups->layout->fields->margin_top->value)) {
3343 $styles .= 'margin-top:' . $module->groups->layout->fields->margin_top->value . str_replace('percent', '%', $module->groups->layout->fields->margin_top->unit_value) . ';';
3344 }
3345 if (!empty($module->groups->layout->fields->margin_right->value)) {
3346 $styles .= 'margin-right:' . $module->groups->layout->fields->margin_right->value . str_replace('percent', '%', $module->groups->layout->fields->margin_right->unit_value) . ';';
3347 }
3348 if (!empty($module->groups->layout->fields->margin_bottom->value)) {
3349 $styles .= 'margin-bottom:' . $module->groups->layout->fields->margin_bottom->value . str_replace('percent', '%', $module->groups->layout->fields->margin_bottom->unit_value) . ';';
3350 }
3351 if (!empty($module->groups->layout->fields->margin_left->value)) {
3352 $styles .= 'margin-left:' . $module->groups->layout->fields->margin_left->value . str_replace('percent', '%', $module->groups->layout->fields->margin_left->unit_value) . ';';
3353 }
3354
3355 //Background
3356 if (!empty($module->groups->layout->fields->background_color->value)) {
3357 $styles .= 'background-color:' . $module->groups->layout->fields->background_color->value . ';';
3358 }
3359
3360 if (!empty($module->groups->layout->fields->background->value)) {
3361 $styles .= 'background:url(' . $module->groups->layout->fields->background->value . ');';
3362 }
3363
3364 if ($module->type == 'footer') {
3365 $styles .= 'position:absolute; bottom:0px; left: 0px;';
3366 }
3367
3368 return $styles;
3369 }
3370
3371 /**
3372 * Convert GA Code
3373 *
3374 * @param string GA Code
3375 *
3376 * @return string GA Code
3377 */
3378 public function convert_ga($code)
3379 {
3380 if (empty($code) || strpos($code, '<script') === false) {
3381 return $code;
3382 }
3383
3384 preg_match_all('/(UA-[0-9]{3,10}-[0-9]{1,3})/i', $code, $matches, PREG_SET_ORDER, 0);
3385 if (!empty($matches[0][0])) {
3386 return $matches[0][0];
3387 } else {
3388 return '';
3389 }
3390 }
3391
3392
3393 /**
3394 * Overwrite current page template with Maintenance page
3395 *
3396 * @param object original_template
3397 *
3398 * @return object new template
3399 */
3400 public function template_include($original_template)
3401 {
3402 $original_template = $this->load_maintenance_page($original_template);
3403 return $original_template;
3404 }
3405
3406 public function check_maintenance_unlocked()
3407 {
3408 $mtnc_options = $this->get_options(true);
3409 if (isset($_COOKIE['maintenance_unlocked']) && $_COOKIE['maintenance_unlocked'] == md5($mtnc_options['maintenance_password'])) {
3410 return true;
3411 } else {
3412 return false;
3413 }
3414 }
3415
3416 public function check_site_unlocked()
3417 {
3418 $mtnc_options = $this->get_options(true);
3419 if (isset($_COOKIE['site_unlocked']) && $_COOKIE['site_unlocked'] == md5($mtnc_options['site_password'])) {
3420 return true;
3421 } else {
3422 return false;
3423 }
3424 }
3425
3426 public function check_maintenance_locked()
3427 {
3428 $mtnc_options = $this->get_options(true);
3429 if (isset($mtnc_options['maintenance_password']) && strlen($mtnc_options['maintenance_password']) > 0 && !$this->check_maintenance_unlocked()) {
3430 return true;
3431 }
3432 return false;
3433 }
3434
3435 public function check_site_locked()
3436 {
3437 $mtnc_options = $this->get_options(true);
3438 if (isset($mtnc_options['site_password']) && strlen($mtnc_options['site_password']) > 0 && !$this->check_site_unlocked()) {
3439 return true;
3440 }
3441 return false;
3442 }
3443
3444 public function load_maintenance_page($original_template)
3445 {
3446 $mtnc_options = $this->get_options(true);
3447 // just to be on the safe side
3448 if (defined('DOING_CRON') && DOING_CRON) {
3449 return false;
3450 }
3451 if (defined('DOING_AJAX') && DOING_AJAX) {
3452 return false;
3453 }
3454 if (defined('WP_CLI') && WP_CLI) {
3455 return false;
3456 }
3457
3458 // init custom enter no main url
3459 $custom_url_link = $mtnc_options['direct_access_link'];
3460 if (!empty($custom_url_link)) {
3461 if (isset($_GET[$custom_url_link])) { //phpcs:ignore
3462 setcookie("skip_maintenance_mode", true, time() + 24 * 60 * 60, '/');
3463 $_COOKIE['skip_maintenance_mode'] = true;
3464 }
3465 }
3466
3467 // Getting custom login URL for the admin
3468 $login_url = wp_login_url();
3469
3470 // This is the server address of the current page
3471 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'] ?? ''));
3472 $request_uri = $this->slashit(strtolower(wp_parse_url($request_uri, PHP_URL_PATH)));
3473 $server_url = get_home_url() . $request_uri;
3474
3475 // Checking for the custom_login_url value
3476 if (empty($mtnc_options['custom_login_url'])) {
3477 $mtnc_options['custom_login_url'] = '';
3478 } else {
3479 $mtnc_options['custom_login_url'] = get_home_url() . $this->slashit($mtnc_options['custom_login_url']);
3480 }
3481
3482 if (!is_admin() || isset($_GET['maintenance-preview'])) { //phpcs:ignore
3483 if ('1' == $mtnc_options['status'] || apply_filters('mtnc_force_display', false) || isset($_GET['maintenance-preview'])) { //phpcs:ignore
3484 if (
3485 false === strpos($server_url, '/wp-login.php')
3486 && false === strpos($server_url, '/wp-admin/')
3487 && false === strpos($server_url, '/async-upload.php')
3488 && false === strpos($server_url, '/upgrade.php')
3489 && false === strpos($server_url, '/xmlrpc.php')
3490 && false === strpos($server_url, $login_url)
3491 && !isset($_GET['mainwpsignature']) //phpcs:ignore
3492 ) {
3493
3494 $show_maintenance_page = 1;
3495
3496 if (!empty($mtnc_options['custom_login_url']) && false !== strpos($server_url, $mtnc_options['custom_login_url'])) {
3497 $show_maintenance_page = 0;
3498 }
3499
3500 // search engines
3501 if ($mtnc_options['excludese'] == '1' && $this->check_referrer()) {
3502 $show_maintenance_page = 0;
3503 }
3504
3505 // if logged in
3506 if ($mtnc_options['show_logged_in'] == '1' && is_user_logged_in()) {
3507 $show_maintenance_page = 0;
3508 }
3509
3510 // IP whitelist
3511 $all_ips = explode("\n", $mtnc_options['ip_whitelist']);
3512 $all_ips = array_map('trim', $all_ips);
3513 $current_ip = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? ''));
3514
3515 if (@in_array($current_ip, $all_ips)) {
3516 $show_maintenance_page = 0;
3517 }
3518
3519 // urls list
3520 $all_urls = explode("\n", trim($mtnc_options['per_url_enable_disable']));
3521 $all_urls = array_map('trim', $all_urls);
3522
3523 // whitelisted / blacklisted URLs
3524 if ($mtnc_options['per_url_settings'] == 'whitelist' && !empty($all_urls)) {
3525 if (in_array($request_uri, $all_urls)) {
3526 $show_maintenance_page = 0;
3527 }
3528 } elseif ($mtnc_options['per_url_settings'] == 'blacklist' && !empty($all_urls)) {
3529 if (!in_array($request_uri, $all_urls)) {
3530 $show_maintenance_page = 0;
3531 }
3532 }
3533
3534 if (!empty($_COOKIE['skip_maintenance_mode'])) {
3535 $show_maintenance_page = 0;
3536 }
3537
3538 if (isset($_COOKIE['site_unlocked']) && $_COOKIE['site_unlocked'] == md5($mtnc_options['site_password'])) {
3539 $show_maintenance_page = 0;
3540 }
3541
3542 $show_maintenance_page = apply_filters('mtnc_force_display', $show_maintenance_page);
3543
3544 if ($show_maintenance_page == 1 || isset($_GET['maintenance-preview'])) { //phpcs:ignore
3545 if (file_exists(MTNC_LOAD . 'index.php')) {
3546 add_filter('script_loader_tag', 'mtnc_defer_scripts', 10, 2);
3547 return MTNC_LOAD . 'index.php';
3548 } else {
3549 return $original_template;
3550 }
3551 }
3552 }
3553 }
3554 }
3555
3556 return $original_template;
3557 }
3558
3559 public function slashit($url)
3560 {
3561 if (strpos($url, '?') === false && substr($url, -4, 1) != '.') {
3562 $url = trailingslashit($url);
3563 }
3564
3565 if ($url != '/') {
3566 $url = '/' . ltrim($url, '/');
3567 }
3568
3569 return $url;
3570 } // slashit
3571
3572 public function get_headers_503()
3573 {
3574 $mtnc_options = $this->get_options(true);
3575 nocache_headers();
3576 if (!empty($mtnc_options['blockse'])) {
3577 $protocol = 'HTTP/1.0';
3578 if (isset($_SERVER['SERVER_PROTOCOL']) && 'HTTP/1.1' === $_SERVER['SERVER_PROTOCOL']) {
3579 $protocol = 'HTTP/1.1';
3580 }
3581 header("$protocol 503 Service Unavailable", true, 503);
3582
3583 $v_curr_date_end = '';
3584 $vdate_end = date_i18n('Y-m-d', strtotime(current_time('mysql', 0)));
3585 $vtime_end = date_i18n('h:i a', strtotime('12:00 pm'));
3586
3587 if (!empty($mtnc_options['expiry_date_end'])) {
3588 $vdate_end = $mtnc_options['expiry_date_end'];
3589 }
3590 if (!empty($mtnc_options['expiry_time_end'])) {
3591 $vtime_end = $mtnc_options['expiry_time_end'];
3592 }
3593 if ($mtnc_options['state'] && !empty($mtnc_options['expiry_date_end']) && !empty($mtnc_options['expiry_time_end'])) {
3594 $date_concat = $vdate_end . ' ' . $vtime_end;
3595 $v_curr_date = strtotime($date_concat);
3596 if (strtotime(current_time('mysql', 0)) < $v_curr_date) {
3597 header('Retry-After: ' . gmdate('D, d M Y H:i:s', $v_curr_date));
3598 } else {
3599 header('Retry-After: 3600');
3600 }
3601 } else {
3602 header('Retry-After: 3600');
3603 }
3604 }
3605 }
3606
3607 public function add_bunny_fonts($theme)
3608 {
3609 $fonts = array();
3610
3611 foreach ($theme->modules as $module) {
3612 foreach ($module->groups as $group) {
3613 foreach ($group->fields as $field) {
3614 if ($field->type == 'font') {
3615 $font_link = $this->get_bunny_font(esc_attr($field->value));
3616 if (!empty($font_link)) {
3617 $fonts[] = $font_link;
3618 }
3619 }
3620 }
3621 }
3622 }
3623 return $fonts;
3624 } //add_bunny_fonts
3625
3626 /**
3627 * Get Google link
3628 *
3629 * @return string link
3630 */
3631 public function get_bunny_font($font = null)
3632 {
3633 $font_params = $full_link = $gg_fonts = '';
3634
3635 $gg_fonts = json_decode($this->get_bunny_fonts());
3636
3637 if (property_exists($gg_fonts, $font)) {
3638 $curr_font = $gg_fonts->{$font};
3639 if (!empty($curr_font)) {
3640 foreach ($curr_font->variants as $values) {
3641 if (!empty($values->id)) {
3642 $font_params .= $values->id . ',';
3643 } elseif (!empty($values)) {
3644 $font_params .= $values . ',';
3645 }
3646 }
3647
3648 $font_params = trim($font_params, ',');
3649 $full_link = $font . ':' . $font_params;
3650 }
3651 }
3652
3653 return $full_link;
3654 } //get_bunny_font
3655
3656 /**
3657 * Get Google fonts from json
3658 *
3659 * @return string Google fonts
3660 */
3661 public function get_bunny_fonts()
3662 {
3663 $gg_fonts = file_get_contents(MTNC_PATH . 'css/font/bunnyfonts.json');
3664 return $gg_fonts;
3665 } //get_bunny_fonts
3666
3667 public function get_custom_login_code()
3668 {
3669 global $wp_query,
3670 $error;
3671 $mtnc_options = $this->get_options();
3672 $user_connect = false;
3673 if (!is_array($wp_query->query_vars)) {
3674 $wp_query->query_vars = array();
3675 }
3676 $error_message = $user_login = $user_pass = $error = '';
3677 $is_role_check = true;
3678 $class_login = 'user-icon';
3679 $class_password = 'pass-icon';
3680 $using_cookie = false;
3681
3682 if (isset($_POST['is_custom_login'])) {
3683 $user_login = '';
3684 if (isset($_POST['log']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
3685 $user_login = sanitize_text_field(wp_unslash($_POST['log']));
3686 }
3687 $user_login = sanitize_user($user_login);
3688 $user_pass = '';
3689 if (isset($_POST['pwd']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['mtnc_login_check'] ?? '')), 'mtnc_login')) {
3690 $user_pass = sanitize_text_field(wp_unslash($_POST['pwd']));
3691 }
3692 $access = array();
3693 $access['user_login'] = esc_attr($user_login);
3694 $access['user_password'] = $user_pass;
3695 $access['remember'] = true;
3696
3697 $user = null;
3698 $user = new WP_User(0, $user_login);
3699 $current_role = current($user->roles);
3700
3701 if (!empty($mtnc_options['roles_array'])) {
3702 foreach (array_keys($mtnc_options['roles_array']) as $key) {
3703 if ($key === $current_role) {
3704 $is_role_check = false;
3705 }
3706 }
3707 } else {
3708 $is_role_check = true;
3709 }
3710
3711 if (!$is_role_check) {
3712 $error_message = esc_html__('Permission access denied!', 'maintenance');
3713 $class_login = 'error';
3714 $class_password = 'error';
3715 } else {
3716
3717 if (is_ssl()) {
3718 $ssl = true;
3719 } else {
3720 $ssl = false;
3721 }
3722
3723 $user_connect = wp_signon($access, $ssl);
3724 if (is_wp_error($user_connect)) {
3725 if ($user_connect->get_error_code() === 'invalid_username') {
3726 $error_message = esc_html__('Login is incorrect!', 'maintenance');
3727
3728 $class_login = 'error';
3729 $class_password = 'error';
3730 } elseif ($user_connect->get_error_code() === 'incorrect_password') {
3731 $error_message = esc_html__('Password is incorrect!', 'maintenance');
3732 $class_password = 'error';
3733 } else {
3734 $error_message = esc_html__('Login and password are incorrect!', 'maintenance');
3735 $class_login = 'error';
3736 $class_password = 'error';
3737 }
3738 } else {
3739 wp_safe_redirect(home_url('/'));
3740 exit;
3741 }
3742 }
3743 }
3744
3745 if (!$user_connect) {
3746 $this->get_headers_503();
3747 }
3748
3749 return array($error_message, $class_login, $class_password, $user_login);
3750 }
3751
3752 /**
3753 * Check referrer if it's a SERP crawler
3754 *
3755 * @return bool true if crawler
3756 */
3757 public function check_referrer()
3758 {
3759 // List of crawlers to check for
3760 $crawlers = array(
3761 'Abacho' => 'AbachoBOT',
3762 'Accoona' => 'Acoon',
3763 'AcoiRobot' => 'AcoiRobot',
3764 'Adidxbot' => 'adidxbot',
3765 'AltaVista robot' => 'Altavista',
3766 'Altavista robot' => 'Scooter',
3767 'ASPSeek' => 'ASPSeek',
3768 'Atomz' => 'Atomz',
3769 'Bing' => 'bingbot',
3770 'BingPreview' => 'BingPreview',
3771 'CrocCrawler' => 'CrocCrawler',
3772 'Dumbot' => 'Dumbot',
3773 'eStyle Bot' => 'eStyle',
3774 'FAST-WebCrawler' => 'FAST-WebCrawler',
3775 'GeonaBot' => 'GeonaBot',
3776 'Gigabot' => 'Gigabot',
3777 'Google' => 'Googlebot',
3778 'ID-Search Bot' => 'IDBot',
3779 'Lycos spider' => 'Lycos',
3780 'MSN' => 'msnbot',
3781 'MSRBOT' => 'MSRBOT',
3782 'Rambler' => 'Rambler',
3783 'Scrubby robot' => 'Scrubby',
3784 'Yahoo' => 'Yahoo',
3785 );
3786
3787 // Checking for the crawler over here
3788 if ($this->string_to_array(sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'] ?? '')), $crawlers)) {
3789 return true;
3790 }
3791 return false;
3792 } //check_referrer
3793
3794 /**
3795 * Function to match the user agent with the crawlers array
3796 *
3797 * @param string string to find
3798 * @param array array to look in
3799 *
3800 * @return bool true if match found
3801 */
3802 public function string_to_array($str, $array)
3803 {
3804 $regexp = '~(' . implode('|', array_values($array)) . ')~i';
3805 return (bool) preg_match($regexp, $str);
3806 } //string_to_array
3807
3808 static function wp_kses_wf($html)
3809 {
3810 add_filter('safe_style_css', function ($styles) {
3811 $styles_wf = array(
3812 'text-align',
3813 'margin',
3814 'color',
3815 'float',
3816 'border',
3817 'background',
3818 'background-color',
3819 'border-bottom',
3820 'border-bottom-color',
3821 'border-bottom-style',
3822 'border-bottom-width',
3823 'border-collapse',
3824 'border-color',
3825 'border-left',
3826 'border-left-color',
3827 'border-left-style',
3828 'border-left-width',
3829 'border-right',
3830 'border-right-color',
3831 'border-right-style',
3832 'border-right-width',
3833 'border-spacing',
3834 'border-style',
3835 'border-top',
3836 'border-top-color',
3837 'border-top-style',
3838 'border-top-width',
3839 'border-width',
3840 'caption-side',
3841 'clear',
3842 'cursor',
3843 'direction',
3844 'font',
3845 'font-family',
3846 'font-size',
3847 'font-style',
3848 'font-variant',
3849 'font-weight',
3850 'height',
3851 'letter-spacing',
3852 'line-height',
3853 'margin-bottom',
3854 'margin-left',
3855 'margin-right',
3856 'margin-top',
3857 'overflow',
3858 'padding',
3859 'padding-bottom',
3860 'padding-left',
3861 'padding-right',
3862 'padding-top',
3863 'text-decoration',
3864 'text-indent',
3865 'vertical-align',
3866 'width',
3867 'display',
3868 );
3869
3870 foreach ($styles_wf as $style_wf) {
3871 $styles[] = $style_wf;
3872 }
3873 return $styles;
3874 });
3875
3876 $allowed_tags = wp_kses_allowed_html('post');
3877 $allowed_tags['input'] = array(
3878 'type' => true,
3879 'style' => true,
3880 'class' => true,
3881 'id' => true,
3882 'checked' => true,
3883 'disabled' => true,
3884 'name' => true,
3885 'size' => true,
3886 'placeholder' => true,
3887 'value' => true,
3888 'data-*' => true,
3889 'size' => true,
3890 'disabled' => true
3891 );
3892
3893 $allowed_tags['textarea'] = array(
3894 'type' => true,
3895 'style' => true,
3896 'class' => true,
3897 'id' => true,
3898 'checked' => true,
3899 'disabled' => true,
3900 'name' => true,
3901 'size' => true,
3902 'placeholder' => true,
3903 'value' => true,
3904 'data-*' => true,
3905 'cols' => true,
3906 'rows' => true,
3907 'disabled' => true,
3908 'autocomplete' => true
3909 );
3910
3911 $allowed_tags['select'] = array(
3912 'type' => true,
3913 'style' => true,
3914 'class' => true,
3915 'id' => true,
3916 'checked' => true,
3917 'disabled' => true,
3918 'name' => true,
3919 'size' => true,
3920 'placeholder' => true,
3921 'value' => true,
3922 'data-*' => true,
3923 'multiple' => true,
3924 'disabled' => true
3925 );
3926
3927 $allowed_tags['option'] = array(
3928 'type' => true,
3929 'style' => true,
3930 'class' => true,
3931 'id' => true,
3932 'checked' => true,
3933 'disabled' => true,
3934 'name' => true,
3935 'size' => true,
3936 'placeholder' => true,
3937 'value' => true,
3938 'selected' => true,
3939 'data-*' => true
3940 );
3941 $allowed_tags['optgroup'] = array(
3942 'type' => true,
3943 'style' => true,
3944 'class' => true,
3945 'id' => true,
3946 'checked' => true,
3947 'disabled' => true,
3948 'name' => true,
3949 'size' => true,
3950 'placeholder' => true,
3951 'value' => true,
3952 'selected' => true,
3953 'data-*' => true,
3954 'label' => true
3955 );
3956
3957 $allowed_tags['a'] = array(
3958 'href' => true,
3959 'data-*' => true,
3960 'class' => true,
3961 'style' => true,
3962 'id' => true,
3963 'target' => true,
3964 'data-*' => true,
3965 'role' => true,
3966 'aria-controls' => true,
3967 'aria-selected' => true,
3968 'disabled' => true
3969 );
3970
3971 $allowed_tags['div'] = array(
3972 'style' => true,
3973 'class' => true,
3974 'id' => true,
3975 'data-*' => true,
3976 'role' => true,
3977 'aria-labelledby' => true,
3978 'value' => true,
3979 'aria-modal' => true,
3980 'tabindex' => true
3981 );
3982
3983 $allowed_tags['h2'] = array(
3984 'style' => true,
3985 'class' => true,
3986 'id' => true,
3987 'data-*' => true,
3988 'role' => true,
3989 'aria-labelledby' => true,
3990 'value' => true,
3991 'aria-modal' => true,
3992 'tabindex' => true,
3993 'font-family' => true,
3994 );
3995
3996 $allowed_tags['li'] = array(
3997 'style' => true,
3998 'class' => true,
3999 'id' => true,
4000 'data-*' => true,
4001 'role' => true,
4002 'aria-labelledby' => true,
4003 'value' => true,
4004 'aria-modal' => true,
4005 'tabindex' => true
4006 );
4007
4008 $allowed_tags['span'] = array(
4009 'style' => true,
4010 'class' => true,
4011 'id' => true,
4012 'data-*' => true,
4013 'aria-hidden' => true
4014 );
4015
4016 $allowed_tags['style'] = array(
4017 'class' => true,
4018 'id' => true,
4019 'type' => true,
4020 'font-family' => true,
4021 );
4022
4023 $allowed_tags['fieldset'] = array(
4024 'class' => true,
4025 'id' => true,
4026 'type' => true
4027 );
4028
4029 $allowed_tags['link'] = array(
4030 'class' => true,
4031 'id' => true,
4032 'type' => true,
4033 'rel' => true,
4034 'href' => true,
4035 'media' => true
4036 );
4037
4038 $allowed_tags['form'] = array(
4039 'style' => true,
4040 'class' => true,
4041 'id' => true,
4042 'method' => true,
4043 'action' => true,
4044 'data-*' => true
4045 );
4046
4047 echo wp_kses($html, $allowed_tags);
4048
4049 add_filter('safe_style_css', function ($styles) {
4050 $styles_wf = array(
4051 'text-align',
4052 'margin',
4053 'color',
4054 'float',
4055 'border',
4056 'background',
4057 'background-color',
4058 'border-bottom',
4059 'border-bottom-color',
4060 'border-bottom-style',
4061 'border-bottom-width',
4062 'border-collapse',
4063 'border-color',
4064 'border-left',
4065 'border-left-color',
4066 'border-left-style',
4067 'border-left-width',
4068 'border-right',
4069 'border-right-color',
4070 'border-right-style',
4071 'border-right-width',
4072 'border-spacing',
4073 'border-style',
4074 'border-top',
4075 'border-top-color',
4076 'border-top-style',
4077 'border-top-width',
4078 'border-width',
4079 'caption-side',
4080 'clear',
4081 'cursor',
4082 'direction',
4083 'font',
4084 'font-family',
4085 'font-size',
4086 'font-style',
4087 'font-variant',
4088 'font-weight',
4089 'height',
4090 'letter-spacing',
4091 'line-height',
4092 'margin-bottom',
4093 'margin-left',
4094 'margin-right',
4095 'margin-top',
4096 'overflow',
4097 'padding',
4098 'padding-bottom',
4099 'padding-left',
4100 'padding-right',
4101 'padding-top',
4102 'text-decoration',
4103 'text-indent',
4104 'vertical-align',
4105 'width'
4106 );
4107
4108 foreach ($styles_wf as $style_wf) {
4109 if (($key = array_search($style_wf, $styles)) !== false) {
4110 unset($styles[$key]);
4111 }
4112 }
4113 return $styles;
4114 });
4115 }
4116
4117 function is_plugin_installed($slug)
4118 {
4119 if (!function_exists('get_plugins')) {
4120 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4121 }
4122 $all_plugins = get_plugins();
4123
4124 if (!empty($all_plugins[$slug])) {
4125 return true;
4126 } else {
4127 return false;
4128 }
4129 } // is_plugin_installed
4130
4131 // auto download / install / activate WP Force SSL plugin
4132 function install_wpfssl()
4133 {
4134 check_ajax_referer('install_wpfssl');
4135
4136 if (false === current_user_can('administrator')) {
4137 wp_die('Sorry, you have to be an admin to run this action.');
4138 }
4139
4140 $plugin_slug = 'wp-force-ssl/wp-force-ssl.php';
4141 $plugin_zip = 'https://downloads.wordpress.org/plugin/wp-force-ssl.latest-stable.zip';
4142
4143 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
4144 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4145 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4146 @include_once ABSPATH . 'wp-admin/includes/file.php';
4147 @include_once ABSPATH . 'wp-admin/includes/misc.php';
4148 echo '<style>
4149 body{
4150 font-family: sans-serif;
4151 font-size: 14px;
4152 line-height: 1.5;
4153 color: #444;
4154 }
4155 </style>';
4156
4157 echo '<div style="margin: 20px; color:#444;">';
4158 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>';
4159 echo 'Starting ...<br><br>';
4160
4161 wp_cache_flush();
4162 $upgrader = new Plugin_Upgrader();
4163 echo 'Check if WP Force SSL is already installed ... <br />';
4164 if ($this->is_plugin_installed($plugin_slug)) {
4165 echo 'WP Force SSL is already installed! <br /><br />Making sure it\'s the latest version.<br />';
4166 $upgrader->upgrade($plugin_slug);
4167 $installed = true;
4168 } else {
4169 echo 'Installing WP Force SSL.<br />';
4170 $installed = $upgrader->install($plugin_zip);
4171 }
4172 wp_cache_flush();
4173
4174 if (!is_wp_error($installed) && $installed) {
4175 echo 'Activating WP Force SSL.<br />';
4176 $activate = activate_plugin($plugin_slug);
4177
4178 if (is_null($activate)) {
4179 echo 'WP Force SSL Activated.<br />';
4180
4181 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
4182 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
4183 }
4184 } else {
4185 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>.';
4186 }
4187
4188 echo '</div>';
4189 } // install_wpfssl
4190
4191 // auto download / install / activate Advanced Google reCAPTCHA plugin
4192 function install_wpcaptcha()
4193 {
4194 check_ajax_referer('install_wpcaptcha');
4195
4196 if (false === current_user_can('administrator')) {
4197 wp_die('Sorry, you have to be an admin to run this action.');
4198 }
4199
4200 $plugin_slug = 'advanced-google-recaptcha/advanced-google-recaptcha.php';
4201 $plugin_zip = 'https://downloads.wordpress.org/plugin/advanced-google-recaptcha.latest-stable.zip';
4202
4203 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
4204 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4205 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4206 @include_once ABSPATH . 'wp-admin/includes/file.php';
4207 @include_once ABSPATH . 'wp-admin/includes/misc.php';
4208 echo '<style>
4209 body{
4210 font-family: sans-serif;
4211 font-size: 14px;
4212 line-height: 1.5;
4213 color: #444;
4214 }
4215 </style>';
4216
4217 echo '<div style="margin: 20px; color:#444;">';
4218 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>';
4219 echo 'Starting ...<br><br>';
4220
4221 wp_cache_flush();
4222 $upgrader = new Plugin_Upgrader();
4223 echo 'Check if Advanced Google reCAPTCHA is already installed ... <br />';
4224 if ($this->is_plugin_installed($plugin_slug)) {
4225 echo 'Advanced Google reCAPTCHA is already installed! <br /><br />Making sure it\'s the latest version.<br />';
4226 $upgrader->upgrade($plugin_slug);
4227 $installed = true;
4228 } else {
4229 echo 'Installing Advanced Google reCAPTCHA.<br />';
4230 $installed = $upgrader->install($plugin_zip);
4231 }
4232 wp_cache_flush();
4233
4234 if (!is_wp_error($installed) && $installed) {
4235 echo 'Activating Advanced Google reCAPTCHA.<br />';
4236 $activate = activate_plugin($plugin_slug);
4237
4238 if (is_null($activate)) {
4239 echo 'Advanced Google reCAPTCHA Activated.<br />';
4240
4241 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
4242 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
4243 }
4244 } else {
4245 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>.';
4246 }
4247
4248 echo '</div>';
4249 } // install_wpcaptcha
4250
4251 // auto download / install / activate Weglot plugin
4252 function install_weglot()
4253 {
4254 check_ajax_referer('install_weglot');
4255
4256 if (false === current_user_can('administrator')) {
4257 wp_die('Sorry, you have to be an admin to run this action.');
4258 }
4259
4260 $plugin_slug = 'weglot/weglot.php';
4261 $plugin_zip = 'https://downloads.wordpress.org/plugin/weglot.latest-stable.zip';
4262
4263 @include_once ABSPATH . 'wp-admin/includes/plugin.php';
4264 @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4265 @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4266 @include_once ABSPATH . 'wp-admin/includes/file.php';
4267 @include_once ABSPATH . 'wp-admin/includes/misc.php';
4268 echo '<style>
4269 body{
4270 font-family: sans-serif;
4271 font-size: 14px;
4272 line-height: 1.5;
4273 color: #444;
4274 }
4275 </style>';
4276
4277 echo '<div style="margin: 20px; color:#444;">';
4278 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>';
4279 echo 'Starting ...<br><br>';
4280
4281 wp_cache_flush();
4282 $upgrader = new Plugin_Upgrader();
4283 echo 'Check if Weglot is already installed ... <br />';
4284 if ($this->is_plugin_installed($plugin_slug)) {
4285 echo 'Weglot is already installed! <br /><br />Making sure it\'s the latest version.<br />';
4286 $upgrader->upgrade($plugin_slug);
4287 $installed = true;
4288 } else {
4289 echo 'Installing Weglot.<br />';
4290 $installed = $upgrader->install($plugin_zip);
4291 }
4292 wp_cache_flush();
4293
4294 if (!is_wp_error($installed) && $installed) {
4295 echo 'Activating Weglot.<br />';
4296 $activate = activate_plugin($plugin_slug);
4297
4298 if (is_null($activate)) {
4299 echo 'Weglot Activated.<br />';
4300
4301 echo '<script>setTimeout(function() { top.location = "admin.php?page=maintenance"; }, 1000);</script>';
4302 echo '<br>If you are not redirected in a few seconds - <a href="admin.php?page=maintenance" target="_parent">click here</a>.';
4303 }
4304 } else {
4305 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>.';
4306 }
4307
4308 echo '</div>';
4309 } // install_weglot
4310
4311 /**
4312 * Disabled; we use singleton pattern so magic functions need to be disabled
4313 *
4314 * @return null
4315 */
4316 public function __clone() {}
4317
4318 /**
4319 * Disabled; we use singleton pattern so magic functions need to be disabled
4320 *
4321 * @return null
4322 */
4323 public function __sleep() {}
4324
4325 /**
4326 * Disabled; we use singleton pattern so magic functions need to be disabled
4327 *
4328 * @return null
4329 */
4330 public function __wakeup() {}
4331 } // MTNC class
4332
4333 // Create plugin instance and hook things up
4334 global $wf_mtnc; //phpcs:ignore
4335 $wf_mtnc = MTNC::getInstance(); //phpcs:ignore
4336