Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 779-788 (lines=10) @@
776
		}
777
	}
778
779
	public function process_request( $post, array $post_data ) {
780
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
781
782
		// Record stats
783
		parent::process_request( $post, $post_data );
784
785
		// Redirect to Reddit
786
		wp_redirect( $reddit_url );
787
		die();
788
	}
789
}
790
791
class Share_LinkedIn extends Sharing_Source {
@@ 957-966 (lines=10) @@
954
		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 );
955
	}
956
957
	public function process_request( $post, array $post_data ) {
958
		$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 ) );
959
960
		// Record stats
961
		parent::process_request( $post, $post_data );
962
963
		// Redirect to Facebook
964
		wp_redirect( $fb_url );
965
		die();
966
	}
967
968
	public function display_footer() {
969
		$this->js_dialog( $this->shortname );
@@ 1418-1426 (lines=9) @@
1415
		}
1416
	}
1417
1418
	public function process_request( $post, array $post_data ) {
1419
		// Record stats
1420
		parent::process_request( $post, $post_data );
1421
1422
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1423
		$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=';
1424
		wp_redirect( $url );
1425
		die();
1426
	}
1427
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1428
	public function display_footer() {
1429
		if ( $this->smart ) {
@@ 1607-1614 (lines=8) @@
1604
		return __( 'Pocket', 'jetpack' );
1605
	}
1606
1607
	public function process_request( $post, array $post_data ) {
1608
		// Record stats
1609
		parent::process_request( $post, $post_data );
1610
1611
		$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 ) ) );
1612
		wp_redirect( $pocket_url );
1613
		exit;
1614
	}
1615
1616
	public function get_display( $post ) {
1617
		if ( $this->smart ) {
@@ 1662-1669 (lines=8) @@
1659
	public function get_name() {
1660
		return __( 'Telegram', 'jetpack' );
1661
	}
1662
	public function process_request( $post, array $post_data ) {
1663
		// Record stats
1664
		parent::process_request( $post, $post_data );
1665
		$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 ) ) );
1666
		wp_redirect( $telegram_url );
1667
		exit;
1668
	}
1669
1670
	public function get_display( $post ) {
1671
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1672
	}