Coding Standards: Rename `$comment_ID` variable to `$comment_id` in various files.
This resolves 80+ WPCS warnings in core: {{{ Variable "$comment_ID" is not in valid snake_case format }}} While matching the database field of the same name, the `$comment_ID` variable did not follow the WordPress coding standards, and is now renamed to address that. This affects: * Function parameters in: * `get_comment_author()` * `comment_author()` * `get_comment_author_email()` * `comment_author_email()` * `get_comment_author_link()` * `comment_author_link()` * `get_comment_author_IP()` * `comment_author_IP()` * `get_comment_author_rl()` * `comment_author_url()` * `get_comment_date()` * `comment_date()` * `get_comment_excerpt()` * `comment_excerpt()` * `get_comment_text()` * `comment_text()` * `get_comment_time()` * `comment_time()` * `get_comment_type()` * `get_page_of_comment()` * `wp_new_comment_notify_moderator()` * `wp_new_comment_notify_postauthor()` * `get_commentdata()` * Internal variables in: * `get_comment_ID()` * `wp_new_comment()` * `wp_xmlrpc_server::wp_deleteComment()` * `wp_xmlrpc_server::wp_editComment()` * `wp_xmlrpc_server::wp_newComment()` * `wp_xmlrpc_server::pingback_ping()` * Hook parameters in: * `get_comment_author` * `comment_author` * `get_comment_author_email` * `author_email` * `get_comment_author_link` * `get_comment_author_IP` * `get_comment_author_url` * `comment_url` * `get_comment_excerpt` * `comment_excerpt` * `get_comment_ID` * `get_comment_type` * `get_page_of_comment` * `comment_{$new_status}_{$comment->comment_type}` * `comment_post` * `notify_moderator` * `notify_post_author` * `commentrss2_item` * `xmlrpc_call_success_wp_deleteComment` * `xmlrpc_call_success_wp_editComment` * `xmlrpc_call_success_wp_newComment` * `pingback_post` Note: The name change only affects variable names and DocBlocks. The change does not affect: * `comment_ID` as the `$orderby` value in `WP_Comment_Query::__construct()` * `comment_ID` as the `$orderby` value in `WP_Comment::get_children()` * `comment_ID` as part of `$commentarr` parameter in `wp_update_comment()` The associated array keys still match the database field. Follow-up to [53723]. Props krunal265, costdev, SergeyBiryukov. Fixes #57671. See #56791. Built from https://develop.svn.wordpress.org/trunk@55308 git-svn-id: http://core.svn.wordpress.org/trunk@54841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
10a1594b64
commit
bd92d87b74
|
@ -3720,25 +3720,25 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$username = $args[1];
|
$username = $args[1];
|
||||||
$password = $args[2];
|
$password = $args[2];
|
||||||
$comment_ID = (int) $args[3];
|
$comment_id = (int) $args[3];
|
||||||
|
|
||||||
$user = $this->login( $username, $password );
|
$user = $this->login( $username, $password );
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! get_comment( $comment_ID ) ) {
|
if ( ! get_comment( $comment_id ) ) {
|
||||||
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
|
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
|
||||||
return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) );
|
return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||||
do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this );
|
do_action( 'xmlrpc_call', 'wp.deleteComment', $args, $this );
|
||||||
|
|
||||||
$status = wp_delete_comment( $comment_ID );
|
$status = wp_delete_comment( $comment_id );
|
||||||
|
|
||||||
if ( $status ) {
|
if ( $status ) {
|
||||||
/**
|
/**
|
||||||
|
@ -3746,10 +3746,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @param int $comment_ID ID of the deleted comment.
|
* @param int $comment_id ID of the deleted comment.
|
||||||
* @param array $args An array of arguments to delete the comment.
|
* @param array $args An array of arguments to delete the comment.
|
||||||
*/
|
*/
|
||||||
do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
|
@ -3787,7 +3787,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$username = $args[1];
|
$username = $args[1];
|
||||||
$password = $args[2];
|
$password = $args[2];
|
||||||
$comment_ID = (int) $args[3];
|
$comment_id = (int) $args[3];
|
||||||
$content_struct = $args[4];
|
$content_struct = $args[4];
|
||||||
|
|
||||||
$user = $this->login( $username, $password );
|
$user = $this->login( $username, $password );
|
||||||
|
@ -3795,18 +3795,18 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! get_comment( $comment_ID ) ) {
|
if ( ! get_comment( $comment_id ) ) {
|
||||||
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
|
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
|
||||||
return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
|
return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||||
do_action( 'xmlrpc_call', 'wp.editComment', $args, $this );
|
do_action( 'xmlrpc_call', 'wp.editComment', $args, $this );
|
||||||
$comment = array(
|
$comment = array(
|
||||||
'comment_ID' => $comment_ID,
|
'comment_ID' => $comment_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( isset( $content_struct['status'] ) ) {
|
if ( isset( $content_struct['status'] ) ) {
|
||||||
|
@ -3858,10 +3858,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @param int $comment_ID ID of the updated comment.
|
* @param int $comment_id ID of the updated comment.
|
||||||
* @param array $args An array of arguments to update the comment.
|
* @param array $args An array of arguments to update the comment.
|
||||||
*/
|
*/
|
||||||
do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
do_action( 'xmlrpc_call_success_wp_editComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3999,12 +3999,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
|
||||||
do_action( 'xmlrpc_call', 'wp.newComment', $args, $this );
|
do_action( 'xmlrpc_call', 'wp.newComment', $args, $this );
|
||||||
|
|
||||||
$comment_ID = wp_new_comment( $comment, true );
|
$comment_id = wp_new_comment( $comment, true );
|
||||||
if ( is_wp_error( $comment_ID ) ) {
|
if ( is_wp_error( $comment_id ) ) {
|
||||||
return new IXR_Error( 403, $comment_ID->get_error_message() );
|
return new IXR_Error( 403, $comment_id->get_error_message() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $comment_ID ) {
|
if ( ! $comment_id ) {
|
||||||
return new IXR_Error( 403, __( 'Something went wrong.' ) );
|
return new IXR_Error( 403, __( 'Something went wrong.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4013,12 +4013,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
*
|
*
|
||||||
* @param int $comment_ID ID of the new comment.
|
* @param int $comment_id ID of the new comment.
|
||||||
* @param array $args An array of new comment arguments.
|
* @param array $args An array of new comment arguments.
|
||||||
*/
|
*/
|
||||||
do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
do_action( 'xmlrpc_call_success_wp_newComment', $comment_id, $args ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||||
|
|
||||||
return $comment_ID;
|
return $comment_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7040,10 +7040,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
'remote_source_original'
|
'remote_source_original'
|
||||||
);
|
);
|
||||||
|
|
||||||
$comment_ID = wp_new_comment( $commentdata );
|
$comment_id = wp_new_comment( $commentdata );
|
||||||
|
|
||||||
if ( is_wp_error( $comment_ID ) ) {
|
if ( is_wp_error( $comment_id ) ) {
|
||||||
return $this->pingback_error( 0, $comment_ID->get_error_message() );
|
return $this->pingback_error( 0, $comment_id->get_error_message() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7051,9 +7051,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
*
|
*
|
||||||
* @param int $comment_ID Comment ID.
|
* @param int $comment_id Comment ID.
|
||||||
*/
|
*/
|
||||||
do_action( 'pingback_post', $comment_ID );
|
do_action( 'pingback_post', $comment_id );
|
||||||
|
|
||||||
/* translators: 1: URL of the page linked from, 2: URL of the page linked to. */
|
/* translators: 1: URL of the page linked from, 2: URL of the page linked to. */
|
||||||
return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto );
|
return sprintf( __( 'Pingback from %1$s to %2$s registered. Keep the web talking! :-)' ), $pagelinkedfrom, $pagelinkedto );
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
* assumed.
|
* assumed.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to retrieve the author.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The comment author
|
* @return string The comment author
|
||||||
*/
|
*/
|
||||||
function get_comment_author( $comment_ID = 0 ) {
|
function get_comment_author( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID;
|
$comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id;
|
||||||
|
|
||||||
if ( empty( $comment->comment_author ) ) {
|
if ( empty( $comment->comment_author ) ) {
|
||||||
$user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false;
|
$user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false;
|
||||||
|
@ -40,36 +40,36 @@ function get_comment_author( $comment_ID = 0 ) {
|
||||||
* Filters the returned comment author name.
|
* Filters the returned comment author name.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $author The comment author's username.
|
* @param string $author The comment author's username.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
|
return apply_filters( 'get_comment_author', $author, $comment_id, $comment );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the author of the current comment.
|
* Displays the author of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_author( $comment_ID = 0 ) {
|
function comment_author( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$author = get_comment_author( $comment );
|
$author = get_comment_author( $comment );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment author's name for display.
|
* Filters the comment author's name for display.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.1.0 The `$comment_ID` parameter was added.
|
* @since 4.1.0 The `$comment_id` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $author The comment author's username.
|
* @param string $author The comment author's username.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
echo apply_filters( 'comment_author', $author, $comment->comment_ID );
|
echo apply_filters( 'comment_author', $author, $comment->comment_ID );
|
||||||
}
|
}
|
||||||
|
@ -78,23 +78,23 @@ function comment_author( $comment_ID = 0 ) {
|
||||||
* Retrieves the email of the author of the current comment.
|
* Retrieves the email of the author of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's email.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The current comment author's email
|
* @return string The current comment author's email
|
||||||
*/
|
*/
|
||||||
function get_comment_author_email( $comment_ID = 0 ) {
|
function get_comment_author_email( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment author's returned email address.
|
* Filters the comment author's returned email address.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $comment_author_email The comment author's email address.
|
* @param string $comment_author_email The comment author's email address.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
|
return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
|
||||||
|
@ -110,23 +110,23 @@ function get_comment_author_email( $comment_ID = 0 ) {
|
||||||
* address and use it for their own means good and bad.
|
* address and use it for their own means good and bad.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's email.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_author_email( $comment_ID = 0 ) {
|
function comment_author_email( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$author_email = get_comment_author_email( $comment );
|
$author_email = get_comment_author_email( $comment );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment author's email for display.
|
* Filters the comment author's email for display.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.1.0 The `$comment_ID` parameter was added.
|
* @since 4.1.0 The `$comment_id` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $author_email The comment author's email address.
|
* @param string $author_email The comment author's email address.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
echo apply_filters( 'author_email', $author_email, $comment->comment_ID );
|
echo apply_filters( 'author_email', $author_email, $comment->comment_ID );
|
||||||
}
|
}
|
||||||
|
@ -208,18 +208,18 @@ function get_comment_author_email_link( $linktext = '', $before = '', $after = '
|
||||||
* Retrieves the HTML link to the URL of the author of the current comment.
|
* Retrieves the HTML link to the URL of the author of the current comment.
|
||||||
*
|
*
|
||||||
* Both get_comment_author_url() and get_comment_author() rely on get_comment(),
|
* Both get_comment_author_url() and get_comment_author() rely on get_comment(),
|
||||||
* which falls back to the global comment variable if the $comment_ID argument is empty.
|
* which falls back to the global comment variable if the $comment_id argument is empty.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's link.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The comment author name or HTML link for author's URL.
|
* @return string The comment author name or HTML link for author's URL.
|
||||||
*/
|
*/
|
||||||
function get_comment_author_link( $comment_ID = 0 ) {
|
function get_comment_author_link( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_ID;
|
$comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id;
|
||||||
$url = get_comment_author_url( $comment );
|
$url = get_comment_author_url( $comment );
|
||||||
$author = get_comment_author( $comment );
|
$author = get_comment_author( $comment );
|
||||||
|
|
||||||
|
@ -263,50 +263,50 @@ function get_comment_author_link( $comment_ID = 0 ) {
|
||||||
* Filters the comment author's link for display.
|
* Filters the comment author's link for display.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
|
* @since 4.1.0 The `$author` and `$comment_id` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $return The HTML-formatted comment author link.
|
* @param string $return The HTML-formatted comment author link.
|
||||||
* Empty for an invalid URL.
|
* Empty for an invalid URL.
|
||||||
* @param string $author The comment author's username.
|
* @param string $author The comment author's username.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_author_link', $return, $author, $comment_ID );
|
return apply_filters( 'get_comment_author_link', $return, $author, $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the HTML link to the URL of the author of the current comment.
|
* Displays the HTML link to the URL of the author of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's link.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_author_link( $comment_ID = 0 ) {
|
function comment_author_link( $comment_id = 0 ) {
|
||||||
echo get_comment_author_link( $comment_ID );
|
echo get_comment_author_link( $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the IP address of the author of the current comment.
|
* Retrieves the IP address of the author of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string Comment author's IP address, or an empty string if it's not available.
|
* @return string Comment author's IP address, or an empty string if it's not available.
|
||||||
*/
|
*/
|
||||||
function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
function get_comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment author's returned IP address.
|
* Filters the comment author's returned IP address.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.
|
* @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||||
|
@ -316,27 +316,27 @@ function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.Na
|
||||||
* Displays the IP address of the author of the current comment.
|
* Displays the IP address of the author of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
function comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
||||||
echo esc_html( get_comment_author_IP( $comment_ID ) );
|
echo esc_html( get_comment_author_IP( $comment_id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the URL of the author of the current comment, not linked.
|
* Retrieves the URL of the author of the current comment, not linked.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's URL.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string Comment author URL, if provided, an empty string otherwise.
|
* @return string Comment author URL, if provided, an empty string otherwise.
|
||||||
*/
|
*/
|
||||||
function get_comment_author_url( $comment_ID = 0 ) {
|
function get_comment_author_url( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$url = '';
|
$url = '';
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
|
||||||
|
@ -350,10 +350,10 @@ function get_comment_author_url( $comment_ID = 0 ) {
|
||||||
* Filters the comment author's URL.
|
* Filters the comment author's URL.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $url The comment author's URL, or an empty string.
|
* @param string $url The comment author's URL, or an empty string.
|
||||||
* @param string|int $comment_ID The comment ID as a numeric string, or 0 if not found.
|
* @param string|int $comment_id The comment ID as a numeric string, or 0 if not found.
|
||||||
* @param WP_Comment|null $comment The comment object, or null if not found.
|
* @param WP_Comment|null $comment The comment object, or null if not found.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_author_url', $url, $id, $comment );
|
return apply_filters( 'get_comment_author_url', $url, $id, $comment );
|
||||||
|
@ -363,23 +363,23 @@ function get_comment_author_url( $comment_ID = 0 ) {
|
||||||
* Displays the URL of the author of the current comment, not linked.
|
* Displays the URL of the author of the current comment, not linked.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's URL.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_author_url( $comment_ID = 0 ) {
|
function comment_author_url( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$author_url = get_comment_author_url( $comment );
|
$author_url = get_comment_author_url( $comment );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment author's URL for display.
|
* Filters the comment author's URL for display.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.1.0 The `$comment_ID` parameter was added.
|
* @since 4.1.0 The `$comment_id` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $author_url The comment author's URL.
|
* @param string $author_url The comment author's URL.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
echo apply_filters( 'comment_url', $author_url, $comment->comment_ID );
|
echo apply_filters( 'comment_url', $author_url, $comment->comment_ID );
|
||||||
}
|
}
|
||||||
|
@ -575,15 +575,15 @@ function get_comment_class( $css_class = '', $comment_id = null, $post = null )
|
||||||
* Retrieves the comment date of the current comment.
|
* Retrieves the comment date of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
|
* @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the date.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the date.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The comment's date.
|
* @return string The comment's date.
|
||||||
*/
|
*/
|
||||||
function get_comment_date( $format = '', $comment_ID = 0 ) {
|
function get_comment_date( $format = '', $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
|
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
|
||||||
|
|
||||||
|
@ -605,14 +605,14 @@ function get_comment_date( $format = '', $comment_ID = 0 ) {
|
||||||
* Displays the comment date of the current comment.
|
* Displays the comment date of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
|
* @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
|
||||||
* @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.
|
* @param int|WP_Comment $comment_id WP_Comment or ID of the comment for which to print the date.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_date( $format = '', $comment_ID = 0 ) {
|
function comment_date( $format = '', $comment_id = 0 ) {
|
||||||
echo get_comment_date( $format, $comment_ID );
|
echo get_comment_date( $format, $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -621,14 +621,14 @@ function comment_date( $format = '', $comment_ID = 0 ) {
|
||||||
* Returns a maximum of 20 words with an ellipsis appended if necessary.
|
* Returns a maximum of 20 words with an ellipsis appended if necessary.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the excerpt.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the excerpt.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The possibly truncated comment excerpt.
|
* @return string The possibly truncated comment excerpt.
|
||||||
*/
|
*/
|
||||||
function get_comment_excerpt( $comment_ID = 0 ) {
|
function get_comment_excerpt( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
if ( ! post_password_required( $comment->comment_post_ID ) ) {
|
if ( ! post_password_required( $comment->comment_post_ID ) ) {
|
||||||
$comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
|
$comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
|
||||||
|
@ -654,10 +654,10 @@ function get_comment_excerpt( $comment_ID = 0 ) {
|
||||||
* Filters the retrieved comment excerpt.
|
* Filters the retrieved comment excerpt.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $excerpt The comment excerpt text.
|
* @param string $excerpt The comment excerpt text.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment );
|
return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment );
|
||||||
|
@ -667,23 +667,23 @@ function get_comment_excerpt( $comment_ID = 0 ) {
|
||||||
* Displays the excerpt of the current comment.
|
* Displays the excerpt of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to print the excerpt.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the excerpt.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_excerpt( $comment_ID = 0 ) {
|
function comment_excerpt( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$comment_excerpt = get_comment_excerpt( $comment );
|
$comment_excerpt = get_comment_excerpt( $comment );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment excerpt for display.
|
* Filters the comment excerpt for display.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.1.0 The `$comment_ID` parameter was added.
|
* @since 4.1.0 The `$comment_id` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $comment_excerpt The comment excerpt text.
|
* @param string $comment_excerpt The comment excerpt text.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
|
echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ function comment_excerpt( $comment_ID = 0 ) {
|
||||||
*/
|
*/
|
||||||
function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
||||||
$comment = get_comment();
|
$comment = get_comment();
|
||||||
$comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
|
$comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the returned comment ID.
|
* Filters the returned comment ID.
|
||||||
|
@ -705,10 +705,10 @@ function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFun
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment` parameter was added.
|
* @since 4.1.0 The `$comment` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $comment_ID The current comment ID as a numeric string.
|
* @param string $comment_id The current comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_ID', $comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
return apply_filters( 'get_comment_ID', $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -985,18 +985,18 @@ function get_comments_number_text( $zero = false, $one = false, $more = false, $
|
||||||
* Retrieves the text of the current comment.
|
* Retrieves the text of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
* @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
|
* @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
|
||||||
*
|
*
|
||||||
* @see Walker_Comment::comment()
|
* @see Walker_Comment::comment()
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the text.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the text.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @param array $args Optional. An array of arguments. Default empty array.
|
* @param array $args Optional. An array of arguments. Default empty array.
|
||||||
* @return string The comment content.
|
* @return string The comment content.
|
||||||
*/
|
*/
|
||||||
function get_comment_text( $comment_ID = 0, $args = array() ) {
|
function get_comment_text( $comment_id = 0, $args = array() ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
$comment_content = $comment->comment_content;
|
$comment_content = $comment->comment_content;
|
||||||
|
|
||||||
|
@ -1032,16 +1032,16 @@ function get_comment_text( $comment_ID = 0, $args = array() ) {
|
||||||
* Displays the text of the current comment.
|
* Displays the text of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @see Walker_Comment::comment()
|
* @see Walker_Comment::comment()
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to print the text.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the text.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @param array $args Optional. An array of arguments. Default empty array.
|
* @param array $args Optional. An array of arguments. Default empty array.
|
||||||
*/
|
*/
|
||||||
function comment_text( $comment_ID = 0, $args = array() ) {
|
function comment_text( $comment_id = 0, $args = array() ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
$comment_text = get_comment_text( $comment, $args );
|
$comment_text = get_comment_text( $comment, $args );
|
||||||
/**
|
/**
|
||||||
|
@ -1062,18 +1062,18 @@ function comment_text( $comment_ID = 0, $args = array() ) {
|
||||||
* Retrieves the comment time of the current comment.
|
* Retrieves the comment time of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 6.2.0 Added the `$comment_ID` parameter.
|
* @since 6.2.0 Added the `$comment_id` parameter.
|
||||||
*
|
*
|
||||||
* @param string $format Optional. PHP date format. Defaults to the 'time_format' option.
|
* @param string $format Optional. PHP date format. Defaults to the 'time_format' option.
|
||||||
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
|
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
|
||||||
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
|
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
|
||||||
* Default true.
|
* Default true.
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the time.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The formatted time.
|
* @return string The formatted time.
|
||||||
*/
|
*/
|
||||||
function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ID = 0 ) {
|
function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
if ( null === $comment ) {
|
if ( null === $comment ) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -1103,28 +1103,28 @@ function get_comment_time( $format = '', $gmt = false, $translate = true, $comme
|
||||||
* Displays the comment time of the current comment.
|
* Displays the comment time of the current comment.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @since 6.2.0 Added the `$comment_ID` parameter.
|
* @since 6.2.0 Added the `$comment_id` parameter.
|
||||||
*
|
*
|
||||||
* @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
|
* @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the time.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
*/
|
*/
|
||||||
function comment_time( $format = '', $comment_ID = 0 ) {
|
function comment_time( $format = '', $comment_id = 0 ) {
|
||||||
echo get_comment_time( $format, $comment_ID );
|
echo get_comment_time( $format, $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the comment type of the current comment.
|
* Retrieves the comment type of the current comment.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
|
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
|
||||||
*
|
*
|
||||||
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the type.
|
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the type.
|
||||||
* Default current comment.
|
* Default current comment.
|
||||||
* @return string The comment type.
|
* @return string The comment type.
|
||||||
*/
|
*/
|
||||||
function get_comment_type( $comment_ID = 0 ) {
|
function get_comment_type( $comment_id = 0 ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
if ( '' === $comment->comment_type ) {
|
if ( '' === $comment->comment_type ) {
|
||||||
$comment->comment_type = 'comment';
|
$comment->comment_type = 'comment';
|
||||||
|
@ -1134,10 +1134,10 @@ function get_comment_type( $comment_ID = 0 ) {
|
||||||
* Filters the returned comment type.
|
* Filters the returned comment type.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
|
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
|
||||||
*
|
*
|
||||||
* @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
|
* @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment The comment object.
|
* @param WP_Comment $comment The comment object.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
|
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
|
||||||
*
|
*
|
||||||
* @global wpdb $wpdb WordPress database abstraction object.
|
* @global wpdb $wpdb WordPress database abstraction object.
|
||||||
*
|
*
|
||||||
* @param int $comment_ID Comment ID.
|
* @param int $comment_id Comment ID.
|
||||||
* @param array $args {
|
* @param array $args {
|
||||||
* Array of optional arguments.
|
* Array of optional arguments.
|
||||||
*
|
*
|
||||||
|
@ -1049,17 +1049,17 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
|
||||||
* @type int $per_page Per-page count to use when calculating pagination.
|
* @type int $per_page Per-page count to use when calculating pagination.
|
||||||
* Defaults to the value of the 'comments_per_page' option.
|
* Defaults to the value of the 'comments_per_page' option.
|
||||||
* @type int|string $max_depth If greater than 1, comment page will be determined
|
* @type int|string $max_depth If greater than 1, comment page will be determined
|
||||||
* for the top-level parent `$comment_ID`.
|
* for the top-level parent `$comment_id`.
|
||||||
* Defaults to the value of the 'thread_comments_depth' option.
|
* Defaults to the value of the 'thread_comments_depth' option.
|
||||||
* } *
|
* } *
|
||||||
* @return int|null Comment page number or null on error.
|
* @return int|null Comment page number or null on error.
|
||||||
*/
|
*/
|
||||||
function get_page_of_comment( $comment_ID, $args = array() ) {
|
function get_page_of_comment( $comment_id, $args = array() ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$page = null;
|
$page = null;
|
||||||
|
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
if ( ! $comment ) {
|
if ( ! $comment ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1175,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||||
* Filters the calculated page on which a comment appears.
|
* Filters the calculated page on which a comment appears.
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
* @since 4.7.0 Introduced the `$comment_ID` parameter.
|
* @since 4.7.0 Introduced the `$comment_id` parameter.
|
||||||
*
|
*
|
||||||
* @param int $page Comment page.
|
* @param int $page Comment page.
|
||||||
* @param array $args {
|
* @param array $args {
|
||||||
|
@ -1196,9 +1196,9 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||||
* @type int $per_page Number of comments per page.
|
* @type int $per_page Number of comments per page.
|
||||||
* @type int $max_depth Maximum comment threading depth allowed.
|
* @type int $max_depth Maximum comment threading depth allowed.
|
||||||
* }
|
* }
|
||||||
* @param int $comment_ID ID of the comment.
|
* @param int $comment_id ID of the comment.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID );
|
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1837,7 +1837,7 @@ function wp_transition_comment_status( $new_status, $old_status, $comment ) {
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*
|
*
|
||||||
* @param string $comment_ID The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
* @param WP_Comment $comment Comment object.
|
* @param WP_Comment $comment Comment object.
|
||||||
*/
|
*/
|
||||||
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
|
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
|
||||||
|
@ -2281,9 +2281,9 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||||
return $commentdata['comment_approved'];
|
return $commentdata['comment_approved'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_ID = wp_insert_comment( $commentdata );
|
$comment_id = wp_insert_comment( $commentdata );
|
||||||
|
|
||||||
if ( ! $comment_ID ) {
|
if ( ! $comment_id ) {
|
||||||
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
|
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
|
||||||
|
|
||||||
foreach ( $fields as $field ) {
|
foreach ( $fields as $field ) {
|
||||||
|
@ -2299,8 +2299,8 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||||
return $commentdata['comment_approved'];
|
return $commentdata['comment_approved'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_ID = wp_insert_comment( $commentdata );
|
$comment_id = wp_insert_comment( $commentdata );
|
||||||
if ( ! $comment_ID ) {
|
if ( ! $comment_id ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2311,13 +2311,13 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @since 4.5.0 The `$commentdata` parameter was added.
|
* @since 4.5.0 The `$commentdata` parameter was added.
|
||||||
*
|
*
|
||||||
* @param int $comment_ID The comment ID.
|
* @param int $comment_id The comment ID.
|
||||||
* @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
|
* @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
|
||||||
* @param array $commentdata Comment data.
|
* @param array $commentdata Comment data.
|
||||||
*/
|
*/
|
||||||
do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
|
do_action( 'comment_post', $comment_id, $commentdata['comment_approved'], $commentdata );
|
||||||
|
|
||||||
return $comment_ID;
|
return $comment_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2325,23 +2325,23 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*
|
*
|
||||||
* @param int $comment_ID ID of the comment.
|
* @param int $comment_id ID of the comment.
|
||||||
* @return bool True on success, false on failure.
|
* @return bool True on success, false on failure.
|
||||||
*/
|
*/
|
||||||
function wp_new_comment_notify_moderator( $comment_ID ) {
|
function wp_new_comment_notify_moderator( $comment_id ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
// Only send notifications for pending comments.
|
// Only send notifications for pending comments.
|
||||||
$maybe_notify = ( '0' == $comment->comment_approved );
|
$maybe_notify = ( '0' == $comment->comment_approved );
|
||||||
|
|
||||||
/** This filter is documented in wp-includes/comment.php */
|
/** This filter is documented in wp-includes/comment.php */
|
||||||
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
|
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
|
||||||
|
|
||||||
if ( ! $maybe_notify ) {
|
if ( ! $maybe_notify ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wp_notify_moderator( $comment_ID );
|
return wp_notify_moderator( $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2352,11 +2352,11 @@ function wp_new_comment_notify_moderator( $comment_ID ) {
|
||||||
* Uses the {@see 'notify_post_author'} filter to determine whether the post author
|
* Uses the {@see 'notify_post_author'} filter to determine whether the post author
|
||||||
* should be notified when a new comment is added, overriding site setting.
|
* should be notified when a new comment is added, overriding site setting.
|
||||||
*
|
*
|
||||||
* @param int $comment_ID Comment ID.
|
* @param int $comment_id Comment ID.
|
||||||
* @return bool True on success, false on failure.
|
* @return bool True on success, false on failure.
|
||||||
*/
|
*/
|
||||||
function wp_new_comment_notify_postauthor( $comment_ID ) {
|
function wp_new_comment_notify_postauthor( $comment_id ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
$maybe_notify = get_option( 'comments_notify' );
|
$maybe_notify = get_option( 'comments_notify' );
|
||||||
|
|
||||||
|
@ -2367,9 +2367,9 @@ function wp_new_comment_notify_postauthor( $comment_ID ) {
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*
|
*
|
||||||
* @param bool $maybe_notify Whether to notify the post author about the new comment.
|
* @param bool $maybe_notify Whether to notify the post author about the new comment.
|
||||||
* @param int $comment_ID The ID of the comment for the notification.
|
* @param int $comment_id The ID of the comment for the notification.
|
||||||
*/
|
*/
|
||||||
$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );
|
$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_id );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wp_notify_postauthor() checks if notifying the author of their own comment.
|
* wp_notify_postauthor() checks if notifying the author of their own comment.
|
||||||
|
@ -2384,7 +2384,7 @@ function wp_new_comment_notify_postauthor( $comment_ID ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wp_notify_postauthor( $comment_ID );
|
return wp_notify_postauthor( $comment_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1225,20 +1225,20 @@ function gzip_compression() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an array of comment data about comment $comment_ID.
|
* Retrieve an array of comment data about comment $comment_id.
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @deprecated 2.7.0 Use get_comment()
|
* @deprecated 2.7.0 Use get_comment()
|
||||||
* @see get_comment()
|
* @see get_comment()
|
||||||
*
|
*
|
||||||
* @param int $comment_ID The ID of the comment
|
* @param int $comment_id The ID of the comment
|
||||||
* @param int $no_cache Whether to use the cache (cast to bool)
|
* @param int $no_cache Whether to use the cache (cast to bool)
|
||||||
* @param bool $include_unapproved Whether to include unapproved comments
|
* @param bool $include_unapproved Whether to include unapproved comments
|
||||||
* @return array The comment data
|
* @return array The comment data
|
||||||
*/
|
*/
|
||||||
function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
|
function get_commentdata( $comment_id, $no_cache = 0, $include_unapproved = false ) {
|
||||||
_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
|
_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
|
||||||
return get_comment($comment_ID, ARRAY_A);
|
return get_comment($comment_id, ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,8 +110,8 @@ do_action( 'rss_tag_pre', 'rss2-comments' );
|
||||||
*
|
*
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*
|
*
|
||||||
* @param int $comment_ID The ID of the comment being displayed.
|
* @param int $comment_id The ID of the comment being displayed.
|
||||||
* @param int $ID The ID of the post the comment is connected to.
|
* @param int $comment_post_id The ID of the post the comment is connected to.
|
||||||
*/
|
*/
|
||||||
do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
|
do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) :
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*
|
*
|
||||||
* @param bool $maybe_notify Whether to notify blog moderator.
|
* @param bool $maybe_notify Whether to notify blog moderator.
|
||||||
* @param int $comment_ID The id of the comment for the notification.
|
* @param int $comment_id The ID of the comment for the notification.
|
||||||
*/
|
*/
|
||||||
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
|
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-beta1-55307';
|
$wp_version = '6.2-beta1-55308';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue