'Arial, Helvetica, sans-serif', 'Arial Black, Gadget, sans-serif' => 'Arial Black, Gadget, sans-serif', 'Bookman Old Style, serif' => 'Bookman Old Style, serif', 'Comic Sans MS, cursive' => 'Comic Sans MS, cursive', 'Courier, monospace' => 'Courier, monospace', 'Garamond, serif' => 'Garamond, serif', 'Georgia, serif' => 'Georgia, serif', 'Impact, Charcoal, sans-serif' => 'Impact, Charcoal, sans-serif', 'Lucida Console, Monaco, monospace' => 'Lucida Console, Monaco, monospace', 'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode, Lucida Grande, sans-serif', 'MS Sans Serif, Geneva, sans-serif' => 'MS Sans Serif, Geneva, sans-serif', 'MS Serif, New York, sans-serif' => 'MS Serif, New York, sans-serif', 'Palatino Linotype, Book Antiqua, Palatino, serif' => 'Palatino Linotype, Book Antiqua, Palatino, serif', 'Tahoma,Geneva, sans-serif' => 'Tahoma, Geneva, sans-serif', 'Times New Roman, Times,serif' => 'Times New Roman, Times, serif', 'Trebuchet MS, Helvetica, sans-serif' => 'Trebuchet MS, Helvetica, sans-serif', 'Verdana, Geneva, sans-serif' => 'Verdana, Geneva, sans-serif', ); function mtnc_get_plugin_options($is_current = false) { $saved = (array) get_option('maintenance_options', array()); if (!$saved) { $saved = mtnc_get_default_array(); } if (!$is_current) { $options = wp_parse_args(get_option('maintenance_options', array()), mtnc_get_default_array()); } else { $options = $saved; } return $options; } function mtnc_generate_input_filed($title, $id, $name, $value, $placeholder = '', $label = '', $pro = false) { $out_filed = ''; $out_filed .= ''; if ($pro) { $out_filed .= ''; } else { $out_filed .= ''; } $out_filed .= ''; $out_filed .= '
'; if ($pro) { $out_filed .= ''; } else { $out_filed .= ''; } $out_filed .= '   ' . $label; if ($pro) { $out_filed .= ' This is a PRO feature.'; } $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_number_field($title, $id, $name, $value, $placeholder = '') { $out_filed = ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_textarea_filed($title, $id, $name, $value) { $out_filed = ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_tinymce_filed($title, $id, $name, $value) { $out_filed = ''; $out_filed .= ''; $out_filed .= '' . esc_attr($title) . ''; $out_filed .= ''; $out_filed .= '
'; ob_start(); wp_editor( $value, $id, array( 'textarea_name' => 'lib_options[' . $name . ']', 'teeny' => 1, 'textarea_rows' => 5, 'media_buttons' => 0, ) ); $out_filed .= ob_get_contents(); ob_clean(); $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_check_field($title, $label, $id, $name, $value, $pro = false) { $out_filed = ''; $out_filed .= ''; if ($pro) { $out_filed .= ''; } else { $out_filed .= ''; } $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_button_field($title, $label, $button_label, $id, $name, $value, $pro = false) { $out_filed = ''; $out_filed .= ''; if ($pro) { $out_filed .= ''; } else { $out_filed .= ''; } $out_filed .= ''; $out_filed .= '
'; if ($pro) { $out_filed .= '   '; } else { $out_filed .= ''; } $out_filed .= $label; if ($pro) { $out_filed .= ' This is a PRO feature.'; } $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_generate_image_filed($title, $id, $name, $value, $class, $name_btn, $class_btn) { $out_filed = ''; $out_filed .= ''; $out_filed .= '' . esc_attr($title) . ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $url = ''; if ($value !== '') { $image = wp_get_attachment_image_src($value, 'full'); $url = @esc_url($image[0]); } $out_filed .= '
'; if ($value) { $out_filed .= ''; } $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_get_color_field($title, $id, $name, $value, $default_color) { $out_filed = ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; mtnc_wp_kses($out_filed); } function mtnc_get_bunny_font($font = null) { $font_params = $full_link = $gg_fonts = ''; $gg_fonts = json_decode(mtnc_get_bunny_fonts()); if (property_exists($gg_fonts, $font)) { $curr_font = $gg_fonts->{$font}; if (!empty($curr_font)) { foreach ($curr_font->variants as $values) { if (!empty($values->id)) { $font_params .= $values->id . ','; } elseif (!empty($values)) { $font_params .= $values . ','; } } $font_params = trim($font_params, ','); $full_link = $font . ':' . $font_params; } } return $full_link; } /* * Function get_fonts_field is backward compatibility with Maintenance PRO Version 3.6.2 and below */ function get_fonts_field($title, $id, $name, $value) { return mtnc_get_fonts_field($title, $id, $name, $value); } function mtnc_get_fonts_field($title, $id, $name, $value) { global $standart_fonts; $out_items = $gg_fonts = ''; $gg_fonts = json_decode(mtnc_get_bunny_fonts()); $out_filed = ''; $out_filed .= ''; $out_filed .= '' . esc_attr($title) . ''; $out_filed .= ''; $out_filed .= '
'; if (!empty($standart_fonts)) { $out_items .= ''; foreach ($standart_fonts as $key => $options) { $out_items .= ''; } } if (!empty($gg_fonts)) { $out_items .= ''; foreach ($gg_fonts as $key => $options) { $out_items .= ''; } } if (!empty($out_items)) { $out_filed .= ''; } $out_filed .= '
'; $out_filed .= '

Maintenance 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, Bunny Fonts helps you stay GDPR compliant 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.

'; $out_filed .= ''; $out_filed .= ''; return $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput } function mtnc_get_fonts_subsets($title, $id, $name, $value) { global $standart_fonts; $out_items = $gg_fonts = $curr_font = $mt_option = ''; $mt_option = mtnc_get_plugin_options(true); $curr_font = esc_attr($mt_option['body_font_family']); $vars = 'subsets'; $gg_fonts = json_decode(mtnc_get_bunny_fonts(), true); if (!empty($gg_fonts)) { $out_filed = ''; $out_filed .= ''; $out_filed .= '' . esc_attr($title) . ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= '
'; $out_filed .= ''; $out_filed .= ''; } return $out_filed; // phpcs:ignore WordPress.Security.EscapeOutput } function mtnc_page_create_meta_boxes() { global $mtnc_variable; $mt_option = mtnc_get_plugin_options(true); if (!$mt_option['default_settings'] || $mt_option['gg_analytics_id']) { //add_meta_box('review-top', __('Please help us keep the plugin free & maintained', 'maintenance'), 'mtnc_add_review_top', $mtnc_variable->options_page, 'normal', 'high'); } add_meta_box('mtnc-toc', __('Jump to Settings Sections', 'maintenance'), 'mtnc_add_toc', $mtnc_variable->options_page, 'normal', 'high'); add_meta_box('mtnc-general', __('Content', 'maintenance'), 'mtnc_add_data_fields', $mtnc_variable->options_page, 'normal', 'high'); add_meta_box('mtnc-themes', __('Themes', 'maintenance'), 'mtnc_add_themes_fields', $mtnc_variable->options_page, 'normal', 'high'); add_meta_box('mtnc-design', __('Design', 'maintenance'), 'mtnc_add_design_fields', $mtnc_variable->options_page, 'normal', 'high'); add_meta_box('mtnc-access', __('Access Settings', 'maintenance'), 'mtnc_add_access_fields', $mtnc_variable->options_page, 'normal', 'high'); add_meta_box('mtnc-css', __('Advanced Settings', 'maintenance'), 'mtnc_add_css_fields', $mtnc_variable->options_page, 'normal', 'default'); add_meta_box('mtnc-excludepages', __('Exclude pages from maintenance mode', 'maintenance'), 'mtnc_add_exclude_pages_fields', $mtnc_variable->options_page, 'normal', 'default'); } add_action('add_mt_meta_boxes', 'mtnc_page_create_meta_boxes', 10); function mtnc_page_create_meta_boxes_widget_pro() { global $mtnc_variable; } add_action('add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_pro', 15); function mtnc_add_review_top() { $promo_text = ''; $promo_text .= '

Your review means a lot! Please help us spread the word so that others know the Maintenance plugin is free and well maintained!
Thank you very much for using our plugin and helping us out!

'; $promo_text .= '


Leave a Review    I already left a review ;)

