Code Duplication    Length = 8-10 lines in 5 locations

projects/plugins/jetpack/modules/sharedaddy/sharing-sources.php 5 locations

@@ 973-982 (lines=10) @@
970
		return $this->build_amp_markup( $attrs );
971
	}
972
973
	public function process_request( $post, array $post_data ) {
974
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
975
976
		// Record stats
977
		parent::process_request( $post, $post_data );
978
979
		// Redirect to Reddit
980
		wp_redirect( $reddit_url );
981
		die();
982
	}
983
}
984
985
class Share_LinkedIn extends Sharing_Source {
@@ 1191-1200 (lines=10) @@
1188
		return $this->build_amp_markup( $attrs );
1189
	}
1190
1191
	public function process_request( $post, array $post_data ) {
1192
		$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 ) );
1193
1194
		// Record stats
1195
		parent::process_request( $post, $post_data );
1196
1197
		// Redirect to Facebook
1198
		wp_redirect( $fb_url );
1199
		die();
1200
	}
1201
1202
	public function display_footer() {
1203
		$this->js_dialog( $this->shortname );
@@ 1602-1610 (lines=9) @@
1599
		}
1600
	}
1601
1602
	public function process_request( $post, array $post_data ) {
1603
		// Record stats
1604
		parent::process_request( $post, $post_data );
1605
1606
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1607
		$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=';
1608
		wp_redirect( $url );
1609
		die();
1610
	}
1611
1612
	public function display_footer() {
1613
		if ( $this->smart ) {
@@ 1822-1829 (lines=8) @@
1819
		return __( 'Pocket', 'jetpack' );
1820
	}
1821
1822
	public function process_request( $post, array $post_data ) {
1823
		// Record stats
1824
		parent::process_request( $post, $post_data );
1825
1826
		$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 ) ) );
1827
		wp_redirect( $pocket_url );
1828
		exit;
1829
	}
1830
1831
	public function get_display( $post ) {
1832
		if ( $this->smart ) {
@@ 1903-1910 (lines=8) @@
1900
	public function get_name() {
1901
		return __( 'Telegram', 'jetpack' );
1902
	}
1903
	public function process_request( $post, array $post_data ) {
1904
		// Record stats
1905
		parent::process_request( $post, $post_data );
1906
		$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 ) ) );
1907
		wp_redirect( $telegram_url );
1908
		exit;
1909
	}
1910
1911
	public function get_display( $post ) {
1912
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1913
	}