Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 949-958 (lines=10) @@
946
		return $this->build_amp_markup( $attrs );
947
	}
948
949
	public function process_request( $post, array $post_data ) {
950
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
951
952
		// Record stats
953
		parent::process_request( $post, $post_data );
954
955
		// Redirect to Reddit
956
		wp_redirect( $reddit_url );
957
		die();
958
	}
959
}
960
961
class Share_LinkedIn extends Sharing_Source {
@@ 1141-1150 (lines=10) @@
1138
		return $this->build_amp_markup( $attrs );
1139
	}
1140
1141
	public function process_request( $post, array $post_data ) {
1142
		$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 ) );
1143
1144
		// Record stats
1145
		parent::process_request( $post, $post_data );
1146
1147
		// Redirect to Facebook
1148
		wp_redirect( $fb_url );
1149
		die();
1150
	}
1151
1152
	public function display_footer() {
1153
		$this->js_dialog( $this->shortname );
@@ 1552-1560 (lines=9) @@
1549
		}
1550
	}
1551
1552
	public function process_request( $post, array $post_data ) {
1553
		// Record stats
1554
		parent::process_request( $post, $post_data );
1555
1556
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1557
		$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=';
1558
		wp_redirect( $url );
1559
		die();
1560
	}
1561
1562
	public function display_footer() {
1563
		if ( $this->smart ) {
@@ 1741-1748 (lines=8) @@
1738
		return __( 'Pocket', 'jetpack' );
1739
	}
1740
1741
	public function process_request( $post, array $post_data ) {
1742
		// Record stats
1743
		parent::process_request( $post, $post_data );
1744
1745
		$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 ) ) );
1746
		wp_redirect( $pocket_url );
1747
		exit;
1748
	}
1749
1750
	public function get_display( $post ) {
1751
		if ( $this->smart ) {
@@ 1809-1816 (lines=8) @@
1806
	public function get_name() {
1807
		return __( 'Telegram', 'jetpack' );
1808
	}
1809
	public function process_request( $post, array $post_data ) {
1810
		// Record stats
1811
		parent::process_request( $post, $post_data );
1812
		$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 ) ) );
1813
		wp_redirect( $telegram_url );
1814
		exit;
1815
	}
1816
1817
	public function get_display( $post ) {
1818
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1819
	}