Changeset 2299708
- Timestamp:
- 05/06/2020 11:19:17 PM (6 years ago)
- Location:
- token-access
- Files:
-
- 5 added
- 2 edited
-
tags/1.6.3 (added)
-
tags/1.6.3/access.php (added)
-
tags/1.6.3/admin.css (added)
-
tags/1.6.3/placeholder.php (added)
-
tags/1.6.3/readme.txt (added)
-
trunk/access.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
token-access/trunk/access.php
r2299353 r2299708 4 4 Plugin URI: http://www.fergusweb.net/software/token-access/ 5 5 Description: Limit access to the site to those with a cookie token. Visitors without the cookie see a customisable "coming soon" style of page. To remove protection, simply disable this plugin. 6 Version: 1. 56 Version: 1.6.3 7 7 Author: Anthony Ferguson 8 8 Author URI: http://www.fergusweb.net … … 10 10 11 11 12 13 add_action('init', create_function('', 'new TokenAccess();'), 1); 12 add_action('init', function() { 13 new TokenAccess(); 14 }, 1); 14 15 15 16 class TokenAccess { … … 54 55 */ 55 56 function check_token() { 56 if ( $_COOKIE[$this->opts['cookie_key']] == md5($_SERVER['REMOTE_ADDR'])) { return true; }57 if (@$_COOKIE[$this->opts['cookie_key']] == md5($_SERVER['REMOTE_ADDR'])) { return true; } 57 58 return false; 58 59 } … … 91 92 if (defined('WP_CLI')) return false; 92 93 // If admin or login, don't run this. 93 if (is_admin()) return;94 if (stristr($_SERVER['SCRIPT_FILENAME'], 'wp-login.php')) return ;94 if (is_admin()) return false; 95 if (stristr($_SERVER['SCRIPT_FILENAME'], 'wp-login.php')) return false; 95 96 // Handle any ?token commands 96 97 $this->token_handler(); 97 98 // Are we allowed access? 98 99 $access = $this->check_token(); 100 // If user logged in, allow access. 101 if (is_user_logged_in()) $access = true; 102 99 103 if ($access) { 100 104 add_action('wp_footer', array($this,'public_visual_cue')); … … 134 138 */ 135 139 function admin_menu() { 136 $hook = add_submenu_page('tools.php', 'Configure Token Access to Site', 'Token Access', 8, 'token-access', array($this,'settings_page'));140 $hook = add_submenu_page('tools.php', 'Configure Token Access to Site', 'Token Access', 'manage_options', 'token-access', array($this,'settings_page')); 137 141 add_action("load-$hook", array($this,'admin_enqueue')); 138 142 } -
token-access/trunk/readme.txt
r1289672 r2299708 3 3 Tags: private, cookie, access, public, whitelist, developer 4 4 Requires at least: 3.0 5 Tested up to: 4.46 Stable tag: 1. 45 Tested up to: 5.4.1 6 Stable tag: 1.6.3 7 7 8 8 Limit access to the site to those with a cookie token. Visitors without the cookie see a customisable "coming soon" style of page. … … 29 29 == Changelog == 30 30 31 = 1.6.3 = 32 * Updating versions & changelog 33 * Better wp-cli compatibility 34 31 35 = 1.4 = 32 36 * Overhaul for better use of WP functions, and more acceptable CSS rules.
Note: See TracChangeset
for help on using the changeset viewer.