forked from HardeepAsrani/advanced-css-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntax-highlighter.php
More file actions
executable file
·33 lines (30 loc) · 1.49 KB
/
syntax-highlighter.php
File metadata and controls
executable file
·33 lines (30 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
// Class to create a custom layout control for CSS editors
class CSS_Highlighter_Custom_Control extends WP_Customize_Control {
// Render the content on the theme customizer page
public function enqueue() {
wp_enqueue_script( 'advanced_css_editor_codemirror_js', plugin_dir_url( __FILE__ ) . 'js/codemirror.js', array( 'jquery'), '', true );
wp_enqueue_script( 'advanced_css_editor_css_js', plugin_dir_url( __FILE__ ) . 'js/css.js', array( 'advanced_css_editor_codemirror_js'), '', true );
wp_enqueue_script( 'advanced_css_editor_custom_js', plugin_dir_url( __FILE__ ) . 'js/code-control.js', array( 'advanced_css_editor_codemirror_js'), '', true );
wp_enqueue_style( 'advanced_css_editor_codemirror_css', plugin_dir_url( __FILE__ ) . 'css/codemirror.css', NULL, NULL, 'all' );
}
protected function render() {?>
<li class="advanced-code-control" id="render_<?php echo $this->id; ?>">
<?php $this->render_content(); ?>
</li>
<?php }
public function render_content() {
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif; ?>
<?php if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo $this->description; ?></span>
<?php endif; ?>
<textarea id="<?php echo $this->id; ?>" rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
</label>
<?php
}
}
?>