Automattic /
jetpack
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Custom Css endpoint |
||
| 4 | * |
||
| 5 | * https://public-api.wordpress.com/rest/v1.1/sites/$site/customcss/ |
||
| 6 | */ |
||
| 7 | |||
| 8 | class WPCOM_JSON_API_Get_CustomCss_Endpoint extends WPCOM_JSON_API_Endpoint { |
||
| 9 | /** |
||
| 10 | * API callback. |
||
| 11 | */ |
||
| 12 | function callback( $path = '', $blog_id = 0 ) { |
||
| 13 | // Switch to the given blog. |
||
| 14 | $blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) ); |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 15 | if ( is_wp_error( $blog_id ) ) { |
||
| 16 | return $blog_id; |
||
| 17 | } |
||
| 18 | |||
| 19 | $args = array( |
||
| 20 | 'css' => Jetpack_Custom_CSS::get_css(), |
||
| 21 | 'preprocessor' => Jetpack_Custom_CSS::get_preprocessor_key(), |
||
| 22 | 'add_to_existing' => ! Jetpack_Custom_CSS::skip_stylesheet(), |
||
| 23 | ); |
||
| 24 | |||
| 25 | $defaults = array( |
||
| 26 | 'css' => '', |
||
| 27 | 'preprocessor' => '', |
||
| 28 | 'add_to_existing' => true, |
||
| 29 | ); |
||
| 30 | return wp_parse_args( $args, $defaults ); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | |||
| 35 |