Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
tools/i18n/extract.php 1 patch
Switch Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -75,35 +75,35 @@
 block discarded – undo
75 75
 		for( $i = 0; $i < count( $rule ); ++$i ) {
76 76
 			if ( $rule[$i] && ( !isset( $call['args'][$i] ) || !is_string( $call['args'][$i] ) || '' == $call['args'][$i] ) ) return false;
77 77
 			switch( $rule[$i] ) {
78
-			case 'string':
79
-				if ( $complete ) {
80
-					$multiple[] = $entry;
81
-					$entry = new Translation_Entry;
82
-					$complete = false;
83
-				}
84
-				$entry->singular = $call['args'][$i];
85
-				$complete = true;
86
-				break;
87
-			case 'singular':
88
-				if ( $complete ) {
89
-					$multiple[] = $entry;
90
-					$entry = new Translation_Entry;
91
-					$complete = false;
92
-				}
93
-				$entry->singular = $call['args'][$i];
94
-				$entry->is_plural = true;
95
-				break;
96
-			case 'plural':
97
-				$entry->plural = $call['args'][$i];
98
-				$entry->is_plural = true;
99
-				$complete = true;
100
-				break;
101
-			case 'context':
102
-				$entry->context = $call['args'][$i];
103
-				foreach( $multiple as &$single_entry ) {
104
-					$single_entry->context = $entry->context;
105
-				}
106
-				break;
78
+				case 'string':
79
+					if ( $complete ) {
80
+						$multiple[] = $entry;
81
+						$entry = new Translation_Entry;
82
+						$complete = false;
83
+					}
84
+					$entry->singular = $call['args'][$i];
85
+					$complete = true;
86
+					break;
87
+				case 'singular':
88
+					if ( $complete ) {
89
+						$multiple[] = $entry;
90
+						$entry = new Translation_Entry;
91
+						$complete = false;
92
+					}
93
+					$entry->singular = $call['args'][$i];
94
+					$entry->is_plural = true;
95
+					break;
96
+				case 'plural':
97
+					$entry->plural = $call['args'][$i];
98
+					$entry->is_plural = true;
99
+					$complete = true;
100
+					break;
101
+				case 'context':
102
+					$entry->context = $call['args'][$i];
103
+					foreach( $multiple as &$single_entry ) {
104
+						$single_entry->context = $entry->context;
105
+					}
106
+					break;
107 107
 			}
108 108
 		}
109 109
 		if ( isset( $call['line'] ) && $call['line'] ) {
Please login to merge, or discard this patch.
src/wp-login.php 1 patch
Switch Indentation   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 
468 468
 switch ($action) {
469 469
 
470
-case 'postpass' :
471
-	require_once ABSPATH . WPINC . '/class-phpass.php';
472
-	$hasher = new PasswordHash( 8, true );
470
+	case 'postpass' :
471
+		require_once ABSPATH . WPINC . '/class-phpass.php';
472
+		$hasher = new PasswordHash( 8, true );
473 473
 
474
-	/**
474
+		/**
475 475
 	 * Filter the life span of the post password cookie.
476 476
 	 *
477 477
 	 * By default, the cookie expires 10 days from creation. To turn this
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @param int $expires The expiry time, as passed to setcookie().
483 483
 	 */
484
-	$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
485
-	$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
486
-	setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
484
+		$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
485
+		$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
486
+		setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
487 487
 
488
-	wp_safe_redirect( wp_get_referer() );
489
-	exit();
488
+		wp_safe_redirect( wp_get_referer() );
489
+		exit();
490 490
 
491
-case 'logout' :
492
-	check_admin_referer('log-out');
491
+	case 'logout' :
492
+		check_admin_referer('log-out');
493 493
 
494
-	$user = wp_get_current_user();
494
+		$user = wp_get_current_user();
495 495
 
496
-	wp_logout();
496
+		wp_logout();
497 497
 
498
-	if ( ! empty( $_REQUEST['redirect_to'] ) ) {
499
-		$redirect_to = $requested_redirect_to = $_REQUEST['redirect_to'];
500
-	} else {
501
-		$redirect_to = 'wp-login.php?loggedout=true';
502
-		$requested_redirect_to = '';
503
-	}
498
+		if ( ! empty( $_REQUEST['redirect_to'] ) ) {
499
+			$redirect_to = $requested_redirect_to = $_REQUEST['redirect_to'];
500
+		} else {
501
+			$redirect_to = 'wp-login.php?loggedout=true';
502
+			$requested_redirect_to = '';
503
+		}
504 504
 
505
-	/**
505
+		/**
506 506
 	 * Filter the log out redirect URL.
507 507
 	 *
508 508
 	 * @since 4.2.0
@@ -511,52 +511,52 @@  discard block
 block discarded – undo
511 511
 	 * @param string  $requested_redirect_to The requested redirect destination URL passed as a parameter.
512 512
 	 * @param WP_User $user                  The WP_User object for the user that's logging out.
513 513
 	 */
514
-	$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
515
-	wp_safe_redirect( $redirect_to );
516
-	exit();
517
-
518
-case 'lostpassword' :
519
-case 'retrievepassword' :
520
-
521
-	if ( $http_post ) {
522
-		$errors = retrieve_password();
523
-		if ( !is_wp_error($errors) ) {
524
-			$redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
525
-			wp_safe_redirect( $redirect_to );
526
-			exit();
514
+		$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
515
+		wp_safe_redirect( $redirect_to );
516
+		exit();
517
+
518
+	case 'lostpassword' :
519
+	case 'retrievepassword' :
520
+
521
+		if ( $http_post ) {
522
+			$errors = retrieve_password();
523
+			if ( !is_wp_error($errors) ) {
524
+				$redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
525
+				wp_safe_redirect( $redirect_to );
526
+				exit();
527
+			}
527 528
 		}
528
-	}
529 529
 
530
-	if ( isset( $_GET['error'] ) ) {
531
-		if ( 'invalidkey' == $_GET['error'] ) {
532
-			$errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) );
533
-		} elseif ( 'expiredkey' == $_GET['error'] ) {
534
-			$errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) );
530
+		if ( isset( $_GET['error'] ) ) {
531
+			if ( 'invalidkey' == $_GET['error'] ) {
532
+				$errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) );
533
+			} elseif ( 'expiredkey' == $_GET['error'] ) {
534
+				$errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) );
535
+			}
535 536
 		}
536
-	}
537 537
 
538
-	$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
539
-	/**
538
+		$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
539
+		/**
540 540
 	 * Filter the URL redirected to after submitting the lostpassword/retrievepassword form.
541 541
 	 *
542 542
 	 * @since 3.0.0
543 543
 	 *
544 544
 	 * @param string $lostpassword_redirect The redirect destination URL.
545 545
 	 */
546
-	$redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect );
546
+		$redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect );
547 547
 
548
-	/**
548
+		/**
549 549
 	 * Fires before the lost password form.
550 550
 	 *
551 551
 	 * @since 1.5.1
552 552
 	 */
553
-	do_action( 'lost_password' );
553
+		do_action( 'lost_password' );
554 554
 
555
-	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);
555
+		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);
556 556
 
557
-	$user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
557
+		$user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
558 558
 
559
-?>
559
+	?>
560 560
 
561 561
 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
562 562
 	<p>
@@ -564,68 +564,68 @@  discard block
 block discarded – undo
564 564
 		<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
565 565
 	</p>
566 566
 	<?php
567
-	/**
567
+		/**
568 568
 	 * Fires inside the lostpassword form tags, before the hidden fields.
569 569
 	 *
570 570
 	 * @since 2.1.0
571 571
 	 */
572
-	do_action( 'lostpassword_form' ); ?>
573
-	<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
572
+		do_action( 'lostpassword_form' ); ?>
573
+		<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
574 574
 	<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>
575 575
 </form>
576 576
 
577 577
 <p id="nav">
578 578
 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
579
-<?php
580
-if ( get_option( 'users_can_register' ) ) :
581
-	$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
579
+	<?php
580
+	if ( get_option( 'users_can_register' ) ) :
581
+		$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
582 582
 
583
-	/** This filter is documented in wp-includes/general-template.php */
584
-	echo ' | ' . apply_filters( 'register', $registration_url );
585
-endif;
586
-?>
587
-</p>
583
+		/** This filter is documented in wp-includes/general-template.php */
584
+		echo ' | ' . apply_filters( 'register', $registration_url );
585
+	endif;
586
+	?>
587
+	</p>
588 588
 
589
-<?php
590
-login_footer('user_login');
591
-break;
592
-
593
-case 'resetpass' :
594
-case 'rp' :
595
-	list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
596
-	$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
597
-	if ( isset( $_GET['key'] ) ) {
598
-		$value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
599
-		setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
600
-		wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
601
-		exit;
602
-	}
589
+	<?php
590
+	login_footer('user_login');
591
+	break;
592
+
593
+	case 'resetpass' :
594
+	case 'rp' :
595
+		list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
596
+		$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
597
+		if ( isset( $_GET['key'] ) ) {
598
+			$value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
599
+			setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
600
+			wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
601
+			exit;
602
+		}
603 603
 
604
-	if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
605
-		list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
606
-		$user = check_password_reset_key( $rp_key, $rp_login );
607
-		if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
604
+		if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
605
+			list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
606
+			$user = check_password_reset_key( $rp_key, $rp_login );
607
+			if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
608
+				$user = false;
609
+			}
610
+		} else {
608 611
 			$user = false;
609 612
 		}
610
-	} else {
611
-		$user = false;
612
-	}
613 613
 
614
-	if ( ! $user || is_wp_error( $user ) ) {
615
-		setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
616
-		if ( $user && $user->get_error_code() === 'expired_key' )
617
-			wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
618
-		else
619
-			wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
620
-		exit;
621
-	}
614
+		if ( ! $user || is_wp_error( $user ) ) {
615
+			setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
616
+			if ( $user && $user->get_error_code() === 'expired_key' )
617
+				wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
618
+			else
619
+				wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
620
+			exit;
621
+		}
622 622
 
623
-	$errors = new WP_Error();
623
+		$errors = new WP_Error();
624 624
 
625
-	if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
626
-		$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
625
+		if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
626
+			$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
627 627
 
628
-	/**
628
+		/**
629 629
 	 * Fires before the password reset procedure is validated.
630 630
 	 *
631 631
 	 * @since 3.5.0
@@ -633,23 +633,23 @@  discard block
 block discarded – undo
633 633
 	 * @param object           $errors WP Error object.
634 634
 	 * @param WP_User|WP_Error $user   WP_User object if the login and reset key match. WP_Error object otherwise.
635 635
 	 */
636
-	do_action( 'validate_password_reset', $errors, $user );
637
-
638
-	if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
639
-		reset_password($user, $_POST['pass1']);
640
-		setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
641
-		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>' );
642
-		login_footer();
643
-		exit;
644
-	}
636
+		do_action( 'validate_password_reset', $errors, $user );
637
+
638
+		if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
639
+			reset_password($user, $_POST['pass1']);
640
+			setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
641
+			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>' );
642
+			login_footer();
643
+			exit;
644
+		}
645 645
 
646
-	wp_enqueue_script('utils');
647
-	wp_enqueue_script('user-profile');
646
+		wp_enqueue_script('utils');
647
+		wp_enqueue_script('user-profile');
648 648
 
649
-	login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
649
+		login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
650 650
 
