PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.4.5
Jetpack – WP Security, Backup, Speed, & Growth v13.4.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / json-endpoints / jetpack / class.jetpack-json-api-translations-modify-endpoint.php

class.jetpack-json-api-translations-modify-endpoint.php in Jetpack – WP Security, Backup, Speed, & Growth 13.4.5, at json-endpoints/jetpack/class.jetpack-json-api-translations-modify-endpoint.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3 /**
4 * Translations modify endpoint class.
5 * POST /sites/%s/translation
6 * POST /sites/%s/translations/update
7 */
8 class Jetpack_JSON_API_Translations_Modify_Endpoint extends Jetpack_JSON_API_Translations_Endpoint {
9
10 /**
11 * The action.
12 *
13 * @var string
14 */
15 protected $action = 'default_action';
16
17 /**
18 * The new version.
19 *
20 * @var string
21 */
22 protected $new_version;
23
24 /**
25 * The log.
26 *
27 * @var array
28 */
29 protected $log;
30
31 /**
32 * Run the default action.
33 *
34 * @return true
35 */
36 public function default_action() {
37 $args = $this->input();
38
39 if ( isset( $args['autoupdate'] ) && is_bool( $args['autoupdate'] ) ) {
40 Jetpack_Options::update_option( 'autoupdate_translations', $args['autoupdate'] );
41 }
42
43 return true;
44 }
45
46 /**
47 * Update the translations.
48 */
49 protected function update() {
50 include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
51
52 $upgrader = new Language_Pack_Upgrader( new Automatic_Upgrader_Skin() );
53 $result = $upgrader->bulk_upgrade();
54
55 $this->log = $upgrader->skin->get_upgrade_messages();
56 $this->success = ( ! is_wp_error( $result ) ) ? (bool) $result : false;
57 }
58 }
59