Code Duplication    Length = 14-18 lines in 4 locations

modules/sso.php 1 location

@@ 598-615 (lines=18) @@
595
		}
596
	}
597
598
	static function delete_connection_for_user( $user_id ) {
599
		if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) {
600
			return;
601
		}
602
		Jetpack::load_xml_rpc_client();
603
		$xml = new Jetpack_IXR_Client( array(
604
			'wpcom_user_id' => $user_id,
605
		) );
606
		$xml->query( 'jetpack.sso.removeUser', $wpcom_user_id );
607
608
		if ( $xml->isError() ) {
609
			return false;
610
		}
611
612
		self::clear_wpcom_profile_cookies();
613
614
		return $xml->getResponse();
615
	}
616
617
	static function request_initial_nonce() {
618
		Jetpack::load_xml_rpc_client();

class.jetpack.php 2 locations

@@ 1472-1485 (lines=14) @@
1469
	/**
1470
	 * Get the wpcom user data of the current|specified connected user.
1471
	 */
1472
	public static function get_connected_user_data( $user_id = null ) {
1473
		if ( ! $user_id ) {
1474
			$user_id = get_current_user_id();
1475
		}
1476
		Jetpack::load_xml_rpc_client();
1477
		$xml = new Jetpack_IXR_Client( array(
1478
			'user_id' => $user_id,
1479
		) );
1480
		$xml->query( 'wpcom.getUser' );
1481
		if ( ! $xml->isError() ) {
1482
			return $xml->getResponse();
1483
		}
1484
		return false;
1485
	}
1486
1487
	/**
1488
	 * Get the wpcom email of the current|specified connected user.
@@ 1490-1503 (lines=14) @@
1487
	/**
1488
	 * Get the wpcom email of the current|specified connected user.
1489
	 */
1490
	public static function get_connected_user_email( $user_id = null ) {
1491
		if ( ! $user_id ) {
1492
			$user_id = get_current_user_id();
1493
		}
1494
		Jetpack::load_xml_rpc_client();
1495
		$xml = new Jetpack_IXR_Client( array(
1496
			'user_id' => $user_id,
1497
		) );
1498
		$xml->query( 'wpcom.getUserEmail' );
1499
		if ( ! $xml->isError() ) {
1500
			return $xml->getResponse();
1501
		}
1502
		return false;
1503
	}
1504
1505
	/**
1506
	 * Get the wpcom email of the master user.

modules/post-by-email.php 1 location

@@ 144-159 (lines=16) @@
141
	<?php
142
	}
143
144
	function get_post_by_email_address() {
145
		Jetpack::load_xml_rpc_client();
146
		$xml = new Jetpack_IXR_Client( array(
147
			'user_id' => get_current_user_id(),
148
		) );
149
		$xml->query( 'jetpack.getPostByEmailAddress' );
150
151
		if ( $xml->isError() )
152
			return NULL;
153
154
		$response = $xml->getResponse();
155
		if ( empty( $response ) )
156
			return NULL;
157
158
		return $response;
159
	}
160
161
	function create_post_by_email_address() {
162
		self::__process_ajax_proxy_request(