Skip to content

Commit f803e7e

Browse files
release(minor): version 1.1.0
### New Features - **New Onboarding for Raft Theme**: Experience a new Onboarding process for the Raft theme, integrating the use of Otter Blocks plugin. - **New Block Patterns**: Added new block patterns to enrich the customization options. - **Fullwidth Template with Header and Footer**: Introduced a new fullwidth template that includes both Header and Footer. ### Bug Fixes - **Fix Notice Error**: Fixed an issue with the Notice causing an error when visiting the Editor.
2 parents 5aa570e + e08fb35 commit f803e7e

32 files changed

+839
-26
lines changed

Diff for: .github/workflows/test-php.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Setup PHP version
4848
uses: shivammathur/setup-php@v2
4949
with:
50-
php-version: '7.1'
50+
php-version: '7.2'
5151
extensions: simplexml, mysql
5252
tools: phpunit-polyfills
5353
- name: Checkout source code
@@ -69,4 +69,4 @@ jobs:
6969
- name: Install composer
7070
run: composer install --prefer-dist --no-progress --no-suggest
7171
- name: Run phpunit
72-
run: phpunit
72+
run: composer run-script phpunit

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ assets/js/build
1313
languages/neve-fse.pot
1414

1515
.DS_Store
16+
.phpunit.result.cache

Diff for: assets/img/neve-fse-img13.webp

695 KB
Binary file not shown.

Diff for: assets/img/neve-fse-img14.webp

742 KB
Binary file not shown.

Diff for: assets/js/src/design-pack-notice.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { createRoot } from '@wordpress/element';
22

33
import DesignPackNotice from './components/DesignPackNotice';
44

5-
const container = document.getElementById( 'neve-fse-design-pack-notice' );
5+
const container = document.createElement( 'div' );
6+
container.id = 'neve-fse-design-pack-notice';
7+
document.body.appendChild( container );
68

