From 2d3f7348477b5d721ff5cf5c04c886af2f61129c Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 13 Dec 2018 09:44:23 +0000 Subject: [PATCH] Blocks: Introduce `WP_Block_Type` and `WP_Block_Type_Registry` classes. These are the foundational classes allowing blocks to be registered and used throughout WordPress. This commit also includes the `has_block()` and `has_blocks()` functions, which are required for unit testing these classes. Merges [43742] from the 5.0 branch to trunk. Props adamsilverstein, danielbachhuber, desrosj. Fixes #45097. See #45109. Built from https://develop.svn.wordpress.org/trunk@44108 git-svn-id: http://core.svn.wordpress.org/trunk@43938 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 61 ++++++ wp-includes/class-wp-block-type-registry.php | 173 ++++++++++++++++ wp-includes/class-wp-block-type.php | 205 +++++++++++++++++++ wp-includes/version.php | 2 +- wp-settings.php | 3 + 5 files changed, 443 insertions(+), 1 deletion(-) create mode 100644 wp-includes/blocks.php create mode 100644 wp-includes/class-wp-block-type-registry.php create mode 100644 wp-includes/class-wp-block-type.php diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php new file mode 100644 index 0000000000..b04696d591 --- /dev/null +++ b/wp-includes/blocks.php @@ -0,0 +1,61 @@ +post_content; + } + } + + return false !== strpos( (string) $post, '