651
-?>
652
-<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
651
+	?>
652
+	<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
653 653
 	<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
654 654
 
655 655
 	<p class="user-pass1-wrap">
@@ -670,77 +670,77 @@  discard block
 block discarded – undo
670 670
 	<br class="clear" />
671 671
 
672 672
 	<?php
673
-	/**
673
+		/**
674 674
 	 * Fires following the 'Strength indicator' meter in the user password reset form.
675 675
 	 *
676 676
 	 * @since 3.9.0
677 677
 	 *
678 678
 	 * @param WP_User $user User object of the user whose password is being reset.
679 679
 	 */
680
-	do_action( 'resetpass_form', $user );
681
-	?>
682
-	<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
680
+		do_action( 'resetpass_form', $user );
681
+		?>
682
+		<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
683 683
 	<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>
684 684
 </form>
685 685
 
686 686
 <p id="nav">
687 687
 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
688
-<?php
689
-if ( get_option( 'users_can_register' ) ) :
690
-	$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
688
+	<?php
689
+	if ( get_option( 'users_can_register' ) ) :
690
+		$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
691 691
 
692
-	/** This filter is documented in wp-includes/general-template.php */
693
-	echo ' | ' . apply_filters( 'register', $registration_url );
694
-endif;
695
-?>
696
-</p>
692
+		/** This filter is documented in wp-includes/general-template.php */
693
+		echo ' | ' . apply_filters( 'register', $registration_url );
694
+	endif;
695
+	?>
696
+	</p>
697 697
 
698
-<?php
699
-login_footer('user_pass');
700
-break;
698
+	<?php
699
+	login_footer('user_pass');
700
+	break;
701 701
 
702
-case 'register' :
703
-	if ( is_multisite() ) {
704
-		/**
702
+	case 'register' :
703
+		if ( is_multisite() ) {
704
+			/**
705 705
 		 * Filter the Multisite sign up URL.
706 706
 		 *
707 707
 		 * @since 3.0.0
708 708
 		 *
709 709
 		 * @param string $sign_up_url The sign up URL.
710 710
 		 */
711
-		wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
712
-		exit;
713
-	}
714
-
715
-	if ( !get_option('users_can_register') ) {
716
-		wp_redirect( site_url('wp-login.php?registration=disabled') );
717
-		exit();
718
-	}
711
+			wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
712
+			exit;
713
+		}
719 714
 
720
-	$user_login = '';
721
-	$user_email = '';
722
-	if ( $http_post ) {
723
-		$user_login = $_POST['user_login'];
724
-		$user_email = $_POST['user_email'];
725
-		$errors = register_new_user($user_login, $user_email);
726
-		if ( !is_wp_error($errors) ) {
727
-			$redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
728
-			wp_safe_redirect( $redirect_to );
715
+		if ( !get_option('users_can_register') ) {
716
+			wp_redirect( site_url('wp-login.php?registration=disabled') );
729 717
 			exit();
730 718
 		}
731
-	}
732 719
 
733
-	$registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
734
-	/**
720
+		$user_login = '';
721
+		$user_email = '';
722
+		if ( $http_post ) {
723
+			$user_login = $_POST['user_login'];
724
+			$user_email = $_POST['user_email'];
725
+			$errors = register_new_user($user_login, $user_email);
726
+			if ( !is_wp_error($errors) ) {
727
+				$redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
728
+				wp_safe_redirect( $redirect_to );
729
+				exit();
730
+			}
731
+		}
732
+
733
+		$registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
734
+		/**
735 735
 	 * Filter the registration redirect URL.
736 736
 	 *
737 737
 	 * @since 3.0.0
738 738
 	 *
739 739
 	 * @param string $registration_redirect The redirect destination URL.
740 740
 	 */
741
-	$redirect_to = apply_filters( 'registration_redirect', $registration_redirect );
742
-	login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
743
-?>
741
+		$redirect_to = apply_filters( 'registration_redirect', $registration_redirect );
742
+		login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
743
+	?>
744 744
 
745 745
 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
746 746
 	<p>
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
 		<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label>
753 753
 	</p>
754 754
 	<?php
755
-	/**
755
+		/**
756 756
 	 * Fires following the 'E-mail' field in the user registration form.
757 757
 	 *
758 758
 	 * @since 2.1.0
759 759
 	 */
760
-	do_action( 'register_form' );
761
-	?>
762
-	<p id="reg_passmail"><?php _e( 'Registration confirmation will be e-mailed to you.' ); ?></p>
760
+		do_action( 'register_form' );
761
+		?>
762
+		<p id="reg_passmail"><?php _e( 'Registration confirmation will be e-mailed to you.' ); ?></p>
763 763
 	<br class="clear" />
764 764
 	<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
765 765
 	<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>
@@ -771,53 +771,53 @@  discard block
 block discarded – undo
771 771
 </p>
772 772
 
773 773
 <?php
774
-login_footer('user_login');
775
-break;
776
-
777
-case 'login' :
778
-default:
779
-	$secure_cookie = '';
780
-	$customize_login = isset( $_REQUEST['customize-login'] );
781
-	if ( $customize_login )
782
-		wp_enqueue_script( 'customize-base' );
783
-
784
-	// If the user wants ssl but the session is not ssl, force a secure cookie.
785
-	if ( !empty($_POST['log']) && !force_ssl_admin() ) {
786
-		$user_name = sanitize_user($_POST['log']);
787
-		if ( $user = get_user_by('login', $user_name) ) {
788
-			if ( get_user_option('use_ssl', $user->ID) ) {
789
-				$secure_cookie = true;
790
-				force_ssl_admin(true);
774
+	login_footer('user_login');
775
+	break;
776
+
777
+	case 'login' :
778
+	default:
779
+		$secure_cookie = '';
780
+		$customize_login = isset( $_REQUEST['customize-login'] );
781
+		if ( $customize_login )
782
+			wp_enqueue_script( 'customize-base' );
783
+
784
+		// If the user wants ssl but the session is not ssl, force a secure cookie.
785
+		if ( !empty($_POST['log']) && !force_ssl_admin() ) {
786
+			$user_name = sanitize_user($_POST['log']);
787
+			if ( $user = get_user_by('login', $user_name) ) {
788
+				if ( get_user_option('use_ssl', $user->ID) ) {
789
+					$secure_cookie = true;
790
+					force_ssl_admin(true);
791
+				}
791 792
 			}
792 793
 		}
793
-	}
794 794
 
795
-	if ( isset( $_REQUEST['redirect_to'] ) ) {
796
-		$redirect_to = $_REQUEST['redirect_to'];
797
-		// Redirect to https if user wants ssl
798
-		if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
799
-			$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
800
-	} else {
801
-		$redirect_to = admin_url();
802
-	}
795
+		if ( isset( $_REQUEST['redirect_to'] ) ) {
796
+			$redirect_to = $_REQUEST['redirect_to'];
797
+			// Redirect to https if user wants ssl
798
+			if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
799
+				$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
800
+		} else {
801
+			$redirect_to = admin_url();
802
+		}
803 803
 
804
-	$reauth = empty($_REQUEST['reauth']) ? false : true;
804
+		$reauth = empty($_REQUEST['reauth']) ? false : true;
805 805
 
806
-	$user = wp_signon( '', $secure_cookie );
806
+		$user = wp_signon( '', $secure_cookie );
807 807
 
808
-	if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
809
-		if ( headers_sent() ) {
810
-			$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>.' ),
811
-				__( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
812
-		} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
813
-			// If cookies are disabled we can't log in even with a valid user+pass
814
-			$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.' ),
815
-				__( 'https://codex.wordpress.org/Cookies' ) ) );
808
+		if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
809
+			if ( headers_sent() ) {
810
+				$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>.' ),
811
+					__( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
812
+			} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
813
+				// If cookies are disabled we can't log in even with a valid user+pass
814
+				$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.' ),
815
+					__( 'https://codex.wordpress.org/Cookies' ) ) );
816
+			}
816 817
 		}
817
-	}
818 818
 
819
-	$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
820
-	/**
819
+		$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
820
+		/**
821 821
 	 * Filter the login redirect URL.
822 822
 	 *
823 823
 	 * @since 3.0.0
@@ -826,62 +826,62 @@  discard block
 block discarded – undo
826 826
 	 * @param string           $requested_redirect_to The requested redirect destination URL passed as a parameter.
827 827
 	 * @param WP_User|WP_Error $user                  WP_User object if login was successful, WP_Error object otherwise.
828 828
 	 */
829
-	$redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
830
-
831
-	if ( !is_wp_error($user) && !$reauth ) {
832
-		if ( $interim_login ) {
833
-			$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
834
-			$interim_login = 'success';
835
-			login_header( '', $message ); ?>
836
-			</div>
829
+		$redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
830
+
831
+		if ( !is_wp_error($user) && !$reauth ) {
832
+			if ( $interim_login ) {
833
+				$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
834
+				$interim_login = 'success';
835
+				login_header( '', $message ); ?>
836
+				</div>
837 837
 			<?php
838
-			/** This action is documented in wp-login.php */
839
-			do_action( 'login_footer' ); ?>
840
-			<?php if ( $customize_login ) : ?>
841
-				<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
838
+				/** This action is documented in wp-login.php */
839
+				do_action( 'login_footer' ); ?>
840
+				<?php if ( $customize_login ) : ?>
841
+					<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
842 842
 			<?php endif; ?>
843
-			</body></html>
844
-<?php		exit;
845
-		}
843
+				</body></html>
844
+	<?php		exit;
845
+			}
846 846
 
847
-		if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
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.
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 = admin_url('profile.php');
847
+			if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
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.
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 = admin_url('profile.php');
855
+			}
856
+			wp_safe_redirect($redirect_to);
857
+			exit();
855 858
 		}
856
-		wp_safe_redirect($redirect_to);
857
-		exit();
858
-	}
859 859
 
860
-	$errors = $user;
861
-	// Clear errors if loggedout is set.
862
-	if ( !empty($_GET['loggedout']) || $reauth )
863
-		$errors = new WP_Error();
860
+		$errors = $user;
861
+		// Clear errors if loggedout is set.
862
+		if ( !empty($_GET['loggedout']) || $reauth )
863
+			$errors = new WP_Error();
864 864
 
