| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Highlighting Code Block |
| 4 |
* Plugin URI: https://wordpress.org/plugins/highlighting-code-block/ |
| 5 |
* Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor) |
| 6 |
* Version: 2.2.1 |
| 7 |
* Requires at least: 5.6 |
| 8 |
* Requires PHP: 5.6 |
| 9 |
* Author: LOOS Inc. |
| 10 |
* Author URI: https://loos.co.jp/ |
| 11 |
* License: GPLv2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: highlighting-code-block |
| 14 |
* Domain Path: /languages |
| 15 |
*/ |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 18 |
|
| 19 |
/** |
| 20 |
* Defined HCB const. |
| 21 |
*/ |
| 22 |
define( 'LOOS_HCB_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 23 |
define( 'LOOS_HCB_URL', plugins_url( '', __FILE__ ) ); |
| 24 |
|
| 25 |
// プラグインのバージョン |
| 26 |
$file_data = get_file_data( __FILE__, [ 'version' => 'Version' ] ); |
| 27 |
if ( ! defined( 'LOOS_HCB_VER' ) ) { |
| 28 |
define( 'LOOS_HCB_VER', $file_data['version'] ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Autoload Class files. |
| 33 |
*/ |
| 34 |
spl_autoload_register( function( $classname ) { |
| 35 |
if ( false === strpos( $classname, 'LOOS_HCB' ) ) return; |
| 36 |
$file = LOOS_HCB_PATH . '/class/' . mb_strtolower( $classname ) . '.php'; |
| 37 |
if ( file_exists( $file ) ) require $file; |
| 38 |
}); |
| 39 |
|
| 40 |
/** |
| 41 |
* Activation hooks. |
| 42 |
*/ |
| 43 |
register_activation_hook( __FILE__, [ 'LOOS_HCB_Activation', 'plugin_activate' ] ); |
| 44 |
register_uninstall_hook( __FILE__, [ 'LOOS_HCB_Activation', 'plugin_uninstall' ] ); |
| 45 |
|
| 46 |
/** |
| 47 |
* 翻訳ファイルの読み込み |
| 48 |
*/ |
| 49 |
add_action( 'init', function() { |
| 50 |
load_plugin_textdomain( 'highlighting-code-block' ); |
| 51 |
}, 0); |
| 52 |
|
| 53 |
/** |
| 54 |
* Start |
| 55 |
*/ |
| 56 |
add_action( 'plugins_loaded', function() { |
| 57 |
new LOOS_HCB(); |
| 58 |
}); |
| 59 |
|