| 1 |
<?php |
| 2 |
/** |
| 3 |
* Initialization and wp-admin integration for the Gutenberg editor plugin. |
| 4 |
* |
| 5 |
* @package gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die( 'Silence is golden.' ); |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Collect information about meta_boxes registered for the current post. |
| 14 |
* |
| 15 |
* Redirects to classic editor if a meta box is incompatible. |
| 16 |
* |
| 17 |
* @since 1.5.0 |
| 18 |
* @deprecated 5.0.0 register_and_do_post_meta_boxes |
| 19 |
*/ |
| 20 |
function gutenberg_collect_meta_box_data() { |
| 21 |
_deprecated_function( __FUNCTION__, '5.0.0', 'register_and_do_post_meta_boxes' ); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Return whether the post can be edited in Gutenberg and by the current user. |
| 26 |
* |
| 27 |
* @since 0.5.0 |
| 28 |
* @deprecated 5.0.0 use_block_editor_for_post |
| 29 |
* |
| 30 |
* @param int|WP_Post $post Post ID or WP_Post object. |
| 31 |
* @return bool Whether the post can be edited with Gutenberg. |
| 32 |
*/ |
| 33 |
function gutenberg_can_edit_post( $post ) { |
| 34 |
_deprecated_function( __FUNCTION__, '5.0.0', 'use_block_editor_for_post' ); |
| 35 |
|
| 36 |
return use_block_editor_for_post( $post ); |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Return whether the post type can be edited in Gutenberg. |
| 42 |
* |
| 43 |
* Gutenberg depends on the REST API, and if the post type is not shown in the |
| 44 |
* REST API, then the post cannot be edited in Gutenberg. |
| 45 |
* |
| 46 |
* @since 1.5.2 |
| 47 |
* @deprecated 5.0.0 use_block_editor_for_post_type |
| 48 |
* |
| 49 |
* @param string $post_type The post type. |
| 50 |
* @return bool Whether the post type can be edited with Gutenberg. |
| 51 |
*/ |
| 52 |
function gutenberg_can_edit_post_type( $post_type ) { |
| 53 |
_deprecated_function( __FUNCTION__, '5.0.0', 'use_block_editor_for_post_type' ); |
| 54 |
|
| 55 |
return use_block_editor_for_post_type( $post_type ); |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Determine whether a post has blocks. This test optimizes for performance |
| 60 |
* rather than strict accuracy, detecting the pattern of a block but not |
| 61 |
* validating its structure. For strict accuracy, you should use the block |
| 62 |
* parser on post content. |
| 63 |
* |
| 64 |
* @see gutenberg_parse_blocks() |
| 65 |
* |
| 66 |
* @since 0.5.0 |
| 67 |
* @deprecated 3.6.0 Use has_blocks() |
| 68 |
* |
| 69 |
* @param object $post Post. |
| 70 |
* @return bool Whether the post has blocks. |
| 71 |
*/ |
| 72 |
function gutenberg_post_has_blocks( $post ) { |
| 73 |
_deprecated_function( __FUNCTION__, '3.6.0', 'has_blocks()' ); |
| 74 |
return has_blocks( $post ); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Determine whether a content string contains blocks. This test optimizes for |
| 79 |
* performance rather than strict accuracy, detecting the pattern of a block |
| 80 |
* but not validating its structure. For strict accuracy, you should use the |
| 81 |
* block parser on post content. |
| 82 |
* |
| 83 |
* @see gutenberg_parse_blocks() |
| 84 |
* |
| 85 |
* @since 1.6.0 |
| 86 |
* @deprecated 3.6.0 Use has_blocks() |
| 87 |
* |
| 88 |
* @param string $content Content to test. |
| 89 |
* @return bool Whether the content contains blocks. |
| 90 |
*/ |
| 91 |
function gutenberg_content_has_blocks( $content ) { |
| 92 |
_deprecated_function( __FUNCTION__, '3.6.0', 'has_blocks()' ); |
| 93 |
return has_blocks( $content ); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Returns the current version of the block format that the content string is using. |
| 98 |
* |
| 99 |
* If the string doesn't contain blocks, it returns 0. |
| 100 |
* |
| 101 |
* @since 2.8.0 |
| 102 |
* @see gutenberg_content_has_blocks() |
| 103 |
* @deprecated 5.0.0 block_version |
| 104 |
* |
| 105 |
* @param string $content Content to test. |
| 106 |
* @return int The block format version. |
| 107 |
*/ |
| 108 |
function gutenberg_content_block_version( $content ) { |
| 109 |
_deprecated_function( __FUNCTION__, '5.0.0', 'block_version' ); |
| 110 |
|
| 111 |
return block_version( $content ); |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* Adds a "Gutenberg" post state for post tables, if the post contains blocks. |
| 116 |
* |
| 117 |
* @deprecated 5.0.0 |
| 118 |
* |
| 119 |
* @param array $post_states An array of post display states. |
| 120 |
* @return array A filtered array of post display states. |
| 121 |
*/ |
| 122 |
function gutenberg_add_gutenberg_post_state( $post_states ) { |
| 123 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 124 |
|
| 125 |
return $post_states; |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Registers custom post types required by the Gutenberg editor. |
| 130 |
* |
| 131 |
* @since 0.10.0 |
| 132 |
* @deprecated 5.0.0 |
| 133 |
*/ |
| 134 |
function gutenberg_register_post_types() { |
| 135 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 136 |
} |
| 137 |
|
| 138 |
/** |
| 139 |
* Apply the correct labels for Reusable Blocks in the bulk action updated messages. |
| 140 |
* |
| 141 |
* @since 4.3.0 |
| 142 |
* @deprecated 5.0.0 |
| 143 |
* |
| 144 |
* @param array $messages Arrays of messages, each keyed by the corresponding post type. |
| 145 |
* |
| 146 |
* @return array |
| 147 |
*/ |
| 148 |
function gutenberg_bulk_post_updated_messages( $messages ) { |
| 149 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 150 |
|
| 151 |
return $messages; |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Injects a hidden input in the edit form to propagate the information that classic editor is selected. |
| 156 |
* |
| 157 |
* @since 1.5.2 |
| 158 |
* @deprecated 5.0.0 |
| 159 |
*/ |
| 160 |
function gutenberg_remember_classic_editor_when_saving_posts() { |
| 161 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 162 |
} |
| 163 |
|
| 164 |
/** |
| 165 |
* Appends a query argument to the redirect url to make sure it gets redirected to the classic editor. |
| 166 |
* |
| 167 |
* @since 1.5.2 |
| 168 |
* @deprecated 5.0.0 |
| 169 |
* |
| 170 |
* @param string $url Redirect url. |
| 171 |
* @return string Redirect url. |
| 172 |
*/ |
| 173 |
function gutenberg_redirect_to_classic_editor_when_saving_posts( $url ) { |
| 174 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 175 |
|
| 176 |
return $url; |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Appends a query argument to the edit url to make sure it is redirected to |
| 181 |
* the editor from which the user navigated. |
| 182 |
* |
| 183 |
* @since 1.5.2 |
| 184 |
* @deprecated 5.0.0 |
| 185 |
* |
| 186 |
* @param string $url Edit url. |
| 187 |
* @return string Edit url. |
| 188 |
*/ |
| 189 |
function gutenberg_revisions_link_to_editor( $url ) { |
| 190 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 191 |
|
| 192 |
return $url; |
| 193 |
} |
| 194 |
|
| 195 |
/** |
| 196 |
* Modifies revisions data to preserve Gutenberg argument used in determining |
| 197 |
* where to redirect user returning to editor. |
| 198 |
* |
| 199 |
* @since 1.9.0 |
| 200 |
* @deprecated 5.0.0 |
| 201 |
* |
| 202 |
* @param array $revisions_data The bootstrapped data for the revisions screen. |
| 203 |
* @return array Modified bootstrapped data for the revisions screen. |
| 204 |
*/ |
| 205 |
function gutenberg_revisions_restore( $revisions_data ) { |
| 206 |
_deprecated_function( __FUNCTION__, '5.0.0' ); |
| 207 |
|
| 208 |
return $revisions_data; |
| 209 |
} |
| 210 |
|