865
-	if ( $interim_login ) {
866
-		if ( ! $errors->get_error_code() )
867
-			$errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.'), 'message');
868
-	} else {
869
-		// Some parts of this script use the main login form to display a message
870
-		if		( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
871
-			$errors->add('loggedout', __('You are now logged out.'), 'message');
872
-		elseif	( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
873
-			$errors->add('registerdisabled', __('User registration is currently not allowed.'));
874
-		elseif	( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
875
-			$errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
876
-		elseif	( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
877
-			$errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
878
-		elseif	( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
879
-			$errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
880
-		elseif ( strpos( $redirect_to, 'about.php?updated' ) )
881
-			$errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
882
-	}
865
+		if ( $interim_login ) {
866
+			if ( ! $errors->get_error_code() )
867
+				$errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.'), 'message');
868
+		} else {
869
+			// Some parts of this script use the main login form to display a message
870
+			if		( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
871
+				$errors->add('loggedout', __('You are now logged out.'), 'message');
872
+			elseif	( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
873
+				$errors->add('registerdisabled', __('User registration is currently not allowed.'));
874
+			elseif	( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
875
+				$errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
876
+			elseif	( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
877
+				$errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
878
+			elseif	( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
879
+				$errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
880
+			elseif ( strpos( $redirect_to, 'about.php?updated' ) )
881
+				$errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
882
+		}
883 883
 
884
-	/**
884
+		/**
885 885
 	 * Filter the login page errors.
886 886
 	 *
887 887
 	 * @since 3.6.0
@@ -889,24 +889,24 @@  discard block
 block discarded – undo
889 889
 	 * @param object $errors      WP Error object.
890 890
 	 * @param string $redirect_to Redirect destination URL.
891 891
 	 */
892
-	$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
892
+		$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
893 893
 
894
-	// Clear any stale cookies.
895
-	if ( $reauth )
896
-		wp_clear_auth_cookie();
894
+		// Clear any stale cookies.
895
+		if ( $reauth )
896
+			wp_clear_auth_cookie();
897 897
 
898
-	login_header(__('Log In'), '', $errors);
898
+		login_header(__('Log In'), '', $errors);
899 899
 
900
-	if ( isset($_POST['log']) )
901
-		$user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
902
-	$rememberme = ! empty( $_POST['rememberme'] );
900
+		if ( isset($_POST['log']) )
901
+			$user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
902
+		$rememberme = ! empty( $_POST['rememberme'] );
903 903
 
904
-	if ( ! empty( $errors->errors ) ) {
905
-		$aria_describedby_error = ' aria-describedby="login_error"';
906
-	} else {
907
-		$aria_describedby_error = '';
908
-	}
909
-?>
904
+		if ( ! empty( $errors->errors ) ) {
905
+			$aria_describedby_error = ' aria-describedby="login_error"';
906
+		} else {
907
+			$aria_describedby_error = '';
908
+		}
909
+	?>
910 910
 
911 911
 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
912 912
 	<p>
@@ -918,42 +918,42 @@  discard block
 block discarded – undo
918 918
 		<input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label>
919 919
 	</p>
920 920
 	<?php
921
-	/**
921
+		/**
922 922
 	 * Fires following the 'Password' field in the login form.
923 923
 	 *
924 924
 	 * @since 2.1.0
925 925
 	 */
926
-	do_action( 'login_form' );
927
-	?>
928
-	<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>
926
+		do_action( 'login_form' );
927
+		?>
928
+		<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>
929 929
 	<p class="submit">
930 930
 		<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" />
931
-<?php	if ( $interim_login ) { ?>
932
-		<input type="hidden" name="interim-login" value="1" />
933
-<?php	} else { ?>
934
-		<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
935
-<?php 	} ?>
936
-<?php   if ( $customize_login ) : ?>
937
-		<input type="hidden" name="customize-login" value="1" />
938
-<?php   endif; ?>
931
+	<?php	if ( $interim_login ) { ?>
932
+			<input type="hidden" name="interim-login" value="1" />
933
+	<?php	} else { ?>
934
+			<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
935
+	<?php 	} ?>
936
+	<?php   if ( $customize_login ) : ?>
937
+			<input type="hidden" name="customize-login" value="1" />
938
+	<?php   endif; ?>
939 939
 		<input type="hidden" name="testcookie" value="1" />
940 940
 	</p>
941 941
 </form>
942 942
 
943 943
 <?php if ( ! $interim_login ) { ?>
944
-<p id="nav">
945
-<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :
946
-	if ( get_option( 'users_can_register' ) ) :
947
-		$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
948
-
949
-		/** This filter is documented in wp-includes/general-template.php */
950
-		echo apply_filters( 'register', $registration_url ) . ' | ';
951
-	endif;
952
-	?>
953
-	<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
954
-<?php endif; ?>
955
-</p>
956
-<?php } ?>
944
+	<p id="nav">
945
+	<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :
946
+		if ( get_option( 'users_can_register' ) ) :
947
+			$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
948
+
949
+			/** This filter is documented in wp-includes/general-template.php */
950
+			echo apply_filters( 'register', $registration_url ) . ' | ';
951
+		endif;
952
+		?>
953
+		<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
954
+	<?php endif; ?>
955
+	</p>
956
+	<?php } ?>
957 957
 
958 958
 <script type="text/javascript">
959 959
 function wp_attempt_focus(){
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 d = document.getElementById('user_pass');
963 963
 d.value = '';
964 964
 <?php } else { ?>
965
-d = document.getElementById('user_login');
966
-<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
965
+	d = document.getElementById('user_login');
966
+	<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
967 967
 if( d.value != '' )
968 968
 d.value = '';
969 969
 <?php
@@ -976,10 +976,10 @@  discard block
 block discarded – undo
976 976
 }
977 977
 
978 978
 <?php if ( !$error ) { ?>
979
-wp_attempt_focus();
980
-<?php } ?>
981
-if(typeof wpOnload=='function')wpOnload();
982
-<?php if ( $interim_login ) { ?>
979
+	wp_attempt_focus();
980
+	<?php } ?>
981
+	if(typeof wpOnload=='function')wpOnload();
982
+	<?php if ( $interim_login ) { ?>
983 983
 (function(){
984 984
 try {
985 985
 	var i, links = document.getElementsByTagName('a');
@@ -990,9 +990,9 @@  discard block
 block discarded – undo
990 990
 } catch(e){}
991 991
 }());
992 992
 <?php } ?>
993
-</script>
993
+	</script>
994 994
 
995
-<?php
996
-login_footer();
997
-break;
995
+	<?php
996
+	login_footer();
997
+	break;
998 998
 } // end action switch
Please login to merge, or discard this patch.
src/wp-admin/users.php 1 patch
Switch Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -97,88 +97,88 @@  discard block
 block discarded – undo
97 97
 switch ( $wp_list_table->current_action() ) {
98 98
 
99 99
 /* Bulk Dropdown menu Role changes */
100
-case 'promote':
101
-	check_admin_referer('bulk-users');
100
+	case 'promote':
101
+		check_admin_referer('bulk-users');
102 102
 
103
-	if ( ! current_user_can( 'promote_users' ) )
104
-		wp_die( __( 'You can&#8217;t edit that user.' ) );
103
+		if ( ! current_user_can( 'promote_users' ) )
104
+			wp_die( __( 'You can&#8217;t edit that user.' ) );
105 105
 
106
-	if ( empty($_REQUEST['users']) ) {
107
-		wp_redirect($redirect);
108
-		exit();
109
-	}
110
-
111
-	$editable_roles = get_editable_roles();
112
-	if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
113
-		wp_die(__('You can&#8217;t give users that role.'));
114
-
115
-	$userids = $_REQUEST['users'];
116
-	$update = 'promote';
117
-	foreach ( $userids as $id ) {
118
-		$id = (int) $id;
119
-
120
-		if ( ! current_user_can('promote_user', $id) )
121
-			wp_die(__('You can&#8217;t edit that user.'));
122
-		// The new role of the current user must also have the promote_users cap or be a multisite super admin
123
-		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
124
-			&& ! ( is_multisite() && is_super_admin() ) ) {
125
-				$update = 'err_admin_role';
126
-				continue;
106
+		if ( empty($_REQUEST['users']) ) {
107
+			wp_redirect($redirect);
108
+			exit();
127 109
 		}
128 110
 
129
-		// If the user doesn't already belong to the blog, bail.
130
-		if ( is_multisite() && !is_user_member_of_blog( $id ) )
131
-			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
132
-
133
-		$user = get_userdata( $id );
134
-		$user->set_role($_REQUEST['new_role']);
135
-	}
111
+		$editable_roles = get_editable_roles();
112
+		if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
113
+			wp_die(__('You can&#8217;t give users that role.'));
136 114
 
137
-	wp_redirect(add_query_arg('update', $update, $redirect));
138
-	exit();
115
+		$userids = $_REQUEST['users'];
116
+		$update = 'promote';
117
+		foreach ( $userids as $id ) {
118
+			$id = (int) $id;
119
+
120
+			if ( ! current_user_can('promote_user', $id) )
121
+				wp_die(__('You can&#8217;t edit that user.'));
122
+			// The new role of the current user must also have the promote_users cap or be a multisite super admin
123
+			if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
124
+				&& ! ( is_multisite() && is_super_admin() ) ) {
125
+					$update = 'err_admin_role';
126
+					continue;
127
+			}
139 128
 
140
-case 'dodelete':
141
-	if ( is_multisite() )
142
-		wp_die( __('User deletion is not allowed from this screen.') );
129
+			// If the user doesn't already belong to the blog, bail.
130
+			if ( is_multisite() && !is_user_member_of_blog( $id ) )
131
+				wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
143 132
 
144
-	check_admin_referer('delete-users');
133
+			$user = get_userdata( $id );
134
+			$user->set_role($_REQUEST['new_role']);
135
+		}
145 136
 
146
-	if ( empty($_REQUEST['users']) ) {
147
-		wp_redirect($redirect);
137
+		wp_redirect(add_query_arg('update', $update, $redirect));
148 138
 		exit();
149
-	}
150
-
151
-	$userids = array_map( 'intval', (array) $_REQUEST['users'] );
152 139
 
153
-	if ( empty( $_REQUEST['delete_option'] ) ) {
154
-		$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
155
-		$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
156
-		wp_redirect( $url );
157
-		exit;
158
-	}
140
+	case 'dodelete':
141
+		if ( is_multisite() )
142
+			wp_die( __('User deletion is not allowed from this screen.') );
159 143
 
160
-	if ( ! current_user_can( 'delete_users' ) )
161
-		wp_die(__('You can&#8217;t delete users.'));
144
+		check_admin_referer('delete-users');
162 145
 
163
-	$update = 'del';
164
-	$delete_count = 0;
146
+		if ( empty($_REQUEST['users']) ) {
147
+			wp_redirect($redirect);
148
+			exit();
149
+		}
165 150
 
166
-	foreach ( $userids as $id ) {
167
-		if ( ! current_user_can( 'delete_user', $id ) )
168
-			wp_die(__( 'You can&#8217;t delete that user.' ) );
151
+		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
169 152
 
170
-		if ( $id == $current_user->ID ) {
171
-			$update = 'err_admin_del';
172
-			continue;
173
-		}
174
-		switch ( $_REQUEST['delete_option'] ) {
175
-		case 'delete':
176
-			wp_delete_user( $id );
177
-			break;
178
-		case 'reassign':
179
-			wp_delete_user( $id, $_REQUEST['reassign_user'] );
180
-			break;
153
+		if ( empty( $_REQUEST['delete_option'] ) ) {
154
+			$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
155
+			$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
156
+			wp_redirect( $url );
157
+			exit;
181 158
 		}
159
+
160
+		if ( ! current_user_can( 'delete_users' ) )
161
+			wp_die(__('You can&#8217;t delete users.'));
162
+
163
+		$update = 'del';
164
+		$delete_count = 0;
165
+
166
+		foreach ( $userids as $id ) {
167
+			if ( ! current_user_can( 'delete_user', $id ) )
168
+				wp_die(__( 'You can&#8217;t delete that user.' ) );
169
+
170
+			if ( $id == $current_user->ID ) {
171
+				$update = 'err_admin_del';
172
+				continue;
173
+			}
174
+			switch ( $_REQUEST['delete_option'] ) {
175
+				case 'delete':
176
+					wp_delete_user( $id );
177
+					break;
178
+				case 'reassign':
179
+					wp_delete_user( $id, $_REQUEST['reassign_user'] );
180
+					break;
181
+			}
182 182
 		++$delete_count;
183 183
 	}
184 184
 
@@ -186,250 +186,250 @@  discard block
 block discarded – undo
186 186
 	wp_redirect($redirect);
187 187
 	exit();
188 188
 
189
-case 'delete':
190
-	if ( is_multisite() )
191
-		wp_die( __('User deletion is not allowed from this screen.') );
189
+	case 'delete':
190
+		if ( is_multisite() )
191
+			wp_die( __('User deletion is not allowed from this screen.') );
192 192
 
193
-	check_admin_referer('bulk-users');
193
+		check_admin_referer('bulk-users');
194 194
 
195
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
196
-		wp_redirect($redirect);
197
-		exit();
198
-	}
195
+		if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
196
+			wp_redirect($redirect);
197
+			exit();
198
+		}
199 199
 
200
-	if ( ! current_user_can( 'delete_users' ) )
201
-		$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
200
+		if ( ! current_user_can( 'delete_users' ) )
201
+			$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
202 202
 
203
-	if ( empty($_REQUEST['users']) )
204
-		$userids = array( intval( $_REQUEST['user'] ) );
205
-	else
206
-		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
203
+		if ( empty($_REQUEST['users']) )
204
+			$userids = array( intval( $_REQUEST['user'] ) );
205
+		else
206
+			$userids = array_map( 'intval', (array) $_REQUEST['users'] );
207 207
 
208
-	add_action( 'admin_head', 'delete_users_add_js' );
208
+		add_action( 'admin_head', 'delete_users_add_js' );
209 209
 
210
-	include( ABSPATH . 'wp-admin/admin-header.php' );
211
-?>
212
-<form method="post" name="updateusers" id="updateusers">
213
-<?php wp_nonce_field('delete-users') ?>
214
-<?php echo $referer; ?>
210
+		include( ABSPATH . 'wp-admin/admin-header.php' );
211
+	?>
212
+	<form method="post" name="updateusers" id="updateusers">
213
+	<?php wp_nonce_field('delete-users') ?>
214
+	<?php echo $referer; ?>
215 215
 
216 216
 <div class="wrap">
217 217
 <h1><?php _e( 'Delete Users' ); ?></h1>
218
-<?php if ( isset( $_REQUEST['error'] ) ) : ?>
218
+	<?php if ( isset( $_REQUEST['error'] ) ) : ?>
219 219
 	<div class="error">
220 220
 		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
221 221
 	</div>
222 222
 <?php endif; ?>
223
-
224
-<?php if ( 1 == count( $userids ) ) : ?>
225
-	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
226
-<?php else : ?>
227
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
228
-<?php endif; ?>
223
+	
224
+	<?php if ( 1 == count( $userids ) ) : ?>
225
+		<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
226
+	<?php else : ?>
227
+		<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
228
+	<?php endif; ?>
229 229
 
230 230
 <ul>
231 231
 <?php
232
-	$go_delete = 0;
233
-	foreach ( $userids as $id ) {
234
-		$user = get_userdata( $id );
235
-		if ( $id == $current_user->ID ) {
236
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
237
-		} else {
238
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
239
-			$go_delete++;
232
+		$go_delete = 0;
233
+		foreach ( $userids as $id ) {
234
+			$user = get_userdata( $id );
235
+			if ( $id == $current_user->ID ) {
236
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
237
+			} else {
238
+				echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
239
+				$go_delete++;
240
+			}
240 241
 		}
241
-	}
242
-	?>
243
-	</ul>
244
-<?php if ( $go_delete ) : ?>
245
-	<?php if ( 1 == $go_delete ) : ?>
246
-		<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
242
+		?>
243
+		</ul>
244
+	<?php if ( $go_delete ) : ?>
245
+		<?php if ( 1 == $go_delete ) : ?>
246
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
247 247
 	<?php else : ?>
248
-		<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
248
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
249 249
 	<?php endif; ?>
250 250
 	<ul style="list-style:none;">
251 251
 		<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
252 252
 		<?php _e('Delete all content.'); ?></label></li>
253 253
 		<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
254 254
 		<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
255
-		wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
255
+			wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
256 256
 	</ul></fieldset>
257 257
 	<?php
258
-	/**
258
+		/**
259 259
 	 * Fires at the end of the delete users form prior to the confirm button.
260 260
 	 *
261 261
 	 * @since 4.0.0
262 262
 	 *
263 263
 	 * @param WP_User $current_user WP_User object for the user being deleted.
264 264
 	 */
265
-	do_action( 'delete_user_form', $current_user );
266
-	?>
267
-	<input type="hidden" name="action" value="dodelete" />
265
+		do_action( 'delete_user_form', $current_user );
266
+		?>
267
+		<input type="hidden" name="action" value="dodelete" />
268 268
 	<?php submit_button( __('Confirm Deletion'), 'secondary' ); ?>
269
-<?php else : ?>
270
-	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
271
-<?php endif; ?>
269
+	<?php else : ?>
270
+		<p><?php _e('There are no valid users selected for deletion.'); ?></p>
271
+	<?php endif; ?>
272 272
 </div>
273 273
 </form>
274 274
 <?php
275 275
 
276
-break;
276
+	break;
277 277
 
278
-case 'doremove':
279
-	check_admin_referer('remove-users');
278
+	case 'doremove':
279
+		check_admin_referer('remove-users');
280 280
 
281
-	if ( ! is_multisite() )
282
-		wp_die( __( 'You can&#8217;t remove users.' ) );
281
+		if ( ! is_multisite() )
282
+			wp_die( __( 'You can&#8217;t remove users.' ) );
283 283
 
284
-	if ( empty($_REQUEST['users']) ) {
285
-		wp_redirect($redirect);
286
-		exit;
287
-	}
284
+		if ( empty($_REQUEST['users']) ) {
285
+			wp_redirect($redirect);
286
+			exit;
287
+		}
288 288
 
289
-	if ( ! current_user_can( 'remove_users' ) )
290
-		wp_die( __( 'You can&#8217;t remove users.' ) );
289
+		if ( ! current_user_can( 'remove_users' ) )
290
+			wp_die( __( 'You can&#8217;t remove users.' ) );
291 291
 
292
-	$userids = $_REQUEST['users'];
292
+		$userids = $_REQUEST['users'];
293 293
 
294
-	$update = 'remove';
295
- 	foreach ( $userids as $id ) {
296
-		$id = (int) $id;
297
-		if ( $id == $current_user->ID && !is_super_admin() ) {
298
-			$update = 'err_admin_remove';
299
-			continue;
300
-		}
301
-		if ( !current_user_can('remove_user', $id) ) {
302
-			$update = 'err_admin_remove';
303
-			continue;
294
+		$update = 'remove';
295
+ 		foreach ( $userids as $id ) {
296
+			$id = (int) $id;
297
+			if ( $id == $current_user->ID && !is_super_admin() ) {
298
+				$update = 'err_admin_remove';
299
+				continue;
300
+			}
301
+			if ( !current_user_can('remove_user', $id) ) {
302
+				$update = 'err_admin_remove';
303
+				continue;
304
+			}
305
+			remove_user_from_blog($id, $blog_id);
304 306
 		}
305
-		remove_user_from_blog($id, $blog_id);
306
-	}
307 307
 
308
-	$redirect = add_query_arg( array('update' => $update), $redirect);
309
-	wp_redirect($redirect);
310
-	exit;
308
+		$redirect = add_query_arg( array('update' => $update), $redirect);
309
+		wp_redirect($redirect);
310
+		exit;
311 311
 
312
-case 'remove':
312
+	case 'remove':
313 313
 
314
-	check_admin_referer('bulk-users');
314
+		check_admin_referer('bulk-users');
315 315
 
316
-	if ( ! is_multisite() )
317
-		wp_die( __( 'You can&#8217;t remove users.' ) );
316
+		if ( ! is_multisite() )
317
+			wp_die( __( 'You can&#8217;t remove users.' ) );
318 318
 
319
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
320
-		wp_redirect($redirect);
321
-		exit();
322
-	}
319
+		if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
320
+			wp_redirect($redirect);
321
+			exit();
322
+		}
323 323
 
324
-	if ( !current_user_can('remove_users') )
325
-		$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
324
+		if ( !current_user_can('remove_users') )
325
+			$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
326 326
 
327
-	if ( empty($_REQUEST['users']) )
328
-		$userids = array(intval($_REQUEST['user']));
329
-	else
330
-		$userids = $_REQUEST['users'];
327
+		if ( empty($_REQUEST['users']) )
328
+			$userids = array(intval($_REQUEST['user']));
329
+		else
330
+			$userids = $_REQUEST['users'];
331 331
 
332
-	include( ABSPATH . 'wp-admin/admin-header.php' );
333
-?>
334
-<form method="post" name="updateusers" id="updateusers">
335
-<?php wp_nonce_field('remove-users') ?>
336
-<?php echo $referer; ?>
332
+		include( ABSPATH . 'wp-admin/admin-header.php' );
333
+	?>
334
+	<form method="post" name="updateusers" id="updateusers">
335
+	<?php wp_nonce_field('remove-users') ?>
336
+	<?php echo $referer; ?>
337 337
 
338 338
 <div class="wrap">
339 339
 <h1><?php _e( 'Remove Users from Site' ); ?></h1>
340 340
 
341
-<?php if ( 1 == count( $userids ) ) : ?>
342
-	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
343
-<?php else : ?>
344
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
345
-<?php endif; ?>
341
+	<?php if ( 1 == count( $userids ) ) : ?>
342
+		<p><?php _e( 'You have specified this user for removal:' ); ?></p>
343
+	<?php else : ?>
344
+		<p><?php _e( 'You have specified these users for removal:' ); ?></p>
345
+	<?php endif; ?>
346 346
 
347 347
 <ul>
348 348
 <?php
349
-	$go_remove = false;
350
- 	foreach ( $userids as $id ) {
351
-		$id = (int) $id;
352
- 		$user = get_userdata( $id );
353
-		if ( $id == $current_user->ID && !is_super_admin() ) {
354
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
355
-		} elseif ( !current_user_can('remove_user', $id) ) {
356
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
357
-		} else {
358
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
359
-			$go_remove = true;
360
-		}
361
- 	}
362
- 	?>
363
-</ul>
364
-<?php if ( $go_remove ) : ?>
365
-		<input type="hidden" name="action" value="doremove" />
349
+		$go_remove = false;
350
+ 		foreach ( $userids as $id ) {
351
+			$id = (int) $id;
352
+ 			$user = get_userdata( $id );
353
+			if ( $id == $current_user->ID && !is_super_admin() ) {
354
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
355
+			} elseif ( !current_user_can('remove_user', $id) ) {
356
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
357
+			} else {
358
+				echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
359
+				$go_remove = true;
360
+			}
361
+ 		}
362
+ 		?>
363
+	</ul>
364
+	<?php if ( $go_remove ) : ?>
365
+			<input type="hidden" name="action" value="doremove" />
366 366
 		<?php submit_button( __('Confirm Removal'), 'secondary' ); ?>
367
-<?php else : ?>
368
-	<p><?php _e('There are no valid users selected for removal.'); ?></p>
369
-<?php endif; ?>
367
+	<?php else : ?>
368
+		<p><?php _e('There are no valid users selected for removal.'); ?></p>
369
+	<?php endif; ?>
370 370
 </div>
371 371
 </form>
372 372
 <?php
373 373
 
374
-break;
375
-
376
-default:
374
+	break;
377 375
 
378
-	if ( !empty($_GET['_wp_http_referer']) ) {
379
-		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
380
-		exit;
381
-	}
376
+	default:
382 377
 
383
-	$wp_list_table->prepare_items();
384
-	$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
385
-	if ( $pagenum > $total_pages && $total_pages > 0 ) {
386
-		wp_redirect( add_query_arg( 'paged', $total_pages ) );
387
-		exit;
388
-	}
378
+		if ( !empty($_GET['_wp_http_referer']) ) {
379
+			wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
380
+			exit;
381
+		}
389 382
 
390
-	include( ABSPATH . 'wp-admin/admin-header.php' );
383
+		$wp_list_table->prepare_items();
384
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
385
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
386
+			wp_redirect( add_query_arg( 'paged', $total_pages ) );
387
+			exit;
388
+		}
391 389
 
392
-	$messages = array();
393
-	if ( isset($_GET['update']) ) :
394
-		switch($_GET['update']) {
395
-		case 'del':
396
-		case 'del_many':
397
-			$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
398
-			if ( 1 == $delete_count ) {
399
-				$message = __( 'User deleted.' );
400
-			} else {
401
-				$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
390
+		include( ABSPATH . 'wp-admin/admin-header.php' );
391
+
392
+		$messages = array();
393
+		if ( isset($_GET['update']) ) :
394
+			switch($_GET['update']) {
395
+				case 'del':
396
+				case 'del_many':
397
+					$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
398
+					if ( 1 == $delete_count ) {
399
+						$message = __( 'User deleted.' );
400
+					} else {
401
+						$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
402
+					}
403
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
404
+					break;
405
+				case 'add':
406
+					if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
407
+						$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
408
+							esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
409
+								self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
410
+					} else {
411
+						$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
412
+					}
413
+					break;
414
+				case 'promote':
415
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
416
+					break;
417
+				case 'err_admin_role':
418
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
419
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
420
+					break;
421
+				case 'err_admin_del':
422
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
423
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
424
+					break;
425
+				case 'remove':
426
+					$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
427
+					break;
428
+				case 'err_admin_remove':
429
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
430
+					$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
431
+					break;
402 432
 			}
403
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
404
-			break;
405
-		case 'add':
406
-			if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
407
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
408
-					esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
409
-						self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
410
-			} else {
411
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
412
-			}
413
-			break;
414
-		case 'promote':
415
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
416
-			break;
417
-		case 'err_admin_role':
418
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
419
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
420
-			break;
421
-		case 'err_admin_del':
422
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
423
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
424
-			break;
425
-		case 'remove':
426
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
427
-			break;
428
-		case 'err_admin_remove':
429
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
430
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
431
-			break;
432
-		}
433 433
 	endif; ?>
434 434
 
435 435
 <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
Please login to merge, or discard this patch.
src/wp-admin/network/site-users.php 1 patch
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -203,36 +203,36 @@
 block discarded – undo
203 203
 
204 204
 if ( isset($_GET['update']) ) :
205 205
 	switch($_GET['update']) {
206
-	case 'adduser':
207
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
208
-		break;
209
-	case 'err_add_member':
210
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
211
-		break;
212
-	case 'err_add_notfound':
213
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
214
-		break;
215
-	case 'promote':
216
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
217
-		break;
218
-	case 'err_promote':
219
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
220
-		break;
221
-	case 'remove':
222
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
223
-		break;
224
-	case 'err_remove':
225
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
226
-		break;
227
-	case 'newuser':
228
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
229
-		break;
230
-	case 'err_new':
231
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
232
-		break;
233
-	case 'err_new_dup':
234
-		echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
235
-		break;
206
+		case 'adduser':
207
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
208
+			break;
209
+		case 'err_add_member':
210
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
211
+			break;
212
+		case 'err_add_notfound':
213
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
214
+			break;
215
+		case 'promote':
216
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
217
+			break;
218
+		case 'err_promote':
219
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
220
+			break;
221
+		case 'remove':
222
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
223
+			break;
224
+		case 'err_remove':
225
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
226
+			break;
227
+		case 'newuser':
228
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
229
+			break;
230
+		case 'err_new':
231
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
232
+			break;
233
+		case 'err_new_dup':
234
+			echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
235
+			break;
236 236
 	}
237 237
 endif; ?>
238 238
 
Please login to merge, or discard this patch.
src/wp-admin/edit-tags.php 1 patch
Switch Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -49,119 +49,119 @@
 block discarded – undo
49 49
 
50 50
 switch ( $wp_list_table->current_action() ) {
51 51
 
52
-case 'add-tag':
52
+	case 'add-tag':
53 53
 
54
-	check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
54
+		check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
55 55
 
56
-	if ( !current_user_can( $tax->cap->edit_terms ) )
57
-		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
56
+		if ( !current_user_can( $tax->cap->edit_terms ) )
57
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
58 58
 
59
-	$ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
60
-	$location = 'edit-tags.php?taxonomy=' . $taxonomy;
61
-	if ( 'post' != $post_type )
62
-		$location .= '&post_type=' . $post_type;
59
+		$ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
60
+		$location = 'edit-tags.php?taxonomy=' . $taxonomy;
61
+		if ( 'post' != $post_type )
62
+			$location .= '&post_type=' . $post_type;
63 63
 
64
-	if ( $referer = wp_get_original_referer() ) {
65
-		if ( false !== strpos( $referer, 'edit-tags.php' ) )
66
-			$location = $referer;
67
-	}
64
+		if ( $referer = wp_get_original_referer() ) {
65
+			if ( false !== strpos( $referer, 'edit-tags.php' ) )
66
+				$location = $referer;
67
+		}
68 68
 
69
-	if ( $ret && !is_wp_error( $ret ) )
70
-		$location = add_query_arg( 'message', 1, $location );
71
-	else
72
-		$location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location );
69
+		if ( $ret && !is_wp_error( $ret ) )
70
+			$location = add_query_arg( 'message', 1, $location );
71
+		else
72
+			$location = add_query_arg( array( 'error' => true, 'message' => 4 ), $location );
73 73
 
74
-	break;
74
+		break;
75 75
 
76
-case 'delete':
77
-	$location = 'edit-tags.php?taxonomy=' . $taxonomy;
78
-	if ( 'post' != $post_type )
79
-		$location .= '&post_type=' . $post_type;
80
-	if ( $referer = wp_get_referer() ) {
81
-		if ( false !== strpos( $referer, 'edit-tags.php' ) )
82
-			$location = $referer;
83
-	}
76
+	case 'delete':
77
+		$location = 'edit-tags.php?taxonomy=' . $taxonomy;
78
+		if ( 'post' != $post_type )
79
+			$location .= '&post_type=' . $post_type;
80
+		if ( $referer = wp_get_referer() ) {
81
+			if ( false !== strpos( $referer, 'edit-tags.php' ) )
82
+				$location = $referer;
83
+		}
84 84
 
85
-	if ( ! isset( $_REQUEST['tag_ID'] ) ) {
86
-		break;
87
-	}
85
+		if ( ! isset( $_REQUEST['tag_ID'] ) ) {
86
+			break;
87
+		}
88 88
 
89
-	$tag_ID = (int) $_REQUEST['tag_ID'];
90
-	check_admin_referer( 'delete-tag_' . $tag_ID );
89
+		$tag_ID = (int) $_REQUEST['tag_ID'];
90
+		check_admin_referer( 'delete-tag_' . $tag_ID );
91 91
 
92
-	if ( !current_user_can( $tax->cap->delete_terms ) )
93
-		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
92
+		if ( !current_user_can( $tax->cap->delete_terms ) )
93
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
94 94
 
95
-	wp_delete_term( $tag_ID, $taxonomy );
95
+		wp_delete_term( $tag_ID, $taxonomy );
96 96
 
97
-	$location = add_query_arg( 'message', 2, $location );
97
+		$location = add_query_arg( 'message', 2, $location );
98 98
 
99
-	break;
99
+		break;
100 100
 
101
-case 'bulk-delete':
102
-	check_admin_referer( 'bulk-tags' );
101
+	case 'bulk-delete':
102
+		check_admin_referer( 'bulk-tags' );
103 103
 
104
-	if ( !current_user_can( $tax->cap->delete_terms ) )
105
-		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
104
+		if ( !current_user_can( $tax->cap->delete_terms ) )
105
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
106 106
 
107
-	$tags = (array) $_REQUEST['delete_tags'];
108
-	foreach ( $tags as $tag_ID ) {
109
-		wp_delete_term( $tag_ID, $taxonomy );
110
-	}
107
+		$tags = (array) $_REQUEST['delete_tags'];
108
+		foreach ( $tags as $tag_ID ) {
109
+			wp_delete_term( $tag_ID, $taxonomy );
110
+		}
111 111
 
112
-	$location = 'edit-tags.php?taxonomy=' . $taxonomy;
113
-	if ( 'post' != $post_type )
114
-		$location .= '&post_type=' . $post_type;
115
-	if ( $referer = wp_get_referer() ) {
116
-		if ( false !== strpos( $referer, 'edit-tags.php' ) )
117
-			$location = $referer;
118
-	}
112
+		$location = 'edit-tags.php?taxonomy=' . $taxonomy;
113
+		if ( 'post' != $post_type )
114
+			$location .= '&post_type=' . $post_type;
115
+		if ( $referer = wp_get_referer() ) {
116
+			if ( false !== strpos( $referer, 'edit-tags.php' ) )
117
+				$location = $referer;
118
+		}
119 119
 
120
-	$location = add_query_arg( 'message', 6, $location );
120
+		$location = add_query_arg( 'message', 6, $location );
121 121
 
122
-	break;
122
+		break;
123 123
 
124
-case 'edit':
125
-	$title = $tax->labels->edit_item;
124
+	case 'edit':
125
+		$title = $tax->labels->edit_item;
126 126
 
127
-	$tag_ID = (int) $_REQUEST['tag_ID'];
127
+		$tag_ID = (int) $_REQUEST['tag_ID'];
128 128
 
129
-	$tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' );
130
-	if ( ! $tag )
131
-		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
132
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
133
-	include( ABSPATH . 'wp-admin/edit-tag-form.php' );
134
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
129
+		$tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' );
130
+		if ( ! $tag )
131
+			wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
132
+		require_once( ABSPATH . 'wp-admin/admin-header.php' );
133
+		include( ABSPATH . 'wp-admin/edit-tag-form.php' );
134
+		include( ABSPATH . 'wp-admin/admin-footer.php' );
135 135
 
136
-	exit;
136
+		exit;
137 137
 
138
-case 'editedtag':
139
-	$tag_ID = (int) $_POST['tag_ID'];
140
-	check_admin_referer( 'update-tag_' . $tag_ID );
138
+	case 'editedtag':
139
+		$tag_ID = (int) $_POST['tag_ID'];
140
+		check_admin_referer( 'update-tag_' . $tag_ID );
141 141
 
142
-	if ( !current_user_can( $tax->cap->edit_terms ) )
143
-		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
142
+		if ( !current_user_can( $tax->cap->edit_terms ) )
143
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
144 144
 
145
-	$tag = get_term( $tag_ID, $taxonomy );
146
-	if ( ! $tag )
147
-		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
145
+		$tag = get_term( $tag_ID, $taxonomy );
146
+		if ( ! $tag )
147
+			wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
148 148
 
149
-	$ret = wp_update_term( $tag_ID, $taxonomy, $_POST );
149
+		$ret = wp_update_term( $tag_ID, $taxonomy, $_POST );
150 150
 
151
-	$location = 'edit-tags.php?taxonomy=' . $taxonomy;
152
-	if ( 'post' != $post_type )
153
-		$location .= '&post_type=' . $post_type;
151
+		$location = 'edit-tags.php?taxonomy=' . $taxonomy;
152
+		if ( 'post' != $post_type )
153
+			$location .= '&post_type=' . $post_type;
154 154
 
155
-	if ( $referer = wp_get_original_referer() ) {
156
-		if ( false !== strpos( $referer, 'edit-tags.php' ) )
157
-			$location = $referer;
158
-	}
155
+		if ( $referer = wp_get_original_referer() ) {
156
+			if ( false !== strpos( $referer, 'edit-tags.php' ) )
157
+				$location = $referer;
158
+		}
159 159
 
160
-	if ( $ret && !is_wp_error( $ret ) )
161
-		$location = add_query_arg( 'message', 3, $location );
162
-	else
163
-		$location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location );
164
-	break;
160
+		if ( $ret && !is_wp_error( $ret ) )
161
+			$location = add_query_arg( 'message', 3, $location );
162
+		else
163
+			$location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location );
164
+		break;
165 165
 }
166 166
 
167 167
 if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
Please login to merge, or discard this patch.
src/wp-admin/plugin-editor.php 1 patch
Switch Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -54,161 +54,161 @@  discard block
 block discarded – undo
54 54
 
55 55
 switch ( $action ) {
56 56
 
57
-case 'update':
57
+	case 'update':
58 58
 
59
-	check_admin_referer('edit-plugin_' . $file);
59
+		check_admin_referer('edit-plugin_' . $file);
60 60
 
61
-	$newcontent = wp_unslash( $_POST['newcontent'] );
62
-	if ( is_writeable($real_file) ) {
63
-		$f = fopen($real_file, 'w+');
64
-		fwrite($f, $newcontent);
65
-		fclose($f);
61
+		$newcontent = wp_unslash( $_POST['newcontent'] );
62
+		if ( is_writeable($real_file) ) {
63
+			$f = fopen($real_file, 'w+');
64
+			fwrite($f, $newcontent);
65
+			fclose($f);
66 66
 
67
-		$network_wide = is_plugin_active_for_network( $file );
67
+			$network_wide = is_plugin_active_for_network( $file );
68 68
 
69
-		// Deactivate so we can test it.
70
-		if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
71
-			if ( is_plugin_active($file) )
72
-				deactivate_plugins($file, true);
69
+			// Deactivate so we can test it.
70
+			if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
71
+				if ( is_plugin_active($file) )
72
+					deactivate_plugins($file, true);
73 73
 
74
-			if ( ! is_network_admin() )
75
-				update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) );
74
+				if ( ! is_network_admin() )
75
+					update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) );
76 76
 
77
-			wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
78
-			exit;
77
+				wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
78
+				exit;
79
+			}
80
+			wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
81
+		} else {
82
+			wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") );
79 83
 		}
