@@ 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. |
@@ 599-611 (lines=13) @@ | ||
596 | return $xml->getResponse(); |
|
597 | } |
|
598 | ||
599 | static function request_initial_nonce() { |
|
600 | Jetpack::load_xml_rpc_client(); |
|
601 | $xml = new Jetpack_IXR_Client( array( |
|
602 | 'user_id' => get_current_user_id(), |
|
603 | ) ); |
|
604 | $xml->query( 'jetpack.sso.requestNonce' ); |
|
605 | ||
606 | if ( $xml->isError() ) { |
|
607 | return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() ); |
|
608 | } |
|
609 | ||
610 | return $xml->getResponse(); |
|
611 | } |
|
612 | ||
613 | /** |
|
614 | * The function that actually handles the login! |