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