Code Duplication    Length = 14-16 lines in 4 locations

modules/sso.php 1 location

@@ 525-540 (lines=16) @@
522
		<?php
523
	}
524
525
	static function delete_connection_for_user( $user_id ) {
526
		if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) {
527
			return;
528
		}
529
		Jetpack::load_xml_rpc_client();
530
		$xml = new Jetpack_IXR_Client( array(
531
			'user_id' => $user_id
532
		) );
533
		$xml->query( 'jetpack.sso.removeUser', $wpcom_user_id );
534
535
		if ( $xml->isError() ) {
536
			return false;
537
		}
538
539
		return $xml->getResponse();
540
	}
541
542
	static function request_initial_nonce() {
543
		Jetpack::load_xml_rpc_client();

modules/post-by-email.php 1 location

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

class.jetpack.php 2 locations

@@ 1568-1581 (lines=14) @@
1565
	/**
1566
	 * Get the wpcom user data of the current|specified connected user.
1567
	 */
1568
	public static function get_connected_user_data( $user_id = null ) {
1569
		if ( ! $user_id ) {
1570
			$user_id = get_current_user_id();
1571
		}
1572
		Jetpack::load_xml_rpc_client();
1573
		$xml = new Jetpack_IXR_Client( array(
1574
			'user_id' => $user_id,
1575
		) );
1576
		$xml->query( 'wpcom.getUser' );
1577
		if ( ! $xml->isError() ) {
1578
			return $xml->getResponse();
1579
		}
1580
		return false;
1581
	}
1582
1583
	/**
1584
	 * Get the wpcom email of the current|specified connected user.
@@ 1586-1599 (lines=14) @@
1583
	/**
1584
	 * Get the wpcom email of the current|specified connected user.
1585
	 */
1586
	public static function get_connected_user_email( $user_id = null ) {
1587
		if ( ! $user_id ) {
1588
			$user_id = get_current_user_id();
1589
		}
1590
		Jetpack::load_xml_rpc_client();
1591
		$xml = new Jetpack_IXR_Client( array(
1592
			'user_id' => $user_id,
1593
		) );
1594
		$xml->query( 'wpcom.getUserEmail' );
1595
		if ( ! $xml->isError() ) {
1596
			return $xml->getResponse();
1597
		}
1598
		return false;
1599
	}
1600
1601
	/**
1602
	 * Get the wpcom email of the master user.