Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 954-963 (lines=10) @@
951
		return $this->build_amp_markup( $attrs );
952
	}
953
954
	public function process_request( $post, array $post_data ) {
955
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
956
957
		// Record stats
958
		parent::process_request( $post, $post_data );
959
960
		// Redirect to Reddit
961
		wp_redirect( $reddit_url );
962
		die();
963
	}
964
}
965
966
class Share_LinkedIn extends Sharing_Source {
@@ 1172-1181 (lines=10) @@
1169
		return $this->build_amp_markup( $attrs );
1170
	}
1171
1172
	public function process_request( $post, array $post_data ) {
1173
		$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 ) );
1174
1175
		// Record stats
1176
		parent::process_request( $post, $post_data );
1177
1178
		// Redirect to Facebook
1179
		wp_redirect( $fb_url );
1180
		die();
1181
	}
1182
1183
	public function display_footer() {
1184
		$this->js_dialog( $this->shortname );
@@ 1583-1591 (lines=9) @@
1580
		}
1581
	}
1582
1583
	public function process_request( $post, array $post_data ) {
1584
		// Record stats
1585
		parent::process_request( $post, $post_data );
1586
1587
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1588
		$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=';
1589
		wp_redirect( $url );
1590
		die();
1591
	}
1592
1593
	public function display_footer() {
1594
		if ( $this->smart ) {
@@ 1803-1810 (lines=8) @@
1800
		return __( 'Pocket', 'jetpack' );
1801
	}
1802
1803
	public function process_request( $post, array $post_data ) {
1804
		// Record stats
1805
		parent::process_request( $post, $post_data );
1806
1807
		$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 ) ) );
1808
		wp_redirect( $pocket_url );
1809
		exit;
1810
	}
1811
1812
	public function get_display( $post ) {
1813
		if ( $this->smart ) {
@@ 1884-1891 (lines=8) @@
1881
	public function get_name() {
1882
		return __( 'Telegram', 'jetpack' );
1883
	}
1884
	public function process_request( $post, array $post_data ) {
1885
		// Record stats
1886
		parent::process_request( $post, $post_data );
1887
		$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 ) ) );
1888
		wp_redirect( $telegram_url );
1889
		exit;
1890
	}
1891
1892
	public function get_display( $post ) {
1893
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1894
	}