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