'; mtnc_wp_kses($promo_text); } function mtcn_is_weglot_active() { if (!function_exists('is_plugin_active') || !function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if (is_plugin_active('weglot/weglot.php')) { $weglot_info = get_plugin_data(ABSPATH . 'wp-content/plugins/weglot/weglot.php'); if (version_compare($weglot_info['Version'], '2.5', '<')) { return false; } else { return true; } } else { return false; } } // mtcn_is_weglot_active // check if Weglot is completely set up function mtnc_is_weglot_setup() { if (!mtcn_is_weglot_active()) { return false; } $active_languages = weglot_get_destination_languages(); if (!empty($active_languages)) { return true; } else { return false; } } // is_weglot_setup function mtnc_page_create_meta_boxes_widget_support() { global $mtnc_variable; add_meta_box('promo-mtnc', __('Work faster - get the PRO version', 'maintenance'), 'mtnc_promo_mtnc', $mtnc_variable->options_page, 'side', 'high'); if (!defined('WPFSSL_OPTIONS_KEY')) { add_meta_box('promo-wpfssl', __('Solve all SSL problems with the free WP Force SSL plugin', 'maintenance'), 'mtnc_promo_wpfssl', $mtnc_variable->options_page, 'side', 'high'); } if (!mtcn_is_weglot_active()) { add_meta_box('promo-weglot', __('50% of your customers don\'t speak english', 'maintenance'), 'mtnc_promo_weglot', $mtnc_variable->options_page, 'side', 'high'); } add_meta_box('promo-review2', __('Help us keep the plugin free & maintained', 'maintenance'), 'mtnc_review_box', $mtnc_variable->options_page, 'side', 'high'); add_meta_box('promo-content2', __('Something is not working? Do you need our help?', 'maintenance'), 'mtnc_contact_support', $mtnc_variable->options_page, 'side', 'default'); } add_action('add_mt_meta_boxes', 'mtnc_page_create_meta_boxes_widget_support', 13); function mtnc_add_toc($object, $box) { $out = ''; $out .= ''; mtnc_wp_kses($out); } function mtnc_add_data_fields($object, $box) { $mt_option = mtnc_get_plugin_options(true); $is_blur = false; $page_title = $heading = $description = $logo_width = $logo_height = ''; $allowed_tags = wp_kses_allowed_html('post'); if (isset($mt_option['page_title'])) { $page_title = wp_kses(stripslashes($mt_option['page_title']), $allowed_tags); } if (isset($mt_option['heading'])) { $heading = wp_kses_post($mt_option['heading']); } if (isset($mt_option['description'])) { $description = wp_kses(stripslashes($mt_option['description']), $allowed_tags); } if (isset($mt_option['footer_text'])) { $footer_text = wp_kses_post($mt_option['footer_text']); } if (isset($mt_option['logo_width'])) { $logo_width = wp_kses_post($mt_option['logo_width']); } if (isset($mt_option['logo_height'])) { $logo_height = wp_kses_post($mt_option['logo_height']); } ?> '; echo ''; echo ''; echo ''; } else { mtnc_generate_check_field(__('Multilingual Support', 'maintenance'), __('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, install the Weglot plugin (free plan and free trial available). It seamlessly integrates with Maintenance and is compatible with all themes & plugins.', 'maintenance'), 'weglot', 'weglot', !empty($mt_option['weglot'])); } mtnc_generate_check_field(__('Show Some Love', 'maintenance'), __('Show a small link in the footer to let others know you\'re using this awesome & free plugin', 'maintenance'), 'show_some_love', 'show_some_love', !empty($mt_option['show_some_love'])); mtnc_generate_check_field(__('Show Contact Form', 'maintenance'), 'Enable & customize a contact form on the page so that visitors can easily get in touch with you.', 'content_contact_form', '', false, true); mtnc_generate_check_field(__('Show Map', 'maintenance'), 'Make it super-easy for visitors to find your business by displaying a map with your location.', 'content_map', '', false, true); mtnc_generate_check_field(__('Show Progress Bar', 'maintenance'), 'Let visitors know how your new site is progressing and when is it going to be complete.', 'content_progress_bar', '', false, true); mtnc_generate_check_field(__('Enable Frontend Login', 'maintenance'), '', 'is_login', 'is_login', (isset($mt_option['is_login']) && $mt_option['is_login'] == true )); mtnc_wp_kses(''); ?>
'; if (mtnc_is_weglot_setup()) { $tmp = ''; $active_languages = array(); $active_languages_weglot = weglot_get_destination_languages(); foreach($active_languages_weglot as $language){ $active_languages[] = $language['language_to']; } $languages = weglot_get_languages_available(); $original_language = weglot_get_original_language(); echo '

