-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
96 lines (80 loc) · 2.57 KB
/
index.php
File metadata and controls
96 lines (80 loc) · 2.57 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
<?php
/**
* Plugin Name: WP Code Tabs
* Version: 1.0.0
* Author: Casey Yates
* Description: Display related code segments with a tabbed interface
*/
define('CYCT_DIR', plugin_dir_path(__FILE__));
define('CYCT_URL', plugin_dir_url(__FILE__));
function cyct_register_dev_blocks()
{
$editor_reqs = include_once('build/editor.asset.php');
$ui_reqs = include_once('build/index.asset.php');
$ui_reqs['dependencies'][] = 'cyct-syntax-hightlighter-php';
wp_register_script(
'cyct-syntax-hightlighter',
'https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shCore.min.js',
[],
''
);
wp_register_script(
'cyct-syntax-hightlighter-php',
'https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushPhp.min.js',
['cyct-syntax-hightlighter'],
''
);
wp_register_script(
'cyct-syntax-hightlighter-js',
'https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushJScript.min.js',
[],
''
);
// Register JavasScript File build/index.js
wp_register_script(
'cyct-blocks-editor-scripts',
plugins_url('build/editor.js', __FILE__),
$editor_reqs['dependencies'],
filemtime(CYCT_DIR . 'build/editor.js')
);
wp_register_script(
'cyct-blocks-frontend-scripts',
plugins_url('build/index.js', __FILE__),
$ui_reqs['dependencies'],
filemtime(CYCT_DIR . 'build/index.js'),
);
// Register editor style src/editor.css
wp_register_style(
'cyct-blocks-editor-style',
plugins_url('build/editor.css', __FILE__),
array('wp-edit-blocks'),
filemtime(CYCT_DIR . 'build/editor.css')
);
wp_register_style(
'cyct-syntaxhighlighter-theme-style',
'https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/styles/shCoreDefault.min.css',
array(),
''
);
wp_register_style(
'cyct-syntaxhighlighter-style',
'https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/styles/shCore.min.css',
array('cyct-syntaxhighlighter-theme-style'),
''
);
// Register front end block style src/index.css
wp_register_style(
'cyct-blocks-frontend-style',
plugins_url('build/index.css', __FILE__),
array('cyct-syntaxhighlighter-style'),
filemtime(CYCT_DIR . 'build/index.css')
);
// Register your block
register_block_type('cyct/code-tabs', array(
'editor_script' => 'cyct-blocks-editor-scripts',
'editor_style' => 'cyct-blocks-editor-style',
'script' => 'cyct-blocks-frontend-scripts',
'style' => 'cyct-blocks-frontend-style',
));
}
add_action('init', 'cyct_register_dev_blocks');