Jetpack_JSON_API_Translations_Modify_Endpoint

The WordPress Core Jetpack JSON API Translations Modify Endpoint class.

Defined (1)

The class is defined in the following location(s).

/json-endpoints/jetpack/class.jetpack-json-api-translations-modify-endpoint.php  
  1. class Jetpack_JSON_API_Translations_Modify_Endpoint extends Jetpack_JSON_API_Translations_Endpoint { 
  2. // POST /sites/%s/translations 
  3. // POST /sites/%s/translations/update 
  4. protected $action = 'default_action'; 
  5. protected $new_version; 
  6. protected $log; 
  7.  
  8. public function default_action() { 
  9. $args = $this->input(); 
  10.  
  11. if ( isset( $args['autoupdate'] ) && is_bool( $args['autoupdate'] ) ) { 
  12. Jetpack_Options::update_option( 'autoupdate_translations', $args['autoupdate'] ); 
  13.  
  14. return true; 
  15.  
  16. protected function update() { 
  17. include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 
  18.  
  19. $upgrader = new Language_Pack_Upgrader( new Automatic_Upgrader_Skin() ); 
  20. $result = $upgrader->bulk_upgrade(); 
  21.  
  22. $this->log = $upgrader->skin->get_upgrade_messages(); 
  23. $this->success = ( ! is_wp_error( $result ) ) ? (bool) $result : false;