Changeset 1032483
- Timestamp:
- 11/25/2014 12:42:46 PM (11 years ago)
- Location:
- site-private/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
site-private.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
site-private/trunk/readme.txt
r1026036 r1032483 1 1 === Plugin Name === 2 2 Contributors: GZep 3 Donate link: http://gzep.ru/ 3 Donate link: http://gzep.ru/donate/ 4 4 Tags: private, authorize 5 5 Requires at least: 4.0 6 Tested up to: 4.0 6 Tested up to: 4.0.1 7 7 Stable tag: trunk 8 8 License: MIT -
site-private/trunk/site-private.php
r1026036 r1032483 4 4 Plugin URI: http://gzep.ru/site-private-wordpress-plugin/ 5 5 Description: Simplest plugin that redirects unauthorized users to login page. 6 Version: 1. 06 Version: 1.1 7 7 Author: Gaiaz Iusipov 8 8 Author URI: http://gzep.ru 9 9 */ 10 10 11 defined('ABSPATH') or exit ();11 defined('ABSPATH') or exit; 12 12 13 class SitePrivate 13 function siteprivate_redirect() 14 14 { 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(); 42 20 } 43 21 } 44 22 45 add_action('plugins_loaded', ' SitePrivate::getInstance');23 add_action('plugins_loaded', 'siteprivate_redirect');
Note: See TracChangeset
for help on using the changeset viewer.