Code Duplication    Length = 11-11 lines in 4 locations

includes/class-sensei-messages.php 4 locations

@@ 493-503 (lines=11) @@
490
	 * @param  string $content Original message content
491
	 * @return string          Empty string if user does not have access to this message
492
	 */
493
	public function message_content( $content ) {
494
		global $post;
495
496
		if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) {
497
			if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) {
498
				$content = __( 'Please log in to view your messages.', 'woothemes-sensei' );
499
			}
500
		}
501
502
		return $content;
503
	}
504
505
	/**
506
	 * Hide all replies
@@ 510-520 (lines=11) @@
507
	 * @param  array $comments Array of replies
508
	 * @return array           Empty array if user does not have access to this message
509
	 */
510
	public function message_replies( $comments ) {
511
		global $post;
512
513
		if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) {
514
			if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) {
515
				$comments = array();
516
			}
517
		}
518
519
		return $comments;
520
	}
521
522
	/**
523
	 * Set message reply count to 0
@@ 528-538 (lines=11) @@
525
	 * @param  integer $post_id ID of post
526
	 * @return integer          0 if user does not have access to this message
527
	 */
528
	public function message_reply_count( $count, $post_id ) {
529
		global $post;
530
531
		if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) {
532
			if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) {
533
				$count = 0;
534
			}
535
		}
536
537
		return $count;
538
	}
539
540
	/**
541
	 * Close replies for messages
@@ 546-556 (lines=11) @@
543
	 * @param  integer $post_id ID of post
544
	 * @return boolean          False if user does not have access to this message
545
	 */
546
	public function message_replies_open( $open, $post_id ) {
547
		global $post;
548
549
		if( is_single() && is_singular( $this->post_type ) && in_the_loop() ) {
550
			if( ! is_user_logged_in() || ! $this->view_message( $post->ID ) ) {
551
				$open = false;
552
			}
553
		}
554
555
		return $open;
556
	}
557
558
    /**
559
     * Print outthe message was sent by $sender_username on the