| @@ 1550-1563 (lines=14) @@ | ||
| 1547 | /** |
|
| 1548 | * Get the wpcom user data of the current|specified connected user. |
|
| 1549 | */ |
|
| 1550 | public static function get_connected_user_data( $user_id = null ) { |
|
| 1551 | if ( ! $user_id ) { |
|
| 1552 | $user_id = get_current_user_id(); |
|
| 1553 | } |
|
| 1554 | Jetpack::load_xml_rpc_client(); |
|
| 1555 | $xml = new Jetpack_IXR_Client( array( |
|
| 1556 | 'user_id' => $user_id, |
|
| 1557 | ) ); |
|
| 1558 | $xml->query( 'wpcom.getUser' ); |
|
| 1559 | if ( ! $xml->isError() ) { |
|
| 1560 | return $xml->getResponse(); |
|
| 1561 | } |
|
| 1562 | return false; |
|
| 1563 | } |
|
| 1564 | ||
| 1565 | /** |
|
| 1566 | * Get the wpcom email of the current|specified connected user. |
|
| @@ 1568-1581 (lines=14) @@ | ||
| 1565 | /** |
|
| 1566 | * Get the wpcom email of the current|specified connected user. |
|
| 1567 | */ |
|
| 1568 | public static function get_connected_user_email( $user_id = null ) { |
|
| 1569 | if ( ! $user_id ) { |
|
| 1570 | $user_id = get_current_user_id(); |
|
| 1571 | } |
|
| 1572 | Jetpack::load_xml_rpc_client(); |
|
| 1573 | $xml = new Jetpack_IXR_Client( array( |
|
| 1574 | 'user_id' => $user_id, |
|
| 1575 | ) ); |
|
| 1576 | $xml->query( 'wpcom.getUserEmail' ); |
|
| 1577 | if ( ! $xml->isError() ) { |
|
| 1578 | return $xml->getResponse(); |
|
| 1579 | } |
|
| 1580 | return false; |
|
| 1581 | } |
|
| 1582 | ||
| 1583 | /** |
|
| 1584 | * Get the wpcom email of the master user. |
|
| @@ 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( |
|