WordPress.org

Plugin Directory

Changeset 634130


Ignore:
Timestamp:
12/04/12 18:41:39 (17 months ago)
Author:
husobj
Message:

Version 1.4

Location:
password-protected
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • password-protected/trunk/admin/admin.php

    r606705 r634130  
    1111        global $wp_version; 
    1212        add_action( 'admin_init', array( $this, 'privacy_settings' ) ); 
     13        add_action( 'load-options-reading.php', array( $this, 'add_reading_help_tabs' ), 20 ); 
    1314        add_action( 'admin_notices', array( $this, 'password_protected_admin_notices' ) ); 
    1415        add_filter( 'pre_update_option_password_protected_password', array( $this, 'pre_update_option_password_protected_password' ), 10, 2 ); 
     
    1920            $this->options_group = 'privacy'; 
    2021        } 
     22    } 
     23     
     24    /** 
     25     * Add Reading Help Tabs 
     26     */ 
     27    function add_reading_help_tabs() { 
     28        global $wp_version; 
     29        if ( version_compare( $wp_version, '3.3', '<' ) ) 
     30            return; 
     31        get_current_screen()->add_help_tab( array( 
     32            'id'      => 'PASSWORD_PROTECTED_READING', 
     33            'title'   => __( 'Password Protected', 'password-protected' ), 
     34            'content' => __( '<p><strong>Enabled Checkbox</strong><br />Turn on/off password protection.</p>', 'password-protected' ) 
     35                . __( '<p><strong>Allow RSS Feeds Checkbox</strong><br />RSS Feeds will be able to accessed even when the site is password proteced.</p>', 'password-protected' ) 
     36                . __( '<p><strong>Allow Administrators Checkbox</strong><br />Administrators will not need to enter a password to view the site (providing they are logged in of course). You will also need to enable this option if you want administrators to be able to preview the site in the Theme Customizer.</p>', 'password-protected' ) 
     37                . __( '<p><strong>Password Fields</strong><br />To set a new password, enter it into both fields. You cannot set an `empty` password. To disable password protection uncheck the Enabled checkbox.</p>', 'password-protected' ) 
     38        ) ); 
    2139    } 
    2240     
     
    5674        ); 
    5775        register_setting( $this->options_group, 'password_protected_status', 'intval' ); 
    58         register_setting( $this->options_group, 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) ); 
    5976        register_setting( $this->options_group, 'password_protected_feeds', 'intval' ); 
    60     } 
     77        register_setting( $this->options_group, 'password_protected_administrators', 'intval' ); 
     78        register_setting( $this->options_group, 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) ); 
     79    } 
    6180     
    6281    /** 
     
    95114    function password_protected_status_field() { 
    96115        echo '<input name="password_protected_status" id="password_protected_status" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_status' ), false ) . ' /> ' . __( 'Enabled', 'password-protected' ); 
    97         echo '<input name="password_protected_feeds" id="password_protected_feeds" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_feeds' ), false ) . ' style="margin-left: 20px;" /> ' . __( 'Allow Feeds', 'password-protected' ); 
     116        echo '<input name="password_protected_feeds" id="password_protected_feeds" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_feeds' ), false ) . ' style="margin-left: 20px;" /> ' . __( 'Allow RSS Feeds', 'password-protected' ); 
     117        echo '<input name="password_protected_administrators" id="password_protected_administrators" type="checkbox" value="1" ' . checked( 1, get_option( 'password_protected_administrators' ), false ) . ' style="margin-left: 20px;" /> ' . __( 'Allow Administrators', 'password-protected' ); 
    98118    } 
    99119     
     
    136156                echo '<div class="error"><p>' . __( 'You have enabled password protection but not yet set a password. Please set one below.', 'password-protected' ) . '</p></div>'; 
    137157            } 
     158            if ( current_user_can( 'manage_options' ) && (bool) get_option( 'password_protected_administrators' ) ) { 
     159                echo '<div class="error"><p>' . __( 'You have enabled password protection and allowed administrators - other users will still need to login to view the site.', 'password-protected' ) . '</p></div>'; 
     160            } 
    138161        } 
    139162    } 
  • password-protected/trunk/password-protected.php

    r630038 r634130  
    55Plugin URI: http://www.benhuson.co.uk/ 
    66Description: A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings. 
    7 Version: 1.3 
     7Version: 1.4 
    88Author: Ben Huson 
    99Author URI: http://www.benhuson.co.uk/ 
     
    4141class Password_Protected { 
    4242     
    43     var $version = '1.3'; 
     43    var $version = '1.4'; 
    4444    var $admin   = null; 
    4545    var $errors  = null; 
     
    5656        add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 ); 
    5757        add_filter( 'pre_option_password_protected_status', array( $this, 'allow_feeds' ) ); 
     58        add_filter( 'pre_option_password_protected_status', array( $this, 'allow_administrators' ) ); 
    5859        if ( is_admin() ) { 
    5960            include_once( dirname( __FILE__ ) . '/admin/admin.php' ); 
     
    7374     */ 
    7475    function is_active() { 
    75         if ( (bool) get_option( 'password_protected_status' ) ) 
     76        if ( (bool) get_option( 'password_protected_status' ) ) { 
     77            if ( ! defined( 'DONOTCACHEPAGE' ) ) 
     78                define( 'DONOTCACHEPAGE', true ); 
    7679            return true; 
     80        } 
    7781        return false; 
    7882    } 
     
    106110    function allow_feeds( $bool ) { 
    107111        if ( is_feed() && (bool) get_option( 'password_protected_feeds' ) ) 
     112            return 0; 
     113        return $bool; 
     114    } 
     115     
     116    /** 
     117     * Allow Administrators 
     118     */ 
     119    function allow_administrators( $bool ) { 
     120        if ( ! is_admin() && current_user_can( 'manage_options' ) && (bool) get_option( 'password_protected_administrators' ) ) 
    108121            return 0; 
    109122        return $bool; 
  • password-protected/trunk/readme.txt

    r606707 r634130  
    44Tags: password, protect, password protect, login 
    55Requires at least: 3.0 
    6 Tested up to: 3.4.2 
    7 Stable tag: 1.3 
     6Tested up to: 3.5 
     7Stable tag: 1.4 
    88License: GPLv2 or later 
    99 
    10 A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings. 
     10A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress settings. 
    1111 
    1212== Description == 
    1313 
    14 A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings. 
     14A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress settings. 
    1515 
    1616Features include: 
    1717 
    1818* Password protect your WordPress site with a single password. 
    19 * Integrates seamlessly into your WordPress privacy settings. 
     19* Option to allow access to feeds. 
     20* Option to allow administrators access without entering password. 
     21* Integrates seamlessly into your WordPress reading settings (or privacy settings prior to WordPress 3.5). 
    2022* Works with Mark Jaquith's [Login Logo](http://wordpress.org/extend/plugins/login-logo/) plugin. 
    2123             
     
    3537 
    3638= How can I change the Wordpress logo to a different image? = 
    37  
    3839Install and configure the [Login Logo](http://wordpress.org/extend/plugins/login-logo/) plugin by Mark Jaquith. This will change the logo on your password entry page AND also your admin login page. 
    3940 
    4041= How can I enable feeds while the site is password protected? = 
    41  
    4242In the settings, check the 'Allow Feeds' checkbox. 
    4343 
     44= Can I prevent administrators having to enter password? = 
     45In the settings, check the 'Allow Administrators' checkbox. 
     46 
     47= I cannot preview my changes in the Theme Customizer = 
     48You must be an administrator (have the manage_options capability) and in the Password Protected settings, check the 'Allow Administrators' checkbox. 
     49 
    4450= How can I log out? = 
    45  
    4651Just add a "password-protected=logout" query to your URL. 
    4752eg. http://www.example.com/?password-protected=logout 
    4853 
    4954= Where can I report bugs and issues? = 
    50  
    5155Please log issues and bugs on the plugin's [GitHub page](https://github.com/benhuson/password-protected/issues). 
    5256You can also submit suggested enhancements if you like. 
    5357 
    5458= How can I contribute? = 
    55  
    5659If you can, please [fork the code](https://github.com/benhuson/password-protected) and submit a pull request via GitHub. If you're not comfortable using Git, then please just submit it to the issues link above. 
    5760 
     
    5962 
    60631. Login page perfectly mimicks the WordPress login. 
    61 2. Integrates seamlessly into your WordPress privacy settings. 
     642. Integrates seamlessly into your WordPress reading settings in WordPress 3.5+. 
     653. Integrates into your WordPress privacy settings in earlier versions of WordPress. 
    6266 
    6367== Changelog == 
    6468 
    6569= 1.3 = 
     70* Add option to allow administrators to use the site without logging in. 
     71* Use DONOTCACHEPAGE to try to prevent some caching issues. 
     72* Updated login screen styling for WordPress 3.5 compatibility. 
     73* Options are now on the 'Reading' settings page in WordPress 3.5 
     74* Added a contextual help tab for WordPress 3.3+. 
    6675 
     76= 1.3 = 
    6777* Added checkbox to allow access to feeds when protection is enabled. 
    6878* Prepare for WordPress 3.5 Settings API changes. 
     
    7383 
    7484= 1.2.2 = 
    75  
    7685* Escape 'redirect_to' attribute. Props A. Alagha. 
    7786* Show login error messages. 
    7887 
    7988= 1.2.1 = 
    80  
    8189* Only disable feeds when protection is active. 
    8290* Added a "How to log out?" FAQ. 
    8391 
    8492= 1.2 = 
    85  
    8693* Use cookies instead of sessions. 
    87  
    8894= 1.1 = 
    8995 
    9096* Encrypt passwords in database. 
    91  
    9297= 1.0 = 
    9398 
     
    95100 
    96101== Upgrade Notice == 
     102 
     103= 1.4 = 
     104Administrators can use the site without logging in. WordPress 3.5 compatible. 
    97105 
    98106= 1.3 = 
  • password-protected/trunk/theme/login.php

    r606705 r634130  
    7979 
    8080</head> 
    81 <body class="login login-password-protected"> 
     81<body class="login login-password-protected login-action-password-protected-login wp-core-ui"> 
    8282 
    8383<div id="login"> 
     
    119119        --> 
    120120        <p class="submit"> 
    121             <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e( 'Log In', 'password-protected' ); ?>" tabindex="100" /> 
     121            <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In', 'password-protected' ); ?>" tabindex="100" /> 
    122122            <input type="hidden" name="testcookie" value="1" /> 
    123123            <input type="hidden" name="password-protected" value="login" /> 
Note: See TracChangeset for help on using the changeset viewer.