Your maintenance page is currently available in the following languages.
To add more languages and configure translations open Weglot settings.

'; echo '
    '; foreach ($languages as $language) { if ($language->getExternalCode() == $original_language) { $tmp = '
  • ' . esc_html($language->getEnglishName()) . ' - original language
  • ' . $tmp; } if (in_array($language->getExternalCode(), $active_languages)) { $tmp .= '
  • ' . esc_html($language->getLocalName()) . '
  • '; } } // foreach language mtnc_wp_kses($tmp); echo '
'; } else { echo '

Your maintenance page is currently not translated.
Open Weglot settings to select languages you want to translate to.

'; } echo '

'); ?>

'); ?>

{$tmp['label']} \n"; } else { $out .= "\n"; } } // foreach if ($output) { mtnc_wp_kses($out); } else { return $out; } } // create_select_options function mtnc_smush_option() { if (defined('WP_SMUSH_VERSION')) { echo ''; echo ''; echo ''; echo 'Configure image compression options.'; echo ''; echo ''; } else { echo ''; echo ''; echo ''; echo 'The easiest way to speed up any site is to compress images. On an average page you can easily save a few megabytes. Doing it manually in Photoshop is a pain! That\'s why there are plugins like Smush that specialize in compressing images. Install the free Smush plugin. It has no limit on the amount of images you can compress, seamlessly integrates with WordPress, and is compatible with all plugins & themes. And best of all - it\'s used by over a million users just like you.'; echo ''; echo ''; } } // mtnc_smush_option function mtnc_add_css_fields() { $mt_option = mtnc_get_plugin_options(true); $gg_analytics_id = ''; if (!empty($mt_option['gg_analytics_id'])) { $gg_analytics_id = esc_js($mt_option['gg_analytics_id']); } echo ''; echo ''; mtnc_generate_input_filed(__('Google Analytics ID', 'maintenance'), 'gg_analytics_id', 'gg_analytics_id', $gg_analytics_id, __('UA-XXXXX-X', 'maintenance')); mtnc_generate_input_filed(__('Custom Tracking Pixel/Code', 'maintenance'), 'advanced_pixel', 'advanced_pixel', '', '', 'Place 3rd party tracking pixels and other tracking code here.', true); mtnc_generate_check_field(__('503 Response Code', 'maintenance'), __('Service temporarily unavailable, Google analytics will be disabled.', 'maintenance'), '503_enabled', '503_enabled', !empty($mt_option['503_enabled'])); mtnc_generate_check_field(__('Send no-cache Headers', 'maintenance'), __('If you don\'t want Google, Facebook, Twitter and similar services to cache the preview of your site under maintenance use this option.', 'maintenance'), 'advanced_nocache', 'advanced_nocache', false, true); mtnc_generate_check_field(__('Enable WP REST API', 'maintenance'), __('By default WP REST API is blocked along with all other pages/URLs. If you need it while the site is under maintenance use this option.', 'maintenance'), 'advanced_restapi', 'advanced_restapi', false, true); mtnc_generate_textarea_filed(__('CSS Code', 'maintenance'), 'custom_css', 'custom_css', wp_kses_stripslashes($mt_option['custom_css'])); echo ''; echo ''; echo ''; echo '
 Enter only the CSS code, without the <style> tags.

