Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 1443-1451 (lines=9) @@
1440
		}
1441
	}
1442
1443
	public function process_request( $post, array $post_data ) {
1444
		// Record stats
1445
		parent::process_request( $post, $post_data );
1446
1447
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1448
		$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=';
1449
		wp_redirect( $url );
1450
		die();
1451
	}
1452
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1453
	public function display_footer() {
1454
		if ( $this->smart ) {
@@ 1632-1639 (lines=8) @@
1629
		return __( 'Pocket', 'jetpack' );
1630
	}
1631
1632
	public function process_request( $post, array $post_data ) {
1633
		// Record stats
1634
		parent::process_request( $post, $post_data );
1635
1636
		$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 ) ) );
1637
		wp_redirect( $pocket_url );
1638
		exit;
1639
	}
1640
1641
	public function get_display( $post ) {
1642
		if ( $this->smart ) {
@@ 1687-1694 (lines=8) @@
1684
	public function get_name() {
1685
		return __( 'Telegram', 'jetpack' );
1686
	}
1687
	public function process_request( $post, array $post_data ) {
1688
		// Record stats
1689
		parent::process_request( $post, $post_data );
1690
		$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 ) ) );
1691
		wp_redirect( $telegram_url );
1692
		exit;
1693
	}
1694
1695
	public function get_display( $post ) {
1696
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1697
	}
@@ 791-800 (lines=10) @@
788
		}
789
	}
790
791
	public function process_request( $post, array $post_data ) {
792
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
793
794
		// Record stats
795
		parent::process_request( $post, $post_data );
796
797
		// Redirect to Reddit
798
		wp_redirect( $reddit_url );
799
		die();
800
	}
801
}
802
803
class Share_LinkedIn extends Sharing_Source {
@@ 969-978 (lines=10) @@
966
		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 );
967
	}
968
969
	public function process_request( $post, array $post_data ) {
970
		$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 ) );
971
972
		// Record stats
973
		parent::process_request( $post, $post_data );
974
975
		// Redirect to Facebook
976
		wp_redirect( $fb_url );
977
		die();
978
	}
979
980
	public function display_footer() {
981
		$this->js_dialog( $this->shortname );