WPCOM_JSON_API_Get_CustomCss_Endpoint

Custom Css endpoint.

Defined (1)

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

/json-endpoints/class.wpcom-json-api-get-customcss.php  
  1. class WPCOM_JSON_API_Get_CustomCss_Endpoint extends WPCOM_JSON_API_Endpoint { 
  2. /** 
  3. * API callback. 
  4. */ 
  5. function callback( $path = '', $blog_id = 0 ) { 
  6. // Switch to the given blog. 
  7. $blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) ); 
  8. if ( is_wp_error( $blog_id ) ) { 
  9. return $blog_id; 
  10.  
  11. $args = array( 
  12. 'css' => Jetpack_Custom_CSS::get_css(),  
  13. 'preprocessor' => Jetpack_Custom_CSS::get_preprocessor_key(),  
  14. 'add_to_existing' => ! Jetpack_Custom_CSS::skip_stylesheet(),  
  15. ); 
  16.  
  17. $defaults = array( 
  18. 'css' => '',  
  19. 'preprocessor' => '',  
  20. 'add_to_existing' => true,  
  21. ); 
  22. return wp_parse_args( $args, $defaults );