From 733b78c5b8d3f89508283a2e59561ae8850ff39d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Wed, 12 Aug 2020 15:04:11 -0500 Subject: [PATCH 01/57] Don't show the Genesis Pro upgrade page on GCB Pro The user would already have GCB Pro, so no need for an upsell. --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++++- php/Admin/Admin.php | 13 ++----------- php/Admin/Upgrade.php | 10 ++++++++++ tests/php/Unit/Admin/TestUpgrade.php | 14 +++++++++++++- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7770d8d87..1877a57a0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,10 @@ about: Report a problem ## Expected behavior ## Actual behavior - + + +## JS Console + ## Additional information @@ -30,6 +33,7 @@ about: Report a problem - WordPress version: - Genesis Custom Blocks version: - Gutenberg plugin version (if active): + - Other block-related plugins (if active): - OS: - Browser: - Device: diff --git a/php/Admin/Admin.php b/php/Admin/Admin.php index d5aa8f9e3..2bfdfca4b 100644 --- a/php/Admin/Admin.php +++ b/php/Admin/Admin.php @@ -54,17 +54,8 @@ public function init() { $this->onboarding = new Onboarding(); genesis_custom_blocks()->register_component( $this->onboarding ); - /** - * Whether to show the pro nag. - * - * @param bool Whether this should show the nag. - */ - $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); - - if ( $show_pro_nag ) { - $this->upgrade = new Upgrade(); - genesis_custom_blocks()->register_component( $this->upgrade ); - } + $this->upgrade = new Upgrade(); + genesis_custom_blocks()->register_component( $this->upgrade ); if ( defined( 'WP_LOAD_IMPORTERS' ) && WP_LOAD_IMPORTERS ) { $this->import = new Import(); diff --git a/php/Admin/Upgrade.php b/php/Admin/Upgrade.php index 8ee0d5c34..37117cf73 100644 --- a/php/Admin/Upgrade.php +++ b/php/Admin/Upgrade.php @@ -27,6 +27,16 @@ class Upgrade extends ComponentAbstract { * Register any hooks that this component needs. */ public function register_hooks() { + /** + * Whether to show the pro nag. + * + * @param bool Whether this should show the nag. + */ + $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); + if ( ! $show_pro_nag ) { + return; + } + add_action( 'admin_menu', [ $this, 'add_submenu_pages' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); } diff --git a/tests/php/Unit/Admin/TestUpgrade.php b/tests/php/Unit/Admin/TestUpgrade.php index 30c3e5a21..383f03c09 100644 --- a/tests/php/Unit/Admin/TestUpgrade.php +++ b/tests/php/Unit/Admin/TestUpgrade.php @@ -52,7 +52,6 @@ public function tearDown() { Monkey\tearDown(); parent::tearDown(); } - /** * Test register_hooks. * @@ -64,6 +63,19 @@ public function test_register_hooks() { $this->assertEquals( 10, has_action( 'admin_enqueue_scripts', [ $this->instance, 'enqueue_scripts' ] ) ); } + /** + * Test that register_hooks exits if the filter is a certain value. + * + * @covers \Genesis\CustomBlocks\Admin\Upgrade::register_hooks() + */ + public function test_register_hooks_exits_via_filter() { + add_filter( 'genesis_custom_blocks_show_pro_nag', '__return_false' ); + $this->instance->register_hooks(); + + $this->assertEquals( false, has_action( 'admin_menu', [ $this->instance, 'add_submenu_pages' ] ) ); + $this->assertEquals( false, has_action( 'admin_enqueue_scripts', [ $this->instance, 'enqueue_scripts' ] ) ); + } + /** * Test enqueue_scripts. * From 64d0d28fd7bc1ab21fbb8dd44f3ed36fa22e4a15 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Wed, 12 Aug 2020 15:37:18 -0500 Subject: [PATCH 02/57] Fix an issue in displaying the Pro nag It should only show if the filter returns true. --- css/admin.settings.css | 3 --- php/Admin/Upgrade.php | 30 ++++++++++++++++++---------- tests/php/Unit/Admin/TestUpgrade.php | 13 ++++++------ 3 files changed, 27 insertions(+), 19 deletions(-) delete mode 100644 css/admin.settings.css diff --git a/css/admin.settings.css b/css/admin.settings.css deleted file mode 100644 index f601da977..000000000 --- a/css/admin.settings.css +++ /dev/null @@ -1,3 +0,0 @@ -.genesis-custom-blocks-settings .nav-tab-wrapper .dashicons-before:before { - padding: 2px 3px 0 0; -} diff --git a/php/Admin/Upgrade.php b/php/Admin/Upgrade.php index 37117cf73..b04744a8c 100644 --- a/php/Admin/Upgrade.php +++ b/php/Admin/Upgrade.php @@ -27,16 +27,6 @@ class Upgrade extends ComponentAbstract { * Register any hooks that this component needs. */ public function register_hooks() { - /** - * Whether to show the pro nag. - * - * @param bool Whether this should show the nag. - */ - $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); - if ( ! $show_pro_nag ) { - return; - } - add_action( 'admin_menu', [ $this, 'add_submenu_pages' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); } @@ -47,6 +37,16 @@ public function register_hooks() { * @return void */ public function enqueue_scripts() { + /** + * Whether to show the pro nag. + * + * @param bool Whether this should show the nag. + */ + $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); + if ( ! $show_pro_nag ) { + return; + } + $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); // Enqueue scripts and styles on the edit screen of the Block post type. @@ -64,6 +64,16 @@ public function enqueue_scripts() { * Add submenu pages to the Genesis Custom Blocks menu. */ public function add_submenu_pages() { + /** + * Whether to show the pro nag. + * + * @param bool Whether this should show the nag. + */ + $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); + if ( ! $show_pro_nag ) { + return; + } + add_submenu_page( 'edit.php?post_type=genesis_custom_block', __( 'Genesis Custom Blocks Pro', 'genesis-custom-blocks' ), diff --git a/tests/php/Unit/Admin/TestUpgrade.php b/tests/php/Unit/Admin/TestUpgrade.php index 383f03c09..ffe0ef674 100644 --- a/tests/php/Unit/Admin/TestUpgrade.php +++ b/tests/php/Unit/Admin/TestUpgrade.php @@ -64,16 +64,17 @@ public function test_register_hooks() { } /** - * Test that register_hooks exits if the filter is a certain value. + * Test enqueue_scripts when there is no pro nag. * - * @covers \Genesis\CustomBlocks\Admin\Upgrade::register_hooks() + * @covers \Genesis\CustomBlocks\Admin\Upgrade::enqueue_scripts() */ - public function test_register_hooks_exits_via_filter() { + public function test_enqueue_scripts_no_pro_nag() { add_filter( 'genesis_custom_blocks_show_pro_nag', '__return_false' ); - $this->instance->register_hooks(); + $this->instance->enqueue_scripts(); + $styles = wp_styles(); - $this->assertEquals( false, has_action( 'admin_menu', [ $this->instance, 'add_submenu_pages' ] ) ); - $this->assertEquals( false, has_action( 'admin_enqueue_scripts', [ $this->instance, 'enqueue_scripts' ] ) ); + $this->assertFalse( in_array( $this->instance->slug, $styles->queue, true ) ); + $this->assertFalse( in_array( $this->instance->slug, $styles->registered, true ) ); } /** From 603ea74e6a5c5557eac5e3b8ae51f2c6848ddf8b Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Wed, 12 Aug 2020 16:40:32 -0500 Subject: [PATCH 03/57] Add a deleted empty line --- tests/php/Unit/Admin/TestUpgrade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/php/Unit/Admin/TestUpgrade.php b/tests/php/Unit/Admin/TestUpgrade.php index ffe0ef674..960ba8698 100644 --- a/tests/php/Unit/Admin/TestUpgrade.php +++ b/tests/php/Unit/Admin/TestUpgrade.php @@ -52,6 +52,7 @@ public function tearDown() { Monkey\tearDown(); parent::tearDown(); } + /** * Test register_hooks. * From 9b37cbd3f2fe0b4250ae909cfff93b0bc94723db Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 13 Aug 2020 15:44:59 -0500 Subject: [PATCH 04/57] Add spaces between style rules --- .eslintignore | 1 - css/admin.block-post.css | 81 +++++++++++++++++++++++++++++++++++++++- php/PluginAbstract.php | 1 - 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 5497a6199..75db91dab 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1 @@ js/editor.blocks.js -js/scripts.js diff --git a/css/admin.block-post.css b/css/admin.block-post.css index 01e8b4147..70d0856a8 100644 --- a/css/admin.block-post.css +++ b/css/admin.block-post.css @@ -3,9 +3,11 @@ #misc-publishing-actions .curtime { display: none; } + #misc-publishing-actions .genesis-custom-blocks-pub-section { padding: 6px 10px 14px; } + #misc-publishing-actions .genesis-custom-blocks-pub-section:before { content: "\f537"; color: #82878c; @@ -18,50 +20,67 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + #misc-publishing-actions .genesis-custom-blocks-pub-section .post-types-display { font-weight: bold; } + #misc-publishing-actions .genesis-custom-blocks-pub-section .post-types-select { display: none; } + #misc-publishing-actions .genesis-custom-blocks-pub-section .post-types-select .post-types-select-items { margin: 3px 0; border: 1px solid #eeeeee; padding: 6px 10px; margin-bottom: 6px; } + +.handle-order-higher, +.handle-order-lower { + display: none +} + #block_fields a, #block_fields a:focus { outline: none; box-shadow: none; } + #block_fields .handlediv, #block_fields .hndle { display: none; } + #block_fields .inside { padding: 0; margin: 0; } + #block_fields .block-fields-list .widefat { border: none; } + #block_fields .block-fields-list td { padding: 0; line-height: 0; } + #block_fields .block-fields-list thead th { font-weight: 600; width: 32%; border-bottom: 1px solid #eee; } + #block_fields .block-fields-list thead th.block-fields-sort { width: 4%; min-width: 32px; } + #block_fields .block-fields-list tbody { background: #f5f5f5; } + #block_fields button { border: 0; background: transparent; @@ -73,13 +92,16 @@ transition: none; line-height: 20px; } + #block_fields button:hover { color: #00a0d2; } + #block_fields button:active, #block_fields button:focus { outline: 0; } + #block_fields button > .dashicons { color: #0073aa; font-size: 12px; @@ -93,36 +115,44 @@ line-height: 16px; transition: none; } + #block_fields button:hover > .dashicons { color: #00a0d2; border-color: #00a0d2; } + #block_fields .block-fields-rows { width: 100%; line-height: 1.5em; } + #block_fields .block-fields-rows .block-no-fields { display: none; padding: 20px 10px 10px; margin: 0; text-align: center; } + #block_fields .block-fields-rows .block-fields-row { background: #fff; border: 1px solid #eee; box-shadow: 0 1px 1px rgba(0,0,0,.04); margin: 10px 10px 0; } + #block_fields .block-fields-rows .block-fields-row-columns { display: grid; grid-template-columns: [handle] minmax( 20px, calc(4% - 10px) ) calc(32% + 14px) calc(32% + 14px) calc(32% - 18px); } + #block_fields .block-fields-rows .block-fields-row > div { padding: 8px 10px; } + #block_fields .block-fields-sort-handle:before { content: "\f545"; } + #block_fields .block-fields-sort-handle { display: none; width: 15px; @@ -133,27 +163,33 @@ cursor: grab; padding-top: 2px; } + #block_fields .block-fields-rows .row-title { display: block; padding-bottom: 6px; } + #block_fields .block-fields-actions-add-field { padding: 20px 10px; clear: both; background: #f5f5f5; text-align: center; } + #block_fields .block-fields-actions { font-size: 12px; line-height: 12px; visibility: hidden; } + #block_fields .block-fields-row-columns:hover > .block-fields-label .block-fields-actions { visibility: visible; } + #block_fields .block-fields-row-columns:hover > .block-fields-sort .block-fields-sort-handle { display: block; } + #block_fields .block-fields-rows .block-fields-row .block-fields-edit { display: none; grid-column: 1 / span 4; @@ -161,56 +197,70 @@ border-bottom: 1px solid #e1e1e1; border-top: 1px solid #e1e1e1; } + #block_fields .block-fields-rows .block-fields-row .block-fields-edit tbody { background: #f7f7f7; } + #block_fields .block-fields-rows .block-fields-edit td, #block_fields .block-fields-rows .block-fields-edit th { padding: 8px 10px; } + #block_fields .block-fields-rows .block-fields-edit td.spacer { width: 4%; } + #block_fields .block-fields-rows .block-fields-edit th { font-size: 12px; width: 32%; border-right: 1px solid #e1e1e1; } + #block_fields .block-fields-rows .block-fields-edit th label { font-weight: 600; } + #block_fields .block-fields-rows .block-fields-control { display: flex; } + #block_fields .block-fields-rows .block-fields-control span.pro-required { margin-left: 0.5rem; } + #block_fields .block-fields-rows input[readonly="readonly"], #block_fields .block-fields-rows textarea[readonly="readonly"] { - color: #999; + color: #999; } + #block_fields .block-fields-rows .button-group > .button { width: 5em; position: relative; z-index: 10; } + #block_fields .block-fields-rows .button-group > .button:last-of-type { border-radius: 0 3px 3px 0; } + #block_fields .block-fields-rows .button-group > .button:hover { z-index: 30; } + #block_fields .block-fields-rows .button-group > .button:checked { background: #eee; border-color: #999; box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5), 0 1px 0 #cccccc; z-index: 20; } + #block_fields .block-fields-rows .button-group > .button:checked:before { width: 0; height: 0; background-color: transparent; } + #block_fields .block-fields-rows .button-group > label { font-size: 13px; position: absolute; @@ -221,6 +271,7 @@ pointer-events: none; z-index: 40; } + #block_fields .block-fields-rows .block-fields-edit-loading .loading:before { content: ''; box-sizing: border-box; @@ -232,6 +283,7 @@ border-top-color: #444; animation: spinner .6s linear infinite; } + @media only screen and (max-width: 850px) { #block_fields .block-fields-rows { max-height: none; @@ -240,12 +292,14 @@ line-height: 1.5em; } } + #block_properties input, #block_properties select, #block_properties label { width: 100%; display: block; } + #block_properties #block-properties-icon-current { background: #ffffff; border: 1px solid #cccccc; @@ -258,10 +312,12 @@ display: inline-block; box-shadow: 0 1px 0 #cccccc; } + #block_properties #block-properties-icon-current svg { color: #23282d; fill: #23282d; } + #block_properties .block-properties-icon-button { width: auto; display: inline-block; @@ -276,17 +332,21 @@ transform: translateY(0); box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ), 0 1px 0 #cccccc; } + #block_properties #block-properties-icon-select, #block_properties #block-properties-icon-close, #block_properties #block-properties-icon-choose:target { display: none; } + #block-properties-icon-choose:target + #block-properties-icon-close { display: inline-block; } + #block-properties-icon-choose:target ~ #block-properties-icon-select { display: block; } + #block_properties .block-properties-icon-select { background: #f9f9f9; overflow-x: hidden; @@ -297,6 +357,7 @@ border: 1px solid #cccccc; border-radius: 3px; } + #block_properties .block-properties-icon-select .icon { display: inline-block; padding: 4px; @@ -309,40 +370,49 @@ width: 1em; height: 1em; } + #block_properties .block-properties-icon-select .icon:hover { background: #fff; border: 1px solid #aaa; color: #444; } + #block_properties .block-properties-icon-select .icon.selected, #block_properties .block-properties-icon-select .icon.selected:hover { border: 1px solid rgba(0, 160, 210, 1); color: rgba(0, 160, 210, 1); fill: rgba(0, 160, 210, 1); } + #block_properties .block-properties-icon-select .icon svg { vertical-align: top; } + #block_properties .block-properties-category-custom { display: none; margin: 12px 0; } + #block_template > h2 { display: none; } + #block_template .inside { padding: 0; margin: 0; } + #block_template .template-notice { background: #fff; border-left: 4px solid #ffffff; padding: 1px 12px; border-left-color: #0066CC; } + #block_template .template-success { border-left-color: #46b450; } + #block_template .template-location { margin: 0 0 6px; padding: 5px 8px; @@ -350,22 +420,27 @@ display: inline-block; font-size: 0; } + #block_template .template-location * { font-size: 12px; line-height: 23px; } + #block_template .template-location a.filename { color: #444; text-decoration: none; border-bottom: 1px dotted #444; } + #block_template .template-location a.filename:focus { outline: none; box-shadow: none; } + #block_template .template-location .click-to-copy { display: none; } + #block_template .template-location .click-to-copy input { color: #444; margin: 0; @@ -383,6 +458,7 @@ z-index: 2; cursor: pointer; } + /* Hide the tooltip content by default */ [data-tooltip]:before, [data-tooltip]:after { @@ -390,6 +466,7 @@ opacity: 0; pointer-events: none; } + /* Position tooltip above the element */ [data-tooltip]:before { position: absolute; @@ -408,6 +485,7 @@ font-size: 12px; line-height: 1.2; } + /* Triangle hack to make tooltip look like a speech bubble */ [data-tooltip]:after { position: absolute; @@ -423,6 +501,7 @@ font-size: 0; line-height: 0; } + /* Show tooltip content on hover */ [data-tooltip]:hover:before, [data-tooltip]:hover:after { diff --git a/php/PluginAbstract.php b/php/PluginAbstract.php index d17d6c552..661736fa5 100644 --- a/php/PluginAbstract.php +++ b/php/PluginAbstract.php @@ -270,7 +270,6 @@ public function get_assets_path( $path = '' ) { * @return PluginAbstract The plugin instance. */ public function register_component( ComponentInterface $component ) { - $component_class = get_class( $component ); // If component already registered, then there is nothing left to do. From 2116fd0e3d4c05039f97fa404a7d641c94b8fe1f Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 13 Aug 2020 15:48:23 -0500 Subject: [PATCH 05/57] Remove styling from the Pro plugin I should have removed this before, as it's for Pro controls. --- css/src/editor.scss | 320 -------------------------------------------- 1 file changed, 320 deletions(-) diff --git a/css/src/editor.scss b/css/src/editor.scss index 550395ee5..2e3764bcb 100644 --- a/css/src/editor.scss +++ b/css/src/editor.scss @@ -184,239 +184,6 @@ div[class^="wp-block-genesis-custom-blocks-"] { max-width: unset; } } - - /* Rich Text Control Component */ - .genesis-custom-blocks-rich-text-control { - .components-base-control__field { - margin-top: 20px; - } - - .input-control { - background: #fff; - min-height: 7em; - line-height: 1.4rem; - font-size: 13px; - - p { - font-size: 13px; - margin-top: 0.67rem; - margin-bottom: 0.67rem; - } - - p:first-child, - p:first-child > p { - margin-top: 0; - } - } - - /* Override native styling that created a double border */ - .editor-rich-text__inline-toolbar .components-toolbar > .components-toolbar { - border: none; - border-right: 1px solid $light-gray-500; - } - } - - /* Classic Text Control Component */ - .genesis-custom-blocks-classic-text-control { - - .classic-text__toolbar { - position: relative; - z-index: 10; - top: 1px; - - > .mce-container { - width: 100% !important; - border: 1px solid #c5c5c5; - box-shadow: none; - box-sizing: border-box; - } - - .mce-container-body { - width: 100% !important; - > .mce-container { - width: 100% !important; - } - } - } - - /* The editing area, not the toolbar. */ - .classic-text__edit { - - background: $white; - padding: 0.2rem 1rem; - border: 1px solid $dark-gray-150; - outline: none; - min-height: 6rem; - - /* Clear the float in case an image is floated. */ - &:after { - content: ""; - display: table; - clear: both; - } - - p { - font-size: 13px; - margin-top: 0.67rem; - margin-bottom: 0.67rem; - } - - ul, ol { - margin-left: 1rem; - } - } - } - - .genesis-custom-blocks-repeater { - - .genesis-custom-blocks-repeater__rows { - width: 100%; - - .genesis-custom-blocks-repeater--row { - min-width: 100%; - border: 1px dashed $dark-gray-150; - border-top: 0; - margin-bottom: 0; - padding: 10px 14px 0; - position: relative; - transition: background 1s ease-in-out; - - &:first-child { - border-top: 1px dashed $dark-gray-150; - - .genesis-custom-blocks-repeater--row-actions .button-move-up { - display: none; - } - } - - &:last-child { - .genesis-custom-blocks-repeater--row-actions .button-move-down { - display: none; - } - } - - .components-base-control__field { - margin: 0 0 14px; - } - - .genesis-custom-blocks-repeater--row-actions { - position: absolute; - display: none; - top: -1px; - left: -30px; - - .components-icon-button { - width: 28px; - padding: 0; - background: $white; - border-color: $dark-gray-150; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right: none; - - svg { - width: 100%; - } - } - } - - .genesis-custom-blocks-repeater--row-delete { - display: none; - position: absolute; - right: 2px; - top: 4px; - - .components-icon-button { - width: 28px; - padding: 0; - border-color: transparent; - box-shadow: none; - background: transparent; - color: $dark-gray-150; - - svg { - width: 100%; - } - - &:hover:not(:disabled) { - color: $alert-red; - } - - &:active:not(:disabled) { - color: $dark-gray-600; - } - - &:disabled { - opacity: 0; - } - } - } - - &.row-to { - transition: background 0.2s ease-in-out; - background: #fef8ee; - } - - &.row-from { - transition: none; - background: transparent; - } - - &:hover:not(.row-from), - &.row-to { - .genesis-custom-blocks-repeater--row-actions { - display: block; - background: #fff; - box-sizing: border-box; - border: 1px solid $dark-gray-150; - border-radius: 3px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right: none; - - .components-icon-button { - border-color: transparent; - box-shadow: none; - background: transparent; - - &:hover { - background-color: $dark-opacity-light-200; - } - } - } - - .genesis-custom-blocks-repeater--row-delete { - display: block; - } - } - - &:before { - content: ''; - width: 29px; - height: 100%; - position: absolute; - left: -30px; - top: 0; - } - } - } - - .genesis-custom-blocks-repeater--row-add { - margin-top: 4px; - display: flex; - justify-content: center; - - .components-icon-button:hover:not(:disabled) { - border-color: transparent; - box-shadow: none; - background: transparent; - color: $blue-medium-focus; - } - .components-icon-button:active:disabled { - color: #555d66; - } - } - } } /* Block form in sidebar */ @@ -431,11 +198,6 @@ div[class^="wp-block-genesis-custom-blocks-"] { .genesis-custom-blocks-color-control .components-base-control__label { display: block; } - - /* The FetchInput component */ - .gcb-fetch--input input[type="text"] { - width: 100%; - } } /* Miscellaneous global styles */ @@ -445,88 +207,6 @@ div[class^="wp-block-genesis-custom-blocks-"] { } } -/* - * FetchInput styling forked from URLInput styling in Gutenberg, with different class names. - * This uses a Popover, which often appears outside of its container. - * So this doesn't work inside the "Block form in editor" section above. - * @see https://github.com/WordPress/gutenberg/blob/fd2468d6c486220f7f1fa5bfa2366c510b46af27/packages/editor/src/components/url-input/style.scss#L42 - */ -.gcb-fetch__input { - width: 100%; -} - -.gcb-fetch__popover.editor:not(.is-mobile) .components-popover__content { - width: $input-width; -} - -.gcb-fetch__popover.inspector:not(.is-mobile) .components-popover__content { - min-width: 247px; -} - -.gcb-fetch-input__suggestions { - max-height: 200px; - transition: all 0.15s ease-in-out; - padding: 4px 0; - overflow-y: auto; -} - -// Hide suggestions on mobile until we @todo find a better way to show them. -.gcb-fetch-input__suggestions, -.gcb-fetch-input .components-spinner { - display: none; - @include break-small() { - display: inherit; - } -} - -.gcb-fetch-input { - > .components-base-control__field { - display: flex; - flex-wrap: wrap; - - > .components-base-control__label { - flex: 3 3 100%; - } - - > .gcb-fetch__input { - flex: 1 1 0; - } - > .components-spinner { - flex: 0 0 auto; - } - } -} - -.gcb-fetch-input__suggestion { - padding: 4px $input-padding; - color: $dark-gray-300; // Lightest we can use for contrast. - display: block; - font-size: $default-font-size; - cursor: pointer; - background: $white; - width: 100%; - border: none; - text-align: left; - @include menu-style__neutral(); - - &:hover { - background: $light-gray-500; - } - - &:focus, - &.is-selected { - background: rgb(0, 113, 158); - color: $white; - outline: none; - } -} - -.gcb-dot-tip.read-more { - float: left; - margin: 0; - padding-right: 1em; -} - // In the display, correct an issue where
    and
      can appear outside (to the left) of their container. .editor-styles-wrapper .genesis-custom-blocks-editor__ssr { ul, ol { From 392ad04a87513bbfe404f5a4f6aadb3895441aab Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 13 Aug 2020 15:52:39 -0500 Subject: [PATCH 06/57] Add a CSS linting script from Gutenberg And do npm run lint:css:fix to apply it. --- .stylelintrc.json | 16 ++ bin/pre-commit.sh | 9 ++ css/src/_color.scss | 2 +- css/src/editor.scss | 355 ++++++++++++++++++++++---------------------- package.json | 3 + 5 files changed, 207 insertions(+), 178 deletions(-) create mode 100644 .stylelintrc.json diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 000000000..648e4d111 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,16 @@ +{ + "extends": "stylelint-config-wordpress", + "rules": { + "at-rule-empty-line-before": null, + "at-rule-no-unknown": null, + "comment-empty-line-before": null, + "declaration-property-unit-whitelist": null, + "font-weight-notation": null, + "max-line-length": null, + "no-descending-specificity": null, + "no-duplicate-selectors": null, + "rule-empty-line-before": null, + "selector-class-pattern": null, + "value-keyword-case": null + } +} diff --git a/bin/pre-commit.sh b/bin/pre-commit.sh index 2ed083850..24dd0d04b 100755 --- a/bin/pre-commit.sh +++ b/bin/pre-commit.sh @@ -19,5 +19,14 @@ if [ ! -z "$js_files" ]; then fi fi +# Lint staged .scss files +scss_files=$( git diff --diff-filter=d --staged --name-only | grep -E '/*\.scss$' ) +if [ -n "$scss_files" ]; then + npm run lint:css:files $scss_files + if [ $? != 0 ]; then + exit 1 + fi +fi + # Lint package.json npm run lint:pkg-json diff --git a/css/src/_color.scss b/css/src/_color.scss index f2865fab5..cfc9526ca 100644 --- a/css/src/_color.scss +++ b/css/src/_color.scss @@ -91,4 +91,4 @@ $blue-medium-focus: #007cba; // Alert colors. $alert-yellow: #f0b849; $alert-red: #d94f4f; -$alert-green: #4ab866; \ No newline at end of file +$alert-green: #4ab866; diff --git a/css/src/editor.scss b/css/src/editor.scss index 2e3764bcb..ed3b1b102 100644 --- a/css/src/editor.scss +++ b/css/src/editor.scss @@ -1,4 +1,4 @@ -@import 'color'; +@import "color"; $input-padding: 8px; $input-width: 300px; @@ -14,202 +14,203 @@ $font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans /* Menu items. */ @mixin menu-style__neutral() { - border: none; - box-shadow: none; + border: none; + box-shadow: none; } /* Block form in editor & sidebar */ div[class^="wp-block-genesis-custom-blocks-"], .edit-post-settings-sidebar__panel-block .components-panel__body { - :required:invalid { - border-color: #C00000; - } - - .text-control__error { - border-color: #d94f4f; - box-shadow: 0 0 0 1px #d94f4f; - } - - /* Color Control Component */ - .genesis-custom-blocks-color-control { - - .components-base-control { - display: inline-block; - margin-bottom: 0 !important; - - .components-base-control__field { - margin: 0 !important; - width: 100%; - height: 100%; - } - - &.genesis-custom-blocks-color-popover { - width: 28px; - height: 28px; - border-radius: 50%; - margin: 1px 1em !important; - background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); - background-size: 10px 10px; - background-position: 0 0, 0 5px, 5px -5px, -5px 0; - display: inline-block; - vertical-align: top; - border: none; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - transition: 100ms transform ease; - cursor: pointer; - - &:hover { - transform: scale(1.2) - } - - .component-color-indicator { - width: 100%; - height: 100%; - margin: 0; - border: none; - border-radius: 50%; - } - } - } - } - - /* Media Upload Component */ - .genesis-custom-blocks-media-controls { - .gcb-image__img { - max-height: 200px; - display: block; - margin-bottom: 8px; - } - - .components-placeholder { - position: relative; - } - - .gcb-image__placeholder .components-button.is-button { - white-space: normal; - } - - .components-form-file-upload, - .components-media-library-button, - .gcb-image__remove { - margin: 0 4px 4px 0; - display: inline-block; - vertical-align: top; - } - - .components-base-control__field { - .components-base-control__help { - margin-bottom: 4px; - margin-top: 0; - } - } - } + :required:invalid { + border-color: #c00000; + } + + .text-control__error { + border-color: #d94f4f; + box-shadow: 0 0 0 1px #d94f4f; + } + + /* Color Control Component */ + .genesis-custom-blocks-color-control { + + .components-base-control { + display: inline-block; + margin-bottom: 0 !important; + + .components-base-control__field { + margin: 0 !important; + width: 100%; + height: 100%; + } + + &.genesis-custom-blocks-color-popover { + width: 28px; + height: 28px; + border-radius: 50%; + margin: 1px 1em !important; + background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); + background-size: 10px 10px; + background-position: 0 0, 0 5px, 5px -5px, -5px 0; + display: inline-block; + vertical-align: top; + border: none; + box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); + transition: 100ms transform ease; + cursor: pointer; + + &:hover { + transform: scale(1.2); + } + + .component-color-indicator { + width: 100%; + height: 100%; + margin: 0; + border: none; + border-radius: 50%; + } + } + } + } + + /* Media Upload Component */ + .genesis-custom-blocks-media-controls { + .gcb-image__img { + max-height: 200px; + display: block; + margin-bottom: 8px; + } + + .components-placeholder { + position: relative; + } + + .gcb-image__placeholder .components-button.is-button { + white-space: normal; + } + + .components-form-file-upload, + .components-media-library-button, + .gcb-image__remove { + margin: 0 4px 4px 0; + display: inline-block; + vertical-align: top; + } + + .components-base-control__field { + .components-base-control__help { + margin-bottom: 4px; + margin-top: 0; + } + } + } } /* Block form in editor */ div[class^="wp-block-genesis-custom-blocks-"] { - margin: 0; - - .block-form { - border-left: none; - background: $dark-opacity-light-200; - padding: 22px 0 22px 22px; - font-size: 0.8125rem; - display: flex; - flex-wrap: wrap; - - h3 { - color: #111; - font-size: 1rem; - margin: 0; - flex: 1 1 100%; - - svg { - position: relative; - top: 6px; - margin-right: 4px; - } - } - - p { - font-size: 1rem; - font-family: $font-family; - } - - .genesis-custom-blocks-control { - flex-basis: 100%; - padding-right: 22px; - - &.width-25 { - flex-basis: 25%; - } - &.width-50 { - flex-basis: 50%; - } - &.width-75 { - flex-basis: 75%; - } - } - - @media screen and (max-width: 782px) { - .genesis-custom-blocks-control.width-25, - .genesis-custom-blocks-control.width-50, - .genesis-custom-blocks-control.width-75 { - flex-basis: 100%; - } - } - - .components-base-control { - font-family: $font-family; - } - - .components-base-control__field { - margin: 1em 0 0; - - .components-base-control__label { - display: block; - font-weight: 600; - } - } - - .components-base-control__help { - margin: 0 0 1em 0.5em; - font-size: 1em; - color: rgba(0, 0, 0, 0.8); - } - - /* Override a max-width: 25rem style rule in Core that can prevent displaying at the selected with, like 75% */ - .components-select-control__input { - max-width: unset; - } - } + margin: 0; + + .block-form { + border-left: none; + background: $dark-opacity-light-200; + padding: 22px 0 22px 22px; + font-size: 0.8125rem; + display: flex; + flex-wrap: wrap; + + h3 { + color: #111; + font-size: 1rem; + margin: 0; + flex: 1 1 100%; + + svg { + position: relative; + top: 6px; + margin-right: 4px; + } + } + + p { + font-size: 1rem; + font-family: $font-family; + } + + .genesis-custom-blocks-control { + flex-basis: 100%; + padding-right: 22px; + + &.width-25 { + flex-basis: 25%; + } + &.width-50 { + flex-basis: 50%; + } + &.width-75 { + flex-basis: 75%; + } + } + + @media screen and (max-width: 782px) { + .genesis-custom-blocks-control.width-25, + .genesis-custom-blocks-control.width-50, + .genesis-custom-blocks-control.width-75 { + flex-basis: 100%; + } + } + + .components-base-control { + font-family: $font-family; + } + + .components-base-control__field { + margin: 1em 0 0; + + .components-base-control__label { + display: block; + font-weight: 600; + } + } + + .components-base-control__help { + margin: 0 0 1em 0.5em; + font-size: 1em; + color: rgba(0, 0, 0, 0.8); + } + + /* Override a max-width: 25rem style rule in Core that can prevent displaying at the selected with, like 75% */ + .components-select-control__input { + max-width: unset; + } + } } /* Block form in sidebar */ .edit-post-settings-sidebar__panel-block .components-panel__body { - /* Media Upload Component */ - .genesis-custom-blocks-media-controls { - .components-spinner { - float: none; - } - } - - .genesis-custom-blocks-color-control .components-base-control__label { - display: block; - } + /* Media Upload Component */ + .genesis-custom-blocks-media-controls { + .components-spinner { + float: none; + } + } + + .genesis-custom-blocks-color-control .components-base-control__label { + display: block; + } } /* Miscellaneous global styles */ .edit-post-layout { - .components-popover:not(.is-mobile):not(.gcb-fetch__popover) .components-popover__content .components-color-picker { - min-width: 340px; - } + .components-popover:not(.is-mobile):not(.gcb-fetch__popover) .components-popover__content .components-color-picker { + min-width: 340px; + } } // In the display, correct an issue where
        and
          can appear outside (to the left) of their container. .editor-styles-wrapper .genesis-custom-blocks-editor__ssr { - ul, ol { - margin-left: 1rem; - } + ul, + ol { + margin-left: 1rem; + } } diff --git a/package.json b/package.json index 059d66b5e..ac5bdbb72 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,9 @@ "dev": "wp-scripts start", "env": "wp-env", "lint": "npm-run-all --parallel lint:*", + "lint:css": "wp-scripts lint-style '**/*.scss'", + "lint:css:files": "wp-scripts lint-style", + "lint:css:fix": "npm run lint:css -- --fix", "lint:js": "wp-scripts lint-js js tests/e2e", "lint:js:files": "wp-scripts lint-js", "lint:js:fix": "npm run lint:js -- --fix", From 0f0f1e45dd8c7669a535311d0ae94c937eb6ef19 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 14 Aug 2020 12:16:54 -0500 Subject: [PATCH 07/57] Simplify the documentation of a filter 2 DocBlocks aren't needed for 2 calls of apply_filters(). --- css/admin.onboarding.css | 1 - php/Admin/Onboarding.php | 2 +- php/Admin/Upgrade.php | 25 +++++++++++----------- php/Deprecated.php | 2 +- php/PostTypes/BlockPost.php | 5 +---- tests/php/Unit/PostTypes/TestBlockPost.php | 1 - 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/css/admin.onboarding.css b/css/admin.onboarding.css index c4f3ba763..93e736560 100644 --- a/css/admin.onboarding.css +++ b/css/admin.onboarding.css @@ -1,4 +1,3 @@ - .genesis-custom-blocks-notice { border-left: 4px solid #0066CC; padding: 10px 20px; diff --git a/php/Admin/Onboarding.php b/php/Admin/Onboarding.php index 99af6eaa7..25a43938f 100644 --- a/php/Admin/Onboarding.php +++ b/php/Admin/Onboarding.php @@ -3,7 +3,7 @@ * User onboarding. * * @package Genesis\CustomBlocks - * @copyright Copyright(c) 2018, Genesis Custom Blocks + * @copyright Copyright(c) 2020, Genesis Custom Blocks * @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0) */ diff --git a/php/Admin/Upgrade.php b/php/Admin/Upgrade.php index b04744a8c..49afa66c3 100644 --- a/php/Admin/Upgrade.php +++ b/php/Admin/Upgrade.php @@ -16,6 +16,13 @@ */ class Upgrade extends ComponentAbstract { + /** + * The default value for whether to show the Pro nag. + * + * @var bool + */ + const DEFAULT_SHOW_PRO_NAG = true; + /** * Page slug. * @@ -24,7 +31,7 @@ class Upgrade extends ComponentAbstract { public $slug = 'genesis-custom-blocks-pro'; /** - * Register any hooks that this component needs. + * Registers any hooks that this component needs. */ public function register_hooks() { add_action( 'admin_menu', [ $this, 'add_submenu_pages' ] ); @@ -32,17 +39,15 @@ public function register_hooks() { } /** - * Enqueue scripts and styles used by the Upgrade screen. - * - * @return void + * Enqueues scripts and styles used by the Upgrade screen. */ public function enqueue_scripts() { /** * Whether to show the pro nag. * - * @param bool Whether this should show the nag. + * @param bool */ - $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); + $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', self::DEFAULT_SHOW_PRO_NAG ); if ( ! $show_pro_nag ) { return; } @@ -64,12 +69,8 @@ public function enqueue_scripts() { * Add submenu pages to the Genesis Custom Blocks menu. */ public function add_submenu_pages() { - /** - * Whether to show the pro nag. - * - * @param bool Whether this should show the nag. - */ - $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', true ); + /** This filter is documented in enqueue_scripts() */ + $show_pro_nag = apply_filters( 'genesis_custom_blocks_show_pro_nag', self::DEFAULT_SHOW_PRO_NAG ); if ( ! $show_pro_nag ) { return; } diff --git a/php/Deprecated.php b/php/Deprecated.php index f6e498e16..6eda18fcd 100644 --- a/php/Deprecated.php +++ b/php/Deprecated.php @@ -7,7 +7,7 @@ * @see Genesis\CustomBlocks\ComponentAbstract->_call() * * @package Genesis\CustomBlocks - * @copyright Copyright(c) 2018, Genesis Custom Blocks + * @copyright Copyright(c) 2020, Genesis Custom Blocks * @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0) */ diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index a70b462d4..453cb1a40 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -708,11 +708,8 @@ class="regular-text" /** * Enables rendering row actions for a field. - * - * @param Field $field The field. - * @param string $uid The unique ID of the field's parent. */ - do_action( 'genesis_custom_blocks_field_row_actions', $field, $uid ); + do_action( 'genesis_custom_blocks_field_row_actions' ); } /** diff --git a/tests/php/Unit/PostTypes/TestBlockPost.php b/tests/php/Unit/PostTypes/TestBlockPost.php index 5fa896c2b..76cda5c04 100644 --- a/tests/php/Unit/PostTypes/TestBlockPost.php +++ b/tests/php/Unit/PostTypes/TestBlockPost.php @@ -62,7 +62,6 @@ public function test_register_hooks() { $this->assertEquals( 10, has_action( 'genesis_custom_blocks_field_value', [ $this->instance, 'get_field_value' ] ) ); $this->assertEquals( 10, has_action( 'disable_months_dropdown', '__return_true' ) ); - $this->assertEquals( 10, has_action( 'page_row_actions', [ $this->instance, 'page_row_actions' ] ) ); $this->assertEquals( 10, has_action( 'bulk_actions-edit-' . self::EXPECTED_SLUG, [ $this->instance, 'bulk_actions' ] ) ); $this->assertEquals( 10, has_action( 'manage_edit-' . self::EXPECTED_SLUG . '_columns', [ $this->instance, 'list_table_columns' ] ) ); $this->assertEquals( 10, has_action( 'manage_' . self::EXPECTED_SLUG . '_posts_custom_column', [ $this->instance, 'list_table_content' ] ) ); From b15c005db7e9dbe03cfe41d791872d7959a4f3e6 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 14 Aug 2020 15:37:27 -0500 Subject: [PATCH 08/57] Add a method get_controls() that the Pro plugin or any other can use Needs to be called after 'init', so the controls were registered. --- php/Plugin.php | 10 +++++++- php/PostTypes/BlockPost.php | 23 ++++++++++++++--- tests/php/Unit/PostTypes/TestBlockPost.php | 29 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/php/Plugin.php b/php/Plugin.php index a4d0f98e6..bdca11031 100644 --- a/php/Plugin.php +++ b/php/Plugin.php @@ -26,6 +26,13 @@ class Plugin extends PluginAbstract { */ protected $util; + /** + * The block post type. + * + * @var BlockPost + */ + public $block_post; + /** * WP Admin resources. * @@ -46,7 +53,8 @@ class Plugin extends PluginAbstract { public function init() { $this->util = new Util(); $this->register_component( $this->util ); - $this->register_component( new BlockPost() ); + $this->block_post = new BlockPost(); + $this->register_component( $this->block_post ); $this->loader = new Loader(); $this->register_component( $this->loader ); diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 453cb1a40..8a1b5c414 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -12,7 +12,7 @@ use Genesis\CustomBlocks\ComponentAbstract; use Genesis\CustomBlocks\Blocks\Block; use Genesis\CustomBlocks\Blocks\Field; -use Genesis\CustomBlocks\Blocks\Controls; +use Genesis\CustomBlocks\Blocks\Controls\ControlAbstract; /** * Class Block @@ -29,7 +29,7 @@ class BlockPost extends ComponentAbstract { /** * Registered controls. * - * @var Controls\ControlAbstract[] + * @var ControlAbstract[] */ public $controls = []; @@ -106,7 +106,7 @@ public function register_controls() { * An associative array of the available controls. * * @type string $control_name The name of the control, like 'user'. - * @type object $control The control object, extending Controls\ControlAbstract. + * @type object $control The control object, extending ControlAbstract. * } */ $this->controls = apply_filters( 'genesis_custom_blocks_controls', $controls ); @@ -131,6 +131,23 @@ public function get_control( $control_name ) { } } + /** + * Gets the registered controls. + * + * @return ControlAbstract[] The block controls. + */ + public function get_controls() { + if ( ! did_action( 'init' ) ) { + _doing_it_wrong( + __METHOD__, + esc_html__( 'Must be called after the init action so the controls are registered', 'genesis-custom-blocks' ), + '1.0.0' + ); + } + + return $this->controls; + } + /** * Gets the field value to be made available or echoed on the front-end template. * diff --git a/tests/php/Unit/PostTypes/TestBlockPost.php b/tests/php/Unit/PostTypes/TestBlockPost.php index 76cda5c04..5f2b12331 100644 --- a/tests/php/Unit/PostTypes/TestBlockPost.php +++ b/tests/php/Unit/PostTypes/TestBlockPost.php @@ -94,6 +94,35 @@ public function test_get_control() { $this->assertEquals( null, $this->instance->get_control( 'non-existent-control' ) ); } + + /** + * Test get_controls. + * + * @covers \Genesis\CustomBlocks\PostTypes\BlockPost::get_controls() + * @covers \Genesis\CustomBlocks\PostTypes\BlockPost::register_controls() + */ + public function test_get_controls() { + $this->instance->register_controls(); + $this->assertEquals( + [ + 'text', + 'textarea', + 'url', + 'email', + 'number', + 'color', + 'image', + 'select', + 'multiselect', + 'toggle', + 'range', + 'checkbox', + 'radio', + ], + array_keys( $this->instance->get_controls() ) + ); + } + /** * Test get_field_value. * From 17c3cef030580d930cf7e227b54c760f8d171de0 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 14 Aug 2020 16:42:14 -0500 Subject: [PATCH 09/57] Add a filter that the Pro plugin can use This is really messy, there might be a better way. But ideally the React refactor will remove this. --- php/PostTypes/BlockPost.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 8a1b5c414..5fc6abfe9 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -1047,8 +1047,21 @@ public function save_block( $data ) { $field = new Field( $field_config ); } - $field->order = count( $block->fields ); - $block->fields[ $name ] = $field; + /** + * The block that will be saved in this iteration. + * + * @param Block $block Block where the field is. + * @param Field $field Block field to save. + * @param array $fields Block fields to save, as sent from the form's POST request. + * @param int|string $key Field key. + * @param string $name Field name. + */ + $block = apply_filters( 'genesis_custom_blocks_block_to_save', $block, $field, $fields, $key, $name ); + + if ( empty( $_POST['block-fields-parent'][ $key ] ) ) { + $field->order = count( $block->fields ); + $block->fields[ $name ] = $field; + } } } From 4b5cd601ecb7357677b2f1097d45e11f5c2c6967 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 17 Aug 2020 14:07:29 -0500 Subject: [PATCH 10/57] Remove the reference to the Code of Conduct In CONTRIBUTING.md Because it references info@getblocklab.com, --- CONTRIBUTING.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69fd84fcb..28c16dadf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,8 +6,6 @@ The following is a set of guidelines for contributing to Genesis Custom Blocks. #### Table Of Contents -[Code of Conduct](#code-of-conduct) - [How Can I Contribute?](#how-can-i-contribute) * [Reporting Bugs](#reporting-bugs) * [Suggesting Enhancements](#suggesting-enhancements) @@ -21,10 +19,6 @@ The following is a set of guidelines for contributing to Genesis Custom Blocks. [Additional Notes](#additional-notes) * [Issue and Pull Request Labels](#issue-and-pull-request-labels) -## Code of Conduct - -This project and everyone participating in it is governed by the [Genesis Custom Blocks Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [info@getblocklab.com](mailto:info@getblocklab.com). - ## How Can I Contribute? ### Reporting Bugs From 739ad6224010b770200abab0e24b55c38b7cc478 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 17 Aug 2020 15:12:40 -0500 Subject: [PATCH 11/57] Remove a seemingly duplicate hook It looks like this output the same markup that was already there. --- php/PostTypes/BlockPost.php | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 5fc6abfe9..606d832b5 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -561,17 +561,18 @@ public function render_fields_meta_box() { - + slug}_after_fields_list" ); wp_nonce_field( "{$this->slug}_save_fields", "{$this->slug}_fields_nonce" ); } @@ -722,11 +723,6 @@ class="regular-text" ?> name ] = $value; - - $field = new Field( $field_config ); + $field = new Field( $field_config ); } } From 78e84c8d649282ce9d64584eed67455a28ce253d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 17 Aug 2020 17:21:14 -0500 Subject: [PATCH 12/57] Change how this gets the field type Instead of instantiating a new control, use one that is already in BlockPost. --- php/Blocks/Field.php | 18 +++++------------- tests/php/Unit/Blocks/TestField.php | 11 ++++++----- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/php/Blocks/Field.php b/php/Blocks/Field.php index 78b12e544..cc4a1e9f8 100644 --- a/php/Blocks/Field.php +++ b/php/Blocks/Field.php @@ -118,18 +118,10 @@ public function from_array( $config ) { $this->settings = $config['settings']; } - $separator = '_'; - if ( ! isset( $config['type'] ) ) { - $control_class_name = 'Genesis\\CustomBlocks\\Blocks\\Controls\\'; - $control_class_name .= str_replace( $separator, '', ucwords( $this->control, $separator ) ); - if ( class_exists( $control_class_name ) ) { - /** - * An instance of the control, to retrieve the correct type. - * - * @var ControlAbstract $control_class - */ - $control_class = new $control_class_name(); - $this->type = $control_class->type; + if ( ! isset( $config['type'] ) && isset( $config['control'] ) ) { + $control = genesis_custom_blocks()->block_post->get_control( $config['control'] ); + if ( $control ) { + $this->type = $control->type; } } @@ -146,7 +138,7 @@ public function from_array( $config ) { * * @param array $settings The field settings. */ - $this->settings = apply_filters( 'genesis_custom_blocks_field_from_array', $this->settings ); + $this->settings = apply_filters( 'genesis_custom_blocks_settings_from_array', $this->settings ); } /** diff --git a/tests/php/Unit/Blocks/TestField.php b/tests/php/Unit/Blocks/TestField.php index 6adaff50c..efccdb566 100644 --- a/tests/php/Unit/Blocks/TestField.php +++ b/tests/php/Unit/Blocks/TestField.php @@ -5,7 +5,7 @@ * @package Genesis\CustomBlocks */ -use Genesis\CustomBlocks\Blocks; +use Genesis\CustomBlocks\Blocks\Field; /** * Tests for class Field. @@ -15,7 +15,7 @@ class TestField extends \WP_UnitTestCase { /** * The instance to test. * - * @var Blocks\Field + * @var Field */ public $instance; @@ -43,7 +43,7 @@ class TestField extends \WP_UnitTestCase { public function setUp() { parent::setUp(); - $this->instance = new Blocks\Field( [] ); + $this->instance = new Field( [] ); } /** @@ -84,15 +84,16 @@ public function test_from_array() { * @covers \Genesis\CustomBlocks\Blocks\Field::from_array() */ public function test_from_array_without_type() { + genesis_custom_blocks()->block_post->register_controls(); $this->instance->from_array( [ 'control' => 'rich_text' ] ); $this->assertEquals( 'string', $this->instance->type ); - $this->instance = new Blocks\Field( [] ); + $this->instance = new Field( [] ); $this->instance->from_array( [ 'control' => 'image' ] ); $this->assertEquals( 'integer', $this->instance->type ); // The control class doesn't exist, so this shouldn't change the default value of $type, 'string'. - $this->instance = new Blocks\Field( [] ); + $this->instance = new Field( [] ); $this->instance->from_array( [ 'control' => 'non-existent' ] ); $this->assertEquals( 'string', $this->instance->type ); } From 118dee499f4d32395f6a1b8e3da20d56ceadd8e6 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Tue, 18 Aug 2020 14:41:36 -0500 Subject: [PATCH 13/57] Change the slug of the 'block-post' script Simply 'block-post' is probably too generic, so prefix it with the plugin name. --- php/Blocks/Field.php | 2 +- php/PostTypes/BlockPost.php | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/php/Blocks/Field.php b/php/Blocks/Field.php index cc4a1e9f8..e88c30328 100644 --- a/php/Blocks/Field.php +++ b/php/Blocks/Field.php @@ -134,7 +134,7 @@ public function from_array( $config ) { } /** - * The parsed field, converted from an array. + * The field settings, parsed from an array. * * @param array $settings The field settings. */ diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 606d832b5..946fd7837 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -258,21 +258,24 @@ public function enqueue_scripts() { return; } + $style_slug = 'genesis-custom-blocks-block-post-style'; + $script_slug = 'genesis-custom-blocks-block-post-script'; + // Enqueue scripts and styles on the edit screen of the Block post type. if ( $this->slug === $screen->post_type && 'post' === $screen->base ) { wp_enqueue_style( - 'block-post', + $style_slug, $this->plugin->get_url( 'css/admin.block-post.css' ), [], $this->plugin->get_version() ); if ( ! in_array( $post->post_status, [ 'publish', 'future', 'pending' ], true ) ) { - wp_add_inline_style( 'block-post', '#delete-action { display: none; }' ); + wp_add_inline_style( $style_slug, '#delete-action { display: none; }' ); } wp_enqueue_script( - 'block-post', + $script_slug, $this->plugin->get_url( 'js/admin.block-post.js' ), [ 'jquery', 'jquery-ui-sortable', 'wp-util', 'wp-blocks' ], $this->plugin->get_version(), @@ -280,7 +283,7 @@ public function enqueue_scripts() { ); wp_localize_script( - 'block-post', + $script_slug, 'genesisCustomBlocks', [ 'fieldSettingsNonce' => wp_create_nonce( "{$this->slug}_field_settings_nonce" ), @@ -300,7 +303,7 @@ public function enqueue_scripts() { if ( $this->slug === $screen->post_type && 'edit' === $screen->base ) { wp_enqueue_style( - 'block-edit', + $style_slug, $this->plugin->get_url( 'css/admin.block-edit.css' ), [], $this->plugin->get_version() From 5f3cc024dbe27f032e997f9f86ca9289f2907d62 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 18:19:21 -0500 Subject: [PATCH 14/57] Update CONTRIBUTING.md for phpunit Instructions about setting up PHPUnit and running it --- CONTRIBUTING.md | 18 + composer.json | 3 +- composer.lock | 1559 ++++++++++++++++++++++++++++++++++- tests/php/Unit/TestUtil.php | 2 +- tests/wp-tests-config.php | 39 - 5 files changed, 1555 insertions(+), 66 deletions(-) delete mode 100644 tests/wp-tests-config.php diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28c16dadf..948438a96 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,6 +94,24 @@ While developing, it is a best practice to watch for changes. This command will composer install ``` +#### PHPUnit + +``` +WP_TESTS_DIR=/path/to/wordpress-develop/tests/phpunit composer test +``` + +If you've already installed the DB for the [WordPress Core unit tests](https://github.com/WordPress/wordpress-develop/tree/0228dd6a5d17aa42735fdff9b106afccb960311e/tests/phpunit), simply pass the path to [wordpress-develop/tests/phpunit/](https://github.com/WordPress/wordpress-develop/tree/0228dd6a5d17aa42735fdff9b106afccb960311e/tests/phpunit) as `WP_TESTS_DIR`, as shown above. + +Otherwise, clone [wordpress-develop](https://github.com/WordPress/wordpress-develop). + +Then, `cd` back to this plugin and do: + +``` +WP_TESTS_DIR=/path/to/wordpress-develop/tests/phpunit ./bin/install-wp-tests.sh +``` + +Use whatever DB name you'd like, and substitute a DB user and password that works in your environment. + Thanks! :heart: :heart: :heart: Genesis Custom Blocks Team diff --git a/composer.json b/composer.json index adfb50a91..1a1bf107d 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "mockery/mockery": "1.3.1", "phpcompatibility/phpcompatibility-wp": "2.1.0", "squizlabs/php_codesniffer": "3.5.3", - "wp-coding-standards/wpcs": "2.2.0" + "wp-coding-standards/wpcs": "2.2.0", + "phpunit/phpunit": "7.5.2" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ece7d73ed..1357bc569 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f7ebb1bb69c022425c3f9ac31cbef714", + "content-hash": "62dc8a419ab92c81125b43e7bbdd538e", "packages": [], "packages-dev": [ { @@ -183,6 +183,76 @@ ], "time": "2018-10-26T13:21:45+00:00" }, + { + "name": "doctrine/instantiator", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-05-29T17:27:14+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -341,6 +411,162 @@ ], "time": "2019-12-26T09:49:15+00:00" }, + { + "name": "myclabs/deep-copy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -502,55 +728,1338 @@ "time": "2019-08-28T14:22:28+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "3.5.3", + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "mockery/mockery": "~1.3.2" }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-08-15T11:14:08+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Greg Sherwood", - "role": "lead" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-06-27T10:12:23+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2", + "phpdocumentor/reflection-docblock": "^5.0", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "time": "2019-12-04T04:46:47+00:00" + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2020-07-08T12:44:21+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "abandoned": true, + "time": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c89093bd00f7d5ddf0ab81dee04f801416b4944", + "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-01-15T08:19:08+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.3", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2019-12-04T04:46:47+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-07-08T17:02:28+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/tests/php/Unit/TestUtil.php b/tests/php/Unit/TestUtil.php index c0ad87291..4e7125280 100644 --- a/tests/php/Unit/TestUtil.php +++ b/tests/php/Unit/TestUtil.php @@ -261,6 +261,6 @@ public function test_get_post_type_slug() { public function test_get_url_from_path() { $subdirectory_path = 'wp-content/theme/blocks/test-block-here.css'; $path = ABSPATH . $subdirectory_path; - $this->assertEquals( '/' . $subdirectory_path, $this->instance->get_url_from_path( $path ) ); + $this->assertContains( '/' . $subdirectory_path, $this->instance->get_url_from_path( $path ) ); } } diff --git a/tests/wp-tests-config.php b/tests/wp-tests-config.php deleted file mode 100644 index 4612dc745..000000000 --- a/tests/wp-tests-config.php +++ /dev/null @@ -1,39 +0,0 @@ - Date: Fri, 21 Aug 2020 18:35:42 -0500 Subject: [PATCH 15/57] Attempt to address failed Composer install Remove the previous phpunit before installing the new one. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ee60439ba..01c6b983b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,7 +75,7 @@ jobs: working_directory: *PLUGIN_PATH command: | composer install && npm install && npm run build - composer require --dev phpunit/phpunit 5.7.9 + composer remove phpunit/phpunit && composer require --dev phpunit/phpunit 5.7.9 WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit js-tests: From 55dd63fc7f06a800989e4b65247fe7b11dc84977 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 18:58:38 -0500 Subject: [PATCH 16/57] Remove phpunit from dev --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 01c6b983b..b5d1221ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,7 +75,7 @@ jobs: working_directory: *PLUGIN_PATH command: | composer install && npm install && npm run build - composer remove phpunit/phpunit && composer require --dev phpunit/phpunit 5.7.9 + composer remove --dev phpunit/phpunit && composer require --dev phpunit/phpunit 5.7.9 WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit js-tests: From 90bc47f8b8a60f1027a0e053c5a2c60121a1d1f8 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 19:06:38 -0500 Subject: [PATCH 17/57] In Composer, remove phpunit/phpunit before doing composer install --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5d1221ca..8ec2c2e0d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,8 +74,8 @@ jobs: name: Running PHPUnit working_directory: *PLUGIN_PATH command: | - composer install && npm install && npm run build - composer remove --dev phpunit/phpunit && composer require --dev phpunit/phpunit 5.7.9 + composer remove --dev phpunit/phpunit && composer install && npm install && npm run build + composer require --dev phpunit/phpunit 5.7.9 WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit js-tests: From 43a2ceed2a22e5a6a77fa4d13774e0f4dac402b6 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 19:45:36 -0500 Subject: [PATCH 18/57] Add an automated way to tag a built plugin, mainly from AMP plugin Thanks to Weston Ruter for his work on this. --- bin/tag-built.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bin/tag-built.sh diff --git a/bin/tag-built.sh b/bin/tag-built.sh new file mode 100644 index 000000000..0c10b8b9c --- /dev/null +++ b/bin/tag-built.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Mainly copied from the Official AMP Plugin for WordPress + +set -e + +tag=$(cat package/trunk/genesis-custom-blocks.php | grep 'Version:' | sed 's/.*: //' | sed 's/-[0-9]\{8\}T[0-9]\{6\}Z-[a-f0-9]*$//') +if [[ -z "$tag" ]]; then + echo "Error: Unable to determine tag." + exit 1 +fi + +built_tag="$tag-built" +if git rev-parse "$built_tag" >/dev/null 2>&1; then + echo "Error: Built tag already exists: $built_tag" + exit 2 +fi + +if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD --; then + echo "Error: Repo is in dirty state" + exit 3 +fi + +git checkout "$tag" +composer install && npm install +gulp +mkdir built +git clone . built/ +cd built +git checkout $tag +git rm -r $(git ls-files) +rsync -avz ../package/trunk/ ./ +git add -A . +git commit -m "Build $tag" --no-verify +# git tag "$built_tag" +# git push origin "$built_tag" +cd .. +# git push origin "$built_tag" +# rm -rf built + +echo "Pushed tag $built_tag." +echo "See https://github.com/studiopress/genesis-custom-blocks/releases/tag/$built_tag" +echo "For https://github.com/studiopress/genesis-custom-blocks/releases/tag/$tag" From 5dbaa498664554cb45db94a1707d2b0403457ea3 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 22:30:45 -0500 Subject: [PATCH 19/57] In composer install, don't build dev dependencies --- bin/tag-built.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 bin/tag-built.sh diff --git a/bin/tag-built.sh b/bin/tag-built.sh old mode 100644 new mode 100755 index 0c10b8b9c..2fcee94fd --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -17,11 +17,11 @@ fi if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD --; then echo "Error: Repo is in dirty state" - exit 3 + #exit 3 fi git checkout "$tag" -composer install && npm install +composer install -o --no-dev && npm install gulp mkdir built git clone . built/ From 43a87f92efa2abca1c9a41864bb9a56066bcf970 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 23:02:46 -0500 Subject: [PATCH 20/57] Move gulp higher so it has access to version --- bin/tag-built.sh | 6 +++--- gulpfile.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index 2fcee94fd..09445bd2d 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -2,8 +2,10 @@ # Mainly copied from the Official AMP Plugin for WordPress set -e +composer install -o --no-dev && npm install +gulp -tag=$(cat package/trunk/genesis-custom-blocks.php | grep 'Version:' | sed 's/.*: //' | sed 's/-[0-9]\{8\}T[0-9]\{6\}Z-[a-f0-9]*$//') +tag=$(grep 'Version:' package/trunk/genesis-custom-blocks.php | sed 's/.*: //' | sed 's/-[0-9]\{8\}T[0-9]\{6\}Z-[a-f0-9]*$//') if [[ -z "$tag" ]]; then echo "Error: Unable to determine tag." exit 1 @@ -21,8 +23,6 @@ if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD --; then fi git checkout "$tag" -composer install -o --no-dev && npm install -gulp mkdir built git clone . built/ cd built diff --git a/gulpfile.js b/gulpfile.js index 4631b242b..dac04bc75 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -78,6 +78,7 @@ gulp.task( 'clean:bundle', function () { 'package/trunk/js/src', 'package/trunk/js/*.map', 'package/trunk/css/*.map', + 'package/trunk/css/src', 'package/trunk/bin', 'package/trunk/node_modules', 'package/trunk/tests', From 118af2f51399236f588fbc60a5ce65ba45a069a6 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 23:06:46 -0500 Subject: [PATCH 21/57] Minor improvements to tag-built.sh syntax --- bin/tag-built.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index 09445bd2d..b2e0d47ae 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -19,15 +19,15 @@ fi if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD --; then echo "Error: Repo is in dirty state" - #exit 3 + exit 3 fi git checkout "$tag" mkdir built git clone . built/ cd built -git checkout $tag -git rm -r $(git ls-files) +git checkout "$tag" +git rm -r "$(git ls-files)" rsync -avz ../package/trunk/ ./ git add -A . git commit -m "Build $tag" --no-verify From 18f055d6f5fd0b76ffca61822b5cf31515e9ed7d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 23:12:43 -0500 Subject: [PATCH 22/57] Remove the exit if in dirty state It usually exits, but I don't see a problem in the git state. --- bin/tag-built.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index b2e0d47ae..b19ed545b 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -17,11 +17,6 @@ if git rev-parse "$built_tag" >/dev/null 2>&1; then exit 2 fi -if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD --; then - echo "Error: Repo is in dirty state" - exit 3 -fi - git checkout "$tag" mkdir built git clone . built/ @@ -31,11 +26,11 @@ git rm -r "$(git ls-files)" rsync -avz ../package/trunk/ ./ git add -A . git commit -m "Build $tag" --no-verify -# git tag "$built_tag" -# git push origin "$built_tag" +git tag "$built_tag" +git push origin "$built_tag" cd .. -# git push origin "$built_tag" -# rm -rf built +git push origin "$built_tag" +rm -rf built echo "Pushed tag $built_tag." echo "See https://github.com/studiopress/genesis-custom-blocks/releases/tag/$built_tag" From 7e5b24d0465b133c0ca0a7d571072c4b5db7df24 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 23:55:21 -0500 Subject: [PATCH 23/57] Add back in a missing template This didn't allow adding in a new field. --- php/PostTypes/BlockPost.php | 11 ++++++++++- tests/e2e/specs/create-block.js | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 946fd7837..343110f36 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -560,10 +560,19 @@ public function render_fields_meta_box() {
          - + { await pressKeyWithModifier( 'primary', 'a' ); await page.keyboard.type( fieldName ); - // Publish the block, and wait for the page to reload. + // Publish the block. await page.click( '#publish' ); - await page.waitForNavigation( { waitUntil: 'networkidle0' } ); // Create a new post and add the new block. await createNewPost(); From c9f7cf3bfcaeb36edca40727d08ed16aae178423 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 21 Aug 2020 23:58:43 -0500 Subject: [PATCH 24/57] Rename the template, as it's not for a repeater field Rename to gcb-field, as it's for a field. --- js/admin.block-post.js | 2 +- php/PostTypes/BlockPost.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/admin.block-post.js b/js/admin.block-post.js index da1de56f9..4257da0a0 100644 --- a/js/admin.block-post.js +++ b/js/admin.block-post.js @@ -15,7 +15,7 @@ blockPostTypesInit(); $( '#block-add-field' ).on( 'click', function() { - const template = wp.template( 'field-repeater' ), + const template = wp.template( 'gcb-field' ), data = { uid: new Date().getTime() }, row = $( template( data ) ), edit = row.find( '.block-fields-actions-edit' ), diff --git a/php/PostTypes/BlockPost.php b/php/PostTypes/BlockPost.php index 343110f36..0989fdd07 100644 --- a/php/PostTypes/BlockPost.php +++ b/php/PostTypes/BlockPost.php @@ -564,7 +564,7 @@ public function render_fields_meta_box() { -
          Date: Sat, 22 Aug 2020 23:59:50 -0500 Subject: [PATCH 42/57] Use the Gutenberg utilty method insertBlock() --- tests/e2e/specs/create-block.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/tests/e2e/specs/create-block.js b/tests/e2e/specs/create-block.js index e7e317922..4dd329048 100644 --- a/tests/e2e/specs/create-block.js +++ b/tests/e2e/specs/create-block.js @@ -3,28 +3,11 @@ */ import { createNewPost, - openGlobalBlockInserter, + insertBlock, pressKeyWithModifier, visitAdminPage, } from '@wordpress/e2e-test-utils'; -/** - * Inserts a block from the block inserter, mainly copied from Gutenberg. - * - * @see https://github.com/WordPress/gutenberg/blob/56f912adc681ebd3a6fb6a17eb4cfcb2c0050f5b/packages/e2e-test-utils/src/insert-block.js - * - * @param {string} blockName The block name to search for. - */ -const insertBlockFromInserter = async ( blockName ) => { - await openGlobalBlockInserter(); - await page.focus( '[placeholder="Search for a block"]' ); - await pressKeyWithModifier( 'primary', 'a' ); - await page.keyboard.type( blockName ); - const insertButton = ( - await page.$x( `//button//span[contains(text(), '${ blockName }')]` ) - )[ 0 ]; - await insertButton.click(); -}; const customPostType = 'genesis_custom_block'; describe( 'TextBlock', () => { @@ -49,7 +32,7 @@ describe( 'TextBlock', () => { // Create a new post and add the new block. await createNewPost(); - await insertBlockFromInserter( blockName ); + await insertBlock( blockName ); await page.waitForSelector( '.wp-block' ); const fieldValue = 'this is some example text'; From 46a14a92c2e3a6f3de81b1a041b5730675394850 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 00:23:28 -0500 Subject: [PATCH 43/57] Add a line about doing composer install after gulp --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 926c5b68a..7ef8691b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,6 +47,7 @@ Use whatever DB name you'd like, and substitute a DB user and password that work 1. There will be a `package/trunk/` directory from running `gulp` earlier. Use this to commit the new plugin version to the wp.org SVN repo. 1. Do `./bin/tag-built.sh` 1. This will create a built tag of the plugin and push it. Then, other plugins or entire sites can require the plugin as a Composer dependency. +1. To resume normal local development, do `composer install`, as running `gulp` will remove the Composer dev dependencies. Thanks! :heart: :heart: :heart: From 072a357ad8c3d05b0201c6c7e56585a847f8b44d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 01:27:27 -0500 Subject: [PATCH 44/57] Add placeholder URLs to get Genesis Pro Maybe these should be changed, but for now there are URLs. --- css/admin.upgrade.css | 56 +++++++++++++++++++++++++++++++++++++++---- php/Views/Upgrade.php | 8 ++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/css/admin.upgrade.css b/css/admin.upgrade.css index c1209ba68..4fe943dde 100644 --- a/css/admin.upgrade.css +++ b/css/admin.upgrade.css @@ -8,7 +8,7 @@ --color-dark-gray: #263238; --color-gray: #546e7a; --color-light-gray: #eceff1; - + --color-gray-100: #f7fafc; --color-gray-200: #edf2f7; --color-gray-300: #e2e8f0; @@ -22,6 +22,7 @@ --box-shadow-small: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); } + .genesis-custom-blocks-pro { padding: 20px 20px 0 0; margin: 0 auto; @@ -30,10 +31,12 @@ font-size: 16px; line-height: 1.5; } + .genesis-custom-blocks-pro .container p { margin-bottom: 1em; font-size: 1em; } + .genesis-custom-blocks-pro .container h1, .genesis-custom-blocks-pro .container h2, .genesis-custom-blocks-pro .container h3, @@ -43,17 +46,21 @@ font-weight: 500; margin-bottom: 1em; } + .genesis-custom-blocks-pro .container h1 { font-size: 1.875rem; } + .genesis-custom-blocks-pro .container h2 { color: var(--color-brand); font-size: 1.5em; } + .genesis-custom-blocks-pro .container a { color: var(--color-brand); text-decoration: underline; } + .genesis-custom-blocks-pro .container { max-width: 960px; margin-left: auto; @@ -63,6 +70,7 @@ background-color: var(--color-white); border-radius: 3px; } + .genesis-custom-blocks-pro .btn { appearance: none; border: none; @@ -84,19 +92,23 @@ text-decoration: none; transition-duration: .2sec; } + .genesis-custom-blocks-pro .btn:hover { cursor: pointer; background-color: var(--color-white); color: var(--color-brand); } + .genesis-custom-blocks-pro .btn-secondary { color: var(--color-brand); border-color: var(--color-brand); } + .genesis-custom-blocks-pro .btn-secondary:hover { color: var(--color-white); background-color: var(--color-brand); } + .genesis-custom-blocks-pro .gcb-hero { display: flex; flex-wrap: wrap; @@ -108,18 +120,27 @@ background-size: cover; background-image: url('https://wpengine.com/wp-content/uploads/2020/07/gcb_gen_pro_hero_bg_img.png'); } + .genesis-custom-blocks-pro .gcb-hero__actions { display: flex; align-items: center; } + +.genesis-custom-blocks-pro .gcb-hero__actions a.btn { + color: var(--color-white); + text-decoration: none; +} + .genesis-custom-blocks-pro .license-key-form { display: flex; align-items: center; margin-bottom: 0; } + .genesis-custom-blocks-pro .gcb-hero > div > .btn { margin-right: 0.5rem; } + .genesis-custom-blocks-pro .license-key-form input { margin-left: 0.5rem; border: none; @@ -135,28 +156,34 @@ line-height: 1; width: 250px; } + .genesis-custom-blocks-pro .license-key-form .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; box-shadow: none; } + .genesis-custom-blocks-pro .gcb-hero img { width: 300px; } + .genesis-custom-blocks-pro .gcb-hero h3 { display: block; color: #fff; font-size: 1.17em; } + .genesis-custom-blocks-pro .gcb-content-body { padding: 2.5rem; } + .genesis-custom-blocks-pro .pro-fields { display: flex; flex-wrap: wrap; margin-left: -10px; margin-right: -10px; } + .genesis-custom-blocks-pro .pro-field { width: 150px; flex-shrink: 0; @@ -174,13 +201,16 @@ color: var(--color-gray); font-size: 0.875rem; } + .genesis-custom-blocks-pro .pro-field--more { background-color: var(--color-light-gray); font-weight: 400; } + .genesis-custom-blocks-pro .pro-field span { line-height: 1; } + .genesis-custom-blocks-pro .pro-field--icon { display: flex; align-items: center; @@ -191,16 +221,19 @@ background-color: var(--color-gray); margin-right: 8px; } + .genesis-custom-blocks-pro .pro-field--icon svg { width: 14px; height: 14px; color: var(--color-white); fill: currentColor; } + .genesis-custom-blocks-pro .gen-feature-table { display: flex; flex-wrap: wrap; } + .genesis-custom-blocks-pro .gen-feature-table--col { width: 0; flex-grow: 1; @@ -218,6 +251,7 @@ margin-bottom: 40px; margin-right: -10px; } + .genesis-custom-blocks-pro .gen-feature-table--col:last-of-type { /* background-color: var(--color-brand); */ background-image: url('https://wpengine.com/wp-content/uploads/2020/07/gcb_gen_pro_plan_bg.png'); @@ -228,24 +262,29 @@ margin-right: 0; box-shadow: var(--box-shadow); } + .genesis-custom-blocks-pro .gen-feature-table--col h3 { color: var(--color-brand); font-size: 1.6rem; font-weight: 600; } + .genesis-custom-blocks-pro .gen-feature-table--col:last-of-type h3 { color: var(--color-white); } + .genesis-custom-blocks-pro .gen-feature-table--col ul { list-style-type: none; padding-left: 0; } + .genesis-custom-blocks-pro .gen-feature-table--col li { position: relative; font-size: 0.875rem; font-weight: 500; margin-bottom: 34px; } + .genesis-custom-blocks-pro .gen-feature-table--col li:after { content: ''; height: 6px; @@ -258,27 +297,34 @@ bottom: -22px; margin-left: -5px; } + .genesis-custom-blocks-pro .gen-feature-table--col:last-of-type li:after { background-color: var(--color-white); } + .genesis-custom-blocks-pro .gen-feature-table--col li:last-of-type:after { display: none; } + @media (max-width:680px) { .genesis-custom-blocks-pro .gcb-hero__actions { flex-direction: column; align-items: flex-start; } -​ .genesis-custom-blocks-pro .gcb-hero__actions>.btn { + + .genesis-custom-blocks-pro .gcb-hero__actions > .btn { margin-bottom: 0.5rem; - }​ + } + .genesis-custom-blocks-pro .gcb-hero__actions .license-key-form { margin-top: 0.5rem; } -​ .genesis-custom-blocks-pro .gcb-hero__actions input { + + .genesis-custom-blocks-pro .gcb-hero__actions input { margin-left: 0; width: auto; - } + } + .genesis-custom-blocks-pro .gen-feature-table--col { width: auto;; } diff --git a/php/Views/Upgrade.php b/php/Views/Upgrade.php index 42956f036..10ffc3f87 100644 --- a/php/Views/Upgrade.php +++ b/php/Views/Upgrade.php @@ -7,13 +7,15 @@ * @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0) */ +$genesis_pro_url = 'https://my.wpengine.com/signup?plan=genesis-pro'; + ?>
          <?php esc_html_e( 'Genesis Custom Blocks', 'genesis-custom-blocks' ); ?>

          - +
          @@ -118,7 +120,7 @@
      - +

      @@ -130,7 +132,7 @@
- + From 054ada5f193a202eefb9db1daafe72ce6784ca58 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 03:28:03 -0500 Subject: [PATCH 45/57] Pass controls to filter, so extending plugin can use it --- js/blocks/components/fields.js | 3 +-- js/blocks/components/gcb-inspector.js | 3 +-- js/blocks/components/test/fields.js | 8 ++++++- js/blocks/helpers/addControls.js | 21 ++++++++++++++++++ js/blocks/helpers/index.js | 1 + js/blocks/helpers/test/addControls.js | 32 +++++++++++++++++++++++++++ js/blocks/index.js | 4 +++- 7 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 js/blocks/helpers/addControls.js create mode 100644 js/blocks/helpers/test/addControls.js diff --git a/js/blocks/components/fields.js b/js/blocks/components/fields.js index 7f1c2a8eb..51744f9d4 100644 --- a/js/blocks/components/fields.js +++ b/js/blocks/components/fields.js @@ -8,7 +8,6 @@ import { select } from '@wordpress/data'; * Internal dependencies */ import { getSimplifiedFields } from '../helpers'; -import controls from '../controls'; /** * Gets the control function for the field. @@ -17,7 +16,7 @@ import controls from '../controls'; * @return {Function} The control function. */ const getControl = ( field ) => { - const loadedControls = applyFilters( 'genesisCustomBlocks.controls', controls ); + const loadedControls = applyFilters( 'genesisCustomBlocks.controls', {} ); return loadedControls[ field.control ]; }; diff --git a/js/blocks/components/gcb-inspector.js b/js/blocks/components/gcb-inspector.js index a7a09f803..c3c3bc059 100644 --- a/js/blocks/components/gcb-inspector.js +++ b/js/blocks/components/gcb-inspector.js @@ -9,7 +9,6 @@ import { applyFilters } from '@wordpress/hooks'; * Internal dependencies */ import { getSimplifiedFields } from '../helpers'; -import controls from '../controls'; /** * Gets the rendered controls for the Inspector Controls, based on the field values. @@ -26,7 +25,7 @@ const GcbInspector = ( { blockProps, block } ) => { return null; } - const loadedControls = applyFilters( 'genesisCustomBlocks.controls', controls ); + const loadedControls = applyFilters( 'genesisCustomBlocks.controls', {} ); const Control = loadedControls[ field.control ]; if ( ! Control ) { return null; diff --git a/js/blocks/components/test/fields.js b/js/blocks/components/test/fields.js index dd75e8a03..f05d2f022 100644 --- a/js/blocks/components/test/fields.js +++ b/js/blocks/components/test/fields.js @@ -5,13 +5,18 @@ import '@testing-library/jest-dom/extend-expect'; import React from 'react'; import { render, screen } from '@testing-library/react'; +/** + * WordPress dependencies + */ +import { addFilter } from '@wordpress/hooks'; + /** * Internal dependencies */ import Fields from '../fields'; +import { addControls } from '../../helpers'; const helpText = 'This is help text'; - describe( 'Fields', () => { it( 'does not display a control that is supposed to be in the Inspector Controls', () => { render( @@ -30,6 +35,7 @@ describe( 'Fields', () => { } ); it( 'displays a control that is supposed to be in the editor', () => { + addFilter( 'genesisCustomBlocks.controls', 'genesisCustomBlocks/addControls', addControls ); render( { + return { + ...initialControls, + ...controls, + }; +}; + +export default addControls; diff --git a/js/blocks/helpers/index.js b/js/blocks/helpers/index.js index 3c5bd87a5..75a9fdb7d 100644 --- a/js/blocks/helpers/index.js +++ b/js/blocks/helpers/index.js @@ -1,3 +1,4 @@ +export { default as addControls } from './addControls'; export { default as getGcbBlockAttributes } from './getGcbBlockAttributes'; export { default as getSimplifiedFields } from './getSimplifiedFields'; export { default as registerBlocks } from './registerBlocks'; diff --git a/js/blocks/helpers/test/addControls.js b/js/blocks/helpers/test/addControls.js new file mode 100644 index 000000000..af667e9f4 --- /dev/null +++ b/js/blocks/helpers/test/addControls.js @@ -0,0 +1,32 @@ +/** + * Internal dependencies + */ +import { addControls } from '../'; + +test( 'addControls', () => { + const mockControl = jest.fn(); + const initialControls = { + apple: mockControl, + banana: mockControl, + }; + + expect( addControls( initialControls ) ).toEqual( + { + apple: mockControl, + banana: mockControl, + checkbox: expect.anything(), + color: expect.anything(), + email: expect.anything(), + image: expect.anything(), + multiselect: expect.anything(), + number: expect.anything(), + radio: expect.anything(), + range: expect.anything(), + select: expect.anything(), + text: expect.anything(), + textarea: expect.anything(), + toggle: expect.anything(), + url: expect.anything(), + } + ); +} ); diff --git a/js/blocks/index.js b/js/blocks/index.js index 3551d42fd..611f10f6c 100644 --- a/js/blocks/index.js +++ b/js/blocks/index.js @@ -4,12 +4,14 @@ * WordPress dependencies */ import { setLocaleData } from '@wordpress/i18n'; +import { addFilter } from '@wordpress/hooks'; /** * Internal dependencies */ -import { registerBlocks } from './helpers'; +import { addControls, registerBlocks } from './helpers'; import { Edit } from './components'; setLocaleData( { '': {} }, 'genesis-custom-blocks' ); +addFilter( 'genesisCustomBlocks.controls', 'genesisCustomBlocks/addControls', addControls ); registerBlocks( genesisCustomBlocks, gcbBlocks, Edit ); From 105f1940d70f345c90038ad5ecd3c76f465ad5a2 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 04:24:31 -0500 Subject: [PATCH 46/57] Fix failed Jest unit test --- js/blocks/helpers/test/registerBlocks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/blocks/helpers/test/registerBlocks.js b/js/blocks/helpers/test/registerBlocks.js index ec22b1c18..9084f0187 100644 --- a/js/blocks/helpers/test/registerBlocks.js +++ b/js/blocks/helpers/test/registerBlocks.js @@ -6,6 +6,7 @@ import { registerBlocks } from '../'; const mockRegisterBlockType = jest.fn(); jest.mock( '@wordpress/blocks', () => { return { + ...jest.requireActual( '@wordpress/blocks' ), registerBlockType: ( ...args ) => mockRegisterBlockType( ...args ), }; } ); From a52a0139aa07d48e34c3641ff2556979e01f0ec2 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 04:34:23 -0500 Subject: [PATCH 47/57] Remove quotes around ls-files This has caused an error, so remove them. --- bin/tag-built.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index 5061fb52c..7e047f4f9 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -21,7 +21,7 @@ mkdir built git clone . built/ cd built git checkout "$tag" -git rm -r "$(git ls-files)" +git rm -r $(git ls-files) rsync -avz ../package/trunk/ ./ git add -A . git commit -m "Build $tag" --no-verify From 491a80e59fa2f61c75b9cc39f3b246109a4e55fa Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 04:42:19 -0500 Subject: [PATCH 48/57] Move the gulp command lower --- bin/tag-built.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index 7e047f4f9..cfb2ae7ed 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -3,7 +3,6 @@ set -e -gulp tag=$(grep 'Version:' package/trunk/genesis-custom-blocks.php | sed 's/.*: //' | sed 's/-[0-9]\{8\}T[0-9]\{6\}Z-[a-f0-9]*$//') if [[ -z "$tag" ]]; then echo "Error: Unable to determine tag." @@ -17,6 +16,7 @@ if git rev-parse "$built_tag" >/dev/null 2>&1; then fi git checkout "$tag" +gulp mkdir built git clone . built/ cd built From 26aff5df576cd1dc8794e7e949c6e00ad6f47b13 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sun, 23 Aug 2020 04:53:22 -0500 Subject: [PATCH 49/57] Revert "Move the gulp command lower" This reverts commit 491a80e59fa2f61c75b9cc39f3b246109a4e55fa. --- bin/tag-built.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tag-built.sh b/bin/tag-built.sh index cfb2ae7ed..7e047f4f9 100755 --- a/bin/tag-built.sh +++ b/bin/tag-built.sh @@ -3,6 +3,7 @@ set -e +gulp tag=$(grep 'Version:' package/trunk/genesis-custom-blocks.php | sed 's/.*: //' | sed 's/-[0-9]\{8\}T[0-9]\{6\}Z-[a-f0-9]*$//') if [[ -z "$tag" ]]; then echo "Error: Unable to determine tag." @@ -16,7 +17,6 @@ if git rev-parse "$built_tag" >/dev/null 2>&1; then fi git checkout "$tag" -gulp mkdir built git clone . built/ cd built From ebb57eeef80072996a12470af59e4b75baa103a1 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:13:05 -0500 Subject: [PATCH 50/57] Commit Luke's GitHub suggestion for css/admin.upgrade.css Co-authored-by: Luke Carbis --- css/admin.upgrade.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/admin.upgrade.css b/css/admin.upgrade.css index 4fe943dde..9f2f20359 100644 --- a/css/admin.upgrade.css +++ b/css/admin.upgrade.css @@ -71,7 +71,7 @@ border-radius: 3px; } -.genesis-custom-blocks-pro .btn { +.genesis-custom-blocks-pro .container .btn { appearance: none; border: none; display: flex; From 5483f5e9022392bb5948608c9e66e966162128a9 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:13:45 -0500 Subject: [PATCH 51/57] Commit Luke's GitHub suggestion for css/admin.upgrade.css Co-authored-by: Luke Carbis --- css/admin.upgrade.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/admin.upgrade.css b/css/admin.upgrade.css index 9f2f20359..64e179258 100644 --- a/css/admin.upgrade.css +++ b/css/admin.upgrade.css @@ -99,7 +99,7 @@ color: var(--color-brand); } -.genesis-custom-blocks-pro .btn-secondary { +.genesis-custom-blocks-pro .container .btn-secondary { color: var(--color-brand); border-color: var(--color-brand); } From 858b6795b6ddb6036942fcd0da77433613ef7d82 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:13:56 -0500 Subject: [PATCH 52/57] Commit Luke's GitHub suggestion for css/admin.upgrade.css Co-authored-by: Luke Carbis --- css/admin.upgrade.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/admin.upgrade.css b/css/admin.upgrade.css index 64e179258..a6a66b6dd 100644 --- a/css/admin.upgrade.css +++ b/css/admin.upgrade.css @@ -104,7 +104,7 @@ border-color: var(--color-brand); } -.genesis-custom-blocks-pro .btn-secondary:hover { +.genesis-custom-blocks-pro .container .btn-secondary:hover { color: var(--color-white); background-color: var(--color-brand); } From fd08954189847f2a9dd8ead6d166431c8567bfdc Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:15:00 -0500 Subject: [PATCH 53/57] Commit Luke's GitHub suggestion for css/admin.upgrade.css Co-authored-by: Luke Carbis --- css/admin.upgrade.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/admin.upgrade.css b/css/admin.upgrade.css index a6a66b6dd..69534cb98 100644 --- a/css/admin.upgrade.css +++ b/css/admin.upgrade.css @@ -93,7 +93,7 @@ transition-duration: .2sec; } -.genesis-custom-blocks-pro .btn:hover { +.genesis-custom-blocks-pro .container .btn:hover { cursor: pointer; background-color: var(--color-white); color: var(--color-brand); From ab549624a5bb64c804a8256fb7808f8490dbe605 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:18:36 -0500 Subject: [PATCH 54/57] Change npm install to npm ci, thanks to John Thanks to John for the suggestion. As he mentioned, this ensures that the packages match the lock file versions. --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78968ff48..2ae697097 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,7 +16,7 @@ commands: set-up-packages: description: "Installing packages and building" steps: - - run: composer remove --dev phpunit/phpunit && composer install && npm install && npm run build + - run: composer remove --dev phpunit/phpunit && composer install && npm ci && npm run build install-composer: description: "Installing Composer" @@ -75,7 +75,7 @@ jobs: name: Running PHPUnit working_directory: *PLUGIN_PATH command: | - composer remove --dev phpunit/phpunit && composer install && npm install && npm run build + composer remove --dev phpunit/phpunit && composer install && npm ci && npm run build composer require --dev phpunit/phpunit 5.7.9 WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit From ac6f3218ae5550d9cd27500d83417a6b79cc23d8 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:24:40 -0500 Subject: [PATCH 55/57] Create the built file in package/, not the plugin root And update CONTRIBUTING.md for this change. --- CONTRIBUTING.md | 2 +- gulpfile.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7ef8691b6..9d3224958 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ Use whatever DB name you'd like, and substitute a DB user and password that work ### Release Procedure 1. `checkout` locally whatever branch you want to release. It could be `develop`, or a release branch like `1.0`. -1. Do `gulp`, and you'll see a `genesis-custom-blocks.zip` file in this plugin directory. +1. Do `gulp`, and you'll see a `genesis-custom-blocks.zip` file in the `package/` directory. 1. Smoke test that `.zip` file. 1. [Create a release](https://github.com/studiopress/genesis-custom-blocks/releases/new), targeting whatever branch you chose in step 1. 1. Upload the `.zip` file you created to the release page. diff --git a/gulpfile.js b/gulpfile.js index 16f2c125c..0c4bc2e85 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,7 +34,6 @@ gulp.task( 'bundle', function () { '!bin/**/*', '!node_modules/**/*', '!composer.*', - '!genesis-custom-blocks.zip', '!js/blocks/**/*', '!js/src/**/*', '!js/tests/**/*', @@ -108,7 +107,7 @@ gulp.task( 'clean:bundle', function () { } ); gulp.task( 'create:zip', function () { - return run( 'if [ -e genesis-custom-blocks.zip ]; then rm genesis-custom-blocks.zip; fi; cd package/trunk; pwd; zip -r ../../genesis-custom-blocks.zip .; cd ..; cd ..; echo "ZIP of build: $(pwd)/genesis-custom-blocks.zip"' ).exec(); + return run( 'if [ -e genesis-custom-blocks.zip ]; then rm genesis-custom-blocks.zip; fi; cd package/trunk; pwd; zip -r ../genesis-custom-blocks.zip .; cd ..; echo "ZIP of build: $(pwd)/genesis-custom-blocks.zip"' ).exec(); } ) gulp.task( 'default', gulp.series( From e73800867373c8d433f9af4c6e888e8ca672ae2f Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:41:24 -0500 Subject: [PATCH 56/57] Add built/ to .gitinore, ensure it's not in the plugin .zip --- .gitignore | 1 + gulpfile.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 51a1d5109..80cfd75c5 100644 --- a/.gitignore +++ b/.gitignore @@ -116,4 +116,5 @@ js/editor.blocks.js js/scripts.js css/blocks.editor.css package/ +built/ *.asset.php diff --git a/gulpfile.js b/gulpfile.js index 0c4bc2e85..24cf190fc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -88,6 +88,7 @@ gulp.task( 'clean:bundle', function () { 'package/trunk/css/*.map', 'package/trunk/css/src', 'package/trunk/bin', + 'package/trunk/built', 'package/trunk/node_modules', 'package/trunk/tests', 'package/trunk/trunk', From e5b22c2b9a6f033b9e2b5695d5cac4266ff6c7cc Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 24 Aug 2020 14:56:17 -0500 Subject: [PATCH 57/57] Change the 'Learn more' links to the URL that Luke mentioned --- php/Views/Upgrade.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/php/Views/Upgrade.php b/php/Views/Upgrade.php index 10ffc3f87..13feb19ba 100644 --- a/php/Views/Upgrade.php +++ b/php/Views/Upgrade.php @@ -7,7 +7,8 @@ * @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0) */ -$genesis_pro_url = 'https://my.wpengine.com/signup?plan=genesis-pro'; +$get_genesis_pro_url = 'https://my.wpengine.com/signup?plan=genesis-pro'; +$genesis_pro_info_url = 'https://www.studiopress.com/genesis-pro/'; ?>
@@ -15,7 +16,7 @@ <?php esc_html_e( 'Genesis Custom Blocks', 'genesis-custom-blocks' ); ?>

- +
@@ -120,7 +121,7 @@
  • - +

    @@ -132,7 +133,7 @@
  • - +