-
Notifications
You must be signed in to change notification settings - Fork 0
/
epi-block-icon.php
73 lines (59 loc) · 2.12 KB
/
epi-block-icon.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace epiphyt\Block_Icon;
/*
Plugin Name: Block Icon
Description: An enhanced icon block.
Author: Epiphyt
Author URI: https://epiph.yt/en/
Version: 1.0.0-dev
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: epi-block-icon
Domain Path: /languages
Block Icon is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
Block Icon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Block Icon. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
*/
// exit if ABSPATH is not defined
\defined( 'ABSPATH' ) || exit;
\define( 'EPI_BLOCK_ICON_VERSION', '1.0.0-dev' );
if ( ! \defined( 'EPI_BLOCK_ICON_BASE' ) ) {
\define( 'EPI_BLOCK_ICON_BASE', WP_PLUGIN_DIR . '/epi-block-icon/' );
}
if ( ! \defined( 'EPI_BLOCK_ICON_FILE' ) ) {
\define( 'EPI_BLOCK_ICON_FILE', __FILE__ );
}
if ( ! \defined( 'EPI_BLOCK_ICON_URL' ) ) {
\define( 'EPI_BLOCK_ICON_URL', \plugin_dir_url( EPI_BLOCK_ICON_FILE ) );
}
/**
* Autoload all necessary classes.
*
* @param string $class The class name of the autoloaded class
*/
\spl_autoload_register( function( string $class ) {
$namespace = \strtolower( __NAMESPACE__ . '\\' );
$path = \explode( '\\', $class );
$filename = \str_replace( '_', '-', \strtolower( \array_pop( $path ) ) );
$class = \str_replace(
[ $namespace, '\\', '_' ],
[ '', '/', '-' ],
\strtolower( $class )
);
$string_position = \strrpos( $class, $filename );
if ( $string_position !== false ) {
$class = \substr_replace( $class, 'class-' . $filename, $string_position, \strlen( $filename ) );
}
$maybe_file = __DIR__ . '/inc/' . $class . '.php';
if ( \file_exists( $maybe_file ) ) {
require_once $maybe_file;
}
} );
\add_action( 'plugins_loaded', [ Plugin::get_instance(), 'init' ] );