PluginProbe
Highlighting Code Block / 1.2.1
Highlighting Code Block v1.2.1
2.2.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.4.0 All 41 releases
highlighting-code-block / highlighting-code-block.php

highlighting-code-block.php in Highlighting Code Block 1.2.1, at highlighting-code-block.php

94 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.1
7 * Author: LOOS WEB STUDIO
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
15 /**
16 * Be disabled ~PHP5.6.
17 */
18 $phpver = phpversion();
19 if ( (double) $phpver < 5.6 ) {
20 add_action( 'admin_notices', function() { ?>
21 <div class="notice notice-error is-dismissible">
22 <p>
23 <b>[ Highlighting Code Block ]</b><br>
24 This Plugin is available in PHP since version 5.6 ! <br> (Your PHP is ver. <?php echo phpversion(); ?> )
25 </p>
26 </div> <?php
27 } );
28 return;
29 }
30
31 /**
32 * 翻訳用のテキストドメインを定義
33 */
34 if ( ! defined( 'LOOS_HCB_DOMAIN' ) ) {
35 define( 'LOOS_HCB_DOMAIN', 'loos-hcb' );
36 }
37
38 /**
39 * Defined HCB const.
40 */
41 if ( ! defined( 'LOOS_HCB_VERSION' ) ) {
42 define( 'LOOS_HCB_VERSION', '1.2.1' );
43 // define( 'LOOS_HCB_VERSION', date('Ymdgis') ); //開発用
44 }
45 if ( ! defined( 'LOOS_HCB_FILE' ) ) {
46 define( 'LOOS_HCB_FILE', __FILE__ );
47 }
48 if ( ! defined( 'LOOS_HCB_PATH' ) ) {
49 define( 'LOOS_HCB_PATH', plugin_dir_path( __FILE__ ) );
50 }
51 if ( ! defined( 'LOOS_HCB_BASENAME' ) ) {
52 define( 'LOOS_HCB_BASENAME', plugin_basename( LOOS_HCB_FILE ) );
53 }
54 if ( ! defined( 'LOOS_HCB_URL' ) ) {
55 define( 'LOOS_HCB_URL', plugins_url( '/', __FILE__ ) );
56 }
57
58
59 /**
60 * 翻訳ファイルを登録
61 */
62 $languages_path = basename( LOOS_HCB_PATH ) .'/languages';
63 $languages_path = str_replace('trunk/', 'highlighting-code-block/', $languages_path);
64 load_plugin_textdomain( LOOS_HCB_DOMAIN, false, $languages_path );
65
66
67 /**
68 * Autoload Class files.
69 */
70 spl_autoload_register( function( $classname ) {
71
72 // LOOS_HCB の付いたクラスだけを対象にする。
73 if ( strpos( $classname, 'LOOS_HCB' ) === false ) return;
74
75 $file = LOOS_HCB_PATH .'class/'. mb_strtolower( $classname ) .'.php';
76 if ( file_exists( $file ) ) {
77 require $file;
78 }
79 });
80
81
82 /**
83 * Activation hooks.
84 */
85 register_activation_hook( LOOS_HCB_FILE, ['LOOS_HCB_Activation', 'plugin_activate'] );
86 register_deactivation_hook( LOOS_HCB_FILE, ['LOOS_HCB_Activation', 'plugin_deactivate'] );
87 register_uninstall_hook( LOOS_HCB_FILE, ['LOOS_HCB_Activation', 'plugin_uninstall'] );
88
89
90 /**
91 * Init
92 */
93 new LOOS_HCB();
94