PluginProbe
Gutenberg / 5.6.1
Gutenberg v5.6.1
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / gutenberg.php

gutenberg.php in Gutenberg 5.6.1, at gutenberg.php

121 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Gutenberg
4 * Plugin URI: https://github.com/WordPress/gutenberg
5 * Description: Printing since 1440. This is the development plugin for the new block editor in core.
6 * Version: 5.6.1
7 * Author: Gutenberg Team
8 * Text Domain: gutenberg
9 *
10 * @package gutenberg
11 */
12
13 ### BEGIN AUTO-GENERATED DEFINES
14 define( 'GUTENBERG_VERSION', '5.6.1' );
15 define( 'GUTENBERG_GIT_COMMIT', '1e4b861cda99b8e9681cf8cffcfac39b4125389b' );
16 ### END AUTO-GENERATED DEFINES
17
18 gutenberg_pre_init();
19
20 /**
21 * Gutenberg's Menu.
22 *
23 * Adds a new wp-admin menu page for the Gutenberg editor.
24 *
25 * @since 0.1.0
26 */
27 function gutenberg_menu() {
28 global $submenu;
29
30 add_menu_page(
31 'Gutenberg',
32 'Gutenberg',
33 'edit_posts',
34 'gutenberg',
35 '',
36 'dashicons-edit'
37 );
38
39 add_submenu_page(
40 'gutenberg',
41 __( 'Demo', 'gutenberg' ),
42 __( 'Demo', 'gutenberg' ),
43 'edit_posts',
44 'gutenberg'
45 );
46
47 add_submenu_page(
48 'gutenberg',
49 __( 'Widgets (beta)', 'gutenberg' ),
50 __( 'Widgets (beta)', 'gutenberg' ),
51 'edit_theme_options',
52 'gutenberg-widgets',
53 'the_gutenberg_widgets'
54 );
55
56 if ( current_user_can( 'edit_posts' ) ) {
57 $submenu['gutenberg'][] = array(
58 __( 'Support', 'gutenberg' ),
59 'edit_posts',
60 __( 'https://wordpress.org/support/plugin/gutenberg', 'gutenberg' ),
61 );
62
63 $submenu['gutenberg'][] = array(
64 __( 'Documentation', 'gutenberg' ),
65 'edit_posts',
66 'https://wordpress.org/gutenberg/handbook/',
67 );
68 }
69 }
70 add_action( 'admin_menu', 'gutenberg_menu' );
71
72 /**
73 * Display a version notice and deactivate the Gutenberg plugin.
74 *
75 * @since 0.1.0
76 */
77 function gutenberg_wordpress_version_notice() {
78 echo '<div class="error"><p>';
79 /* translators: %s: Minimum required version */
80 printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.0.0' );
81 echo '</p></div>';
82
83 deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
84 }
85
86 /**
87 * Display a build notice.
88 *
89 * @since 0.1.0
90 */
91 function gutenberg_build_files_notice() {
92 echo '<div class="error"><p>';
93 _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/master/CONTRIBUTING.md">contributing</a> file for more information.', 'gutenberg' );
94 echo '</p></div>';
95 }
96
97 /**
98 * Verify that we can initialize the Gutenberg editor , then load it.
99 *
100 * @since 1.5.0
101 */
102 function gutenberg_pre_init() {
103 if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) {
104 add_action( 'admin_notices', 'gutenberg_build_files_notice' );
105 return;
106 }
107
108 // Get unmodified $wp_version.
109 include ABSPATH . WPINC . '/version.php';
110
111 // Strip '-src' from the version string. Messes up version_compare().
112 $version = str_replace( '-src', '', $wp_version );
113
114 if ( version_compare( $version, '5.0.0', '<' ) ) {
115 add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
116 return;
117 }
118
119 require_once dirname( __FILE__ ) . '/lib/load.php';
120 }
121