Code Duplication    Length = 8-10 lines in 5 locations

modules/sharedaddy/sharing-sources.php 5 locations

@@ 1441-1449 (lines=9) @@
1438
		}
1439
	}
1440
1441
	public function process_request( $post, array $post_data ) {
1442
		// Record stats
1443
		parent::process_request( $post, $post_data );
1444
1445
		// Redirect to Tumblr's sharing endpoint (a la their bookmarklet)
1446
		$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=';
1447
		wp_redirect( $url );
1448
		die();
1449
	}
1450
1451
	public function display_footer() {
1452
		if ( $this->smart ) {
@@ 1630-1637 (lines=8) @@
1627
		return __( 'Pocket', 'jetpack' );
1628
	}
1629
1630
	public function process_request( $post, array $post_data ) {
1631
		// Record stats
1632
		parent::process_request( $post, $post_data );
1633
1634
		$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 ) ) );
1635
		wp_redirect( $pocket_url );
1636
		exit;
1637
	}
1638
1639
	public function get_display( $post ) {
1640
		if ( $this->smart ) {
@@ 1685-1692 (lines=8) @@
1682
	public function get_name() {
1683
		return __( 'Telegram', 'jetpack' );
1684
	}
1685
	public function process_request( $post, array $post_data ) {
1686
		// Record stats
1687
		parent::process_request( $post, $post_data );
1688
		$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 ) ) );
1689
		wp_redirect( $telegram_url );
1690
		exit;
1691
	}
1692
1693
	public function get_display( $post ) {
1694
		return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Telegram', 'share to', 'jetpack' ), __( 'Click to share on Telegram', 'jetpack' ), 'share=telegram' );
1695
	}
@@ 867-876 (lines=10) @@
864
		}
865
	}
866
867
	public function process_request( $post, array $post_data ) {
868
		$reddit_url = $this->http() . '://reddit.com/submit?url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&title=' . rawurlencode( $this->get_share_title( $post->ID ) );
869
870
		// Record stats
871
		parent::process_request( $post, $post_data );
872
873
		// Redirect to Reddit
874
		wp_redirect( $reddit_url );
875
		die();
876
	}
877
}
878
879
class Share_LinkedIn extends Sharing_Source {
@@ 1045-1054 (lines=10) @@
1042
		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 );
1043
	}
1044
1045
	public function process_request( $post, array $post_data ) {
1046
		$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 ) );
1047
1048
		// Record stats
1049
		parent::process_request( $post, $post_data );
1050
1051
		// Redirect to Facebook
1052
		wp_redirect( $fb_url );
1053
		die();
1054
	}
1055
1056
	public function display_footer() {
1057
		$this->js_dialog( $this->shortname );