PageRenderTime 22ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/public/wp-content/plugins/password-protected/theme/password-protected-login.php

https://gitlab.com/kath.de/cibedo_cibedo.de
PHP | 135 lines | 94 code | 28 blank | 13 comment | 13 complexity | f31b1d71a4e44d58033f5258b3832643 MD5 | raw file
  1. <?php
  2. /**
  3. * Based roughly on wp-login.php @revision 19414
  4. * http://core.trac.wordpress.org/browser/trunk/wp-login.php?rev=19414
  5. */
  6. global $wp_version, $Password_Protected, $error, $is_iphone;
  7. /**
  8. * WP Shake JS
  9. */
  10. if ( ! function_exists( 'wp_shake_js' ) ) {
  11. function wp_shake_js() {
  12. global $is_iphone;
  13. if ( $is_iphone ) {
  14. return;
  15. }
  16. ?>
  17. <script type="text/javascript">
  18. 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();}}};
  19. function s(id,pos){g(id).left=pos+'px';}
  20. function g(id){return document.getElementById(id).style;}
  21. 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){}}}
  22. 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);});
  23. </script>
  24. <?php
  25. }
  26. }
  27. nocache_headers();
  28. header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );
  29. // Set a cookie now to see if they are supported by the browser.
  30. setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN );
  31. if ( SITECOOKIEPATH != COOKIEPATH ) {
  32. setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN );
  33. }
  34. // If cookies are disabled we can't log in even with a valid password.
  35. if ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
  36. $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.", 'password-protected' ) );
  37. }
  38. // Shake it!
  39. $shake_error_codes = array( 'empty_password', 'incorrect_password' );
  40. if ( $Password_Protected->errors->get_error_code() && in_array( $Password_Protected->errors->get_error_code(), $shake_error_codes ) ) {
  41. add_action( 'password_protected_login_head', 'wp_shake_js', 12 );
  42. }
  43. // Obey privacy setting
  44. add_action( 'password_protected_login_head', 'noindex' );
  45. ?>
  46. <!DOCTYPE html>
  47. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
  48. <head>
  49. <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
  50. <title><?php echo apply_filters( 'password_protected_wp_title', get_bloginfo( 'name' ) ); ?></title>
  51. <?php
  52. if ( version_compare( $wp_version, '3.9-dev', '>=' ) ) {
  53. wp_admin_css( 'login', true );
  54. } else {
  55. wp_admin_css( 'wp-admin', true );
  56. wp_admin_css( 'colors-fresh', true );
  57. }
  58. ?>
  59. <style type="text/css" media="screen">
  60. #login_error, .login .message, #loginform { margin-bottom: 20px; }
  61. </style>
  62. <?php
  63. if ( $is_iphone ) {
  64. ?>
  65. <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
  66. <style type="text/css" media="screen">
  67. .login form, .login .message, #login_error { margin-left: 0px; }
  68. .login #nav, .login #backtoblog { margin-left: 8px; }
  69. .login h1 a { width: auto; }
  70. #login { padding: 20px 0; }
  71. </style>
  72. <?php
  73. }
  74. do_action( 'login_enqueue_scripts' );
  75. do_action( 'password_protected_login_head' );
  76. ?>
  77. </head>
  78. <body class="login login-password-protected login-action-password-protected-login wp-core-ui">
  79. <div id="login">
  80. <h1><a href="<?php echo esc_url( apply_filters( 'password_protected_login_headerurl', home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( apply_filters( 'password_protected_login_headertitle', get_bloginfo( 'name' ) ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
  81. <?php do_action( 'password_protected_login_messages' ); ?>
  82. <?php do_action( 'password_protected_before_login_form' ); ?>
  83. <form name="loginform" id="loginform" action="<?php echo esc_url( $Password_Protected->login_url() ); ?>" method="post">
  84. <p>
  85. <label for="password_protected_pass"><?php _e( 'Password', 'password-protected' ) ?><br />
  86. <input type="password" name="password_protected_pwd" id="password_protected_pass" class="input" value="" size="20" tabindex="20" /></label>
  87. </p>
  88. <!--
  89. <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', 'password-protected' ); ?></label></p>
  90. -->
  91. <p class="submit">
  92. <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" />
  93. <input type="hidden" name="testcookie" value="1" />
  94. <input type="hidden" name="password-protected" value="login" />
  95. <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $_REQUEST['redirect_to'] ); ?>" />
  96. </p>
  97. </form>
  98. <?php do_action( 'password_protected_after_login_form' ); ?>
  99. </div>
  100. <script type="text/javascript">
  101. try{document.getElementById('password_protected_pass').focus();}catch(e){}
  102. if(typeof wpOnload=='function')wpOnload();
  103. </script>
  104. <?php do_action( 'login_footer' ); ?>
  105. <div class="clear"></div>
  106. </body>
  107. </html>