PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / WordPress / Settings / Options / CodeEditor.php

CodeEditor.php in Depicter — Popup & Slider Builder 1.9.2, at app/src/WordPress/Settings/Options/CodeEditor.php

35 lines 959 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Depicter\WordPress\Settings\Options;
4
5 use Depicter\WordPress\Settings\Options\OptionAbstract;
6
7 class CodeEditor extends OptionAbstract
8 {
9 public $view = 'code-editor';
10
11 public function __construct($section, $args = [])
12 {
13 add_action('admin_enqueue_scripts', [$this, 'enqueue']);
14
15 parent::__construct($section, $args);
16 }
17
18 public function enqueue()
19 {
20 wp_enqueue_script('wp-theme-plugin-editor');
21 wp_enqueue_style('wp-codemirror');
22
23 $settings_name = str_replace('-', '_', $this->get_id_attribute());
24
25 wp_localize_script('jquery', $settings_name, wp_enqueue_code_editor(['type' => $this->get_arg('editor_type', 'text/html')]));
26
27 wp_add_inline_script('wp-theme-plugin-editor', 'jQuery(function($){ wp.codeEditor.initialize($("#'.$this->get_id_attribute().'"), '.$settings_name.'); });');
28 }
29
30 public function sanitize($value)
31 {
32 return $value;
33 }
34 }
35