Skip to content

Commit

Permalink
release(minor): version 1.1.0
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
HardeepAsrani authored Aug 28, 2024
2 parents 5aa570e + e08fb35 commit f803e7e
Show file tree
Hide file tree
Showing 32 changed files with 839 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
php-version: '7.2'
extensions: simplexml, mysql
tools: phpunit-polyfills
- name: Checkout source code
Expand All @@ -69,4 +69,4 @@ jobs:
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run phpunit
run: phpunit
run: composer run-script phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ assets/js/build
languages/neve-fse.pot

.DS_Store
.phpunit.result.cache
Binary file added assets/img/neve-fse-img13.webp
Binary file not shown.
Binary file added assets/img/neve-fse-img14.webp
Binary file not shown.
4 changes: 3 additions & 1 deletion assets/js/src/design-pack-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { createRoot } from '@wordpress/element';

import DesignPackNotice from './components/DesignPackNotice';

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

if ( container ) {
createRoot( container ).render( <DesignPackNotice /> );
Expand Down
14 changes: 14 additions & 0 deletions assets/js/src/welcome-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ function handleWelcomeNotice( $ ) {
installing,
done,
activationUrl,
onboardingUrl,
ajaxUrl,
nonce,
otterRefNonce,
otterStatus,
} = neveFSEData;

Expand All @@ -30,16 +32,28 @@ function handleWelcomeNotice( $ ) {
const activateOtter = async () => {
installText.text( activating );
await activatePlugin( activationUrl );

await $.post( ajaxUrl, {
nonce: otterRefNonce,
action: 'neve_fse_set_otter_ref',
} );

installSpinner.removeClass( 'dashicons-update' );
installSpinner.addClass( 'dashicons-yes' );
installText.text( done );
setTimeout( hideAndRemoveNotice, 1500 );
window.location.href = onboardingUrl;
};

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

if ( otterStatus === 'active' ) {
window.location.href = onboardingUrl;
return;
}

if ( otterStatus === 'installed' ) {
await activateOtter();
return;
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"format": "phpcbf --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ",
"phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-",
"lint": "composer run-script phpcs",
"phpcs-i": "phpcs -i"
"phpcs-i": "phpcs -i",
"phpunit": "phpunit"
}
}
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 84 additions & 7 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class Admin {
*/
private $suspend_survey = true;

/**
* Otter reference key.
*
* @var string
*/
const OTTER_REF = 'otter_reference_key';

/**
* Admin constructor.
*/
Expand Down Expand Up @@ -59,6 +66,8 @@ public function setup_admin_hooks() {

add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) );
add_action( 'wp_ajax_neve_fse_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) );
add_action( 'activated_plugin', 'after_otter_activation' );
add_action( 'wp_ajax_neve_fse_set_otter_ref', array( $this, 'set_otter_ref' ) );
}

/**
Expand All @@ -78,11 +87,12 @@ public function add_fse_design_pack_notice() {
true,
array(),
array(
'nonce' => wp_create_nonce( 'neve-fse-dismiss-design-pack-notice' ),
'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ),
'ajaxAction' => 'neve_fse_dismiss_design_pack_notice',
'buttonLink' => tsdk_utmify( 'https://themeisle.com/plugins/fse-design-pack', 'editor', 'neve-fse' ),
'strings' => array(
'nonce' => wp_create_nonce( 'neve-fse-dismiss-design-pack-notice' ),
'otterRefNonce' => wp_create_nonce( 'neve-fse-set-otter-ref' ),
'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ),
'ajaxAction' => 'neve_fse_dismiss_design_pack_notice',
'buttonLink' => tsdk_utmify( 'https://themeisle.com/plugins/fse-design-pack', 'editor', 'neve-fse' ),
'strings' => array(
'dismiss' => __( 'Dismiss', 'neve-fse' ),
'recommends' => __( 'Neve FSE recommends', 'neve-fse' ),
'learnMore' => __( 'Learn More', 'neve-fse' ),
Expand All @@ -95,8 +105,6 @@ public function add_fse_design_pack_notice() {
),
'designPackNoticeData'
);

echo '<div id="neve-fse-design-pack-notice"></div>';
}

/**
Expand Down Expand Up @@ -270,6 +278,14 @@ public function render_welcome_notice() {
admin_url( 'plugins.php' )
)
),
'onboardingUrl' => esc_url(
add_query_arg(
array(
'onboarding' => 'true',
),
admin_url( 'site-editor.php' )
)
),
'activating' => __( 'Activating', 'neve-fse' ) . '&hellip;',
'installing' => __( 'Installing', 'neve-fse' ) . '&hellip;',
'done' => __( 'Done', 'neve-fse' ),
Expand Down Expand Up @@ -421,13 +437,74 @@ private function should_show_welcome_notice(): bool {
private function get_otter_status(): string {
$status = 'not-installed';

if ( is_plugin_active( 'otter-blocks/otter-blocks.php' ) ) {
return 'active';
}

if ( file_exists( ABSPATH . 'wp-content/plugins/otter-blocks/otter-blocks.php' ) ) {
return 'installed';
}

return $status;
}

/**
* Run after Otter Blocks activation.
*
* @param string $plugin Plugin name.
*
* @return void
*/
public function after_otter_activation( $plugin ) {
if ( 'otter-blocks/otter-blocks.php' !== $plugin ) {
return;
}

if ( ! class_exists( '\ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding' ) ) {
return;
}

$status = get_option( \ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding::OPTION_KEY, array() );
$slug = get_stylesheet();

if ( ! empty( $status[ $slug ] ) ) {
return;
}

// Dismiss after two days from activation.
$activated_time = get_option( 'neve_fse_install' );

if ( ! empty( $activated_time ) && time() - intval( $activated_time ) > ( 2 * DAY_IN_SECONDS ) ) {
update_option( Constants::CACHE_KEYS['dismissed-welcome-notice'], 'yes' );
return;
}

$onboarding = add_query_arg(
array(
'onboarding' => 'true',
),
admin_url( 'site-editor.php' )
);

wp_safe_redirect( $onboarding );
exit;
}

/**
* Update Otter reference key.
*
* @return void
*/
public function set_otter_ref() {
if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['nonce'] ), 'neve-fse-set-otter-ref' ) ) {
return;
}

