Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 1679-1686 (lines=8) @@
1676
	public function get_name() {
1677
		return __( 'Telegram', 'jetpack' );
1678
	}
1679
	public function process_request( $post, array $post_data ) {
1680
		// Record stats
1681
		parent::process_request( $post, $post_data );
1682
		$telegram_url = esc_url_raw( 'https://telegram.me/share/url?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&text=' . rawurlencode( $this->get_share_title( $post->ID ) ) );
1683
		wp_redirect( $telegram_url );
1684
		exit;
1685
	}
1686
1687
	public function get_display( $post ) {
1688
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1689
	}
@@ 863-872 (lines=10) @@
860
		}
861
	}
862
863
	public function process_request( $post, array $post_data ) {
864
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
865
866
		// Record stats
867
		parent::process_request( $post, $post_data );
868
869
		// Redirect to Reddit
870
		wp_redirect( $reddit_url );
871
		die();
872
	}
873
}
874
875
class Share_LinkedIn extends Sharing_Source {
@@ 1041-1050 (lines=10) @@
1038
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Facebook', 'share to', 'jetpack' ), __( 'Click to share on Facebook', 'jetpack' ), 'share=facebook', 'sharing-facebook-' . $post->ID );
1039
	}
1040
1041
	public function process_request( $post, array $post_data ) {
1042
		$fb_url = $this->http() . '://www.facebook.com/sharer.php?u=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&t=' . rawurlencode( $this->get_share_title( $post->ID ) );
1043
1044
		// Record stats
1045
		parent::process_request( $post, $post_data );
1046
1047
		// Redirect to Facebook
1048
		wp_redirect( $fb_url );
1049
		die();
1050
	}
1051
1052
	public function display_footer() {
1053
		$this->js_dialog( $this->shortname );
@@ 1435-1443 (lines=9) @@
1432
		}
1433
	}
1434
1435
	public function process_request( $post, array $post_data ) {
1436
		// Record stats
1437
		parent::process_request( $post, $post_data );
1438
1439
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1440
		$url = 'https://www.tumblr.com/share?v=3&u=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&t=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '&s=';
1441
		wp_redirect( $url );
1442
		die();
1443
	}
1444
1445
	public function display_footer() {
1446
		if ( $this->smart ) {
@@ 1624-1631 (lines=8) @@
1621
		return __( 'Pocket', 'jetpack' );
1622
	}
1623
1624
	public function process_request( $post, array $post_data ) {
1625
		// Record stats
1626
		parent::process_request( $post, $post_data );
1627
1628
		$pocket_url = esc_url_raw( 'https://getpocket.com/save/?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) ) );
1629
		wp_redirect( $pocket_url );
1630
		exit;
1631
	}
1632
1633
	public function get_display( $post ) {
1634
		if ( $this->smart ) {