From 18393ff9d5f859109a66312eb55824bb36de87db Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 25 Jul 2017 14:36:09 -0700 Subject: [PATCH 1/4] Move block server-side logic into same directory as client-side logic --- .../library/latest-posts/index.php | 0 gutenberg.php | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename lib/blocks/latest-posts.php => blocks/library/latest-posts/index.php (100%) diff --git a/lib/blocks/latest-posts.php b/blocks/library/latest-posts/index.php similarity index 100% rename from lib/blocks/latest-posts.php rename to blocks/library/latest-posts/index.php diff --git a/gutenberg.php b/gutenberg.php index 01cd4899f2b40..12ec073afedc9 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -25,6 +25,7 @@ require_once dirname( __FILE__ ) . '/lib/parser.php'; require_once dirname( __FILE__ ) . '/lib/register.php'; - // Register server-side code for individual blocks. - require_once dirname( __FILE__ ) . '/lib/blocks/latest-posts.php'; + foreach ( glob( dirname( __FILE__ ) . '/blocks/library/*/index.php' ) as $block_logic ) { + require_once $block_logic; + } } From bfe31c27e731615c1c3d9c7e8fd00c6fb8b17b74 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 28 Jul 2017 15:27:36 -0700 Subject: [PATCH 2/4] Update location for block php files in build-plugin-zip.sh --- bin/build-plugin-zip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-plugin-zip.sh b/bin/build-plugin-zip.sh index b8497d635aaf9..4fd513c8fc0f6 100755 --- a/bin/build-plugin-zip.sh +++ b/bin/build-plugin-zip.sh @@ -68,7 +68,7 @@ mv gutenberg.tmp.php gutenberg.php zip -r gutenberg.zip \ gutenberg.php \ lib/*.php \ - lib/blocks/*.php \ + blocks/library/*/*.php \ post-content.js \ $vendor_scripts \ blocks/build/*.{js,map} \ From 0a8799af6dbdeb78415236fb2c66daf6546f54e3 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 28 Jul 2017 15:38:33 -0700 Subject: [PATCH 3/4] Add ./blocks/library to phpcs-scanned files --- phpcs.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 335484c779a5b..2378a5902301a 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -15,6 +15,7 @@ gutenberg.php ./lib + ./blocks/library ./lib/parser.php ./phpunit ./bin From b434f253346f4831db3b0d8f83db7825ee4238f9 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 31 Jul 2017 12:36:46 -0700 Subject: [PATCH 4/4] Restore comment for purpose of glob require loop --- gutenberg.php | 1 + 1 file changed, 1 insertion(+) diff --git a/gutenberg.php b/gutenberg.php index 12ec073afedc9..9477b120bca59 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -25,6 +25,7 @@ require_once dirname( __FILE__ ) . '/lib/parser.php'; require_once dirname( __FILE__ ) . '/lib/register.php'; + // Register server-side code for individual blocks. foreach ( glob( dirname( __FILE__ ) . '/blocks/library/*/index.php' ) as $block_logic ) { require_once $block_logic; }