Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 777-786 (lines=10) @@
774
		}
775
	}
776
777
	public function process_request( $post, array $post_data ) {
778
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
779
780
		// Record stats
781
		parent::process_request( $post, $post_data );
782
783
		// Redirect to Reddit
784
		wp_redirect( $reddit_url );
785
		die();
786
	}
787
}
788
789
class Share_LinkedIn extends Sharing_Source {
@@ 955-964 (lines=10) @@
952
		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 );
953
	}
954
955
	public function process_request( $post, array $post_data ) {
956
		$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 ) );
957
958
		// Record stats
959
		parent::process_request( $post, $post_data );
960
961
		// Redirect to Facebook
962
		wp_redirect( $fb_url );
963
		die();
964
	}
965
966
	public function display_footer() {
967
		$this->js_dialog( $this->shortname );
@@ 1429-1437 (lines=9) @@
1426
		}
1427
	}
1428
1429
	public function process_request( $post, array $post_data ) {
1430
		// Record stats
1431
		parent::process_request( $post, $post_data );
1432
1433
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1434
		$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=';
1435
		wp_redirect( $url );
1436
		die();
1437
	}
1438
	// http://www.tumblr.com/share?v=3&u=URL&t=TITLE&s=
1439
	public function display_footer() {
1440
		if ( $this->smart ) {
@@ 1618-1625 (lines=8) @@
1615
		return __( 'Pocket', 'jetpack' );
1616
	}
1617
1618
	public function process_request( $post, array $post_data ) {
1619
		// Record stats
1620
		parent::process_request( $post, $post_data );
1621
1622
		$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 ) ) );
1623
		wp_redirect( $pocket_url );
1624
		exit;
1625
	}
1626
1627
	public function get_display( $post ) {
1628
		if ( $this->smart ) {
@@ 1673-1680 (lines=8) @@
1670
	public function get_name() {
1671
		return __( 'Telegram', 'jetpack' );
1672
	}
1673
	public function process_request( $post, array $post_data ) {
1674
		// Record stats
1675
		parent::process_request( $post, $post_data );
1676
		$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 ) ) );
1677
		wp_redirect( $telegram_url );
1678
		exit;
1679
	}
1680
1681
	public function get_display( $post ) {
1682
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1683
	}