Code Duplication    Length = 53-55 lines in 2 locations

src/wp-includes/user.php 2 locations

@@ 1819-1873 (lines=55) @@
1816
			$switched_locale = switch_to_locale( get_user_locale( $user_id ) );
1817
		}
1818
1819
		if ( ! empty( $send_password_change_email ) ) {
1820
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1821
			$pass_change_text = __( 'Hi ###USERNAME###,
1822
1823
This notice confirms that your password was changed on ###SITENAME###.
1824
1825
If you did not change your password, please contact the Site Administrator at
1826
###ADMIN_EMAIL###
1827
1828
This email has been sent to ###EMAIL###
1829
1830
Regards,
1831
All at ###SITENAME###
1832
###SITEURL###' );
1833
1834
			$pass_change_email = array(
1835
				'to'      => $user['user_email'],
1836
				/* translators: User password change notification email subject. 1: Site name */
1837
				'subject' => __( '[%s] Notice of Password Change' ),
1838
				'message' => $pass_change_text,
1839
				'headers' => '',
1840
			);
1841
1842
			/**
1843
			 * Filters the contents of the email sent when the user's password is changed.
1844
			 *
1845
			 * @since 4.3.0
1846
			 *
1847
			 * @param array $pass_change_email {
1848
			 *            Used to build wp_mail().
1849
			 *            @type string $to      The intended recipients. Add emails in a comma separated string.
1850
			 *            @type string $subject The subject of the email.
1851
			 *            @type string $message The content of the email.
1852
			 *                The following strings have a special meaning and will get replaced dynamically:
1853
			 *                - ###USERNAME###    The current user's username.
1854
			 *                - ###ADMIN_EMAIL### The admin email in case this was unexpected.
1855
			 *                - ###EMAIL###       The old email.
1856
			 *                - ###SITENAME###    The name of the site.
1857
			 *                - ###SITEURL###     The URL to the site.
1858
			 *            @type string $headers Headers. Add headers in a newline (\r\n) separated string.
1859
			 *        }
1860
			 * @param array $user     The original user array.
1861
			 * @param array $userdata The updated user array.
1862
			 *
1863
			 */
1864
			$pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );
1865
1866
			$pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] );
1867
			$pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] );
1868
			$pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] );
1869
			$pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] );
1870
			$pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] );
1871
1872
			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
1873
		}
1874
1875
		if ( ! empty( $send_email_change_email ) ) {
1876
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
@@ 1875-1927 (lines=53) @@
1872
			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
1873
		}
1874
1875
		if ( ! empty( $send_email_change_email ) ) {
1876
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1877
			$email_change_text = __( 'Hi ###USERNAME###,
1878
1879
This notice confirms that your email was changed on ###SITENAME###.
1880
1881
If you did not change your email, please contact the Site Administrator at
1882
###ADMIN_EMAIL###
1883
1884
This email has been sent to ###EMAIL###
1885
1886
Regards,
1887
All at ###SITENAME###
1888
###SITEURL###' );
1889
1890
			$email_change_email = array(
1891
				'to'      => $user['user_email'],
1892
				/* translators: User email change notification email subject. 1: Site name */
1893
				'subject' => __( '[%s] Notice of Email Change' ),
1894
				'message' => $email_change_text,
1895
				'headers' => '',
1896
			);
1897
1898
			/**
1899
			 * Filters the contents of the email sent when the user's email is changed.
1900
			 *
1901
			 * @since 4.3.0
1902
			 *
1903
			 * @param array $email_change_email {
1904
			 *            Used to build wp_mail().
1905
			 *            @type string $to      The intended recipients.
1906
			 *            @type string $subject The subject of the email.
1907
			 *            @type string $message The content of the email.
1908
			 *                The following strings have a special meaning and will get replaced dynamically:
1909
			 *                - ###USERNAME###    The current user's username.
1910
			 *                - ###ADMIN_EMAIL### The admin email in case this was unexpected.
1911
			 *                - ###EMAIL###       The old email.
1912
			 *                - ###SITENAME###    The name of the site.
1913
			 *                - ###SITEURL###     The URL to the site.
1914
			 *            @type string $headers Headers.
1915
			 *        }
1916
			 * @param array $user The original user array.
1917
			 * @param array $userdata The updated user array.
1918
			 */
1919
			$email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );
1920
1921
			$email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] );
1922
			$email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] );
1923
			$email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] );
1924
			$email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] );
1925
			$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
1926
1927
			wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] );
1928
		}
1929
1930
		if ( $switched_locale ) {