-
Notifications
You must be signed in to change notification settings - Fork 4
/
block-catalog.php
executable file
·52 lines (44 loc) · 1.89 KB
/
block-catalog.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
<?php
/**
* Plugin Name: Block Catalog
* Description: Keep track of which Gutenberg Blocks are used across your site.
* Version: 1.6.1
* Requires at least: 6.5
* Requires PHP: 7.4
* Author: 10up
* Author URI: https://10up.com
* License: GPL-2.0-or-later
* License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
* Text Domain: block-catalog
* Domain Path: /languages
*
* @package BlockCatalog
*/
// Useful global constants.
define( 'BLOCK_CATALOG_PLUGIN_VERSION', '1.6.1' );
define( 'BLOCK_CATALOG_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'BLOCK_CATALOG_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'BLOCK_CATALOG_PLUGIN_INC', BLOCK_CATALOG_PLUGIN_PATH . 'includes/' );
define( 'BLOCK_CATALOG_PLUGIN_FILE', plugin_basename( __FILE__ ) );
define( 'BLOCK_CATALOG_TAXONOMY', 'block-catalog' );
$is_local_env = in_array( wp_get_environment_type(), [ 'local', 'development' ], true );
$is_local_url = strpos( home_url(), '.test' ) || strpos( home_url(), '.local' );
$is_local = $is_local_env || $is_local_url;
if ( $is_local && file_exists( __DIR__ . '/dist/fast-refresh.php' ) ) {
require_once __DIR__ . '/dist/fast-refresh.php';
TenUpToolkit\set_dist_url_path( basename( __DIR__ ), TENUP_THEME_DIST_URL, TENUP_THEME_DIST_PATH );
}
// Require Composer autoloader if it exists.
if ( file_exists( BLOCK_CATALOG_PLUGIN_PATH . 'vendor/autoload.php' ) ) {
require_once BLOCK_CATALOG_PLUGIN_PATH . 'vendor/autoload.php';
} else {
require_once BLOCK_CATALOG_PLUGIN_PATH . 'autoload.php';
}
// Include files.
require_once BLOCK_CATALOG_PLUGIN_INC . '/utility.php';
require_once BLOCK_CATALOG_PLUGIN_INC . '/core.php';
// Activation/Deactivation.
register_activation_hook( __FILE__, '\BlockCatalog\activate' );
register_deactivation_hook( __FILE__, '\BlockCatalog\deactivate' );
// Bootstrap.
BlockCatalog\setup();