79
if ( container ) {
810
createRoot( container ).render( <DesignPackNotice /> );

Diff for: assets/js/src/welcome-notice.js

+14
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ function handleWelcomeNotice( $ ) {
88
installing,
99
done,
1010
activationUrl,
11+
onboardingUrl,
1112
ajaxUrl,
1213
nonce,
14+
otterRefNonce,
1315
otterStatus,
1416
} = neveFSEData;
1517

@@ -30,16 +32,28 @@ function handleWelcomeNotice( $ ) {
3032
const activateOtter = async () => {
3133
installText.text( activating );
3234
await activatePlugin( activationUrl );
35+
36+
await $.post( ajaxUrl, {
37+
nonce: otterRefNonce,
38+
action: 'neve_fse_set_otter_ref',
39+
} );
40+
3341
installSpinner.removeClass( 'dashicons-update' );
3442
installSpinner.addClass( 'dashicons-yes' );
3543
installText.text( done );
3644
setTimeout( hideAndRemoveNotice, 1500 );
45+
window.location.href = onboardingUrl;
3746
};
3847

3948
$( installBtn ).on( 'click', async () => {
4049
installSpinner.removeClass( 'hidden' );
4150
installBtn.attr( 'disabled', true );
4251

52+
if ( otterStatus === 'active' ) {
53+
window.location.href = onboardingUrl;
54+
return;
55+
}
56+
4357
if ( otterStatus === 'installed' ) {
4458
await activateOtter();
4559
return;

Diff for: composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"format": "phpcbf --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ",
5252
"phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-",
5353
"lint": "composer run-script phpcs",
54-
"phpcs-i": "phpcs -i"
54+
"phpcs-i": "phpcs -i",
55+
"phpunit": "phpunit"
5556
}
5657
}

Diff for: composer.lock

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: inc/Admin.php

+84-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ class Admin {
2222
*/
2323
private $suspend_survey = true;
2424

25+
/**
26+
* Otter reference key.
27+
*
28+
* @var string
29+
*/
30+
const OTTER_REF = 'otter_reference_key';
31+
2532
/**
2633
* Admin constructor.
2734
*/
@@ -59,6 +66,8 @@ public function setup_admin_hooks() {
5966

6067
add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) );
6168
add_action( 'wp_ajax_neve_fse_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) );
69+
add_action( 'activated_plugin', 'after_otter_activation' );
70+
add_action( 'wp_ajax_neve_fse_set_otter_ref', array( $this, 'set_otter_ref' ) );
6271
}
6372

6473
/**
@@ -78,11 +87,12 @@ public function add_fse_design_pack_notice() {
7887
true,
7988
array(),
8089
array(
81-
'nonce' => wp_create_nonce( 'neve-fse-dismiss-design-pack-notice' ),
82-
'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ),
83-
'ajaxAction' => 'neve_fse_dismiss_design_pack_notice',
84-
'buttonLink' => tsdk_utmify( 'https://themeisle.com/plugins/fse-design-pack', 'editor', 'neve-fse' ),
85-
'strings' => array(
90+
'nonce' => wp_create_nonce( 'neve-fse-dismiss-design-pack-notice' ),
91+
'otterRefNonce' => wp_create_nonce( 'neve-fse-set-otter-ref' ),
92+
'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ),
93+
'ajaxAction' => 'neve_fse_dismiss_design_pack_notice',
94+
'buttonLink' => tsdk_utmify( 'https://themeisle.com/plugins/fse-design-pack', 'editor', 'neve-fse' ),
95+
'strings' => array(
8696
'dismiss' => __( 'Dismiss', 'neve-fse' ),
8797
'recommends' => __( 'Neve FSE recommends', 'neve-fse' ),
8898
'learnMore' => __( 'Learn More', 'neve-fse' ),
@@ -95,8 +105,6 @@ public function add_fse_design_pack_notice() {
95105
),
96106
'designPackNoticeData'
97107
);
98-
99-
echo '<div id="neve-fse-design-pack-notice"></div>';
100108
}
101109

102110
/**
@@ -270,6 +278,14 @@ public function render_welcome_notice() {
270278
admin_url( 'plugins.php' )
271279
)
272280
),
281+
'onboardingUrl' => esc_url(
282+
add_query_arg(
283+
array(
284+
'onboarding' => 'true',
285+
),
286+
admin_url( 'site-editor.php' )
287+
)
288+
),
273289
'activating' => __( 'Activating', 'neve-fse' ) . '&hellip;',
274290
'installing' => __( 'Installing', 'neve-fse' ) . '&hellip;',
275291
'done' => __( 'Done', 'neve-fse' ),
@@ -421,13 +437,74 @@ private function should_show_welcome_notice(): bool {
421437
private function get_otter_status(): string {
422438
$status = 'not-installed';
423439

440+
if ( is_plugin_active( 'otter-blocks/otter-blocks.php' ) ) {
441+
return 'active';
442+
}
443+
424444
if ( file_exists( ABSPATH . 'wp-content/plugins/otter-blocks/otter-blocks.php' ) ) {
425445
return 'installed';
426446
}
427447

428448
return $status;
429449
}
430450

451+
/**
452+
* Run after Otter Blocks activation.
453+
*
454+
* @param string $plugin Plugin name.
455+
*
456+
* @return void
457+
*/
458+
public function after_otter_activation( $plugin ) {
459+
if ( 'otter-blocks/otter-blocks.php' !== $plugin ) {
460+
return;
461+
}
462+
463+
if ( ! class_exists( '\ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding' ) ) {
464+
return;
465+
}
466+
467+
$status = get_option( \ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding::OPTION_KEY, array() );
468+
$slug = get_stylesheet();
469+
470+
if ( ! empty( $status[ $slug ] ) ) {
471+
return;
472+
}
473+
474+
// Dismiss after two days from activation.
475+
$activated_time = get_option( 'neve_fse_install' );
476+
477+
if ( ! empty( $activated_time ) && time() - intval( $activated_time ) > ( 2 * DAY_IN_SECONDS ) ) {
478+
update_option( Constants::CACHE_KEYS['dismissed-welcome-notice'], 'yes' );
479+
return;
480+
}
481+
482+
$onboarding = add_query_arg(
483+
array(
484+
'onboarding' => 'true',
485+
),
486+
admin_url( 'site-editor.php' )
487+
);
488+
489+
wp_safe_redirect( $onboarding );
490+
exit;
491+
}
492+
493+
/**
494+
* Update Otter reference key.
495+
*
496+
* @return void
497+
*/
498+
public function set_otter_ref() {
499+
if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'neve-fse-set-otter-ref' ) ) {
500+
return;
501+
}
502+
503+
update_option( self::OTTER_REF, 'neve-fse' );
504+
505+
wp_send_json_success();
506+
}
507+
431508
/**
432509
* Add NPS form.
433510
*

Diff for: inc/Block_Patterns.php

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ private function setup_properties() {
9696
'layout/columns-image-and-text',
9797
'layout/portfolio-columns',
9898
'layout/columns-image-and-text-inv',
99+
'layout/hero-with-feature-columns',
100+
'layout/columns-testimonials-inv',
101+
'layout/columns-with-services-text',
102+
'layout/contact-section',
103+
'layout/hero-with-text',
104+
'layout/map-section',
105+
'layout/faq-section',
99106

100107
// Post patterns.
101108
'loops/post-loop-1',

Diff for: inc/Core.php

+60
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,66 @@ public function setup() {
8585
)
8686
);
8787

88+
add_theme_support(
89+
'otter-onboarding',
90+
array(
91+
'logo' => NEVE_FSE_URL . 'assets/img/neve-fse-logo.svg',
92+
'templates' => array(
93+
'archive' => array(
94+
'archive-list' => array(
95+
'file' => NEVE_FSE_DIR . 'library/archive/archive-list.php',
96+
'title' => __( 'Archive List', 'neve-fse' ),
97+
),
98+
'archive-cover' => array(
99+
'file' => NEVE_FSE_DIR . 'library/archive/archive-cover.php',
100+
'title' => __( 'Archive Cover', 'neve-fse' ),
101+
),
102+
),
103+
'single' => array(
104+
'single-post-cover-boxed' => array(
105+
'file' => NEVE_FSE_DIR . 'library/single/single-post-cover-boxed.php',
106+
'title' => __( 'Single Post Cover Boxed', 'neve-fse' ),
107+
),
108+
'single-post-cover' => array(
109+
'file' => NEVE_FSE_DIR . 'library/single/single-post-cover.php',
110+
'title' => __( 'Single Post Cover', 'neve-fse' ),
111+
),
112+
),
113+
'front-page' => array(
114+
'front-page-alt' => array(
115+
'file' => NEVE_FSE_DIR . 'library/front-page/front-page-2.php',
116+
'title' => __( 'Homepage 2', 'neve-fse' ),
117+
),
118+
'front-page-alt-2' => array(
119+
'file' => NEVE_FSE_DIR . 'library/front-page/front-page-3.php',
120+
'title' => __( 'Homepage 4', 'neve-fse' ),
121+
),
122+
),
123+
),
124+
'page_templates' => array(
125+
'about-page' => array(
126+
'file' => NEVE_FSE_DIR . 'library/templates/about-page.php',
127+
'title' => __( 'About Page', 'neve-fse' ),
128+
'template' => 'template-plain',
129+
),
130+
'contact-page' => array(
131+
'file' => NEVE_FSE_DIR . 'library/templates/contact-page.php',
132+
'title' => __( 'Contact Page', 'neve-fse' ),
133+
'template' => 'template-plain',
134+
),
135+
'portfolio-page' => array(
136+
'file' => NEVE_FSE_DIR . 'library/templates/portfolio-page.php',
137+
'title' => __( 'Portfolio Page', 'neve-fse' ),
138+
'template' => 'template-plain',
139+
),
140+
'services-page' => array(
141+
'file' => NEVE_FSE_DIR . 'library/templates/services-page.php',
142+
'title' => __( 'Services Page', 'neve-fse' ),
143+
'template' => 'template-plain',
144+
),
145+
),
146+
)
147+
);
88148

89149
register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'neve-fse' ) ) );
90150
}

0 commit comments

Comments
 (0)