Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: pluggable.php
* list.
[1500] Fix | Delete
*
[1501] Fix | Delete
* If the host is not allowed, then the redirect defaults to wp-admin on the siteurl
[1502] Fix | Delete
* instead. This prevents malicious redirects which redirect to another host,
[1503] Fix | Delete
* but only used in a few places.
[1504] Fix | Delete
*
[1505] Fix | Delete
* Note: wp_safe_redirect() does not exit automatically, and should almost always be
[1506] Fix | Delete
* followed by a call to `exit;`:
[1507] Fix | Delete
*
[1508] Fix | Delete
* wp_safe_redirect( $url );
[1509] Fix | Delete
* exit;
[1510] Fix | Delete
*
[1511] Fix | Delete
* Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional
[1512] Fix | Delete
* in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters:
[1513] Fix | Delete
*
[1514] Fix | Delete
* if ( wp_safe_redirect( $url ) ) {
[1515] Fix | Delete
* exit;
[1516] Fix | Delete
* }
[1517] Fix | Delete
*
[1518] Fix | Delete
* @since 2.3.0
[1519] Fix | Delete
* @since 5.1.0 The return value from wp_redirect() is now passed on, and the `$x_redirect_by` parameter was added.
[1520] Fix | Delete
*
[1521] Fix | Delete
* @param string $location The path or URL to redirect to.
[1522] Fix | Delete
* @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
[1523] Fix | Delete
* @param string|false $x_redirect_by Optional. The application doing the redirect or false to omit. Default 'WordPress'.
[1524] Fix | Delete
* @return bool False if the redirect was canceled, true otherwise.
[1525] Fix | Delete
*/
[1526] Fix | Delete
function wp_safe_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) {
[1527] Fix | Delete
[1528] Fix | Delete
// Need to look at the URL the way it will end up in wp_redirect().
[1529] Fix | Delete
$location = wp_sanitize_redirect( $location );
[1530] Fix | Delete
[1531] Fix | Delete
/**
[1532] Fix | Delete
* Filters the redirect fallback URL for when the provided redirect is not safe (local).
[1533] Fix | Delete
*
[1534] Fix | Delete
* @since 4.3.0
[1535] Fix | Delete
*
[1536] Fix | Delete
* @param string $fallback_url The fallback URL to use by default.
[1537] Fix | Delete
* @param int $status The HTTP response status code to use.
[1538] Fix | Delete
*/
[1539] Fix | Delete
$fallback_url = apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status );
[1540] Fix | Delete
[1541] Fix | Delete
$location = wp_validate_redirect( $location, $fallback_url );
[1542] Fix | Delete
[1543] Fix | Delete
return wp_redirect( $location, $status, $x_redirect_by );
[1544] Fix | Delete
}
[1545] Fix | Delete
endif;
[1546] Fix | Delete
[1547] Fix | Delete
if ( ! function_exists( 'wp_validate_redirect' ) ) :
[1548] Fix | Delete
/**
[1549] Fix | Delete
* Validates a URL for use in a redirect.
[1550] Fix | Delete
*
[1551] Fix | Delete
* Checks whether the $location is using an allowed host, if it has an absolute
[1552] Fix | Delete
* path. A plugin can therefore set or remove allowed host(s) to or from the
[1553] Fix | Delete
* list.
[1554] Fix | Delete
*
[1555] Fix | Delete
* If the host is not allowed, then the redirect is to $fallback_url supplied.
[1556] Fix | Delete
*
[1557] Fix | Delete
* @since 2.8.1
[1558] Fix | Delete
*
[1559] Fix | Delete
* @param string $location The redirect to validate.
[1560] Fix | Delete
* @param string $fallback_url The value to return if $location is not allowed.
[1561] Fix | Delete
* @return string Redirect-sanitized URL.
[1562] Fix | Delete
*/
[1563] Fix | Delete
function wp_validate_redirect( $location, $fallback_url = '' ) {
[1564] Fix | Delete
$location = wp_sanitize_redirect( trim( $location, " \t\n\r\0\x08\x0B" ) );
[1565] Fix | Delete
// Browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'.
[1566] Fix | Delete
if ( str_starts_with( $location, '//' ) ) {
[1567] Fix | Delete
$location = 'http:' . $location;
[1568] Fix | Delete
}
[1569] Fix | Delete
[1570] Fix | Delete
/*
[1571] Fix | Delete
* In PHP 5 parse_url() may fail if the URL query part contains 'http://'.
[1572] Fix | Delete
* See https://bugs.php.net/bug.php?id=38143
[1573] Fix | Delete
*/
[1574] Fix | Delete
$cut = strpos( $location, '?' );
[1575] Fix | Delete
$test = $cut ? substr( $location, 0, $cut ) : $location;
[1576] Fix | Delete
[1577] Fix | Delete
$lp = parse_url( $test );
[1578] Fix | Delete
[1579] Fix | Delete
// Give up if malformed URL.
[1580] Fix | Delete
if ( false === $lp ) {
[1581] Fix | Delete
return $fallback_url;
[1582] Fix | Delete
}
[1583] Fix | Delete
[1584] Fix | Delete
// Allow only 'http' and 'https' schemes. No 'data:', etc.
[1585] Fix | Delete
if ( isset( $lp['scheme'] ) && ! ( 'http' === $lp['scheme'] || 'https' === $lp['scheme'] ) ) {
[1586] Fix | Delete
return $fallback_url;
[1587] Fix | Delete
}
[1588] Fix | Delete
[1589] Fix | Delete
if ( ! isset( $lp['host'] ) && ! empty( $lp['path'] ) && '/' !== $lp['path'][0] ) {
[1590] Fix | Delete
$path = '';
[1591] Fix | Delete
if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
[1592] Fix | Delete
$path = dirname( parse_url( 'http://placeholder' . $_SERVER['REQUEST_URI'], PHP_URL_PATH ) . '?' );
[1593] Fix | Delete
$path = wp_normalize_path( $path );
[1594] Fix | Delete
}
[1595] Fix | Delete
$location = '/' . ltrim( $path . '/', '/' ) . $location;
[1596] Fix | Delete
}
[1597] Fix | Delete
[1598] Fix | Delete
/*
[1599] Fix | Delete
* Reject if certain components are set but host is not.
[1600] Fix | Delete
* This catches URLs like https:host.com for which parse_url() does not set the host field.
[1601] Fix | Delete
*/
[1602] Fix | Delete
if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
[1603] Fix | Delete
return $fallback_url;
[1604] Fix | Delete
}
[1605] Fix | Delete
[1606] Fix | Delete
// Reject malformed components parse_url() can return on odd inputs.
[1607] Fix | Delete
foreach ( array( 'user', 'pass', 'host' ) as $component ) {
[1608] Fix | Delete
if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) {
[1609] Fix | Delete
return $fallback_url;
[1610] Fix | Delete
}
[1611] Fix | Delete
}
[1612] Fix | Delete
[1613] Fix | Delete
$wpp = parse_url( home_url() );
[1614] Fix | Delete
[1615] Fix | Delete
/**
[1616] Fix | Delete
* Filters the list of allowed hosts to redirect to.
[1617] Fix | Delete
*
[1618] Fix | Delete
* @since 2.3.0
[1619] Fix | Delete
*
[1620] Fix | Delete
* @param string[] $hosts An array of allowed host names.
[1621] Fix | Delete
* @param string $host The host name of the redirect destination; empty string if not set.
[1622] Fix | Delete
*/
[1623] Fix | Delete
$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' );
[1624] Fix | Delete
[1625] Fix | Delete
if ( isset( $lp['host'] ) && ( ! in_array( $lp['host'], $allowed_hosts, true ) && strtolower( $wpp['host'] ) !== $lp['host'] ) ) {
[1626] Fix | Delete
$location = $fallback_url;
[1627] Fix | Delete
}
[1628] Fix | Delete
[1629] Fix | Delete
return $location;
[1630] Fix | Delete
}
[1631] Fix | Delete
endif;
[1632] Fix | Delete
[1633] Fix | Delete
if ( ! function_exists( 'wp_notify_postauthor' ) ) :
[1634] Fix | Delete
/**
[1635] Fix | Delete
* Notifies an author (and/or others) of a comment/trackback/pingback on a post.
[1636] Fix | Delete
*
[1637] Fix | Delete
* @since 1.0.0
[1638] Fix | Delete
*
[1639] Fix | Delete
* @param int|WP_Comment $comment_id Comment ID or WP_Comment object.
[1640] Fix | Delete
* @param string $deprecated Not used.
[1641] Fix | Delete
* @return bool True on completion. False if no email addresses were specified.
[1642] Fix | Delete
*/
[1643] Fix | Delete
function wp_notify_postauthor( $comment_id, $deprecated = null ) {
[1644] Fix | Delete
if ( null !== $deprecated ) {
[1645] Fix | Delete
_deprecated_argument( __FUNCTION__, '3.8.0' );
[1646] Fix | Delete
}
[1647] Fix | Delete
[1648] Fix | Delete
$comment = get_comment( $comment_id );
[1649] Fix | Delete
if ( empty( $comment ) || empty( $comment->comment_post_ID ) ) {
[1650] Fix | Delete
return false;
[1651] Fix | Delete
}
[1652] Fix | Delete
[1653] Fix | Delete
$post = get_post( $comment->comment_post_ID );
[1654] Fix | Delete
$author = get_userdata( $post->post_author );
[1655] Fix | Delete
[1656] Fix | Delete
// Who to notify? By default, just the post author, but others can be added.
[1657] Fix | Delete
$emails = array();
[1658] Fix | Delete
if ( $author ) {
[1659] Fix | Delete
$emails[] = $author->user_email;
[1660] Fix | Delete
}
[1661] Fix | Delete
[1662] Fix | Delete
/**
[1663] Fix | Delete
* Filters the list of email addresses to receive a comment notification.
[1664] Fix | Delete
*
[1665] Fix | Delete
* By default, only post authors are notified of comments. This filter allows
[1666] Fix | Delete
* others to be added.
[1667] Fix | Delete
*
[1668] Fix | Delete
* @since 3.7.0
[1669] Fix | Delete
*
[1670] Fix | Delete
* @param string[] $emails An array of email addresses to receive a comment notification.
[1671] Fix | Delete
* @param string $comment_id The comment ID as a numeric string.
[1672] Fix | Delete
*/
[1673] Fix | Delete
$emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );
[1674] Fix | Delete
$emails = array_filter( $emails );
[1675] Fix | Delete
[1676] Fix | Delete
// If there are no addresses to send the comment to, bail.
[1677] Fix | Delete
if ( ! count( $emails ) ) {
[1678] Fix | Delete
return false;
[1679] Fix | Delete
}
[1680] Fix | Delete
[1681] Fix | Delete
// Facilitate unsetting below without knowing the keys.
[1682] Fix | Delete
$emails = array_flip( $emails );
[1683] Fix | Delete
[1684] Fix | Delete
/**
[1685] Fix | Delete
* Filters whether to notify comment authors of their comments on their own posts.
[1686] Fix | Delete
*
[1687] Fix | Delete
* By default, comment authors aren't notified of their comments on their own
[1688] Fix | Delete
* posts. This filter allows you to override that.
[1689] Fix | Delete
*
[1690] Fix | Delete
* @since 3.8.0
[1691] Fix | Delete
*
[1692] Fix | Delete
* @param bool $notify Whether to notify the post author of their own comment.
[1693] Fix | Delete
* Default false.
[1694] Fix | Delete
* @param string $comment_id The comment ID as a numeric string.
[1695] Fix | Delete
*/
[1696] Fix | Delete
$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
[1697] Fix | Delete
[1698] Fix | Delete
// The comment was left by the author.
[1699] Fix | Delete
if ( $author && ! $notify_author && (int) $comment->user_id === (int) $post->post_author ) {
[1700] Fix | Delete
unset( $emails[ $author->user_email ] );
[1701] Fix | Delete
}
[1702] Fix | Delete
[1703] Fix | Delete
// The author moderated a comment on their own post.
[1704] Fix | Delete
if ( $author && ! $notify_author && get_current_user_id() === (int) $post->post_author ) {
[1705] Fix | Delete
unset( $emails[ $author->user_email ] );
[1706] Fix | Delete
}
[1707] Fix | Delete
[1708] Fix | Delete
// The post author is no longer a member of the blog.
[1709] Fix | Delete
if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
[1710] Fix | Delete
unset( $emails[ $author->user_email ] );
[1711] Fix | Delete
}
[1712] Fix | Delete
[1713] Fix | Delete
// If there's no email to send the comment to, bail, otherwise flip array back around for use below.
[1714] Fix | Delete
if ( ! count( $emails ) ) {
[1715] Fix | Delete
return false;
[1716] Fix | Delete
} else {
[1717] Fix | Delete
$emails = array_flip( $emails );
[1718] Fix | Delete
}
[1719] Fix | Delete
[1720] Fix | Delete
$switched_locale = switch_to_locale( get_locale() );
[1721] Fix | Delete
[1722] Fix | Delete
$comment_author_domain = '';
[1723] Fix | Delete
if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) {
[1724] Fix | Delete
$comment_author_domain = gethostbyaddr( $comment->comment_author_IP );
[1725] Fix | Delete
}
[1726] Fix | Delete
[1727] Fix | Delete
/*
[1728] Fix | Delete
* The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
[1729] Fix | Delete
* We want to reverse this for the plain text arena of emails.
[1730] Fix | Delete
*/
[1731] Fix | Delete
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
[1732] Fix | Delete
$comment_content = wp_specialchars_decode( $comment->comment_content );
[1733] Fix | Delete
[1734] Fix | Delete
switch ( $comment->comment_type ) {
[1735] Fix | Delete
case 'trackback':
[1736] Fix | Delete
/* translators: %s: Post title. */
[1737] Fix | Delete
$notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
[1738] Fix | Delete
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
[1739] Fix | Delete
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1740] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1741] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1742] Fix | Delete
/* translators: %s: Comment text. */
[1743] Fix | Delete
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
[1744] Fix | Delete
$notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
[1745] Fix | Delete
/* translators: Trackback notification email subject. 1: Site title, 2: Post title. */
[1746] Fix | Delete
$subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title );
[1747] Fix | Delete
break;
[1748] Fix | Delete
[1749] Fix | Delete
case 'pingback':
[1750] Fix | Delete
/* translators: %s: Post title. */
[1751] Fix | Delete
$notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
[1752] Fix | Delete
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
[1753] Fix | Delete
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1754] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1755] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1756] Fix | Delete
/* translators: %s: Comment text. */
[1757] Fix | Delete
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
[1758] Fix | Delete
$notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
[1759] Fix | Delete
/* translators: Pingback notification email subject. 1: Site title, 2: Post title. */
[1760] Fix | Delete
$subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title );
[1761] Fix | Delete
break;
[1762] Fix | Delete
[1763] Fix | Delete
default: // Comments.
[1764] Fix | Delete
/* translators: %s: Post title. */
[1765] Fix | Delete
$notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
[1766] Fix | Delete
/* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */
[1767] Fix | Delete
$notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1768] Fix | Delete
/* translators: %s: Comment author email. */
[1769] Fix | Delete
$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
[1770] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1771] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1772] Fix | Delete
[1773] Fix | Delete
if ( $comment->comment_parent && user_can( $post->post_author, 'edit_comment', $comment->comment_parent ) ) {
[1774] Fix | Delete
/* translators: Comment moderation. %s: Parent comment edit URL. */
[1775] Fix | Delete
$notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n";
[1776] Fix | Delete
}
[1777] Fix | Delete
[1778] Fix | Delete
/* translators: %s: Comment text. */
[1779] Fix | Delete
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
[1780] Fix | Delete
$notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";
[1781] Fix | Delete
/* translators: Comment notification email subject. 1: Site title, 2: Post title. */
[1782] Fix | Delete
$subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title );
[1783] Fix | Delete
break;
[1784] Fix | Delete
}
[1785] Fix | Delete
[1786] Fix | Delete
$notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n";
[1787] Fix | Delete
/* translators: %s: Comment URL. */
[1788] Fix | Delete
$notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n";
[1789] Fix | Delete
[1790] Fix | Delete
if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
[1791] Fix | Delete
if ( EMPTY_TRASH_DAYS ) {
[1792] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1793] Fix | Delete
$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
[1794] Fix | Delete
} else {
[1795] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1796] Fix | Delete
$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
[1797] Fix | Delete
}
[1798] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1799] Fix | Delete
$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
[1800] Fix | Delete
}
[1801] Fix | Delete
[1802] Fix | Delete
$wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', wp_parse_url( network_home_url(), PHP_URL_HOST ) );
[1803] Fix | Delete
[1804] Fix | Delete
if ( '' === $comment->comment_author ) {
[1805] Fix | Delete
$from = "From: \"$blogname\" <$wp_email>";
[1806] Fix | Delete
if ( '' !== $comment->comment_author_email ) {
[1807] Fix | Delete
$reply_to = "Reply-To: $comment->comment_author_email";
[1808] Fix | Delete
}
[1809] Fix | Delete
} else {
[1810] Fix | Delete
$from = "From: \"$comment->comment_author\" <$wp_email>";
[1811] Fix | Delete
if ( '' !== $comment->comment_author_email ) {
[1812] Fix | Delete
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
[1813] Fix | Delete
}
[1814] Fix | Delete
}
[1815] Fix | Delete
[1816] Fix | Delete
$message_headers = "$from\n"
[1817] Fix | Delete
. 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
[1818] Fix | Delete
[1819] Fix | Delete
if ( isset( $reply_to ) ) {
[1820] Fix | Delete
$message_headers .= $reply_to . "\n";
[1821] Fix | Delete
}
[1822] Fix | Delete
[1823] Fix | Delete
/**
[1824] Fix | Delete
* Filters the comment notification email text.
[1825] Fix | Delete
*
[1826] Fix | Delete
* @since 1.5.2
[1827] Fix | Delete
*
[1828] Fix | Delete
* @param string $notify_message The comment notification email text.
[1829] Fix | Delete
* @param string $comment_id Comment ID as a numeric string.
[1830] Fix | Delete
*/
[1831] Fix | Delete
$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );
[1832] Fix | Delete
[1833] Fix | Delete
/**
[1834] Fix | Delete
* Filters the comment notification email subject.
[1835] Fix | Delete
*
[1836] Fix | Delete
* @since 1.5.2
[1837] Fix | Delete
*
[1838] Fix | Delete
* @param string $subject The comment notification email subject.
[1839] Fix | Delete
* @param string $comment_id Comment ID as a numeric string.
[1840] Fix | Delete
*/
[1841] Fix | Delete
$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );
[1842] Fix | Delete
[1843] Fix | Delete
/**
[1844] Fix | Delete
* Filters the comment notification email headers.
[1845] Fix | Delete
*
[1846] Fix | Delete
* @since 1.5.2
[1847] Fix | Delete
*
[1848] Fix | Delete
* @param string $message_headers Headers for the comment notification email.
[1849] Fix | Delete
* @param string $comment_id Comment ID as a numeric string.
[1850] Fix | Delete
*/
[1851] Fix | Delete
$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
[1852] Fix | Delete
[1853] Fix | Delete
foreach ( $emails as $email ) {
[1854] Fix | Delete
wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
[1855] Fix | Delete
}
[1856] Fix | Delete
[1857] Fix | Delete
if ( $switched_locale ) {
[1858] Fix | Delete
restore_previous_locale();
[1859] Fix | Delete
}
[1860] Fix | Delete
[1861] Fix | Delete
return true;
[1862] Fix | Delete
}
[1863] Fix | Delete
endif;
[1864] Fix | Delete
[1865] Fix | Delete
if ( ! function_exists( 'wp_notify_moderator' ) ) :
[1866] Fix | Delete
/**
[1867] Fix | Delete
* Notifies the moderator of the site about a new comment that is awaiting approval.
[1868] Fix | Delete
*
[1869] Fix | Delete
* @since 1.0.0
[1870] Fix | Delete
*
[1871] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1872] Fix | Delete
*
[1873] Fix | Delete
* Uses the {@see 'notify_moderator'} filter to determine whether the site moderator
[1874] Fix | Delete
* should be notified, overriding the site setting.
[1875] Fix | Delete
*
[1876] Fix | Delete
* @param int $comment_id Comment ID.
[1877] Fix | Delete
* @return true Always returns true.
[1878] Fix | Delete
*/
[1879] Fix | Delete
function wp_notify_moderator( $comment_id ) {
[1880] Fix | Delete
global $wpdb;
[1881] Fix | Delete
[1882] Fix | Delete
$maybe_notify = get_option( 'moderation_notify' );
[1883] Fix | Delete
[1884] Fix | Delete
/**
[1885] Fix | Delete
* Filters whether to send the site moderator email notifications, overriding the site setting.
[1886] Fix | Delete
*
[1887] Fix | Delete
* @since 4.4.0
[1888] Fix | Delete
*
[1889] Fix | Delete
* @param bool $maybe_notify Whether to notify blog moderator.
[1890] Fix | Delete
* @param int $comment_id The ID of the comment for the notification.
[1891] Fix | Delete
*/
[1892] Fix | Delete
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
[1893] Fix | Delete
[1894] Fix | Delete
if ( ! $maybe_notify ) {
[1895] Fix | Delete
return true;
[1896] Fix | Delete
}
[1897] Fix | Delete
[1898] Fix | Delete
$comment = get_comment( $comment_id );
[1899] Fix | Delete
$post = get_post( $comment->comment_post_ID );
[1900] Fix | Delete
$user = get_userdata( $post->post_author );
[1901] Fix | Delete
// Send to the administration and to the post author if the author can modify the comment.
[1902] Fix | Delete
$emails = array( get_option( 'admin_email' ) );
[1903] Fix | Delete
if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
[1904] Fix | Delete
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
[1905] Fix | Delete
$emails[] = $user->user_email;
[1906] Fix | Delete
}
[1907] Fix | Delete
}
[1908] Fix | Delete
[1909] Fix | Delete
$switched_locale = switch_to_locale( get_locale() );
[1910] Fix | Delete
[1911] Fix | Delete
$comment_author_domain = '';
[1912] Fix | Delete
if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) {
[1913] Fix | Delete
$comment_author_domain = gethostbyaddr( $comment->comment_author_IP );
[1914] Fix | Delete
}
[1915] Fix | Delete
[1916] Fix | Delete
$comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" );
[1917] Fix | Delete
[1918] Fix | Delete
/*
[1919] Fix | Delete
* The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
[1920] Fix | Delete
* We want to reverse this for the plain text arena of emails.
[1921] Fix | Delete
*/
[1922] Fix | Delete
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
[1923] Fix | Delete
$comment_content = wp_specialchars_decode( $comment->comment_content );
[1924] Fix | Delete
[1925] Fix | Delete
switch ( $comment->comment_type ) {
[1926] Fix | Delete
case 'trackback':
[1927] Fix | Delete
/* translators: %s: Post title. */
[1928] Fix | Delete
$notify_message = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
[1929] Fix | Delete
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
[1930] Fix | Delete
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
[1931] Fix | Delete
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1932] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1933] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1934] Fix | Delete
$notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n";
[1935] Fix | Delete
break;
[1936] Fix | Delete
[1937] Fix | Delete
case 'pingback':
[1938] Fix | Delete
/* translators: %s: Post title. */
[1939] Fix | Delete
$notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
[1940] Fix | Delete
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
[1941] Fix | Delete
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
[1942] Fix | Delete
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1943] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1944] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1945] Fix | Delete
$notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n";
[1946] Fix | Delete
break;
[1947] Fix | Delete
[1948] Fix | Delete
default: // Comments.
[1949] Fix | Delete
/* translators: %s: Post title. */
[1950] Fix | Delete
$notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
[1951] Fix | Delete
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
[1952] Fix | Delete
/* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */
[1953] Fix | Delete
$notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
[1954] Fix | Delete
/* translators: %s: Comment author email. */
[1955] Fix | Delete
$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
[1956] Fix | Delete
/* translators: %s: Trackback/pingback/comment author URL. */
[1957] Fix | Delete
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
[1958] Fix | Delete
[1959] Fix | Delete
if ( $comment->comment_parent ) {
[1960] Fix | Delete
/* translators: Comment moderation. %s: Parent comment edit URL. */
[1961] Fix | Delete
$notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n";
[1962] Fix | Delete
}
[1963] Fix | Delete
[1964] Fix | Delete
/* translators: %s: Comment text. */
[1965] Fix | Delete
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
[1966] Fix | Delete
break;
[1967] Fix | Delete
}
[1968] Fix | Delete
[1969] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1970] Fix | Delete
$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
[1971] Fix | Delete
[1972] Fix | Delete
if ( EMPTY_TRASH_DAYS ) {
[1973] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1974] Fix | Delete
$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
[1975] Fix | Delete
} else {
[1976] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1977] Fix | Delete
$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
[1978] Fix | Delete
}
[1979] Fix | Delete
[1980] Fix | Delete
/* translators: Comment moderation. %s: Comment action URL. */
[1981] Fix | Delete
$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
[1982] Fix | Delete
[1983] Fix | Delete
$notify_message .= sprintf(
[1984] Fix | Delete
/* translators: Comment moderation. %s: Number of comments awaiting approval. */
[1985] Fix | Delete
_n(
[1986] Fix | Delete
'Currently %s comment is waiting for approval. Please visit the moderation panel:',
[1987] Fix | Delete
'Currently %s comments are waiting for approval. Please visit the moderation panel:',
[1988] Fix | Delete
$comments_waiting
[1989] Fix | Delete
),
[1990] Fix | Delete
number_format_i18n( $comments_waiting )
[1991] Fix | Delete
) . "\r\n";
[1992] Fix | Delete
$notify_message .= admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ) . "\r\n";
[1993] Fix | Delete
[1994] Fix | Delete
/* translators: Comment moderation notification email subject. 1: Site title, 2: Post title. */
[1995] Fix | Delete
$subject = sprintf( __( '[%1$s] Please moderate: "%2$s"' ), $blogname, $post->post_title );
[1996] Fix | Delete
$message_headers = '';
[1997] Fix | Delete
[1998] Fix | Delete
/**
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function