-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPlugin.php
More file actions
108 lines (101 loc) · 2.36 KB
/
Plugin.php
File metadata and controls
108 lines (101 loc) · 2.36 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* Main plugin file.
*
* @package ShinyCode
* @since 0.1.0
* @copyright Copyright (c) 2018 Cedaro, LLC
* @license GPL-2.0-or-later
*/
declare ( strict_types = 1 );
namespace Cedaro\WP\BlockType\Code;
use Cedaro\WP\Plugin\AbstractPlugin;
/**
* Main plugin class.
*
* @package ShinyCode
* @since 0.1.0
*/
class Plugin extends AbstractPlugin {
/**
* Retrieve code language settings.
*
* @since 0.1.0
*
* @return array
*/
public function get_languages(): array {
$languages = [
'css' => [
'name' => esc_html__( 'CSS', 'shiny-code' ),
'codemirror' => [
'autoCloseBrackets' => true,
'matchBrackets' => true,
],
],
'html' => [
'name' => esc_html__( 'HTML', 'shiny-code' ),
'codemirror' => [
'autoCloseBrackets' => true,
'autoCloseTags' => true,
'matchTags' => [
'bothTags' => true,
],
'mode' => 'htmlmixed',
],
],
'javascript' => [
'name' => esc_html__( 'JavaScript', 'shiny-code' ),
'codemirror' => [
'autoCloseBrackets' => true,
'matchBrackets' => true,
],
],
'json' => [
'name' => esc_html__( 'JSON', 'shiny-code' ),
'codemirror' => [
'autoCloseBrackets' => true,
'matchBrackets' => true,
'mode' => [
'name' => 'javascript',
'json' => true,
],
],
],
'php' => [
'name' => esc_html__( 'PHP', 'shiny-code' ),
'codemirror' => [
'autoCloseBrackets' => true,
'autoCloseTags' => true,
'matchBrackets' => true,
'matchTags' => [
'bothTags' => true,
],
],
],
];
return apply_filters( 'shiny_code_languages', $languages );
}
/**
* Retrieve syntax highlighting theme settings.
*
* @since 0.1.0
*
* @return array
*/
public function get_themes(): array {
$themes = [
'atom-one-dark' => [
'name' => esc_html__( 'Atom One Dark', 'shiny-code' ),
'codemirror' => '',
'prism' => $this->get_url( 'build/css/themes/atom-one-dark/prism.css' ),
],
'atom-one-light' => [
'name' => esc_html__( 'Atom One Light', 'shiny-code' ),
'codemirror' => '',
'prism' => $this->get_url( 'build/css/themes/atom-one-light/prism.css' ),
],
];
return apply_filters( 'shiny_code_themes', $themes );
}
}