wp/wp-includes/widgets/class-wp-widget-recent-comments.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/widgets/class-wp-widget-recent-comments.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/widgets/class-wp-widget-recent-comments.php	Mon Oct 14 18:28:13 2019 +0200
@@ -23,8 +23,8 @@
 	 */
 	public function __construct() {
 		$widget_ops = array(
-			'classname' => 'widget_recent_comments',
-			'description' => __( 'Your site’s most recent comments.' ),
+			'classname'                   => 'widget_recent_comments',
+			'description'                 => __( 'Your site’s most recent comments.' ),
 			'customize_selective_refresh' => true,
 		);
 		parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops );
@@ -35,7 +35,7 @@
 		}
 	}
 
- 	/**
+	/**
 	 * Outputs the default styles for the Recent Comments widget.
 	 *
 	 * @since 2.8.0
@@ -50,8 +50,9 @@
 		 * @param string $id_base The widget ID.
 		 */
 		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
-			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
+			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
 			return;
+		}
 		?>
 		<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
 		<?php
@@ -67,8 +68,9 @@
 	 * @param array $instance Settings for the current Recent Comments widget instance.
 	 */
 	public function widget( $args, $instance ) {
-		if ( ! isset( $args['widget_id'] ) )
+		if ( ! isset( $args['widget_id'] ) ) {
 			$args['widget_id'] = $this->id;
+		}
 
 		$output = '';
 
@@ -78,8 +80,9 @@
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
 
 		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
-		if ( ! $number )
+		if ( ! $number ) {
 			$number = 5;
+		}
 
 		/**
 		 * Filters the arguments for the Recent Comments widget.
@@ -92,11 +95,17 @@
 		 * @param array $comment_args An array of arguments used to retrieve the recent comments.
 		 * @param array $instance     Array of settings for the current widget.
 		 */
-		$comments = get_comments( apply_filters( 'widget_comments_args', array(
-			'number'      => $number,
-			'status'      => 'approve',
-			'post_status' => 'publish'
-		), $instance ) );
+		$comments = get_comments(
+			apply_filters(
+				'widget_comments_args',
+				array(
+					'number'      => $number,
+					'status'      => 'approve',
+					'post_status' => 'publish',
+				),
+				$instance
+			)
+		);
 
 		$output .= $args['before_widget'];
 		if ( $title ) {
@@ -112,7 +121,8 @@
 			foreach ( (array) $comments as $comment ) {
 				$output .= '<li class="recentcomments">';
 				/* translators: comments widget: 1: comment author, 2: post link */
-				$output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
+				$output .= sprintf(
+					_x( '%1$s on %2$s', 'widgets' ),
 					'<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>',
 					'<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
 				);
@@ -136,8 +146,8 @@
 	 * @return array Updated settings to save.
 	 */
 	public function update( $new_instance, $old_instance ) {
-		$instance = $old_instance;
-		$instance['title'] = sanitize_text_field( $new_instance['title'] );
+		$instance           = $old_instance;
+		$instance['title']  = sanitize_text_field( $new_instance['title'] );
 		$instance['number'] = absint( $new_instance['number'] );
 		return $instance;
 	}
@@ -150,7 +160,7 @@
 	 * @param array $instance Current settings.
 	 */
 	public function form( $instance ) {
-		$title = isset( $instance['title'] ) ? $instance['title'] : '';
+		$title  = isset( $instance['title'] ) ? $instance['title'] : '';
 		$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
 		?>
 		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>