Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 938-947 (lines=10) @@
935
		return $this->build_amp_markup( $attrs );
936
	}
937
938
	public function process_request( $post, array $post_data ) {
939
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
940
941
		// Record stats
942
		parent::process_request( $post, $post_data );
943
944
		// Redirect to Reddit
945
		wp_redirect( $reddit_url );
946
		die();
947
	}
948
}
949
950
class Share_LinkedIn extends Sharing_Source {
@@ 1130-1139 (lines=10) @@
1127
		return $this->build_amp_markup( $attrs );
1128
	}
1129
1130
	public function process_request( $post, array $post_data ) {
1131
		$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 ) );
1132
1133
		// Record stats
1134
		parent::process_request( $post, $post_data );
1135
1136
		// Redirect to Facebook
1137
		wp_redirect( $fb_url );
1138
		die();
1139
	}
1140
1141
	public function display_footer() {
1142
		$this->js_dialog( $this->shortname );
@@ 1541-1549 (lines=9) @@
1538
		}
1539
	}
1540
1541
	public function process_request( $post, array $post_data ) {
1542
		// Record stats
1543
		parent::process_request( $post, $post_data );
1544
1545
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1546
		$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=';
1547
		wp_redirect( $url );
1548
		die();
1549
	}
1550
1551
	public function display_footer() {
1552
		if ( $this->smart ) {
@@ 1730-1737 (lines=8) @@
1727
		return __( 'Pocket', 'jetpack' );
1728
	}
1729
1730
	public function process_request( $post, array $post_data ) {
1731
		// Record stats
1732
		parent::process_request( $post, $post_data );
1733
1734
		$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 ) ) );
1735
		wp_redirect( $pocket_url );
1736
		exit;
1737
	}
1738
1739
	public function get_display( $post ) {
1740
		if ( $this->smart ) {
@@ 1798-1805 (lines=8) @@
1795
	public function get_name() {
1796
		return __( 'Telegram', 'jetpack' );
1797
	}
1798
	public function process_request( $post, array $post_data ) {
1799
		// Record stats
1800
		parent::process_request( $post, $post_data );
1801
		$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 ) ) );
1802
		wp_redirect( $telegram_url );
1803
		exit;
1804
	}
1805
1806
	public function get_display( $post ) {
1807
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1808
	}