-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmerpress.php
44 lines (38 loc) · 990 Bytes
/
merpress.php
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
<?php
/**
* Plugin Name: MerPress
* Plugin URI: https://github.com/n3f/merpress
* Description: Merpress lets you create diagrams and visualizations using <a href="https://mermaid-js.github.io/mermaid/">MermaidJS</a>.
* Version: 1.1.7
* Requires at least: 4.6
*
* @package MerPress
*/
declare( strict_types=1 );
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'MERMAID_PLUGIN_VERSION', '1.1.7' );
define( 'MERMAID_JS_VERSION', '11.4.1' );
add_action(
'init',
function () {
$mermaid_config = [
'mermaid_version' => MERMAID_JS_VERSION,
'mermaid_url' => plugin_dir_url( __FILE__ ) . 'public/mermaid.min.js',
];
wp_register_script(
'mermaid',
$mermaid_config['mermaid_url'],
[],
$mermaid_config['mermaid_version'],
false
);
// Register the mermaidjs block.
$result = register_block_type( __DIR__ . '/build' );
if ( false === $result ) {
error_log( 'Failed to register block type' );
}
}
);