@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! isset($wp_did_header)): |
|
4 | -if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
|
3 | +if ( ! isset($wp_did_header)): |
|
4 | +if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) { |
|
5 | 5 | if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
6 | 6 | else $path = 'wp-admin/'; |
7 | 7 | |
8 | - require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
|
9 | - require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
|
10 | - require_once( dirname(__FILE__) . '/wp-includes/plugin.php'); |
|
11 | - wp_die( sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
8 | + require_once(dirname(__FILE__).'/wp-includes/classes.php'); |
|
9 | + require_once(dirname(__FILE__).'/wp-includes/functions.php'); |
|
10 | + require_once(dirname(__FILE__).'/wp-includes/plugin.php'); |
|
11 | + wp_die(sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress › Error' /*/WP_I18N_ERROR*/); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $wp_did_header = true; |
15 | 15 | |
16 | -require_once( dirname(__FILE__) . '/wp-config.php'); |
|
16 | +require_once(dirname(__FILE__).'/wp-config.php'); |
|
17 | 17 | |
18 | 18 | wp(); |
19 | 19 | |
20 | -require_once(ABSPATH . WPINC . '/template-loader.php'); |
|
20 | +require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
21 | 21 | |
22 | 22 | endif; |
23 | 23 |
@@ -2,8 +2,11 @@ |
||
2 | 2 | |
3 | 3 | if (! isset($wp_did_header)): |
4 | 4 | if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
5 | - if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
|
6 | - else $path = 'wp-admin/'; |
|
5 | + if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) { |
|
6 | + $path = ''; |
|
7 | + } else { |
|
8 | + $path = 'wp-admin/'; |
|
9 | + } |
|
7 | 10 | |
8 | 11 | require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
9 | 12 | require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! isset($wp_did_header)): |
|
4 | -if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
|
3 | +if ( ! isset($wp_did_header)): |
|
4 | +if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) { |
|
5 | 5 | if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
6 | 6 | else $path = 'wp-admin/'; |
7 | 7 | |
8 | - require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
|
9 | - require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
|
10 | - require_once( dirname(__FILE__) . '/wp-includes/plugin.php'); |
|
11 | - wp_die( sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress › Error" /*/WP_I18N_ERROR*/); |
|
8 | + require_once(dirname(__FILE__).'/wp-includes/classes.php'); |
|
9 | + require_once(dirname(__FILE__).'/wp-includes/functions.php'); |
|
10 | + require_once(dirname(__FILE__).'/wp-includes/plugin.php'); |
|
11 | + wp_die(sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress › Error" /*/WP_I18N_ERROR*/); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $wp_did_header = true; |
15 | 15 | |
16 | -require_once( dirname(__FILE__) . '/wp-config.php'); |
|
16 | +require_once(dirname(__FILE__).'/wp-config.php'); |
|
17 | 17 | |
18 | 18 | wp(); |
19 | 19 | |
20 | -require_once(ABSPATH . WPINC . '/template-loader.php'); |
|
20 | +require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
21 | 21 | |
22 | 22 | endif; |
23 | 23 |
@@ -2,8 +2,11 @@ |
||
2 | 2 | |
3 | 3 | if (! isset($wp_did_header)): |
4 | 4 | if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) { |
5 | - if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; |
|
6 | - else $path = 'wp-admin/'; |
|
5 | + if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) { |
|
6 | + $path = ''; |
|
7 | + } else { |
|
8 | + $path = 'wp-admin/'; |
|
9 | + } |
|
7 | 10 | |
8 | 11 | require_once( dirname(__FILE__) . '/wp-includes/classes.php'); |
9 | 12 | require_once( dirname(__FILE__) . '/wp-includes/functions.php'); |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | * @package wordpress-i18n |
6 | 6 | * @subpackage tools |
7 | 7 | */ |
8 | -error_reporting( E_ALL ); |
|
9 | -require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php'; |
|
8 | +error_reporting(E_ALL); |
|
9 | +require_once dirname(dirname(__FILE__)).'/not-gettexted.php'; |
|
10 | 10 | |
11 | 11 | class NotGettextedTest extends PHPUnit_Framework_TestCase { |
12 | 12 | |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | |
17 | 17 | function test_make_string_aggregator() { |
18 | 18 | global $baba; |
19 | - $f = $this->ng->make_string_aggregator( 'baba', 'baba.php' ); |
|
20 | - call_user_func( $f, 'x', 'y', 'z' ); |
|
21 | - call_user_func( $f, 'a', 'b', 'c' ); |
|
22 | - $this->assertEquals( array( array( 'x', 'y', 'baba.php', 'z'), array( 'a', 'b', 'baba.php', 'c' ) ), $baba ); |
|
19 | + $f = $this->ng->make_string_aggregator('baba', 'baba.php'); |
|
20 | + call_user_func($f, 'x', 'y', 'z'); |
|
21 | + call_user_func($f, 'a', 'b', 'c'); |
|
22 | + $this->assertEquals(array(array('x', 'y', 'baba.php', 'z'), array('a', 'b', 'baba.php', 'c')), $baba); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | function test_walk() { |
@@ -30,17 +30,17 @@ discard block |
||
30 | 30 | if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); } |
31 | 31 | ?>'; |
32 | 32 | $tokens = token_get_all($code); |
33 | - $this->assertEquals( '', $this->ng->walk_tokens( $tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token') ) ); |
|
34 | - $this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token') ) ); |
|
35 | - $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); |
|
36 | - $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); |
|
33 | + $this->assertEquals('', $this->ng->walk_tokens($tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token'))); |
|
34 | + $this->assertEquals('"yes"\'We died %d times!\'', $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token'))); |
|
35 | + $this->assertEquals($code, $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token'))); |
|
36 | + $this->assertEquals($code, $this->ng->walk_tokens($tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token'))); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | function test_replace() { |
40 | 40 | # copy to a new file, so that we don't corrupt the old one |
41 | - copy( 'data/not-gettexted-0.php', 'data/not-gettexted-0-work.php' ); |
|
42 | - $this->ng->command_replace( 'data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php' ); |
|
43 | - $this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) ); |
|
44 | - unlink( 'data/not-gettexted-0-work.php' ); |
|
41 | + copy('data/not-gettexted-0.php', 'data/not-gettexted-0-work.php'); |
|
42 | + $this->ng->command_replace('data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php'); |
|
43 | + $this->assertEquals(file_get_contents('data/not-gettexted-0-result.php'), file_get_contents('data/not-gettexted-0-work.php')); |
|
44 | + unlink('data/not-gettexted-0-work.php'); |
|
45 | 45 | } |
46 | 46 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress User Page |
|
4 | - * |
|
5 | - * Handles authentication, registering, resetting passwords, forgot password, |
|
6 | - * and other user handling. |
|
7 | - * |
|
8 | - * @package WordPress |
|
9 | - */ |
|
3 | + * WordPress User Page |
|
4 | + * |
|
5 | + * Handles authentication, registering, resetting passwords, forgot password, |
|
6 | + * and other user handling. |
|
7 | + * |
|
8 | + * @package WordPress |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /** Make sure that the WordPress bootstrap has run before continuing. */ |
12 | 12 | require( dirname(__FILE__) . '/wp-load.php' ); |
@@ -426,16 +426,16 @@ discard block |
||
426 | 426 | |
427 | 427 | switch ($action) { |
428 | 428 | |
429 | -case 'postpass' : |
|
430 | - if ( ! array_key_exists( 'post_password', $_POST ) ) { |
|
431 | - wp_safe_redirect( wp_get_referer() ); |
|
432 | - exit(); |
|
433 | - } |
|
429 | + case 'postpass' : |
|
430 | + if ( ! array_key_exists( 'post_password', $_POST ) ) { |
|
431 | + wp_safe_redirect( wp_get_referer() ); |
|
432 | + exit(); |
|
433 | + } |
|
434 | 434 | |
435 | - require_once ABSPATH . WPINC . '/class-phpass.php'; |
|
436 | - $hasher = new PasswordHash( 8, true ); |
|
435 | + require_once ABSPATH . WPINC . '/class-phpass.php'; |
|
436 | + $hasher = new PasswordHash( 8, true ); |
|
437 | 437 | |
438 | - /** |
|
438 | + /** |
|
439 | 439 | * Filter the life span of the post password cookie. |
440 | 440 | * |
441 | 441 | * By default, the cookie expires 10 days from creation. To turn this |
@@ -445,33 +445,33 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @param int $expires The expiry time, as passed to setcookie(). |
447 | 447 | */ |
448 | - $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); |
|
449 | - $referer = wp_get_referer(); |
|
450 | - if ( $referer ) { |
|
451 | - $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); |
|
452 | - } else { |
|
453 | - $secure = false; |
|
454 | - } |
|
455 | - setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
448 | + $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); |
|
449 | + $referer = wp_get_referer(); |
|
450 | + if ( $referer ) { |
|
451 | + $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); |
|
452 | + } else { |
|
453 | + $secure = false; |
|
454 | + } |
|
455 | + setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
456 | 456 | |
457 | - wp_safe_redirect( wp_get_referer() ); |
|
458 | - exit(); |
|
457 | + wp_safe_redirect( wp_get_referer() ); |
|
458 | + exit(); |
|
459 | 459 | |
460 | -case 'logout' : |
|
461 | - check_admin_referer('log-out'); |
|
460 | + case 'logout' : |
|
461 | + check_admin_referer('log-out'); |
|
462 | 462 | |
463 | - $user = wp_get_current_user(); |
|
463 | + $user = wp_get_current_user(); |
|
464 | 464 | |
465 | - wp_logout(); |
|
465 | + wp_logout(); |
|
466 | 466 | |
467 | - if ( ! empty( $_REQUEST['redirect_to'] ) ) { |
|
468 | - $redirect_to = $requested_redirect_to = $_REQUEST['redirect_to']; |
|
469 | - } else { |
|
470 | - $redirect_to = 'wp-login.php?loggedout=true'; |
|
471 | - $requested_redirect_to = ''; |
|
472 | - } |
|
467 | + if ( ! empty( $_REQUEST['redirect_to'] ) ) { |
|
468 | + $redirect_to = $requested_redirect_to = $_REQUEST['redirect_to']; |
|
469 | + } else { |
|
470 | + $redirect_to = 'wp-login.php?loggedout=true'; |
|
471 | + $requested_redirect_to = ''; |
|
472 | + } |
|
473 | 473 | |
474 | - /** |
|
474 | + /** |
|
475 | 475 | * Filter the log out redirect URL. |
476 | 476 | * |
477 | 477 | * @since 4.2.0 |
@@ -480,52 +480,52 @@ discard block |
||
480 | 480 | * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
481 | 481 | * @param WP_User $user The WP_User object for the user that's logging out. |
482 | 482 | */ |
483 | - $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
484 | - wp_safe_redirect( $redirect_to ); |
|
485 | - exit(); |
|
486 | - |
|
487 | -case 'lostpassword' : |
|
488 | -case 'retrievepassword' : |
|
489 | - |
|
490 | - if ( $http_post ) { |
|
491 | - $errors = retrieve_password(); |
|
492 | - if ( !is_wp_error($errors) ) { |
|
493 | - $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
|
494 | - wp_safe_redirect( $redirect_to ); |
|
495 | - exit(); |
|
483 | + $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
484 | + wp_safe_redirect( $redirect_to ); |
|
485 | + exit(); |
|
486 | + |
|
487 | + case 'lostpassword' : |
|
488 | + case 'retrievepassword' : |
|
489 | + |
|
490 | + if ( $http_post ) { |
|
491 | + $errors = retrieve_password(); |
|
492 | + if ( !is_wp_error($errors) ) { |
|
493 | + $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
|
494 | + wp_safe_redirect( $redirect_to ); |
|
495 | + exit(); |
|
496 | + } |
|
496 | 497 | } |
497 | - } |
|
498 | 498 | |
499 | - if ( isset( $_GET['error'] ) ) { |
|
500 | - if ( 'invalidkey' == $_GET['error'] ) { |
|
501 | - $errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) ); |
|
502 | - } elseif ( 'expiredkey' == $_GET['error'] ) { |
|
503 | - $errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) ); |
|
499 | + if ( isset( $_GET['error'] ) ) { |
|
500 | + if ( 'invalidkey' == $_GET['error'] ) { |
|
501 | + $errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) ); |
|
502 | + } elseif ( 'expiredkey' == $_GET['error'] ) { |
|
503 | + $errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) ); |
|
504 | + } |
|
504 | 505 | } |
505 | - } |
|
506 | 506 | |
507 | - $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
508 | - /** |
|
507 | + $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
508 | + /** |
|
509 | 509 | * Filter the URL redirected to after submitting the lostpassword/retrievepassword form. |
510 | 510 | * |
511 | 511 | * @since 3.0.0 |
512 | 512 | * |
513 | 513 | * @param string $lostpassword_redirect The redirect destination URL. |
514 | 514 | */ |
515 | - $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect ); |
|
515 | + $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect ); |
|
516 | 516 | |
517 | - /** |
|
517 | + /** |
|
518 | 518 | * Fires before the lost password form. |
519 | 519 | * |
520 | 520 | * @since 1.5.1 |
521 | 521 | */ |
522 | - do_action( 'lost_password' ); |
|
522 | + do_action( 'lost_password' ); |
|
523 | 523 | |
524 | - login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors); |
|
524 | + login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors); |
|
525 | 525 | |
526 | - $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; |
|
526 | + $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; |
|
527 | 527 | |
528 | -?> |
|
528 | + ?> |
|
529 | 529 | |
530 | 530 | <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> |
531 | 531 | <p> |
@@ -533,68 +533,68 @@ discard block |
||
533 | 533 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> |
534 | 534 | </p> |
535 | 535 | <?php |
536 | - /** |
|
536 | + /** |
|
537 | 537 | * Fires inside the lostpassword form tags, before the hidden fields. |
538 | 538 | * |
539 | 539 | * @since 2.1.0 |
540 | 540 | */ |
541 | - do_action( 'lostpassword_form' ); ?> |
|
542 | - <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
541 | + do_action( 'lostpassword_form' ); ?> |
|
542 | + <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
543 | 543 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password'); ?>" /></p> |
544 | 544 | </form> |
545 | 545 | |
546 | 546 | <p id="nav"> |
547 | 547 | <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a> |
548 | -<?php |
|
549 | -if ( get_option( 'users_can_register' ) ) : |
|
550 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
548 | + <?php |
|
549 | + if ( get_option( 'users_can_register' ) ) : |
|
550 | + $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
551 | 551 | |
552 | - /** This filter is documented in wp-includes/general-template.php */ |
|
553 | - echo ' | ' . apply_filters( 'register', $registration_url ); |
|
554 | -endif; |
|
555 | -?> |
|
556 | -</p> |
|
552 | + /** This filter is documented in wp-includes/general-template.php */ |
|
553 | + echo ' | ' . apply_filters( 'register', $registration_url ); |
|
554 | + endif; |
|
555 | + ?> |
|
556 | + </p> |
|
557 | 557 | |
558 | -<?php |
|
559 | -login_footer('user_login'); |
|
560 | -break; |
|
561 | - |
|
562 | -case 'resetpass' : |
|
563 | -case 'rp' : |
|
564 | - list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
565 | - $rp_cookie = 'wp-resetpass-' . COOKIEHASH; |
|
566 | - if ( isset( $_GET['key'] ) ) { |
|
567 | - $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); |
|
568 | - setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
569 | - wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); |
|
570 | - exit; |
|
571 | - } |
|
558 | + <?php |
|
559 | + login_footer('user_login'); |
|
560 | + break; |
|
561 | + |
|
562 | + case 'resetpass' : |
|
563 | + case 'rp' : |
|
564 | + list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
565 | + $rp_cookie = 'wp-resetpass-' . COOKIEHASH; |
|
566 | + if ( isset( $_GET['key'] ) ) { |
|
567 | + $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); |
|
568 | + setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
569 | + wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); |
|
570 | + exit; |
|
571 | + } |
|
572 | 572 | |
573 | - if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { |
|
574 | - list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); |
|
575 | - $user = check_password_reset_key( $rp_key, $rp_login ); |
|
576 | - if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { |
|
573 | + if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { |
|
574 | + list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); |
|
575 | + $user = check_password_reset_key( $rp_key, $rp_login ); |
|
576 | + if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { |
|
577 | + $user = false; |
|
578 | + } |
|
579 | + } else { |
|
577 | 580 | $user = false; |
578 | 581 | } |
579 | - } else { |
|
580 | - $user = false; |
|
581 | - } |
|
582 | 582 | |
583 | - if ( ! $user || is_wp_error( $user ) ) { |
|
584 | - setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
585 | - if ( $user && $user->get_error_code() === 'expired_key' ) |
|
586 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
587 | - else |
|
588 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
589 | - exit; |
|
590 | - } |
|
583 | + if ( ! $user || is_wp_error( $user ) ) { |
|
584 | + setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
585 | + if ( $user && $user->get_error_code() === 'expired_key' ) |
|
586 | + wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
587 | + else |
|
588 | + wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
589 | + exit; |
|
590 | + } |
|
591 | 591 | |
592 | - $errors = new WP_Error(); |
|
592 | + $errors = new WP_Error(); |
|
593 | 593 | |
594 | - if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) |
|
595 | - $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) ); |
|
594 | + if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) |
|
595 | + $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) ); |
|
596 | 596 | |
597 | - /** |
|
597 | + /** |
|
598 | 598 | * Fires before the password reset procedure is validated. |
599 | 599 | * |
600 | 600 | * @since 3.5.0 |
@@ -602,23 +602,23 @@ discard block |
||
602 | 602 | * @param object $errors WP Error object. |
603 | 603 | * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise. |
604 | 604 | */ |
605 | - do_action( 'validate_password_reset', $errors, $user ); |
|
606 | - |
|
607 | - if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) { |
|
608 | - reset_password($user, $_POST['pass1']); |
|
609 | - setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
610 | - login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' ); |
|
611 | - login_footer(); |
|
612 | - exit; |
|
613 | - } |
|
605 | + do_action( 'validate_password_reset', $errors, $user ); |
|
606 | + |
|
607 | + if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) { |
|
608 | + reset_password($user, $_POST['pass1']); |
|
609 | + setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
610 | + login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' ); |
|
611 | + login_footer(); |
|
612 | + exit; |
|
613 | + } |
|
614 | 614 | |
615 | - wp_enqueue_script('utils'); |
|
616 | - wp_enqueue_script('user-profile'); |
|
615 | + wp_enqueue_script('utils'); |
|
616 | + wp_enqueue_script('user-profile'); |
|
617 | 617 | |
618 | - login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); |
|
618 | + login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); |
|
619 | 619 | |
620 | -?> |
|
621 | -<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
|
620 | + ?> |
|
621 | + <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
|
622 | 622 | <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> |
623 | 623 | |
624 | 624 | <div class="user-pass1-wrap"> |
@@ -643,78 +643,78 @@ discard block |
||
643 | 643 | <br class="clear" /> |
644 | 644 | |
645 | 645 | <?php |
646 | - /** |
|
646 | + /** |
|
647 | 647 | * Fires following the 'Strength indicator' meter in the user password reset form. |
648 | 648 | * |
649 | 649 | * @since 3.9.0 |
650 | 650 | * |
651 | 651 | * @param WP_User $user User object of the user whose password is being reset. |
652 | 652 | */ |
653 | - do_action( 'resetpass_form', $user ); |
|
654 | - ?> |
|
655 | - <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
|
653 | + do_action( 'resetpass_form', $user ); |
|
654 | + ?> |
|
655 | + <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
|
656 | 656 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p> |
657 | 657 | </form> |
658 | 658 | |
659 | 659 | <p id="nav"> |
660 | 660 | <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
661 | -<?php |
|
662 | -if ( get_option( 'users_can_register' ) ) : |
|
663 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
661 | + <?php |
|
662 | + if ( get_option( 'users_can_register' ) ) : |
|
663 | + $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
664 | 664 | |
665 | - /** This filter is documented in wp-includes/general-template.php */ |
|
666 | - echo ' | ' . apply_filters( 'register', $registration_url ); |
|
667 | -endif; |
|
668 | -?> |
|
669 | -</p> |
|
665 | + /** This filter is documented in wp-includes/general-template.php */ |
|
666 | + echo ' | ' . apply_filters( 'register', $registration_url ); |
|
667 | + endif; |
|
668 | + ?> |
|
669 | + </p> |
|
670 | 670 | |
671 | -<?php |
|
672 | -login_footer('user_pass'); |
|
673 | -break; |
|
671 | + <?php |
|
672 | + login_footer('user_pass'); |
|
673 | + break; |
|
674 | 674 | |
675 | -case 'register' : |
|
676 | - if ( is_multisite() ) { |
|
677 | - /** |
|
675 | + case 'register' : |
|
676 | + if ( is_multisite() ) { |
|
677 | + /** |
|
678 | 678 | * Filter the Multisite sign up URL. |
679 | 679 | * |
680 | 680 | * @since 3.0.0 |
681 | 681 | * |
682 | 682 | * @param string $sign_up_url The sign up URL. |
683 | 683 | */ |
684 | - wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) ); |
|
685 | - exit; |
|
686 | - } |
|
687 | - |
|
688 | - if ( !get_option('users_can_register') ) { |
|
689 | - wp_redirect( site_url('wp-login.php?registration=disabled') ); |
|
690 | - exit(); |
|
691 | - } |
|
684 | + wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) ); |
|
685 | + exit; |
|
686 | + } |
|
692 | 687 | |
693 | - $user_login = ''; |
|
694 | - $user_email = ''; |
|
695 | - if ( $http_post ) { |
|
696 | - $user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : ''; |
|
697 | - $user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : ''; |
|
698 | - $errors = register_new_user($user_login, $user_email); |
|
699 | - if ( !is_wp_error($errors) ) { |
|
700 | - $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
|
701 | - wp_safe_redirect( $redirect_to ); |
|
688 | + if ( !get_option('users_can_register') ) { |
|
689 | + wp_redirect( site_url('wp-login.php?registration=disabled') ); |
|
702 | 690 | exit(); |
703 | 691 | } |
704 | - } |
|
705 | 692 | |
706 | - $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
707 | - /** |
|
693 | + $user_login = ''; |
|
694 | + $user_email = ''; |
|
695 | + if ( $http_post ) { |
|
696 | + $user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : ''; |
|
697 | + $user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : ''; |
|
698 | + $errors = register_new_user($user_login, $user_email); |
|
699 | + if ( !is_wp_error($errors) ) { |
|
700 | + $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
|
701 | + wp_safe_redirect( $redirect_to ); |
|
702 | + exit(); |
|
703 | + } |
|
704 | + } |
|
705 | + |
|
706 | + $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
707 | + /** |
|
708 | 708 | * Filter the registration redirect URL. |
709 | 709 | * |
710 | 710 | * @since 3.0.0 |
711 | 711 | * |
712 | 712 | * @param string $registration_redirect The redirect destination URL. |
713 | 713 | */ |
714 | - $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); |
|
715 | - login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors); |
|
716 | -?> |
|
717 | -<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
|
714 | + $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); |
|
715 | + login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors); |
|
716 | + ?> |
|
717 | + <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
|
718 | 718 | <p> |
719 | 719 | <label for="user_login"><?php _e('Username') ?><br /> |
720 | 720 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label> |
@@ -724,14 +724,14 @@ discard block |
||
724 | 724 | <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label> |
725 | 725 | </p> |
726 | 726 | <?php |
727 | - /** |
|
727 | + /** |
|
728 | 728 | * Fires following the 'Email' field in the user registration form. |
729 | 729 | * |
730 | 730 | * @since 2.1.0 |
731 | 731 | */ |
732 | - do_action( 'register_form' ); |
|
733 | - ?> |
|
734 | - <p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.' ); ?></p> |
|
732 | + do_action( 'register_form' ); |
|
733 | + ?> |
|
734 | + <p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.' ); ?></p> |
|
735 | 735 | <br class="clear" /> |
736 | 736 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
737 | 737 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register'); ?>" /></p> |
@@ -743,59 +743,59 @@ discard block |
||
743 | 743 | </p> |
744 | 744 | |
745 | 745 | <?php |
746 | -login_footer('user_login'); |
|
747 | -break; |
|
748 | - |
|
749 | -case 'login' : |
|
750 | -default: |
|
751 | - $secure_cookie = ''; |
|
752 | - $customize_login = isset( $_REQUEST['customize-login'] ); |
|
753 | - if ( $customize_login ) |
|
754 | - wp_enqueue_script( 'customize-base' ); |
|
755 | - |
|
756 | - // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
757 | - if ( !empty($_POST['log']) && !force_ssl_admin() ) { |
|
758 | - $user_name = sanitize_user($_POST['log']); |
|
759 | - $user = get_user_by( 'login', $user_name ); |
|
760 | - |
|
761 | - if ( ! $user && strpos( $user_name, '@' ) ) { |
|
762 | - $user = get_user_by( 'email', $user_name ); |
|
763 | - } |
|
746 | + login_footer('user_login'); |
|
747 | + break; |
|
748 | + |
|
749 | + case 'login' : |
|
750 | + default: |
|
751 | + $secure_cookie = ''; |
|
752 | + $customize_login = isset( $_REQUEST['customize-login'] ); |
|
753 | + if ( $customize_login ) |
|
754 | + wp_enqueue_script( 'customize-base' ); |
|
755 | + |
|
756 | + // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
757 | + if ( !empty($_POST['log']) && !force_ssl_admin() ) { |
|
758 | + $user_name = sanitize_user($_POST['log']); |
|
759 | + $user = get_user_by( 'login', $user_name ); |
|
760 | + |
|
761 | + if ( ! $user && strpos( $user_name, '@' ) ) { |
|
762 | + $user = get_user_by( 'email', $user_name ); |
|
763 | + } |
|
764 | 764 | |
765 | - if ( $user ) { |
|
766 | - if ( get_user_option('use_ssl', $user->ID) ) { |
|
767 | - $secure_cookie = true; |
|
768 | - force_ssl_admin(true); |
|
765 | + if ( $user ) { |
|
766 | + if ( get_user_option('use_ssl', $user->ID) ) { |
|
767 | + $secure_cookie = true; |
|
768 | + force_ssl_admin(true); |
|
769 | + } |
|
769 | 770 | } |
770 | 771 | } |
771 | - } |
|
772 | 772 | |
773 | - if ( isset( $_REQUEST['redirect_to'] ) ) { |
|
774 | - $redirect_to = $_REQUEST['redirect_to']; |
|
775 | - // Redirect to https if user wants ssl |
|
776 | - if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) |
|
777 | - $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
|
778 | - } else { |
|
779 | - $redirect_to = admin_url(); |
|
780 | - } |
|
773 | + if ( isset( $_REQUEST['redirect_to'] ) ) { |
|
774 | + $redirect_to = $_REQUEST['redirect_to']; |
|
775 | + // Redirect to https if user wants ssl |
|
776 | + if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) |
|
777 | + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
|
778 | + } else { |
|
779 | + $redirect_to = admin_url(); |
|
780 | + } |
|
781 | 781 | |
782 | - $reauth = empty($_REQUEST['reauth']) ? false : true; |
|
782 | + $reauth = empty($_REQUEST['reauth']) ? false : true; |
|
783 | 783 | |
784 | - $user = wp_signon( '', $secure_cookie ); |
|
784 | + $user = wp_signon( '', $secure_cookie ); |
|
785 | 785 | |
786 | - if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { |
|
787 | - if ( headers_sent() ) { |
|
788 | - $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), |
|
789 | - __( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) ); |
|
790 | - } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) { |
|
791 | - // If cookies are disabled we can't log in even with a valid user+pass |
|
792 | - $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), |
|
793 | - __( 'https://codex.wordpress.org/Cookies' ) ) ); |
|
786 | + if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { |
|
787 | + if ( headers_sent() ) { |
|
788 | + $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), |
|
789 | + __( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) ); |
|
790 | + } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) { |
|
791 | + // If cookies are disabled we can't log in even with a valid user+pass |
|
792 | + $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), |
|
793 | + __( 'https://codex.wordpress.org/Cookies' ) ) ); |
|
794 | + } |
|
794 | 795 | } |
795 | - } |
|
796 | 796 | |
797 | - $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
798 | - /** |
|
797 | + $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
798 | + /** |
|
799 | 799 | * Filter the login redirect URL. |
800 | 800 | * |
801 | 801 | * @since 3.0.0 |
@@ -804,65 +804,65 @@ discard block |
||
804 | 804 | * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
805 | 805 | * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
806 | 806 | */ |
807 | - $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
808 | - |
|
809 | - if ( !is_wp_error($user) && !$reauth ) { |
|
810 | - if ( $interim_login ) { |
|
811 | - $message = '<p class="message">' . __('You have logged in successfully.') . '</p>'; |
|
812 | - $interim_login = 'success'; |
|
813 | - login_header( '', $message ); ?> |
|
814 | - </div> |
|
807 | + $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
808 | + |
|
809 | + if ( !is_wp_error($user) && !$reauth ) { |
|
810 | + if ( $interim_login ) { |
|
811 | + $message = '<p class="message">' . __('You have logged in successfully.') . '</p>'; |
|
812 | + $interim_login = 'success'; |
|
813 | + login_header( '', $message ); ?> |
|
814 | + </div> |
|
815 | 815 | <?php |
816 | - /** This action is documented in wp-login.php */ |
|
817 | - do_action( 'login_footer' ); ?> |
|
818 | - <?php if ( $customize_login ) : ?> |
|
819 | - <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> |
|
816 | + /** This action is documented in wp-login.php */ |
|
817 | + do_action( 'login_footer' ); ?> |
|
818 | + <?php if ( $customize_login ) : ?> |
|
819 | + <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> |
|
820 | 820 | <?php endif; ?> |
821 | - </body></html> |
|
822 | -<?php exit; |
|
823 | - } |
|
824 | - |
|
825 | - if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { |
|
826 | - // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. |
|
827 | - if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) ) |
|
828 | - $redirect_to = user_admin_url(); |
|
829 | - elseif ( is_multisite() && !$user->has_cap('read') ) |
|
830 | - $redirect_to = get_dashboard_url( $user->ID ); |
|
831 | - elseif ( !$user->has_cap('edit_posts') ) |
|
832 | - $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
821 | + </body></html> |
|
822 | + <?php exit; |
|
823 | + } |
|
833 | 824 | |
834 | - wp_redirect( $redirect_to ); |
|
825 | + if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { |
|
826 | + // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. |
|
827 | + if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) ) |
|
828 | + $redirect_to = user_admin_url(); |
|
829 | + elseif ( is_multisite() && !$user->has_cap('read') ) |
|
830 | + $redirect_to = get_dashboard_url( $user->ID ); |
|
831 | + elseif ( !$user->has_cap('edit_posts') ) |
|
832 | + $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
833 | + |
|
834 | + wp_redirect( $redirect_to ); |
|
835 | + exit(); |
|
836 | + } |
|
837 | + wp_safe_redirect($redirect_to); |
|
835 | 838 | exit(); |
836 | 839 | } |
837 | - wp_safe_redirect($redirect_to); |
|
838 | - exit(); |
|
839 | - } |
|
840 | 840 | |
841 | - $errors = $user; |
|
842 | - // Clear errors if loggedout is set. |
|
843 | - if ( !empty($_GET['loggedout']) || $reauth ) |
|
844 | - $errors = new WP_Error(); |
|
841 | + $errors = $user; |
|
842 | + // Clear errors if loggedout is set. |
|
843 | + if ( !empty($_GET['loggedout']) || $reauth ) |
|
844 | + $errors = new WP_Error(); |
|
845 | 845 | |
846 | - if ( $interim_login ) { |
|
847 | - if ( ! $errors->get_error_code() ) |
|
848 | - $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
849 | - } else { |
|
850 | - // Some parts of this script use the main login form to display a message |
|
851 | - if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) |
|
852 | - $errors->add('loggedout', __('You are now logged out.'), 'message'); |
|
853 | - elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) |
|
854 | - $errors->add('registerdisabled', __('User registration is currently not allowed.')); |
|
855 | - elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) |
|
856 | - $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); |
|
857 | - elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) |
|
858 | - $errors->add('newpass', __('Check your email for your new password.'), 'message'); |
|
859 | - elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) |
|
860 | - $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); |
|
861 | - elseif ( strpos( $redirect_to, 'about.php?updated' ) ) |
|
862 | - $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
|
863 | - } |
|
846 | + if ( $interim_login ) { |
|
847 | + if ( ! $errors->get_error_code() ) |
|
848 | + $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
849 | + } else { |
|
850 | + // Some parts of this script use the main login form to display a message |
|
851 | + if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) |
|
852 | + $errors->add('loggedout', __('You are now logged out.'), 'message'); |
|
853 | + elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) |
|
854 | + $errors->add('registerdisabled', __('User registration is currently not allowed.')); |
|
855 | + elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) |
|
856 | + $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); |
|
857 | + elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) |
|
858 | + $errors->add('newpass', __('Check your email for your new password.'), 'message'); |
|
859 | + elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) |
|
860 | + $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); |
|
861 | + elseif ( strpos( $redirect_to, 'about.php?updated' ) ) |
|
862 | + $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
|
863 | + } |
|
864 | 864 | |
865 | - /** |
|
865 | + /** |
|
866 | 866 | * Filter the login page errors. |
867 | 867 | * |
868 | 868 | * @since 3.6.0 |
@@ -870,24 +870,24 @@ discard block |
||
870 | 870 | * @param object $errors WP Error object. |
871 | 871 | * @param string $redirect_to Redirect destination URL. |
872 | 872 | */ |
873 | - $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
|
873 | + $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
|
874 | 874 | |
875 | - // Clear any stale cookies. |
|
876 | - if ( $reauth ) |
|
877 | - wp_clear_auth_cookie(); |
|
875 | + // Clear any stale cookies. |
|
876 | + if ( $reauth ) |
|
877 | + wp_clear_auth_cookie(); |
|
878 | 878 | |
879 | - login_header(__('Log In'), '', $errors); |
|
879 | + login_header(__('Log In'), '', $errors); |
|
880 | 880 | |
881 | - if ( isset($_POST['log']) ) |
|
882 | - $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
883 | - $rememberme = ! empty( $_POST['rememberme'] ); |
|
881 | + if ( isset($_POST['log']) ) |
|
882 | + $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
883 | + $rememberme = ! empty( $_POST['rememberme'] ); |
|
884 | 884 | |
885 | - if ( ! empty( $errors->errors ) ) { |
|
886 | - $aria_describedby_error = ' aria-describedby="login_error"'; |
|
887 | - } else { |
|
888 | - $aria_describedby_error = ''; |
|
889 | - } |
|
890 | -?> |
|
885 | + if ( ! empty( $errors->errors ) ) { |
|
886 | + $aria_describedby_error = ' aria-describedby="login_error"'; |
|
887 | + } else { |
|
888 | + $aria_describedby_error = ''; |
|
889 | + } |
|
890 | + ?> |
|
891 | 891 | |
892 | 892 | <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
893 | 893 | <p> |
@@ -899,42 +899,42 @@ discard block |
||
899 | 899 | <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label> |
900 | 900 | </p> |
901 | 901 | <?php |
902 | - /** |
|
902 | + /** |
|
903 | 903 | * Fires following the 'Password' field in the login form. |
904 | 904 | * |
905 | 905 | * @since 2.1.0 |
906 | 906 | */ |
907 | - do_action( 'login_form' ); |
|
908 | - ?> |
|
909 | - <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> |
|
907 | + do_action( 'login_form' ); |
|
908 | + ?> |
|
909 | + <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> |
|
910 | 910 | <p class="submit"> |
911 | 911 | <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" /> |
912 | -<?php if ( $interim_login ) { ?> |
|
913 | - <input type="hidden" name="interim-login" value="1" /> |
|
914 | -<?php } else { ?> |
|
915 | - <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> |
|
916 | -<?php } ?> |
|
917 | -<?php if ( $customize_login ) : ?> |
|
918 | - <input type="hidden" name="customize-login" value="1" /> |
|
919 | -<?php endif; ?> |
|
912 | + <?php if ( $interim_login ) { ?> |
|
913 | + <input type="hidden" name="interim-login" value="1" /> |
|
914 | + <?php } else { ?> |
|
915 | + <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> |
|
916 | + <?php } ?> |
|
917 | + <?php if ( $customize_login ) : ?> |
|
918 | + <input type="hidden" name="customize-login" value="1" /> |
|
919 | + <?php endif; ?> |
|
920 | 920 | <input type="hidden" name="testcookie" value="1" /> |
921 | 921 | </p> |
922 | 922 | </form> |
923 | 923 | |
924 | 924 | <?php if ( ! $interim_login ) { ?> |
925 | -<p id="nav"> |
|
926 | -<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : |
|
927 | - if ( get_option( 'users_can_register' ) ) : |
|
928 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
929 | - |
|
930 | - /** This filter is documented in wp-includes/general-template.php */ |
|
931 | - echo apply_filters( 'register', $registration_url ) . ' | '; |
|
932 | - endif; |
|
933 | - ?> |
|
934 | - <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
|
935 | -<?php endif; ?> |
|
936 | -</p> |
|
937 | -<?php } ?> |
|
925 | + <p id="nav"> |
|
926 | + <?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : |
|
927 | + if ( get_option( 'users_can_register' ) ) : |
|
928 | + $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
929 | + |
|
930 | + /** This filter is documented in wp-includes/general-template.php */ |
|
931 | + echo apply_filters( 'register', $registration_url ) . ' | '; |
|
932 | + endif; |
|
933 | + ?> |
|
934 | + <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
|
935 | + <?php endif; ?> |
|
936 | + </p> |
|
937 | + <?php } ?> |
|
938 | 938 | |
939 | 939 | <script type="text/javascript"> |
940 | 940 | function wp_attempt_focus(){ |
@@ -943,8 +943,8 @@ discard block |
||
943 | 943 | d = document.getElementById('user_pass'); |
944 | 944 | d.value = ''; |
945 | 945 | <?php } else { ?> |
946 | -d = document.getElementById('user_login'); |
|
947 | -<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> |
|
946 | + d = document.getElementById('user_login'); |
|
947 | + <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> |
|
948 | 948 | if( d.value != '' ) |
949 | 949 | d.value = ''; |
950 | 950 | <?php |
@@ -957,10 +957,10 @@ discard block |
||
957 | 957 | } |
958 | 958 | |
959 | 959 | <?php if ( !$error ) { ?> |
960 | -wp_attempt_focus(); |
|
961 | -<?php } ?> |
|
962 | -if(typeof wpOnload=='function')wpOnload(); |
|
963 | -<?php if ( $interim_login ) { ?> |
|
960 | + wp_attempt_focus(); |
|
961 | + <?php } ?> |
|
962 | + if(typeof wpOnload=='function')wpOnload(); |
|
963 | + <?php if ( $interim_login ) { ?> |
|
964 | 964 | (function(){ |
965 | 965 | try { |
966 | 966 | var i, links = document.getElementsByTagName('a'); |
@@ -971,9 +971,9 @@ discard block |
||
971 | 971 | } catch(e){} |
972 | 972 | }()); |
973 | 973 | <?php } ?> |
974 | -</script> |
|
974 | + </script> |
|
975 | 975 | |
976 | -<?php |
|
977 | -login_footer(); |
|
978 | -break; |
|
976 | + <?php |
|
977 | + login_footer(); |
|
978 | + break; |
|
979 | 979 | } // end action switch |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** Make sure that the WordPress bootstrap has run before continuing. */ |
12 | -require( dirname(__FILE__) . '/wp-load.php' ); |
|
12 | +require(dirname(__FILE__).'/wp-load.php'); |
|
13 | 13 | |
14 | 14 | // Redirect to https login if forced to use SSL |
15 | -if ( force_ssl_admin() && ! is_ssl() ) { |
|
16 | - if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) { |
|
17 | - wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ); |
|
15 | +if (force_ssl_admin() && ! is_ssl()) { |
|
16 | + if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) { |
|
17 | + wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https')); |
|
18 | 18 | exit(); |
19 | 19 | } else { |
20 | - wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
|
20 | + wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
21 | 21 | exit(); |
22 | 22 | } |
23 | 23 | } |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | * @param string $message Optional. Message to display in header. Default empty. |
31 | 31 | * @param WP_Error $wp_error Optional. The error to pass. Default empty. |
32 | 32 | */ |
33 | -function login_header( $title = 'Log In', $message = '', $wp_error = '' ) { |
|
33 | +function login_header($title = 'Log In', $message = '', $wp_error = '') { |
|
34 | 34 | global $error, $interim_login, $action; |
35 | 35 | |
36 | 36 | // Don't index any of these forms |
37 | - add_action( 'login_head', 'wp_no_robots' ); |
|
37 | + add_action('login_head', 'wp_no_robots'); |
|
38 | 38 | |
39 | - if ( wp_is_mobile() ) |
|
40 | - add_action( 'login_head', 'wp_login_viewport_meta' ); |
|
39 | + if (wp_is_mobile()) |
|
40 | + add_action('login_head', 'wp_login_viewport_meta'); |
|
41 | 41 | |
42 | - if ( empty($wp_error) ) |
|
42 | + if (empty($wp_error)) |
|
43 | 43 | $wp_error = new WP_Error(); |
44 | 44 | |
45 | 45 | // Shake it! |
46 | - $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' ); |
|
46 | + $shake_error_codes = array('empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password'); |
|
47 | 47 | /** |
48 | 48 | * Filter the error codes array for shaking the login form. |
49 | 49 | * |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param array $shake_error_codes Error codes that shake the login form. |
53 | 53 | */ |
54 | - $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
|
54 | + $shake_error_codes = apply_filters('shake_error_codes', $shake_error_codes); |
|
55 | 55 | |
56 | - if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) |
|
57 | - add_action( 'login_head', 'wp_shake_js', 12 ); |
|
56 | + if ($shake_error_codes && $wp_error->get_error_code() && in_array($wp_error->get_error_code(), $shake_error_codes)) |
|
57 | + add_action('login_head', 'wp_shake_js', 12); |
|
58 | 58 | |
59 | 59 | $separator = is_rtl() ? ' › ' : ' ‹ '; |
60 | 60 | |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | <!--<![endif]--> |
68 | 68 | <head> |
69 | 69 | <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> |
70 | - <title><?php echo get_bloginfo( 'name', 'display' ) . $separator . $title; ?></title> |
|
70 | + <title><?php echo get_bloginfo('name', 'display').$separator.$title; ?></title> |
|
71 | 71 | <?php |
72 | 72 | |
73 | - wp_enqueue_style( 'login' ); |
|
73 | + wp_enqueue_style('login'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * Remove all stored post data on logging out. |
77 | 77 | * This could be added by add_action('login_head'...) like wp_shake_js(), |
78 | 78 | * but maybe better if it's not removable by plugins |
79 | 79 | */ |
80 | - if ( 'loggedout' == $wp_error->get_error_code() ) { |
|
80 | + if ('loggedout' == $wp_error->get_error_code()) { |
|
81 | 81 | ?> |
82 | 82 | <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script> |
83 | 83 | <?php |
@@ -88,21 +88,21 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @since 3.1.0 |
90 | 90 | */ |
91 | - do_action( 'login_enqueue_scripts' ); |
|
91 | + do_action('login_enqueue_scripts'); |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Fires in the login page header after scripts are enqueued. |
95 | 95 | * |
96 | 96 | * @since 2.1.0 |
97 | 97 | */ |
98 | - do_action( 'login_head' ); |
|
98 | + do_action('login_head'); |
|
99 | 99 | |
100 | - if ( is_multisite() ) { |
|
100 | + if (is_multisite()) { |
|
101 | 101 | $login_header_url = network_home_url(); |
102 | 102 | $login_header_title = get_current_site()->site_name; |
103 | 103 | } else { |
104 | - $login_header_url = __( 'https://wordpress.org/' ); |
|
105 | - $login_header_title = __( 'Powered by WordPress' ); |
|
104 | + $login_header_url = __('https://wordpress.org/'); |
|
105 | + $login_header_title = __('Powered by WordPress'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param string $login_header_url Login header logo URL. |
114 | 114 | */ |
115 | - $login_header_url = apply_filters( 'login_headerurl', $login_header_url ); |
|
115 | + $login_header_url = apply_filters('login_headerurl', $login_header_url); |
|
116 | 116 | /** |
117 | 117 | * Filter the title attribute of the header logo above login form. |
118 | 118 | * |
@@ -120,23 +120,23 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param string $login_header_title Login header logo title attribute. |
122 | 122 | */ |
123 | - $login_header_title = apply_filters( 'login_headertitle', $login_header_title ); |
|
123 | + $login_header_title = apply_filters('login_headertitle', $login_header_title); |
|
124 | 124 | |
125 | - $classes = array( 'login-action-' . $action, 'wp-core-ui' ); |
|
126 | - if ( wp_is_mobile() ) |
|
125 | + $classes = array('login-action-'.$action, 'wp-core-ui'); |
|
126 | + if (wp_is_mobile()) |
|
127 | 127 | $classes[] = 'mobile'; |
128 | - if ( is_rtl() ) |
|
128 | + if (is_rtl()) |
|
129 | 129 | $classes[] = 'rtl'; |
130 | - if ( $interim_login ) { |
|
130 | + if ($interim_login) { |
|
131 | 131 | $classes[] = 'interim-login'; |
132 | 132 | ?> |
133 | 133 | <style type="text/css">html{background-color: transparent;}</style> |
134 | 134 | <?php |
135 | 135 | |
136 | - if ( 'success' === $interim_login ) |
|
136 | + if ('success' === $interim_login) |
|
137 | 137 | $classes[] = 'interim-login-success'; |
138 | 138 | } |
139 | - $classes[] =' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
|
139 | + $classes[] = ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_locale()))); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Filter the login page body classes. |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | * @param array $classes An array of body classes. |
147 | 147 | * @param string $action The action that brought the visitor to the login page. |
148 | 148 | */ |
149 | - $classes = apply_filters( 'login_body_class', $classes, $action ); |
|
149 | + $classes = apply_filters('login_body_class', $classes, $action); |
|
150 | 150 | |
151 | 151 | ?> |
152 | 152 | </head> |
153 | - <body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>"> |
|
153 | + <body class="login <?php echo esc_attr(implode(' ', $classes)); ?>"> |
|
154 | 154 | <div id="login"> |
155 | - <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1> |
|
155 | + <h1><a href="<?php echo esc_url($login_header_url); ?>" title="<?php echo esc_attr($login_header_title); ?>" tabindex="-1"><?php bloginfo('name'); ?></a></h1> |
|
156 | 156 | <?php |
157 | 157 | |
158 | - unset( $login_header_url, $login_header_title ); |
|
158 | + unset($login_header_url, $login_header_title); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Filter the message to display above the login form. |
@@ -164,29 +164,29 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @param string $message Login message text. |
166 | 166 | */ |
167 | - $message = apply_filters( 'login_message', $message ); |
|
168 | - if ( !empty( $message ) ) |
|
169 | - echo $message . "\n"; |
|
167 | + $message = apply_filters('login_message', $message); |
|
168 | + if ( ! empty($message)) |
|
169 | + echo $message."\n"; |
|
170 | 170 | |
171 | 171 | // In case a plugin uses $error rather than the $wp_errors object |
172 | - if ( !empty( $error ) ) { |
|
172 | + if ( ! empty($error)) { |
|
173 | 173 | $wp_error->add('error', $error); |
174 | 174 | unset($error); |
175 | 175 | } |
176 | 176 | |
177 | - if ( $wp_error->get_error_code() ) { |
|
177 | + if ($wp_error->get_error_code()) { |
|
178 | 178 | $errors = ''; |
179 | 179 | $messages = ''; |
180 | - foreach ( $wp_error->get_error_codes() as $code ) { |
|
181 | - $severity = $wp_error->get_error_data( $code ); |
|
182 | - foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { |
|
183 | - if ( 'message' == $severity ) |
|
184 | - $messages .= ' ' . $error_message . "<br />\n"; |
|
180 | + foreach ($wp_error->get_error_codes() as $code) { |
|
181 | + $severity = $wp_error->get_error_data($code); |
|
182 | + foreach ($wp_error->get_error_messages($code) as $error_message) { |
|
183 | + if ('message' == $severity) |
|
184 | + $messages .= ' '.$error_message."<br />\n"; |
|
185 | 185 | else |
186 | - $errors .= ' ' . $error_message . "<br />\n"; |
|
186 | + $errors .= ' '.$error_message."<br />\n"; |
|
187 | 187 | } |
188 | 188 | } |
189 | - if ( ! empty( $errors ) ) { |
|
189 | + if ( ! empty($errors)) { |
|
190 | 190 | /** |
191 | 191 | * Filter the error messages displayed above the login form. |
192 | 192 | * |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @param string $errors Login error message. |
196 | 196 | */ |
197 | - echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n"; |
|
197 | + echo '<div id="login_error">'.apply_filters('login_errors', $errors)."</div>\n"; |
|
198 | 198 | } |
199 | - if ( ! empty( $messages ) ) { |
|
199 | + if ( ! empty($messages)) { |
|
200 | 200 | /** |
201 | 201 | * Filter instructional messages displayed above the login form. |
202 | 202 | * |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @param string $messages Login messages. |
206 | 206 | */ |
207 | - echo '<p class="message">' . apply_filters( 'login_messages', $messages ) . "</p>\n"; |
|
207 | + echo '<p class="message">'.apply_filters('login_messages', $messages)."</p>\n"; |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } // End of login_header() |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | global $interim_login; |
219 | 219 | |
220 | 220 | // Don't allow interim logins to navigate away from the page. |
221 | - if ( ! $interim_login ): ?> |
|
222 | - <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php printf( __( '← Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p> |
|
221 | + if ( ! $interim_login): ?> |
|
222 | + <p id="backtoblog"><a href="<?php echo esc_url(home_url('/')); ?>"><?php printf(__('← Back to %s'), get_bloginfo('title', 'display')); ?></a></p> |
|
223 | 223 | <?php endif; ?> |
224 | 224 | |
225 | 225 | </div> |
226 | 226 | |
227 | - <?php if ( !empty($input_id) ) : ?> |
|
227 | + <?php if ( ! empty($input_id)) : ?> |
|
228 | 228 | <script type="text/javascript"> |
229 | 229 | try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} |
230 | 230 | if(typeof wpOnload=='function')wpOnload(); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @since 3.1.0 |
239 | 239 | */ |
240 | - do_action( 'login_footer' ); ?> |
|
240 | + do_action('login_footer'); ?> |
|
241 | 241 | <div class="clear"></div> |
242 | 242 | </body> |
243 | 243 | </html> |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @since 3.0.0 |
249 | 249 | */ |
250 | 250 | function wp_shake_js() { |
251 | - if ( wp_is_mobile() ) |
|
251 | + if (wp_is_mobile()) |
|
252 | 252 | return; |
253 | 253 | ?> |
254 | 254 | <script type="text/javascript"> |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | |
284 | 284 | $errors = new WP_Error(); |
285 | 285 | |
286 | - if ( empty( $_POST['user_login'] ) ) { |
|
286 | + if (empty($_POST['user_login'])) { |
|
287 | 287 | $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or email address.')); |
288 | - } elseif ( strpos( $_POST['user_login'], '@' ) ) { |
|
289 | - $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); |
|
290 | - if ( empty( $user_data ) ) |
|
288 | + } elseif (strpos($_POST['user_login'], '@')) { |
|
289 | + $user_data = get_user_by('email', trim($_POST['user_login'])); |
|
290 | + if (empty($user_data)) |
|
291 | 291 | $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); |
292 | 292 | } else { |
293 | 293 | $login = trim($_POST['user_login']); |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | * @param WP_Error $errors A WP_Error object containing any errors generated |
304 | 304 | * by using invalid credentials. |
305 | 305 | */ |
306 | - do_action( 'lostpassword_post', $errors ); |
|
306 | + do_action('lostpassword_post', $errors); |
|
307 | 307 | |
308 | - if ( $errors->get_error_code() ) |
|
308 | + if ($errors->get_error_code()) |
|
309 | 309 | return $errors; |
310 | 310 | |
311 | - if ( !$user_data ) { |
|
311 | + if ( ! $user_data) { |
|
312 | 312 | $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or email.')); |
313 | 313 | return $errors; |
314 | 314 | } |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | // Redefining user_login ensures we return the right case in the email. |
317 | 317 | $user_login = $user_data->user_login; |
318 | 318 | $user_email = $user_data->user_email; |
319 | - $key = get_password_reset_key( $user_data ); |
|
319 | + $key = get_password_reset_key($user_data); |
|
320 | 320 | |
321 | - if ( is_wp_error( $key ) ) { |
|
321 | + if (is_wp_error($key)) { |
|
322 | 322 | return $key; |
323 | 323 | } |
324 | 324 | |
325 | - $message = __('Someone has requested a password reset for the following account:') . "\r\n\r\n"; |
|
326 | - $message .= network_home_url( '/' ) . "\r\n\r\n"; |
|
327 | - $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; |
|
328 | - $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n"; |
|
329 | - $message .= __('To reset your password, visit the following address:') . "\r\n\r\n"; |
|
330 | - $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n"; |
|
325 | + $message = __('Someone has requested a password reset for the following account:')."\r\n\r\n"; |
|
326 | + $message .= network_home_url('/')."\r\n\r\n"; |
|
327 | + $message .= sprintf(__('Username: %s'), $user_login)."\r\n\r\n"; |
|
328 | + $message .= __('If this was a mistake, just ignore this email and nothing will happen.')."\r\n\r\n"; |
|
329 | + $message .= __('To reset your password, visit the following address:')."\r\n\r\n"; |
|
330 | + $message .= '<'.network_site_url("wp-login.php?action=rp&key=$key&login=".rawurlencode($user_login), 'login').">\r\n"; |
|
331 | 331 | |
332 | - if ( is_multisite() ) |
|
332 | + if (is_multisite()) |
|
333 | 333 | $blogname = $GLOBALS['current_site']->site_name; |
334 | 334 | else |
335 | 335 | /* |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
340 | 340 | |
341 | - $title = sprintf( __('[%s] Password Reset'), $blogname ); |
|
341 | + $title = sprintf(__('[%s] Password Reset'), $blogname); |
|
342 | 342 | |
343 | 343 | /** |
344 | 344 | * Filter the subject of the password reset email. |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @param string $user_login The username for the user. |
351 | 351 | * @param WP_User $user_data WP_User object. |
352 | 352 | */ |
353 | - $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); |
|
353 | + $title = apply_filters('retrieve_password_title', $title, $user_login, $user_data); |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Filter the message body of the password reset mail. |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | * @param string $user_login The username for the user. |
364 | 364 | * @param WP_User $user_data WP_User object. |
365 | 365 | */ |
366 | - $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); |
|
366 | + $message = apply_filters('retrieve_password_message', $message, $key, $user_login, $user_data); |
|
367 | 367 | |
368 | - if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) |
|
369 | - wp_die( __('The email could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') ); |
|
368 | + if ($message && ! wp_mail($user_email, wp_specialchars_decode($title), $message)) |
|
369 | + wp_die(__('The email could not be sent.')."<br />\n".__('Possible reason: your host may have disabled the mail() function.')); |
|
370 | 370 | |
371 | 371 | return true; |
372 | 372 | } |
@@ -378,38 +378,38 @@ discard block |
||
378 | 378 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
379 | 379 | $errors = new WP_Error(); |
380 | 380 | |
381 | -if ( isset($_GET['key']) ) |
|
381 | +if (isset($_GET['key'])) |
|
382 | 382 | $action = 'resetpass'; |
383 | 383 | |
384 | 384 | // validate action so as to default to the login screen |
385 | -if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) ) |
|
385 | +if ( ! in_array($action, array('postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login'), true) && false === has_filter('login_form_'.$action)) |
|
386 | 386 | $action = 'login'; |
387 | 387 | |
388 | 388 | nocache_headers(); |
389 | 389 | |
390 | 390 | header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset')); |
391 | 391 | |
392 | -if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set |
|
393 | - if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) ) |
|
394 | - $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); |
|
392 | +if (defined('RELOCATE') && RELOCATE) { // Move flag is set |
|
393 | + if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
394 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
395 | 395 | |
396 | - $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); |
|
397 | - if ( $url != get_option( 'siteurl' ) ) |
|
398 | - update_option( 'siteurl', $url ); |
|
396 | + $url = dirname(set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'])); |
|
397 | + if ($url != get_option('siteurl')) |
|
398 | + update_option('siteurl', $url); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | //Set a cookie now to see if they are supported by the browser. |
402 | -$secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); |
|
403 | -setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
404 | -if ( SITECOOKIEPATH != COOKIEPATH ) |
|
405 | - setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
402 | +$secure = ('https' === parse_url(wp_login_url(), PHP_URL_SCHEME)); |
|
403 | +setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure); |
|
404 | +if (SITECOOKIEPATH != COOKIEPATH) |
|
405 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure); |
|
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Fires when the login form is initialized. |
409 | 409 | * |
410 | 410 | * @since 3.2.0 |
411 | 411 | */ |
412 | -do_action( 'login_init' ); |
|
412 | +do_action('login_init'); |
|
413 | 413 | /** |
414 | 414 | * Fires before a specified login form action. |
415 | 415 | * |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @since 2.8.0 |
421 | 421 | */ |
422 | -do_action( 'login_form_' . $action ); |
|
422 | +do_action('login_form_'.$action); |
|
423 | 423 | |
424 | 424 | $http_post = ('POST' == $_SERVER['REQUEST_METHOD']); |
425 | 425 | $interim_login = isset($_REQUEST['interim-login']); |
@@ -427,13 +427,13 @@ discard block |
||
427 | 427 | switch ($action) { |
428 | 428 | |
429 | 429 | case 'postpass' : |
430 | - if ( ! array_key_exists( 'post_password', $_POST ) ) { |
|
431 | - wp_safe_redirect( wp_get_referer() ); |
|
430 | + if ( ! array_key_exists('post_password', $_POST)) { |
|
431 | + wp_safe_redirect(wp_get_referer()); |
|
432 | 432 | exit(); |
433 | 433 | } |
434 | 434 | |
435 | - require_once ABSPATH . WPINC . '/class-phpass.php'; |
|
436 | - $hasher = new PasswordHash( 8, true ); |
|
435 | + require_once ABSPATH.WPINC.'/class-phpass.php'; |
|
436 | + $hasher = new PasswordHash(8, true); |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * Filter the life span of the post password cookie. |
@@ -445,16 +445,16 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @param int $expires The expiry time, as passed to setcookie(). |
447 | 447 | */ |
448 | - $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); |
|
448 | + $expire = apply_filters('post_password_expires', time() + 10 * DAY_IN_SECONDS); |
|
449 | 449 | $referer = wp_get_referer(); |
450 | - if ( $referer ) { |
|
451 | - $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); |
|
450 | + if ($referer) { |
|
451 | + $secure = ('https' === parse_url($referer, PHP_URL_SCHEME)); |
|
452 | 452 | } else { |
453 | 453 | $secure = false; |
454 | 454 | } |
455 | - setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
455 | + setcookie('wp-postpass_'.COOKIEHASH, $hasher->HashPassword(wp_unslash($_POST['post_password'])), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure); |
|
456 | 456 | |
457 | - wp_safe_redirect( wp_get_referer() ); |
|
457 | + wp_safe_redirect(wp_get_referer()); |
|
458 | 458 | exit(); |
459 | 459 | |
460 | 460 | case 'logout' : |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | wp_logout(); |
466 | 466 | |
467 | - if ( ! empty( $_REQUEST['redirect_to'] ) ) { |
|
467 | + if ( ! empty($_REQUEST['redirect_to'])) { |
|
468 | 468 | $redirect_to = $requested_redirect_to = $_REQUEST['redirect_to']; |
469 | 469 | } else { |
470 | 470 | $redirect_to = 'wp-login.php?loggedout=true'; |
@@ -480,31 +480,31 @@ discard block |
||
480 | 480 | * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
481 | 481 | * @param WP_User $user The WP_User object for the user that's logging out. |
482 | 482 | */ |
483 | - $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
484 | - wp_safe_redirect( $redirect_to ); |
|
483 | + $redirect_to = apply_filters('logout_redirect', $redirect_to, $requested_redirect_to, $user); |
|
484 | + wp_safe_redirect($redirect_to); |
|
485 | 485 | exit(); |
486 | 486 | |
487 | 487 | case 'lostpassword' : |
488 | 488 | case 'retrievepassword' : |
489 | 489 | |
490 | - if ( $http_post ) { |
|
490 | + if ($http_post) { |
|
491 | 491 | $errors = retrieve_password(); |
492 | - if ( !is_wp_error($errors) ) { |
|
493 | - $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
|
494 | - wp_safe_redirect( $redirect_to ); |
|
492 | + if ( ! is_wp_error($errors)) { |
|
493 | + $redirect_to = ! empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
|
494 | + wp_safe_redirect($redirect_to); |
|
495 | 495 | exit(); |
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
499 | - if ( isset( $_GET['error'] ) ) { |
|
500 | - if ( 'invalidkey' == $_GET['error'] ) { |
|
501 | - $errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) ); |
|
502 | - } elseif ( 'expiredkey' == $_GET['error'] ) { |
|
503 | - $errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) ); |
|
499 | + if (isset($_GET['error'])) { |
|
500 | + if ('invalidkey' == $_GET['error']) { |
|
501 | + $errors->add('invalidkey', __('Your password reset link appears to be invalid. Please request a new link below.')); |
|
502 | + } elseif ('expiredkey' == $_GET['error']) { |
|
503 | + $errors->add('expiredkey', __('Your password reset link has expired. Please request a new link below.')); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
507 | - $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
507 | + $lostpassword_redirect = ! empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''; |
|
508 | 508 | /** |
509 | 509 | * Filter the URL redirected to after submitting the lostpassword/retrievepassword form. |
510 | 510 | * |
@@ -512,22 +512,22 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @param string $lostpassword_redirect The redirect destination URL. |
514 | 514 | */ |
515 | - $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect ); |
|
515 | + $redirect_to = apply_filters('lostpassword_redirect', $lostpassword_redirect); |
|
516 | 516 | |
517 | 517 | /** |
518 | 518 | * Fires before the lost password form. |
519 | 519 | * |
520 | 520 | * @since 1.5.1 |
521 | 521 | */ |
522 | - do_action( 'lost_password' ); |
|
522 | + do_action('lost_password'); |
|
523 | 523 | |
524 | - login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors); |
|
524 | + login_header(__('Lost Password'), '<p class="message">'.__('Please enter your username or email address. You will receive a link to create a new password via email.').'</p>', $errors); |
|
525 | 525 | |
526 | 526 | $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; |
527 | 527 | |
528 | 528 | ?> |
529 | 529 | |
530 | -<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> |
|
530 | +<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url(network_site_url('wp-login.php?action=lostpassword', 'login_post')); ?>" method="post"> |
|
531 | 531 | <p> |
532 | 532 | <label for="user_login" ><?php _e('Username or Email') ?><br /> |
533 | 533 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> |
@@ -538,19 +538,19 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @since 2.1.0 |
540 | 540 | */ |
541 | - do_action( 'lostpassword_form' ); ?> |
|
542 | - <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
541 | + do_action('lostpassword_form'); ?> |
|
542 | + <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> |
|
543 | 543 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password'); ?>" /></p> |
544 | 544 | </form> |
545 | 545 | |
546 | 546 | <p id="nav"> |
547 | -<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a> |
|
547 | +<a href="<?php echo esc_url(wp_login_url()); ?>"><?php _e('Log in') ?></a> |
|
548 | 548 | <?php |
549 | -if ( get_option( 'users_can_register' ) ) : |
|
550 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
549 | +if (get_option('users_can_register')) : |
|
550 | + $registration_url = sprintf('<a href="%s">%s</a>', esc_url(wp_registration_url()), __('Register')); |
|
551 | 551 | |
552 | 552 | /** This filter is documented in wp-includes/general-template.php */ |
553 | - echo ' | ' . apply_filters( 'register', $registration_url ); |
|
553 | + echo ' | '.apply_filters('register', $registration_url); |
|
554 | 554 | endif; |
555 | 555 | ?> |
556 | 556 | </p> |
@@ -561,38 +561,38 @@ discard block |
||
561 | 561 | |
562 | 562 | case 'resetpass' : |
563 | 563 | case 'rp' : |
564 | - list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
565 | - $rp_cookie = 'wp-resetpass-' . COOKIEHASH; |
|
566 | - if ( isset( $_GET['key'] ) ) { |
|
567 | - $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); |
|
568 | - setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
569 | - wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); |
|
564 | + list($rp_path) = explode('?', wp_unslash($_SERVER['REQUEST_URI'])); |
|
565 | + $rp_cookie = 'wp-resetpass-'.COOKIEHASH; |
|
566 | + if (isset($_GET['key'])) { |
|
567 | + $value = sprintf('%s:%s', wp_unslash($_GET['login']), wp_unslash($_GET['key'])); |
|
568 | + setcookie($rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true); |
|
569 | + wp_safe_redirect(remove_query_arg(array('key', 'login'))); |
|
570 | 570 | exit; |
571 | 571 | } |
572 | 572 | |
573 | - if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { |
|
574 | - list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); |
|
575 | - $user = check_password_reset_key( $rp_key, $rp_login ); |
|
576 | - if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { |
|
573 | + if (isset($_COOKIE[$rp_cookie]) && 0 < strpos($_COOKIE[$rp_cookie], ':')) { |
|
574 | + list($rp_login, $rp_key) = explode(':', wp_unslash($_COOKIE[$rp_cookie]), 2); |
|
575 | + $user = check_password_reset_key($rp_key, $rp_login); |
|
576 | + if (isset($_POST['pass1']) && ! hash_equals($rp_key, $_POST['rp_key'])) { |
|
577 | 577 | $user = false; |
578 | 578 | } |
579 | 579 | } else { |
580 | 580 | $user = false; |
581 | 581 | } |
582 | 582 | |
583 | - if ( ! $user || is_wp_error( $user ) ) { |
|
584 | - setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
585 | - if ( $user && $user->get_error_code() === 'expired_key' ) |
|
586 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
583 | + if ( ! $user || is_wp_error($user)) { |
|
584 | + setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true); |
|
585 | + if ($user && $user->get_error_code() === 'expired_key') |
|
586 | + wp_redirect(site_url('wp-login.php?action=lostpassword&error=expiredkey')); |
|
587 | 587 | else |
588 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
588 | + wp_redirect(site_url('wp-login.php?action=lostpassword&error=invalidkey')); |
|
589 | 589 | exit; |
590 | 590 | } |
591 | 591 | |
592 | 592 | $errors = new WP_Error(); |
593 | 593 | |
594 | - if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) |
|
595 | - $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) ); |
|
594 | + if (isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2']) |
|
595 | + $errors->add('password_reset_mismatch', __('The passwords do not match.')); |
|
596 | 596 | |
597 | 597 | /** |
598 | 598 | * Fires before the password reset procedure is validated. |
@@ -602,12 +602,12 @@ discard block |
||
602 | 602 | * @param object $errors WP Error object. |
603 | 603 | * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise. |
604 | 604 | */ |
605 | - do_action( 'validate_password_reset', $errors, $user ); |
|
605 | + do_action('validate_password_reset', $errors, $user); |
|
606 | 606 | |
607 | - if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) { |
|
607 | + if (( ! $errors->get_error_code()) && isset($_POST['pass1']) && ! empty($_POST['pass1'])) { |
|
608 | 608 | reset_password($user, $_POST['pass1']); |
609 | - setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
610 | - login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' ); |
|
609 | + setcookie($rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true); |
|
610 | + login_header(__('Password Reset'), '<p class="message reset-pass">'.__('Your password has been reset.').' <a href="'.esc_url(wp_login_url()).'">'.__('Log in').'</a></p>'); |
|
611 | 611 | login_footer(); |
612 | 612 | exit; |
613 | 613 | } |
@@ -615,27 +615,27 @@ discard block |
||
615 | 615 | wp_enqueue_script('utils'); |
616 | 616 | wp_enqueue_script('user-profile'); |
617 | 617 | |
618 | - login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); |
|
618 | + login_header(__('Reset Password'), '<p class="message reset-pass">'.__('Enter your new password below.').'</p>', $errors); |
|
619 | 619 | |
620 | 620 | ?> |
621 | -<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
|
622 | - <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> |
|
621 | +<form name="resetpassform" id="resetpassform" action="<?php echo esc_url(network_site_url('wp-login.php?action=resetpass', 'login_post')); ?>" method="post" autocomplete="off"> |
|
622 | + <input type="hidden" id="user_login" value="<?php echo esc_attr($rp_login); ?>" autocomplete="off" /> |
|
623 | 623 | |
624 | 624 | <div class="user-pass1-wrap"> |
625 | 625 | <p> |
626 | - <label for="pass1"><?php _e( 'New password' ) ?></label> |
|
626 | + <label for="pass1"><?php _e('New password') ?></label> |
|
627 | 627 | </p> |
628 | 628 | |
629 | 629 | <div class="wp-pwd"> |
630 | 630 | <span class="password-input-wrapper"> |
631 | - <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" /> |
|
631 | + <input type="password" data-reveal="1" data-pw="<?php echo esc_attr(wp_generate_password(16)); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" /> |
|
632 | 632 | </span> |
633 | - <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> |
|
633 | + <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e('Strength indicator'); ?></div> |
|
634 | 634 | </div> |
635 | 635 | </div> |
636 | 636 | |
637 | 637 | <p class="user-pass2-wrap"> |
638 | - <label for="pass2"><?php _e( 'Confirm new password' ) ?></label><br /> |
|
638 | + <label for="pass2"><?php _e('Confirm new password') ?></label><br /> |
|
639 | 639 | <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /> |
640 | 640 | </p> |
641 | 641 | |
@@ -650,20 +650,20 @@ discard block |
||
650 | 650 | * |
651 | 651 | * @param WP_User $user User object of the user whose password is being reset. |
652 | 652 | */ |
653 | - do_action( 'resetpass_form', $user ); |
|
653 | + do_action('resetpass_form', $user); |
|
654 | 654 | ?> |
655 | - <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
|
655 | + <input type="hidden" name="rp_key" value="<?php echo esc_attr($rp_key); ?>" /> |
|
656 | 656 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p> |
657 | 657 | </form> |
658 | 658 | |
659 | 659 | <p id="nav"> |
660 | -<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
|
660 | +<a href="<?php echo esc_url(wp_login_url()); ?>"><?php _e('Log in'); ?></a> |
|
661 | 661 | <?php |
662 | -if ( get_option( 'users_can_register' ) ) : |
|
663 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
662 | +if (get_option('users_can_register')) : |
|
663 | + $registration_url = sprintf('<a href="%s">%s</a>', esc_url(wp_registration_url()), __('Register')); |
|
664 | 664 | |
665 | 665 | /** This filter is documented in wp-includes/general-template.php */ |
666 | - echo ' | ' . apply_filters( 'register', $registration_url ); |
|
666 | + echo ' | '.apply_filters('register', $registration_url); |
|
667 | 667 | endif; |
668 | 668 | ?> |
669 | 669 | </p> |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | break; |
674 | 674 | |
675 | 675 | case 'register' : |
676 | - if ( is_multisite() ) { |
|
676 | + if (is_multisite()) { |
|
677 | 677 | /** |
678 | 678 | * Filter the Multisite sign up URL. |
679 | 679 | * |
@@ -681,29 +681,29 @@ discard block |
||
681 | 681 | * |
682 | 682 | * @param string $sign_up_url The sign up URL. |
683 | 683 | */ |
684 | - wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) ); |
|
684 | + wp_redirect(apply_filters('wp_signup_location', network_site_url('wp-signup.php'))); |
|
685 | 685 | exit; |
686 | 686 | } |
687 | 687 | |
688 | - if ( !get_option('users_can_register') ) { |
|
689 | - wp_redirect( site_url('wp-login.php?registration=disabled') ); |
|
688 | + if ( ! get_option('users_can_register')) { |
|
689 | + wp_redirect(site_url('wp-login.php?registration=disabled')); |
|
690 | 690 | exit(); |
691 | 691 | } |
692 | 692 | |
693 | 693 | $user_login = ''; |
694 | 694 | $user_email = ''; |
695 | - if ( $http_post ) { |
|
696 | - $user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : ''; |
|
697 | - $user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : ''; |
|
695 | + if ($http_post) { |
|
696 | + $user_login = isset($_POST['user_login']) ? $_POST['user_login'] : ''; |
|
697 | + $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
698 | 698 | $errors = register_new_user($user_login, $user_email); |
699 | - if ( !is_wp_error($errors) ) { |
|
700 | - $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
|
701 | - wp_safe_redirect( $redirect_to ); |
|
699 | + if ( ! is_wp_error($errors)) { |
|
700 | + $redirect_to = ! empty($_POST['redirect_to']) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
|
701 | + wp_safe_redirect($redirect_to); |
|
702 | 702 | exit(); |
703 | 703 | } |
704 | 704 | } |
705 | 705 | |
706 | - $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
706 | + $registration_redirect = ! empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''; |
|
707 | 707 | /** |
708 | 708 | * Filter the registration redirect URL. |
709 | 709 | * |
@@ -711,17 +711,17 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @param string $registration_redirect The redirect destination URL. |
713 | 713 | */ |
714 | - $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); |
|
715 | - login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors); |
|
714 | + $redirect_to = apply_filters('registration_redirect', $registration_redirect); |
|
715 | + login_header(__('Registration Form'), '<p class="message register">'.__('Register For This Site').'</p>', $errors); |
|
716 | 716 | ?> |
717 | -<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
|
717 | +<form name="registerform" id="registerform" action="<?php echo esc_url(site_url('wp-login.php?action=register', 'login_post')); ?>" method="post" novalidate="novalidate"> |
|
718 | 718 | <p> |
719 | 719 | <label for="user_login"><?php _e('Username') ?><br /> |
720 | 720 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label> |
721 | 721 | </p> |
722 | 722 | <p> |
723 | 723 | <label for="user_email"><?php _e('Email') ?><br /> |
724 | - <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label> |
|
724 | + <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(wp_unslash($user_email)); ?>" size="25" /></label> |
|
725 | 725 | </p> |
726 | 726 | <?php |
727 | 727 | /** |
@@ -729,17 +729,17 @@ discard block |
||
729 | 729 | * |
730 | 730 | * @since 2.1.0 |
731 | 731 | */ |
732 | - do_action( 'register_form' ); |
|
732 | + do_action('register_form'); |
|
733 | 733 | ?> |
734 | - <p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.' ); ?></p> |
|
734 | + <p id="reg_passmail"><?php _e('Registration confirmation will be emailed to you.'); ?></p> |
|
735 | 735 | <br class="clear" /> |
736 | - <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
736 | + <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> |
|
737 | 737 | <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register'); ?>" /></p> |
738 | 738 | </form> |
739 | 739 | |
740 | 740 | <p id="nav"> |
741 | -<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> | |
|
742 | -<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
|
741 | +<a href="<?php echo esc_url(wp_login_url()); ?>"><?php _e('Log in'); ?></a> | |
|
742 | +<a href="<?php echo esc_url(wp_lostpassword_url()); ?>"><?php _e('Lost your password?'); ?></a> |
|
743 | 743 | </p> |
744 | 744 | |
745 | 745 | <?php |
@@ -749,31 +749,31 @@ discard block |
||
749 | 749 | case 'login' : |
750 | 750 | default: |
751 | 751 | $secure_cookie = ''; |
752 | - $customize_login = isset( $_REQUEST['customize-login'] ); |
|
753 | - if ( $customize_login ) |
|
754 | - wp_enqueue_script( 'customize-base' ); |
|
752 | + $customize_login = isset($_REQUEST['customize-login']); |
|
753 | + if ($customize_login) |
|
754 | + wp_enqueue_script('customize-base'); |
|
755 | 755 | |
756 | 756 | // If the user wants ssl but the session is not ssl, force a secure cookie. |
757 | - if ( !empty($_POST['log']) && !force_ssl_admin() ) { |
|
757 | + if ( ! empty($_POST['log']) && ! force_ssl_admin()) { |
|
758 | 758 | $user_name = sanitize_user($_POST['log']); |
759 | - $user = get_user_by( 'login', $user_name ); |
|
759 | + $user = get_user_by('login', $user_name); |
|
760 | 760 | |
761 | - if ( ! $user && strpos( $user_name, '@' ) ) { |
|
762 | - $user = get_user_by( 'email', $user_name ); |
|
761 | + if ( ! $user && strpos($user_name, '@')) { |
|
762 | + $user = get_user_by('email', $user_name); |
|
763 | 763 | } |
764 | 764 | |
765 | - if ( $user ) { |
|
766 | - if ( get_user_option('use_ssl', $user->ID) ) { |
|
765 | + if ($user) { |
|
766 | + if (get_user_option('use_ssl', $user->ID)) { |
|
767 | 767 | $secure_cookie = true; |
768 | 768 | force_ssl_admin(true); |
769 | 769 | } |
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
773 | - if ( isset( $_REQUEST['redirect_to'] ) ) { |
|
773 | + if (isset($_REQUEST['redirect_to'])) { |
|
774 | 774 | $redirect_to = $_REQUEST['redirect_to']; |
775 | 775 | // Redirect to https if user wants ssl |
776 | - if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) |
|
776 | + if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
777 | 777 | $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
778 | 778 | } else { |
779 | 779 | $redirect_to = admin_url(); |
@@ -781,20 +781,20 @@ discard block |
||
781 | 781 | |
782 | 782 | $reauth = empty($_REQUEST['reauth']) ? false : true; |
783 | 783 | |
784 | - $user = wp_signon( '', $secure_cookie ); |
|
784 | + $user = wp_signon('', $secure_cookie); |
|
785 | 785 | |
786 | - if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { |
|
787 | - if ( headers_sent() ) { |
|
788 | - $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), |
|
789 | - __( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) ); |
|
790 | - } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) { |
|
786 | + if (empty($_COOKIE[LOGGED_IN_COOKIE])) { |
|
787 | + if (headers_sent()) { |
|
788 | + $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.'), |
|
789 | + __('https://codex.wordpress.org/Cookies'), __('https://wordpress.org/support/'))); |
|
790 | + } elseif (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) { |
|
791 | 791 | // If cookies are disabled we can't log in even with a valid user+pass |
792 | - $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), |
|
793 | - __( 'https://codex.wordpress.org/Cookies' ) ) ); |
|
792 | + $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.'), |
|
793 | + __('https://codex.wordpress.org/Cookies'))); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | - $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
|
797 | + $requested_redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''; |
|
798 | 798 | /** |
799 | 799 | * Filter the login redirect URL. |
800 | 800 | * |
@@ -804,34 +804,34 @@ discard block |
||
804 | 804 | * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
805 | 805 | * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
806 | 806 | */ |
807 | - $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
807 | + $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user); |
|
808 | 808 | |
809 | - if ( !is_wp_error($user) && !$reauth ) { |
|
810 | - if ( $interim_login ) { |
|
811 | - $message = '<p class="message">' . __('You have logged in successfully.') . '</p>'; |
|
809 | + if ( ! is_wp_error($user) && ! $reauth) { |
|
810 | + if ($interim_login) { |
|
811 | + $message = '<p class="message">'.__('You have logged in successfully.').'</p>'; |
|
812 | 812 | $interim_login = 'success'; |
813 | - login_header( '', $message ); ?> |
|
813 | + login_header('', $message); ?> |
|
814 | 814 | </div> |
815 | 815 | <?php |
816 | 816 | /** This action is documented in wp-login.php */ |
817 | - do_action( 'login_footer' ); ?> |
|
818 | - <?php if ( $customize_login ) : ?> |
|
817 | + do_action('login_footer'); ?> |
|
818 | + <?php if ($customize_login) : ?> |
|
819 | 819 | <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> |
820 | 820 | <?php endif; ?> |
821 | 821 | </body></html> |
822 | 822 | <?php exit; |
823 | 823 | } |
824 | 824 | |
825 | - if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { |
|
825 | + if ((empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url())) { |
|
826 | 826 | // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. |
827 | - if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) ) |
|
827 | + if (is_multisite() && ! get_active_blog_for_user($user->ID) && ! is_super_admin($user->ID)) |
|
828 | 828 | $redirect_to = user_admin_url(); |
829 | - elseif ( is_multisite() && !$user->has_cap('read') ) |
|
830 | - $redirect_to = get_dashboard_url( $user->ID ); |
|
831 | - elseif ( !$user->has_cap('edit_posts') ) |
|
832 | - $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
829 | + elseif (is_multisite() && ! $user->has_cap('read')) |
|
830 | + $redirect_to = get_dashboard_url($user->ID); |
|
831 | + elseif ( ! $user->has_cap('edit_posts')) |
|
832 | + $redirect_to = $user->has_cap('read') ? admin_url('profile.php') : home_url(); |
|
833 | 833 | |
834 | - wp_redirect( $redirect_to ); |
|
834 | + wp_redirect($redirect_to); |
|
835 | 835 | exit(); |
836 | 836 | } |
837 | 837 | wp_safe_redirect($redirect_to); |
@@ -840,26 +840,26 @@ discard block |
||
840 | 840 | |
841 | 841 | $errors = $user; |
842 | 842 | // Clear errors if loggedout is set. |
843 | - if ( !empty($_GET['loggedout']) || $reauth ) |
|
843 | + if ( ! empty($_GET['loggedout']) || $reauth) |
|
844 | 844 | $errors = new WP_Error(); |
845 | 845 | |
846 | - if ( $interim_login ) { |
|
847 | - if ( ! $errors->get_error_code() ) |
|
848 | - $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
846 | + if ($interim_login) { |
|
847 | + if ( ! $errors->get_error_code()) |
|
848 | + $errors->add('expired', __('Your session has expired. Please log in to continue where you left off.'), 'message'); |
|
849 | 849 | } else { |
850 | 850 | // Some parts of this script use the main login form to display a message |
851 | - if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) |
|
851 | + if (isset($_GET['loggedout']) && true == $_GET['loggedout']) |
|
852 | 852 | $errors->add('loggedout', __('You are now logged out.'), 'message'); |
853 | - elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) |
|
853 | + elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) |
|
854 | 854 | $errors->add('registerdisabled', __('User registration is currently not allowed.')); |
855 | - elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) |
|
855 | + elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) |
|
856 | 856 | $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); |
857 | - elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) |
|
857 | + elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) |
|
858 | 858 | $errors->add('newpass', __('Check your email for your new password.'), 'message'); |
859 | - elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) |
|
859 | + elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) |
|
860 | 860 | $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); |
861 | - elseif ( strpos( $redirect_to, 'about.php?updated' ) ) |
|
862 | - $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
|
861 | + elseif (strpos($redirect_to, 'about.php?updated')) |
|
862 | + $errors->add('updated', __('<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.'), 'message'); |
|
863 | 863 | } |
864 | 864 | |
865 | 865 | /** |
@@ -870,29 +870,29 @@ discard block |
||
870 | 870 | * @param object $errors WP Error object. |
871 | 871 | * @param string $redirect_to Redirect destination URL. |
872 | 872 | */ |
873 | - $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
|
873 | + $errors = apply_filters('wp_login_errors', $errors, $redirect_to); |
|
874 | 874 | |
875 | 875 | // Clear any stale cookies. |
876 | - if ( $reauth ) |
|
876 | + if ($reauth) |
|
877 | 877 | wp_clear_auth_cookie(); |
878 | 878 | |
879 | 879 | login_header(__('Log In'), '', $errors); |
880 | 880 | |
881 | - if ( isset($_POST['log']) ) |
|
882 | - $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
883 | - $rememberme = ! empty( $_POST['rememberme'] ); |
|
881 | + if (isset($_POST['log'])) |
|
882 | + $user_login = ('incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code()) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
883 | + $rememberme = ! empty($_POST['rememberme']); |
|
884 | 884 | |
885 | - if ( ! empty( $errors->errors ) ) { |
|
885 | + if ( ! empty($errors->errors)) { |
|
886 | 886 | $aria_describedby_error = ' aria-describedby="login_error"'; |
887 | 887 | } else { |
888 | 888 | $aria_describedby_error = ''; |
889 | 889 | } |
890 | 890 | ?> |
891 | 891 | |
892 | -<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
|
892 | +<form name="loginform" id="loginform" action="<?php echo esc_url(site_url('wp-login.php', 'login_post')); ?>" method="post"> |
|
893 | 893 | <p> |
894 | 894 | <label for="user_login"><?php _e('Username or Email') ?><br /> |
895 | - <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label> |
|
895 | + <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> |
|
896 | 896 | </p> |
897 | 897 | <p> |
898 | 898 | <label for="user_pass"><?php _e('Password') ?><br /> |
@@ -904,34 +904,34 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @since 2.1.0 |
906 | 906 | */ |
907 | - do_action( 'login_form' ); |
|
907 | + do_action('login_form'); |
|
908 | 908 | ?> |
909 | - <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> |
|
909 | + <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked($rememberme); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> |
|
910 | 910 | <p class="submit"> |
911 | 911 | <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" /> |
912 | -<?php if ( $interim_login ) { ?> |
|
912 | +<?php if ($interim_login) { ?> |
|
913 | 913 | <input type="hidden" name="interim-login" value="1" /> |
914 | 914 | <?php } else { ?> |
915 | 915 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> |
916 | 916 | <?php } ?> |
917 | -<?php if ( $customize_login ) : ?> |
|
917 | +<?php if ($customize_login) : ?> |
|
918 | 918 | <input type="hidden" name="customize-login" value="1" /> |
919 | 919 | <?php endif; ?> |
920 | 920 | <input type="hidden" name="testcookie" value="1" /> |
921 | 921 | </p> |
922 | 922 | </form> |
923 | 923 | |
924 | -<?php if ( ! $interim_login ) { ?> |
|
924 | +<?php if ( ! $interim_login) { ?> |
|
925 | 925 | <p id="nav"> |
926 | -<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : |
|
927 | - if ( get_option( 'users_can_register' ) ) : |
|
928 | - $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
|
926 | +<?php if ( ! isset($_GET['checkemail']) || ! in_array($_GET['checkemail'], array('confirm', 'newpass'))) : |
|
927 | + if (get_option('users_can_register')) : |
|
928 | + $registration_url = sprintf('<a href="%s">%s</a>', esc_url(wp_registration_url()), __('Register')); |
|
929 | 929 | |
930 | 930 | /** This filter is documented in wp-includes/general-template.php */ |
931 | - echo apply_filters( 'register', $registration_url ) . ' | '; |
|
931 | + echo apply_filters('register', $registration_url).' | '; |
|
932 | 932 | endif; |
933 | 933 | ?> |
934 | - <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
|
934 | + <a href="<?php echo esc_url(wp_lostpassword_url()); ?>"><?php _e('Lost your password?'); ?></a> |
|
935 | 935 | <?php endif; ?> |
936 | 936 | </p> |
937 | 937 | <?php } ?> |
@@ -939,12 +939,12 @@ discard block |
||
939 | 939 | <script type="text/javascript"> |
940 | 940 | function wp_attempt_focus(){ |
941 | 941 | setTimeout( function(){ try{ |
942 | -<?php if ( $user_login ) { ?> |
|
942 | +<?php if ($user_login) { ?> |
|
943 | 943 | d = document.getElementById('user_pass'); |
944 | 944 | d.value = ''; |
945 | 945 | <?php } else { ?> |
946 | 946 | d = document.getElementById('user_login'); |
947 | -<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> |
|
947 | +<?php if ('invalid_username' == $errors->get_error_code()) { ?> |
|
948 | 948 | if( d.value != '' ) |
949 | 949 | d.value = ''; |
950 | 950 | <?php |
@@ -956,11 +956,11 @@ discard block |
||
956 | 956 | }, 200); |
957 | 957 | } |
958 | 958 | |
959 | -<?php if ( !$error ) { ?> |
|
959 | +<?php if ( ! $error) { ?> |
|
960 | 960 | wp_attempt_focus(); |
961 | 961 | <?php } ?> |
962 | 962 | if(typeof wpOnload=='function')wpOnload(); |
963 | -<?php if ( $interim_login ) { ?> |
|
963 | +<?php if ($interim_login) { ?> |
|
964 | 964 | (function(){ |
965 | 965 | try { |
966 | 966 | var i, links = document.getElementsByTagName('a'); |
@@ -36,11 +36,13 @@ discard block |
||
36 | 36 | // Don't index any of these forms |
37 | 37 | add_action( 'login_head', 'wp_no_robots' ); |
38 | 38 | |
39 | - if ( wp_is_mobile() ) |
|
40 | - add_action( 'login_head', 'wp_login_viewport_meta' ); |
|
39 | + if ( wp_is_mobile() ) { |
|
40 | + add_action( 'login_head', 'wp_login_viewport_meta' ); |
|
41 | + } |
|
41 | 42 | |
42 | - if ( empty($wp_error) ) |
|
43 | - $wp_error = new WP_Error(); |
|
43 | + if ( empty($wp_error) ) { |
|
44 | + $wp_error = new WP_Error(); |
|
45 | + } |
|
44 | 46 | |
45 | 47 | // Shake it! |
46 | 48 | $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' ); |
@@ -53,8 +55,9 @@ discard block |
||
53 | 55 | */ |
54 | 56 | $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
55 | 57 | |
56 | - if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) |
|
57 | - add_action( 'login_head', 'wp_shake_js', 12 ); |
|
58 | + if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) { |
|
59 | + add_action( 'login_head', 'wp_shake_js', 12 ); |
|
60 | + } |
|
58 | 61 | |
59 | 62 | $separator = is_rtl() ? ' › ' : ' ‹ '; |
60 | 63 | |
@@ -123,18 +126,21 @@ discard block |
||
123 | 126 | $login_header_title = apply_filters( 'login_headertitle', $login_header_title ); |
124 | 127 | |
125 | 128 | $classes = array( 'login-action-' . $action, 'wp-core-ui' ); |
126 | - if ( wp_is_mobile() ) |
|
127 | - $classes[] = 'mobile'; |
|
128 | - if ( is_rtl() ) |
|
129 | - $classes[] = 'rtl'; |
|
129 | + if ( wp_is_mobile() ) { |
|
130 | + $classes[] = 'mobile'; |
|
131 | + } |
|
132 | + if ( is_rtl() ) { |
|
133 | + $classes[] = 'rtl'; |
|
134 | + } |
|
130 | 135 | if ( $interim_login ) { |
131 | 136 | $classes[] = 'interim-login'; |
132 | 137 | ?> |
133 | 138 | <style type="text/css">html{background-color: transparent;}</style> |
134 | 139 | <?php |
135 | 140 | |
136 | - if ( 'success' === $interim_login ) |
|
137 | - $classes[] = 'interim-login-success'; |
|
141 | + if ( 'success' === $interim_login ) { |
|
142 | + $classes[] = 'interim-login-success'; |
|
143 | + } |
|
138 | 144 | } |
139 | 145 | $classes[] =' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
140 | 146 | |
@@ -165,8 +171,9 @@ discard block |
||
165 | 171 | * @param string $message Login message text. |
166 | 172 | */ |
167 | 173 | $message = apply_filters( 'login_message', $message ); |
168 | - if ( !empty( $message ) ) |
|
169 | - echo $message . "\n"; |
|
174 | + if ( !empty( $message ) ) { |
|
175 | + echo $message . "\n"; |
|
176 | + } |
|
170 | 177 | |
171 | 178 | // In case a plugin uses $error rather than the $wp_errors object |
172 | 179 | if ( !empty( $error ) ) { |
@@ -180,10 +187,11 @@ discard block |
||
180 | 187 | foreach ( $wp_error->get_error_codes() as $code ) { |
181 | 188 | $severity = $wp_error->get_error_data( $code ); |
182 | 189 | foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { |
183 | - if ( 'message' == $severity ) |
|
184 | - $messages .= ' ' . $error_message . "<br />\n"; |
|
185 | - else |
|
186 | - $errors .= ' ' . $error_message . "<br />\n"; |
|
190 | + if ( 'message' == $severity ) { |
|
191 | + $messages .= ' ' . $error_message . "<br />\n"; |
|
192 | + } else { |
|
193 | + $errors .= ' ' . $error_message . "<br />\n"; |
|
194 | + } |
|
187 | 195 | } |
188 | 196 | } |
189 | 197 | if ( ! empty( $errors ) ) { |
@@ -248,9 +256,10 @@ discard block |
||
248 | 256 | * @since 3.0.0 |
249 | 257 | */ |
250 | 258 | function wp_shake_js() { |
251 | - if ( wp_is_mobile() ) |
|
252 | - return; |
|
253 | -?> |
|
259 | + if ( wp_is_mobile() ) { |
|
260 | + return; |
|
261 | + } |
|
262 | + ?> |
|
254 | 263 | <script type="text/javascript"> |
255 | 264 | 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();}}}; |
256 | 265 | function s(id,pos){g(id).left=pos+'px';} |
@@ -287,8 +296,9 @@ discard block |
||
287 | 296 | $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or email address.')); |
288 | 297 | } elseif ( strpos( $_POST['user_login'], '@' ) ) { |
289 | 298 | $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) ); |
290 | - if ( empty( $user_data ) ) |
|
291 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); |
|
299 | + if ( empty( $user_data ) ) { |
|
300 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); |
|
301 | + } |
|
292 | 302 | } else { |
293 | 303 | $login = trim($_POST['user_login']); |
294 | 304 | $user_data = get_user_by('login', $login); |
@@ -305,8 +315,9 @@ discard block |
||
305 | 315 | */ |
306 | 316 | do_action( 'lostpassword_post', $errors ); |
307 | 317 | |
308 | - if ( $errors->get_error_code() ) |
|
309 | - return $errors; |
|
318 | + if ( $errors->get_error_code() ) { |
|
319 | + return $errors; |
|
320 | + } |
|
310 | 321 | |
311 | 322 | if ( !$user_data ) { |
312 | 323 | $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or email.')); |
@@ -329,14 +340,15 @@ discard block |
||
329 | 340 | $message .= __('To reset your password, visit the following address:') . "\r\n\r\n"; |
330 | 341 | $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n"; |
331 | 342 | |
332 | - if ( is_multisite() ) |
|
333 | - $blogname = $GLOBALS['current_site']->site_name; |
|
334 | - else |
|
335 | - /* |
|
343 | + if ( is_multisite() ) { |
|
344 | + $blogname = $GLOBALS['current_site']->site_name; |
|
345 | + } else { |
|
346 | + /* |
|
336 | 347 | * The blogname option is escaped with esc_html on the way into the database |
337 | 348 | * in sanitize_option we want to reverse this for the plain text arena of emails. |
338 | 349 | */ |
339 | 350 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
351 | + } |
|
340 | 352 | |
341 | 353 | $title = sprintf( __('[%s] Password Reset'), $blogname ); |
342 | 354 | |
@@ -365,8 +377,9 @@ discard block |
||
365 | 377 | */ |
366 | 378 | $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); |
367 | 379 | |
368 | - if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) |
|
369 | - wp_die( __('The email could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') ); |
|
380 | + if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) { |
|
381 | + wp_die( __('The email could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') ); |
|
382 | + } |
|
370 | 383 | |
371 | 384 | return true; |
372 | 385 | } |
@@ -378,31 +391,36 @@ discard block |
||
378 | 391 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
379 | 392 | $errors = new WP_Error(); |
380 | 393 | |
381 | -if ( isset($_GET['key']) ) |
|
394 | +if ( isset($_GET['key']) ) { |
|
382 | 395 | $action = 'resetpass'; |
396 | +} |
|
383 | 397 | |
384 | 398 | // validate action so as to default to the login screen |
385 | -if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) ) |
|
399 | +if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) ) { |
|
386 | 400 | $action = 'login'; |
401 | +} |
|
387 | 402 | |
388 | 403 | nocache_headers(); |
389 | 404 | |
390 | 405 | header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset')); |
391 | 406 | |
392 | 407 | if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set |
393 | - if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) ) |
|
394 | - $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); |
|
408 | + if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) ) { |
|
409 | + $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); |
|
410 | + } |
|
395 | 411 | |
396 | 412 | $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); |
397 | - if ( $url != get_option( 'siteurl' ) ) |
|
398 | - update_option( 'siteurl', $url ); |
|
399 | -} |
|
413 | + if ( $url != get_option( 'siteurl' ) ) { |
|
414 | + update_option( 'siteurl', $url ); |
|
415 | + } |
|
416 | + } |
|
400 | 417 | |
401 | 418 | //Set a cookie now to see if they are supported by the browser. |
402 | 419 | $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); |
403 | 420 | setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
404 | -if ( SITECOOKIEPATH != COOKIEPATH ) |
|
421 | +if ( SITECOOKIEPATH != COOKIEPATH ) { |
|
405 | 422 | setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); |
423 | +} |
|
406 | 424 | |
407 | 425 | /** |
408 | 426 | * Fires when the login form is initialized. |
@@ -582,17 +600,19 @@ discard block |
||
582 | 600 | |
583 | 601 | if ( ! $user || is_wp_error( $user ) ) { |
584 | 602 | setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
585 | - if ( $user && $user->get_error_code() === 'expired_key' ) |
|
586 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
587 | - else |
|
588 | - wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
603 | + if ( $user && $user->get_error_code() === 'expired_key' ) { |
|
604 | + wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
605 | + } else { |
|
606 | + wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
607 | + } |
|
589 | 608 | exit; |
590 | 609 | } |
591 | 610 | |
592 | 611 | $errors = new WP_Error(); |
593 | 612 | |
594 | - if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) |
|
595 | - $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) ); |
|
613 | + if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) { |
|
614 | + $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) ); |
|
615 | + } |
|
596 | 616 | |
597 | 617 | /** |
598 | 618 | * Fires before the password reset procedure is validated. |
@@ -750,8 +770,9 @@ discard block |
||
750 | 770 | default: |
751 | 771 | $secure_cookie = ''; |
752 | 772 | $customize_login = isset( $_REQUEST['customize-login'] ); |
753 | - if ( $customize_login ) |
|
754 | - wp_enqueue_script( 'customize-base' ); |
|
773 | + if ( $customize_login ) { |
|
774 | + wp_enqueue_script( 'customize-base' ); |
|
775 | + } |
|
755 | 776 | |
756 | 777 | // If the user wants ssl but the session is not ssl, force a secure cookie. |
757 | 778 | if ( !empty($_POST['log']) && !force_ssl_admin() ) { |
@@ -773,8 +794,9 @@ discard block |
||
773 | 794 | if ( isset( $_REQUEST['redirect_to'] ) ) { |
774 | 795 | $redirect_to = $_REQUEST['redirect_to']; |
775 | 796 | // Redirect to https if user wants ssl |
776 | - if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) |
|
777 | - $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
|
797 | + if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') ) { |
|
798 | + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
|
799 | + } |
|
778 | 800 | } else { |
779 | 801 | $redirect_to = admin_url(); |
780 | 802 | } |
@@ -824,12 +846,13 @@ discard block |
||
824 | 846 | |
825 | 847 | if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { |
826 | 848 | // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. |
827 | - if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) ) |
|
828 | - $redirect_to = user_admin_url(); |
|
829 | - elseif ( is_multisite() && !$user->has_cap('read') ) |
|
830 | - $redirect_to = get_dashboard_url( $user->ID ); |
|
831 | - elseif ( !$user->has_cap('edit_posts') ) |
|
832 | - $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
849 | + if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) ) { |
|
850 | + $redirect_to = user_admin_url(); |
|
851 | + } elseif ( is_multisite() && !$user->has_cap('read') ) { |
|
852 | + $redirect_to = get_dashboard_url( $user->ID ); |
|
853 | + } elseif ( !$user->has_cap('edit_posts') ) { |
|
854 | + $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
855 | + } |
|
833 | 856 | |
834 | 857 | wp_redirect( $redirect_to ); |
835 | 858 | exit(); |
@@ -840,26 +863,29 @@ discard block |
||
840 | 863 | |
841 | 864 | $errors = $user; |
842 | 865 | // Clear errors if loggedout is set. |
843 | - if ( !empty($_GET['loggedout']) || $reauth ) |
|
844 | - $errors = new WP_Error(); |
|
866 | + if ( !empty($_GET['loggedout']) || $reauth ) { |
|
867 | + $errors = new WP_Error(); |
|
868 | + } |
|
845 | 869 | |
846 | 870 | if ( $interim_login ) { |
847 | - if ( ! $errors->get_error_code() ) |
|
848 | - $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
871 | + if ( ! $errors->get_error_code() ) { |
|
872 | + $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
873 | + } |
|
849 | 874 | } else { |
850 | 875 | // Some parts of this script use the main login form to display a message |
851 | - if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) |
|
852 | - $errors->add('loggedout', __('You are now logged out.'), 'message'); |
|
853 | - elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) |
|
854 | - $errors->add('registerdisabled', __('User registration is currently not allowed.')); |
|
855 | - elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) |
|
856 | - $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); |
|
857 | - elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) |
|
858 | - $errors->add('newpass', __('Check your email for your new password.'), 'message'); |
|
859 | - elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) |
|
860 | - $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); |
|
861 | - elseif ( strpos( $redirect_to, 'about.php?updated' ) ) |
|
862 | - $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
|
876 | + if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) { |
|
877 | + $errors->add('loggedout', __('You are now logged out.'), 'message'); |
|
878 | + } elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) { |
|
879 | + $errors->add('registerdisabled', __('User registration is currently not allowed.')); |
|
880 | + } elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) { |
|
881 | + $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); |
|
882 | + } elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) { |
|
883 | + $errors->add('newpass', __('Check your email for your new password.'), 'message'); |
|
884 | + } elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) { |
|
885 | + $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); |
|
886 | + } elseif ( strpos( $redirect_to, 'about.php?updated' ) ) { |
|
887 | + $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
|
888 | + } |
|
863 | 889 | } |
864 | 890 | |
865 | 891 | /** |
@@ -873,13 +899,15 @@ discard block |
||
873 | 899 | $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
874 | 900 | |
875 | 901 | // Clear any stale cookies. |
876 | - if ( $reauth ) |
|
877 | - wp_clear_auth_cookie(); |
|
902 | + if ( $reauth ) { |
|
903 | + wp_clear_auth_cookie(); |
|
904 | + } |
|
878 | 905 | |
879 | 906 | login_header(__('Log In'), '', $errors); |
880 | 907 | |
881 | - if ( isset($_POST['log']) ) |
|
882 | - $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
908 | + if ( isset($_POST['log']) ) { |
|
909 | + $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; |
|
910 | + } |
|
883 | 911 | $rememberme = ! empty( $_POST['rememberme'] ); |
884 | 912 | |
885 | 913 | if ( ! empty( $errors->errors ) ) { |
@@ -5,14 +5,14 @@ |
||
5 | 5 | * @package WordPress |
6 | 6 | */ |
7 | 7 | |
8 | -if ( !isset($wp_did_header) ) { |
|
8 | +if ( ! isset($wp_did_header)) { |
|
9 | 9 | |
10 | 10 | $wp_did_header = true; |
11 | 11 | |
12 | - require_once( dirname(__FILE__) . '/wp-load.php' ); |
|
12 | + require_once(dirname(__FILE__).'/wp-load.php'); |
|
13 | 13 | |
14 | 14 | wp(); |
15 | 15 | |
16 | - require_once( ABSPATH . WPINC . '/template-loader.php' ); |
|
16 | + require_once(ABSPATH.WPINC.'/template-loader.php'); |
|
17 | 17 | |
18 | 18 | } |
@@ -43,15 +43,15 @@ |
||
43 | 43 | <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> |
44 | 44 | <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> |
45 | 45 | <?php |
46 | - /** |
|
47 | - * Add additional APIs to the Really Simple Discovery (RSD) endpoint. |
|
48 | - * |
|
49 | - * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
46 | + /** |
|
47 | + * Add additional APIs to the Really Simple Discovery (RSD) endpoint. |
|
50 | 48 | * |
51 | - * @since 3.5.0 |
|
52 | - */ |
|
53 | - do_action( 'xmlrpc_rsd_apis' ); |
|
54 | - ?> |
|
49 | + * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
50 | + * |
|
51 | + * @since 3.5.0 |
|
52 | + */ |
|
53 | + do_action( 'xmlrpc_rsd_apis' ); |
|
54 | + ?> |
|
55 | 55 | </apis> |
56 | 56 | </service> |
57 | 57 | </rsd> |
@@ -17,19 +17,19 @@ discard block |
||
17 | 17 | |
18 | 18 | // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default, |
19 | 19 | // but we can do it ourself. |
20 | -if ( !isset( $HTTP_RAW_POST_DATA ) ) { |
|
21 | - $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); |
|
20 | +if ( ! isset($HTTP_RAW_POST_DATA)) { |
|
21 | + $HTTP_RAW_POST_DATA = file_get_contents('php://input'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // fix for mozBlog and other cases where '<?xml' isn't on the very first line |
25 | -if ( isset($HTTP_RAW_POST_DATA) ) |
|
25 | +if (isset($HTTP_RAW_POST_DATA)) |
|
26 | 26 | $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); |
27 | 27 | |
28 | 28 | /** Include the bootstrap for setting up WordPress environment */ |
29 | -include( dirname( __FILE__ ) . '/wp-load.php' ); |
|
29 | +include(dirname(__FILE__).'/wp-load.php'); |
|
30 | 30 | |
31 | -if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
32 | -header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); |
|
31 | +if (isset($_GET['rsd'])) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
|
32 | +header('Content-Type: text/xml; charset='.get_option('blog_charset'), true); |
|
33 | 33 | ?> |
34 | 34 | <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> |
35 | 35 | <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 3.5.0 |
52 | 52 | */ |
53 | - do_action( 'xmlrpc_rsd_apis' ); |
|
53 | + do_action('xmlrpc_rsd_apis'); |
|
54 | 54 | ?> |
55 | 55 | </apis> |
56 | 56 | </service> |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | exit; |
60 | 60 | } |
61 | 61 | |
62 | -include_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
63 | -include_once(ABSPATH . WPINC . '/class-IXR.php'); |
|
64 | -include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); |
|
62 | +include_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
63 | +include_once(ABSPATH.WPINC.'/class-IXR.php'); |
|
64 | +include_once(ABSPATH.WPINC.'/class-wp-xmlrpc-server.php'); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Posts submitted via the XML-RPC interface get that title |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param string $class The name of the XML-RPC server class. |
79 | 79 | */ |
80 | -$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
|
80 | +$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server'); |
|
81 | 81 | $wp_xmlrpc_server = new $wp_xmlrpc_server_class; |
82 | 82 | |
83 | 83 | // Fire off the request |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param string $io Whether input or output |
95 | 95 | * @param string $msg Information describing logging reason. |
96 | 96 | */ |
97 | -function logIO( $io, $msg ) { |
|
98 | - _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); |
|
99 | - if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) |
|
100 | - error_log( $io . ' - ' . $msg ); |
|
97 | +function logIO($io, $msg) { |
|
98 | + _deprecated_function(__FUNCTION__, '3.4', 'error_log()'); |
|
99 | + if ( ! empty($GLOBALS['xmlrpc_logging'])) |
|
100 | + error_log($io.' - '.$msg); |
|
101 | 101 | } |
102 | 102 | \ No newline at end of file |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | // fix for mozBlog and other cases where '<?xml' isn't on the very first line |
25 | -if ( isset($HTTP_RAW_POST_DATA) ) |
|
25 | +if ( isset($HTTP_RAW_POST_DATA) ) { |
|
26 | 26 | $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); |
27 | +} |
|
27 | 28 | |
28 | 29 | /** Include the bootstrap for setting up WordPress environment */ |
29 | 30 | include( dirname( __FILE__ ) . '/wp-load.php' ); |
@@ -96,6 +97,7 @@ discard block |
||
96 | 97 | */ |
97 | 98 | function logIO( $io, $msg ) { |
98 | 99 | _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); |
99 | - if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) |
|
100 | - error_log( $io . ' - ' . $msg ); |
|
101 | -} |
|
102 | 100 | \ No newline at end of file |
101 | + if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { |
|
102 | + error_log( $io . ' - ' . $msg ); |
|
103 | + } |
|
104 | + } |
|
103 | 105 | \ No newline at end of file |
@@ -723,10 +723,10 @@ |
||
723 | 723 | </div> |
724 | 724 | <?php |
725 | 725 | /** |
726 | - * Fires after the sign-up forms, before wp_footer. |
|
727 | - * |
|
728 | - * @since 3.0.0 |
|
729 | - */ |
|
726 | + * Fires after the sign-up forms, before wp_footer. |
|
727 | + * |
|
728 | + * @since 3.0.0 |
|
729 | + */ |
|
730 | 730 | do_action( 'after_signup_form' ); ?> |
731 | 731 | |
732 | 732 | <?php get_footer(); ?> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** Sets up the WordPress Environment. */ |
4 | -require( dirname(__FILE__) . '/wp-load.php' ); |
|
4 | +require(dirname(__FILE__).'/wp-load.php'); |
|
5 | 5 | |
6 | -add_action( 'wp_head', 'wp_no_robots' ); |
|
6 | +add_action('wp_head', 'wp_no_robots'); |
|
7 | 7 | |
8 | -require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
|
8 | +require(dirname(__FILE__).'/wp-blog-header.php'); |
|
9 | 9 | |
10 | -if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) ) { |
|
11 | - wp_redirect( network_home_url() ); |
|
10 | +if (is_array(get_site_option('illegal_names')) && isset($_GET['new']) && in_array($_GET['new'], get_site_option('illegal_names'))) { |
|
11 | + wp_redirect(network_home_url()); |
|
12 | 12 | die(); |
13 | 13 | } |
14 | 14 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @since 3.0.0 |
25 | 25 | */ |
26 | - do_action( 'signup_header' ); |
|
26 | + do_action('signup_header'); |
|
27 | 27 | } |
28 | -add_action( 'wp_head', 'do_signup_header' ); |
|
28 | +add_action('wp_head', 'do_signup_header'); |
|
29 | 29 | |
30 | -if ( !is_multisite() ) { |
|
31 | - wp_redirect( wp_registration_url() ); |
|
30 | +if ( ! is_multisite()) { |
|
31 | + wp_redirect(wp_registration_url()); |
|
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -if ( !is_main_site() ) { |
|
36 | - wp_redirect( network_site_url( 'wp-signup.php' ) ); |
|
35 | +if ( ! is_main_site()) { |
|
36 | + wp_redirect(network_site_url('wp-signup.php')); |
|
37 | 37 | die(); |
38 | 38 | } |
39 | 39 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @since 4.4.0 |
47 | 47 | */ |
48 | -do_action( 'before_signup_header' ); |
|
48 | +do_action('before_signup_header'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Prints styles for front-end Multisite signup pages |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'wp_head', 'wpmu_signup_stylesheet' ); |
|
77 | -get_header( 'wp-signup' ); |
|
76 | +add_action('wp_head', 'wpmu_signup_stylesheet'); |
|
77 | +get_header('wp-signup'); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Fires before the site sign-up form. |
81 | 81 | * |
82 | 82 | * @since 3.0.0 |
83 | 83 | */ |
84 | -do_action( 'before_signup_form' ); |
|
84 | +do_action('before_signup_form'); |
|
85 | 85 | ?> |
86 | 86 | <div id="signup-content" class="widecolumn"> |
87 | 87 | <div class="mu_register wp-signup-container"> |
@@ -95,35 +95,35 @@ discard block |
||
95 | 95 | * @param string $blog_title The new site title |
96 | 96 | * @param array $errors |
97 | 97 | */ |
98 | -function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
|
98 | +function show_blog_form($blogname = '', $blog_title = '', $errors = '') { |
|
99 | 99 | $current_site = get_current_site(); |
100 | 100 | // Blog name |
101 | - if ( !is_subdomain_install() ) |
|
102 | - echo '<label for="blogname">' . __('Site Name:') . '</label>'; |
|
101 | + if ( ! is_subdomain_install()) |
|
102 | + echo '<label for="blogname">'.__('Site Name:').'</label>'; |
|
103 | 103 | else |
104 | - echo '<label for="blogname">' . __('Site Domain:') . '</label>'; |
|
104 | + echo '<label for="blogname">'.__('Site Domain:').'</label>'; |
|
105 | 105 | |
106 | - if ( $errmsg = $errors->get_error_message('blogname') ) { ?> |
|
106 | + if ($errmsg = $errors->get_error_message('blogname')) { ?> |
|
107 | 107 | <p class="error"><?php echo $errmsg ?></p> |
108 | 108 | <?php } |
109 | 109 | |
110 | - if ( !is_subdomain_install() ) |
|
111 | - echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; |
|
110 | + if ( ! is_subdomain_install()) |
|
111 | + echo '<span class="prefix_address">'.$current_site->domain.$current_site->path.'</span><input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><br />'; |
|
112 | 112 | else |
113 | - echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />'; |
|
113 | + echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.'.($site_domain = preg_replace('|^www\.|', '', $current_site->domain)).'</span><br />'; |
|
114 | 114 | |
115 | - if ( !is_user_logged_in() ) { |
|
116 | - if ( !is_subdomain_install() ) |
|
117 | - $site = $current_site->domain . $current_site->path . __( 'sitename' ); |
|
115 | + if ( ! is_user_logged_in()) { |
|
116 | + if ( ! is_subdomain_install()) |
|
117 | + $site = $current_site->domain.$current_site->path.__('sitename'); |
|
118 | 118 | else |
119 | - $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; |
|
120 | - echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; |
|
119 | + $site = __('domain').'.'.$site_domain.$current_site->path; |
|
120 | + echo '<p>(<strong>'.sprintf(__('Your address will be %s.'), $site).'</strong>) '.__('Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!').'</p>'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Blog Title |
124 | 124 | ?> |
125 | 125 | <label for="blog_title"><?php _e('Site Title:') ?></label> |
126 | - <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> |
|
126 | + <?php if ($errmsg = $errors->get_error_message('blog_title')) { ?> |
|
127 | 127 | <p class="error"><?php echo $errmsg ?></p> |
128 | 128 | <?php } |
129 | 129 | echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />'; |
@@ -133,30 +133,30 @@ discard block |
||
133 | 133 | // Site Language. |
134 | 134 | $languages = signup_get_available_languages(); |
135 | 135 | |
136 | - if ( ! empty( $languages ) ) : |
|
136 | + if ( ! empty($languages)) : |
|
137 | 137 | ?> |
138 | 138 | <p> |
139 | - <label for="site-language"><?php _e( 'Site Language:' ); ?></label> |
|
139 | + <label for="site-language"><?php _e('Site Language:'); ?></label> |
|
140 | 140 | <?php |
141 | 141 | // Network default. |
142 | - $lang = get_site_option( 'WPLANG' ); |
|
142 | + $lang = get_site_option('WPLANG'); |
|
143 | 143 | |
144 | - if ( isset( $_POST['WPLANG'] ) ) { |
|
144 | + if (isset($_POST['WPLANG'])) { |
|
145 | 145 | $lang = $_POST['WPLANG']; |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Use US English if the default isn't available. |
149 | - if ( ! in_array( $lang, $languages ) ) { |
|
149 | + if ( ! in_array($lang, $languages)) { |
|
150 | 150 | $lang = ''; |
151 | 151 | } |
152 | 152 | |
153 | - wp_dropdown_languages( array( |
|
153 | + wp_dropdown_languages(array( |
|
154 | 154 | 'name' => 'WPLANG', |
155 | 155 | 'id' => 'site-language', |
156 | 156 | 'selected' => $lang, |
157 | 157 | 'languages' => $languages, |
158 | 158 | 'show_available_translations' => false, |
159 | - ) ); |
|
159 | + )); |
|
160 | 160 | ?> |
161 | 161 | </p> |
162 | 162 | <?php endif; // Languages. ?> |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | <div id="privacy"> |
165 | 165 | <p class="privacy-intro"> |
166 | 166 | <label for="blog_public_on"><?php _e('Privacy:') ?></label> |
167 | - <?php _e( 'Allow search engines to index this site.' ); ?> |
|
167 | + <?php _e('Allow search engines to index this site.'); ?> |
|
168 | 168 | <br style="clear:both" /> |
169 | 169 | <label class="checkbox" for="blog_public_on"> |
170 | - <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> /> |
|
171 | - <strong><?php _e( 'Yes' ); ?></strong> |
|
170 | + <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( ! isset($_POST['blog_public']) || $_POST['blog_public'] == '1') { ?>checked="checked"<?php } ?> /> |
|
171 | + <strong><?php _e('Yes'); ?></strong> |
|
172 | 172 | </label> |
173 | 173 | <label class="checkbox" for="blog_public_off"> |
174 | - <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> /> |
|
175 | - <strong><?php _e( 'No' ); ?></strong> |
|
174 | + <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if (isset($_POST['blog_public']) && $_POST['blog_public'] == '0') { ?>checked="checked"<?php } ?> /> |
|
175 | + <strong><?php _e('No'); ?></strong> |
|
176 | 176 | </label> |
177 | 177 | </p> |
178 | 178 | </div> |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors. |
187 | 187 | */ |
188 | - do_action( 'signup_blogform', $errors ); |
|
188 | + do_action('signup_blogform', $errors); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | function validate_blog_form() { |
199 | 199 | $user = ''; |
200 | - if ( is_user_logged_in() ) |
|
200 | + if (is_user_logged_in()) |
|
201 | 201 | $user = wp_get_current_user(); |
202 | 202 | |
203 | 203 | return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function show_user_form($user_name = '', $user_email = '', $errors = '') { |
216 | 216 | // User name |
217 | - echo '<label for="user_name">' . __('Username:') . '</label>'; |
|
218 | - if ( $errmsg = $errors->get_error_message('user_name') ) { |
|
217 | + echo '<label for="user_name">'.__('Username:').'</label>'; |
|
218 | + if ($errmsg = $errors->get_error_message('user_name')) { |
|
219 | 219 | echo '<p class="error">'.$errmsg.'</p>'; |
220 | 220 | } |
221 | - echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />'; |
|
222 | - _e( '(Must be at least 4 characters, letters and numbers only.)' ); |
|
221 | + echo '<input name="user_name" type="text" id="user_name" value="'.esc_attr($user_name).'" maxlength="60" /><br />'; |
|
222 | + _e('(Must be at least 4 characters, letters and numbers only.)'); |
|
223 | 223 | ?> |
224 | 224 | |
225 | - <label for="user_email"><?php _e( 'Email Address:' ) ?></label> |
|
226 | - <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> |
|
225 | + <label for="user_email"><?php _e('Email Address:') ?></label> |
|
226 | + <?php if ($errmsg = $errors->get_error_message('user_email')) { ?> |
|
227 | 227 | <p class="error"><?php echo $errmsg ?></p> |
228 | 228 | <?php } ?> |
229 | 229 | <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> |
230 | 230 | <?php |
231 | - if ( $errmsg = $errors->get_error_message('generic') ) { |
|
232 | - echo '<p class="error">' . $errmsg . '</p>'; |
|
231 | + if ($errmsg = $errors->get_error_message('generic')) { |
|
232 | + echo '<p class="error">'.$errmsg.'</p>'; |
|
233 | 233 | } |
234 | 234 | /** |
235 | 235 | * Fires at the end of the user registration form on the site sign-up form. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param array $errors An array possibly containing 'user_name' or 'user_email' errors. |
240 | 240 | */ |
241 | - do_action( 'signup_extra_fields', $errors ); |
|
241 | + do_action('signup_extra_fields', $errors); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | * @param string $blog_title The new site title. |
262 | 262 | * @param array $errors |
263 | 263 | */ |
264 | -function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { |
|
264 | +function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { |
|
265 | 265 | $current_user = wp_get_current_user(); |
266 | 266 | |
267 | - if ( ! is_wp_error($errors) ) { |
|
267 | + if ( ! is_wp_error($errors)) { |
|
268 | 268 | $errors = new WP_Error(); |
269 | 269 | } |
270 | 270 | |
@@ -287,34 +287,34 @@ discard block |
||
287 | 287 | * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors. |
288 | 288 | * } |
289 | 289 | */ |
290 | - $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); |
|
290 | + $filtered_results = apply_filters('signup_another_blog_init', $signup_defaults); |
|
291 | 291 | |
292 | 292 | $blogname = $filtered_results['blogname']; |
293 | 293 | $blog_title = $filtered_results['blog_title']; |
294 | 294 | $errors = $filtered_results['errors']; |
295 | 295 | |
296 | - echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>'; |
|
296 | + echo '<h2>'.sprintf(__('Get <em>another</em> %s site in seconds'), get_current_site()->site_name).'</h2>'; |
|
297 | 297 | |
298 | - if ( $errors->get_error_code() ) { |
|
299 | - echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; |
|
298 | + if ($errors->get_error_code()) { |
|
299 | + echo '<p>'.__('There was a problem, please correct the form below and try again.').'</p>'; |
|
300 | 300 | } |
301 | 301 | ?> |
302 | - <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ), $current_user->display_name ) ?></p> |
|
302 | + <p><?php printf(__('Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!'), $current_user->display_name) ?></p> |
|
303 | 303 | |
304 | 304 | <?php |
305 | 305 | $blogs = get_blogs_of_user($current_user->ID); |
306 | - if ( !empty($blogs) ) { ?> |
|
306 | + if ( ! empty($blogs)) { ?> |
|
307 | 307 | |
308 | - <p><?php _e( 'Sites you are already a member of:' ) ?></p> |
|
308 | + <p><?php _e('Sites you are already a member of:') ?></p> |
|
309 | 309 | <ul> |
310 | - <?php foreach ( $blogs as $blog ) { |
|
311 | - $home_url = get_home_url( $blog->userblog_id ); |
|
312 | - echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>'; |
|
310 | + <?php foreach ($blogs as $blog) { |
|
311 | + $home_url = get_home_url($blog->userblog_id); |
|
312 | + echo '<li><a href="'.esc_url($home_url).'">'.$home_url.'</a></li>'; |
|
313 | 313 | } ?> |
314 | 314 | </ul> |
315 | 315 | <?php } ?> |
316 | 316 | |
317 | - <p><?php _e( 'If you’re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p> |
|
317 | + <p><?php _e('If you’re not going to use a great site domain, leave it for a new user. Now have at it!') ?></p> |
|
318 | 318 | <form id="setupform" method="post" action="wp-signup.php"> |
319 | 319 | <input type="hidden" name="stage" value="gimmeanotherblog" /> |
320 | 320 | <?php |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | * @param string $context A string describing the steps of the sign-up process. The value can be |
327 | 327 | * 'create-another-site', 'validate-user', or 'validate-site'. |
328 | 328 | */ |
329 | - do_action( 'signup_hidden_fields', 'create-another-site' ); |
|
329 | + do_action('signup_hidden_fields', 'create-another-site'); |
|
330 | 330 | ?> |
331 | 331 | <?php show_blog_form($blogname, $blog_title, $errors); ?> |
332 | - <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p> |
|
332 | + <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Create Site') ?>" /></p> |
|
333 | 333 | </form> |
334 | 334 | <?php |
335 | 335 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | function validate_another_blog_signup() { |
346 | 346 | global $wpdb, $blogname, $blog_title, $errors, $domain, $path; |
347 | 347 | $current_user = wp_get_current_user(); |
348 | - if ( ! is_user_logged_in() ) { |
|
348 | + if ( ! is_user_logged_in()) { |
|
349 | 349 | die(); |
350 | 350 | } |
351 | 351 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $blog_title = $result['blog_title']; |
359 | 359 | $errors = $result['errors']; |
360 | 360 | |
361 | - if ( $errors->get_error_code() ) { |
|
361 | + if ($errors->get_error_code()) { |
|
362 | 362 | signup_another_blog($blogname, $blog_title, $errors); |
363 | 363 | return false; |
364 | 364 | } |
@@ -371,14 +371,14 @@ discard block |
||
371 | 371 | ); |
372 | 372 | |
373 | 373 | // Handle the language setting for the new site. |
374 | - if ( ! empty( $_POST['WPLANG'] ) ) { |
|
374 | + if ( ! empty($_POST['WPLANG'])) { |
|
375 | 375 | |
376 | 376 | $languages = signup_get_available_languages(); |
377 | 377 | |
378 | - if ( in_array( $_POST['WPLANG'], $languages ) ) { |
|
379 | - $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
|
378 | + if (in_array($_POST['WPLANG'], $languages)) { |
|
379 | + $language = wp_unslash(sanitize_text_field($_POST['WPLANG'])); |
|
380 | 380 | |
381 | - if ( $language ) { |
|
381 | + if ($language) { |
|
382 | 382 | $blog_meta_defaults['WPLANG'] = $language; |
383 | 383 | } |
384 | 384 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @param array $blog_meta_defaults An array of default blog meta variables. |
395 | 395 | */ |
396 | - $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); |
|
396 | + $meta_defaults = apply_filters('signup_create_blog_meta', $blog_meta_defaults); |
|
397 | 397 | |
398 | 398 | /** |
399 | 399 | * Filter the new default site meta variables. |
@@ -407,15 +407,15 @@ discard block |
||
407 | 407 | * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false. |
408 | 408 | * } |
409 | 409 | */ |
410 | - $meta = apply_filters( 'add_signup_meta', $meta_defaults ); |
|
410 | + $meta = apply_filters('add_signup_meta', $meta_defaults); |
|
411 | 411 | |
412 | - $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); |
|
412 | + $blog_id = wpmu_create_blog($domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid); |
|
413 | 413 | |
414 | - if ( is_wp_error( $blog_id ) ) { |
|
414 | + if (is_wp_error($blog_id)) { |
|
415 | 415 | return false; |
416 | 416 | } |
417 | 417 | |
418 | - confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); |
|
418 | + confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id); |
|
419 | 419 | return true; |
420 | 420 | } |
421 | 421 | |
@@ -433,31 +433,31 @@ discard block |
||
433 | 433 | * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup(). |
434 | 434 | * @param int $blog_id The site ID. |
435 | 435 | */ |
436 | -function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) { |
|
436 | +function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0) { |
|
437 | 437 | |
438 | - if ( $blog_id ) { |
|
439 | - switch_to_blog( $blog_id ); |
|
440 | - $home_url = home_url( '/' ); |
|
438 | + if ($blog_id) { |
|
439 | + switch_to_blog($blog_id); |
|
440 | + $home_url = home_url('/'); |
|
441 | 441 | $login_url = wp_login_url(); |
442 | 442 | restore_current_blog(); |
443 | 443 | } else { |
444 | - $home_url = 'http://' . $domain . $path; |
|
445 | - $login_url = 'http://' . $domain . $path . 'wp-login.php'; |
|
444 | + $home_url = 'http://'.$domain.$path; |
|
445 | + $login_url = 'http://'.$domain.$path.'wp-login.php'; |
|
446 | 446 | } |
447 | 447 | |
448 | - $site = sprintf( '<a href="%1$s">%2$s</a>', |
|
449 | - esc_url( $home_url ), |
|
448 | + $site = sprintf('<a href="%1$s">%2$s</a>', |
|
449 | + esc_url($home_url), |
|
450 | 450 | $blog_title |
451 | 451 | ); |
452 | 452 | |
453 | 453 | ?> |
454 | - <h2><?php printf( __( 'The site %s is yours.' ), $site ); ?></h2> |
|
454 | + <h2><?php printf(__('The site %s is yours.'), $site); ?></h2> |
|
455 | 455 | <p> |
456 | 456 | <?php printf( |
457 | - __( '<a href="%1$s">%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.' ), |
|
458 | - esc_url( $home_url ), |
|
459 | - untrailingslashit( $domain . $path ), |
|
460 | - esc_url( $login_url ), |
|
457 | + __('<a href="%1$s">%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.'), |
|
458 | + esc_url($home_url), |
|
459 | + untrailingslashit($domain.$path), |
|
460 | + esc_url($login_url), |
|
461 | 461 | $user_name |
462 | 462 | ); ?> |
463 | 463 | </p> |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @since 3.0.0 |
469 | 469 | */ |
470 | - do_action( 'signup_finished' ); |
|
470 | + do_action('signup_finished'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -479,13 +479,13 @@ discard block |
||
479 | 479 | * @param string $user_email The user's email |
480 | 480 | * @param array $errors |
481 | 481 | */ |
482 | -function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
|
482 | +function signup_user($user_name = '', $user_email = '', $errors = '') { |
|
483 | 483 | global $active_signup; |
484 | 484 | |
485 | - if ( !is_wp_error($errors) ) |
|
485 | + if ( ! is_wp_error($errors)) |
|
486 | 486 | $errors = new WP_Error(); |
487 | 487 | |
488 | - $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; |
|
488 | + $signup_for = isset($_POST['signup_for']) ? esc_html($_POST['signup_for']) : 'blog'; |
|
489 | 489 | |
490 | 490 | $signup_user_defaults = array( |
491 | 491 | 'user_name' => $user_name, |
@@ -506,32 +506,32 @@ discard block |
||
506 | 506 | * @type array $errors An array of possible errors relevant to the sign-up user. |
507 | 507 | * } |
508 | 508 | */ |
509 | - $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); |
|
509 | + $filtered_results = apply_filters('signup_user_init', $signup_user_defaults); |
|
510 | 510 | $user_name = $filtered_results['user_name']; |
511 | 511 | $user_email = $filtered_results['user_email']; |
512 | 512 | $errors = $filtered_results['errors']; |
513 | 513 | |
514 | 514 | ?> |
515 | 515 | |
516 | - <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2> |
|
516 | + <h2><?php printf(__('Get your own %s account in seconds'), get_current_site()->site_name) ?></h2> |
|
517 | 517 | <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate"> |
518 | 518 | <input type="hidden" name="stage" value="validate-user-signup" /> |
519 | 519 | <?php |
520 | 520 | /** This action is documented in wp-signup.php */ |
521 | - do_action( 'signup_hidden_fields', 'validate-user' ); |
|
521 | + do_action('signup_hidden_fields', 'validate-user'); |
|
522 | 522 | ?> |
523 | 523 | <?php show_user_form($user_name, $user_email, $errors); ?> |
524 | 524 | |
525 | 525 | <p> |
526 | - <?php if ( $active_signup == 'blog' ) { ?> |
|
526 | + <?php if ($active_signup == 'blog') { ?> |
|
527 | 527 | <input id="signupblog" type="hidden" name="signup_for" value="blog" /> |
528 | - <?php } elseif ( $active_signup == 'user' ) { ?> |
|
528 | + <?php } elseif ($active_signup == 'user') { ?> |
|
529 | 529 | <input id="signupblog" type="hidden" name="signup_for" value="user" /> |
530 | 530 | <?php } else { ?> |
531 | - <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> |
|
531 | + <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked($signup_for, 'blog'); ?> /> |
|
532 | 532 | <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label> |
533 | 533 | <br /> |
534 | - <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> /> |
|
534 | + <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked($signup_for, 'user'); ?> /> |
|
535 | 535 | <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label> |
536 | 536 | <?php } ?> |
537 | 537 | </p> |
@@ -554,18 +554,18 @@ discard block |
||
554 | 554 | $user_email = $result['user_email']; |
555 | 555 | $errors = $result['errors']; |
556 | 556 | |
557 | - if ( $errors->get_error_code() ) { |
|
557 | + if ($errors->get_error_code()) { |
|
558 | 558 | signup_user($user_name, $user_email, $errors); |
559 | 559 | return false; |
560 | 560 | } |
561 | 561 | |
562 | - if ( 'blog' == $_POST['signup_for'] ) { |
|
562 | + if ('blog' == $_POST['signup_for']) { |
|
563 | 563 | signup_blog($user_name, $user_email); |
564 | 564 | return false; |
565 | 565 | } |
566 | 566 | |
567 | 567 | /** This filter is documented in wp-signup.php */ |
568 | - wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); |
|
568 | + wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); |
|
569 | 569 | |
570 | 570 | confirm_user_signup($user_name, $user_email); |
571 | 571 | return true; |
@@ -582,14 +582,14 @@ discard block |
||
582 | 582 | function confirm_user_signup($user_name, $user_email) { |
583 | 583 | ?> |
584 | 584 | <h2><?php /* translators: %s: username */ |
585 | - printf( __( '%s is your new username' ), $user_name) ?></h2> |
|
586 | - <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p> |
|
585 | + printf(__('%s is your new username'), $user_name) ?></h2> |
|
586 | + <p><?php _e('But, before you can start using your new username, <strong>you must activate it</strong>.') ?></p> |
|
587 | 587 | <p><?php /* translators: %s: email address */ |
588 | - printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p> |
|
589 | - <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> |
|
588 | + printf(__('Check your inbox at %s and click the link given.'), '<strong>'.$user_email.'</strong>'); ?></p> |
|
589 | + <p><?php _e('If you do not activate your username within two days, you will have to sign up again.'); ?></p> |
|
590 | 590 | <?php |
591 | 591 | /** This action is documented in wp-signup.php */ |
592 | - do_action( 'signup_finished' ); |
|
592 | + do_action('signup_finished'); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @param array $errors |
605 | 605 | */ |
606 | 606 | function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { |
607 | - if ( !is_wp_error($errors) ) |
|
607 | + if ( ! is_wp_error($errors)) |
|
608 | 608 | $errors = new WP_Error(); |
609 | 609 | |
610 | 610 | $signup_blog_defaults = array( |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * @type array $errors An array of possible errors relevant to new site creation variables. |
631 | 631 | * } |
632 | 632 | */ |
633 | - $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults ); |
|
633 | + $filtered_results = apply_filters('signup_blog_init', $signup_blog_defaults); |
|
634 | 634 | |
635 | 635 | $user_name = $filtered_results['user_name']; |
636 | 636 | $user_email = $filtered_results['user_email']; |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $blog_title = $filtered_results['blog_title']; |
639 | 639 | $errors = $filtered_results['errors']; |
640 | 640 | |
641 | - if ( empty($blogname) ) |
|
641 | + if (empty($blogname)) |
|
642 | 642 | $blogname = $user_name; |
643 | 643 | ?> |
644 | 644 | <form id="setupform" method="post" action="wp-signup.php"> |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" /> |
648 | 648 | <?php |
649 | 649 | /** This action is documented in wp-signup.php */ |
650 | - do_action( 'signup_hidden_fields', 'validate-site' ); |
|
650 | + do_action('signup_hidden_fields', 'validate-site'); |
|
651 | 651 | ?> |
652 | 652 | <?php show_blog_form($blogname, $blog_title, $errors); ?> |
653 | 653 | <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p> |
@@ -664,40 +664,40 @@ discard block |
||
664 | 664 | */ |
665 | 665 | function validate_blog_signup() { |
666 | 666 | // Re-validate user info. |
667 | - $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); |
|
667 | + $user_result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); |
|
668 | 668 | $user_name = $user_result['user_name']; |
669 | 669 | $user_email = $user_result['user_email']; |
670 | 670 | $user_errors = $user_result['errors']; |
671 | 671 | |
672 | - if ( $user_errors->get_error_code() ) { |
|
673 | - signup_user( $user_name, $user_email, $user_errors ); |
|
672 | + if ($user_errors->get_error_code()) { |
|
673 | + signup_user($user_name, $user_email, $user_errors); |
|
674 | 674 | return false; |
675 | 675 | } |
676 | 676 | |
677 | - $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] ); |
|
677 | + $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); |
|
678 | 678 | $domain = $result['domain']; |
679 | 679 | $path = $result['path']; |
680 | 680 | $blogname = $result['blogname']; |
681 | 681 | $blog_title = $result['blog_title']; |
682 | 682 | $errors = $result['errors']; |
683 | 683 | |
684 | - if ( $errors->get_error_code() ) { |
|
684 | + if ($errors->get_error_code()) { |
|
685 | 685 | signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); |
686 | 686 | return false; |
687 | 687 | } |
688 | 688 | |
689 | 689 | $public = (int) $_POST['blog_public']; |
690 | - $signup_meta = array ('lang_id' => 1, 'public' => $public); |
|
690 | + $signup_meta = array('lang_id' => 1, 'public' => $public); |
|
691 | 691 | |
692 | 692 | // Handle the language setting for the new site. |
693 | - if ( ! empty( $_POST['WPLANG'] ) ) { |
|
693 | + if ( ! empty($_POST['WPLANG'])) { |
|
694 | 694 | |
695 | 695 | $languages = signup_get_available_languages(); |
696 | 696 | |
697 | - if ( in_array( $_POST['WPLANG'], $languages ) ) { |
|
698 | - $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
|
697 | + if (in_array($_POST['WPLANG'], $languages)) { |
|
698 | + $language = wp_unslash(sanitize_text_field($_POST['WPLANG'])); |
|
699 | 699 | |
700 | - if ( $language ) { |
|
700 | + if ($language) { |
|
701 | 701 | $signup_meta['WPLANG'] = $language; |
702 | 702 | } |
703 | 703 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | /** This filter is documented in wp-signup.php */ |
708 | - $meta = apply_filters( 'add_signup_meta', $signup_meta ); |
|
708 | + $meta = apply_filters('add_signup_meta', $signup_meta); |
|
709 | 709 | |
710 | 710 | wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); |
711 | 711 | confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); |
@@ -724,27 +724,27 @@ discard block |
||
724 | 724 | * @param string $user_email The user's email address |
725 | 725 | * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup() |
726 | 726 | */ |
727 | -function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) { |
|
727 | +function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array()) { |
|
728 | 728 | ?> |
729 | 729 | <h2><?php /* translators: %s: site address */ |
730 | - printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> |
|
730 | + printf(__('Congratulations! Your new site, %s, is almost ready.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>") ?></h2> |
|
731 | 731 | |
732 | - <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p> |
|
732 | + <p><?php _e('But, before you can start using your site, <strong>you must activate it</strong>.') ?></p> |
|
733 | 733 | <p><?php /* translators: %s: email address */ |
734 | - printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p> |
|
735 | - <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> |
|
736 | - <h2><?php _e( 'Still waiting for your email?' ); ?></h2> |
|
734 | + printf(__('Check your inbox at %s and click the link given.'), '<strong>'.$user_email.'</strong>'); ?></p> |
|
735 | + <p><?php _e('If you do not activate your site within two days, you will have to sign up again.'); ?></p> |
|
736 | + <h2><?php _e('Still waiting for your email?'); ?></h2> |
|
737 | 737 | <p> |
738 | - <?php _e( 'If you haven’t received your email yet, there are a number of things you can do:' ) ?> |
|
738 | + <?php _e('If you haven’t received your email yet, there are a number of things you can do:') ?> |
|
739 | 739 | <ul id="noemail-tips"> |
740 | - <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li> |
|
741 | - <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li> |
|
742 | - <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email ) ?></li> |
|
740 | + <li><p><strong><?php _e('Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.') ?></strong></p></li> |
|
741 | + <li><p><?php _e('Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.') ?></p></li> |
|
742 | + <li><?php printf(__('Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.'), $user_email) ?></li> |
|
743 | 743 | </ul> |
744 | 744 | </p> |
745 | 745 | <?php |
746 | 746 | /** This action is documented in wp-signup.php */ |
747 | - do_action( 'signup_finished' ); |
|
747 | + do_action('signup_finished'); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @param array $available_languages Available languages. |
771 | 771 | */ |
772 | - $languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() ); |
|
772 | + $languages = (array) apply_filters('signup_get_available_languages', get_available_languages()); |
|
773 | 773 | |
774 | 774 | /* |
775 | 775 | * Strip any non-installed languages and return. |
@@ -777,11 +777,11 @@ discard block |
||
777 | 777 | * Re-call get_available_languages() here in case a language pack was installed |
778 | 778 | * in a callback hooked to the 'signup_get_available_languages' filter before this point. |
779 | 779 | */ |
780 | - return array_intersect_assoc( $languages, get_available_languages() ); |
|
780 | + return array_intersect_assoc($languages, get_available_languages()); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | // Main |
784 | -$active_signup = get_site_option( 'registration', 'none' ); |
|
784 | +$active_signup = get_site_option('registration', 'none'); |
|
785 | 785 | /** |
786 | 786 | * Filter the type of site sign-up. |
787 | 787 | * |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * @param string $active_signup String that returns registration type. The value can be |
791 | 791 | * 'all', 'none', 'blog', or 'user'. |
792 | 792 | */ |
793 | -$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); |
|
793 | +$active_signup = apply_filters('wpmu_active_signup', $active_signup); |
|
794 | 794 | |
795 | 795 | // Make the signup type translatable. |
796 | 796 | $i18n_signup['all'] = _x('all', 'Multisite active signup type'); |
@@ -798,65 +798,65 @@ discard block |
||
798 | 798 | $i18n_signup['blog'] = _x('blog', 'Multisite active signup type'); |
799 | 799 | $i18n_signup['user'] = _x('user', 'Multisite active signup type'); |
800 | 800 | |
801 | -if ( is_super_admin() ) |
|
802 | - echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; |
|
801 | +if (is_super_admin()) |
|
802 | + echo '<div class="mu_alert">'.sprintf(__('Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your <a href="%s">Options page</a>.'), $i18n_signup[$active_signup], esc_url(network_admin_url('settings.php'))).'</div>'; |
|
803 | 803 | |
804 | 804 | $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; |
805 | 805 | |
806 | 806 | $current_user = wp_get_current_user(); |
807 | -if ( $active_signup == 'none' ) { |
|
808 | - _e( 'Registration has been disabled.' ); |
|
809 | -} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) { |
|
810 | - $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); |
|
811 | - echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); |
|
807 | +if ($active_signup == 'none') { |
|
808 | + _e('Registration has been disabled.'); |
|
809 | +} elseif ($active_signup == 'blog' && ! is_user_logged_in()) { |
|
810 | + $login_url = wp_login_url(network_site_url('wp-signup.php')); |
|
811 | + echo sprintf(__('You must first <a href="%s">log in</a>, and then you can create a new site.'), $login_url); |
|
812 | 812 | } else { |
813 | - $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
|
814 | - switch ( $stage ) { |
|
813 | + $stage = isset($_POST['stage']) ? $_POST['stage'] : 'default'; |
|
814 | + switch ($stage) { |
|
815 | 815 | case 'validate-user-signup' : |
816 | - if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) |
|
816 | + if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') |
|
817 | 817 | validate_user_signup(); |
818 | 818 | else |
819 | - _e( 'User registration has been disabled.' ); |
|
819 | + _e('User registration has been disabled.'); |
|
820 | 820 | break; |
821 | 821 | case 'validate-blog-signup': |
822 | - if ( $active_signup == 'all' || $active_signup == 'blog' ) |
|
822 | + if ($active_signup == 'all' || $active_signup == 'blog') |
|
823 | 823 | validate_blog_signup(); |
824 | 824 | else |
825 | - _e( 'Site registration has been disabled.' ); |
|
825 | + _e('Site registration has been disabled.'); |
|
826 | 826 | break; |
827 | 827 | case 'gimmeanotherblog': |
828 | 828 | validate_another_blog_signup(); |
829 | 829 | break; |
830 | 830 | case 'default': |
831 | 831 | default : |
832 | - $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; |
|
832 | + $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
833 | 833 | /** |
834 | 834 | * Fires when the site sign-up form is sent. |
835 | 835 | * |
836 | 836 | * @since 3.0.0 |
837 | 837 | */ |
838 | - do_action( 'preprocess_signup_form' ); |
|
839 | - if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) |
|
838 | + do_action('preprocess_signup_form'); |
|
839 | + if (is_user_logged_in() && ($active_signup == 'all' || $active_signup == 'blog')) |
|
840 | 840 | signup_another_blog($newblogname); |
841 | - elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) |
|
842 | - signup_user( $newblogname, $user_email ); |
|
843 | - elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) |
|
844 | - _e( 'Sorry, new registrations are not allowed at this time.' ); |
|
841 | + elseif ( ! is_user_logged_in() && ($active_signup == 'all' || $active_signup == 'user')) |
|
842 | + signup_user($newblogname, $user_email); |
|
843 | + elseif ( ! is_user_logged_in() && ($active_signup == 'blog')) |
|
844 | + _e('Sorry, new registrations are not allowed at this time.'); |
|
845 | 845 | else |
846 | - _e( 'You are logged in already. No need to register again!' ); |
|
846 | + _e('You are logged in already. No need to register again!'); |
|
847 | 847 | |
848 | - if ( $newblogname ) { |
|
849 | - $newblog = get_blogaddress_by_name( $newblogname ); |
|
848 | + if ($newblogname) { |
|
849 | + $newblog = get_blogaddress_by_name($newblogname); |
|
850 | 850 | |
851 | - if ( $active_signup == 'blog' || $active_signup == 'all' ) |
|
851 | + if ($active_signup == 'blog' || $active_signup == 'all') |
|
852 | 852 | /* translators: %s: site address */ |
853 | - printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
|
854 | - '<strong>' . $newblog . '</strong>' |
|
853 | + printf('<p><em>'.__('The site you were looking for, %s, does not exist, but you can create it now!').'</em></p>', |
|
854 | + '<strong>'.$newblog.'</strong>' |
|
855 | 855 | ); |
856 | 856 | else |
857 | 857 | /* translators: %s: site address */ |
858 | - printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
|
859 | - '<strong>' . $newblog . '</strong>' |
|
858 | + printf('<p><em>'.__('The site you were looking for, %s, does not exist.').'</em></p>', |
|
859 | + '<strong>'.$newblog.'</strong>' |
|
860 | 860 | ); |
861 | 861 | } |
862 | 862 | break; |
@@ -871,6 +871,6 @@ discard block |
||
871 | 871 | * |
872 | 872 | * @since 3.0.0 |
873 | 873 | */ |
874 | -do_action( 'after_signup_form' ); ?> |
|
874 | +do_action('after_signup_form'); ?> |
|
875 | 875 | |
876 | -<?php get_footer( 'wp-signup' ); |
|
876 | +<?php get_footer('wp-signup'); |
@@ -98,25 +98,28 @@ discard block |
||
98 | 98 | function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
99 | 99 | $current_site = get_current_site(); |
100 | 100 | // Blog name |
101 | - if ( !is_subdomain_install() ) |
|
102 | - echo '<label for="blogname">' . __('Site Name:') . '</label>'; |
|
103 | - else |
|
104 | - echo '<label for="blogname">' . __('Site Domain:') . '</label>'; |
|
101 | + if ( !is_subdomain_install() ) { |
|
102 | + echo '<label for="blogname">' . __('Site Name:') . '</label>'; |
|
103 | + } else { |
|
104 | + echo '<label for="blogname">' . __('Site Domain:') . '</label>'; |
|
105 | + } |
|
105 | 106 | |
106 | 107 | if ( $errmsg = $errors->get_error_message('blogname') ) { ?> |
107 | 108 | <p class="error"><?php echo $errmsg ?></p> |
108 | 109 | <?php } |
109 | 110 | |
110 | - if ( !is_subdomain_install() ) |
|
111 | - echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; |
|
112 | - else |
|
113 | - echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />'; |
|
111 | + if ( !is_subdomain_install() ) { |
|
112 | + echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; |
|
113 | + } else { |
|
114 | + echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />'; |
|
115 | + } |
|
114 | 116 | |
115 | 117 | if ( !is_user_logged_in() ) { |
116 | - if ( !is_subdomain_install() ) |
|
117 | - $site = $current_site->domain . $current_site->path . __( 'sitename' ); |
|
118 | - else |
|
119 | - $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; |
|
118 | + if ( !is_subdomain_install() ) { |
|
119 | + $site = $current_site->domain . $current_site->path . __( 'sitename' ); |
|
120 | + } else { |
|
121 | + $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; |
|
122 | + } |
|
120 | 123 | echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; |
121 | 124 | } |
122 | 125 | |
@@ -197,8 +200,9 @@ discard block |
||
197 | 200 | */ |
198 | 201 | function validate_blog_form() { |
199 | 202 | $user = ''; |
200 | - if ( is_user_logged_in() ) |
|
201 | - $user = wp_get_current_user(); |
|
203 | + if ( is_user_logged_in() ) { |
|
204 | + $user = wp_get_current_user(); |
|
205 | + } |
|
202 | 206 | |
203 | 207 | return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); |
204 | 208 | } |
@@ -482,8 +486,9 @@ discard block |
||
482 | 486 | function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
483 | 487 | global $active_signup; |
484 | 488 | |
485 | - if ( !is_wp_error($errors) ) |
|
486 | - $errors = new WP_Error(); |
|
489 | + if ( !is_wp_error($errors) ) { |
|
490 | + $errors = new WP_Error(); |
|
491 | + } |
|
487 | 492 | |
488 | 493 | $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; |
489 | 494 | |
@@ -604,8 +609,9 @@ discard block |
||
604 | 609 | * @param array $errors |
605 | 610 | */ |
606 | 611 | function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { |
607 | - if ( !is_wp_error($errors) ) |
|
608 | - $errors = new WP_Error(); |
|
612 | + if ( !is_wp_error($errors) ) { |
|
613 | + $errors = new WP_Error(); |
|
614 | + } |
|
609 | 615 | |
610 | 616 | $signup_blog_defaults = array( |
611 | 617 | 'user_name' => $user_name, |
@@ -638,8 +644,9 @@ discard block |
||
638 | 644 | $blog_title = $filtered_results['blog_title']; |
639 | 645 | $errors = $filtered_results['errors']; |
640 | 646 | |
641 | - if ( empty($blogname) ) |
|
642 | - $blogname = $user_name; |
|
647 | + if ( empty($blogname) ) { |
|
648 | + $blogname = $user_name; |
|
649 | + } |
|
643 | 650 | ?> |
644 | 651 | <form id="setupform" method="post" action="wp-signup.php"> |
645 | 652 | <input type="hidden" name="stage" value="validate-blog-signup" /> |
@@ -798,8 +805,9 @@ discard block |
||
798 | 805 | $i18n_signup['blog'] = _x('blog', 'Multisite active signup type'); |
799 | 806 | $i18n_signup['user'] = _x('user', 'Multisite active signup type'); |
800 | 807 | |
801 | -if ( is_super_admin() ) |
|
808 | +if ( is_super_admin() ) { |
|
802 | 809 | echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; |
810 | +} |
|
803 | 811 | |
804 | 812 | $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; |
805 | 813 | |
@@ -813,16 +821,18 @@ discard block |
||
813 | 821 | $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
814 | 822 | switch ( $stage ) { |
815 | 823 | case 'validate-user-signup' : |
816 | - if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) |
|
817 | - validate_user_signup(); |
|
818 | - else |
|
819 | - _e( 'User registration has been disabled.' ); |
|
824 | + if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) { |
|
825 | + validate_user_signup(); |
|
826 | + } else { |
|
827 | + _e( 'User registration has been disabled.' ); |
|
828 | + } |
|
820 | 829 | break; |
821 | 830 | case 'validate-blog-signup': |
822 | - if ( $active_signup == 'all' || $active_signup == 'blog' ) |
|
823 | - validate_blog_signup(); |
|
824 | - else |
|
825 | - _e( 'Site registration has been disabled.' ); |
|
831 | + if ( $active_signup == 'all' || $active_signup == 'blog' ) { |
|
832 | + validate_blog_signup(); |
|
833 | + } else { |
|
834 | + _e( 'Site registration has been disabled.' ); |
|
835 | + } |
|
826 | 836 | break; |
827 | 837 | case 'gimmeanotherblog': |
828 | 838 | validate_another_blog_signup(); |
@@ -836,28 +846,30 @@ discard block |
||
836 | 846 | * @since 3.0.0 |
837 | 847 | */ |
838 | 848 | do_action( 'preprocess_signup_form' ); |
839 | - if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) |
|
840 | - signup_another_blog($newblogname); |
|
841 | - elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) |
|
842 | - signup_user( $newblogname, $user_email ); |
|
843 | - elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) |
|
844 | - _e( 'Sorry, new registrations are not allowed at this time.' ); |
|
845 | - else |
|
846 | - _e( 'You are logged in already. No need to register again!' ); |
|
849 | + if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { |
|
850 | + signup_another_blog($newblogname); |
|
851 | + } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) { |
|
852 | + signup_user( $newblogname, $user_email ); |
|
853 | + } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) { |
|
854 | + _e( 'Sorry, new registrations are not allowed at this time.' ); |
|
855 | + } else { |
|
856 | + _e( 'You are logged in already. No need to register again!' ); |
|
857 | + } |
|
847 | 858 | |
848 | 859 | if ( $newblogname ) { |
849 | 860 | $newblog = get_blogaddress_by_name( $newblogname ); |
850 | 861 | |
851 | - if ( $active_signup == 'blog' || $active_signup == 'all' ) |
|
852 | - /* translators: %s: site address */ |
|
862 | + if ( $active_signup == 'blog' || $active_signup == 'all' ) { |
|
863 | + /* translators: %s: site address */ |
|
853 | 864 | printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
854 | 865 | '<strong>' . $newblog . '</strong>' |
855 | 866 | ); |
856 | - else |
|
857 | - /* translators: %s: site address */ |
|
867 | + } else { |
|
868 | + /* translators: %s: site address */ |
|
858 | 869 | printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
859 | 870 | '<strong>' . $newblog . '</strong>' |
860 | 871 | ); |
872 | + } |
|
861 | 873 | } |
862 | 874 | break; |
863 | 875 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Handles Comment Post to WordPress and prevents duplicate comment posting. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - */ |
|
3 | + * Handles Comment Post to WordPress and prevents duplicate comment posting. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { |
9 | 9 | header('Allow: POST'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package WordPress |
6 | 6 | */ |
7 | 7 | |
8 | -if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { |
|
8 | +if ('POST' != $_SERVER['REQUEST_METHOD']) { |
|
9 | 9 | header('Allow: POST'); |
10 | 10 | header('HTTP/1.1 405 Method Not Allowed'); |
11 | 11 | header('Content-Type: text/plain'); |
@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | /** Sets up the WordPress Environment. */ |
16 | -require( dirname(__FILE__) . '/wp-load.php' ); |
|
16 | +require(dirname(__FILE__).'/wp-load.php'); |
|
17 | 17 | |
18 | 18 | nocache_headers(); |
19 | 19 | |
20 | -$comment = wp_handle_comment_submission( wp_unslash( $_POST ) ); |
|
21 | -if ( is_wp_error( $comment ) ) { |
|
22 | - $data = intval( $comment->get_error_data() ); |
|
23 | - if ( ! empty( $data ) ) { |
|
24 | - wp_die( '<p>' . $comment->get_error_message() . '</p>', __( 'Comment Submission Failure' ), array( 'response' => $data, 'back_link' => true ) ); |
|
20 | +$comment = wp_handle_comment_submission(wp_unslash($_POST)); |
|
21 | +if (is_wp_error($comment)) { |
|
22 | + $data = intval($comment->get_error_data()); |
|
23 | + if ( ! empty($data)) { |
|
24 | + wp_die('<p>'.$comment->get_error_message().'</p>', __('Comment Submission Failure'), array('response' => $data, 'back_link' => true)); |
|
25 | 25 | } else { |
26 | 26 | exit; |
27 | 27 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * @param WP_Comment $comment Comment object. |
38 | 38 | * @param WP_User $user User object. The user may not exist. |
39 | 39 | */ |
40 | -do_action( 'set_comment_cookies', $comment, $user ); |
|
40 | +do_action('set_comment_cookies', $comment, $user); |
|
41 | 41 | |
42 | -$location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID; |
|
42 | +$location = empty($_POST['redirect_to']) ? get_comment_link($comment) : $_POST['redirect_to'].'#comment-'.$comment->comment_ID; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Filter the location URI to send the commenter after posting. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $location The 'redirect_to' URI sent via $_POST. |
50 | 50 | * @param WP_Comment $comment Comment object. |
51 | 51 | */ |
52 | -$location = apply_filters( 'comment_post_redirect', $location, $comment ); |
|
52 | +$location = apply_filters('comment_post_redirect', $location, $comment); |
|
53 | 53 | |
54 | -wp_safe_redirect( $location ); |
|
54 | +wp_safe_redirect($location); |
|
55 | 55 | exit; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | ignore_user_abort(true); |
13 | 13 | |
14 | -if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') ) |
|
14 | +if ( ! empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON')) |
|
15 | 15 | die(); |
16 | 16 | |
17 | 17 | /** |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | define('DOING_CRON', true); |
23 | 23 | |
24 | -if ( !defined('ABSPATH') ) { |
|
24 | +if ( ! defined('ABSPATH')) { |
|
25 | 25 | /** Set up WordPress environment */ |
26 | - require_once( dirname( __FILE__ ) . '/wp-load.php' ); |
|
26 | + require_once(dirname(__FILE__).'/wp-load.php'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -40,44 +40,44 @@ discard block |
||
40 | 40 | global $wpdb; |
41 | 41 | |
42 | 42 | $value = 0; |
43 | - if ( wp_using_ext_object_cache() ) { |
|
43 | + if (wp_using_ext_object_cache()) { |
|
44 | 44 | /* |
45 | 45 | * Skip local cache and force re-fetch of doing_cron transient |
46 | 46 | * in case another process updated the cache. |
47 | 47 | */ |
48 | - $value = wp_cache_get( 'doing_cron', 'transient', true ); |
|
48 | + $value = wp_cache_get('doing_cron', 'transient', true); |
|
49 | 49 | } else { |
50 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); |
|
51 | - if ( is_object( $row ) ) |
|
50 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron')); |
|
51 | + if (is_object($row)) |
|
52 | 52 | $value = $row->option_value; |
53 | 53 | } |
54 | 54 | |
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 | |
58 | -if ( false === $crons = _get_cron_array() ) |
|
58 | +if (false === $crons = _get_cron_array()) |
|
59 | 59 | die(); |
60 | 60 | |
61 | -$keys = array_keys( $crons ); |
|
62 | -$gmt_time = microtime( true ); |
|
61 | +$keys = array_keys($crons); |
|
62 | +$gmt_time = microtime(true); |
|
63 | 63 | |
64 | -if ( isset($keys[0]) && $keys[0] > $gmt_time ) |
|
64 | +if (isset($keys[0]) && $keys[0] > $gmt_time) |
|
65 | 65 | die(); |
66 | 66 | |
67 | 67 | |
68 | 68 | // The cron lock: a unix timestamp from when the cron was spawned. |
69 | -$doing_cron_transient = get_transient( 'doing_cron' ); |
|
69 | +$doing_cron_transient = get_transient('doing_cron'); |
|
70 | 70 | |
71 | 71 | // Use global $doing_wp_cron lock otherwise use the GET lock. If no lock, trying grabbing a new lock. |
72 | -if ( empty( $doing_wp_cron ) ) { |
|
73 | - if ( empty( $_GET[ 'doing_wp_cron' ] ) ) { |
|
72 | +if (empty($doing_wp_cron)) { |
|
73 | + if (empty($_GET['doing_wp_cron'])) { |
|
74 | 74 | // Called from external script/job. Try setting a lock. |
75 | - if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) |
|
75 | + if ($doing_cron_transient && ($doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time)) |
|
76 | 76 | return; |
77 | - $doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); |
|
78 | - set_transient( 'doing_cron', $doing_wp_cron ); |
|
77 | + $doing_cron_transient = $doing_wp_cron = sprintf('%.22F', microtime(true)); |
|
78 | + set_transient('doing_cron', $doing_wp_cron); |
|
79 | 79 | } else { |
80 | - $doing_wp_cron = $_GET[ 'doing_wp_cron' ]; |
|
80 | + $doing_wp_cron = $_GET['doing_wp_cron']; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | * The cron lock (a unix timestamp set when the cron was spawned), |
86 | 86 | * must match $doing_wp_cron (the "key"). |
87 | 87 | */ |
88 | -if ( $doing_cron_transient != $doing_wp_cron ) |
|
88 | +if ($doing_cron_transient != $doing_wp_cron) |
|
89 | 89 | return; |
90 | 90 | |
91 | -foreach ( $crons as $timestamp => $cronhooks ) { |
|
92 | - if ( $timestamp > $gmt_time ) |
|
91 | +foreach ($crons as $timestamp => $cronhooks) { |
|
92 | + if ($timestamp > $gmt_time) |
|
93 | 93 | break; |
94 | 94 | |
95 | - foreach ( $cronhooks as $hook => $keys ) { |
|
95 | + foreach ($cronhooks as $hook => $keys) { |
|
96 | 96 | |
97 | - foreach ( $keys as $k => $v ) { |
|
97 | + foreach ($keys as $k => $v) { |
|
98 | 98 | |
99 | 99 | $schedule = $v['schedule']; |
100 | 100 | |
101 | - if ( $schedule != false ) { |
|
101 | + if ($schedule != false) { |
|
102 | 102 | $new_args = array($timestamp, $schedule, $hook, $v['args']); |
103 | 103 | call_user_func_array('wp_reschedule_event', $new_args); |
104 | 104 | } |
105 | 105 | |
106 | - wp_unschedule_event( $timestamp, $hook, $v['args'] ); |
|
106 | + wp_unschedule_event($timestamp, $hook, $v['args']); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Fires scheduled events. |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | * @param string $hook Name of the hook that was scheduled to be fired. |
115 | 115 | * @param array $args The arguments to be passed to the hook. |
116 | 116 | */ |
117 | - do_action_ref_array( $hook, $v['args'] ); |
|
117 | + do_action_ref_array($hook, $v['args']); |
|
118 | 118 | |
119 | 119 | // If the hook ran too long and another cron process stole the lock, quit. |
120 | - if ( _get_cron_lock() != $doing_wp_cron ) |
|
120 | + if (_get_cron_lock() != $doing_wp_cron) |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | -if ( _get_cron_lock() == $doing_wp_cron ) |
|
127 | - delete_transient( 'doing_cron' ); |
|
126 | +if (_get_cron_lock() == $doing_wp_cron) |
|
127 | + delete_transient('doing_cron'); |
|
128 | 128 | |
129 | 129 | die(); |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | |
12 | 12 | ignore_user_abort(true); |
13 | 13 | |
14 | -if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') ) |
|
14 | +if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') ) { |
|
15 | 15 | die(); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Tell WordPress we are doing the CRON task. |
@@ -48,21 +49,24 @@ discard block |
||
48 | 49 | $value = wp_cache_get( 'doing_cron', 'transient', true ); |
49 | 50 | } else { |
50 | 51 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); |
51 | - if ( is_object( $row ) ) |
|
52 | - $value = $row->option_value; |
|
52 | + if ( is_object( $row ) ) { |
|
53 | + $value = $row->option_value; |
|
54 | + } |
|
53 | 55 | } |
54 | 56 | |
55 | 57 | return $value; |
56 | 58 | } |
57 | 59 | |
58 | -if ( false === $crons = _get_cron_array() ) |
|
60 | +if ( false === $crons = _get_cron_array() ) { |
|
59 | 61 | die(); |
62 | +} |
|
60 | 63 | |
61 | 64 | $keys = array_keys( $crons ); |
62 | 65 | $gmt_time = microtime( true ); |
63 | 66 | |
64 | -if ( isset($keys[0]) && $keys[0] > $gmt_time ) |
|
67 | +if ( isset($keys[0]) && $keys[0] > $gmt_time ) { |
|
65 | 68 | die(); |
69 | +} |
|
66 | 70 | |
67 | 71 | |
68 | 72 | // The cron lock: a unix timestamp from when the cron was spawned. |
@@ -72,8 +76,9 @@ discard block |
||
72 | 76 | if ( empty( $doing_wp_cron ) ) { |
73 | 77 | if ( empty( $_GET[ 'doing_wp_cron' ] ) ) { |
74 | 78 | // Called from external script/job. Try setting a lock. |
75 | - if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) |
|
76 | - return; |
|
79 | + if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) { |
|
80 | + return; |
|
81 | + } |
|
77 | 82 | $doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); |
78 | 83 | set_transient( 'doing_cron', $doing_wp_cron ); |
79 | 84 | } else { |
@@ -85,12 +90,14 @@ discard block |
||
85 | 90 | * The cron lock (a unix timestamp set when the cron was spawned), |
86 | 91 | * must match $doing_wp_cron (the "key"). |
87 | 92 | */ |
88 | -if ( $doing_cron_transient != $doing_wp_cron ) |
|
93 | +if ( $doing_cron_transient != $doing_wp_cron ) { |
|
89 | 94 | return; |
95 | +} |
|
90 | 96 | |
91 | 97 | foreach ( $crons as $timestamp => $cronhooks ) { |
92 | - if ( $timestamp > $gmt_time ) |
|
93 | - break; |
|
98 | + if ( $timestamp > $gmt_time ) { |
|
99 | + break; |
|
100 | + } |
|
94 | 101 | |
95 | 102 | foreach ( $cronhooks as $hook => $keys ) { |
96 | 103 | |
@@ -117,13 +124,15 @@ discard block |
||
117 | 124 | do_action_ref_array( $hook, $v['args'] ); |
118 | 125 | |
119 | 126 | // If the hook ran too long and another cron process stole the lock, quit. |
120 | - if ( _get_cron_lock() != $doing_wp_cron ) |
|
121 | - return; |
|
127 | + if ( _get_cron_lock() != $doing_wp_cron ) { |
|
128 | + return; |
|
129 | + } |
|
122 | 130 | } |
123 | 131 | } |
124 | 132 | } |
125 | 133 | |
126 | -if ( _get_cron_lock() == $doing_wp_cron ) |
|
134 | +if ( _get_cron_lock() == $doing_wp_cron ) { |
|
127 | 135 | delete_transient( 'doing_cron' ); |
136 | +} |
|
128 | 137 | |
129 | 138 | die(); |