Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 792-801 (lines=10) @@
789
		}
790
	}
791
792
	public function process_request( $post, array $post_data ) {
793
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
794
795
		// Record stats
796
		parent::process_request( $post, $post_data );
797
798
		// Redirect to Reddit
799
		wp_redirect( $reddit_url );
800
		die();
801
	}
802
}
803
804
class Share_LinkedIn extends Sharing_Source {
@@ 970-979 (lines=10) @@
967
		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 );
968
	}
969
970
	public function process_request( $post, array $post_data ) {
971
		$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 ) );
972
973
		// Record stats
974
		parent::process_request( $post, $post_data );
975
976
		// Redirect to Facebook
977
		wp_redirect( $fb_url );
978
		die();
979
	}
980
981
	public function display_footer() {
982
		$this->js_dialog( $this->shortname );
@@ 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
	}