Code Duplication    Length = 14-18 lines in 4 locations

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(

modules/sso.php 1 location

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