PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.0.1
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.0.1
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / admin / ta-framework / fields / code_editor / code_editor.php

code_editor.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.0.1, at admin/ta-framework/fields/code_editor/code_editor.php

61 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('ABSPATH')) {
2 die;
3 } // Cannot access directly.
4 /**
5 *
6 * Field: code_editor
7 *
8 * @since 1.0.0
9 * @version 1.0.0
10 */
11 if (!class_exists('DRK_LITE_Field_code_editor')) {
12 class DRK_LITE_Field_code_editor extends DRK_LITE_Fields
13 {
14
15 public $version = '6.65.7';
16
17 public function __construct($field, $value = '', $unique = '', $where = '', $parent = '')
18 {
19 parent::__construct($field, $value, $unique, $where, $parent);
20 }
21
22 public function render()
23 {
24
25 $default_settings = array(
26 'tabSize' => 2,
27 'lineNumbers' => true,
28 'theme' => 'default',
29 'mode' => 'htmlmixed',
30 );
31
32 $settings = (!empty($this->field['settings'])) ? $this->field['settings'] : array();
33 $settings = wp_parse_args($settings, $default_settings);
34
35 echo wp_kses_post($this->field_before());
36 echo '<textarea name="' . esc_attr($this->field_name()) . '"' . wp_kses_post($this->field_attributes()) . ' data-editor="' . esc_attr(wp_json_encode($settings)) . '">' . wp_kses_post($this->value) . '</textarea>';
37 echo wp_kses_post($this->field_after());
38 }
39
40 public function enqueue()
41 {
42
43 $page = (!empty($_GET['page'])) ? sanitize_text_field(wp_unslash($_GET['page'])) : '';
44
45 // Do not loads CodeMirror in revslider page.
46 if (in_array($page, array('revslider'))) {
47 return;
48 }
49
50 if (!wp_script_is('drk_lite-codemirror')) {
51 wp_enqueue_script('wp-codemirror-js', 'path_to_wp_codemirror_js_file', array('jquery'), null, true);
52 wp_enqueue_script('loadmode', DRK_LITE_DIR_URL . 'admin/ta-framework/assets/js/loadmode.min.js', array('drk_lite-codemirror'), $this->version, true);
53 }
54
55 if (!wp_style_is('drk_lite-codemirror')) {
56 wp_enqueue_style('wp-codemirror', 'path_to_wp_codemirror_css_file');
57 }
58 }
59 }
60 }
61