WordPress.org

Plugin Directory

Changeset 1035370


Ignore:
Timestamp:
11/30/14 10:40:59 (3 years ago)
Author:
wet
Message:

wet_maintenance 2.3

Location:
wet-maintenance/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wet-maintenance/trunk/readme.txt

    r822883 r1035370  
    22Contributors: wet 
    33Tags: admin, maintenance, under construction, development, 503, seo, offline 
    4 Requires at least: 2.5 
    5 Tested up to: 3.8.1-alpha 
     4Requires at least: 3.8 
     5Tested up to: 4.1 
    66Stable tag: trunk 
    77 
     
    2525== Changelog == 
    2626 
     27= 2.3 = 
     28 
     291. Compatibility check with WordPress 4.1-beta. 
     301. A bit of style. 
     31 
    2732= 2.2 = 
    2833 
  • wet-maintenance/trunk/wet_maintenance.php

    r822883 r1035370  
    55Description: Puts the site into maintenance mode by sending a '503 Service Unavailable' status to all unauthenticated clients. 
    66Author: Robert Wetzlmayr 
    7 Version: 2.2 
     7Version: 2.3 
    88Author URI: http://wetzlmayr.com/ 
    99License: GPL 2.0, @see http://www.gnu.org/licenses/gpl-2.0.html 
    1010*/ 
    1111 
    12 if(!function_exists('wet_maintenance_header')): 
    13 function wet_maintenance_header($status_header, $header, $text, $protocol) { 
    14     if ( !is_user_logged_in() ) { 
    15         return "$protocol 503 Service Unavailable"; 
    16     } 
    17 } 
     12if (!function_exists('wet_maintenance_header')): 
     13    function wet_maintenance_header($status_header, $header, $text, $protocol) 
     14    { 
     15        if (!is_user_logged_in()) { 
     16            return "$protocol 503 Service Unavailable"; 
     17        } 
     18    } 
    1819endif; 
    1920 
    20 if(!function_exists('wet_maintenance_content')): 
    21 function wet_maintenance_content() { 
    22     if ( !is_user_logged_in() ) { 
    23         $page = <<<EOT 
     21if (!function_exists('wet_maintenance_content')): 
     22    function wet_maintenance_content() 
     23    { 
     24        if (!is_user_logged_in()) { 
     25            $page = <<<EOT 
    2426<!DOCTYPE html> 
    2527<html> 
     
    2830<style> 
    2931body { 
    30     font-family: Verdana, Arial, Helvetica, sans-serif; 
    31     background-color: #F7FCFE; 
     32    background-color: #e0dcdc; 
     33    color: #444; 
     34    font-family: "Open Sans",sans-serif; 
     35    font-size: 13px; 
     36    line-height: 1.4em; 
     37} 
     38body > div { 
     39    background-color: #f8f8f8; 
     40    border: 1px solid #ddd; 
     41    border-radius: 5px; 
     42    box-shadow: 0 0 5px #888; 
     43    margin: 3em auto; 
     44    padding: 2em; 
     45    text-align: center; 
     46    width: 20%; 
     47    min-width: 20em; 
    3248} 
    3349</style> 
    3450</head> 
    3551<body> 
     52<div> 
    3653<h1>Service unavailable.</h1> 
    3754<p>Please check back later&hellip;</p> 
     55</div> 
    3856</body> 
    3957</html> 
    4058EOT; 
    41         die($page); 
    42     } 
    43 } 
     59            die($page); 
     60        } 
     61    } 
    4462endif; 
    4563 
    46 if(!function_exists('wet_maintenance_feed')): 
    47 function wet_maintenance_feed() { 
    48     if ( !is_user_logged_in() ) { 
    49         die('<?xml version="1.0" encoding="UTF-8"?>'. 
    50             '<status>Service unavailable.</status>'); 
    51     } 
    52 } 
     64if (!function_exists('wet_maintenance_feed')): 
     65    function wet_maintenance_feed() 
     66    { 
     67        if (!is_user_logged_in()) { 
     68            die('<?xml version="1.0" encoding="UTF-8"?>' . 
     69                '<status>Service unavailable.</status>'); 
     70        } 
     71    } 
    5372endif; 
    5473 
    55 if(!function_exists('wet_add_feed_actions')): 
    56 function wet_add_feed_actions() { 
    57     $feeds = array ('rdf', 'rss', 'rss2', 'atom'); 
    58     foreach ($feeds as $feed) { 
    59         add_action('do_feed_'.$feed, 'wet_maintenance_feed', 1, 1); 
    60     } 
    61 } 
     74if (!function_exists('wet_add_feed_actions')): 
     75    function wet_add_feed_actions() 
     76    { 
     77        $feeds = array('rdf', 'rss', 'rss2', 'atom'); 
     78        foreach ($feeds as $feed) { 
     79            add_action('do_feed_' . $feed, 'wet_maintenance_feed', 1, 1); 
     80        } 
     81    } 
    6282endif; 
    6383 
    64 if (function_exists('add_filter') ): 
    65 add_filter('status_header', 'wet_maintenance_header', 10, 4); 
    66 add_action('get_header', 'wet_maintenance_content'); 
    67 wet_add_feed_actions(); 
     84if (function_exists('add_filter')): 
     85    add_filter('status_header', 'wet_maintenance_header', 10, 4); 
     86    add_action('get_header', 'wet_maintenance_content'); 
     87    wet_add_feed_actions(); 
    6888else: 
    6989// Prevent direct invocation by user agents. 
    70 die('Get off my lawn!'); 
     90    die('Get off my lawn!'); 
    7191endif; 
Note: See TracChangeset for help on using the changeset viewer.