80
-		wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
81
-	} else {
82
-		wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") );
83
-	}
84
-	exit;
84
+		exit;
85 85
 
86
-default:
86
+	default:
87 87
 
88
-	if ( isset($_GET['liveupdate']) ) {
89
-		check_admin_referer('edit-plugin-test_' . $file);
88
+		if ( isset($_GET['liveupdate']) ) {
89
+			check_admin_referer('edit-plugin-test_' . $file);
90 90
 
91
-		$error = validate_plugin($file);
92
-		if ( is_wp_error($error) )
93
-			wp_die( $error );
91
+			$error = validate_plugin($file);
92
+			if ( is_wp_error($error) )
93
+				wp_die( $error );
94 94
 
95
-		if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
96
-			activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
95
+			if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
96
+				activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
97 97
 
98
-		wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
99
-		exit;
100
-	}
98
+			wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
99
+			exit;
100
+		}
101 101
 
102
-	// List of allowable extensions
103
-	$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
102
+		// List of allowable extensions
103
+		$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
104 104
 
105
-	/**
105
+		/**
106 106
 	 * Filter file type extensions editable in the plugin editor.
107 107
 	 *
108 108
 	 * @since 2.8.0
109 109
 	 *
110 110
 	 * @param array $editable_extensions An array of editable plugin file extensions.
111 111
 	 */
