Code Duplication    Length = 53-55 lines in 2 locations

wp-includes/user.php 2 locations

@@ 1788-1842 (lines=55) @@
1785
1786
		$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
1787
1788
		if ( ! empty( $send_password_change_email ) ) {
1789
1790
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1791
			$pass_change_text = __( 'Hi ###USERNAME###,
1792
1793
This notice confirms that your password was changed on ###SITENAME###.
1794
1795
If you did not change your password, please contact the Site Administrator at
1796
###ADMIN_EMAIL###
1797
1798
This email has been sent to ###EMAIL###
1799
1800
Regards,
1801
All at ###SITENAME###
1802
###SITEURL###' );
1803
1804
			$pass_change_email = array(
1805
				'to'      => $user['user_email'],
1806
				'subject' => __( '[%s] Notice of Password Change' ),
1807
				'message' => $pass_change_text,
1808
				'headers' => '',
1809
			);
1810
1811
			/**
1812
			 * Filters the contents of the email sent when the user's password is changed.
1813
			 *
1814
			 * @since 4.3.0
1815
			 *
1816
			 * @param array $pass_change_email {
1817
			 *            Used to build wp_mail().
1818
			 *            @type string $to      The intended recipients. Add emails in a comma separated string.
1819
			 *            @type string $subject The subject of the email.
1820
			 *            @type string $message The content of the email.
1821
			 *                The following strings have a special meaning and will get replaced dynamically:
1822
			 *                - ###USERNAME###    The current user's username.
1823
			 *                - ###ADMIN_EMAIL### The admin email in case this was unexpected.
1824
			 *                - ###EMAIL###       The old email.
1825
			 *                - ###SITENAME###    The name of the site.
1826
			 *                - ###SITEURL###     The URL to the site.
1827
			 *            @type string $headers Headers. Add headers in a newline (\r\n) separated string.
1828
			 *        }
1829
			 * @param array $user     The original user array.
1830
			 * @param array $userdata The updated user array.
1831
			 *
1832
			 */
1833
			$pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );
1834
1835
			$pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] );
1836
			$pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] );
1837
			$pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] );
1838
			$pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] );
1839
			$pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] );
1840
1841
			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
1842
		}
1843
1844
		if ( ! empty( $send_email_change_email ) ) {
1845
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
@@ 1844-1896 (lines=53) @@
1841
			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
1842
		}
1843
1844
		if ( ! empty( $send_email_change_email ) ) {
1845
			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1846
			$email_change_text = __( 'Hi ###USERNAME###,
1847
1848
This notice confirms that your email was changed on ###SITENAME###.
1849
1850
If you did not change your email, please contact the Site Administrator at
1851
###ADMIN_EMAIL###
1852
1853
This email has been sent to ###EMAIL###
1854
1855
Regards,
1856
All at ###SITENAME###
1857
###SITEURL###' );
1858
1859
			$email_change_email = array(
1860
				'to'      => $user['user_email'],
1861
				'subject' => __( '[%s] Notice of Email Change' ),
1862
				'message' => $email_change_text,
1863
				'headers' => '',
1864
			);
1865
1866
			/**
1867
			 * Filters the contents of the email sent when the user's email is changed.
1868
			 *
1869
			 * @since 4.3.0
1870
			 *
1871
			 * @param array $email_change_email {
1872
			 *            Used to build wp_mail().
1873
			 *            @type string $to      The intended recipients.
1874
			 *            @type string $subject The subject of the email.
1875
			 *            @type string $message The content of the email.
1876
			 *                The following strings have a special meaning and will get replaced dynamically:
1877
			 *                - ###USERNAME###    The current user's username.
1878
			 *                - ###ADMIN_EMAIL### The admin email in case this was unexpected.
1879
			 *                - ###EMAIL###       The old email.
1880
			 *                - ###SITENAME###    The name of the site.
1881
			 *                - ###SITEURL###     The URL to the site.
1882
			 *            @type string $headers Headers.
1883
			 *        }
1884
			 * @param array $user The original user array.
1885
			 * @param array $userdata The updated user array.
1886
			 */
1887
			$email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );
1888
1889
			$email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] );
1890
			$email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] );
1891
			$email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] );
1892
			$email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] );
1893
			$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
1894
1895
			wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] );
1896
		}
1897
	}
1898
1899
	// Update the cookies if the password changed.