@@ 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(); |
@@ 1583-1596 (lines=14) @@ | ||
1580 | /** |
|
1581 | * Get the wpcom user data of the current|specified connected user. |
|
1582 | */ |
|
1583 | public static function get_connected_user_data( $user_id = null ) { |
|
1584 | if ( ! $user_id ) { |
|
1585 | $user_id = get_current_user_id(); |
|
1586 | } |
|
1587 | Jetpack::load_xml_rpc_client(); |
|
1588 | $xml = new Jetpack_IXR_Client( array( |
|
1589 | 'user_id' => $user_id, |
|
1590 | ) ); |
|
1591 | $xml->query( 'wpcom.getUser' ); |
|
1592 | if ( ! $xml->isError() ) { |
|
1593 | return $xml->getResponse(); |
|
1594 | } |
|
1595 | return false; |
|
1596 | } |
|
1597 | ||
1598 | /** |
|
1599 | * Get the wpcom email of the current|specified connected user. |
|
@@ 1601-1614 (lines=14) @@ | ||
1598 | /** |
|
1599 | * Get the wpcom email of the current|specified connected user. |
|
1600 | */ |
|
1601 | public static function get_connected_user_email( $user_id = null ) { |
|
1602 | if ( ! $user_id ) { |
|
1603 | $user_id = get_current_user_id(); |
|
1604 | } |
|
1605 | Jetpack::load_xml_rpc_client(); |
|
1606 | $xml = new Jetpack_IXR_Client( array( |
|
1607 | 'user_id' => $user_id, |
|
1608 | ) ); |
|
1609 | $xml->query( 'wpcom.getUserEmail' ); |
|
1610 | if ( ! $xml->isError() ) { |
|
1611 | return $xml->getResponse(); |
|
1612 | } |
|
1613 | return false; |
|
1614 | } |
|
1615 | ||
1616 | /** |
|
1617 | * Get the wpcom email of the master user. |
@@ 473-488 (lines=16) @@ | ||
470 | echo '<div id="jetpack-sso-wrap" class="jetpack-sso-wrap' . $classes . '">' . $this->button() . '</div>'; |
|
471 | } |
|
472 | ||
473 | static function delete_connection_for_user( $user_id ) { |
|
474 | if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) { |
|
475 | return; |
|
476 | } |
|
477 | Jetpack::load_xml_rpc_client(); |
|
478 | $xml = new Jetpack_IXR_Client( array( |
|
479 | 'user_id' => $user_id, |
|
480 | ) ); |
|
481 | $xml->query( 'jetpack.sso.removeUser', $wpcom_user_id ); |
|
482 | ||
483 | if ( $xml->isError() ) { |
|
484 | return false; |
|
485 | } |
|
486 | ||
487 | return $xml->getResponse(); |
|
488 | } |
|
489 | ||
490 | static function request_initial_nonce() { |
|
491 | Jetpack::load_xml_rpc_client(); |