112
-	$editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions );
112
+		$editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions );
113 113
 
114
-	if ( ! is_file($real_file) ) {
115
-		wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
116
-	} else {
117
-		// Get the extension of the file
118
-		if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
119
-			$ext = strtolower($matches[1]);
120
-			// If extension is not in the acceptable list, skip it
121
-			if ( !in_array( $ext, $editable_extensions) )
122
-				wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
114
+		if ( ! is_file($real_file) ) {
115
+			wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
116
+		} else {
117
+			// Get the extension of the file
118
+			if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
119
+				$ext = strtolower($matches[1]);
120
+				// If extension is not in the acceptable list, skip it
121
+				if ( !in_array( $ext, $editable_extensions) )
122
+					wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
123
+			}
123 124
 		}
124
-	}
125
-
126
-	get_current_screen()->add_help_tab( array(
127
-	'id'		=> 'overview',
128
-	'title'		=> __('Overview'),
129
-	'content'	=>
130
-		'<p>' . __('You can use the editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' .
131
-		'<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
132
-		'<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' .
133
-		'<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' .
134
-		'<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' .
135
-		( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
136
-	) );
137
-
138
-	get_current_screen()->set_help_sidebar(
139
-		'<p><strong>' . __('For more information:') . '</strong></p>' .
140
-		'<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' .
141
-		'<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' .
142
-		'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
143
-	);
144
-
145
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
146
-
147
-	update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
148
-
149
-	$content = file_get_contents( $real_file );
150
-
151
-	if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
152
-		$functions = wp_doc_link_parse( $content );
153
-
154
-		if ( !empty($functions) ) {
155
-			$docs_select = '<select name="docs-list" id="docs-list">';
156
-			$docs_select .= '<option value="">' . __( 'Function Name&hellip;' ) . '</option>';
157
-			foreach ( $functions as $function) {
158
-				$docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>';
125
+
126
+		get_current_screen()->add_help_tab( array(
127
+		'id'		=> 'overview',
128
+		'title'		=> __('Overview'),
129
+		'content'	=>
130
+			'<p>' . __('You can use the editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' .
131
+			'<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
132
+			'<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' .
133
+			'<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' .
134
+			'<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' .
135
+			( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
136
+		) );
137
+
138
+		get_current_screen()->set_help_sidebar(
139
+			'<p><strong>' . __('For more information:') . '</strong></p>' .
140
+			'<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' .
141
+			'<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' .
142
+			'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
143
+		);
144
+
145
+		require_once(ABSPATH . 'wp-admin/admin-header.php');
146
+
147
+		update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
148
+
149
+		$content = file_get_contents( $real_file );
150
+
151
+		if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
152
+			$functions = wp_doc_link_parse( $content );
153
+
154
+			if ( !empty($functions) ) {
155
+				$docs_select = '<select name="docs-list" id="docs-list">';
156
+				$docs_select .= '<option value="">' . __( 'Function Name&hellip;' ) . '</option>';
157
+				foreach ( $functions as $function) {
158
+					$docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>';
159
+				}
160
+				$docs_select .= '</select>';
159 161
 			}
160
-			$docs_select .= '</select>';
161 162
 		}
162
-	}
163 163
 
164
-	$content = esc_textarea( $content );
165
-	?>
166
-<?php if (isset($_GET['a'])) : ?>
167
- <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div>
168
-<?php elseif (isset($_GET['phperror'])) : ?>
169
- <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
164
+		$content = esc_textarea( $content );
165
+		?>
166
+	<?php if (isset($_GET['a'])) : ?>
167
+	 <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div>
168
+	<?php elseif (isset($_GET['phperror'])) : ?>
169
+	 <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
170 170
 	<?php
171
-		if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
172
-	<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo esc_attr($file); ?>&amp;_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe>
171
+			if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
172
+		<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo esc_attr($file); ?>&amp;_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe>
173 173
 	<?php } ?>
174
-</div>
175
-<?php endif; ?>
174
+	</div>
175
+	<?php endif; ?>
176 176
 <div class="wrap">
177 177
 <h1><?php echo esc_html( $title ); ?></h1>
178 178
 
179 179
 <div class="fileedit-sub">
180 180
 <div class="alignleft">
181 181
 <big><?php
182
-	if ( is_plugin_active($plugin) ) {
183
-		if ( is_writeable($real_file) )
184
-			echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
185
-		else
186
-			echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
187
-	} else {
188
-		if ( is_writeable($real_file) )
189
-			echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
190
-		else
191
-			echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
192
-	}
193
-	?></big>
182
+		if ( is_plugin_active($plugin) ) {
183
+			if ( is_writeable($real_file) )
184
+				echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
185
+			else
186
+				echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
187
+		} else {
188
+			if ( is_writeable($real_file) )
189
+				echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
190
+			else
191
+				echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
192
+		}
193
+		?></big>
194 194
 </div>
195 195
 <div class="alignright">
196 196
 	<form action="plugin-editor.php" method="post">
197 197
 		<strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
198 198
 		<select name="plugin" id="plugin">
199 199
 <?php
200
-	foreach ( $plugins as $plugin_key => $a_plugin ) {
201
-		$plugin_name = $a_plugin['Name'];
202
-		if ( $plugin_key == $plugin )
203
-			$selected = " selected='selected'";
204
-		else
205
-			$selected = '';
206
-		$plugin_name = esc_attr($plugin_name);
207
-		$plugin_key = esc_attr($plugin_key);
208
-		echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
209
-	}
210
-?>
211
-		</select>
200
+		foreach ( $plugins as $plugin_key => $a_plugin ) {
201
+			$plugin_name = $a_plugin['Name'];
202
+			if ( $plugin_key == $plugin )
203
+				$selected = " selected='selected'";
204
+			else
205
+				$selected = '';
206
+			$plugin_name = esc_attr($plugin_name);
207
+			$plugin_key = esc_attr($plugin_key);
208
+			echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
209
+		}
210
+	?>
211
+			</select>
212 212
 		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
213 213
 	</form>
214 214
 </div>
@@ -220,50 +220,50 @@  discard block
 block discarded – undo
220 220
 
221 221
 	<ul>
222 222
 <?php
223
-foreach ( $plugin_files as $plugin_file ) :
224
-	// Get the extension of the file
225
-	if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) {
226
-		$ext = strtolower($matches[1]);
227
-		// If extension is not in the acceptable list, skip it
228
-		if ( !in_array( $ext, $editable_extensions ) )
223
+	foreach ( $plugin_files as $plugin_file ) :
224
+		// Get the extension of the file
225
+		if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) {
226
+			$ext = strtolower($matches[1]);
227
+			// If extension is not in the acceptable list, skip it
228
+			if ( !in_array( $ext, $editable_extensions ) )
229
+				continue;
230
+		} else {
231
+			// No extension found
229 232
 			continue;
230
-	} else {
231
-		// No extension found
232
-		continue;
233
-	}
234
-?>
235
-		<li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
236
-<?php endforeach; ?>
233
+		}
234
+	?>
235
+			<li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
236
+	<?php endforeach; ?>
237 237
 	</ul>
238 238
 </div>
239 239
 <form name="template" id="template" action="plugin-editor.php" method="post">
240 240
 	<?php wp_nonce_field('edit-plugin_' . $file) ?>
241
-		<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
241
+			<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
242 242
 		<input type="hidden" name="action" value="update" />
243 243
 		<input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
244 244
 		<input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
245 245
 		<input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
246 246
 		</div>
247 247
 		<?php if ( !empty( $docs_select ) ) : ?>
248
-		<div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
248
+			<div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
249 249
 		<?php endif; ?>
250
-<?php if ( is_writeable($real_file) ) : ?>
251
-	<?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
252
-		<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
250
+	<?php if ( is_writeable($real_file) ) : ?>
251
+		<?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
252
+			<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
253 253
 	<?php } ?>
