| 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: 1.2.6 |
| 7 |
* Author: LOOS, Inc. |
| 8 |
* Author URI: https://loos-web-studio.com/ |
| 9 |
* License: GPL2 or later |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 |
* Text Domain: loos-hcb |
| 12 |
*/ |
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 14 |
if ( ! function_exists( 'register_block_type' ) ) return; |
| 15 |
|
| 16 |
/** |
| 17 |
* Defined HCB const. |
| 18 |
*/ |
| 19 |
define( 'LOOS_HCB_VERSION', ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? date('mdGis') : '1.2.6'); |
| 20 |
define( 'LOOS_HCB_PATH', plugin_dir_path( __FILE__ ) ); |
| 21 |
define( 'LOOS_HCB_BASENAME', plugin_basename( __FILE__ ) ); |
| 22 |
define( 'LOOS_HCB_URL', plugins_url( '/', __FILE__ ) ); |
| 23 |
|
| 24 |
/** |
| 25 |
* Autoload Class files. |
| 26 |
*/ |
| 27 |
spl_autoload_register( function( $classname ) { |
| 28 |
|
| 29 |
if ( false === strpos( $classname, 'LOOS_HCB' ) ) return; |
| 30 |
$file = LOOS_HCB_PATH .'class/'. mb_strtolower( $classname ) .'.php'; |
| 31 |
if ( file_exists( $file ) ) require $file; |
| 32 |
}); |
| 33 |
|
| 34 |
/** |
| 35 |
* Activation hooks. |
| 36 |
*/ |
| 37 |
register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] ); |
| 38 |
register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] ); |
| 39 |
|
| 40 |
/** |
| 41 |
* Start |
| 42 |
*/ |
| 43 |
add_action( 'plugins_loaded', function() { |
| 44 |
// 翻訳 |
| 45 |
$locale = apply_filters( 'plugin_locale', determine_locale(), 'loos-hcb' ); |
| 46 |
load_textdomain( 'loos-hcb', LOOS_HCB_PATH . 'languages/loos-hcb-' . $locale . '.mo' ); |
| 47 |
|
| 48 |
// 実行 |
| 49 |
new LOOS_HCB(); |
| 50 |
}); |
| 51 |
|