'; } function mtnc_add_themes_fields() { $themes = array( 0 => array( 'id' => '5f2f8c65307b6f3097f2ca4d25d5cb26', 'name' => 'Adventure Blog', 'name_clean' => 'adventure-blog', 'status' => 'pro', ), 1 => array( 'id' => '0a0c5efe1e95f91a42bc9e6e6ca884dd', 'name' => 'Business', 'name_clean' => 'business', 'status' => 'pro', ), 2 => array( 'id' => '06142f926b2da71d8dddfba3254a78cb', 'name' => 'Digital Marketing Agency', 'name_clean' => 'digital-marketing-agency', 'status' => 'pro', ), 3 => array( 'id' => '1f62286e16a799a6cf57a5013518a915', 'name' => 'E-Shop', 'name_clean' => 'e-shop', 'status' => 'pro', ), 4 => array( 'id' => 'd41b1b0a6d4cb304e886121b3118cfa0', 'name' => 'Fashion', 'name_clean' => 'fashion', 'status' => 'pro', ), 5 => array( 'id' => '7f96d3918bd5840258a6dce654f4b0dc', 'name' => 'Flower Shop', 'name_clean' => 'flower-shop', 'status' => 'pro', ), 6 => array( 'id' => '1c498ed60de01a93c2a4cac0ab50ddc2', 'name' => 'Gaming', 'name_clean' => 'gaming', 'status' => 'pro', ), 7 => array( 'id' => 'bb9f78a54648fe776fe7cdce018d4649', 'name' => 'Interior Design', 'name_clean' => 'interior-design', 'status' => 'pro', ), 8 => array( 'id' => 'bce5308440264fa4a8ce9cf1b38f3242', 'name' => 'Mobile App', 'name_clean' => 'mobile-app', 'status' => 'pro', ), 9 => array( 'id' => 'b20f2da4e5cd0753638723ff12383378', 'name' => 'Non-Profit Organization', 'name_clean' => 'non-profit-organization', 'status' => 'pro', ), 10 => array( 'id' => '2c6c47a437172cf970e9027ab7c4f680', 'name' => 'Photography', 'name_clean' => 'photography', 'status' => 'pro', ), 11 => array( 'id' => 'ea2584e286d8e0304994f4d9d9e4d335', 'name' => 'Podcast', 'name_clean' => 'podcast', 'status' => 'pro', ), 12 => array( 'id' => 'f7432f296c75f398c018ebbd0118cf1f', 'name' => 'Product Marketing', 'name_clean' => 'product-marketing', 'status' => 'pro', ), 13 => array( 'id' => '274bd92fd91aadc05fe0637f614633d8', 'name' => 'Restaurant', 'name_clean' => 'restaurant', 'status' => 'pro', ), 14 => array( 'id' => '1ff8ca16c5010eec8797eb5416373c6d', 'name' => 'Skincare', 'name_clean' => 'skincare', 'status' => 'pro', ), 15 => array( 'id' => 'a2df8994e86f844e9fe7516fb272b6f3', 'name' => 'Social Media', 'name_clean' => 'social-media', 'status' => 'pro', ), 16 => array( 'id' => 'eb668b7221bb4ed50c8edc8aebb68ba4', 'name' => 'Sport', 'name_clean' => 'sport', 'status' => 'pro', ), 17 => array( 'id' => '906d50132e2caf64ad57d9c76b07f78c', 'name' => 'Travel Vlog', 'name_clean' => 'travel-vlog', 'status' => 'pro', ), 18 => array( 'id' => 'd1dd1f82d0d557460f22ac7058c291e0', 'name' => 'Wedding', 'name_clean' => 'wedding', 'status' => 'pro', ), 19 => array( 'id' => '35b404155b3be97d198dadf05ddfc960', 'name' => 'Wellness', 'name_clean' => 'wellness', 'status' => 'pro', ), ); function mntc_themes_sort($item1, $item2) { if (strtotime($item1['last_edit']) == strtotime($item2['last_edit'])) { return 0; } return strtotime($item1['last_edit']) < strtotime($item2['last_edit']) ? 1 : -1; } //usort($themes,'mntc_themes_sort'); echo '