254
-	<p class="submit">
254
+		<p class="submit">
255 255
 	<?php
256
-		if ( isset($_GET['phperror']) ) {
257
-			echo "<input type='hidden' name='phperror' value='1' />";
258
-			submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false );
259
-		} else {
260
-			submit_button( __( 'Update File' ), 'primary', 'submit', false );
261
-		}
262
-	?>
263
-	</p>
264
-<?php else : ?>
265
-	<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
266
-<?php endif; ?>
256
+			if ( isset($_GET['phperror']) ) {
257
+				echo "<input type='hidden' name='phperror' value='1' />";
258
+				submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false );
259
+			} else {
260
+				submit_button( __( 'Update File' ), 'primary', 'submit', false );
261
+			}
262
+		?>
263
+		</p>
264
+	<?php else : ?>
265
+		<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
266
+	<?php endif; ?>
267 267
 </form>
268 268
 <br class="clear" />
269 269
 </div>
@@ -274,6 +274,6 @@  discard block
 block discarded – undo
274 274
 });
275 275
 </script>
276 276
 <?php
277
-	break;
277
+		break;
278 278
 }
279 279
 include(ABSPATH . "wp-admin/admin-footer.php");
Please login to merge, or discard this patch.
src/wp-admin/revision.php 1 patch
Switch Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
 $redirect = 'edit.php';
