Code Duplication    Length = 14-16 lines in 4 locations

modules/post-by-email.php 1 location

@@ 136-151 (lines=16) @@
133
	<?php
134
	}
135
136
	function get_post_by_email_address() {
137
		Jetpack::load_xml_rpc_client();
138
		$xml = new Jetpack_IXR_Client( array(
139
			'user_id' => get_current_user_id(),
140
		) );
141
		$xml->query( 'jetpack.getPostByEmailAddress' );
142
143
		if ( $xml->isError() )
144
			return NULL;
145
146
		$response = $xml->getResponse();
147
		if ( empty( $response ) )
148
			return NULL;
149
150
		return $response;
151
	}
152
153
	function create_post_by_email_address() {
154
		Jetpack::load_xml_rpc_client();

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();

class.jetpack.php 2 locations

@@ 1582-1595 (lines=14) @@
1579
	/**
1580
	 * Get the wpcom user data of the current|specified connected user.
1581
	 */
1582
	public static function get_connected_user_data( $user_id = null ) {
1583
		if ( ! $user_id ) {
1584
			$user_id = get_current_user_id();
1585
		}
1586
		Jetpack::load_xml_rpc_client();
1587
		$xml = new Jetpack_IXR_Client( array(
1588
			'user_id' => $user_id,
1589
		) );
1590
		$xml->query( 'wpcom.getUser' );
1591
		if ( ! $xml->isError() ) {
1592
			return $xml->getResponse();
1593
		}
1594
		return false;
1595
	}
1596
1597
	/**
1598
	 * Get the wpcom email of the current|specified connected user.
@@ 1600-1613 (lines=14) @@
1597
	/**
1598
	 * Get the wpcom email of the current|specified connected user.
1599
	 */
1600
	public static function get_connected_user_email( $user_id = null ) {
1601
		if ( ! $user_id ) {
1602
			$user_id = get_current_user_id();
1603
		}
1604
		Jetpack::load_xml_rpc_client();
1605
		$xml = new Jetpack_IXR_Client( array(
1606
			'user_id' => $user_id,
1607
		) );
1608
		$xml->query( 'wpcom.getUserEmail' );
1609
		if ( ! $xml->isError() ) {
1610
			return $xml->getResponse();
1611
		}
1612
		return false;
1613
	}
1614
1615
	/**
1616
	 * Get the wpcom email of the master user.