| @@ 1567-1580 (lines=14) @@ | ||
| 1564 | /** |
|
| 1565 | * Get the wpcom user data of the current|specified connected user. |
|
| 1566 | */ |
|
| 1567 | public static function get_connected_user_data( $user_id = null ) { |
|
| 1568 | if ( ! $user_id ) { |
|
| 1569 | $user_id = get_current_user_id(); |
|
| 1570 | } |
|
| 1571 | Jetpack::load_xml_rpc_client(); |
|
| 1572 | $xml = new Jetpack_IXR_Client( array( |
|
| 1573 | 'user_id' => $user_id, |
|
| 1574 | ) ); |
|
| 1575 | $xml->query( 'wpcom.getUser' ); |
|
| 1576 | if ( ! $xml->isError() ) { |
|
| 1577 | return $xml->getResponse(); |
|
| 1578 | } |
|
| 1579 | return false; |
|
| 1580 | } |
|
| 1581 | ||
| 1582 | /** |
|
| 1583 | * Get the wpcom email of the current|specified connected user. |
|
| @@ 1585-1598 (lines=14) @@ | ||
| 1582 | /** |
|
| 1583 | * Get the wpcom email of the current|specified connected user. |
|
| 1584 | */ |
|
| 1585 | public static function get_connected_user_email( $user_id = null ) { |
|
| 1586 | if ( ! $user_id ) { |
|
| 1587 | $user_id = get_current_user_id(); |
|
| 1588 | } |
|
| 1589 | Jetpack::load_xml_rpc_client(); |
|
| 1590 | $xml = new Jetpack_IXR_Client( array( |
|
| 1591 | 'user_id' => $user_id, |
|
| 1592 | ) ); |
|
| 1593 | $xml->query( 'wpcom.getUserEmail' ); |
|
| 1594 | if ( ! $xml->isError() ) { |
|
| 1595 | return $xml->getResponse(); |
|
| 1596 | } |
|
| 1597 | return false; |
|
| 1598 | } |
|
| 1599 | ||
| 1600 | /** |
|
| 1601 | * Get the wpcom email of the master user. |
|
| @@ 598-615 (lines=18) @@ | ||
| 595 | } |
|
| 596 | } |
|
| 597 | ||
| 598 | static function delete_connection_for_user( $user_id ) { |
|
| 599 | if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) { |
|
| 600 | return; |
|
| 601 | } |
|
| 602 | Jetpack::load_xml_rpc_client(); |
|
| 603 | $xml = new Jetpack_IXR_Client( array( |
|
| 604 | 'wpcom_user_id' => $user_id, |
|
| 605 | ) ); |
|
| 606 | $xml->query( 'jetpack.sso.removeUser', $wpcom_user_id ); |
|
| 607 | ||
| 608 | if ( $xml->isError() ) { |
|
| 609 | return false; |
|
| 610 | } |
|
| 611 | ||
| 612 | self::clear_wpcom_profile_cookies(); |
|
| 613 | ||
| 614 | return $xml->getResponse(); |
|
| 615 | } |
|
| 616 | ||
| 617 | static function request_initial_nonce() { |
|
| 618 | Jetpack::load_xml_rpc_client(); |
|
| @@ 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( |
|