Are you in a hurry? Looking for something that looks great for your site? Pick one of +20 premium pre-built themes and be done in 5 minutes! Our PRO plugin comes with built-in SEO analyzer, a collection of over 3.7 million images and it can connect to any mailing system like Mailchimp so you can start collecting emails from day one! Did we mention you can rebrand the plugin and control all client sites from the plugin\'s centralized Dashboard?

'; $i = 1; foreach ($themes as $theme) { echo '
'; $i++; if ($theme['status'] != 'free') { echo 'Preview ' . esc_html($theme['name']) . ''; } echo '' . esc_html($theme['name']) . ''; echo ''; if ($theme['status'] != 'free') { echo 'BUY lifetime license   '; echo 'Preview'; } echo ''; if ($theme['status'] != 'free') { echo '
'; } echo '
'; } // foreach theme } function mtnc_generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '') { $base_url = 'https://wpmaintenancemode.com'; if ('/' != $page) { $page = '/' . trim($page, '/') . '/'; } if ($page == '//') { $page = '/'; } $parts = array_merge(array('utm_source' => 'maintenance-free', 'utm_medium' => 'plugin', 'utm_content' => $placement, 'utm_campaign' => 'maintenance-free-v' . MTNC_VERSION), $params); if (!empty($anchor)) { $anchor = '#' . trim($anchor, '#'); } $out = $base_url . $page . '?' . http_build_query($parts, '', '&') . $anchor; return $out; } // csmm_generate_web_link function mtnc_add_exclude_pages_fields() { $mt_option = mtnc_get_plugin_options(true); $out_filed = ''; $post_types = get_post_types( array( 'show_ui' => true, 'public' => true, ), 'objects' ); $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= ''; foreach ($post_types as $post_slug => $type) { if (($post_slug === 'attachment') || ($post_slug === 'revision') || ($post_slug === 'nav_menu_item') ) { continue; } $args = array( 'posts_per_page' => 200, 'orderby' => 'NAME', 'order' => 'ASC', 'post_type' => $post_slug, 'post_status' => 'publish', ); $posts_array = get_posts($args); $db_pages_ex = array(); if (!empty($posts_array)) { /*Exclude pages from maintenance mode*/ if (!empty($mt_option['exclude_pages']) && isset($mt_option['exclude_pages'][$post_slug])) { $db_pages_ex = $mt_option['exclude_pages'][$post_slug]; } $out_filed .= ''; $out_filed .= ''; $out_filed .= '
'; $out_filed .= '
'; $out_filed .= ''; } } $out_filed .= ''; $out_filed .= ''; $out_filed .= '
' . __('Select the page(s) to be displayed normally, excluded by maintenance mode.', 'maintenance') . ' Please note that in order to prevent issues on sites with large number of posts we show only the first 200 entries for each post type (post, page, product,...).
' . $type->labels->name . ''; $out_filed .= ''; $out_filed .= ''; $out_filed .= '

