Jetpack_JSON_API_Sync_Modify_Settings_Endpoint

The WordPress Core Jetpack JSON API Sync Modify Settings Endpoint class.

Defined (1)

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

/json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php  
  1. class Jetpack_JSON_API_Sync_Modify_Settings_Endpoint extends Jetpack_JSON_API_Sync_Endpoint { 
  2. protected function result() { 
  3. $args = $this->input(); 
  4.  
  5. require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-settings.php'; 
  6.  
  7. $sync_settings = Jetpack_Sync_Settings::get_settings(); 
  8.  
  9. foreach ( $args as $key => $value ) { 
  10. if ( $value !== false ) { 
  11. if ( is_numeric( $value ) ) { 
  12. $value = (int) $value; 
  13.  
  14. // special case for sending empty arrays - a string with value 'empty' 
  15. if ( $value === 'empty' ) { 
  16. $value = array(); 
  17.  
  18. $sync_settings[ $key ] = $value; 
  19.  
  20. Jetpack_Sync_Settings::update_settings( $sync_settings ); 
  21.  
  22. // re-fetch so we see what's really being stored 
  23. return Jetpack_Sync_Settings::get_settings();