-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
61 lines (52 loc) · 1.89 KB
/
Copy pathfunctions.php
File metadata and controls
61 lines (52 loc) · 1.89 KB
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
<?php
/**
* Blockwright functions and definitions
*
* @package Blockwright
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'BLOCKWRIGHT_VERSION' ) ) {
define( 'BLOCKWRIGHT_VERSION', '1.1.2' );
}
// Theme path/URI constants (safe for parent/child).
if ( ! defined( 'BLOCKWRIGHT_THEME_DIR' ) ) {
define( 'BLOCKWRIGHT_THEME_DIR', get_template_directory() );
}
if ( ! defined( 'BLOCKWRIGHT_THEME_URI' ) ) {
define( 'BLOCKWRIGHT_THEME_URI', get_template_directory_uri() );
}
// Ensure core block styles are available (enables block gap, etc.).
add_theme_support( 'wp-block-styles' );
/**
* Load environment first so later includes can use its vars.
*/
$blockwright_env_loader = __DIR__ . '/inc/load-env.php';
if ( file_exists( $blockwright_env_loader ) ) {
require_once $blockwright_env_loader;
}
/**
* Load inc/*.php. Dev tooling (inc/dev*.php) loads only in a development
* environment - it must never run on a distributed/production site (e.g.
* inc/dev-pages.php creates pages on theme activation).
*/
$blockwright_is_dev = function_exists( 'wp_get_environment_type' )
&& in_array( wp_get_environment_type(), array( 'local', 'development' ), true );
foreach ( glob( __DIR__ . '/inc/*.php' ) as $blockwright_file ) {
$blockwright_basename = basename( $blockwright_file );
if ( 'load-env.php' === $blockwright_basename ) {
continue; // already loaded above.
}
if ( 'dev-cli.php' === $blockwright_basename ) {
continue; // loaded separately, under WP-CLI in dev only.
}
if ( 0 === strpos( $blockwright_basename, 'dev' ) && ! $blockwright_is_dev ) {
continue; // dev-only tooling.
}
require_once $blockwright_file;
}
$blockwright_dev_cli = get_template_directory() . '/inc/dev-cli.php';
if ( $blockwright_is_dev && defined( 'WP_CLI' ) && WP_CLI && file_exists( $blockwright_dev_cli ) ) {
require_once $blockwright_dev_cli; // stripped from distributed builds; guard so it never fatals.
}