'; mtnc_wp_kses($out_filed); } function mtnc_get_background_fileds_action() { $mt_option = mtnc_get_plugin_options(true); mtnc_generate_image_filed(__('Background Image', 'maintenance'), 'body_bg', 'body_bg', esc_attr($mt_option['body_bg']), 'boxes box-bg', __('Upload Background', 'maintenance'), 'upload_background upload_btn button'); } add_action('mtnc_background_field', 'mtnc_get_background_fileds_action', 10); function mtnc_get_color_fileds_action() { $mt_option = mtnc_get_plugin_options(true); mtnc_get_color_field(__('Background Color', 'maintenance'), 'body_bg_color', 'body_bg_color', esc_attr($mt_option['body_bg_color']), '#111111'); mtnc_get_color_field(__('Font Color', 'maintenance'), 'font_color', 'font_color', esc_attr($mt_option['font_color']), '#ffffff'); mtnc_get_color_field(__('Login Block Background Color', 'maintenance'), 'controls_bg_color', 'controls_bg_color', isset($mt_option['controls_bg_color']) ? esc_attr($mt_option['controls_bg_color']) : '', '#000000'); } add_action('mtnc_color_fields', 'mtnc_get_color_fileds_action', 10); function mtnc_get_font_fileds_action() { $mt_option = mtnc_get_plugin_options(true); mtnc_wp_kses(mtnc_get_fonts_field(__('Font Family', 'maintenance'), 'body_font_family', 'body_font_family', esc_html($mt_option['body_font_family']))); $subset = ''; if (!empty($mt_option['body_font_subset'])) { $subset = $mt_option['body_font_subset']; } mtnc_wp_kses(mtnc_get_fonts_subsets(__('Subsets', 'maintenance'), 'body_font_subset', 'body_font_subset', esc_html($subset))); } add_action('mtnc_font_fields', 'mtnc_get_font_fileds_action', 10); function mtnc_contact_support() { $promo_text = ''; $promo_text .= ''; echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput } function mtnc_review_box() { $promo_text = ''; $promo_text .= ''; echo $promo_text; // phpcs:ignore WordPress.Security.EscapeOutput } function mtnc_promo_wpfssl() { $promo_text = ''; //$promo_text .= '

