-
Notifications
You must be signed in to change notification settings - Fork 6
/
highlighting-code-block.php
53 lines (47 loc) · 1.54 KB
/
highlighting-code-block.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
45
46
47
48
49
50
51
52
53
<?php
/**
* Plugin Name: Highlighting Code Block
* Plugin URI: https://wordpress.org/plugins/highlighting-code-block/
* Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)
* Version: 2.0.1
* Requires at least: 5.6
* Author: LOOS, Inc.
* Author URI: https://loos-web-studio.com/
* License: GPL2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: loos-hcb
* Domain Path: /languages
*/
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Defined HCB const.
*/
define( 'LOOS_HCB_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'LOOS_HCB_URL', plugins_url( '', __FILE__ ) );
// プラグインのバージョン
$file_data = get_file_data( __FILE__, [ 'version' => 'Version' ] );
if ( ! defined( 'LOOS_HCB_VER' ) ) {
define( 'LOOS_HCB_VER', $file_data['version'] );
}
/**
* Autoload Class files.
*/
spl_autoload_register( function( $classname ) {
if ( false === strpos( $classname, 'LOOS_HCB' ) ) return;
$file = LOOS_HCB_PATH . '/class/' . mb_strtolower( $classname ) . '.php';
if ( file_exists( $file ) ) require $file;
});
/**
* Activation hooks.
*/
register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate' ] );
register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall' ] );
/**
* Start
*/
add_action( 'plugins_loaded', function() {
// 翻訳ファイルの読み込み
load_plugin_textdomain( 'loos-hcb', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
// 実行
new LOOS_HCB();
});