# code-block-pro/1.27.6/php/routes.php

Code Block Pro – Beautiful Syntax Highlighting, version 1.27.6. 34 lines.

- Page: https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/php/routes.php
- Raw: https://pluginprobe.com/plugins/code-block-pro/1.27.6/raw/php/routes.php
- Modified: 2023-10-12T00:06:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-block-pro/1.27.6/code/php/routes.php#L10-L20`.

```php
<?php

defined('ABSPATH') or die;

add_action('rest_api_init', function () {
    CBPRouter::post('/settings', function ($payload) {
        if (isset($payload['code_block_pro_settings'])) {
            update_option('code_block_pro_settings', $payload['code_block_pro_settings']);
        }
        if (isset($payload['code_block_pro_settings_2'])) {
            update_option('code_block_pro_settings_2', $payload['code_block_pro_settings_2']);
        }
        return new WP_REST_Response(
            [
                'code_block_pro_settings' => get_option('code_block_pro_settings'),
                'code_block_pro_settings_2' => get_option('code_block_pro_settings_2'),
            ]
        );
    });

    CBPRouter::get('/settings', function () {
        return new WP_REST_Response(
            [
                'code_block_pro_settings' => get_option('code_block_pro_settings'),
                'code_block_pro_settings_2' => get_option('code_block_pro_settings_2'),
            ]
        );
    });

    CBPRouter::get('/can-save-html', function () {
        return new WP_REST_Response(current_user_can('unfiltered_html'));
    });
});

```
