Plugin Directory

Changeset 2299708


Ignore:
Timestamp:
05/06/2020 11:19:17 PM (6 years ago)
Author:
ajferg
Message:

Update to version 1.6.3

Location:
token-access
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • token-access/trunk/access.php

    r2299353 r2299708  
    44Plugin URI:     http://www.fergusweb.net/software/token-access/
    55Description:    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.5
     6Version:        1.6.3
    77Author:         Anthony Ferguson
    88Author URI:     http://www.fergusweb.net
     
    1010
    1111
    12 
    13 add_action('init', create_function('', 'new TokenAccess();'), 1);
     12add_action('init', function() {
     13    new TokenAccess();
     14}, 1);
    1415
    1516class TokenAccess {
     
    5455     */
    5556    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; }
    5758        return false;
    5859    }
     
    9192        if (defined('WP_CLI'))  return false;
    9293        // 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;
    9596        // Handle any ?token commands
    9697        $this->token_handler();
    9798        // Are we allowed access?
    9899        $access = $this->check_token();
     100        // If user logged in, allow access.
     101        if (is_user_logged_in())    $access = true;
     102
    99103        if ($access) {
    100104            add_action('wp_footer', array($this,'public_visual_cue'));
     
    134138     */
    135139    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'));
    137141        add_action("load-$hook", array($this,'admin_enqueue'));
    138142    }
  • token-access/trunk/readme.txt

    r1289672 r2299708  
    33Tags:               private, cookie, access, public, whitelist, developer
    44Requires at least:  3.0
    5 Tested up to:       4.4
    6 Stable tag:         1.4
     5Tested up to:       5.4.1
     6Stable tag:         1.6.3
    77
    88Limit access to the site to those with a cookie token.  Visitors without the cookie see a customisable "coming soon" style of page.
     
    2929== Changelog ==
    3030
     31= 1.6.3 =
     32* Updating versions & changelog
     33* Better wp-cli compatibility
     34
    3135= 1.4 =
    3236* Overhaul for better use of WP functions, and more acceptable CSS rules.
Note: See TracChangeset for help on using the changeset viewer.