forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gutenberg.php
107 lines (93 loc) · 3.54 KB
/
gutenberg.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Plugin Name: Gutenberg - Nightly
* Plugin URI: https://github.com/bph/gutenberg
* Description: Zip from trunk (the default branch) of WordPress Gutenberg GitHub repo: Gutenberg This is the development plugin for the new block editor in core. If you have trouble seeing updates, go to <em>Git Updater > Settings</em> and use the button <em>Refresh Cache</em>. Ping @bph on WPSlack for questions. Or <a href="https://github.com/bph/gutenberg/discussions/new">post on the Discussion board</a>.
* Requires at least: 6.5
* Requires PHP: 7.4
* Version: 20.1.20241221
* Author: Gutenberg Team and Birgit Pauli-Haack (Gutenberg Times)
* Text Domain: gutenberg
* GitHub Plugin URI: bph/gutenberg
* Primary Branch: trunk
* Release Asset: true
*
* @package gutenberg
*/
// GitHub Updater filters.
add_filter(
'gu_override_dot_org',
function ( $overrides ) {
return array_merge(
$overrides,
array( 'gutenberg/gutenberg.php' )
);
}
);
add_filter(
'gu_release_asset_rollback',
function ( $rollback, $file ) {
if ( $file === plugin_basename( __FILE__ ) ) {
return [ 'gutenberg-nightly' ];
}
},
10,
2
);
add_filter( 'gu_no_release_asset_branches', '__return_true' );
// End GitHub Updater filters.
### BEGIN AUTO-GENERATED DEFINES
define( 'GUTENBERG_VERSION', '9.6.2.20201230' );
define( 'GUTENBERG_GIT_COMMIT', 'd516050927e6f7d8c4d1917f37c46bab00daacec' );
### END AUTO-GENERATED DEFINES
defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.6' );
gutenberg_pre_init();
/**
* Display a version notice and deactivate the Gutenberg plugin.
*
* @since 0.1.0
*/
function gutenberg_wordpress_version_notice() {
echo '<div class="error"><p>';
/* translators: %s: Minimum required version */
printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), GUTENBERG_MINIMUM_WP_VERSION );
echo '</p></div>';
deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
}
/**
* Display a build notice.
*
* @since 0.1.0
*/
function gutenberg_build_files_notice() {
echo '<div class="error"><p>';
_e( 'Gutenberg development mode requires files to be built. Run <code>npm install</code> to install dependencies, <code>npm run build</code> to build the files or <code>npm run dev</code> to build the files and watch for changes. Read the <a href="https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/getting-started-with-code-contribution.md">contributing</a> file for more information.', 'gutenberg' );
echo '</p></div>';
}
/**
* Verify that we can initialize the Gutenberg editor , then load it.
*
* @since 1.5.0
*
* @global string $wp_version The WordPress version string.
*
*/
function gutenberg_pre_init() {
global $wp_version;
if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( __DIR__ . '/build/blocks' ) ) {
add_action( 'admin_notices', 'gutenberg_build_files_notice' );
return;
}
// Get unmodified $wp_version.
include ABSPATH . WPINC . '/version.php';
// Strip '-src' from the version string. Messes up version_compare().
$version = str_replace( '-src', '', $wp_version );
// Compare against major release versions (X.Y) rather than minor (X.Y.Z)
// unless a minor release is the actual minimum requirement. WordPress reports
// X.Y for its major releases.
if ( version_compare( $version, GUTENBERG_MINIMUM_WP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
return;
}
require_once __DIR__ . '/lib/load.php';
}