| 1 |
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit( 0 ); |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Translations endpoint class. |
| 9 |
* |
| 10 |
* GET /sites/%s/translations |
| 11 |
* POST /sites/%s/translations |
| 12 |
* POST /sites/%s/translations/update |
| 13 |
* |
| 14 |
* @phan-constructor-used-for-side-effects |
| 15 |
*/ |
| 16 |
class Jetpack_JSON_API_Translations_Endpoint extends Jetpack_JSON_API_Endpoint { |
| 17 |
/** |
| 18 |
* Needed capabilities. |
| 19 |
* |
| 20 |
* @var array |
| 21 |
*/ |
| 22 |
protected $needed_capabilities = array( 'update_core', 'update_plugins', 'update_themes' ); |
| 23 |
|
| 24 |
/** |
| 25 |
* The log. |
| 26 |
* |
| 27 |
* @var array |
| 28 |
*/ |
| 29 |
protected $log; |
| 30 |
|
| 31 |
/** |
| 32 |
* If we're successful. |
| 33 |
* |
| 34 |
* @var bool |
| 35 |
*/ |
| 36 |
protected $success; |
| 37 |
|
| 38 |
/** |
| 39 |
* API Endpoint. |
| 40 |
* |
| 41 |
* @return array |
| 42 |
*/ |
| 43 |
public function result() { |
| 44 |
return array( |
| 45 |
'translations' => wp_get_translation_updates(), |
| 46 |
'autoupdate' => Jetpack_Options::get_option( 'autoupdate_translations', false ), |
| 47 |
'log' => $this->log, |
| 48 |
'success' => $this->success, |
| 49 |
); |
| 50 |
} |
| 51 |
} |
| 52 |
|