| 1 |
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit( 0 ); |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Core endpoint class. |
| 9 |
* |
| 10 |
* POST /sites/%s/core |
| 11 |
* POST /sites/%s/core/update |
| 12 |
* |
| 13 |
* @phan-constructor-used-for-side-effects |
| 14 |
*/ |
| 15 |
class Jetpack_JSON_API_Core_Endpoint extends Jetpack_JSON_API_Endpoint { |
| 16 |
|
| 17 |
/** |
| 18 |
* Needed capabilities. |
| 19 |
* |
| 20 |
* @var string |
| 21 |
*/ |
| 22 |
protected $needed_capabilities = 'manage_options'; |
| 23 |
|
| 24 |
/** |
| 25 |
* New version. |
| 26 |
* |
| 27 |
* @var string |
| 28 |
*/ |
| 29 |
protected $new_version; |
| 30 |
|
| 31 |
/** |
| 32 |
* An array of log strings. |
| 33 |
* |
| 34 |
* @var array |
| 35 |
*/ |
| 36 |
protected $log; |
| 37 |
|
| 38 |
/** |
| 39 |
* Return the result of the wp_version. |
| 40 |
* |
| 41 |
* @return array |
| 42 |
*/ |
| 43 |
public function result() { |
| 44 |
global $wp_version; |
| 45 |
|
| 46 |
return array( |
| 47 |
'version' => ( empty( $this->new_version ) ) ? $wp_version : $this->new_version, |
| 48 |
'autoupdate' => Jetpack_Options::get_option( 'autoupdate_core', false ), |
| 49 |
'log' => $this->log, |
| 50 |
); |
| 51 |
} |
| 52 |
} |
| 53 |
|