HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //home/Test/wp/wp-content/plugins/5sec-maintenance-mode/5sec-maintenance-mode.php
<?php
/*
Plugin Name: 5sec Maintenance Mode
Plugin URI: http://5sec-maintenance-mode.webfactoryltd.com/
Description: Locks out WordPress in maintenance mode so that you can make modifications in peace.
Author: Web factory Ltd
Version: 1.2
Author URI: http://www.webfactoryltd.com/
*/

// disable direct script call
if (!function_exists('add_action')) {
  die('Please do not open this file directly!');
}

// include common Web factory plugin functions
require_once 'wf-mm-common.php';

// main plugin class
class wf_mm {
  static function init() {
    if (is_admin()) {
      // add MM menu to admin tools menu group
      add_action('admin_menu', array('wf_mm', 'admin_menu'));

      // settings registration
      add_action('admin_init', array('wf_mm', 'register_settings'));

      // if the plugin was installed/reinstalled/broken set settings to default
      self::default_settings(false);

      // aditional links in plugin description
      add_filter('plugin_action_links_' . basename(dirname(__FILE__)) . '/' . basename(__FILE__),
                            array(__CLASS__, 'plugin_action_links'));
      add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);

      // manages admin header notifications
      add_action('admin_notices', array('wf_mm', 'notices'));

      // inject JS/CSS code in admin header
      add_action('admin_head', array('wf_mm', 'admin_head'));

      // register AJAX endpoints
      add_action('wp_ajax_mm_gen_link', array('wf_mm', 'ajax_callback_gen_link'));
    } else {
      if (!session_id()) {
        @session_start();
      }
      
      // actual app logic
      add_filter('status_header', array('wf_mm', 'status_header'), 10, 4);
      add_action('get_header', array('wf_mm', 'maintenance'));

      // disable feeds if necessary
      add_action('do_feed_rdf', array('wf_mm', 'maintenance_feed'), 1, 1);
      add_action('do_feed_rss', array('wf_mm', 'maintenance_feed'), 1, 1);
      add_action('do_feed_rss2', array('wf_mm', 'maintenance_feed'), 1, 1);
      add_action('do_feed_atom', array('wf_mm', 'maintenance_feed'), 1, 1);

      // show maintenance notice on login form
      add_action('login_message', array('wf_mm', 'login_notices'));
    }

