Version Description
- First Release. If you spot any bugs or issues please log them here.
Download this release
Release Info
Developer | husobj |
Plugin | Password Protected |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- admin/admin.php +100 -0
- password-protected.php +136 -0
- readme.txt +53 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- theme/login.php +136 -0
admin/admin.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Password_Protected_Admin {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Constructor
|
7 |
+
*/
|
8 |
+
function Password_Protected_Admin() {
|
9 |
+
add_action( 'admin_init', array( $this, 'privacy_settings' ) );
|
10 |
+
add_action( 'admin_notices', array( $this, 'password_protected_admin_notices' ) );
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Settings API
|
15 |
+
*/
|
16 |
+
function privacy_settings() {
|
17 |
+
add_settings_section(
|
18 |
+
'password_protected',
|
19 |
+
'Password Protected Settings',
|
20 |
+
array( $this, 'password_protected_settings_section' ),
|
21 |
+
'privacy'
|
22 |
+
);
|
23 |
+
add_settings_field(
|
24 |
+
'password_protected_status',
|
25 |
+
'Password Protection Status',
|
26 |
+
array( $this, 'password_protected_status_field' ),
|
27 |
+
'privacy',
|
28 |
+
'password_protected'
|
29 |
+
);
|
30 |
+
add_settings_field(
|
31 |
+
'password_protected_password',
|
32 |
+
'New Password',
|
33 |
+
array( $this, 'password_protected_password_field' ),
|
34 |
+
'privacy',
|
35 |
+
'password_protected'
|
36 |
+
);
|
37 |
+
register_setting( 'privacy', 'password_protected_status', 'intval' );
|
38 |
+
register_setting( 'privacy', 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Sanitize Password Field Input
|
43 |
+
*/
|
44 |
+
function sanitize_password_protected_password( $val ) {
|
45 |
+
$old_val = get_option( 'password_protected_password' );
|
46 |
+
if ( empty( $val['new'] ) ) {
|
47 |
+
return $old_val;
|
48 |
+
} elseif ( empty( $val['confirm'] ) ) {
|
49 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. When setting a new password please enter it in both fields.', 'password_protected' ) );
|
50 |
+
return $old_val;
|
51 |
+
} elseif ( $val['new'] != $val['confirm'] ) {
|
52 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password not saved. Password fields did not match.', 'password_protected' ) );
|
53 |
+
return $old_val;
|
54 |
+
} elseif ( $val['new'] == $val['confirm'] ) {
|
55 |
+
add_settings_error( 'password_protected_password', 'password_protected_password', __( 'New password saved.', 'password_protected' ), 'updated' );
|
56 |
+
return $val['new'];
|
57 |
+
}
|
58 |
+
return get_option( 'password_protected_password' );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Password Protected Section
|
63 |
+
*/
|
64 |
+
function password_protected_settings_section() {
|
65 |
+
echo '<p>' . __( 'Password protect your web site. Users will be asked to enter a password to view the site.', 'password_protected' ) . '</p>';
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Password Protection Status Field
|
70 |
+
*/
|
71 |
+
function password_protected_status_field() {
|
72 |
+
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' );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Password Field
|
77 |
+
*/
|
78 |
+
function password_protected_password_field() {
|
79 |
+
echo '<input type="password" name="password_protected_password[new]" id="password_protected_password_new" size="16" value="" autocomplete="off"> <span class="description">' . __( 'If you would like to change the password type a new one. Otherwise leave this blank.', 'password_protected' ) . '</span><br>
|
80 |
+
<input type="password" name="password_protected_password[confirm]" id="password_protected_password_confirm" size="16" value="" autocomplete="off"> <span class="description">' . __( 'Type your new password again.', 'password_protected' ) . '</span>';
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Password Admin Notice
|
85 |
+
* Warns the user if they have enabled password protection but not entered a password
|
86 |
+
*/
|
87 |
+
function password_protected_admin_notices(){
|
88 |
+
global $current_screen;
|
89 |
+
if ( $current_screen->id == 'options-privacy' ) {
|
90 |
+
$status = get_option( 'password_protected_status' );
|
91 |
+
$pwd = get_option( 'password_protected_password' );
|
92 |
+
if ( (bool) $status && empty( $pwd ) ) {
|
93 |
+
echo '<div class="error"><p>' . __( 'You have enabled password protection but not yet set a password. Please set one below.', 'password_protected' ) . '</p></div>';
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
?>
|
password-protected.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Password Protected
|
5 |
+
Plugin URI: http://www.benhuson.co.uk/
|
6 |
+
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.0
|
8 |
+
Author: Ben Huson
|
9 |
+
Author URI: http://www.benhuson.co.uk/
|
10 |
+
License: GPLv2
|
11 |
+
*/
|
12 |
+
|
13 |
+
/*
|
14 |
+
Copyright 2012 Ben Huson (email : ben@thewhiteroom.net)
|
15 |
+
|
16 |
+
This program is free software; you can redistribute it and/or modify
|
17 |
+
it under the terms of the GNU General Public License, version 2, as
|
18 |
+
published by the Free Software Foundation.
|
19 |
+
|
20 |
+
This program is distributed in the hope that it will be useful,
|
21 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
GNU General Public License for more details.
|
24 |
+
|
25 |
+
You should have received a copy of the GNU General Public License
|
26 |
+
along with this program; if not, write to the Free Software
|
27 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
+
*/
|
29 |
+
|
30 |
+
// Start session if not already started...
|
31 |
+
if ( session_id() == '' )
|
32 |
+
session_start();
|
33 |
+
|
34 |
+
// Setup Password Protected
|
35 |
+
global $Password_Protected;
|
36 |
+
$Password_Protected = new Password_Protected();
|
37 |
+
|
38 |
+
class Password_Protected {
|
39 |
+
|
40 |
+
var $admin = null;
|
41 |
+
var $errors = null;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructor
|
45 |
+
*/
|
46 |
+
function Password_Protected() {
|
47 |
+
$this->errors = new WP_Error();
|
48 |
+
add_action( 'init', array( $this, 'maybe_process_login' ), 1 );
|
49 |
+
add_action( 'template_redirect', array( $this, 'maybe_show_login' ), 1 );
|
50 |
+
$this->disable_feeds();
|
51 |
+
if ( is_admin() ) {
|
52 |
+
include_once( dirname( __FILE__ ) . '/admin/admin.php' );
|
53 |
+
$this->admin = new Password_Protected_Admin();
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Is Active?
|
59 |
+
*/
|
60 |
+
function is_active() {
|
61 |
+
if ( (bool) get_option( 'password_protected_status' ) )
|
62 |
+
return true;
|
63 |
+
return false;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Disable Feeds
|
68 |
+
*/
|
69 |
+
function disable_feeds() {
|
70 |
+
add_action( 'do_feed', array( $this, 'disable_feed' ), 1 );
|
71 |
+
add_action( 'do_feed_rdf', array( $this, 'disable_feed' ), 1 );
|
72 |
+
add_action( 'do_feed_rss', array( $this, 'disable_feed' ), 1 );
|
73 |
+
add_action( 'do_feed_rss2', array( $this, 'disable_feed' ), 1 );
|
74 |
+
add_action( 'do_feed_atom', array( $this, 'disable_feed' ), 1 );
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Disable Feed
|
79 |
+
* @todo Make Translatable
|
80 |
+
*/
|
81 |
+
function disable_feed() {
|
82 |
+
wp_die( __( 'Feeds are not available for this site. Please visit the <a href="'. get_bloginfo( 'url' ) .'">website</a>.' ) );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Maybe Process Login
|
87 |
+
*/
|
88 |
+
function maybe_process_login() {
|
89 |
+
if ( $this->is_active() && isset( $_REQUEST['password_protected_pwd'] ) ) {
|
90 |
+
$password_protected_pwd = $_REQUEST['password_protected_pwd'];
|
91 |
+
$pwd = get_option( 'password_protected_password' );
|
92 |
+
// If correct password...
|
93 |
+
if ( $password_protected_pwd == $pwd && $pwd != '' ) {
|
94 |
+
$_SESSION[$this->get_site_id() . '_password_protected_auth'] = 1;
|
95 |
+
} else {
|
96 |
+
// ... otherwise incorrect password
|
97 |
+
$this->errors->add( 'incorrect_password', 'Incorrect Password' );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// Log out
|
102 |
+
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'logout' ) {
|
103 |
+
$_SESSION[$this->get_site_id() . '_password_protected_auth'] = 0;
|
104 |
+
$this->errors = new WP_Error();
|
105 |
+
$this->errors->add( 'logged_out', __( 'You are now logged out.' ), 'message' );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Maybe Show Login
|
111 |
+
*/
|
112 |
+
function maybe_show_login() {
|
113 |
+
// Don't show login if not enabled
|
114 |
+
if ( ! $this->is_active() )
|
115 |
+
return;
|
116 |
+
|
117 |
+
// Logged in
|
118 |
+
if ( isset( $_SESSION[$this->get_site_id() . '_password_protected_auth'] ) && $_SESSION[$this->get_site_id() . '_password_protected_auth'] == 1 )
|
119 |
+
return;
|
120 |
+
|
121 |
+
// Show login form
|
122 |
+
include( dirname( __FILE__ ) . '/theme/login.php' );
|
123 |
+
exit();
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get Site ID
|
128 |
+
*/
|
129 |
+
function get_site_id() {
|
130 |
+
global $blog_id;
|
131 |
+
return apply_filters( 'password_protected_blog_id', $blog_id );
|
132 |
+
}
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Password Protected ===
|
2 |
+
Contributors: husobj
|
3 |
+
Donate link: http://www.benhuson.co.uk/donate/
|
4 |
+
Tags: password, protect, password protect, login
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.3.1
|
7 |
+
Stable tag: 1.0
|
8 |
+
|
9 |
+
A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
A very simple way to quickly password protect your WordPress site with a single password. Integrates seamlessly into your WordPress privacy settings.
|
14 |
+
|
15 |
+
Features include:
|
16 |
+
|
17 |
+
* Password protect your WordPress site with a single password.
|
18 |
+
* Integrates seamlessly into your WordPress privacy settings.
|
19 |
+
* Works with Mark Jaquith's [Login Logo](http://wordpress.org/extend/plugins/login-logo/) plugin.
|
20 |
+
|
21 |
+
== Installation ==
|
22 |
+
|
23 |
+
To install and configure this plugin...
|
24 |
+
|
25 |
+
1. Upload or install the plugin through your WordPress admin.
|
26 |
+
2. Activate the plugin via the 'Plugins' admin menu.
|
27 |
+
3. Configuration the password in your WordPress Privacy settings.
|
28 |
+
|
29 |
+
== Frequently Asked Questions ==
|
30 |
+
|
31 |
+
= How can I change the Wordpress logo to a different image? =
|
32 |
+
|
33 |
+
Install 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.
|
34 |
+
|
35 |
+
= Where can I report bugs and issues? =
|
36 |
+
|
37 |
+
Please log issues and bugs on the plugin's [GitHub page](https://github.com/benhuson/password-protected/issues).
|
38 |
+
You can also submit suggested enhancements if you like.
|
39 |
+
|
40 |
+
= How can I contribute? =
|
41 |
+
|
42 |
+
If 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.
|
43 |
+
|
44 |
+
== Screenshots ==
|
45 |
+
|
46 |
+
1. Login page perfectly mimicks the WordPress login.
|
47 |
+
2. Integrates seamlessly into your WordPress privacy settings.
|
48 |
+
|
49 |
+
== Changelog ==
|
50 |
+
|
51 |
+
= 1.0 =
|
52 |
+
|
53 |
+
* First Release. If you spot any bugs or issues please [log them here](https://github.com/benhuson/password-protected/issues).
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
theme/login.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Based roughly on wp-login.php @revision 19414
|
5 |
+
* http://core.trac.wordpress.org/browser/trunk/wp-login.php?rev=19414
|
6 |
+
*/
|
7 |
+
|
8 |
+
global $Password_Protected, $error, $is_iphone;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* WP Shake JS
|
12 |
+
*/
|
13 |
+
if ( ! function_exists( 'wp_shake_js' ) ) {
|
14 |
+
function wp_shake_js() {
|
15 |
+
global $is_iphone;
|
16 |
+
if ( $is_iphone )
|
17 |
+
return;
|
18 |
+
?>
|
19 |
+
<script type="text/javascript">
|
20 |
+
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
21 |
+
function s(id,pos){g(id).left=pos+'px';}
|
22 |
+
function g(id){return document.getElementById(id).style;}
|
23 |
+
function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
|
24 |
+
addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
|
25 |
+
</script>
|
26 |
+
<?php
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
nocache_headers();
|
31 |
+
header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );
|
32 |
+
|
33 |
+
// Set a cookie now to see if they are supported by the browser.
|
34 |
+
setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN );
|
35 |
+
if ( SITECOOKIEPATH != COOKIEPATH )
|
36 |
+
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN );
|
37 |
+
|
38 |
+
// If cookies are disabled we can't log in even with a valid password.
|
39 |
+
if ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )
|
40 |
+
$Password_Protected->errors->add( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress." ) );
|
41 |
+
|
42 |
+
// Shake it!
|
43 |
+
$shake_error_codes = array( 'empty_password', 'incorrect_password' );
|
44 |
+
if ( $Password_Protected->errors->get_error_code() && in_array( $Password_Protected->errors->get_error_code(), $shake_error_codes ) )
|
45 |
+
add_action( 'password_protected_login_head', 'wp_shake_js', 12 );
|
46 |
+
|
47 |
+
// Add support for Mark Jaquith's Login Logo plugin
|
48 |
+
// http://wordpress.org/extend/plugins/login-logo/
|
49 |
+
if ( class_exists( 'CWS_Login_Logo_Plugin' ) )
|
50 |
+
add_action( 'password_protected_login_head', array( new CWS_Login_Logo_Plugin, 'login_head' ) );
|
51 |
+
|
52 |
+
?>
|
53 |
+
<!DOCTYPE html>
|
54 |
+
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
|
55 |
+
<head>
|
56 |
+
|
57 |
+
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
|
58 |
+
<title><?php echo apply_filters( 'password_protected_wp_title', get_bloginfo( 'name' ) ); ?></title>
|
59 |
+
|
60 |
+
<?php
|
61 |
+
wp_admin_css( 'wp-admin', true );
|
62 |
+
wp_admin_css( 'colors-fresh', true );
|
63 |
+
|
64 |
+
if ( $is_iphone ) {
|
65 |
+
?>
|
66 |
+
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
|
67 |
+
<style type="text/css" media="screen">
|
68 |
+
.login form, .login .message, #login_error { margin-left: 0px; }
|
69 |
+
.login #nav, .login #backtoblog { margin-left: 8px; }
|
70 |
+
.login h1 a { width: auto; }
|
71 |
+
#login { padding: 20px 0; }
|
72 |
+
</style>
|
73 |
+
<?php
|
74 |
+
}
|
75 |
+
|
76 |
+
do_action( 'login_enqueue_scripts' );
|
77 |
+
do_action( 'password_protected_login_head' );
|
78 |
+
?>
|
79 |
+
|
80 |
+
</head>
|
81 |
+
<body class="login login-password-protected">
|
82 |
+
|
83 |
+
<div id="login">
|
84 |
+
<h1><a href="<?php echo esc_url( apply_filters( 'password_proteced_login_headerurl', home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( apply_filters( 'password_protected_login_headertitle', get_bloginfo( 'name' ) ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
85 |
+
<?php
|
86 |
+
|
87 |
+
// Add message
|
88 |
+
$message = apply_filters( 'password_protected_login_message', '' );
|
89 |
+
if ( ! empty( $message ) ) echo $message . "\n";
|
90 |
+
|
91 |
+
if ( $Password_Protected->errors->get_error_code() ) {
|
92 |
+
$errors = '';
|
93 |
+
$messages = '';
|
94 |
+
foreach ( $Password_Protected->errors->get_error_codes() as $code ) {
|
95 |
+
$severity = $Password_Protected->errors->get_error_data( $code );
|
96 |
+
foreach ( $Password_Protected->errors->get_error_messages( $code ) as $error ) {
|
97 |
+
if ( 'message' == $severity )
|
98 |
+
$messages .= ' ' . $error . "<br />\n";
|
99 |
+
else
|
100 |
+
$errors .= ' ' . $error . "<br />\n";
|
101 |
+
}
|
102 |
+
}
|
103 |
+
if ( ! empty( $errors ) )
|
104 |
+
echo '<div id="login_error">' . apply_filters( 'password_protected_login_errors', $errors ) . "</div>\n";
|
105 |
+
if ( ! empty( $messages ) )
|
106 |
+
echo '<p class="message">' . apply_filters( 'password_protected_login_messages', $messages ) . "</p>\n";
|
107 |
+
}
|
108 |
+
?>
|
109 |
+
|
110 |
+
<form name="loginform" id="loginform" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="post">
|
111 |
+
<p>
|
112 |
+
<label for="password_protected_pass"><?php _e( 'Password' ) ?><br />
|
113 |
+
<input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20" /></label>
|
114 |
+
</p>
|
115 |
+
<!--
|
116 |
+
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( ! empty( $_POST['rememberme'] ) ); ?> /> <?php esc_attr_e( 'Remember Me' ); ?></label></p>
|
117 |
+
-->
|
118 |
+
<p class="submit">
|
119 |
+
<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e( 'Log In' ); ?>" tabindex="100" />
|
120 |
+
<input type="hidden" name="testcookie" value="1" />
|
121 |
+
</p>
|
122 |
+
</form>
|
123 |
+
|
124 |
+
</div>
|
125 |
+
|
126 |
+
<script type="text/javascript">
|
127 |
+
try{document.getElementById('password_protected_pass').focus();}catch(e){}
|
128 |
+
if(typeof wpOnload=='function')wpOnload();
|
129 |
+
</script>
|
130 |
+
|
131 |
+
<?php do_action( 'login_footer' ); ?>
|
132 |
+
|
133 |
+
<div class="clear"></div>
|
134 |
+
|
135 |
+
</body>
|
136 |
+
</html>
|