Plugin Directory

Changeset 1032483


Ignore:
Timestamp:
11/25/2014 12:42:46 PM (11 years ago)
Author:
GZep
Message:

Reduced code size

Location:
site-private/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • site-private/trunk/readme.txt

    r1026036 r1032483  
    11=== Plugin Name ===
    22Contributors: GZep
    3 Donate link: http://gzep.ru/
     3Donate link: http://gzep.ru/donate/
    44Tags: private, authorize
    55Requires at least: 4.0
    6 Tested up to: 4.0
     6Tested up to: 4.0.1
    77Stable tag: trunk
    88License: MIT
  • site-private/trunk/site-private.php

    r1026036 r1032483  
    44Plugin URI: http://gzep.ru/site-private-wordpress-plugin/
    55Description: Simplest plugin that redirects unauthorized users to login page.
    6 Version: 1.0
     6Version: 1.1
    77Author: Gaiaz Iusipov
    88Author URI: http://gzep.ru
    99*/
    1010
    11 defined('ABSPATH') or exit();
     11defined('ABSPATH') or exit;
    1212
    13 class SitePrivate
     13function siteprivate_redirect()
    1414{
    15     private static $instance;
    16 
    17     private function __construct()
    18     {
    19         add_action('template_redirect', array($this, 'actionRedirect'));
    20     }
    21 
    22     private function __clone()
    23     {
    24     }
    25 
    26     public static function getInstance()
    27     {
    28         if (null === self::$instance) {
    29             self::$instance = new self;
    30         }
    31         return self::$instance;
    32     }
    33 
    34     public function actionRedirect()
    35     {
    36         global $pagenow;
    37         if ('wp-login.php' !== $pagenow
    38             && !is_user_logged_in()
    39             && !is_user_member_of_blog()) {
    40             auth_redirect();
    41         }
     15    global $pagenow;
     16    if ('wp-login.php' !== $pagenow
     17        && !is_user_logged_in()
     18        && !is_user_member_of_blog()) {
     19        auth_redirect();
    4220    }
    4321}
    4422
    45 add_action('plugins_loaded', 'SitePrivate::getInstance');
     23add_action('plugins_loaded', 'siteprivate_redirect');
Note: See TracChangeset for help on using the changeset viewer.