31 31
 
32 32
 switch ( $action ) {
33
-case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
-		break;
33
+	case 'restore' :
34
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
+			break;
36 36
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
-		break;
37
+		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
+			break;
39 39
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
41
-		break;
40
+		if ( ! $post = get_post( $revision->post_parent ) )
41
+			break;
42 42
 
43
-	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44
-	if ( ! wp_revisions_enabled( $post ) ) {
45
-		$redirect = 'edit.php?post_type=' . $post->post_type;
46
-		break;
47
-	}
43
+		// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44
+		if ( ! wp_revisions_enabled( $post ) ) {
45
+			$redirect = 'edit.php?post_type=' . $post->post_type;
46
+			break;
47
+		}
48 48
 
49
-	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
51
-		break;
49
+		// Don't allow revision restore when post is locked
50
+		if ( wp_check_post_lock( $post->ID ) )
51
+			break;
52 52
 
53
-	check_admin_referer( "restore-post_{$revision->ID}" );
53
+		check_admin_referer( "restore-post_{$revision->ID}" );
54 54
 
55
-	wp_restore_post_revision( $revision->ID );
56
-	$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
57
-	break;
58
-case 'view' :
59
-case 'edit' :
60
-default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
55
+		wp_restore_post_revision( $revision->ID );
56
+		$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
62 57
 		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
58
+	case 'view' :
59
+	case 'edit' :
60
+	default :
61
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
62
+			break;
63
+		if ( ! $post = get_post( $revision->post_parent ) )
64
+			break;
65
+
66
+		if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
67
+			break;
68
+
69
+		// Revisions disabled and we're not looking at an autosave
70
+		if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
+			$redirect = 'edit.php?post_type=' . $post->post_type;
72
+			break;
73
+		}
74
+
75
+		$post_edit_link = get_edit_post_link();
76
+		$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
+		$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
+		$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
79
+		$title          = __( 'Revisions' );
80
+
81
+		$redirect = false;
64 82
 		break;
65
-
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
67
-		break;
68
-
69
-	// Revisions disabled and we're not looking at an autosave
70
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
-		$redirect = 'edit.php?post_type=' . $post->post_type;
72
-		break;
73
-	}
74
-
75
-	$post_edit_link = get_edit_post_link();
76
-	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
-	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
-	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
79
-	$title          = __( 'Revisions' );
80
-
81
-	$redirect = false;
82
-	break;
83 83
 }
84 84
 
85 85
 // Empty post_type means either malformed object found, or no valid parent was found.
Please login to merge, or discard this patch.
src/wp-admin/setup-config.php 1 patch
Switch Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 switch($step) {
102
-	case -1:
103
-		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
104
-			setup_config_display_header( 'language-chooser' );
105
-			echo '<form id="setup" method="post" action="?step=0">';
106
-			wp_install_language_form( $languages );
107
-			echo '</form>';
108
-			break;
109
-		}
102
+		case -1:
103
+			if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
104
+				setup_config_display_header( 'language-chooser' );
105
+				echo '<form id="setup" method="post" action="?step=0">';
106
+				wp_install_language_form( $languages );
107
+				echo '</form>';
108
+				break;
109
+			}
110 110
 
111
-		// Deliberately fall through if we can't reach the translations API.
111
+			// Deliberately fall through if we can't reach the translations API.
112 112
 
