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 );
@@ 1430-1438 (lines=9) @@
1427
		}
1428
	}
1429
1430
	public function process_request( $post, array $post_data ) {
1431
		// Record stats
1432
		parent::process_request( $post, $post_data );
1433
1434
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1435
		$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=';
1436
		wp_redirect( $url );
1437
		die();
1438
	}
1439
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1440
	public function display_footer() {
1441
		if ( $this->smart ) {
@@ 1619-1626 (lines=8) @@
1616
		return __( 'Pocket', 'jetpack' );
1617
	}
1618
1619
	public function process_request( $post, array $post_data ) {
1620
		// Record stats
1621
		parent::process_request( $post, $post_data );
1622
1623
		$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 ) ) );
1624
		wp_redirect( $pocket_url );
1625
		exit;
1626
	}
1627
1628
	public function get_display( $post ) {
1629
		if ( $this->smart ) {
@@ 1674-1681 (lines=8) @@
1671
	public function get_name() {
1672
		return __( 'Telegram', 'jetpack' );
1673
	}
1674
	public function process_request( $post, array $post_data ) {
1675
		// Record stats
1676
		parent::process_request( $post, $post_data );
1677
		$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 ) ) );
1678
		wp_redirect( $telegram_url );
1679
		exit;
1680
	}
1681
1682
	public function get_display( $post ) {
1683
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1684
	}