PluginProbe
Admin and Site Enhancements (ASE) / 7.9.7
Admin and Site Enhancements (ASE) v7.9.7
9.1.1 9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 All 273 releases
admin-site-enhancements / includes / password-protected-login.php
password-protected-login.php
103 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 global $error, $password_protected_errors, $is_iphone;
4 $options = get_option( ASENHA_SLUG_U, array() );
5 $password_field_label = __( 'Password', 'admin-site-enhancements' );
6 $button_label = __( 'View Content', 'admin-site-enhancements' );
7 /**
8 * WP Shake JS
9 */
10 if ( !function_exists( 'wp_shake_js' ) ) {
11 function wp_shake_js() {
12 if ( isset( $is_iphone ) ) {
13 if ( $is_iphone ) {
14 return;
15 }
16 }
17 ?>
18 <script>
19 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();}}};
20 function s(id,pos){g(id).left=pos+'px';}
21 function g(id){return document.getElementById(id).style;}
22 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){}}}
23 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);});
24 </script>
25 <?php
26 }
27
28 }
29 nocache_headers();
30 header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );
31 // Maybe show error message above login form
32 $shake_error_codes = array('empty_password', 'incorrect_password');
33 if ( $password_protected_errors->get_error_code() && in_array( $password_protected_errors->get_error_code(), $shake_error_codes ) ) {
34 add_action( 'asenha_password_protection_login_head', 'wp_shake_js', 12 );
35 }
36 ?>
37 <!DOCTYPE html>
38 <html xmlns="http://www.w3.org/1999/xhtml" <?php
39 language_attributes();
40 ?>>
41 <head>
42 <meta http-equiv="Content-Type" content="<?php
43 bloginfo( 'html_type' );
44 ?>; charset=<?php
45 bloginfo( 'charset' );
46 ?>" />
47 <meta name="viewport" content="width=device-width" />
48 <meta name="robots" content="noindex">
49 <title><?php
50 bloginfo( 'name' );
51 ?></title>
52 <?php
53 wp_admin_css( 'login', true );
54 do_action( 'asenha_password_protection_login_head' );
55 ?>
56 <style type="text/css" id="protected-page-login-style">
57 #login_error {
58 box-sizing: border-box;
59 width: 287px;
60 border-left: 4px solid #d63638;
61 padding: 12px;
62 margin-top: 20px;
63 margin-bottom: 0;
64 background-color: #fff;
65 box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
66 word-wrap: break-word;
67 color: #3c434a;
68 }
69 </style>
70 <?php
71 ?>
72 </head>
73 <body class="login protected-page-login wp-core-ui">
74
75 <div id="login">
76 <?php
77 do_action( 'asenha_password_protection_error_messages' );
78 ?>
79 <form name="loginform" id="loginform" action="<?php
80 echo esc_url( add_query_arg( 'protected-page', 'view', home_url( '/' ) ) );
81 ?>" method="post">
82 <label for="protected_page_pwd"><?php
83 echo esc_html( $password_field_label );
84 ?></label>
85 <input type="password" name="protected_page_pwd" id="protected_page_pwd" class="input" value="" size="20" />
86 <p class="submit">
87 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php
88 echo esc_attr( $button_label );
89 ?>" />
90 <input type="hidden" name="protected-page" value="view" />
91 <input type="hidden" name="source" value="<?php
92 echo esc_attr( ( !empty( $_REQUEST['source'] ) ? $_REQUEST['source'] : '' ) );
93 ?>" />
94 </p>
95 </form>
96 </div>
97
98 <?php
99 do_action( 'login_footer' );
100 ?>
101
102 </body>
103 </html>