    // admin bar notice for frontend/backend
    add_action('wp_before_admin_bar_render', array('wf_mm', 'admin_bar_notice'));
  } // init

  // if configured return status header 503
  static function status_header($status_header, $header, $text, $protocol) {
    $options = get_option('wf_mm');

    if ($options['compatibility-mode']) {
      if (self::is_maintenance_enabled(false)) {
        echo self::get_template($options['theme']);
        die();
      }
    } else {
      if (self::is_maintenance_enabled(false) && $options['header-503']) {
        return $protocol . ' 503 Service Unavailable';
      } else {
        return "$protocol $header $text";
      }  
    }
    
    return "$protocol $header $text";
  } // status_header

  // actuall maintenace function; gets and displays the page
  static function maintenance() {
    $options = get_option('wf_mm');

    if (self::is_maintenance_enabled(false)) {
      echo self::get_template($options['theme']);
      die();
    }
  } // maintenance

  // disables feeds if necessary
  static function maintenance_feed() {
    $options = get_option('wf_mm');

    if (self::is_maintenance_enabled(false) && $options['disable-feeds']) {
      echo '<?xml version="1.0" encoding="UTF-8" ?><status>Service unavailable.</status>';
      die();
    }
  } // maintenance_feed

  // returnes parsed maintenance theme
  static function get_template($template_id) {
    $options = get_option('wf_mm');
    $template = $page = file_get_contents(dirname(__FILE__) . '/themes/' . $template_id . '.html');

    $url = plugins_url('', __FILE__) . '/themes/';
    $title = str_replace(array('{blog-title}', '{blog-tagline}', '{blog-url}', '{blog-login-url}'),
                         array(get_bloginfo('name'), get_bloginfo('description'), get_home_url(), get_site_url() . '/wp-login.php'),
                         $options['title']);
    $heading1 = str_replace(array('{blog-title}', '{blog-tagline}', '{blog-url}', '{blog-login-url}'),
                         array(get_bloginfo('name'), get_bloginfo('description'), get_home_url(), get_site_url() . '/wp-login.php'),
                         $options['heading1']);
    $heading2 = str_replace(array('{blog-title}', '{blog-tagline}', '{blog-url}', '{blog-login-url}'),
                         array(get_bloginfo('name'), get_bloginfo('description'), get_home_url(), get_site_url() . '/wp-login.php'),
                         $options['heading2']);
    $content = str_replace(array('{blog-title}', '{blog-tagline}', '{blog-url}', '{blog-login-url}'),
                         array(get_bloginfo('name'), get_bloginfo('description'), get_home_url(), get_site_url() . '/wp-login.php'),
                         $options['content']);
    $description = get_bloginfo('description');

    if ($options['countdown']) {
      $date = strtotime($options['countdown-time']);
      $tmp_date  = date('Y, ', $date);
      $tmp_date .= date('m', $date) - 1;
      $tmp_date .= date(', d, H, i', $date);

      $countdown_div = '<div id="defaultCountdown"></div>';
      $countdown_js = "$(function () {
            $('#defaultCountdown').countdown({until: new Date(" . $tmp_date . ")}); });";
    } else {
      $countdown_div = '';
      $countdown_js = '';
    }

    if ($options['progress']) {
      $progress_div = '<div style="margin: 20px;" class="progressBar" id="progress">' . $options['progress-per'] . '%</div>';
      $progress_js = "$(document).ready(function() {
        $('#progress').progressBar({ barImage: '" . $url . "images/progressbg_black.gif', boxImage: '" . $url . "images/progressbar.gif' }); });";
    } else {
      $progress_div = '';
      $progress_js = '';
    }

    if ($options['ga'] && substr(strtolower($options['ga']), 0, 3) == 'ua-') {
      $ga = "  <script type=\"text/javascript\">
  var _gaq = _gaq || []; _gaq.push(['_setAccount', '" . $options['ga'] . "']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>";
    } else {
      $ga = '';
    }

    $template = str_replace(array('{url}', '{title}', '{heading1}', '{heading2}', '{content}', '{description}'),
                            array($url, $title, $heading1, nl2br($heading2), nl2br($content), $description),
                            $template);
    $template = str_replace(array('{countdown_div}', '{countdown_js}', '{progress_div}', '{progress_js}', '{ga}'),
                            array($countdown_div, $countdown_js, $progress_div, $progress_js, $ga),
                            $template);

    return $template;
  } // get_template

  // checks if users IP matches one from the list
  static function match_ip($ips, $user_ip) {
    if (!is_array($ips)) {
      $ips = array($ips);
    }

    for($i = 0, $cnt = count($ips); $i < $cnt; $i++) {
      if (empty($ips[$i])) {
        continue;
      }
      $ipregex = str_replace('.', '\.', $ips[$i]);
      $ipregex = str_replace('*', '.*', $ipregex);

      if(preg_match('/^' . $ipregex . '/', $user_ip)) {
        return true;
      }
    } // for

    return false;
  } // match_ip

  // checks if maintenance mode is enabled for the current user
  static function is_maintenance_enabled($global = false) {
    $options = get_option('wf_mm');
    $ips = $options['ips'];
    $ips = explode("\n", $ips);
    for ($i = 0, $tmp = sizeof($ips); $i < $tmp; $i++) {
      $ips[$i] = trim($ips[$i]);
    }
    $tmp_token = @$_GET['skip-maintenance-token'];
    if ($tmp_token == $options['access_token']) {
      $_SESSION['mm-token'] = $tmp_token;
    }

    if ($global) {
      if ($options['status']) {
        return true;
      } else {
        return false;
      }
    } else {
      // check if mm is enabled for current user
      if (!$options['status']) {
        return false;
      } elseif (self::user_has_role($options['roles'])) {
        return false;
      } elseif (self::match_ip($ips, $_SERVER['REMOTE_ADDR'])) {
        return false;
      } elseif (@$_SESSION['mm-token'] == $options['access_token']) {
        return false;
      } else {
        return true;
      }
    }
  } // is_maintenance_enabled

  // check if user has the specified role
  static function user_has_role($roles) {
    global $current_user;
    wp_get_current_user(  );

    if ($current_user->roles) {
      $user_role = $current_user->roles[0];
    } else {
      $user_role = 'guest';
    }

    return in_array($user_role, $roles);
  } // user_has_role

  // displays various notices in admin header
  static function notices() {
    $options = get_option('wf_mm');

    if (self::is_maintenance_enabled(true) && !$options['disable-notices']) {
      echo '<div id="message" class="error"><p>Caution: 5sec Maintenance mode is <strong>enabled</strong>! Edit <a href="tools.php?page=wf-mm" title="5sec Maintenance Mode Settings">settings</a> to disable it.</p></div>';
    }

    if (get_transient('wf-mm-updated')) {
      echo '<div id="message-mm" class="updated"><p><b>Settings saved.</b></p></div>';
      delete_transient('wf-mm-updated');
    }
  } // notices

  // show maintenance notice on WP login form
  static function login_notices() {
    $options = get_option('wf_mm');

    if (self::is_maintenance_enabled(true) && !$options['disable-notices']) {
      echo '<div id="login_error"><b>CAUTION:</b> 5sec Maintenance mode is <b>enabled</b>!</div>';
    }
  } // login_notices

  // adds admin bar notice when MM is enabled
  static function admin_bar_notice() {
    global $wp_admin_bar;
    $options = get_option('wf_mm');

    if (self::is_maintenance_enabled(true) && !$options['disable-notices']) {
      $wp_admin_bar->add_menu(array(
          'parent' => '',
          'id' => 'maintenance-mode',
          'title' => 'Maintenance mode is <b>enabled</b>',
          'href' => admin_url('tools.php?page=wf-mm')
      ));
    }
  } // admin_bar_notice

  // add settings link to plugins page
  static function plugin_action_links($links) {
    $settings_link = '<a href="tools.php?page=wf-mm" title="5sec Maintenance Mode Settings">Settings</a>';
    array_unshift($links, $settings_link);

    return $links;
  } // plugin_action_links
  
  // add links to plugin's description in plugins table
  static function plugin_meta_links($links, $file) {
     $documentation_link = '<a target="_blank" href="' . plugin_dir_url(__FILE__) . 'documentation/" title="View 5sec Maintenance Mode documentation">Documentation</a>';
    $support_link = '<a target="_blank" href="http://codecanyon.net/user/WebFactory#from" title="Contact Web factory">Support</a>';

    if ($file == plugin_basename(__FILE__)) {
      $links[] = $documentation_link;
      $links[] = $support_link;
    }

    return $links;
  } // plugin_meta_links

  // create the admin menu item
  static function admin_menu() {
    add_management_page('5sec Maintenance Mode', '5sec Maintenance Mode', 'manage_options', 'wf-mm', array('wf_mm', 'options_page'));
  } // admin_menu

  // all settings are saved in one option
  static function register_settings() {
    register_setting('wf_mm', 'wf_mm', array('wf_mm', 'sanitize_settings'));
  } // register_settings

  // set default settings
  static function default_settings($force = false) {
    $defaults = array('status' => '0',
                      'theme' => 'bunny',
                      'title' => '{blog-title} is down for maintenance',
                      'heading1' => 'Sorry, we\'re down for maintenance.',
                      'heading2' => 'Fortunately only for a short while.',
                      'content' => 'Thank you for being patient!',
                      'countdown-time' => date('Y-m-d H:i', time() + DAY_IN_SECONDS * 15), // +15 days
                      'progress-per' => '45',
                      'ga' => '',
                      'ips' => '',
                      'header-503' => 1,
                      'disable-feeds' => 1,
                      'disable-notices' => 0,
                      'compatibility-mode' => 0,
                      'roles' => array('administrator'),
                      'access_token' => self::generate_access_token(false),
                      'countdown' => 1,
                      'progress' => 0);

    $options = get_option('wf_mm');

    if ($force || !$options || !$options['theme']) {
      update_option('wf_mm', $defaults);
    }
  } // default_settings

  // generates a temp access token
  static function generate_access_token($update_token = true) {
    $token = mt_rand(0, 0xffffff);
    $token = sprintf("%06x", $token);
    $token = strtoupper($token);

    if ($update_token) {
      $options = get_option('wf_mm');
      $options['access_token'] = $token;
      update_option('wf_mm', $options);
    }

    return $token;
  }
  // generate and return new tmp access link
  static function ajax_callback_gen_link() {
    self::generate_access_token();

    $options = get_option('wf_mm');
    $out = get_home_url() . '/?skip-maintenance-token=' . $options['access_token'];

    echo json_encode($out);
    die();
  } // ajax_callback_post_featured


  // admin JS/CSS
  static function admin_head() {
    if (!isset($_GET['page']) || $_GET['page'] != 'wf-mm') {
      return;
    }

    echo '<script type="text/javascript" src="' . plugins_url('js/anytimec.js', __FILE__) . '"></script>';
    echo '<script type="text/javascript" src="' . plugins_url('js/wf-mm.js', __FILE__) . '"></script>';
    echo '<link rel="stylesheet" href="' . plugins_url('css/wf-mm.css', __FILE__) . '" type="text/css" />';
  } // admin_head

  // sanitize settings on save
  static function sanitize_settings($values) {
    $old_options = get_option('wf_mm');
    set_transient('wf-mm-updated', true, 10);

    foreach ($values as $key => $value) {
      switch ($key) {
        case 'progress-per':
          $values[$key] = (int) $value;
        break;
        case 'theme':
        case 'ga':
        case 'title':
        case 'ips':
        case 'countdown-time':
          $values[$key] = trim($value);
        break;
      } // switch
    } // foreach

    wf_mm_common::check_var_isset($values, array('header-503' => 0,
                                                 'disable-feeds' => 0,
                                                 'disable-notices' => 0,
                                                 'compatibility-mode' => 0,
                                                 'countdown' => 0,
                                                 'roles' => array(),
                                                 'progress' => 0));

    return array_merge($old_options, $values);
  } // sanitize_settings

  // output the whole options page
  static function options_page() {
    if (!current_user_can('manage_options'))  {
      wp_die('You do not have sufficient permissions to access this page.');
    }

    $options = get_option('wf_mm');

    echo '<div class="wrap">
          <div class="icon32" id="icon-tools"><br /></div>
          <h2>5sec Maintenance Mode</h2>';

    echo '<form action="options.php" method="post">';
    settings_fields('wf_mm');

    echo '<h3>General Settings</h3>';

    echo '<p class="submit"><input type="submit" value="Save Changes" class="button-primary" name="Submit" /></p>';
    echo '<table class="form-table"><tbody>';

    $status[] = array('val' => '0', 'label' => 'Disabled - site is working normally');
    $status[] = array('val' => '1', 'label' => 'Enabled - site is in maintenance mode');

    $themes[] = array('val' => 'cookies', 'label' => 'Blue cookies');
    $themes[] = array('val' => 'bunny',   'label' => 'Pink bunny');
    $themes[] = array('val' => 'zebra',   'label' => 'Black &amp; white zebra');
    $themes[] = array('val' => 'switch',  'label' => 'Brown switch');
    $themes[] = array('val' => 'wheelbarrow',   'label' => 'White wheelbarrow');
    $themes[] = array('val' => 'plain',   'label' => 'Green plain text');

    for ($i=0; $i<=100; $i++) {
      $progress[] = array('val' => $i, 'label' => $i . '%');
    }

    $tmp_roles = get_editable_roles();
    foreach ($tmp_roles as $tmp_role => $details) {
      $name = translate_user_role($details['name']);
      $roles[] = array('val' => $tmp_role,  'label' => $name);
    }
    $roles[] = array('val' => 'guest',  'label' => 'Guest (not logged in user)');

    echo '<tr valign="top">
    <th scope="row"><label for="status">Status</label></th>
    <td><select id="status" name="wf_mm[status]">';
      wf_mm_common::create_select_options($status, $options['status']);
    echo '</select>';
    echo '<p>By enabling maintenance mode configured users and user groups will not be able to access the site\'s content. They will only see the maintenance page. Default: disabled.</p>';
    echo '</td></tr>';

    $img = plugins_url('/images/', __FILE__);
    echo '<tr valign="top">
    <th scope="row">Theme</th>
    <td>
    <div class="mm-thumb"><label for="layout-1"><img src="' . $img . 'bunny.png" alt="Pink bunny" title="Pink bunny" /></label><br /><input ' . checked('bunny', $options['theme'], false) . ' type="radio" id="layout-1" name="wf_mm[theme]" value="bunny" /> Pink bunny</div>
    <div class="mm-thumb"><label for="layout-2"><img src="' . $img . 'cookies.png" alt="Blue cookies" title="Blue cookies" /></label><br /><input ' . checked('cookies', $options['theme'], false) . ' type="radio" id="layout-2" name="wf_mm[theme]" value="cookies" /> Blue cookies</div>
    <div class="mm-thumb"><label for="layout-3"><img src="' . $img . 'zebra.png" alt="Black &amp; white zebra" title="Black &amp; white zebra" /></label><br /><input ' . checked('zebra', $options['theme'], false) . ' type="radio" id="layout-3" name="wf_mm[theme]" value="zebra" /> Black &amp; white zebra</div>
    <div class="mm-thumb"><label for="layout-4"><img src="' . $img . 'switch.png" alt="Brown switch" title="Brown switch" /></label><br /><input ' . checked('switch', $options['theme'], false) . ' type="radio" id="layout-4" name="wf_mm[theme]" value="switch" /> Brown switch</div>
    <div class="mm-thumb"><label for="layout-5"><img src="' . $img . 'wheelbarrow.png" alt="White wheelbarrow" title="White wheelbarrow" /></label><br /><input ' . checked('wheelbarrow', $options['theme'], false) . ' type="radio" id="layout-5" name="wf_mm[theme]" value="wheelbarrow" /> White wheelbarrow</div>
    <div class="mm-thumb"><label for="layout-6"><img src="' . $img . 'plain.png" alt="Green plain text" title="Green plain text" /></label><br /><input ' . checked('plain', $options['theme'], false) . ' type="radio" id="layout-6" name="wf_mm[theme]" value="plain" /> Green plain text</div>
    <br style="clear: both;" />
    <p>All themes can be customized by using the settings below. Default: pink bunny.</p>
    </td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="title">Maintenance Page Title</label></th>
    <td><input type="text" id="title" class="regular-text" name="wf_mm[title]" value="' . $options['title'] . '" />';
    echo '<p>Maintenance page title. Default: {blog-title} is down for maintenance.</p>';
    echo '<p><b>Available variables:</b></p>
    <ul class="mm-bullets">
    <li>{blog-title} - blog title, as set in <a href="options-general.php">Options - General</a></li>
    <li>{blog-tagline} - blog tagline, as set in <a href="options-general.php">Options - General</a></li>
    <li>{blog-url} - blog URL (site address), as set in <a href="options-general.php">Options - General</a></li>
    <li>{blog-login-url} - URL to blog login form</li>
    </ul>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="heading1">Maintenance Page Heading 1</label></th>
    <td><input id="heading1" type="text" class="large-text" name="wf_mm[heading1]" value="' . $options['heading1'] . '" />';
    echo '<p>Maintenance page (first) larger heading (look above for available variables). Default: Sorry, we\'re down for maintenance.</p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="heading2">Maintenance Page Heading 2</label></th>
    <td><textarea id="heading2" rows="3" class="large-text" name="wf_mm[heading2]">' . $options['heading2'] . '</textarea>';
    echo '<p>Maintenance page (second) smaller heading. Newlines are converted to HTML line breaks (look above for available variables). Default: Fortunately only for a short while.</p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="mm-content">Maintenance Page Content</label></th>
    <td><textarea id="mm-content" rows="3" class="large-text" name="wf_mm[content]">' . $options['content'] . '</textarea>';
    echo '<p>Maintenance page content. Newlines are converted to HTML line breaks (look above for available variables). Default: Thank you for being patient!</p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="countdown">Show Countdown Timer</label></th>
    <td><p><input name="wf_mm[countdown]" id="countdown" ' . checked('1', $options['countdown'], false) . ' value="1" type="checkbox" />
    If checked the maintenace page will show a countdown timer from the current time to the time specified below. Default: checked.</p>
    <p>Site will be back online on: <input class="medium-text" id="countdown-time" type="text" name="wf_mm[countdown-time]" value="' . $options['countdown-time'] . '" /></p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="progress">Show Progress Meter</label></th>
    <td><p><input name="wf_mm[progress]" id="progress" ' . checked('1', $options['progress'], false) . ' value="1" type="checkbox" />
    If checked the maintenance page will show a progress meter with the progress percentage defined below. Default: unchecked.</p>
    <p>How much progress has been made?
    <select id="progress-per" name="wf_mm[progress-per]">';
      wf_mm_common::create_select_options($progress, $options['progress-per']);
    echo '</select></p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="ga">Google Analytics UA Code</label></th>
    <td><input type="text" id="ga" class="normal-text" name="wf_mm[ga]" value="' . $options['ga'] . '" />';
    echo '<p>If you want to track visits to your maintenance page enter GA profile UA code; ie: UA-123456-12. Default: none.</p>';
    echo '</td></tr>';

    echo '</tbody></table>';
    echo '<p class="submit"><input type="submit" value="Save Changes" class="button-primary" name="Submit" /></p>';

    echo '<h3>Access Settings</h3>';
    echo '<table class="form-table"><tbody>';

    echo '<tr valign="top">
    <th scope="row"><label for="token">Temporary Access Link</label></th>
    <td><input onfocus="this.select();" type="text" readonly="readonly" id="token" class="large-text" name="token" value="' . get_home_url() . '/?skip-maintenance-token=' . $options['access_token'] . '" />
    <input type="button" value="Generate New Temporary Access Link" class="button-secondary" name="gen-link" id="gen-link" onclick="gen_link();" />';
    echo '<p>Giving this link to people will allow them temporary access to the site while it\'s still under maintenance mode.
    Please note that only one temporary link is active at any time. If you give someone the link and then generate a new one they wont be able to access the site anymore using the old link.</p>';
    echo '</td></tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="ips">Whitelisted IP Addresses</label></th>
    <td><textarea id="ips" rows="4" name="wf_mm[ips]">' . $options['ips'] . '</textarea>';
    echo '<p>Clients with IP addresses noted above will <b>not</b> be affected by maintenance mode and will always see the "normal" site. You can use the asterisk (*) as a wildchar, ie: "192.168.0.*".
    Please enter one IP address per line. Default: 127.0.0.1.<br />Your current IP address is: ' . $_SERVER['REMOTE_ADDR'] .'</p></td>
    </tr>';

    echo '<tr valign="top">
    <th scope="row">Whitelisted User Roles</th>
    <td>';
    foreach ($roles as $tmp_role) {
      echo  '<input name="wf_mm[roles][]" id="roles-' . $tmp_role['val'] . '" ' . wf_mm_common::checked($tmp_role['val'], $options['roles'], false) . ' value="' . $tmp_role['val'] . '" type="checkbox" /> <label for="roles-' . $tmp_role['val'] . '">' . $tmp_role['label'] . '</label><br />';
    }
    echo '<p>Selected user roles will <b>not</b> be affected by maintenance mode and will always see the "normal" site. Default: administrator.</p>';
    echo '</td></tr>';

    echo '</tbody></table>';
    echo '<p class="submit"><input type="submit" value="Save Changes" class="button-primary" name="Submit" /></p>';

    echo '<h3>Advanced Settings</h3>';
    echo '<table class="form-table"><tbody>';

    echo '<tr valign="top">
    <th scope="row"><label for="header-503">Respond with HTTP 503 Header</label></th>
    <td><p><input name="wf_mm[header-503]" id="header-503" ' . checked('1', $options['header-503'], false) . ' value="1" type="checkbox" />
    If checked, when maintenance mode is enabled the server will respond with "503 Service Temporarily Unavailable" header
    indicating to search engines and clients that this site\'s state is only temporary. Default: checked.</p></td>
    </tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="disable-feeds">Disable Feeds</label></th>
    <td><p><input name="wf_mm[disable-feeds]" id="disable-feeds" ' . checked('1', $options['disable-feeds'], false) . ' value="1" type="checkbox" />
    If checked, when maintenance mode is enabled all site\'s feeds will be disabled. Default: checked.</p></td>
    </tr>';

    echo '<tr valign="top">
    <th scope="row"><label for="disable-notices">Hide Admin Notices</label></th>
    <td><p><input name="wf_mm[disable-notices]" id="disable-notices" ' . checked('1', $options['disable-notices'], false) . ' value="1" type="checkbox" />
    If checked all admin notices (login screen, admin bar, notice box) that are displayed when maintenance mode is enabled will be hidden. Default: unchecked.</p></td>
    </tr>';
    
    echo '<tr valign="top">
    <th scope="row"><label for="compatibility-mode">Compatibility Mode</label></th>
    <td><p><input name="wf_mm[compatibility-mode]" id="compatibility-mode" ' . checked('1', $options['compatibility-mode'], false) . ' value="1" type="checkbox" />
    Enable this mode only if you\'re having problems with the plugin and maintenance mode wont show up on the site. Default: unchecked.</p></td>
    </tr>';

    echo '</tbody></table>';
    echo '<p class="submit"><input type="submit" value="Save Changes" class="button-primary" name="Submit" /></p>';
    echo '</form></div>';
  } // options_page
} // class wf_mm

// hook MM
add_action('init', array('wf_mm', 'init'));