Code Duplication    Length = 14-16 lines in 3 locations

modules/post-by-email.php 1 location

@@ 129-144 (lines=16) @@
126
	<?php
127
	}
128
129
	function get_post_by_email_address() {
130
		Jetpack::load_xml_rpc_client();
131
		$xml = new Jetpack_IXR_Client( array(
132
			'user_id' => get_current_user_id(),
133
		) );
134
		$xml->query( 'jetpack.getPostByEmailAddress' );
135
136
		if ( $xml->isError() )
137
			return NULL;
138
139
		$response = $xml->getResponse();
140
		if ( empty( $response ) )
141
			return NULL;
142
143
		return $response;
144
	}
145
146
	function create_post_by_email_address() {
147
		Jetpack::load_xml_rpc_client();

class.jetpack.php 2 locations

@@ 1435-1448 (lines=14) @@
1432
	/**
1433
	 * Get the wpcom user data of the current|specified connected user.
1434
	 */
1435
	public static function get_connected_user_data( $user_id = null ) {
1436
		if ( ! $user_id ) {
1437
			$user_id = get_current_user_id();
1438
		}
1439
		Jetpack::load_xml_rpc_client();
1440
		$xml = new Jetpack_IXR_Client( array(
1441
			'user_id' => $user_id,
1442
		) );
1443
		$xml->query( 'wpcom.getUser' );
1444
		if ( ! $xml->isError() ) {
1445
			return $xml->getResponse();
1446
		}
1447
		return false;
1448
	}
1449
1450
	/**
1451
	 * Get the wpcom email of the current|specified connected user.
@@ 1453-1466 (lines=14) @@
1450
	/**
1451
	 * Get the wpcom email of the current|specified connected user.
1452
	 */
1453
	public static function get_connected_user_email( $user_id = null ) {
1454
		if ( ! $user_id ) {
1455
			$user_id = get_current_user_id();
1456
		}
1457
		Jetpack::load_xml_rpc_client();
1458
		$xml = new Jetpack_IXR_Client( array(
1459
			'user_id' => $user_id,
1460
		) );
1461
		$xml->query( 'wpcom.getUserEmail' );
1462
		if ( ! $xml->isError() ) {
1463
			return $xml->getResponse();
1464
		}
1465
		return false;
1466
	}
1467
1468
	/**
1469
	 * Get the wpcom email of the master user.