# quickwebp/3.2.6/admin/components/code-editor.php

QuickWebP – WebP &amp; AVIF Image Optimizer, Compression &amp; SEO for WordPress, version 3.2.6. 35 lines.

- Page: https://pluginprobe.com/plugins/quickwebp/3.2.6/code/admin/components/code-editor.php
- Raw: https://pluginprobe.com/plugins/quickwebp/3.2.6/raw/admin/components/code-editor.php
- Modified: 2025-09-16T13:46:58+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/quickwebp/3.2.6/code/admin/components/code-editor.php#L10-L20`.

```php
<?php
/**
 * Code editor component like theme editor for the settings page
 */

$key_option = sanitize_key( $data['name'] );

if( isset( $key_option, $_POST[ $key_option ] ) ) {
    update_option( $key_option, $_POST[ $key_option ] );
}
?>
<textarea 
    name="<?php echo esc_attr( $key_option ?? '' ); ?>"
    id="<?php echo esc_attr( $key_option ?? '' ); ?>"
><?php echo esc_textarea( stripslashes(  get_option( $key_option ?? '' ) ) ); ?></textarea>

<style>
    <?php echo '.' . esc_attr( $key_option ) . '-container'; ?> > .CodeMirror {
        height: <?php echo esc_attr( $data['height'] ?? "auto" ); ?>;
    }
</style>

<?php
$settings = wp_enqueue_code_editor( array( 'type' => $data['mime_type'] ?? 'text/html' ) );

if ( $settings ) {
    wp_add_inline_script(
        'code-editor',
        sprintf(
            'jQuery( function() { wp.codeEditor.initialize( "'. $key_option .'", %s ); } );',
            wp_json_encode( $settings )
        )
    );
}

```
