Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 934-943 (lines=10) @@
931
		return $this->build_amp_markup( $attrs );
932
	}
933
934
	public function process_request( $post, array $post_data ) {
935
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
936
937
		// Record stats
938
		parent::process_request( $post, $post_data );
939
940
		// Redirect to Reddit
941
		wp_redirect( $reddit_url );
942
		die();
943
	}
944
}
945
946
class Share_LinkedIn extends Sharing_Source {
@@ 1126-1135 (lines=10) @@
1123
		return $this->build_amp_markup( $attrs );
1124
	}
1125
1126
	public function process_request( $post, array $post_data ) {
1127
		$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 ) );
1128
1129
		// Record stats
1130
		parent::process_request( $post, $post_data );
1131
1132
		// Redirect to Facebook
1133
		wp_redirect( $fb_url );
1134
		die();
1135
	}
1136
1137
	public function display_footer() {
1138
		$this->js_dialog( $this->shortname );
@@ 1537-1545 (lines=9) @@
1534
		}
1535
	}
1536
1537
	public function process_request( $post, array $post_data ) {
1538
		// Record stats
1539
		parent::process_request( $post, $post_data );
1540
1541
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1542
		$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=';
1543
		wp_redirect( $url );
1544
		die();
1545
	}
1546
1547
	public function display_footer() {
1548
		if ( $this->smart ) {
@@ 1726-1733 (lines=8) @@
1723
		return __( 'Pocket', 'jetpack' );
1724
	}
1725
1726
	public function process_request( $post, array $post_data ) {
1727
		// Record stats
1728
		parent::process_request( $post, $post_data );
1729
1730
		$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 ) ) );
1731
		wp_redirect( $pocket_url );
1732
		exit;
1733
	}
1734
1735
	public function get_display( $post ) {
1736
		if ( $this->smart ) {
@@ 1794-1801 (lines=8) @@
1791
	public function get_name() {
1792
		return __( 'Telegram', 'jetpack' );
1793
	}
1794
	public function process_request( $post, array $post_data ) {
1795
		// Record stats
1796
		parent::process_request( $post, $post_data );
1797
		$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 ) ) );
1798
		wp_redirect( $telegram_url );
1799
		exit;
1800
	}
1801
1802
	public function get_display( $post ) {
1803
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1804
	}