| @@ 520-535 (lines=16) @@ | ||
| 517 | <?php |
|
| 518 | } |
|
| 519 | ||
| 520 | static function delete_connection_for_user( $user_id ) { |
|
| 521 | if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) { |
|
| 522 | return; |
|
| 523 | } |
|
| 524 | Jetpack::load_xml_rpc_client(); |
|
| 525 | $xml = new Jetpack_IXR_Client( array( |
|
| 526 | 'user_id' => $user_id |
|
| 527 | ) ); |
|
| 528 | $xml->query( 'jetpack.sso.removeUser', $wpcom_user_id ); |
|
| 529 | ||
| 530 | if ( $xml->isError() ) { |
|
| 531 | return false; |
|
| 532 | } |
|
| 533 | ||
| 534 | return $xml->getResponse(); |
|
| 535 | } |
|
| 536 | ||
| 537 | static function request_initial_nonce() { |
|
| 538 | Jetpack::load_xml_rpc_client(); |
|
| @@ 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(); |
|
| @@ 1561-1574 (lines=14) @@ | ||
| 1558 | /** |
|
| 1559 | * Get the wpcom user data of the current|specified connected user. |
|
| 1560 | */ |
|
| 1561 | public static function get_connected_user_data( $user_id = null ) { |
|
| 1562 | if ( ! $user_id ) { |
|
| 1563 | $user_id = get_current_user_id(); |
|
| 1564 | } |
|
| 1565 | Jetpack::load_xml_rpc_client(); |
|
| 1566 | $xml = new Jetpack_IXR_Client( array( |
|
| 1567 | 'user_id' => $user_id, |
|
| 1568 | ) ); |
|
| 1569 | $xml->query( 'wpcom.getUser' ); |
|
| 1570 | if ( ! $xml->isError() ) { |
|
| 1571 | return $xml->getResponse(); |
|
| 1572 | } |
|
| 1573 | return false; |
|
| 1574 | } |
|
| 1575 | ||
| 1576 | /** |
|
| 1577 | * Get the wpcom email of the current|specified connected user. |
|
| @@ 1579-1592 (lines=14) @@ | ||
| 1576 | /** |
|
| 1577 | * Get the wpcom email of the current|specified connected user. |
|
| 1578 | */ |
|
| 1579 | public static function get_connected_user_email( $user_id = null ) { |
|
| 1580 | if ( ! $user_id ) { |
|
| 1581 | $user_id = get_current_user_id(); |
|
| 1582 | } |
|
| 1583 | Jetpack::load_xml_rpc_client(); |
|
| 1584 | $xml = new Jetpack_IXR_Client( array( |
|
| 1585 | 'user_id' => $user_id, |
|
| 1586 | ) ); |
|
| 1587 | $xml->query( 'wpcom.getUserEmail' ); |
|
| 1588 | if ( ! $xml->isError() ) { |
|
| 1589 | return $xml->getResponse(); |
|
| 1590 | } |
|
| 1591 | return false; |
|
| 1592 | } |
|
| 1593 | ||
| 1594 | /** |
|
| 1595 | * Get the wpcom email of the master user. |
|