Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function options_validate( array $input ): array {
* @return bool
*/
private function sanitize_bool( $value ): bool {
return ( $value || ! empty( $value ) );
return (bool) $value;
}

/**
Expand Down
27 changes: 12 additions & 15 deletions admin/comment-parent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ public function comment_parent_box( $comment ) { // phpcs:ignore Generic.CodeAna
* @return void
*/
public function load_comment_parent_box() {
if ( \function_exists( 'add_meta_box' ) ) {
\add_meta_box(
'comment_parent',
\esc_html__( 'Comment Parent', 'yoast-comment-hacks' ),
[
$this,
'comment_parent_box',
],
'comment',
'normal'
);
}
\add_meta_box(
'comment_parent',
\esc_html__( 'Comment Parent', 'yoast-comment-hacks' ),
[
$this,
'comment_parent_box',
],
'comment',
'normal'
);
}

/**
Expand All @@ -70,11 +68,10 @@ public function update_comment_parent() {
return; // There might be another reason for a comment to be updated.
}

if ( \function_exists( 'wp_doing_ajax' ) && \wp_doing_ajax() ) {
if ( \wp_doing_ajax() ) {
\check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
}

if ( ! \function_exists( 'wp_doing_ajax' ) || ! \wp_doing_ajax() ) {
else {
\check_admin_referer( 'update-comment_' . $comment_id );
}

Expand Down
8 changes: 3 additions & 5 deletions inc/clean-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,12 @@ private function comment_notification_actions(): void {
* @return void
*/
private function comment_action_links( array $actions ): void {
$links = '';
$links = [];
foreach ( $actions as $action => $label ) {
$links .= $this->comment_action_link( $label, $action ) . ' | ';
$links[] = $this->comment_action_link( $label, $action );
}

$links = \rtrim( $links, '| ' );

$this->message .= $links;
$this->message .= \implode( ' | ', $links );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion inc/hacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function modify_comment_edit_link_block( $block_content, $block ) {
public function get_remove_comment_url_link( $comment_id ) {
$comment = \get_comment( $comment_id );

if ( isset( $comment ) && $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) {
if ( $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) {
return \sprintf(
'<a href="#" class="comment-remove-url" data-comment-id="%d" aria-label="%s">%s</a>',
\esc_attr( (string) $comment_id ),
Expand Down
11 changes: 3 additions & 8 deletions inc/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,13 @@ public function filter_notification_recipients( $recipients, $comment_id ): arra
public function filter_notification_headers( $message_headers, $comment_id ): string {
$comment = \get_comment( $comment_id );

if ( $comment->comment_author !== '' && $comment->comment_author_email !== '' ) {
$name = \esc_html( $comment->comment_author );
$message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n";

if ( $comment->comment_author_email === '' ) {
return $message_headers;
}

if ( $comment->comment_author_email !== '' ) {
$message_headers .= "\nReply-To: $comment->comment_author_email <$comment->comment_author_email>\n";
$name = ( $comment->comment_author !== '' ) ? \esc_html( $comment->comment_author ) : $comment->comment_author_email;

return $message_headers;
}
$message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n";

return $message_headers;
}
Expand Down
6 changes: 1 addition & 5 deletions inc/progress-planner/comment-policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ public function get_description() {
* @return bool
*/
public function should_add_task() {
if ( ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy'] ) {
return true;
}

return false;
return ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy'];
}

/**
Expand Down
6 changes: 1 addition & 5 deletions inc/progress-planner/comment-redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ public function get_description() {
* @return bool
*/
public function should_add_task() {
if ( ! $this->options['redirect_page'] ) {
return true;
}

return false;
return ! $this->options['redirect_page'];
}

/**
Expand Down
Loading