update_option( self::OTTER_REF, 'neve-fse' );

wp_send_json_success();
}

/**
* Add NPS form.
*
Expand Down
7 changes: 7 additions & 0 deletions inc/Block_Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ private function setup_properties() {
'layout/columns-image-and-text',
'layout/portfolio-columns',
'layout/columns-image-and-text-inv',
'layout/hero-with-feature-columns',
'layout/columns-testimonials-inv',
'layout/columns-with-services-text',
'layout/contact-section',
'layout/hero-with-text',
'layout/map-section',
'layout/faq-section',

// Post patterns.
'loops/post-loop-1',
Expand Down
60 changes: 60 additions & 0 deletions inc/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,66 @@ public function setup() {
)
);

add_theme_support(
'otter-onboarding',
array(
'logo' => NEVE_FSE_URL . 'assets/img/neve-fse-logo.svg',
'templates' => array(
'archive' => array(
'archive-list' => array(
'file' => NEVE_FSE_DIR . 'library/archive/archive-list.php',
'title' => __( 'Archive List', 'neve-fse' ),
),
'archive-cover' => array(
'file' => NEVE_FSE_DIR . 'library/archive/archive-cover.php',
'title' => __( 'Archive Cover', 'neve-fse' ),
),
),
'single' => array(
'single-post-cover-boxed' => array(
'file' => NEVE_FSE_DIR . 'library/single/single-post-cover-boxed.php',
'title' => __( 'Single Post Cover Boxed', 'neve-fse' ),
),
'single-post-cover' => array(
'file' => NEVE_FSE_DIR . 'library/single/single-post-cover.php',
'title' => __( 'Single Post Cover', 'neve-fse' ),
),
),
'front-page' => array(
'front-page-alt' => array(
'file' => NEVE_FSE_DIR . 'library/front-page/front-page-2.php',
'title' => __( 'Homepage 2', 'neve-fse' ),
),
'front-page-alt-2' => array(
'file' => NEVE_FSE_DIR . 'library/front-page/front-page-3.php',
'title' => __( 'Homepage 4', 'neve-fse' ),
),
),
),
'page_templates' => array(
'about-page' => array(
'file' => NEVE_FSE_DIR . 'library/templates/about-page.php',
'title' => __( 'About Page', 'neve-fse' ),
'template' => 'template-plain',
),
'contact-page' => array(
'file' => NEVE_FSE_DIR . 'library/templates/contact-page.php',
'title' => __( 'Contact Page', 'neve-fse' ),
'template' => 'template-plain',
),
'portfolio-page' => array(
'file' => NEVE_FSE_DIR . 'library/templates/portfolio-page.php',
'title' => __( 'Portfolio Page', 'neve-fse' ),
'template' => 'template-plain',
),
'services-page' => array(
'file' => NEVE_FSE_DIR . 'library/templates/services-page.php',
'title' => __( 'Services Page', 'neve-fse' ),
'template' => 'template-plain',
),
),
)
);

register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'neve-fse' ) ) );
}
Expand Down
Loading

0 comments on commit f803e7e

Please sign in to comment.