Problems with SSL certificate?
Moving a site from HTTP to HTTPS?
Mixed content giving you troubles?

'; $promo_text .= '

WP Force SSL

'; $promo_text .= '


Install & activate the free WP Force SSL plugin

'; $promo_text .= '

WP Force SSL is a free WP plugin maintained by the same team as this Maintenance plugin. It has +180,000 users, 5-star rating, and is hosted on the official WP repository.

'; mtnc_wp_kses($promo_text); } // mtnc_promo_wpfssl function mtnc_promo_weglot() { $promo_text = ''; $promo_text .= '

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.

'; $promo_text .= '


Install the Weglot Translate freemium plugin

'; mtnc_wp_kses($promo_text); } // mtnc_promo_weglot function mtnc_promo_mtnc() { $promo_text = ''; //$promo_text .= '

Problems with SSL certificate?
Moving a site from HTTP to HTTPS?
Mixed content giving you troubles?

'; $promo_text .= '

WP Maintenance PRO

'; $promo_text .= '


Get PRO now

'; $promo_text .= '

PRO version is here! Grab the launch discount - all prices are LIFETIME!

'; mtnc_wp_kses($promo_text); } // mtnc_promo_mtnc function mtnc_check_exclude() { global $mt_options, $post; $mt_options = mtnc_get_plugin_options(true); $is_skip = false; if (is_page() || is_single()) { $curr_id = $post->ID; } else { if (is_home()) { $blog_id = get_option('page_for_posts'); if ($blog_id) { $curr_id = $blog_id; } } if (is_front_page()) { $front_page_id = get_option('show_on_front'); if ($front_page_id) { $curr_id = $front_page_id; } } } if (isset($curr_id) && isset($mt_options['exclude_pages']) && !empty($mt_options['exclude_pages'])) { $exlude_objs = $mt_options['exclude_pages']; foreach ($exlude_objs as $objs_id) { foreach ($objs_id as $obj_id) { if ($curr_id === (int) $obj_id) { $is_skip = true; break; } } } } return $is_skip; } function mtnc_load_maintenance_page($original_template) { global $mt_options; $v_curr_date_start = $v_curr_date_end = $v_curr_time = ''; $vdate_start = $vdate_end = date_i18n('Y-m-d', strtotime(current_time('mysql', 0))); $vtime_start = date_i18n('h:i:s A', strtotime('01:00:00 am')); $vtime_end = date_i18n('h:i:s A', strtotime('12:59:59 pm')); //no nonce because preview links can be manually opened directly if (file_exists(MTNC_LOAD . 'index.php') && isset($_GET['maintenance-preview'])) { //phpcs:ignore add_filter('script_loader_tag', 'mtnc_defer_scripts', 10, 2); return MTNC_LOAD . 'index.php'; } $not_logged_in = !is_user_logged_in(); if (apply_filters('mtnc_load_maintenance_page_for_this_user', $not_logged_in)) { if (!empty($mt_options['state'])) { if (!empty($mt_options['expiry_date_start'])) { $vdate_start = $mt_options['expiry_date_start']; } if (!empty($mt_options['expiry_date_end'])) { $vdate_end = $mt_options['expiry_date_end']; } if (!empty($mt_options['expiry_time_start'])) { $vtime_start = $mt_options['expiry_time_start']; } if (!empty($mt_options['expiry_time_end'])) { $vtime_end = $mt_options['expiry_time_end']; } $v_curr_time = strtotime(current_time('mysql', 0)); $v_curr_date_start = strtotime($vdate_start . ' ' . $vtime_start); $v_curr_date_end = strtotime($vdate_end . ' ' . $vtime_end); if (mtnc_check_exclude()) { return $original_template; } if (($v_curr_time < $v_curr_date_start) || ($v_curr_time > $v_curr_date_end)) { if (!empty($mt_options['is_down'])) { // is down - is flag for "Open website after countdown expired" return $original_template; } } } else { return $original_template; } if (file_exists(MTNC_LOAD . 'index.php')) { add_filter('script_loader_tag', 'mtnc_defer_scripts', 10, 2); return MTNC_LOAD . 'index.php'; } else { return $original_template; } } else { return $original_template; } } function mtnc_defer_scripts($tag, $handle) { if (strpos($handle, '_ie') !== 0) { return $tag; } return str_replace(' src', ' defer="defer" src', $tag); } function mtnc_metaboxes_scripts() { global $mtnc_variable; ?> add_menu( array( 'id' => 'maintenance_options', 'title' => __('Maintenance', 'maintenance') . __(' is ', 'maintenance') . $check, 'href' => $url_to, 'meta' => array( 'title' => __( 'Maintenance', 'maintenance' ) . __( ' is ', 'maintenance' ) . $check, ), ) ); } function mtnc_hex2rgb($hex) { $hex = str_replace('#', '', $hex); if (strlen($hex) === 3) { $r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1)); $g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1)); $b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1)); } else { $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); } $rgb = array($r, $g, $b); return implode(',', $rgb); } function mtnc_insert_attach_sample_files() { global $wpdb, $wp_filesystem; mtnc_wp_init_filesystem(); $title = ''; $attach_id = 0; //db call ok; no-cache ok $is_attach_exists = $wpdb->get_results("SELECT p.ID FROM $wpdb->posts p WHERE p.post_title LIKE '%mt-sample-background%'", OBJECT); //phpcs:ignore if (!empty($is_attach_exists)) { $attach_id = current($is_attach_exists)->ID; } else { require_once ABSPATH . 'wp-admin/includes/image.php'; $image_url = MTNC_DIR . 'images/mt-sample-background.jpg'; $file_name = basename($image_url); $file_content = $wp_filesystem->get_contents( $image_url ); $upload = wp_upload_bits($file_name, null, $file_content, current_time('mysql', 0)); if (!$upload['error']) { $title = preg_replace('/\.[^.]+$/', '', $file_name); $wp_filetype = wp_check_filetype(basename($upload['file']), null); $attachment = array( 'guid' => $upload['url'], 'post_mime_type' => $wp_filetype['type'], 'post_title' => $title, 'post_content' => '', 'post_status' => 'inherit', ); $attach_id = wp_insert_attachment($attachment, $upload['file']); $attach_data = wp_generate_attachment_metadata($attach_id, $upload['file']); wp_update_attachment_metadata($attach_id, $attach_data); } } if (!empty($attach_id)) { return $attach_id; } else { return ''; } } function mtnc_get_default_array() { $defaults = array( 'state' => true, 'page_title' => __('Site is undergoing maintenance', 'maintenance'), 'heading' => __('Maintenance mode is on', 'maintenance'), 'description' => __('Site will be available soon. Thank you for your patience!', 'maintenance'), 'footer_text' => '© ' . get_bloginfo('name') . ' ' . gmdate('Y'), 'show_some_love' => '', 'logo_width' => 220, 'logo_height' => '', 'logo' => '', 'retina_logo' => '', 'body_bg' => mtnc_insert_attach_sample_files(), 'bg_image_portrait' => '', 'preloader_img' => '', 'body_bg_color' => '#111111', 'controls_bg_color' => '#111111', 'font_color' => '#ffffff', 'body_font_family' => 'Open Sans', 'body_font_subset' => 'Latin', 'is_blur' => false, 'blur_intensity' => 5, '503_enabled' => false, 'gg_analytics_id' => '', 'is_login' => true, 'custom_css' => '', 'exclude_pages' => '', 'default_settings' => true, ); return apply_filters('mtnc_get_default_array', $defaults); } if (!function_exists('mtnc_get_bunny_fonts')) { function mtnc_get_bunny_fonts() { global $wp_filesystem; mtnc_wp_init_filesystem(); $gg_fonts = $wp_filesystem->get_contents(MTNC_DIR . 'includes/fonts/fonts.json'); return $gg_fonts; } }