| @@ 579-591 (lines=13) @@ | ||
| 576 | return $xml->getResponse(); | |
| 577 | } | |
| 578 | ||
| 579 | 	static function request_initial_nonce() { | |
| 580 | Jetpack::load_xml_rpc_client(); | |
| 581 | $xml = new Jetpack_IXR_Client( array( | |
| 582 | 'user_id' => get_current_user_id(), | |
| 583 | ) ); | |
| 584 | $xml->query( 'jetpack.sso.requestNonce' ); | |
| 585 | ||
| 586 | 		if ( $xml->isError() ) { | |
| 587 | return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() ); | |
| 588 | } | |
| 589 | ||
| 590 | return $xml->getResponse(); | |
| 591 | } | |
| 592 | ||
| 593 | /** | |
| 594 | * The function that actually handles the login! | |
| @@ 85-95 (lines=11) @@ | ||
| 82 | <?php | |
| 83 | } | |
| 84 | ||
| 85 | 	public function is_active() { | |
| 86 | Jetpack::load_xml_rpc_client(); | |
| 87 | $xml = new Jetpack_IXR_Client( array( | |
| 88 | 'user_id' => get_current_user_id() | |
| 89 | ) ); | |
| 90 | $xml->query( 'jetpack.monitor.isActive' ); | |
| 91 | 		if ( $xml->isError() ) { | |
| 92 | wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) ); | |
| 93 | } | |
| 94 | return $xml->getResponse(); | |
| 95 | } | |
| 96 | ||
| 97 | 	public function update_option_receive_jetpack_monitor_notification( $value ) { | |
| 98 | Jetpack::load_xml_rpc_client(); | |
| @@ 141-153 (lines=13) @@ | ||
| 138 | return $xml->getResponse(); | |
| 139 | } | |
| 140 | ||
| 141 | 	public function activate_monitor() { | |
| 142 | Jetpack::load_xml_rpc_client(); | |
| 143 | $xml = new Jetpack_IXR_Client( array( | |
| 144 | 'user_id' => get_current_user_id() | |
| 145 | ) ); | |
| 146 | ||
| 147 | $xml->query( 'jetpack.monitor.activate' ); | |
| 148 | ||
| 149 | 		if ( $xml->isError() ) { | |
| 150 | wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) ); | |
| 151 | } | |
| 152 | return true; | |
| 153 | } | |
| 154 | ||
| 155 | 	public function deactivate_monitor() { | |
| 156 | Jetpack::load_xml_rpc_client(); | |
| @@ 155-167 (lines=13) @@ | ||
| 152 | return true; | |
| 153 | } | |
| 154 | ||
| 155 | 	public function deactivate_monitor() { | |
| 156 | Jetpack::load_xml_rpc_client(); | |
| 157 | $xml = new Jetpack_IXR_Client( array( | |
| 158 | 'user_id' => get_current_user_id() | |
| 159 | ) ); | |
| 160 | ||
| 161 | $xml->query( 'jetpack.monitor.deactivate' ); | |
| 162 | ||
| 163 | 		if ( $xml->isError() ) { | |
| 164 | wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) ); | |
| 165 | } | |
| 166 | return true; | |
| 167 | } | |
| 168 | ||
| 169 | /* | |
| 170 | * Returns date of the last downtime. | |