113
-	case 0:
114
-		if ( ! empty( $language ) ) {
115
-			$loaded_language = wp_download_language_pack( $language );
116
-			if ( $loaded_language ) {
117
-				load_default_textdomain( $loaded_language );
118
-				$GLOBALS['wp_locale'] = new WP_Locale();
113
+		case 0:
114
+			if ( ! empty( $language ) ) {
115
+				$loaded_language = wp_download_language_pack( $language );
116
+				if ( $loaded_language ) {
117
+					load_default_textdomain( $loaded_language );
118
+					$GLOBALS['wp_locale'] = new WP_Locale();
119
+				}
119 120
 			}
120
-		}
121 121
 
122
-		setup_config_display_header();
123
-		$step_1 = 'setup-config.php?step=1';
124
-		if ( isset( $_REQUEST['noapi'] ) ) {
125
-			$step_1 .= '&amp;noapi';
126
-		}
127
-		if ( ! empty( $loaded_language ) ) {
128
-			$step_1 .= '&amp;language=' . $loaded_language;
129
-		}
130
-?>
122
+			setup_config_display_header();
123
+			$step_1 = 'setup-config.php?step=1';
124
+			if ( isset( $_REQUEST['noapi'] ) ) {
125
+				$step_1 .= '&amp;noapi';
126
+			}
127
+			if ( ! empty( $loaded_language ) ) {
128
+				$step_1 .= '&amp;language=' . $loaded_language;
129
+			}
130
+	?>
131 131
 
132 132
 <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
133 133
 <ol>
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
 </ol>
140 140
 <p>
141 141
 	<?php _e( 'We&#8217;re going to use this information to create a <code>wp-config.php</code> file.' ); ?>
142
-	<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
142
+		<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
143 143
 	<?php _e( "Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ); ?>
144 144
 </p>
145 145
 <p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
146 146
 
147 147
 <p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
148
-<?php
149
-	break;
148
+	<?php
149
+		break;
150 150
 
151
-	case 1:
152
-		load_default_textdomain( $language );
153
-		$GLOBALS['wp_locale'] = new WP_Locale();
151
+		case 1:
152
+			load_default_textdomain( $language );
153
+			$GLOBALS['wp_locale'] = new WP_Locale();
154 154
 
155
-		setup_config_display_header();
156
-	?>
155
+			setup_config_display_header();
156
+		?>
157 157
 <form method="post" action="setup-config.php?step=2">
158 158
 	<p><?php _e( "Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host." ); ?></p>
159 159
 	<table class="form-table">
@@ -184,100 +184,100 @@  discard block
 block discarded – undo
184 184
 		</tr>
185 185
 	</table>
186 186
 	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
187
-	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
187
+		<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
188 188
 	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
189 189
 </form>
190 190
 <?php
191
-	break;
191
+		break;
192 192
 
193
-	case 2:
194
-	load_default_textdomain( $language );
195
-	$GLOBALS['wp_locale'] = new WP_Locale();
193
+		case 2:
194
+		load_default_textdomain( $language );
195
+		$GLOBALS['wp_locale'] = new WP_Locale();
196 196
 
197
-	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
198
-	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
199
-	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
200
-	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
201
-	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
197
+		$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
198
+		$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
199
+		$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
200
+		$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
201
+		$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
202 202
 
203
-	$step_1 = 'setup-config.php?step=1';
204
-	$install = 'install.php';
205
-	if ( isset( $_REQUEST['noapi'] ) ) {
206
-		$step_1 .= '&amp;noapi';
207
-	}
203
+		$step_1 = 'setup-config.php?step=1';
204
+		$install = 'install.php';
205
+		if ( isset( $_REQUEST['noapi'] ) ) {
206
+			$step_1 .= '&amp;noapi';
207
+		}
208 208
 
209
-	if ( ! empty( $language ) ) {
210
-		$step_1 .= '&amp;language=' . $language;
211
-		$install .= '?language=' . $language;
212
-	} else {
213
-		$install .= '?language=en_US';
214
-	}
209
+		if ( ! empty( $language ) ) {
210
+			$step_1 .= '&amp;language=' . $language;
211
+			$install .= '?language=' . $language;
212
+		} else {
213
+			$install .= '?language=en_US';
214
+		}
215 215
 
216
-	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
216
+		$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
217 217
 
218
-	if ( empty( $prefix ) )
219
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
218
+		if ( empty( $prefix ) )
219
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
220 220
 
221
-	// Validate $prefix: it can only contain letters, numbers and underscores.
222
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
221
+		// Validate $prefix: it can only contain letters, numbers and underscores.
222
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
224 224
 
225
-	// Test the db connection.
226
-	/**#@+
225
+		// Test the db connection.
226
+		/**#@+
227 227
 	 * @ignore
228 228
 	 */
229
-	define('DB_NAME', $dbname);
230
-	define('DB_USER', $uname);
231
-	define('DB_PASSWORD', $pwd);
232
-	define('DB_HOST', $dbhost);
233
-	/**#@-*/
229
+		define('DB_NAME', $dbname);
230
+		define('DB_USER', $uname);
231
+		define('DB_PASSWORD', $pwd);
232
+		define('DB_HOST', $dbhost);
233
+		/**#@-*/
234 234
 
235
-	// Re-construct $wpdb with these new values.
236
-	unset( $wpdb );
237
-	require_wp_db();
235
+		// Re-construct $wpdb with these new values.
236
+		unset( $wpdb );
237
+		require_wp_db();
238 238
 
239
-	/*
239
+		/*
240 240
 	 * The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
241 241
 	 * fire this manually. We'll fail here if the values are no good.
242 242
 	 */
243
-	$wpdb->db_connect();
244
-
245
-	if ( ! empty( $wpdb->error ) )
246
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
243
+		$wpdb->db_connect();
247 244
 
248
-	// Fetch or generate keys and salts.
249
-	$no_api = isset( $_POST['noapi'] );
250
-	if ( ! $no_api ) {
251
-		$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
252
-	}
245
+		if ( ! empty( $wpdb->error ) )
246
+			wp_die( $wpdb->error->get_error_message() . $tryagain_link );
253 247
 
254
-	if ( $no_api || is_wp_error( $secret_keys ) ) {
255
-		$secret_keys = array();
256
-		for ( $i = 0; $i < 8; $i++ ) {
257
-			$secret_keys[] = wp_generate_password( 64, true, true );
248
+		// Fetch or generate keys and salts.
249
+		$no_api = isset( $_POST['noapi'] );
250
+		if ( ! $no_api ) {
251
+			$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
258 252
 		}
259
-	} else {
260
-		$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
261
-		foreach ( $secret_keys as $k => $v ) {
262
-			$secret_keys[$k] = substr( $v, 28, 64 );
263
-		}
264
-	}
265 253
 
266
-	$key = 0;
267
-	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
268
-	foreach ( $config_file as $line_num => $line ) {
269
-		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
270
-			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
271
-			continue;
254
+		if ( $no_api || is_wp_error( $secret_keys ) ) {
255
+			$secret_keys = array();
256
+			for ( $i = 0; $i < 8; $i++ ) {
257
+				$secret_keys[] = wp_generate_password( 64, true, true );
258
+			}
259
+		} else {
260
+			$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
261
+			foreach ( $secret_keys as $k => $v ) {
262
+				$secret_keys[$k] = substr( $v, 28, 64 );
263
+			}
272 264
 		}
273 265
 
274
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
275
-			continue;
266
+		$key = 0;
267
+		// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
268
+		foreach ( $config_file as $line_num => $line ) {
269
+			if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
270
+				$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
271
+				continue;
272
+			}
273
+
274
+			if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
275
+				continue;
276 276
 
277
-		$constant = $match[1];
278
-		$padding  = $match[2];
277
+			$constant = $match[1];
278
+			$padding  = $match[2];
279 279
 
280
-		switch ( $constant ) {
280
+			switch ( $constant ) {
281 281
 			case 'DB_NAME'     :
282 282
 			case 'DB_USER'     :
283 283
 			case 'DB_PASSWORD' :
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			case 'NONCE_SALT'       :
300 300
 				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
301 301
 				break;
302
-		}
302
+			}
303 303
 	}
304 304
 	unset( $line );
305 305
 
Please login to merge, or discard this patch.
src/wp-admin/theme-editor.php 1 patch
Switch Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -76,60 +76,60 @@  discard block
 block discarded – undo
76 76
 $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0;
77 77
 
78 78
 switch( $action ) {
79
-case 'update':
80
-	check_admin_referer( 'edit-theme_' . $file . $stylesheet );
81
-	$newcontent = wp_unslash( $_POST['newcontent'] );
82
-	$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
83
-	if ( is_writeable( $file ) ) {
84
-		// is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
85
-		$f = fopen( $file, 'w+' );
86
-		if ( $f !== false ) {
87
-			fwrite( $f, $newcontent );
88
-			fclose( $f );
89
-			$location .= '&updated=true';
90
-			$theme->cache_delete();
79
+	case 'update':
80
+		check_admin_referer( 'edit-theme_' . $file . $stylesheet );
81
+		$newcontent = wp_unslash( $_POST['newcontent'] );
82
+		$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
83
+		if ( is_writeable( $file ) ) {
84
+			// is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
85
+			$f = fopen( $file, 'w+' );
86
+			if ( $f !== false ) {
87
+				fwrite( $f, $newcontent );
88
+				fclose( $f );
89
+				$location .= '&updated=true';
90
+				$theme->cache_delete();
91
+			}
91 92
 		}
92
-	}
93
-	wp_redirect( $location );
94
-	exit;
93
+		wp_redirect( $location );
94
+		exit;
95 95
 
96
-default:
96
+	default:
97 97
 
98
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
98
+		require_once( ABSPATH . 'wp-admin/admin-header.php' );
99 99
 
100
-	update_recently_edited( $file );
100
+		update_recently_edited( $file );
101 101
 
102
-	if ( ! is_file( $file ) )
103
-		$error = true;
102
+		if ( ! is_file( $file ) )
103
+			$error = true;
104 104
 
105
-	$content = '';
106
-	if ( ! $error && filesize( $file ) > 0 ) {
107
-		$f = fopen($file, 'r');
108
-		$content = fread($f, filesize($file));
105
+		$content = '';
106
+		if ( ! $error && filesize( $file ) > 0 ) {
107
+			$f = fopen($file, 'r');
108
+			$content = fread($f, filesize($file));
109 109
 
110
-		if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
111
-			$functions = wp_doc_link_parse( $content );
110
+			if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
111
+				$functions = wp_doc_link_parse( $content );
112 112
 
113
-			$docs_select = '<select name="docs-list" id="docs-list">';
114
-			$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
115
-			foreach ( $functions as $function ) {
116
-				$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
113
+				$docs_select = '<select name="docs-list" id="docs-list">';
114
+				$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
115
+				foreach ( $functions as $function ) {
116
+					$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
117
+				}
118
+				$docs_select .= '</select>';
117 119
 			}
118
-			$docs_select .= '</select>';
119
-		}
120 120
 
121
-		$content = esc_textarea( $content );
122
-	}
121
+			$content = esc_textarea( $content );
122
+		}
123 123
 
124
-	if ( isset( $_GET['updated'] ) ) : ?>
125
- <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
126
-<?php endif;
124
+		if ( isset( $_GET['updated'] ) ) : ?>
125
+	 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
126
+	<?php endif;
127 127
 
128
-$description = get_file_description( $file );
129
-$file_show = array_search( $file, array_filter( $allowed_files ) );
130
-if ( $description != $file_show )
131
-	$description .= ' <span>(' . $file_show . ')</span>';
132
-?>
128
+	$description = get_file_description( $file );
129
+	$file_show = array_search( $file, array_filter( $allowed_files ) );
130
+	if ( $description != $file_show )
131
+		$description .= ' <span>(' . $file_show . ')</span>';
132
+	?>
133 133
 <div class="wrap">
134 134
 <h1><?php echo esc_html( $title ); ?></h1>
135 135
 
@@ -142,61 +142,61 @@  discard block
 block discarded – undo
142 142
 		<strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
143 143
 		<select name="theme" id="theme">
144 144
 <?php
145
-foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
146
-	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
147
-		continue;
145
+	foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
146
+		if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
147
+			continue;
148 148
 
149
-	$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
150
-	echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
149
+		$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
150
+		echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
151 151
 }
152
-?>
153
-		</select>
152
+	?>
153
+			</select>
154 154
 		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
155 155
 	</form>
156 156
 </div>
157 157
 <br class="clear" />
158 158
 </div>
159 159
 <?php
160
-if ( $theme->errors() )
161
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
162
-?>
163
-	<div id="templateside">
164
-<?php
165
-if ( $allowed_files ) :
166
-	if ( $has_templates || $theme->parent() ) :
167
-?>
168
-	<h3><?php _e('Templates'); ?></h3>
160
+	if ( $theme->errors() )
161
+		echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
162
+	?>
163
+		<div id="templateside">
164
+	<?php
165
+	if ( $allowed_files ) :
166
+		if ( $has_templates || $theme->parent() ) :
167
+	?>
168
+		<h3><?php _e('Templates'); ?></h3>
169 169
 	<?php if ( $theme->parent() ) : ?>
170
-	<p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), '<a href="' . self_admin_url('theme-editor.php?theme=' . urlencode( $theme->get_template() ) ) . '">' . $theme->parent()->display('Name') . '</a>' ); ?></p>
170
+		<p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), '<a href="' . self_admin_url('theme-editor.php?theme=' . urlencode( $theme->get_template() ) ) . '">' . $theme->parent()->display('Name') . '</a>' ); ?></p>
171 171
 	<?php endif; ?>
172
-	<ul>
173
-<?php
174
-	endif;
175
-
176
-	foreach ( $allowed_files as $filename => $absolute_filename ) :
177
-		if ( 'style.css' == $filename )
178
-			echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
179
-
180
-		$file_description = get_file_description( $absolute_filename );
181
-		if ( $file_description != basename( $filename ) )
182
-			$file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
183
-
184
-		if ( $absolute_filename == $file )
185
-			$file_description = '<span class="highlight">' . $file_description . '</span>';
186
-?>
187
-		<li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&amp;theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li>
188
-<?php
189
-	endforeach;
190
-?>
191
-</ul>
192
-<?php endif; ?>
193
-</div>
194
-<?php if ( $error ) :
195
-	echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
196
-else : ?>
197
-	<form name="template" id="template" action="theme-editor.php" method="post">
172
+		<ul>
173
+	<?php
174
+		endif;
175
+
176
+		foreach ( $allowed_files as $filename => $absolute_filename ) :
177
+			if ( 'style.css' == $filename )
178
+				echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
179
+
180
+			$file_description = get_file_description( $absolute_filename );
181
+			if ( $file_description != basename( $filename ) )
182
+				$file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
183
+
184
+			if ( $absolute_filename == $file )
185
+				$file_description = '<span class="highlight">' . $file_description . '</span>';
186
+	?>
187
+			<li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&amp;theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li>
188
+	<?php
189
+		endforeach;
190
+	?>
191
+	</ul>
192
+	<?php endif; ?>
193
+	</div>
194
+	<?php if ( $error ) :
195
+		echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
196
+	else : ?>
197
+		<form name="template" id="template" action="theme-editor.php" method="post">
198 198
 	<?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?>
199
-		<div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
199
+			<div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
200 200
 		<input type="hidden" name="action" value="update" />
201 201
 		<input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
202 202
 		<input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
@@ -206,26 +206,26 @@  discard block
 block discarded – undo
206 206
 		<div id="documentation" class="hide-if-no-js">
207 207
 		<label for="docs-list"><?php _e('Documentation:') ?></label>
208 208
 		<?php echo $docs_select; ?>
209
-		<input type="button" class="button" value=" <?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" />
209
+			<input type="button" class="button" value=" <?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" />
210 210
 		</div>
211 211
 	<?php endif; ?>
212 212
 
213 213
 		<div>
214 214
 		<?php if ( is_child_theme() && $theme->get_stylesheet() == get_template() ) : ?>
215
-			<p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
216
-			<?php _e( 'This is a file in your current parent theme.' ); ?></p>
215
+				<p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
216
+				<?php _e( 'This is a file in your current parent theme.' ); ?></p>
217 217
 		<?php endif; ?>
218
-<?php
219
-	if ( is_writeable( $file ) ) :
220
-		submit_button( __( 'Update File' ), 'primary', 'submit', true );
221
-	else : ?>
222
-<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
223
-<?php endif; ?>
218
+	<?php
219
+		if ( is_writeable( $file ) ) :
220
+			submit_button( __( 'Update File' ), 'primary', 'submit', true );
221
+		else : ?>
222
+	<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
223
+	<?php endif; ?>
224 224
 		</div>
225 225
 	</form>
226 226
 <?php
227
-endif; // $error
228
-?>
227
+	endif; // $error
228
+	?>
229 229
 <br class="clear" />
230 230
 </div>
231 231
 <script type="text/javascript">
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 });
236 236
 </script>
237 237
 <?php
238
-break;
238
+	break;
239 239
 }
240 240
 
241 241
 include(ABSPATH . 'wp-admin/admin-footer.php' );
Please login to merge, or discard this patch.